I just upgraded django tree which recently merged in the unicode support. This immediately broke django templates for venus. Here is what you need to change in planet/shell/dj.py to account for new django changes:
43c43,46
< f.write(t.render(context))
---
> ss = t.render(context)
> if isinstance(ss,unicode):
> ss=ss.encode('utf-8')
> f.write(ss)
This is probably due to render returning unicode strings which need to be converted to byte-streams.
Update: I found out that my changes broke it for people using older version of django. I have updated the patch above to account for that.
I needed to reset the django admin password and found this page which tells us how to do this. It did not work for me, however I tried to get the user object explicitly, reset the password and save it and it worked!
Here is a session describing the behavior:
> python manage.py shell
In [1]: from django.contrib.auth.models import User
In [2]: u=User.objects.all()
In [3]: u[0].password
Out[3]: 'sha1$0913d$6c5cfefb89b3c77dc8573e466a943c7acd177f6b'
In [9]: u[0].set_password('testme')
In [10]: u[0].save()
In [11]: u[0].password
Out[11]: 'sha1$0913d$6c5cfefb89b3c77dc8573e466a943c7acd177f6b'
In [12]: q=User.objects.get(id=1)
In [13]: q
Out[13]: <user : root>
In [14]: q.set_password('testme')
In [15]: q.save()
In [16]: q.password
Out[16]: 'sha1$24e9c$868ff39f08c3bde96397e33ea6a8847a658a16bc'
Maybe this is related to queryset caching, which would print the same password even after calling set_password. But it looks like in the first method, the password does not even get written to the database. This might be a bug. I will need to run more tests and report (or possibly patch) it...
Update: Perhaps I am not clear in the above post. The weirdness is that in the above two scenarios u[0] and q should essentially reference the same user object, but calling set_password (and later save) method on the u[0] reference does not seem to work (i.e. the password attribute remains unchanged and changed password cannot be used on the admin pages) but calling the same method on q reference seems to work!
Update2:I got it finally. Thanks all (Esp SmileyChris) ! every array slice is a new query! so in the first solution, I need this to make it work:
u=User.objects.all()
u[0].password # to display current hash (Query #1)
q=u[0] # (Query #2)
q.set_password('testme')
q.save()
q.password
u[0].password # (Query #3) this should print updated hash!
I received the following in email forward. It is supposedly a customer support call to Idea Cellular. It sounds like it is a staged conversation, but is hilarious anyway! Knowledge of marathi is recommended 😉
I am looking for a flash media player which can play audio/video content in browser. I am currently using del.icio.us's playtagger for now, but it is limited to mp3 only (I had to change the code a little bit to prevent it from adding multiple inclusions - my changed code is here) and it does not allow rewind/forward.
I also looked at this post which suggests using google video player, which would be nice as it could then also play video files, but it consumes a lot of real estate on the pages. There is also this website mentioned which is nicer but that player is bigger than I want too... And it is probably not a fair use as it is undocumented use...
I also checked out the odeo player, which is nice but you need to host the files on odeo, which is a no-no.
Here are my requirements for this with a scorecard for Playtagger and Google:
Easy to use. No need to add tag soup for each file. (Del.icio.us + Google -)
Small size on the page (need to collapse the buttons until user clicks on play button) (Del.icio.us + Google -)
Ability to rewind/fast forward (Del.icio.us - Google +)
Play different media formats (mp3/wav/ogg/avi/mpeg video, possibly realmedia) (Del.icio.us - Google +)
To play the file, click on the small triangle before the name. (needs javascript and flash plugin)
To download the file, right click on file name and select “Save Link As” or “Save Target As”
Maharshtratimes.com (or maharashtratimes.indiatimes.com) is a marathi news website using unicode fonts. But it does not display correctly on firefox browser. The problem is because of a single HTML div which uses justified font style. It displays correctly on IE (which is why it is not getting fixed) - this could be because of firefox's buggy implementation of "align: justify" or that IE simply ignores that style (likely).
Anyway, here is a javascript one liner that you can bookmark and once the page is loaded, click on it to fix your font problem.
I tried to create a greasemonkey script to do this automatically, but it's not working for some reason...
Update: Apparently it *is* a mozilla/firefox bug open for 4+ years. See here and here.
Update2: Here is a greasemonkey script by Saravana Kumar to fix this issue. Caution: you might want to change the included domains carefully (it by default runs on all http and https sites!)
Here are some recipes for interpreting stream of bytes as different C types. I will keep adding more to this as I go...
Convert a byte stream (embedded in a string) into 1 byte signed integers:
"\xfc\xfd\xfe\xff".unpack("c*")
=> [-4, -3, -2, -1]
Convert a byte stream (embedded in a string) into 1 byte unsigned integers:
"\xfc\xfd\xfe\xff".unpack("C*")
=> [252, 253, 254, 255]
This post describes the steps that I took to restore an old server which had died some months back.
I had a linux server running debian pretty reliably. It had failed because of a hardware problems (broken power supply). I replaced the power supply and proceeded to make it current with security fixes. But as it happens when you update after a long time, (or it could also be due to my own itch to remove old kernels), I hosed the system. By that I mean that the system was running but somehow all the kernels had been removed (including the current one that I was running!). Anyway, in summary, the system would not boot because there was no kernel to do so.
Step 1: Okay, I thought I will just reinstall it with Ubuntu (which BTW is my new favorite distribution). But the problem was that the machine was using LVM and Ubuntu installer did not recognize the LVM volumes (even though it is documented to do so).
Step 2: So next stop was latest and greatest Knoppix which recognizes LVM. When I booted knoppix, I was able to see all the old partitions and data (70 gigs of legal *cough* songs, audio books and movies). Success!
Step 3: Next step was to chroot into the old root partition and use apt-get to get the kernel package installed back again. I confirmed that there was no kernel-image-* package installed! apt-get update would fail, because procfs was not mounted, so from out of the chroot, mounted the procfs. After that I was able to update the packages, but the install scripts failed because of errors. The specific error was /dev/null: Permission Denied. I was stumped. The device looked okay and the permissions also were okay (the script runs as root afterall). Upon some search I found out that it is because the default mounts in knoppix do not mount devices (nodev option). Once I fixed that, all things fell right in place.
I created a small form using which you can search the web for unicode devanagari words. It is very cumbersome to actually enter unicode devanagari characters using qwert keyboards, so I have adopted the phonetic transliteration scheme from Manogat website. Do give it a try:
http://amit.chakradeo.net/search/ (Link now removed, please see update below)
Start typing devanagari words phonetically and you will see unicode characters in the input area. When you hit enter, the phrase will be submitted to google.
I keep getting a lot of hits on some of the old posts (Ram Raksha Stotra and Hanuman Chalisa) with visitors asking for audio versions of the stotra. Here is a page where I will keep collecting the audio versions of various stotras.
To Play: If you have javascript enabled, you can click on the small arrow before each link to play the file. To Download: Right click the link and select "Save Link As" or “Save Target As”.
beautifully sung by Vijay Prakash, Sonu Nigam, Shaan, Palash Sen, Kailash Kher, Madhushree, Sneha Pant, music by Tapas Relia and lyrics by Satish Mutatkar.
Lyrics in itrans ascii:
(jaya hanumaan gyaan guNa saagar
jaya kapiis tihu lok ujaagar
raamadoot atulit bal dhaamaa
a.njanee putra pavanasoot naamaa)
paraakram se gu.nje tribhuvan
dharatii paataal,duShTa bhanjan
jal saagar kare paraajay kra.ndan
trikaal nira.ntar lok va.ndan
Here is the updated bookmarklet: Phishy? (tested on firefox 2.0 only!)
1. Drag this link to your bookmark. This checks if the site you are currently on is a phishing site.
2. Drag this link to your bookmark. This prompts for a URL and checks if it is a phising site.
If this does not work try turning debug to true above if you want to see the encoding.
Update: This still uses the GET method for checking the URL. Phishtank recommends using the POST interface (which will remove limitations on URL length: base64 inflates the length by 33%). Implementing that would need some kind of xmlhttprequest hackery. Stay tuned...
Update2: I got the AJAX bookmarklet ready, (thanks!)but it hits the infamous "uncaught exception: Permission denied to call method XMLHttpRequest.open" bug. i.e. you cannot do cross-domain xmlhttprequests. To solve that I think I need to convince PhishTank to host the javascript code, so the bookmarklet will insert a hidden iframe into the current page which will load the javascript from phishtank page, which will eventually make xmlhttprequest to phistank and display the result back. Are you listening PhishTank ?
Update3: Thanks to "till" who commented below, here is the bookmarklet using the POST method so now the solution will also work for really long URLs. Till's solution is good, but it makes users trust his site (in addition to phishtank). So basically user has to trust that he is not trying to filter the results being presented..
I have also merged the two earlier bookmarklets so that the current site location will be autopopulated in the prompt, so that user can easily change it if he wants to check a URL different from the one he currently is on.
Against All Enemies: Inside America's War on Terror is a fascinating account of events that happened inside the White House before and after 9/11 and how the focus shifted from fighting the terrorists to war with Iraq. I got to know about this book after watching Clinton's interview with Fox News. where he repeatedly asks the interviewer to read this book. The book starts off describing events in situation room and then goes back in history and explains the background of how Al-Qaeda started appearing on CIA's radar. There is an interesting account of different presidents and their view of terrorism and the changes in the mindset from Cold-War era to terrorism.
I wanted to use the ruby geocoder library on the windows machine, but the installation of the gem failed due to some weird error. I checked the rubyforge project page to see if someone else had a similar problems and someone actually had, but the bug was open for a long time. I decided to fix this issue and found that the problem was due to the fact that windows platform does not allow characters '?' and '&' in the filename with any escaping, period. The said files were used (in a very innovative way I must say!) to test the library by modifying http.rb to return the test datafile contents instead of fetching the URL from the net. (yay open classes in ruby!). The way I fixed the problem was to change the filenames to use '_' instead of '?' and '__' instead of '&'.
I wrote to the developer, but there was no response. Anyway I managed to create a new GEM with the changed files so that this should be installable on windows now. Here are the files if you want to try installing the gem. (Also including the tgz because... it got generated anyway!) geocoder-0.1.1.gem geocoder-0.1.1.tgz