Archive

Archive for the ‘Linux’ Category

Makefile woes: PATH variable

September 9th, 2009 No comments

Was just writing a Makefile and ran into kind of a silly snag. The Makefile wasn’t finding any of the standard Unix commands (rm, rsync, …). What happened was I set the variable “PATH” to a value that I wanted to use on my script, totally forgetting the special significance of it.

Categories: Linux Tags:

crontab shell

August 10th, 2009 1 comment

I wrote a Python script that I want to run every five minutes through a crontab. The script ran fine and linked with my local libraries until I ran it through the crontab and it couldn’t find my local libraries. After a bit of thought, I realized that the crontab was not running through the same shell environment as I expected it to. Apparently the shell is set in /etc/crontab file and there it was set to bash. That in turn was calling the wrong version of Python, and that was why my local Python scripts weren’t being found.

There are four different ways around this:
1) Modify /etc/crontab to hit the right shell; in my case (first line modified):
/etc/crontab

SHELL=/bin/tcsh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly

crontab -e

*/5 * * * * python /my/script.py

2) Add the shell value to the top of the custom crontab (crontab -e); in my case:

SHELL=/bin/tcsh

*/5 * * * * python /my/script.py

3) Run the actual command through the tcsh as so:

*/5 * * * * tcsh -c "python /my/script.py"

4) Directly request the right version of Python:

*/5 * * * * /tools/bin/python /my/script.py
Categories: Linux, Python Tags:

Append to PYTHONPATH in Ubuntu

August 13th, 2008 2 comments

Not sure how other distros have this setup, but I know this works with Ubuntu…

First off, to view your PYTHONPATH. Load the python shell, by just running “python” from your favorite prompt. Then the following.


>>> import sys
>>> for line in sys.path: print line

Modifying it is as simple as adding a path file (such as “myproject.pth”) to this folder:

/usr/local/lib/pythonx.y/site-packages

Then within the file “myproject.pth” put the path to the folder of interest.

Important asside:
Although this is useful to know, the reason I ended up figuring this out was to add the path of my project so that my own project could access a certain folder within the project. What I really missed was just adding an __init__.py within the folder I added to my project, which is why I couldn’t treat the folder as a module… Arg!

Categories: Linux, Python, Ubuntu Tags:

Installing Django from SVN and setting up django-registration (on Ubuntu)

March 14th, 2008 No comments

Go to the shell and navigate to a directory that you want to leave the Django codebase. then enter the following code to check out the current codebase from Django:
svn co http://code.djangoproject.com/svn/django/trunk/ django-trunk

Next you will need to make a symbolic link to the Django codebase:

sudo ln -s `pwd`/django-trunk/django/ /usr/lib/python2.5/site-packages/django

Link to django-admin, which is used to create Django projects:

sudo ln -s `pwd`/django-trunk/django/bin/django-admin.py /usr/local/bin

Make sure not to use regular apostrophes around pwd or else you could run into an error with your libraries.  I was getting this error (since the mapping was going to the wrong place)
Traceback (most recent call last):

File "manage.py", line 2, in <module>
from django.core.management import execute_manager
ImportError: No module named django.core.management

Django registration

svn checkout http://django-registration.googlecode.com/svn/trunk/registration/ registration/
sudo ln -s `pwd`/registration /usr/lib/python2.5/site-packages/registration

Categories: Django, Linux, MSSQL, Ubuntu Tags:

Configure router on network

May 20th, 2007 1 comment

I was having a problem configuring my router and all that was needed was a refresh of the DHCP settings on the router.

On my router I had to logon to my router by going to 192.168.1.1 and then just refreshing the DHCP and this was annoying as I love gaming and using the  BestLiveCasinosUK so ill let you guys this tips.

Invest in one of the best gaming routers if you find yourself frustrated with your online experience when gaming. You need an uninterrupted, robust signal for just about everything online now, let alone gaming. And, when you’re in the heat of the moment in one of your favorite online games, you don’t want to deal with any disruptions or lags that could ruin, or at least frustrate, your ability to play.

Even with a gaming PC packed with the latest components, you’re going to suffer if you don’t have a capable router. And, even if offline single-player titles are more your speed, you still need control over your internet connection when downloading games or big updates, whether to prevent interruptions or prioritize gaming-related bandwidth.

It’s time to invest in the top gaming router if you or someone at home is a big gamer. Move on from that mediocre one that your ISP is renting you and get one that can handle all your online demands, regardless of whether you’re downloading the best PC games or connecting your brand new next-generation console. You’ll find everything on this guide, from routers packed with gamer-centric features to ones with cutting edge tech like Wi-Fi 6.

 

Categories: Linux Tags:

Setting up pentium core 2 duo on Ubuntu

May 16th, 2007 No comments

I spent a lot of time trying to diagnose this problem. What would happen is that when I would login to Ubuntu I would get the following message “CPU frequency scaling unsupported.”

There are two things that need to be done. First you have to make sure SpeedStepping is set. The way to activate this is to go into your setup when the computer starts up and check your processor settings.

The next thing you have to do is get a kernel that supports this chip. The standard 386 kernel that comes with the Ubuntu (Dapper/Edgy/Feisty) does not support it. You need to go into Synaptic and download the generic kernel.

By the way I spent hours trying to compile my own kernel since I didn’t know that prebuilt kernels existed as a package. Apparently the Ubuntu people don’t want us compiling our own kernels and have made it as difficult as possible. I got as far as I willing to go with the kernel compiling process. I got the kernel setup in the GRUB and loaded it, but the computer would stop somewhere while loading. There probably is no reason to compile your own kernel at this point. I don’t think having extra things turned on in the kernel will even make a difference at this point.

Categories: Linux Tags: