Sep 19, 2013

Syncing Photos/Videos from iPhone to Computer

This is a little off topic in the blog and the post after a long time, however i had trouble getting my photos and videos from my iphone to my laptop.

Here is how i was able to finally find it myself after tried so many options,


  • Connect your iphone to your computer, Windows7 in my case.
  • Go to My Computer/Computer.
  • You should see the iPhone under portable devices or Cameras.
  • Right click on iphone and click on Import Pictures and Videos




In MyComputer

  • Then Import
  • Click on Delete post import to clean up your iphone to free up space.

Hope this helps. 

Cheers

Oct 12, 2011

malformed header from script. - CGI Bash

A CGI bash script will throw error as malformed header from script. in the web server error log when the content is not spaced, To eliminate this error give a empty line/newline after content.

#!/bin/bash
echo "Content-type: text/html"
echo
the log may look like this,
[Tue Oct 11 14:09:42 2011] [error] [client 172.16.32.215] malformed header from script. Bad header=TEST: test.html

Sep 25, 2011

Locking windows xp/vista in command line

Found this command when i tried to lock my remote PC (xp), its useful when you need to lock your VM or remote desktops. 

rundll32.exe user32.dll, LockWorkStation


Note: this is case sensitive, otherwise will give dll errors.

May 10, 2011

Create full format Excel file from bash scripts

This post shows how I managed to create a excel output with all the bells and whistles of the MS Excel such as merging, colors on the tables and etc.
Open your excel sheet if you have already or make a template of your needed output format.
 



Save it as XML Spreadsheet 2003 .xml format in your drive.





Ignore the following pop up and hit Yes.

 


Open the saved xml with your favorite editor, in my case Notepad++.
 


Now you can see your data filled inside <Table> tag. you can simply parse the data from your real output and replce the start and end with these Tags " <Cell ss:StyleID="s62"><Data ss:Type="Number">" and "</Data></Cell>" then write the whole data in a excel file (something.xls). In my case i have parsed a file for the numbers output and replced the start and end with the xml tags.

Eg: grep "Selected Period" PV.html|sed -ne 's/^.*Selected Period\([^T]*\).*$/\1/p'| sed 's/\\//g;s/nt*//g;s/\///g;s/\&bsp;//g;s/<[^>]*>/\n/g'|sed 's/[0-9]\.//g;s/^ //g;/^$/d;/[a-z].*/d;s/^/\<Cell ss\:StyleID="s112"\>\<Data ss\:Type="Number"\>/g;s/$/\<\/Data\>\<\/Cell\>/g' > opv.dat




Hope this helps to create an excel from Bash.

Happy Scripting.
Deva.