django duplicate field weirdness

So in django if you duplicate field names in a model declaration “weird” things happen, like
ValueError at /admin/

invalid literal for int() with base 10: ‘False’

Request Method: POST
Request URL: http://localhost:8000/admin/
Exception Type: ValueError
Exception Value: invalid literal for int() with base 10: ‘False’
Exception Location: c:\Python25\lib\site-packages\django\db\backends\util.py in typecast_date, line 46

Go figure 🙂

how to download files in Ruby

# the ruby way to download files 🙂 — useful if you haven’t got wget on the system…
require ‘open-uri’
writeOut = open(whereItGoes, “wb”)
writeOut.write(open(urlToGet).read)
writeOut.close
puts “downloaded” + urlToGet + “\n”

Of course, this reads in the whole file before writing it (I bet), so be careful.

setting up scgi

As a note on http://wiki.rubyonrails.org/rails/pages/SCGI+Rails+Runner+with+Apache+2+on+Linux

Note: you may not need to edit the .htaccess file at all.  Don’t be afraid if you do it and find an error messsage in apache/logs/error that the rewrite engine on directive is not recognized.  This means that mod_rewrite is not installed but it may not be necessary for SCGI anyway.  Apparently not necessary these days.

svn purge

svn purge is used to ‘delete’ all traces of a file (“it never existed”) from a repository.  One idea (since as of 2005 purge wasn’t implemented) is to keep some backups of the svn repostiory directory so you can ‘step back’ by reerting to a saved repository. not pretty but do-able.

ruby compilation overcome

So...
it appears that if you compile ruby and get a "warning clock skew detected" that it
 may be due to your machine having a clock set for a certain time, and an nfs server being set 
for (say) one hour difference or not. Synchronize them and you're good 🙂
Thanks for all those information.

background:

BTW I am using a intel box having 8 processors, each one 2-way hyperthreaded. And yes, the File system id      NFS.

Thanks.
--------
Hemayet Hossain

Dan Gibson wrote:

This happens when you're compiling on a virtual machine, and your host machine supports dynamic frequency modulation. There is a fix to the issue... you can find it on google.

Mike Marty wrote:
While Make is doing its timestamp-based dependency check, the timestamps
on some of your files appeared to be in the future...hence the clock skew
detected message

It is not a GEMS thing.  Sounds like an issue on your host system.

--Mike

Hi All,
I was compiling ruby (gems 1.3) in simics 3.0.14. At the end of
compilation I am getting the following warning. (ruby seems working
fine). Does anybody know why is that coming or is there any potential
problem for that warning?
---------------------------------
Template closure done
Made module
make[1]: warning:  Clock skew detected.  Your build may be incomplete.
make[1]: Leaving directory `/home/vax2/u2/hossain/G3S364/ruby'
Ruby: Linking simics module
cd ../simics; make ruby
make[1]: Entering directory `/home/vax2/u2/hossain/G3S364/workspace'
=== Building module "ruby" ===
make[2]: Entering directory
`/home/vax2/u2/hossain/G3S364/workspace/amd64-linux/obj/modules/ruby'
make[2]: Warning: File
`/home/vax2/u2/hossain/G3S364/workspace/modules/../../ruby/amd64-linux/generated/MOSI_SMP_bcast/obj/util.d'
has modification time 51 s in the future
Using the Simics 3.0 API for ruby module
CCLD    ruby.so
make[2]: warning:  Clock skew detected.  Your build may be incomplete.
make[2]: Leaving directory
`/home/vax2/u2/hossain/G3S364/workspace/amd64-linux/obj/modules/ruby'
make[1]: Leaving directory `/home/vax2/u2/hossain/G3S364/workspace'
Ruby: Moving simics module
make BUILD_FLAGS=-DSIMICS movemodule
make[1]: Entering directory `/home/vax2/u2/hossain/G3S364/ruby'
../scripts/prepare_simics_home.sh ../simics/home/MOSI_SMP_bcast amd64-linux
make[1]: Leaving directory `/home/vax2/u2/hossain/G3S364/ruby'
Ruby: my work is done here...

Thanks.

installing subversion with mod_dav_svn

So if you install subversion (and want SSL) and get errors listed here or below…

(if installed with ./configure –without-apache) or what not

run the following from the subversion directory

./configure –with-ssl –without-apache
make && sudo make install
it errs
go to Makefile (I believe) and take out the reference (dependency on) install_mods_shared (line 324 for me)

and run sudo make install again.

I believe this overcomes the following problems, as well.

chmod 755 /usr/lib/apache2/mod_dav_svn.so
apxs:Error: Config file /etc/apache2/httpd2-prefork.conf not found.
make: *** [install-mods-shared] Error 1
svn: error while loading shared libraries: /usr/local/lib/libsvn_ra_dav-1.so.0: undefined symbol: SSL_shutdown

cd subversion/mod_dav_svn ; /usr/bin/install -c -d “/usr/lib/apache2″ ; /usr/sbin/apxs2 -i -S LIBEXECDIR=”/usr/lib/apache2” -a -n dav_svn mod_dav_svn.la
/usr/share/apache2/build/instdso.sh SH_LIBTOOL=’/usr/share/apache2/build/libtool’ mod_dav_svn.la /usr/lib/apache2
/usr/share/apache2/build/libtool –mode=install cp mod_dav_svn.la /usr/lib/apache2/
libtool: install: error: cannot install `mod_dav_svn.la’ to a directory not ending in /usr/local/apache2/modules
apxs:Error: Command failed with rc=65536

Here is the gross output.. 🙂

/usr/bin/install -c -m 644 ./subversion/svnversion/svnversion.1 /usr/local/man/man1/svnversion.1
cd subversion/mod_dav_svn ; /usr/bin/install -c -d “/usr/lib/apache2″ ; /usr/sbin/apxs2 -i -S LIBEXECDIR=”/usr/lib/apache2” -a -n dav_svn mod_dav_svn.la
/usr/share/apache2/build/instdso.sh SH_LIBTOOL=’/usr/share/apache2/build/libtool’ mod_dav_svn.la /usr/lib/apache2
/usr/share/apache2/build/libtool –mode=install cp mod_dav_svn.la /usr/lib/apache2/
libtool: install: warning: relinking `mod_dav_svn.la’
(cd /home/rpack/downloads/subversion-1.4.3/subversion/mod_dav_svn; /bin/sh /home/rpack/downloads/subversion-1.4.3/libtool  –tag=CC –silent –mode=relink gcc -g -O2 -g -O2 -pthread -D_LARGEFILE64_SOURCE -DNE_LFS -rpath /usr/lib/apache2 -avoid-version -module -o mod_dav_svn.la activity.lo deadprops.lo file_revs.lo liveprops.lo lock.lo log.lo merge.lo mod_dav_svn.lo replay.lo repos.lo update.lo util.lo version.lo ../../subversion/libsvn_repos/libsvn_repos- 1.la ../../subversion/libsvn_fs/libsvn_fs- 1.la ../../subversion/libsvn_delta/libsvn_delta- 1.la ../../subversion/libsvn_subr/libsvn_subr-1.la -lz )
libtool: link: warning: `/usr/lib/gcc-lib/i586-suse-linux/3.3.3/../../..//libexpat.la’ seems to be moved
libtool: link: warning: `/usr/lib/gcc-lib/i586-suse-linux/3.3.3/../../..//libexpat.la’ seems to be moved
libtool: link: warning: `/usr/lib/gcc-lib/i586-suse-linux/3.3.3/../../..//libexpat.la’ seems to be moved
libtool: link: warning: `/usr/lib/gcc-lib/i586-suse-linux/3.3.3/../../..//libexpat.la’ seems to be moved
cp .libs/mod_dav_svn.soT /usr/lib/apache2/mod_dav_svn.so
cp .libs/mod_dav_svn.lai /usr/lib/apache2/mod_dav_svn.la
cp .libs/mod_dav_svn.a /usr/lib/apache2/mod_dav_svn.a
ranlib /usr/lib/apache2/mod_dav_svn.a
chmod 644 /usr/lib/apache2/mod_dav_svn.a
PATH=”$PATH:/sbin” ldconfig -n /usr/lib/apache2
———————————————————————-
Libraries have been installed in:
/usr/lib/apache2

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR’
flag during linking and do at least one of the following:
– add LIBDIR to the `LD_LIBRARY_PATH’ environment variable
during execution
– add LIBDIR to the `LD_RUN_PATH’ environment variable
during linking
– use the `-Wl,–rpath -Wl,LIBDIR’ linker flag
– have your system administrator add LIBDIR to `/etc/ld.so.conf’

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
———————————————————————-
chmod 755 /usr/lib/apache2/mod_dav_svn.so
apxs:Error: Config file /etc/apache2/httpd2- prefork.conf not found.
make: *** [install-mods-shared] Error 1



-Roger Pack
“Men are that they might have joy.” (2 ne 2:25)

How to display the version of python in django

assuming you have an app called “mysite”

add this to urls.py

<code>

(r’^system/$’, ‘mysite.polls.views.system_list’),

</code>
now create the system_list function in
mysite/polls/views

def system_list(request):
t = loader.get_template(‘polls/system.html’)
c = Context({
‘sys_version’: sys.version,
‘sys_executable’ : sys.executable
})
return HttpResponse(t.render(c))
and then create the system.html file (somewhere within your template paths)

[{{ sys_version }}] [{{ sys_executable }}]

And voila you may see it 🙂

python weird error

So if you get errors when installing django and pysqlite that seem obscure, you can fix them by going to settings.py and changing “USE_I18N” to False.  Then they go away.  Either that or you could attempt to (somehow) recompile pysqlite with the correct Unicode extension, as apparently it is not being built with it.  Good luck!

RoR speed test

Seems that scgi is the fastest (that I can tell)…umm… [ran

100 immediate connections on webrick:
Slowest pages on average (worst 5):
Average times (sec)
connect write   read    close   hits    URL
2.9217  2.9217  51.6146 51.6146 500     http://localhost:3200/
Requests: 500 Time: 516.15 Req/Sec: 0.98

100 immediate connections on scgi single

Slowest pages on average (worst 5):
Average times (sec)
connect write   read    close   hits    URL
0.0005  0.0005  28.8796 28.8797 113     http://localhost:8100/
Requests: 113 Time: 40.29 Req/Sec: 8.24

Is this a joke?

Slowest pages on average (worst 5):
Average times (sec)
connect write   read    close   hits    URL
0.0002  0.0002  60.5475 60.5476 771     http://localhost:4000/
Requests: 771 Time: 598.49 Req/Sec: 1.52

Hmm. Why? I have no idea.
Using flood, scgi with one instance running, webrick on production mode.  Note mod_ruby I could not really even get to compile, and mongrel seemed slow, too.

Odd.

Roger's meanderings, notes to himself, bug reports, and other things