Personal tools
You are here: Home

jorgenmodin.net

2012-01-23

Link - Requests: An alternative to urllib2 in python

Filed Under:

Note to self.

Python’s standard urllib2 module provides most of the HTTP capabilities you need, but the API is thoroughly broken. It was built for a different time — and a different web. It requires an enormous amount of work (even method overrides) to perform the simplest of tasks. Things shouldn’t be this way. Not in Python.



Read more: Requests: HTTP for Humans — Requests 0.10.1 documentation

2012-01-18

Link - Git over http

Filed Under:


This looks very interesting for integrating external authentication sources. It seems to be a CGI script so it does not operate the same way as e.g. subversions's http protocol. I will probably need to install it and check the logs for what the requests will look like. My guess is a combination of path and POST parameters.

I believe this because it’s both efficient and can be run either secure and authenticated (https) or open and unauthenticated (http). It also has the huge advantage that most firewalls have those ports (80 and 443) open already and normal users don’t have to deal with ssh-keygen and the like. Once most clients have updated to at least v1.6.6, http will have a big place in the Git world.



Read more: Pro Git - Smart HTTP Transport

2012-01-16

How to make a massive Zope/Plone undo through the web

Filed Under:

 

Summary:

http://localhost:8080/manage_UndoForm?PrincipiaUndoBatchSize:int=660

....where 660 should be replaced with the number of transactions you need to go back. Then click like crazy.

 

I had the need to back a Zope site in time several months, October 2011 to be specific.

I had deleted a page (after its due date) for a Plone course December 2011 and kept one for December 2007. I did not, repeat not, want to enter everything that has changed in the contents of that course in between those two dates again. There are backups for the entire system but they are rotated, and I caught this late.

The course page is a compound content type consisting of sub objects for dates, pricing and other things. The missing course page had resided in a folder hierarchy that had also been deleted. The easiest would therefore be to just back the entire server in time, rather than trying to find specific edits to undo.

The undo page in the ZMI batches undoable transactions in lots of 20. My plan was to revert everything back to October 2011 (working on a copy of course). So, 20 transactions is not enough. I need a mega batch! I know there are command line scripts were I can find the byte offset for the date I am interested in and then use truncate, but haven't done it for ages (ok, once in 2002), and can the effect still be achieved from the ZMI? It will be an append but that's OK.

If you look at the "Earlier transactions" and "Later transactions" links, you can see that the start and end transactions are encoded as cgi parameters. The batch size is in other words, not hard coded.  So, if the url for "Later transactions" on the second page is

http://localhost:8080/manage_UndoForm?first_transaction:int=0&last_transaction:int=20&PrincipiaUndoBatchSize:int=20

 

We can just change those numbers. So I clicked through "Earlier transactions" until I reached October, noted where I were in transaction numbers and did something like this:

 

http://localhost:8080/manage_UndoForm?first_transaction:int=0&last_transaction:int=660&PrincipiaUndoBatchSize:int=20

I got a big page and I did a lot of clicking of check boxes, and hit "Undo" - worked like a charm. I then copied over the oh so precious text to the production server.

"PrincipiaUndoBatchSize" I did not notice until now, it did not seem to overrule the other numbers; I did not change that one.

Hmmm, must go back and try something.... Yup, this works too:

http://localhost:8080/manage_UndoForm?PrincipiaUndoBatchSize:int=660

 

2012-01-12

How to force a disk check on next restart on Ubuntu

Filed Under:

sudo shutdown -rF

-or-

make file in the root ("/") directory called forcefsck

Tested on Ubuntu 10.10 .

I had to forcefully shut down a laptop today, and when it came back to life it did not seem all that well. Sometimes Ubuntu starts a spontaneous disk check but it had no such intentions this time. I could not do a "live" disk check since the disk was mounted and fsck sternly warned that I *will* destroy things if I continue. Well, then, how to direct it to do it on next boot?

There are at least two ways of doing this: By issuing a restart from the command line with shutdown command, where in addtion to the restart flag one also issues a Force disk check. Or by creating a temporary file that Ubuntu reads as a kind of flag on boot and then deletes.

2012-01-09

Länk - Python på Android

Filed Under:

 

Turn your python application to an Android APK - Build your own python and extension



Read more: kivy/python-for-android - GitHub

2012-01-08

Länk - Färganpassning av skärmen till dygnet

Filed Under:

 

f.lux makes your computer screen look like the room you're in, all the time. When the sun sets, it makes your computer look like your indoor lights. In the morning, it makes things look like sunlight again.



Read more: F.lux: software to make your life better

2012-01-04

Bör man ha åsikter om läkemedelsförpackningars storlek och utformning?

Filed Under:

Speciellt receptfria. En Facebookdiskussion spårade in på denna fråga. Jag lägger upp denna post om vidare diskussion önskas.

 

Freakonomics » Why Can’t You Buy a Big Bottle of Headache Pills in England?

2012-01-02

Piano player on getting better

Filed Under:

This is supposed to applicable to programming, not sure but I make a bookmark:

 

  • Strategy #1: Avoid Flow. Do What Does Not Come Easy.
  • Strategy #2: To Master a Skill, Master Something Harder.
  • Strategy #3: Systematically Eliminate Weakness.
  • Strategy #4: Create Beauty, Don’t Avoid Ugliness.




Avoid Flow. Do What Does Not Come Easy.


Read more: Study Hacks » Blog Archive » Flow is the Opiate of the Mediocore: Advice on Getting Better from an Accomplished Piano Player

2011-12-30

How to disable WPS on Netgear WNDR3700

Filed Under:

A new attack against home routers has been discovered, and an exploit tool has been made available. To disable WPS  on a Netgear WNDR3700: Go to the admin interface, look at the Screen shot below: go to "Advanced Wireless Settings" and check the checkbox "Disable Router's PIN". Then click the "Apply" button.

 

(I have not verified that WPS is indeed disabled, but as long as the WNDR admin interface does what it says, it should be OK)

Just a day after security researcher Stefan Viehbock released details of a vulnerability in the WiFi Protected Setup (WPS) standard that enables attackers to recover the router PIN, a security firm has published an open-source tool capable of exploiting the vulnerability.



Read more: Attack Tool Released For WPS Setup Flaw - Slashdot

 

2011-12-15

Länk - Virtual machines for Internet Explorer testing

Filed Under:

 

Microsoft provides virtual machine disk images to facilitate website testing in multiple versions of IE, regardless of the host operating system. Unfortunately, setting these virtual machines up without Microsoft's VirtualPC can be extremely difficult. The ievms scripts aim to facilitate that process using VirtualBox on Linux or OS X. With a single command, you can have IE7, IE8 and IE9 running in separate virtual machines



Read more: xdissent/ievms - GitHub

 
Recent Comments


Atom

(postings)

Atom

(comments)

 

This site conforms to the following standards: