delete more than one image on moqups.com
moqups.com doesn´t offer thepossibility to select more than one image, at least to delete from Images collection so what about delete more than a hundred of little icons one by one?
well, the httpRequest to delete looks like this:
“https://moqups.com/a/image/del?imageId=999999&_=9999999999999”
and the answer to this request looks like:
{"hasRight":true,"success":true,"object":null,"message":""}
since you need the session from your browser you can run this javascript code on console (your browser probably has a developer tool for this)
for (var n = 196000; n<198000; n++){ FDBK.library.isUserLoggedIn() && FDBK.API.xhr(FDBK.API.CALL_DELETE_IMAGE, {
data: {
imageId: n
}});}
the n value can be found on html source ( “<li id=image-197277”, this last number).
I have seen so many times this overuse of classes in Python! I usually see code from engineers that come from other (evil) languages like Java, where everything is a class, and they expect to be done the same way in Python. But it is not.
When I started programming in the 80s, the coolest language you could learn was Smalltalk. It was based on the object-oriented paradigm, a very modern thing by then. “everything is an object”, was their slogan. A program was something that managed “objects”, objects were classified in “classes” and objects knew about their operations and how to interact with other objects. For example, an Integer object knew how to add to another Integer object (specified in something called “methods”), and when they wanted to communicate, they could send “messages” to each other.
So OOP was considered the good path to follow. Objects were the natural solution to many problems. It encapsulated data with the operations on that data, so your code looked cleaner. It moved control to objects, hiding implementation details, but it also provided flexibility thanks to inheritance. So we got better code, less bugs, and everyone was happy.
But then Java came into play, and people started creating classes for just everything!. I heard conversations like “I have some code I don’t known where to put it”. “Just put it in a new class!”, someone said. So no more plain functions, just classes (yes, I know, Java required that). may Controller Classes were born those days. But also the idea of complex data types disappeared: people just put their data as attributes in classes, so they didn’t need “structs with structs with enums”, or those weird types functional languages had. Just a simple class was everything a good programmer could need!
Now many Java programmers have moved to the Python world. And many of them have moved with their old programming manners, and I started seeing GoF patterns implemented as direct translations from Java, class by class…
good discussion.
In this list of seven libraries for Python, I specially love the sh library, (a hack) for accessing the underlying shell in a very useful manner…
Datavisualization.ch Selected Tools is a collection of tools that the people behind Datavisualization.ch work with on a daily basis and recommend warmly. This is not a list of everything out there, but instead a thoughtfully curated selection of their favourite tools that will make your life easier creating meaningful and beautiful data visualizations.
CertificateHostnameMismatch
check wich version you have installed:
#pip freeze | grep httplib
install the new:
#sudo pip install —upgrade httplib2
Using Urlpatterns (summarizing the official documentation)
Acording to the official documentation it’s fairly common to use the same view function in multiple URL patterns in URLconf - sometimes the aplication calls one page with some or none arguments and other times it calls with none or other arguments. With named URL patterns you distinguish different patterns or different uses of the same view without repeat your code. See the example:
urlpatterns = patterns(”,
url(r’^archive/(\d{4})/$’, archive, name=”full-archive”),
url(r’^archive-summary/(\d{4})/$’, archive, {‘summary’: True}, “arch-summary”),
)
With these names in place (full-archive and arch-summary), you can target each pattern individually by using its name on url template tag:
{% url ‘arch-summary’ 1945 %}
{% url ‘full-archive’ 2007 %}
Here it is the tips for better naming. As Django use a MTV approach the named Urlpattern is on Controller component, it settles on your urls.py file and url template tag is on Template component.
In other situations the aplication defines a get_absolute_url() method to tell Django how to calculate the canonical URL for an object in the Model component, for example:
@models.permalink
def get_absolute_url(self):
return (‘archive_view’, (), {
‘year’: self.created.year,
‘month’: self.created.strftime(‘%m’),
‘day’: self.created.strftime(‘%d’)})
for this URLconf:
(r’/archive/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$’, archive_view)
So the decorated function represents a Python-level equivalent to the url template tag and a high-level wrapper for the django.core.urlresolvers.reverse() function. In the end the method t returns a string for the correct URL, with all parameters substituted in the correct positions.
if the server request a file to itself
maybe, the application in a specific moment try to request a file through a url pointing to the own server.
so for test, if you try to
#wget http://[servername]/[folder]/[file]
within the server itself as
#wget http://xvzfbirasrv/static/images/picture.png
and the “status code” is 404. you need to configure your web server to responde correctly.
if you have a line similar to this on your /etc/hosts :
127.0.1.1 [servername].local.domain
then on the output of the wget command [servername] is translated to 127.0.1.1.
so you need to create ( in the case of using apache) a new virtual host
<VirtualHost 127.0.1.1:80>…
