Länk - How to find out what variables are defined in buildout
Note to self:
I found from the buildout docs that bin/buildout annotate was what I was looking for.
Läs mer: python - Listing buildout configuration variables - Stack Overflow
Note to self:
I found from the buildout docs that bin/buildout annotate was what I was looking for.
Läs mer: python - Listing buildout configuration variables - Stack Overflow
I had a hunch that a web development problem had to do with different web elements historically being saved alternately in utf-8 and iso-8859-1. I decided to try tell the web server that my browser only accepted iso-8859-1, to see if I could trigger the bug.
I used the modify headers add-on for Firefox, and in it I specified like so:
I then verified on the server side that the headers were indeed altered.
The bug I was trying to find? Turned out not to have to do with this.
Add, modify and filter the HTTP request headers sent to web servers. This addon is particularly useful for Mobile web development, HTTP testing and privacy.
Läs mer: Modify Headers :: Add-ons for Firefox
Och någon verkar ha anpassat det till Plone.
Bootstrap is a toolkit from Twitter designed to kickstart development of webapps and sites. It includes base CSS and HTML for typography, forms, buttons, tables, grids, navigation, and more.
Läs mer: Bootstrap, from Twitter
I'm not exactly sure what Livecode is, but I know what it looks like - Hypertalk, the language used in Apple's venerable HyperCard and its ilks (such as SuperCard). I was a professional HyperCard programmer at one time. I found Livecode while searching for text processing code for Javascript. This brings back memories. I liked Hypertalk.
put word 3 to 6 of “The quick brown fox jumped over the lazy dog.” into theVariable
Läs mer: Text and Data Processing | RunRev
I have used this to figure out what is happening in complex pieces of software, such as Plone.
The hook is set via the sys.settrace() function. This takes a function which is called during any of several events. One is the "line" event. Before the interpreter executes a line it calls the trace function with the current frame and the string "line". (The function gets a third argument which is None; that fields is used by other events.
import sys import linecache def traceit(frame, event, arg): if event == "line": lineno = frame.f_lineno filename = frame.f_globals["__file__"] if (filename.endswith(".pyc") or filename.endswith(".pyo")): filename = filename[:-1] name = frame.f_globals["__name__"] line = linecache.getline(filename, lineno) print "%s:%s: %s" % (name, lineno, line.rstrip()) return traceit
You start the tracing by calling the function defined above:
sys.settrace(traceit)
...and then your code follows.
Read more: Tracing python code, Tracing a Program As It Runs - Python Module of the Week
Here is a version I made some years ago, that probably works. It seems to track function calls:
def traceit(frame, event, arg): fo = open('/tmp/recur_log','a') if event != 'call': return co = frame.f_code func_name = co.co_name if func_name == 'write': # Ignore write() calls from print statements return func_line_no = frame.f_lineno func_filename = co.co_filename caller = frame.f_back caller_line_no = caller.f_lineno caller_filename = caller.f_code.co_filename fo.write( 'Call to %s on line %s of %s from line %s of %s\n' % (func_name, func_line_no, func_filename, caller_line_no, caller_filename)) fo.close() return traceit
It doesn't seem to extract the module name though, can be done with:
name = frame.f_globals["__name__"]
Just a collection of links to untested pieces of software, that I may come around to test
Update 2012-02-06:
Two more mentioned on Reddit:
An pypi server which automatically proxies and mirrors pypi packages based upon packages requested. It also supports the uploading of local (private) packages. Note that this is currently really, really alpha :-)Read more: mvantellingen/localshop - GitHub
A simple application for managing a static python package index. It borrows heavily from BasketWeaver and cheese_emporium. It leverages pip and setuptools/distribute for various package management tasks.
Read more: SurveyMonkey/CheesePrism - GitHub
Please make sure you are using VirtualEnv. This will isolate yopypi from other packages:
http://pypi.rhaptos.org is an eggs proxy cache aimed at being used by Rhaptos and Connexions developers. The goal is the prevent depending on the http://pypi.python.org infrastructure and / or external sites hosting eggs dependencies and speed up the build process. (see http://buildbot.rhaptos.org/waterfall)
Läs mer: pypi.rhaptos.org – Rhaptos-Trac
Setting up a PyPI mirror (with z3c.pypimirror) erstellt von Jens W. Klein — 17.08.2010 22:39 This article describes how to set up an own mirror of the Python Package index (aka Cheese-Shop)
Läs mer: Setting up a PyPI mirror (with z3c.pypimirror) — BlueDynamics Alliance
collective.eggproxy is a smart mirror for PyPI. It will collect packages on PyPI only when a program like easy_install or zc.buildout asks for it. In other words, unlike some mirrors that act like rsync and get the whole PyPI base (more than 5 gigas) collective.eggproxy will only get what you need.
Läs mer: collective.eggproxy 0.5.1 : Python Package Index
It has sold over 5,000 of its Thing-O-Matic 3D printers, which retail for $2,500 fully assembled or $1,299 in kit-form. Meanwhile, a newcomer from the Netherlands called Ultimaker, which costs $1,700 as a kit, is winning fans for its raw speed and ability to handle larger jobs. Some wonder whether the Ultimaker could be personal manufacturing's Apple II.
Läs mer: 3D printing: Difference Engine: Making it | The Economist
Med alla dåliga ekonomiska nyheter man läser så skulle man kunna tro att börsen skulle gå ner, men det gör den inte. Det finns till och med ett ordspråk myntat: "The market can stay irrational longer than you can stay solvent".
Jag lanserar härmed helghypotesen - att ingen vill må dåligt på helgen. Under varje vecka fram till jul kommer börsen att stiga från måndag till fredag så att alla kan må bra på helgen. Under helgen görs politiska och ekonomiska åtgärder som får börsen att öppna nedåt på följande måndag.
Denna cykel rullar på mot jul. Julen är också en helg och ju närmare julen man kommer, desto bättre vill man må under julen. Alltså går börsen upp framemot jul.
Sedan går det åt pipan!
Today on a temporary test setup I had the need for Apache to serve out sites on the same IP number, but on different ports (due to inflexible port forwarding on a router). According to the Apache documentation, NameVirtualHost can be written without a port specification.
NameVirtualHost *
However if you do so on Ubuntu 10.10 with some virtual hosts defined with ports, you get:
[error] VirtualHost *:80 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported,
proceeding with undefined results
Putting in more than one NameVirtualHost, with different port numbers covering the ports used in the virtual hosts directives, gives no errors though:
NameVirtualHost *:80
NameVirtualHost *:8080
And seems to work. You need to tell Apache to listen to all ports specified too.
Make a custom http header to hold the debug info:
sub vcl_fetch { set obj.http.X-Cookie-Debug = "Request cookie: " req.http.Cookie; ... }
Läs mer: Varnish, caching and HTTP cookies | Open Source Hacker
Summary: Supply the -i flag with 0 as an argument. The client will update the DNS info with the automatically discovered IP number, and return.
No-ip has an update client for Linux that when run detaches itself from the terminal. It comes with a couple of shell scripts to install it as a daemon, none for Ubuntu however and the Debian one is described in the Readme file such:
"There is a startup script for Debian called debian.noip2.sh. It also has been supplied by another user and is rumored to fail in some situations."
So, I would prefer the update client to be controlled by cron. There is a mode for running the update client and have it immediately return after having done its update. In this mode, you need to supply the -i switch and supply it with an IP number, according to the readme. That kind of defeats the purpose of it finding the IP automatically for you.
However if you read the C source code of the update client you see this:
if (*IPaddress == 0) {
if (nat)
get_our_visible_IPaddr(IPaddress);
...which means that if you supply 0 as the IP address it will look up the address for you.
The readme file also states:
"If you are behind a firewall, you will need to allow port 8245 (TCP) through
in both directions."
This does not seem to be the case. It works fine in my tests behind a firewall, both from the command line and when used with cron, no ports opened for it.
Harvard och MIT har släppt en rapport där de mäter ett lands potential genom att se hur komplexa varor dte kan leverera. Om bara ett fåtal länder kan leverera en vara så tyder det på att den är svår att göra (undantaget råvaror som bara finns på vissa ställen). Japan är den solklara ledaren här, följt av Tyskland, Schweiz och Sverige(!).
Gamla Östeuropa (rättare sagt Centraleuropa), gör också bra ifrån sig.
Creative Commons License The Atlas of Economic Complexity: Mapping Paths to Prosperity by Hausmann, Hidalgo et al. is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
Läs mer: The Atlas of Economic Complexity
Hittat via:
I came across something called the Atlas of Economic Complexity. It’s an attempt to measure the ”productive knowledge” of each country using network analysis techniques on the flows of trade – a bit like Google analyses internet links to rank websites. From the Atlas
Läs mer: Economic Complexity « Hotel Ivory
On these two distributions of Linux, you can type:
cat /etc/issue
On Ubuntu, but not Debian, you can also type:
cat /etc/lsb-release
...and you will get more verbose version information.
Tested on Ubuntu 10.10 and Debian 4 and 5 (apparently :-)
I have recently installed ubuntu 11.04. My friend just asked me what beta I am using. How can I find out?
How can I know what version of ubuntu I'm running? - Ask Ubuntu - Stack Exchange
I haven't tried it, but might be good for next time I do not want to remember ffmpeg's command line switches.
PyFFmpeg provides a simple object oriented interface to those libraries. PyFFmpeg is a wrapper around FFmpeg's libavcodec, libavformat and libavutil libraries whose main purpose is to provide access to individual frames of video files of various formats and codecs (such as mpg, mp4, mov, avi, flv, mkv, wmf, and webm). It also provides access to audio data.
...for me, that is. I have only gone a couple of pages in it but I think I would now understand Haskell code.
Hey yo! This is Learn You a Haskell, the funkiest way to learn Haskell, which is the best functional programming language around. You may have heard of it.
Läs mer: Learn You a Haskell for Great Good!
Update: It is now on pypi:
https://pypi.python.org/pypi/chromium_compact_language_detector
It turns out the CLD part of the Chromium source tree is nicely standalone, so I pulled it out into a new separate Google code project, making it possible to use CLD directly from any C++ code. I also added basic initial Python binding (one method!), and ported the small C++ unit test (verifying detection of known strings for 64 different languages) to Python (it passes!).
Läs mer: Changing Bits: Language detection with Google's Compact Language Detector
Note to self: Not sure exactly what this is, but sounded like it could be important, if libraries are in places a recipe does not expect them to be.
Use this to get easy_install to build eggs with extension modules that need to find libaries on multi-arch systems like Ubuntu and Debian
Läs mer: Making easy_install play nicely with multi-arch — Ross Patterson
Summary: Skype, VNC and VirtualBox in combination works really well.
I recently got a request for and did Plone online training (plug: there will be a Plone course in London in December), and it gave me the opportunity to try out a technology stack that I had had in mind for this purpose for some time. It turned out to be a complete success.
By using two VNC screen sharing servers there was good visual communication. Secondly, by using a VirtualBox instance for the course participant's work, there were no snags in setting up and running Plone, and the course participant could download the virtual machine image afterwards, with a complete buildout/subversion combo.
First, you need voice communication. There are many technologies you can use including the plain old telephone. In this case we used Skype. It worked fine with good sound quality without hogging to much bandwidth.
Secondly, set up two screens, one controlled by the teacher and one controlled by the course participant. Both screens are displayed on both computers. The teacher screen is basically a replacement for the projector screen in a classroom environment. The course participant's screen is where he will do all work, and the teacher can pop in and see what's happening and give help.
We used tightvnc, which has the option to have one view password and one full control password. So, on my workstation I set up a tightvnc server called the "teacher server". This screen will be controlled by the teacher and viewed by the course participant. The screen resolution should be set to something that fits on the participant's computer's screen. We used 1024x768.
The course participant's VNC server was set up in a slightly more complicated way. When teaching Plone in a classroom setting, it can be a bit complicated to get the buildouts to run on all kinds of different platforms that the course participants are bringing: Windows in different versions and OS X. Linux usually just works.
If you are teaching remotely, as you do with on-line training, you do not want to troubleshoot the course participant's computer: It would be close to impossible. Instead, I created a virtual Linux running under VirtualBox on my machine, and configured that machine with all libraries and stuff needed to develop in Plone. Then I set up a tightvnc server inside of that VirtualBox, and gave the password to the course participant. This means that the course participant is effectively working on my computer, which machine I have no problems troubleshooting of course, if need be. The course participant controls that screen and I open a view only VNC viewer to it and can see exactly how work progresses and the participant can show stuff.
This means that the physical computer that the course participant is using, just needs to be able to run a VNC client (viewer). After the course, the course participant simply downloads the VDI file (hard disk) of the VirtualBox he's been using, and that will give him the whole development environment plus all his work. I used Ubuntu 10.10 for the VirtualBox, with Gnome installed. Make sure the course participant's download the VNC and VirtualBox software from trusted sources, since there are quite some shenaningans going on on the Internet.
There was actually not much trouble, except for things that are totally avoidable that simply had to do with how I happened to set up the virtual computer. I was short of time so I used a ready made Ubuntu 10.10 VDI image for VirtualBox, and that one turned out to be in Italian. It took a couple of minutes to change it
Secondly there was something funky with the virtual storage. It reported that the disk was full, when there was 1.5GB left according to the df command. That was solved by uninstalling OpenOffice to make some free space.
These things were rectified before the course started I should add.
Thirdly, VNC makes Ubuntu assign "d" to minimize all windows instead of "meta-d". I have written about that and how to solve it here.
Fourthly, when the course participants should download their vdi VirtualBox images, be careful with compression, since many do not have adequate programs for uncompressing, or may have trouble using them.
Some weeks ago I tried to help a friend install a Ubuntu vdi image that had been compressed into the .7z format. He used a Mac that he had just got from work, and he had never used a Mac before. After about one hour's phone conversation and unreliable screen sharing over Skype with installing software, dragging, dropping and guessing, it all ended in confusion. If possible, provide the vdi images uncompressed.
One thing that is a bit hard with just having view access to a screen is that you cannot point at different parts of the screen. Sometimes it is easier to say "click there" and point, than saying "click the rightmost button at the bottom of the left pane". Or actually it is quite easy to say it, but not that easy to parse it for the course participant if he or she is in the middle of a difficult task.
I wonder if there exists a VNC client/server combination which would allow a view-only mode where you can point at stuff with an extra pointer that does not interfere with the work?
Furthermore the virtual machine image can be slimmed down to a server + just enough GUI for web browsers and a decent GUI text editor. One might even not need Gnome or KDE and instead go with something more lightweight such as XFCE. Still, even a non-GUI Ubuntu server install from scratch, which I have done in Virtualbox for other tasks before, is quite hefty, weighing in at about 800MB if i remember correctly.
If one wants more security against eavesdropping one can use noVNC (see guide here) as an intermediate server in which case the connection over the Internet can optionally be encrypted. noVNC also has the added benefit of only requring Google Chrome or Chromium on the course participant's computer, requiring no installation of a VNC client.
is the best information source on the Web on such software development topics as design patterns, refactoring and UML.
Läs mer: Design Patterns and Refactoring
I asked a customer to install VirtualBox on his computer, and unfortunately he downloaded it from one of these free download sites, instead of from virtualbox.org. Nowadays many of these free download sites wrap the downloads in adware, and maybe also spyware, viruses and scamware. And this is exactly what happened to my customer who now will need to clean out his computer, if that is enough.
So, when asking someone to download a piece of the software, also specify the exact location where they should download it from.