Search This Blog

2010-11-30

A geneic vba ListBox with column titles

'START Adding column titles ==================================

list1.ColumnCount = objRecordSet.Fields.Count

i = 0
With Me.list1
.Clear
.AddItem
Dim j As Integer
Dim maxFieldsCount As Integer
maxFieldsCount = objRecordSet.Fields.Count - 1
' generic list box addition no column names !!!
For j = 0 To maxFieldsCount
.List(i, j) = objRecordSet.Fields(j).Name
Next

i = i + 1
End With
'STOP Adding column titles ==================================

'START Adding the row values =============================
If (objRecordSet.EOF = True) Then
FlagRecordsExist = True
Else
objRecordSet.MoveFirst
With Me.list1
Do
.AddItem
maxFieldsCount = objRecordSet.Fields.Count - 1
' generic list box addition no column names !!!
For j = 0 To maxFieldsCount
.List(i, j) = objRecordSet(j).Value
Next
i = i + 1
objRecordSet.MoveNext
Loop Until objRecordSet.EOF
End With
'STOP Adding the row values =============================
End If

2010-11-22

Принципи и поуки ...

Пореден номер Принцип или поука
1 Едно е да си баеш на себе си и на другите, второ да знаеш какво искаш , трето наистина да го искаш , четвърто е да знаеш как да го направиш , пето да можеш да го направиш , шесто е наистина да го направиш , седмо да не съжаляваш че си го направил 
2 Не си въобгъзявай. Правиж не само себе си , но и останалите на гъз. 
3 Не лъжи – така или иначе истината излиза наяве своевременно. 
4 Изправи се и горе главата. Не бъди надменен а горд. 
5 Мисли тук и сега и действай според реалността, но знай че успешното бъдеще иска стратегическо планиране. 
6 Не кради. Ако крадеш , значи не го заслужаваш. 
7 Ако не обичаш и пазиш себе си, няма да имаш сили да обичаш и пазиш хората които обичаш около себе си. 
8 Не е важно да спечелиш всяка една битка. Важното е да си победител във войната на живота 
9 Когато бързаш без да мислиш и си стесиран, малките препъни-камъчета правят големи поражения
10 Виртуалният свят оправлява физическия, но той е нищо като му дръпнат шалтера
11 Не бъди по-краставичар от краставичаря. Ако няма какво да кажеш си мълчи като индианец. Като мълчиш не ги гледай във очите. 
12 Черната овца никой не я обича както и да мечи или да се опитва да смени козината 
13 Сдраво тяло, здрав дух. Можеш да разбереш колко е безценно здравето чак като го изгубиш. 
14 Когато има междуособици във тима, не говори за личности а за обстоятелства и проблеми 
15 Не се критикувай пред останалите, още по-малко не повдигай темата за твоите грешки … 
16 Голмайсторите от чужбина ги търпят само докато правят голове, когато престанат ги ритат първи извън терена
17 В живота побеждават тези които могат и да губят
18 Една злоупотреба с алкохол може да ти струва от 15 дена до цял живот работа или дори живота. За наркотиците дори не си струва да се говори
19 Когато много ти се иска да кажеш нещо и да прекъснеш остананалите изчакай
20 Когато делегираш на някого нещо гледай да не започне да си прави каквото иска … а каквото трябва. 
21 Ако казваш на другите :“ Не прави каквото аз правя а прави каквото аз казвам“ си въобгъзяваш и правиш не само другите а и себе си на гъз … 
22 Защо пък трябва да се харесваш на останалите след като болшинството от тях така или иначе не те харесва
23 Дойде ли момент когато списъкът ти от задачи стане много голям, може да започеш да си задаваш въпроси
24 Когато лайната ти стигнат до устата , горе главата !!!
25 Ако си сигурен че като кажеш нещо на слушащите те няма да те разберат или ефекта ще бъде 0 въобще има ли смисъл да си отваряш устата 
26 С викане няма да стане. Колкото повече викаш толкова повече няма да стане !!! Рови се по-дълбоко в окопа и стискай менгемето … 
27 Започне някой да ти говори само неща които искаш да чуеш значи иска да ти продава нещо
28 Можеш да станеше лидер на нов успешен бизнес след разбереш възможността и убедиш хората които ще участват в него и действително го провеждаш така че всички да са доволни
29 Преди лайното да се удари във вентилатора започва да мирише … Помисли си докога има смисъл да стоиш във стаята на действието
30 Не показвай на другите без причина колкото си успял – завистта пречи при уреждането на взаимните работи
31 Ако някой ти губи времето разкарай го учтиво така че да не остане засегнат
32 Многото псувни и простотии и твърде цветистия език издават лъжеца и блъфьора
33 Когато съотборника ти се представи добре похвали го на всички и в никакъв случай не си предписвай неговите заслуги
34 Силата на участващите в разговора се разбира не по количеството на информацията изказана направо а по обема на неизказаното
35 Умението да мълчиш и слушаш когато другите говорят, е по-ценно от умението да говориш
36 If your actions inspire others to dream more, learn more, do more, and become more, you are a leader
37 Less is more
38 Щастието което човек може да получи от тялото си е като количеството вода в една чаша. Всички пороци изразват чашата само по-бързо. Лама Оле

2010-11-19

example perl script with default args and logging



use strict;
use warnings 'all';
use Archive::Tar;
 
my $DebugLevel = 3 ; 
print defined($ARGV[0]) ? $DebugLevel = $ARGV[0] : "Using max DebugLevel = $DebugLevel", " \n";
my $minimumAmountOfCommandLineArgs = 1 ; 
 
 
sub main 
{
logMsg("$0 SCRIPT START " , 1 );
#Action !!!    call here methods
checkCommandLineArgs();        
logMsg("$0 SCRIPT STOP " , 1 );
} #eof sub main
 
 
 
sub checkCommandLineArgs
{
 
if ( @ARGV != $minimumAmountOfCommandLineArgs )
{
logErrorMsg ( "Not enougn command line args supplied exit 1" , 1 );
die "usage: $0 1 args \n" ; 
exit 1 ; 
} #eof if
else 
{
foreach (@ARGV) { logMsg ( "$_ " ) ;  }
} #eof else         if ( @ARGV != 4 )
 
 
} #eof sub checkCommandLineArgs
 
#log a message according to the DebugLevel
sub logMsg 
{
my $msg = shift ;
my $importance = shift ; 
my $CurrentPerlScriptName = "$0" ; 
my $niceMonth = GetANiceMonth (); 
my $logFile = "$CurrentPerlScriptName" . '_' . "$niceMonth" .  '.log' ; 
$msg = GetANiceTime () .' --- ' .   $msg . " \n" ; 
if ( $importance == 1 ) 
{
$msg = "\n============================================================ \n" . $msg ; 
$msg = $msg . "============================================================ \n" ;
}
#debug nothing
if ( $DebugLevel == 0 ) {     return ; } 
#just print the message
if ( $DebugLevel == 1 ) 
{
print $msg 
} #eof if ( $DebugLevel == 1 ) 
 
#print the message in 
if ( $DebugLevel == 2 ) 
{
#READ ALL ROWS OF A FILE TO ALIST 
open (LOG, ">> $logFile") || print "could not open the \$logFile $logFile !!!\n"; 
print LOG $msg  ; 
close LOG;
}
 
#print the message in 
if ( $DebugLevel == 3 ) 
{
#READ ALL ROWS OF A FILE TO ALIST 
open (LOG, ">> $logFile") || print "could not open the \$logFile $logFile !!!\n"; 
print LOG $msg  ; 
close LOG;
print $msg ; 
} #eof if ( $DebugLevel == 3 ) 
 
 
} #eof sub logMsg 
 
#log a message according to the DebugLevel
sub logErrorMsg 
{
my $errorMsg = shift ; 
my $importance  = shift ; 
my $CurrentPerlScriptName = "$0" ; 
my $niceMonth = GetANiceMonth (); 
my $errorLogFile = "$CurrentPerlScriptName" . "_" .  "$niceMonth" . '.error.log' ; 
$errorMsg = GetANiceTime () .' --- ' .   $errorMsg . " \n" ; 
 
if ( $importance == 1 ) 
{
$errorMsg = "\n============================================================ \n" . $errorMsg ; 
$errorMsg= $errorMsg. "============================================================ \n" ;
}
 
#debug nothing
if ( $DebugLevel == 0 ) {     return ; } 
#just print the message
if ( $DebugLevel == 1 )  {         print $errorMsg ;     } 
 
#print the message in a error log file
if ( $DebugLevel == 2 ) 
{
#READ ALL ROWS OF A FILE TO ALIST 
open (ERRLOG, ">> $errorLogFile") || print "could not open the \$errorLogFile $errorLogFile !!!\n"; 
print ERRLOG $errorMsg ; 
close ERRLOG;
}
 
#print the message in 
if ( $DebugLevel == 3 ) 
{
#READ ALL ROWS OF A FILE TO ALIST 
open (ERRLOG, ">> $errorLogFile") || print "could not open the \$errorLogFile $errorLogFile !!!\n"; 
print ERRLOG $errorMsg  ; 
close ERRLOG;
print $errorMsg ; 
} #eof if ( $DebugLevel == 3 ) 
 
 
} #eof sub logErrorMsg 
 
 
#GET A NICE TIME 
sub GetANiceTime {
# Purpose: returns the time in yyyymmdd-format 
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); 
#---- change 'month'- and 'year'-values to correct format ---- 
$min = "0$min" if ($min < 10); 
$hour = "0$hour" if ($hour < 10);
$mon = $mon + 1;
$mon = "0$mon" if ($mon < 10); 
$year = $year + 1900;
$mday = "0$mday" if ($mday < 10); 
return "$year\.$mon\.$mday" . "-" . "$hour\:$min\:$sec"; 
} #eof sub GetANiceTime
 
 
sub GetANiceMonth {
# Purpose: returns the time in yyyymmdd-format 
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); 
#---- change 'month'- and 'year'-values to correct format ---- 
$mon = $mon + 1;
$mon = "0$mon" if ($mon < 10); 
$year = $year + 1900;
return "$year\.$mon" ; 
} #eof sub GetANiceTime
 
 
#Action !!!
main(); 
 
1 ; 
 
__END__
 
 
#Version
#1.0.20101117_110231 --- Yordan Georgiev --- Initial version , copy from Net + args passing 
#1.1.20101118_093059 --- Yordan Georgiev --- Added (error)logging according to DebugLevel 

2010-11-17

My favorite Unix command

rm -Rf /path/to/dir/toRemove/Without/Prompt/Recursively

2010-11-16

Vb sucks !!! Read at the end of the post why ...



Private Sub butRunSelectAll_Click()
'Declare variables'
Dim objConn As ADODB.Connection
Dim objCmd As ADODB.Command
Dim objRecordset As ADODB.Recordset
 
Set objConn = New ADODB.Connection
Set objCmd = New ADODB.Command
Set objRecordset = New ADODB.Recordset
 
'Open Connection'
objConn.ConnectionString = "Provider=SQLOLEDB;Data Source=localhost\POC_QA;Initial Catalog=poc;User ID=user;Password=secretpass;"
objConn.Open
 
'Set and Excecute SQL Command'
Set objCmd.ActiveConnection = objConn
objCmd.CommandText = "select * from POC_DEV.dbo.Project_tb"
objCmd.CommandType = adCmdText
 
'Open Recordset'
Set objRecordset.Source = objCmd
objRecordset.Open
 
'Copy Data to Excel'
ActiveSheet.Range("A1").CopyFromRecordset objRecordset
End Sub
 
 
 
Private Sub butRunProc_Click()
 
'Declare variables'
Dim objConn As ADODB.Connection
Dim objCmd As ADODB.Command
Dim objRecordset As ADODB.Recordset
 
Set objConn = New ADODB.Connection
Set objCmd = New ADODB.Command
Set objRecordset = New ADODB.Recordset
 
'Open Connection'
objConn.ConnectionString = "Provider=SQLOLEDB;Data Source=localhost\POC_QA;Initial Catalog=CAS_DEV;User ID=user;Password=secretpass;"
objConn.Open
 
'Set and Excecute SQL Command'
Set objCmd.ActiveConnection = objConn
'We are going to use a stored procedure
objCmd.CommandType = adCmdStoredProc
'Add an Input parameter NOTE THE EMPTY ' ' !!!
objCmd.Parameters.Append objCmd.CreateParameter("@UserSessionId", adBigInt, adParamInput, , 12)
'Add an InOut parameter Note again no Size just an empty , ,
objCmd.Parameters.Append objCmd.CreateParameter("@Ret", adInteger, adParamInputOutput, , 1)
'Specify the name of the stored procedure
objCmd.CommandText = "procReport_Bug_SelectAll1"
'Action !!!
objCmd.Execute
 
'Open Recordset'
Set objRecordset.Source = objCmd
objRecordset.Open
 
'Copy Data to Excel'
ActiveSheet.Range("A1").CopyFromRecordset objRecordset
 
 
End Sub 'butRunProc_Click()
 
Private Sub TextBox1_Change()
 
End Sub
 
Private Sub UserForm_Click()
 
End Sub

Because every idiot could start writing spageti code like this after some 2 days of practice and start thinking that he / she is a real programmer hence the amount of data that could be transfered between the sql and the Excel !!!

2010-11-06

how-to convert an Excel file into multiple html files by worksheets

Download the whole thingy from here



 
START ===== D:\perl\sfw\ExcelToHtml\ExcelToHtml.pl
use Spreadsheet::ParseExcel;
use strict;
 
package ExcelToHtml ; 
 
sub main {
 
my $ExcelFileToParse = "$ARGV[0]" ; 
my $OutputDir="$ARGV[1]" ;
 
my $BaseFileName = $ExcelFileToParse ; 
print "\$BaseFileName is $BaseFileName \n" ; 
$BaseFileName =~ s/^(.*)(\\|\/)(.*)/$3/;    #strip the directory part 
print "\$BaseFileName is $BaseFileName \n" ; 
$BaseFileName =~ s/^(.*)(\.)(.*)/$1/ ;     #strip the file extension
print "\$BaseFileName is $BaseFileName \n" ; 
 
ParseExcelAndPrintFiles ( $ExcelFileToParse  , $BaseFileName , $OutputDir) ; 
 
 
}
 
 
sub ParseExcelAndPrintFiles {
my $ExcelFileToParse = shift ; 
my $BaseFileName = shift ; 
my $OutputDir = shift ; 
my $strToReturn = "";
 
my $parser   = Spreadsheet::ParseExcel->new();
my $workbook = $parser->Parse("$ExcelFileToParse");
 
for my $worksheet ( $workbook->worksheets() ) {
 
my ( $row_min, $row_max ) = $worksheet->row_range();
my ( $col_min, $col_max ) = $worksheet->col_range();
 
for my $row ( $row_min .. $row_max ) {
for my $col ( $col_min .. $col_max ) {
 
my $cell = $worksheet->get_cell( $row, $col );
next unless $cell;
 
print " Row, Col    = ($row, $col)\n";
print " Value = ", $cell->value() ;                #The Value
$strToReturn .=  makeCell($cell->value() )      ;                #The Value
print "Unformatted = ", $cell->unformatted(), "\n";
}
$strToReturn = makeRow( $strToReturn ); 
} #eof for my row
 
my $worksheetName = $worksheet->{'Name'}  ; 
my $FileToPrint = "$OutputDir/$BaseFileName" .  '.' . $worksheetName . '.' . 'html' ; 
print "\$FileToPrint  is $FileToPrint  \n" ; 
$strToReturn = makeTable ( $strToReturn );
$strToReturn = makeFile ( $strToReturn );
print "\$strToReturn  is $strToReturn  \n" ; 
PrintToFile ( $FileToPrint , $strToReturn ) ; 
$strToReturn = "" ;
$FileToPrint = "" ;
} #eof for my worksheet
 
} #eof sub
 
sub PrintToFile {
my $FileOutput = shift ; 
my $StringToPrint = shift ; 
#READ ALL ROWS OF A FILE TO ALIST 
open (FILEOUTPUT, ">$FileOutput") || 
print "could not open the \$FileOutput $FileOutput!\n"; 
print  FILEOUTPUT $StringToPrint ; 
close FILEOUTPUT ;
 
#debug $strToReturn .=  $StringToPrint; 
 
}
# =========================================== eof sub PrintToFile
 
sub trim    
{
$_[0]=~s/^\s+//;
$_[0]=~s/\s+$//;
return $_[0];
}
 
# =========================================== eof sub trim 
# Action !!!
 
 
 
sub makeRow 
{
my $row = shift ; 
return "<tr> $row </tr> \n" ; 
}
 
sub makeCell 
{
my $cell = shift ; 
return "<td> $cell </td> " ; 
}
 
sub makeTable
{
my $table = shift ; 
return "<table> $table </table> " ; 
}
 
sub makeFile
{
my $file = shift ; 
$file = "<html> <head></head><body> $file </body></html>\n" ; 
return $file ; 
}
 
 
main();
 
 
 
 
1 ; 
 
__END__ 
END ================== D:\perl\sfw\ExcelToHtml\ExcelToHtml.pl
. 
START ===== D:\perl\sfw\ExcelToHtml\ExcelToHtml.cmd
@echo off  
ECHO %0 > %0.log
ECHO %0.error.log >%0.error.log
 
set BaseDir=D:\perl\sfw\ExcelToHtml
echo BaseDir is %BaseDir%  1>>%0.log 2>>%0.error.log
ECHO.
 
 
set ExcelFileToParse="%BaseDir%\TODO.xls"
echo ExcelFileToParse is %ExcelFileToParse%  1>>%0.log 2>>%0.error.log
echo.
 
set OutputDir=%BaseDir%
echo OutputDir is %Outputdir%  1>>%0.log 2>>%0.error.log
echo.
 
::set PerlScript=parseExcelToCsv.pl
set PerlScript=ExcelToHtml.pl
echo PerlScript is %PerlScript%  1>>%0.log 2>>%0.error.log
ECHO.
 
 
echo Action !!!  1>>%0.log 2>>%0.error.log
echo perl %BaseDir%\%PerlScript% %ExcelFileToParse% %OutputDir%  1>>%0.log 2>>%0.error.log
perl %BaseDir%\%PerlScript% %ExcelFileToParse% %OutputDir% 1>>%0.log 2>>%0.error.log
 
%0.error.log
%0.log
 
::debug pause
 
END ================== D:\perl\sfw\ExcelToHtml\ExcelToHtml.cmd

how-to parse excel file in perl



 
START ===== D:\perl\sfw\csv\tmp\parseExcelToCsv.cmd
@echo off  
ECHO %0 > %0.log
ECHO %0.error.log >%0.error.log
 
set BaseDir=D:\perl\sfw\csv
echo BaseDir is %BaseDir%  1>>%0.log 2>>%0.error.log
ECHO.
 
 
set ExcelFileToParse="parse.xls"
echo ExcelFileToParse is %ExcelFileToParse%  1>>%0.log 2>>%0.error.log
echo.
 
set OutputDir=D:\perl\sfw\csv
echo OutputDir is %Outputdir%  1>>%0.log 2>>%0.error.log
echo.
 
::set PerlScript=parseExcelToCsv.pl
set PerlScript=parseExcelToCsv.2.0.pl
echo PerlScript is %PerlScript%  1>>%0.log 2>>%0.error.log
ECHO.
 
::This is the ASCII number of the token delimiter to use in the csv file
set TokenDelimiterAsciiNumber=44
echo TokenDelimiterAsciiNumber is %TokenDelimiterAsciiNumber%  1>>%0.log 2>>%0.error.log
 
 
::This is the ASCII number of the token delimiter to use in the csv file
set RowEndAsciiNumber=13
echo RowEndAsciiNumber is %RowEndAsciiNumber% %RowEndAsciiNumber% 1>>%0.log 2>>%0.error.log
 
 
echo Action !!!  1>>%0.log 2>>%0.error.log
echo perl %BaseDir%\%PerlScript% %ExcelFileToParse% %OutputDir% %TokenDelimiterAsciiNumber% %RowEndAsciiNumber% 1>>%0.log 2>>%0.error.log
perl %BaseDir%\%PerlScript% %ExcelFileToParse% %OutputDir% %TokenDelimiterAsciiNumber% %RowEndAsciiNumber% 1>>%0.log 2>>%0.error.log
 
%0.error.log
%0.log
 
::debug pause
 
 
END ================== D:\perl\sfw\csv\tmp\parseExcelToCsv.cmd
 
. 
START ===== D:\perl\sfw\csv\tmp\parseExcelToCsv.2.0.pl
use Spreadsheet::ParseExcel;
use strict;
 
package parseExcelToCsv ; 
 
sub main {
 
my $ExcelFileToParse = "$ARGV[0]" ; 
my $OutputDir="$ARGV[1]" ;
my $delimiter = chr($ARGV[2]);
my $rowEnd = chr($ARGV[3]);
 
print "\$delimiter is $delimiter \n" ; 
print "\$rowEnd is $rowEnd \n" ; 
 
$ExcelFileToParse =~m/^.*(\\|\/)(.*)/; # strip the remote path and keep the filename
my $FileToPrint = $ExcelFileToParse ; 
$FileToPrint =~ s/^(.*)(\.)(.*)/$1/ ;     #strip the file extension
$FileToPrint .= ".csv" ;         #add the acsv file t extension 
$FileToPrint = "$OutputDir/$FileToPrint";         #add the directory in front ... 
 
my $strToPrint = ParseExcel ( $ExcelFileToParse  , $delimiter , $rowEnd) ; 
PrintToFile( $FileToPrint , $strToPrint )  ;
 
print $strToPrint ; 
}
 
 
sub ParseExcel {
my $ExcelFileToParse = shift ; 
my $delimiter = shift ; 
my $rowEnd = shift ; 
my $strToReturn = "";
 
my $parser   = Spreadsheet::ParseExcel->new();
my $workbook = $parser->Parse("$ExcelFileToParse");
 
for my $worksheet ( $workbook->worksheets() ) {
 
my ( $row_min, $row_max ) = $worksheet->row_range();
my ( $col_min, $col_max ) = $worksheet->col_range();
 
for my $row ( $row_min .. $row_max ) {
for my $col ( $col_min .. $col_max ) {
 
my $cell = $worksheet->get_cell( $row, $col );
next unless $cell;
 
print " Row, Col    = ($row, $col)\n";
print " Value = ", $cell->value() ;                #The Value
$strToReturn .=  $cell->value() . $delimiter       ;                #The Value
print "Unformatted = ", $cell->unformatted(), "\n";
 
}
chop ($strToReturn) ; #remove the latest delimiter
$strToReturn .= $rowEnd ;     #end the row    
}
}
return $strToReturn ; 
} #eof sub
 
sub PrintToFile {
my $FileOutput = shift ; 
my $StringToPrint = shift ; 
#READ ALL ROWS OF A FILE TO ALIST 
open (FILEOUTPUT, ">$FileOutput") || 
print "could not open the \$FileOutput $FileOutput!\n"; 
print  FILEOUTPUT $StringToPrint ; 
close FILEOUTPUT ;
 
#debug $strToReturn .=  $StringToPrint; 
 
}
# =========================================== eof sub PrintToFile
 
sub trim    
{
$_[0]=~s/^\s+//;
$_[0]=~s/\s+$//;
return $_[0];
}
 
# =========================================== eof sub trim 
# Action !!!
 
 
 
main();
 
 
 
 
1 ; 
 
__END__ 
END ================== D:\perl\sfw\csv\tmp\parseExcelToCsv.2.0.pl
 

ascii table





































































0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 !
34 "
35 #
36 $
37 %
38 &
39 '
40 (
41 )
42 *
43 +
44 ,
45 -
46 .
47 /
48 0
49 1
50 2
51 3
52 4
53 5
54 6
55 7
56 8
57 9
58 :
59 ;
60 <
61 =
62 >
63 ?
64 @
65 A
66 B
67 C
68 D
69 E
70 F
71 G
72 H
73 I
74 J
75 K
76 L
77 M
78 N
79 O
80 P
81 Q
82 R
83 S
84 T
85 U
86 V
87 W
88 X
89 Y
90 Z
91 [
92 \
93 ]
94 ^
95 _
96 `
97 a
98 b
99 c
100 d
101 e
102 f
103 g
104 h
105 i
106 j
107 k
108 l
109 m
110 n
111 o
112 p
113 q
114 r
115 s
116 t
117 u
118 v
119 w
120 x
121 y
122 z
123 {
124 |
125 }
126 ~
127 

perl ascii table generator caller

Copy the public link


@echo off
ECHO %0 > %0.log
ECHO %0.error.log >%0.error.log

set BaseDir=D:\perl\sfw\csv
echo BaseDir is %BaseDir% 1>>%0.log 2>>%0.error.log
ECHO.



set OutputDir=D:\perl\sfw\csv
echo OutputDir is %Outputdir% 1>>%0.log 2>>%0.error.log
echo.


set PerlScript=printAscii.pl
echo PerlScript is %PerlScript% 1>>%0.log 2>>%0.error.log
ECHO.

echo Action !!! 1>>%0.log 2>>%0.error.log
echo running : %BaseDir%\%PerlScript% 1>>%0.log 2>>%0.error.log
perl %BaseDir%\%PerlScript% 1>>%0.log 2>>%0.error.log

%0.error.log
%0.log

::debug pause

perl ascii html table generator



use strict ; 
package printAscii ; 
 
sub main 
{
my $table = "" ; 
my $html = "" ; 
for ( my $i = 0 ; $i< 128 ; $i ++ ) 
{
print "\$i is $i \n" ; 
my $row = makeCell ( $i ) . makeCell (chr($i)) ; 
$row = makeRow($row);
$table .= $row ; 
} #eof for
$table = makeTable ($table ) ; 
print $table ; 
$html = makeHtml ( $table ) ; 
PrintToFile ( "ascii.html" , $html ) ; 
 
 
 
} #eof main 
 
sub makeRow 
{
my $row = shift ; 
return "<tr> $row </tr> \n" ; 
}
 
sub makeCell 
{
my $cell = shift ; 
return "<td> $cell </td> " ; 
}
 
sub makeTable
{
my $table = shift ; 
return "<table> $table </table> " ; 
}
 
sub makeHtml 
{
my $html = shift ; 
$html = "<html> <head></head><body> $html </body></html>\n" ; 
 
}
 
sub PrintToFile {
my $FileOutput = shift ; 
my $StringToPrint = shift ; 
open (FILEOUTPUT, ">$FileOutput") || 
print "could not open the \$FileOutput $FileOutput!\n"; 
print  FILEOUTPUT $StringToPrint ; 
close FILEOUTPUT ;
 
} #eof sub
# =========================================== eof sub PrintToFile
 
#Action !!!
main();
 
 
1 ; 
 
__END__

2010-11-05

how-to check column meta data in mssql server



SELECT ' Returns whether or not the column''s nullability is set to allow null values'  
SELECT (CASE COLUMNPROPERTY(OBJECT_ID('Task'), 'TaskId', 'AllowsNull') WHEN 1 THEN 'True' ELSE 'False' END) AS 'AllowsNull'
SELECT ' Returns whether or not the column is computed with the values of one or more columns'  
SELECT (CASE COLUMNPROPERTY(OBJECT_ID('Task'), 'TaskId', 'IsComputed') WHEN 1 THEN 'True' ELSE 'False' END) AS 'IsComputed'
SELECT ' Returns whether or not the parameter is of data type cursor'  
SELECT (CASE COLUMNPROPERTY(OBJECT_ID('Task'), 'TaskId', 'IsCursorType') WHEN 1 THEN 'True' ELSE 'False' END) AS 'IsCursorType'
SELECT ' Returns whether or not a computed column is deterministic.'  
SELECT (CASE COLUMNPROPERTY(OBJECT_ID('Task'), 'TaskId', 'IsDeterministic') WHEN 1 THEN 'True' ELSE 'False' END) AS 'IsDeterministic'
SELECT ' Returns whether or not the column is used in full-text indexing'  
SELECT (CASE COLUMNPROPERTY(OBJECT_ID('Task'), 'TaskId', 'IsFulltextIndexed') WHEN 1 THEN 'True' ELSE 'False' END) AS 'IsFulltextIndexed'
SELECT ' Returns whether or not the column has its Identity attribute set for automatic numbering'  
SELECT (CASE COLUMNPROPERTY(OBJECT_ID('Task'), 'TaskId', 'IsIdentity') WHEN 1 THEN 'True' ELSE 'False' END) AS 'IsIdentity'
SELECT ' Returns whether or not an identity column''s values should be re-seeded during replication or replicated with the explicit values of the column'  
SELECT (CASE COLUMNPROPERTY(OBJECT_ID('Task'), 'TaskId', 'IsIdNotForRepl') WHEN 1 THEN 'True' ELSE 'False' END) AS 'IsIdNotForRepl'
SELECT ' Returns whether or not the column can be indexed'  
SELECT (CASE COLUMNPROPERTY(OBJECT_ID('Task'), 'TaskId', 'IsIndexable') WHEN 1 THEN 'True' ELSE 'False' END) AS 'IsIndexable'
SELECT ' Returns whether or not a stored procedure parameter is an output parameter'  
SELECT (CASE COLUMNPROPERTY(OBJECT_ID('Task'), 'TaskId', 'IsOutParam') WHEN 1 THEN 'True' ELSE 'False' END) AS 'IsOutParam'
SELECT ' The column is precise (deterministic columns only)'  
SELECT (CASE COLUMNPROPERTY(OBJECT_ID('Task'), 'TaskId', 'IsPrecise') WHEN 1 THEN 'True' ELSE 'False' END) AS 'IsPrecise'
SELECT ' Returns whether or not a column is of data type uniqueidentifier and has its ROWGUID property set'  
SELECT (CASE COLUMNPROPERTY(OBJECT_ID('Task'), 'TaskId', 'IsRowGuidCol') WHEN 1 THEN 'True' ELSE 'False' END) AS 'IsRowGuidCol'
SELECT ' Returns the precision for a column or parameter'  
SELECT (CASE COLUMNPROPERTY(OBJECT_ID('Task'), 'TaskId', 'Precision') WHEN 1 THEN 'True' ELSE 'False' END) AS 'Precision'
SELECT ' Returns the scale for a column or parameter'  
SELECT (CASE COLUMNPROPERTY(OBJECT_ID('Task'), 'TaskId', 'Scale') WHEN 1 THEN 'True' ELSE 'False' END) AS 'Scale'
SELECT ' Returns whether or not the SQL-92 ANSI padding setting was on when the table was created'  
SELECT (CASE COLUMNPROPERTY(OBJECT_ID('Task'), 'TaskId', 'UsesAnsiTrim') WHEN 1 THEN 'True' ELSE 'False' END) AS 'UsesAnsiTrim'

John Underkoffler points to the future of UI



Labels

perl (41) Cheat Sheet (25) how-to (24) sql server 2008 (13) windows (13) linux (12) oracle (12) sql (12) Unix (11) cmd windows batch (10) mssql (10) cmd (9) script (9) textpad (9) netezza (8) sql server 2005 (8) cygwin (7) meta data mssql (7) metadata (7) code generation (6) Informatica (5) bash (5) cheatsheet (5) energy (5) tsql (5) utilities (5) excel (4) future (4) generic (4) html (4) perl modules (4) programs (4) settings (4) sh (4) shortcuts (4) поуки (4) принципи (4) Focus Fusion (3) Solaris (3) cool programs (3) development (3) economy (3) example (3) freeware (3) fusion (3) git cheat sheet (3) morphus (3) mssql 2005 (3) nuclear (3) nz (3) parse (3) python (3) sftp (3) sofware development (3) source (3) sqlplus (3) table (3) vim (3) .Net (2) C# (2) China (2) GUI (2) Google (2) GoogleCL (2) Solaris Unix (2) ascii (2) awk (2) batch (2) cas (2) chrome extensions (2) code2html (2) columns (2) configuration (2) conversion (2) duplicates (2) excel shortcuts (2) export (2) file (2) free programs (2) informatica sql repository (2) logging (2) mssql 2008 (2) mysql (2) next big future (2) nsis (2) nz netezza cheat sheet (2) nzsql (2) ora (2) prediction (2) publish (2) release management (2) report (2) security (2) single-click (2) sqlserver 2005 (2) sqlserver 2008 (2) src (2) ssh (2) template (2) tools (2) vba (2) video (2) xlt (2) xml (2) youtube videos (2) *nix (1) .vimrc (1) .virmrc vim settings configs (1) BSD license (1) Bulgaria (1) Dallas (1) Database role (1) Dense plasma focus (1) Deployment (1) ERP (1) ExcelToHtml (1) GD (1) GDP (1) HP-UX (1) Hosting (1) INC (1) IT general (1) ITIL management bullshit-management (1) IZarc (1) Java Web Start (1) JavaScript anchor html jquery (1) Khan Academy (1) LINUX UNIX BASH AND CYGWIN TIPS AND TRICKS (1) Linux Unix rpm cpio build install configure (1) Linux git source build .configure make (1) ListBox (1) MIT HYDROGEN VIRUS (1) OO (1) Obama (1) PowerShell (1) Run-time (1) SDL (1) SIWA (1) SOX (1) Scala (1) Services (1) Stacks (1) SubSonic (1) TED (1) abstractions (1) ansible hosts linux bash (1) ansible linux deployment how-to (1) ansible yum pip python (1) apache (1) apache 2.2 (1) application life cycle (1) architecture (1) archive (1) arguments (1) avatar (1) backup (1) bash Linux open-ssh ssh ssh_server ssh_client public-private key authentication (1) bash perl search and replace (1) bash stub (1) bin (1) biofuels (1) biology (1) books (1) browser (1) bubblesort (1) bugs (1) build (1) byte (1) cas_sql_dev (1) chennai (1) chrome (1) class (1) claut (1) cmdow (1) code generation sqlserver (1) command (1) command line (1) conf (1) confluence (1) console (1) convert (1) cool programs windows free freeware (1) copy-paste (1) csv (1) ctags (1) current local time (1) cygwin X11 port-forwarding mintty xclock Linux Unix X (1) cygwin bash how-to tips_n_tricks (1) cygwin conf how-to (1) data (1) data types (1) db2 cheat sheet (1) db2 starter ibm bash Linux (1) debt (1) diagram (1) dictionaries (1) digital (1) disk (1) disk space (1) documentation (1) dos (1) dubai (1) e-cars (1) electric cars (1) electricity (1) emulate (1) errors (1) exponents (1) export workflow (1) extract (1) fast export (1) fexp (1) file extension (1) file permissions (1) findtag (1) firewall (1) for loop (1) freaky (1) functions (1) fusion research (1) german (1) git gitlab issues handling system (1) google cli (1) google code (1) google command line interface (1) gpg (1) ha (1) head (1) helsinki (1) history (1) hop or flop (1) host-independant (1) how-to Windows cmd time date datetime (1) ibm db2 cognos installation example db deployment provisioning (1) ideas (1) image (1) informatica oracle sql (1) informatica repo sql workflows sessions file source dir (1) informatica source files etl (1) install (1) it management best practices (1) java (1) jump to (1) keyboard shortcuts (1) ksh (1) level (1) linkedin (1) linux bash ansible hosts (1) linux bash commands (1) linux bash how-to shell expansion (1) linux bash shell grep xargs (1) linux bash tips and t ricks (1) linux bash unix cygwin cheatsheet (1) linux bash user accounts password (1) linux bash xargs space (1) linux cheat sheet (1) linux cheat-sheet (1) linux cheatsheet cheat-sheet revised how-to (1) linux how-to non-root vim (1) linux ssh hosts parallel subshell bash oneliner (1) london (1) make (1) me (1) metacolumn (1) metadata functions (1) metaphonre (1) method (1) model (1) movie (1) multithreaded (1) mysql cheat sheet (1) mysql how-to table datatypes (1) n900 (1) nano (1) neteza (1) netezza bash linux nps (1) netezza nps (1) netezza nps nzsql (1) netezza nz Linux bash (1) netezza nz bash linux (1) netezza nz nzsql sql (1) netezza nzsql database db sizes (1) non-password (1) nord pol (1) nps backup nzsql schema (1) number formatting (1) nz db size (1) nz table count rows (1) nzsql date timestamp compare bigint to_date to_char now (1) on-lier (1) one-liners (1) one-to-many (1) oneliners (1) open (1) open source (1) openrowset (1) oracle PL/SQL (1) oracle Perl perl (1) oracle installation usability (1) oracle number formatting format-model ora-sql oracle (1) oracle templates create table (1) oracle trigger generic autoincrement (1) oracle vbox virtual box cheat sheet (1) oracle virtual box cheat sheet (1) outlook (1) parser (1) password (1) paths (1) perl @INC compile-time run-time (1) perl disk usage administration Linux Unix (1) perl modules configuration management (1) permissions (1) php (1) picasa (1) platform (1) postgreSQL how-to (1) powerShell cmd cygwin mintty.exe terminal (1) ppm (1) predictions (1) prices (1) principles (1) productivity (1) project (1) prompt (1) proxy account (1) public private key (1) publishing (1) putty (1) qt (1) read file (1) registry (1) relationship (1) repository (1) rm (1) scp (1) scripts (1) scsi (1) search and replace (1) sed (1) sendEmail (1) sh stub (1) shortcuts Windows sql developer Oracle (1) sidebar (1) silicon (1) smtp (1) software procurement (1) sofware (1) sort (1) sql script (1) sql_dev (1) sqlcmd (1) sqlite (1) sqlite3 (1) sshd (1) sshd cygwin (1) stackoverflow (1) stored procedure (1) stub (1) stupidity (1) subroutines (1) svn (1) sysinternals (1) tail (1) tar (1) temp table (1) templates (1) teradata (1) terminal (1) test (1) testing (1) theory (1) thorium (1) time (1) tip (1) title (1) tmux .tmux.conf configuration (1) tmux efficiency bash (1) tool (1) ui code prototyping tips and tricks (1) umask Linux Unix bash file permissions chmod (1) url (1) urls (1) user (1) utility (1) utils (1) vb (1) vim perl regex bash search for string (1) vim recursively hacks (1) vim starter (1) vim-cheat-sheet vim cheat-sheet (1) vimeo (1) visual stuio (1) warsaw (1) wiki (1) wikipedia (1) window (1) windows 7 (1) windows 8 (1) windows programs (1) windows reinstall (1) windows utility batch perl space Windows::Clipboard (1) wisdoms (1) workflow (1) worth-reading (1) wrapper (1) xp_cmdshell (1) xslt (1) youtube (1)

Blog Archive

Translate with Google Translate

My Blog List

VideoBar

This content is not yet available over encrypted connections.