Showing posts with label Tips. Show all posts
Showing posts with label Tips. Show all posts

Sunday, February 24, 2013

Python subprocess throws [Errno 2] No such file or directory

First steps in Python, and I've been spending a while trying to understand why my python script would fail when called from my webserver. The same script would work just fine when I run it manually.

simple example

file  run_maven_clean.py:

        #!/usr/bin/python
        import os, sys,


        subprocess.check_call(["mvn", "clean", "install"])

This will work if run manually
user:~$  run_maven_clean.py
mvn clean install

but fails terribly when called by a web server

  File "/home/use/run_maven_clean.py", line 105, in build
    subprocess.check_call(cmd)
  File "/usr/lib/python2.5/subprocess.py", line 457, in check_call
    retcode = call(*popenargs, **kwargs)
  File "/usr/lib/python2.5/subprocess.py", line 444, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib/python2.5/subprocess.py", line 594, in __init__
    errread, errwrite)
  File "/usr/lib/python2.5/subprocess.py", line 1149, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory


Reading around, I found tips, that there is no shell, make sure you have bash or csh... Of course, I have shell=False for security, still, I thought "mvn" is pretty well known executable on the system, it should find it, well NO.

NO SHELL also means, you have NO PATH, NO ENVIRONMENT VARIABLES.

and the correct way to do really is

              subprocess.check_call(["/opt/apache-maven-3.0.4/bin/mvn", "clean", "install"])



Friday, February 15, 2013

Check or Turn Off Windows UAC (User Account Control)

Windows User Account Control or UAC is another Windows feature that may cause any non-Microsoft application to malfunction.

Deciding whether the security benefit is worth the trouble is your choice.

Here's my preferred way of verifying it:

1- Open Regedit on the machine
2- check the registry key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA 
(REG_DWORD) if the key is missing or its value is 0, then it's disabled, any other value (like 1) then it's enabled


The way to do it from the UI is as follow:

From your "Start Menu"
Launch the "Control Panel"
Select "User Accounts"
Then "Change User Account Control Settings"

reboot your computer after any change!



Friday, December 7, 2012

How to really disable DEP (Data Execution Prevention) / BCDEdit

Windows DEP or Data Execution Prevention is often blocking you or your application from working properly.

If you explore Windows configuration and Help, you will find

My computer
  -> Right click
     -> Properties
         -> Advanced System Settings
            -> Performance Settings
               -> Data Execution Prevention

You can set a few options on or off, but this is rarely enough.

In order to REALLY disable DEP, you need to tell Windows at boot time.

For Windows 2003 or Windows XP
You need to go to

My computer
  -> Right click
     -> Properties
         -> Advanced System Settings
            -> Startup and Recovery Settings 

and edit your boot.ini from there
and add the parameter /NoExecute=AlwaysOff


For Windows Vista or Windows 7
There is a command line tool to do so, make sure to launch your command prompt "As Administrator" and run the command
BCDEdit.exe /set {current} nx AlwaysOff

You can also see all your boot options with
BCDEdit /enum

you will something similar to
Windows Boot Manager
--------------------
identifier              {bootmgr}
device                  partition=C:
description             Windows Boot Manager
locale                  en-US
inherit                 {globalsettings}
default                 {current}
resumeobject            {5a9684f2-9ec0-11e1-a7c3-00137290c993}
displayorder            {current}
toolsdisplayorder       {memdiag}
timeout                 5

Windows Boot Loader
-------------------
identifier              {current}
device                  partition=C:
path                    \Windows\system32\winload.exe
description             Windows 7
locale                  en-US
inherit                 {bootloadersettings}
recoverysequence        {5a9684f6-9ec0-11e1-a7c3-00137290c993}
recoveryenabled         Yes
osdevice                partition=C:
systemroot              \Windows
resumeobject            {5a9684f2-9ec0-11e1-a7c3-00137290c993}
nx                      AlwaysOff


Don't forget, this is a boot option, so you do need to reboot for Windows to take it into account.

Tuesday, December 4, 2012

Synaptics LuxPad V1.5 keeps disabling accidently


I recently got a new laptop, HP EliteBook 8570w, and like all the new line of HP laptops, it comes with the Synaptics LuxPad. It's a very large touchpad that supports multitouch and advanced gestures the way your smartphone would.

However frustration often comes because the touchpad tends to disable itself if my hand rests on it while typing.

Synaptics Luxpad Disabled

I'm then left without my touchpad trying to go in the LuxPad's configuration panel in order to re-enable it. After this happened a couple times, frustration rises.

Today I found out the proper way to enable or disable it, I simply need to double tap the top left corner of the pad! and Voila

Synaptics Luxpad Enabled
Back to work now ! :)






Monday, January 24, 2011

Unstable Wifi Connection issues

It's not the first time and not the last time, but way too often Wifi connections are unstable. Of course plugging a good old RJ45 works like a bliss.

This time I'm using a Belkin
F7D1301 v1 Router and all the computers in the household experience a dropped connection every 2 to 4 hours. It can take up to 30 min to be able to reconnect, and it seems bringing the laptop closer to the router helps reconnecting faster!

Interferences?

I upgraded the router's firmware, and great result: no more disconnection, I even download way faster (but there is no evidence this is related).

After a week of enjoying stable connections, the dropped connections are back, every 5 to 10 minutes this time!

Few hours later,
a power outage might have brought me the answer. Indeed the power outage might indicate that before that, the power line was not working properly. Variations in the power the router's gets could create variations in the wifi signal and so the dropped connections. After the outage was over, the wifi connections were stable again.

It is probably a good idea to put your router behind a UPS device (or uninterruptible power supply), this will provide safe and stable current and will give you a stable wifi signal.

Saturday, April 25, 2009

How much car insurance is enought?


This week I was trying to answer the question: "How much insurance do I really need?"

All over the web, the only answer is 'the minimum legal' or if you have valuable assets 'the more you can afford to protect them'.

I will try to answer this question here.

Bodily Injury and Property Damage is what we are concerned about.

Bodily Injury
Let's say you injured Bill in a traffic accident.
You will have to pay bill for his pain, mental anguish, lost wages, loss of family time and more... Yes you will have to pay damages if Bill can't have sex with his wife for sometime!.... how much is she worth? His employer can also come after you for productivity loss.

Unfortunately if the worse was to come, it will all be settled by numbers.

So here's the question that comes next:

How much does a serious injury cost?
How much would it cost in case of a death?

Find below the US national average for 2006 per injured

Death$4,000,000
Incapacitating injury$201,100
Nonincapacitating evident injury$50,400
Possible injury$24,400
No injury$2,200

Property Damage Crash

$8,200
(Data from the National Safety Council nsc.org)

Remember, if there are 2, 3, 4, 5 people in the car, the costs will multiply and unfortunately not your coverage.
So you should adjust your coverage with the number of people usually in your car, and in the cars around you.

Also, remember that all this does not need to be covered only by a car insurance, you can buy a global 'liability' insurance that will cover you for liability with your cars, houses...
some $200-$300 for $1Million then $50 per additional million.

You may be safer inside an SUV/Pick-up, but you have 6 times more risk of killing others in the event of an accident. SUV/Pick-up don't handle as well as cars and are four times more likely to roll over.

Public transportations are the safest, 10 times!

Below is a table of the coverages that my insurance offers me. You can select the different options you want and see the total. In red is what I believe appropriate for someone in a case similar as mine.
I drive a 4 years old VW Passat, which I consider safe.
I park it in a safe neighboorhood.
I live in California, bay-area => the chances of hitting a Mercedes, Porshe or Lexus are pretty high: I need a good Property Damage coverage.

Bodily Injury
This pays for the people you injure and protect your assets from lawsuits

$15,000/$30,000
$61.1
$30,000/$60,000
$76.4
$50,000/$100,000
$82.5
$100,000/$200,000
$89.3
$100,000/$300,000
$92.3
$300,000/$300,000
$99.0
$300,000/$500,000
$102.1
$500,000/$750,000
$105.8
$500,000/$1,000,000
$107.2
$1,000,000/$1,000,000
$113.7
Uninsured Motorist
This pays if you are injured by an uninsured

$15,000/$30,000
$12.8
$20,000/$40,000
$15,0
$25,000/$50,000
$16.6
$30,000/$60,000
$17.9
$50,000/$100,000
$19.8
$100,000/$200,000
$26.8
$100,000/$300,000
$29.3
$300,000/$300,000
$34.4
$300,000/$500,000
$36.4
$500,000/$500,000
$39.5
Property Damage
This pays for cars and properties you damage and protect your assets

$5,000
$83.6
$10,000
$88.0
$15,000
$88.8
$20,000
$89.8
$25,000
$90.6
$50,000
$93.2
$100,000
$95.9
Comprehensive
This pays if you car gets damaged by theft or nature

N/A
$0
$1000 Ded.
$38.9
$500 Ded.
$43.5
$250 Ded.
$50.5
$200 Ded.
$55.2
$100 Ded.
$66.0
$50 Ded.
$77.6
$0 Ded.
$97.0
Collision
This pays for repair or replacement in case of an accident

N/A
$0
$1000 Ded.
$203
$1000 Ded./Waiver
$208.4
$500 Ded.
$223.4
$500 Ded./Waiver
$226.1
$250 Ded.
$324.9
$250 Ded./Waiver
$326.2
$200 Ded.
$345.3
$200 Ded./Waiver
$346.3
$150 Ded.
$365.6
$25 Ded.
$812.2
Rental Reimbursement
This pays for rental car while you car is repaired after a collision

N/A
$0
$25/Day, $750 Max
$8.8
$50/Day, $1,500 Max
$17.6
Medical Payments

$0
$0
$1000
$12.0
$2000
$17.4
$3000
$19.7
$4000
$20.9
$5000
$21.5
$7500
$25.1
$10000
$27.4
$25000
$38.8
Current Selection

Bodily Injury
Uninsured Motorist
Property Damage
Comprehensive
Collision
Rental Reimbursement
Medical Payments
Grand total

Hopefully this will help you drive without worrying.

Good Day!

Thursday, April 9, 2009

Don't want to see Ads on the web?

The easiest way is to use Firefox and install the "AdBlock" add-on
https://addons.mozilla.org/firefox/addon/1865
This works really well for me and no maintenance needed.
Surf lighter!

Monday, April 6, 2009

Removing unwanted or pay-per-view TV channels

Many of us have access to 100s of TV channels and of course our TV is not smart enough to not show us the channels we don't pay for. Every time you change channels and go over one of them, you're TV will freeze some 30 seconds, then display that you need to buy this channel in order to view it.

Which is true, but how frustrating. I'd rather have my TV only show me the channels I can see, and if it could also skip these advertising channels that would be a bliss.

This is actually possible and even simple, activate the parental control on your TV and set all these channels as 'restricted/adult only', now enjoy surfing through your TV channels.