Search This Blog

Wednesday, August 5, 2009

Curl's epsv broken when upload file via ftp.

Passive mode just wasn't good enough so engineering thought extended passive mode would fix something I had no clue was broken. However curl (the swiss army knife of moving web data around) didn't exactly implement it correctly.

To get the passive ftp uploads to work, you might have to use the
--disable-epsv
switch twice!!

curl --data-binary --disable-epsv --disable-epsv -v -u user123:mypasswd -T "myfile.tab" ftp://ftp.xyz.com/uploads/

Something is broke in curl's arg routine but this works for me. So try this if you're getting stuck with at "229 Entering Extended Passive Mode".

Thursday, July 30, 2009

Loading MySQL data via stdin

Here's a handy trick to put in a cron script to automate importing of data into mysql. As long as the tab delimited fields are in the same order as your mysql table columns, you can pipe data directly into it with LOAD DATA LOCAL INFILE '/dev/stdin'. This eliminates the need for an intermediary file - unless you're dealing with millions of rows, then a intermediary file might be neccessary.

/usr/bin/dump_customers | sed 's/abc/xyz/g' | mysql -u impy -pSeCrEt -e"use mydb; DELETE FROM customers; LOAD DATA LOCAL INFILE '/dev/stdin' REPLACE INTO TABLE customers FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n'"

I injected a simple sed search and replace in order to hotfix some data. Also note, that dates need to be in the format of YYYY-MM-DD.

Wednesday, February 4, 2009

The irony of our 44th President

I've heard this video was banned by NBC during the 2009 Superbowl commercials. It wouldn't surprise me. Now, this man pandered to Planned Parenthood in 2006 (see youtube for that appalling fundraiser speech). What's so sickening is that to Mr. Barack Hussein Obama a pregnant woman is not a mother. Since you're just a woman, you don't have a "mother's choice", you have a "woman's choice". He spins the words 'newborn baby' in a good light by giving "mothers" more than a 3 mo. maternity break. He fails to mention the 'unborn babies' in the other light. Obama's ideological argument is that abortions are needed for sustained resources for chosen people. His ideology is to allow women to kill their babies in order to avoid "a lifetime of struggle" and to increase her chance to receive the "same opportunities" as men. Obama briefly mentions that his church (Trinity - United Church of Christ) and others of faith can not ignore that "abstinence is an ideal but not reality". With his faith hat on, his argument for better education is admirable. But he doesn't keep this hat on and state the sinful nature of abortion. He is a master panderer. He's never pondered why 'two wrongs don't make a right'. He's purely bought into the legalized murder ideology. His "can't do / won't do" argument against the Bush administration is pure childishness. If you're a pro-life individual, the applause of that 2006 speech will sicken you. And the great irony of his pro-abortion stance is perfectly exemplified by this video - notice the smile. Sign. After a deep breathe, I'll still pray for the man and his like-minded agents. If I was on the left side of the abortion issue, I'd most certainly be rocked by John Piper's plea: http://www.youtube.com/watch?v=kdnQAB3cJec I don't think I could let that go unanswered - man up.

Thursday, January 15, 2009

DS Lite won't turn on - Loose Inductor

If you have a Nintendo DS Lite which charges but will not turn on and you hear something rattling inside, then it's probably a loose electronics part. It's a small cube that's black with two silver sides. This L2 inductor seems to be a frequent cause of dead Nintendo DS Lite units. The repetative depressing of the 'A' button seems to stress the board opposite of this small cube inductor which is located next to the power switch. Under a magnifing glass you should see glue residue on one side of the cube which gives you a clue as to which side goes down and in which direction. Like putting a broken ceramic piece back in place, try placing the inductor back in it's same orientation, as it will make a tight fit between the two broke L2 posts. Re-add a very tiny drop of clue to hold the inductor in place. Then do a quick touch-up of the solder points using your favorite gun - I used a Cold Heat soldering tool. User a pencil erase to firmly press down on the inducter before soldering - this will insure a better PCB contact. The DS should turn on once again. You can hold the battery in place manually to test it before putting it all back together. Note that you'll need a small tri-wing "security bit" screw driver. These are sold online by gaming shops but I would recommend Harbor Freight Tools to get your own precision screwdriver set.