avik's Journal http://use.perl.org/~avik/journal/ avik's use Perl Journal en-us use Perl; is Copyright 1998-2006, Chris Nandor. Stories, comments, journals, and other submissions posted on use Perl; are Copyright their respective owners. 2012-01-25T02:27:48+00:00 pudge pudge@perl.org Technology hourly 1 1970-01-01T00:00+00:00 avik's Journal http://use.perl.org/images/topics/useperl.gif http://use.perl.org/~avik/journal/ What would I do without Perl? http://use.perl.org/~avik/journal/28992?from=rss <p>I don't know what would I do without Perl.</p><p>I even came up with a new acronym: JABS (Just Another Butt Saver)...</p><p>Think about it. Siebel OLEDB Driver that we've been told to use does not quite work with MS SQL Server. Nothing makes these two systems talk to each other in any meaningfull way, perhaps due to data type missmatch, or some weird ODBC interfacing hurdles, or whatever, I don't care, they just don't like each other. Well, I married them using Perl DBI. It's been working great for at least 6 months. Under 1000 lines of code incorporate everything which SQL DTS mechanism cannot even dream about (what a stupid piece of software anyway): process logging, data validation, backups, etc. Yes, I do use T-SQL also, but my impression is that it's a terrible language. If Perl is like a camel, then T-SQL, perhaps, is like a frog. Yes, it is a hack, but that seems to be the only way to get the job done.</p><p>Thanks to all of you, Perl community. Great language, great job, and just another butt saved<nobr> <wbr></nobr>:)</p> avik 2006-03-14T17:53:55+00:00 journal Cold ConFusion and SQL Butcher http://use.perl.org/~avik/journal/22926?from=rss <p>My company uses only ColdFusion and SQL Server, so I'm learning new things, for example:</p><ul> <li> In Access I used to write <code> IIf(if_condition,true_result,false_result)</code>, but now in SQL Server I have to write <code> CASE source_value WHEN target_value THEN true_result ELSE false_result END </code> </li><li> Never thought that <code>select str(3.1415927) as foo</code> would return <b>3</b> </li><li> How awful that <code>Format(Now(),'yyyy-mm-dd')</code> must now be written as <code>left(convert(varchar(12),getdate(),120),10)</code> to get me the same output. </li><li> <code> String &amp; ' ' &amp; Number &amp; ' ' &amp; String </code> works fine in Access, but in SQL Server it must be written as <code> string + ' ' + Cast(number as varchar) + ' ' + string </code> but why the pluses if we don't even add anything, we're concatenating, right? </li><li> Cold Fusion's <code>cfquery</code> causes all single quoted characters to be auto-escaped, by doubling them. Good in 90% of cases, but what if you are doing dynamic SQL think with interpolation of single-quoted values? Then that becomes a mess. You must now use tag in order to to be used in <code>PreserveSingleQuotes(sql)</code> manner. This is not intuitive. I spent about an hour to find an answer. </li><li> Documentation sucks big time for SQL server. Documentation is little better for ColdFusion, but not clear enough in many cases. </li><li> I deeply miss relative simplicity and friendly uglinness of Perl + DBI + DBD::ODBC + CGI.pm </li></ul> avik 2005-01-28T14:49:43+00:00 journal How I am fighting with MS-Outlook http://use.perl.org/~avik/journal/18658?from=rss <p>On NT4 my Access application sent and received messages transparently through Outlook just fine. When time came to upgrade hardware, I received it with Win2K pre-installed. When I moved my application to that shining new workstation, I realized that Outlook has a new security patch with prevents messages from being sent directly through Outlook API. What happens, is that each time a message is sent you see a dialog with 5 second delay. After 5 seconds are over you see an enabled "Yes" button on that dialog. Then your Outlook is activated, so you have to switch back after message has been sent. When you receive new messages you have to tell outlook to allow access for certian number of minutes. Same when trying to resolve a name in Global Address Book.</p><p>Forget it, I thought, I'll do something with Perl. And I did. And it works. Everything except listing folders on Exchange server. That part I still need to figure out. Thank you, authors of such useful modules as Net::POP3, Net::SMTP, Net::LDAP, SOAP::Lite. Thanks for pocketSOAP developers also (that's how I connect between Access and other functions).</p><p>Outlook is bad. And it is getting worse and worse. So annoying.</p> avik 2004-05-07T04:53:44+00:00 journal Tough Camel http://use.perl.org/~avik/journal/12062?from=rss <p>Programming in Perl is difficult, because it is not intuitive. It is good, though. Sometimes I experience a certain relief when I find an elegant solution to an old dilema. And more often than before I put comments like <code># THANK YOU, LORD!</code> or <code># Glory to God in the Highest!</code> inside my code. Why? Because I'm not a perl programmer, I am a perl user, I suppose. Although I managed to write quite an extensive application in Perl, I feel like my learning of this language will never end. Unfortunately.</p><p>Don't you wish you would be able to say "I speak Perl fluently". How many of you out there can say that honestly? Does Perl have to be difficult?</p><p>How about one of my recent eurica's:</p><blockquote><div><p> <tt>sub copy_button {<br>&nbsp; &nbsp; my ($item, $item_id, $parent_id) = @_;<br>&nbsp; &nbsp; my $kids = {<br>&nbsp; &nbsp; &nbsp; &nbsp; pilot =&gt; 'survey',<br>&nbsp; &nbsp; &nbsp; &nbsp; survey =&gt; 'section',<br>&nbsp; &nbsp; &nbsp; &nbsp; section =&gt; 'question',<br>&nbsp; &nbsp; &nbsp; &nbsp; question =&gt; 'option'<br>&nbsp; &nbsp; };<br> <br>&nbsp; &nbsp; my $ref = $dbh-&gt;selectall_arrayref("<br>&nbsp; &nbsp; &nbsp; &nbsp; SELECT ID, NAME FROM $$kids{$item}s<br>&nbsp; &nbsp; &nbsp; &nbsp; WHERE $item\_id = $item_id<br>&nbsp; &nbsp; ");<br> <br>&nbsp; &nbsp; return submit({<br>&nbsp; &nbsp; &nbsp; &nbsp; name =&gt; 'copy_'.$item.'_'.$parent_id,<br>&nbsp; &nbsp; &nbsp; &nbsp; value =&gt; 'Copy'<br>&nbsp; &nbsp; })<br>&nbsp; &nbsp; . popup_menu({<br>&nbsp; &nbsp; &nbsp; &nbsp; name =&gt; 'source',<br>&nbsp; &nbsp; &nbsp; &nbsp; value =&gt; [ map ($$_[0], @$ref ) ],<br>&nbsp; &nbsp; &nbsp; &nbsp; label =&gt; { map {$$_[0], $$_[1]} @$ref }&nbsp; # Glory to God in the Highest!<br>&nbsp; &nbsp; });<br>}</tt></p></div> </blockquote><p>I wish it would be simpler. Should I try Ruby?..</p> avik 2003-05-07T19:23:01+00:00 journal comment http://use.perl.org/~avik/journal/11542?from=rss # This can't happen, but happens every single time for some obscure reason. avik 2003-04-09T11:38:03+00:00 journal my impression on Perl http://use.perl.org/~avik/journal/11528?from=rss Like life in general, programming in Perl is both beautiful and ugly. avik 2003-04-08T20:45:47+00:00 journal