Tuesday

Duplicate filename:7z:creating archive files from list

you have list of files from differen folders in text file.

To create zip archive use this command:
"c:\Program Files\7-Zip\7z.exe" a  -tzip archive.zip  @c:\listfile.txt

when you get error Duplicate filename:  because of file with the same name in different folders, remove drive name  from list file.


Sunday

System.Data.StrongTypingException

to fix this exception in strong-type dataset use method IsNull method before reading value to avoid this exception.

in C# it will be like :
if (!logins[0].Isincorrect_attempt_dateNull())
{
 incor_pass_hours_ago = DateTime.Now.Subtract((DateTime)logins[0].incorrect_attempt_date).TotalHours;
}


fix "SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM."

Use System.Data.SqlTypes.SqlDateTime.MinValue.Value  insted DateTime.MinValue and System.Data.SqlTypes.SqlDateTime.MaxValue.Value instead DateTime.MinValue.


Saturday

to transfer file by pscp (putty scp) to sftp (secured ftp) server:

source file: source1.txt
server ip : 61.155.5.15
server shh port : 2222
destination file:d\target1.txt

command line: 
pscp  -l al -P 2222 source1.txt user@67.155.5.15:d\target1.txt

pscp help:

PuTTY Secure Copy client
Release 0.57
Usage: pscp [options] [user@]host:source target
       pscp [options] source [source...] [user@]host:target
       pscp [options] -ls [user@]host:filespec
Options:
  -p        preserve file attributes
  -q        quiet, don't show statistics
  -r        copy directories recursively
  -v        show verbose messages
  -load sessname  Load settings from saved session
  -P port   connect to specified port
  -l user   connect with specified username
  -pw passw login with specified password
  -1 -2     force use of particular SSH protocol version
  -C        enable compression
  -i key    private key file for authentication
  -batch    disable all interactive prompts
  -unsafe   allow server-side wildcards (DANGEROUS)
  -V        print version information
  -sftp     force use of SFTP protocol
  -scp      force use of SCP protocol


Wednesday

python post example



from httplib2 import Http
from urllib import urlencode

url = 'http://de.gigajob.com/req.ax'
#body = {'USERNAME': 'foo', 'PASSWORD': 'bar'}
#headers = {'Content-type': 'application/x-www-form-urlencoded'}
body={'xajax':'ajax_get_sgd_html_display' ,'xajaxargs':'<xjxobj><e><k>searchword</k><v>C%23</v></e><e><k>zip</k><v></v></e><e><k>adtype</k><v>offer</v></e><e> <k>distance</k><v>25</v></e><e><k>country</k><v>all</v></e><e><k>language</k><v>de</v></e><e><k>page</k><v>1</v></e><e><k>sort</k><v>age</v></e><e><k>location</k><v></v></e><e><k>age</k><v>999</v></e></xjxobj>' ,'xajaxargs':'1' ,'xajaxargs':'1' ,'xajaxr':'1234400546535'}
h = Http()
response, content = h.request(url,'POST',urlencode(body))
print response
print content


more...

Friday

easy_install.exe for Python 2.6 on Windows

get ez_setup.py and setuptools-0.6c9-py2.6.egg.
type: python ez_setup.py setuptools-0.6c9-py2.6.egg and that should get setuptools installed.
2. Now that you have setuptools installed, in your Python 2.6 directory there is a directory called Scripts. If you go to that directory (C:\Python26\Scripts on the systems I worked on) you’ll see easy_install.exe.

imagemagic add text to image

rem different types of text annotations on existing images rem cyan yellow orange gold rem -gravity SouthWest rem draw text and anno...