[Boston.pm] Template toolkit and floats
Hi All, I am working on a custom shopping basket, and using Template to multiple the quantity of each item by its base price, and then also summing it. But I'm losing the floating points. It's coming out as flat INTs. Any idea of how to fix this? Thanks in advance. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Template toolkit and floats
Thanks Shlomi, My boss told me not to worry about different currencies yet. He's pushing to get the site up asap with the bare necessities. I actually have some similar custom code that I'll be using later when I get more time to implement it (not my first time dealing with international currencies). But thanks very much for thinking of this and providing the link. That's a nice clean collection. --Alex On Thu, Jan 10, 2013 at 5:19 PM, Shlomi Fish shlo...@shlomifish.org wrote: Hi Alex, On Thu, 10 Jan 2013 16:17:06 + Alex Brelsfoard alex.brelsfo...@gmail.com wrote: Nevermind... Sorry... Turned out to be a JS problem actually parseInt vs parseFloat Ugh. On Thu, Jan 10, 2013 at 4:06 PM, Alex Brelsfoard alex.brelsfo...@gmail.comwrote: Hi All, I am working on a custom shopping basket, and using Template to multiple the quantity of each item by its base price, and then also summing it. But I'm losing the floating points. It's coming out as flat INTs. Any idea of how to fix this? Thanks in advance. --Alex I'm glad you got your problem sorted out, but note that you should note use the built-in floating-point arithmetics for currency. See: * https://metacpan.org/release/Math-Currency * http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html - “What Every Computer Scientist Should Know About Floating-Point Arithmetic”. Regards, Shlomi Fish -- - Shlomi Fish http://www.shlomifish.org/ Humanity - Parody of Modern Life - http://shlom.in/humanity Botje Khisanth =~ s/must sleep/must give Botje all my money/ . — Freenode’s #perl Please reply to list if it's a mailing list post - http://shlom.in/reply . ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Could use some feedback -- typo fix
Wow.. these messages got sent to my spam folder so I'm only now reading them.. Ugh. Thanks for the feedback. I did first think of going with Kickstarter. But they do not accept campaigns for websites like mine. I already tried, and they said no :( That's why I went with Indiegogo.com. I have just done a follow-up video (see http://www.modomhan.com/gallery.html) that explains things a bit better. One of the things I mention is the planned support for PHP. As for non-programmers being able to make their own widgets, I HAVE put some thought into this. And I hope to be able to build tools for this. But I certainly don't have anything ready yet, nor will I in the near future. Android and Iphone apps have worked pretty well for non-programmers, so I figure I should be safe since there are more Perl and PHP programmers than Iphone Android (though those numbers are changing...) Every $0.02 is most welcome! Thanks! --Alex On Sun, Oct 14, 2012 at 1:11 AM, David Larochelle da...@larochelle.namewrote: tl:dr Glanced at your sight. Is this being funded on KickStarter? If not you might consider kickstart just for the publicity. I'm never been one to down play the importance of good marketing. But I'm not a marketing guy so I can't say if that is your problem. I saw that you mentioned HTML,CSS, Javascript and Perl, do you have a provision for non-technical users/ non-programmers? Also while Perl is near and dear to our hearts, other languages such as PHP might appeal more to people who are building things on the web. (Yes everyone acknowledges that PHP is a flawed language but it has mind share in a certain demographic.) I saw you're planning on adding PHP but perhaps the fact that you don't have it now is part of your problem. Just my $0.02. Hope it helped and good luck with the site. -- David On Sat, Oct 13, 2012 at 7:12 PM, Alex Brelsfoard alex.brelsfo...@gmail.com wrote: URL was incorrect. Correction: http://www.indiegogo.com/modomhan Thanks. --Alex On Sat, Oct 13, 2012 at 11:42 PM, Alex Brelsfoard alex.brelsfo...@gmail.com wrote: Hi All, Sorry for the slightly off-topic message, but I could really use some feedback. I'm trying to go live with a big new project (written in Perl), and I'm using crowd sourcing to get it off the ground ( http://indeigogo.com/modomhan). I'm really keen on pushing the open source technology part, and the fact that anyone who can program in Perl will be able to contribute to and help define MoDomhan. But I'm having a hard time getting the word out. Is this just a really tough time? Am I not doing enough (facebook, twitter, regular SEO, adwords, emails, phone calls, projects.mefi, boingboing, etc.)? Or is this simply a really crap idea? (I seriously dig this project though) Any advice or input would be really helpful. Thanks. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Could use some feedback
Wow.. these messages got sent to my spam folder so I'm only now reading them.. Ugh. Jason, Thank you very much for your thoughts. And you are not alone in thinking this way. Your right, the biggest problem I have is that MoDomhan can do SO much. So how do I create a short video to explain it. The answer turns out much like you explained: I can't. Let me first answer your main question: what can MoDomhan do that no other site/app can: It can give a non-programmer the ability to create a fully customized and feature-rich website without needing to hire a developer or designer. And full websites can be built in minutes. Sure you can build full websites, even customized websites in Wordpress. But you typically need to be a programmer to do so and you need to pay for the ability to customize your site. This is the main issue I am having with advertising. There are really important points from both the developer and the layman point of view: Developer side: You have a new and easy platform to develop on where you can make money and/or just play. Layman side: you can create your own website easily and with no need for a developer. As I explained above, this only touches the tip of the iceberg, but it's the driving force of MoDomhan so far. My current solution now is to break up the advertisements. I just released a new video (see http://www.modomhan.com/gallery.html) where I speak more to the laymen. I will be doing another one soon where I'll be speaking to the developers out there. So, all you developers: if you have questions (like Jason Gabor) send them my way and I'll try to incorporate them into my next video. Gabor, Thanks very much for your feedback too. To answer *your* questions: I had originally planned on making this open source, but the more I worked on it, the more I realized that it would really work best as a hosted solution. I DO hope that MoDomhan becomes A better Wordpress, but I honestly plan on it being much more than just that. For example, I'm hoping for this to become a useful platform for social/professional networkers who are tired of or frustrated with the current options. You raise a very good point though: people need to *know* me. I'll definitely be adding a section of my experience and expertise in the next video. And once I do that I'll also update the text on the campaign website. *Very* good feedback. Also you asked about a blog. Right now I've just got a news feed: http://www.modomhan.com/news I might eventually create a more proper blog. But this is working for my current needs. As for letting people in for Alpha testing: I would LOVE to. I simply haven't had enough for alpha users to play with to make it worthwhile (only have a couple widgets and background themes setup), plus it being in alpha it wasn't all that pretty. But I've made some good progress over the last couple weeks and might be open to letting some people in for alpha testing soonish. Do I have any interested parties here? Again, thank you so very much for the helpful feedback. And I'm so sorry for my delayed response. (I've added a new filter to prevent these messages from going into spam again). Hope you guys read this long-winded email :) Thanks! --Alex On Wed, Oct 17, 2012 at 5:57 PM, Jason McIntosh j...@jmac.org wrote: On Oct 17, 2012, at 12:45 AM, Gabor Szabo ga...@szabgab.com wrote: Have you already written about your experience in a blog that could be shared? Have you given talks about this at Boston.pm or YAPCs? Maybe now… In fact I gave talks to Boston.pm and other local gatherings circa 2006-7, when I was in the thick of things and very optimistic. Here's a YouTube from 2007: http://www.youtube.com/watch?v=xsXIaDg7agQfeature=g-upl A postmortem blog post that I wrote a couple of years after that: http://prog.livejournal.com/953385.html I haven't otherwise turned my experiences into talks. (And I'm aware that volity.org does not in fact have any documentation on it right now, alas. Scraping the doc-wiki out of the Wayback Machine is on my TODO…) -- Jason McIntosh Appleseed Software Consulting j...@appleseed-sc.com • www.appleseed-sc.com ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
[Boston.pm] Could use some feedback
Hi All, Sorry for the slightly off-topic message, but I could really use some feedback. I'm trying to go live with a big new project (written in Perl), and I'm using crowd sourcing to get it off the ground (http://indeigogo.com/modomhan ). I'm really keen on pushing the open source technology part, and the fact that anyone who can program in Perl will be able to contribute to and help define MoDomhan. But I'm having a hard time getting the word out. Is this just a really tough time? Am I not doing enough (facebook, twitter, regular SEO, adwords, emails, phone calls, projects.mefi, boingboing, etc.)? Or is this simply a really crap idea? (I seriously dig this project though) Any advice or input would be really helpful. Thanks. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
[Boston.pm] Could use some feedback -- typo fix
URL was incorrect. Correction: http://www.indiegogo.com/modomhan Thanks. --Alex On Sat, Oct 13, 2012 at 11:42 PM, Alex Brelsfoard alex.brelsfo...@gmail.com wrote: Hi All, Sorry for the slightly off-topic message, but I could really use some feedback. I'm trying to go live with a big new project (written in Perl), and I'm using crowd sourcing to get it off the ground ( http://indeigogo.com/modomhan). I'm really keen on pushing the open source technology part, and the fact that anyone who can program in Perl will be able to contribute to and help define MoDomhan. But I'm having a hard time getting the word out. Is this just a really tough time? Am I not doing enough (facebook, twitter, regular SEO, adwords, emails, phone calls, projects.mefi, boingboing, etc.)? Or is this simply a really crap idea? (I seriously dig this project though) Any advice or input would be really helpful. Thanks. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
[Boston.pm] Converting Microsoft Word Special Characters
Hi All, I was wondering if I could get some help here. I am looking for an existing function/method/module that will properly convert all special characters (like those from Microsoft Word: smart quotes, mdash, ellipses, bullet points, etc.) to either a matching simpler character, or an HTML entity. HTML::Entities does a close job, but it does not handle everything correctly. I need to clean this data up for use in a google product feed (xml). Here is an example of some text I am having trouble with: ( the +'s are actually bullet points) == begin == My doctor has recommended a dream specialist, and together we are trying to figure out what these nightmares mean. Jump into Hidden Object action in Doors of the Mind – Inner Mysteries.ADVANTAGES OF THE COMPLETE VERSION :DOORS OF THE MIND: INNER MYSTERIES + Dark atmosphere+ Spooky gameplay+ Explore a world of nightmares! === end === And here is the output from using HTML::Entities: == begin == My doctor has recommended a dream specialist, and together we are trying to figure out what these nightmares mean. Jump into Hidden Object action in Doors of the Mind acirc;#128;#147; Inner Mysteries.ADVANTAGES OF THE COMPLETE VERSION :DOORS OF THE MIND: INNER MYSTERIESAcirc;nbsp;+Acirc;nbsp;Dark atmosphere+Acirc;nbsp;Spooky gameplay+Acirc;nbsp;Explore a world of nightmares! === end === Notice the extra Acirc; all over the place. Any help you can provide would be immensely helpful. Thanks. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Converting Microsoft Word Special Characters
Thanks Uri, Yeah I found that one when I was Googling. Sadly it only converts a few special characters (smart quotes and M and N dashes). I need something that does as many as can be thought of/found. --Alex On Sat, May 19, 2012 at 1:26 AM, Uri Guttman u...@stemsystems.com wrote: On 05/18/2012 07:55 PM, Alex Brelsfoard wrote: Hi All, I was wondering if I could get some help here. I am looking for an existing function/method/module that will properly convert all special characters (like those from Microsoft Word: smart quotes, mdash, ellipses, bullet points, etc.) to either a matching simpler character, or an HTML entity. HTML::Entities does a close job, but it does not handle everything correctly. years ago someone i know wrote such a beast. it is appropriately called the demoronizer (replaces 'smart' crapola). http://www.fourmilab.ch/**webtools/demoroniser/http://www.fourmilab.ch/webtools/demoroniser/ it may do the trick. at least it is pure perl and would be easy for you to hack to your specific needs. note that it is very old and written in perl4 code! uri __**_ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/**listinfo/boston-pmhttp://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Login error with SFTP
Thanks Tom. I have tried specifying first SSH2, and then SSH1. Interestingly I get the same result. Though I have tried turning on the debug mode, I have not gotten any different results (though I'm not so sure how to USE the debug mode really). Are you saying nothing is written to STDOUT or STDERR? Neither Try collecting some data about the target host. Run: $ telnet host 22 and you should see something like: Trying 0.0.0.0... Connected to 0. Escape character is '^]'. SSH-2.0-OpenSSH_4.3p2 Debian-9etch2 unless they've obscured the banner, this will tell you what version of the protocol and what software is being used to implement it. That might provide some clues when tracking down an incompatibility with the SSH module. Compare that to the hosts that are working OK. They HAVE obscured their banner. But I have asked for them to get some of this info for me. I'd then check rt.cpan.org for bug reports relating to this for the SSH module. If you determine that the SSH module is failing to login only with a specific SSH server implementation, then you should file a bug at rt.cpan.org. Will look. Thanks. I always forget about rt.cpan.org Try coding up a simple test that uses the SSH module to login. That'll take the SFTP module out of the picture and make it easier to debug. Try it with both SSH1.pm and SSH2.pm. Try it first with a known working host. will do that next. Bill's suggestions: I tried ssh -v and got the following output: [EMAIL PROTECTED] ~]$ ssh -v .com OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options for * debug1: Connecting to .com [###.###.###.###] port 22. debug1: Connection established. debug1: identity file /home/alexb/.ssh/identity type -1 debug1: identity file /home/alexb/.ssh/id_rsa type -1 debug1: identity file /home/alexb/.ssh/id_dsa type -1 debug1: Remote protocol version 2.0, remote software version OpenSSH_4.5p1 FreeBSD-20061110 debug1: match: OpenSSH_4.5p1 FreeBSD-20061110 pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_3.9p1 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server-client aes128-cbc hmac-md5 none debug1: kex: client-server aes128-cbc hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(102410248192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Host 'data-access.sandiegomedia.com' is known and matches the DSA host key. debug1: Found key in /home/alexb/.ssh/known_hosts:4 debug1: ssh_dss_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,password,keyboard-interactive debug1: Next authentication method: publickey debug1: Trying private key: /home/alexb/.ssh/identity debug1: Trying private key: /home/alexb/.ssh/id_rsa debug1: Trying private key: /home/alexb/.ssh/id_dsa debug1: Next authentication method: keyboard-interactive Anyway for me to check for certain from my end if the allow suppress shell? Seems like we've got a few supporters for Net::SCP::Expect. So i installed it and tested it out. It worked on this server! I've never used this module before, so I've got a couple quick questions about it: - Is there any reason to worry about my current servers that work with the SFTP module working with this SCP module? - Are there any known gotchas with using Net::SCP::Expect? - Simply put: should it work anywhere clients are expecting to use SFTP? I do not have any control over the servers that are being programmed for our servers to connect to. So I need to program I a way that can handle most/all cases. Right now we offer local/manual download, HTTP, FTP, SFTP. Thanks again for all of the help. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
[Boston.pm] Login error with SFTP
I wrote up some code to perform SFTP file downloads for my company. It is now working for all but one of our clients that have chosen to use this method. But I need to get it working for ALL of them. For the life of me I cannot figure out why it's not working for this one machine. Here's the info: - I can sftp in perfectly fine from the command line. - The client has this set right: PasswordAuthentication yes - The code works for other servers perfectly fine. Here is the code: --- my $ftp = undef; my $errors = undef; my %args; $args{'user'} = $user; $args{'password'} = $pass; $args{'debug'} = 'true'; # Update where the connection should be looking # for the SFTP Known Hosts file. my %ssh_args; $ssh_args{'options'} = [UserKnownHostsFile .$config::sftp_hosts_file, RSAAuthentication yes, protocol='2,1']; $args{'ssh_args'} = \%ssh_args; # Make SFTP connection. eval { $ftp = Net::SFTP-new( $server, %args ) or $errors = 'Cannot connect to SFTP Server.'; }; $errors = 'Cannot connect to SFTP Server. '.$@ if ($@); - I then print out $errors and this is what i get: Cannot connect to SFTP Server. Permission denied at /usr/lib/perl5/site_perl/5.8.5/Net/SFTP.pm line 62 Line 62 correlates with the login function in SFTP.pm: $ssh-login($param{user}, $param{password}, 'supress_shell'); I added the , protocol='2,1' bit per the suggestion of someone on some forum for a similar problem. Can anyone think of any other reason why this might be happening? Thanks. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Login error with SFTP
Though I have tried turning on the debug mode, I have not gotten any different results (though I'm not so sure how to USE the debug mode really). SSH1.pm SSH2.pm each have the following line: SSH1.pm:$ssh-fatal_disconnect(Permission denied); SSH2.pm:$ssh-_login or $ssh-fatal_disconnect(Permission denied); SSH2.pm: -- sub login { my $ssh = shift; $ssh-SUPER::login(@_); my $suppress_shell = $_[2]; $ssh-_login or $ssh-fatal_disconnect(Permission denied); $ssh-debug(Login completed, opening dummy shell channel.); ... sub _login { my $ssh = shift; my $kex = Net::SSH::Perl::Kex-new($ssh); $kex-exchange; my $amgr = Net::SSH::Perl::AuthMgr-new($ssh); $amgr-authenticate; } --- SSH1.PM: - sub _setup_connection { my $ssh = shift; $ssh-_connect unless $ssh-sock; $ssh-_login or $ssh-fatal_disconnect(Permission denied); ... - SSH1.pm has all functions inside the _login function so too much to paste here. --Alex On Wed, Jul 30, 2008 at 1:06 PM, Tom Metro [EMAIL PROTECTED] wrote: Alex Brelsfoard wrote: Cannot connect to SFTP Server. Permission denied at /usr/lib/perl5/site_perl/5.8.5/Net/SFTP.pm line 62 Line 62 correlates with the login function in SFTP.pm: $ssh-login($param{user}, $param{password}, 'supress_shell'); I'd look at the source for the $ssh object and see where or if it throws a Permission denied error in its login() method. I'd also look to see if there is a debug mode for the module providing $ssh. -Tom -- Tom Metro Venture Logic, Newton, MA, USA Enterprise solutions through open source. Professional Profile: http://tmetro.venturelogic.com/ ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Dealing with different EOL's
Uri, Bernado, all, Thanks for your thoughts. Here's a more detailed explanation: We are reading in feeds (typically TSV or CSV files), parsing them, reformatting the data, and spitting it out as another file. These feeds can come from all sorts of people/places/things. So sometimes they are wonderfully formatted and we understand their content. Sometime they are not, and we do not. Imagine a feed that is a list of products. Each row lists the name, type, description, and price of a product. Now say you have someone using some sort of CMS to create their feed. No say that they have all of their information stored in Word files. It is very easy to see the scenario where the person will just copy and pastes the description (with line breaks) into their CMS. Their CMS may just enclose this field in quotes and move on. So now we have a feed where the description column may have linebreaks in it. So I can't just split on any form of linebreak. Does this make a bit more sense? btw, there's no chance that I could define $/ as a regex could I? Thanks again for the help. --Alex On Jan 24, 2008 10:03 AM, Bernardo Rechea [EMAIL PROTECTED] wrote: On Wednesday 23 January 2008 19:26, Uri Guttman wrote: define inline break. it can't be a newline or CR as those define lines. you need clearer specs and data examples if you want more help. Expanding on Uri's comment, what do you want to do with the files while dealing with line terminators. Are you simply trying to normalize line terminators from different platforms to a common one? Also, by 'inline break' perhaps you mean what's often called a hard line break, i.e., when distinguishing between paragraphs and lines, one that doesn't define a paragraph ending, but simply cuts lines at a certain length? In that case you need something different to terminate paragraphs, e.g., a blank line (two line breaks in a row), or similar. Bernardo ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
[Boston.pm] Dealing with different EOL's
Hi all, I am currently trying to work on a system that reads in all kinds of feeds. These feeds can be created on a PC, new/old mac, or a *nix machine. And I need to be able to deal with them all. Here's the kicker, these feeds sometimes have inline breaks, and we need to keep them. Does anyone have any suggestions on how to deal with this? This works: --- my $newline = \n; my $file = '788_test.txt'; open (my $file_fh, $file) || die could not open $file for reading; my $file_content = $file_fh; $file_content =~ s/(?:\015{1,2}\012|\015|\012)/$newline/sg; foreach (split(/\n/, $file_content)) { print $_\n; } close($file_fh); --- I can even split on that regular expression. But I'm just concerned about losing inline breaks. Thoughts? Thanks. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
[Boston.pm] converting utf-8 to unicode from XML text gathered by XML::Twig
Hi All, I am currently using XML::Twig to read in some XML. This XML's text is in utf-8. So there are smart-quotes and such in there. I need to unicode-ify the text. I tried using most of the methods that are part of XML::Twig, but came up dry. The best I could do is convert all unsupported chars to question marks. Without any XML::Twig conversion the smart quotes come out looking like: “ ” or ’ I tried doing a simple $val =~ s/’/'/gs; But that didn't work either. Does anyone have any suggestions on how I can do this conversion either manually OR with XML::Twig methods? Thanks. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] IE7 and JS image object
Thanks all. As it turns out this whole problem is caused by interfering JS. I was not originally told of this, but the testing page had other JS calls on it. Once they were removed, this JS worked fine. Don't know how that would make this break, and how my fix would fix it. But at least we know that the problem is not directly with my code. Thanks for all the help. --Alex On Nov 13, 2007 3:40 PM, Tom Metro [EMAIL PROTECTED] wrote: Alex Brelsfoard wrote: This JS is being called through a perl script: So file.pl spits out Content-type: text/JavaScript\n\n followed by some JavaScript. As long as your JS is executing, I don't expect that has an impact on the problem. This does NOT give a request to the apache logs: var img_src = https://mydomain.com/images/ping.gif?n=1;; But this DOES: var img_src = https://mydomain.com/images/ping.gif?n=2;; You said you had code to add random data after the file name. I don't see that. ...if you can help explain this strange behavior in IE7 I would be very grateful. I reiterate the suggestions from my last posting: The other option to consider is the involvement of a caching proxy. Is IE configured to use a proxy? Try running a packet sniffer to see where it is actually connecting. You might also be faced with a transparent caching proxy at an ISP, which you won't be able to bypass from the client side, but should have the same effect on all browsers running on the machine running IE7. [...] Have you explored setting the headers from the server side of things? If this is just a simple image bug used for tracking purposes, you could throw together a CGI with a few lines of code that sets the headers and returns the image. There are probably scripts already available that do this. -Tom -- Tom Metro Venture Logic, Newton, MA, USA Enterprise solutions through open source. Professional Profile: http://tmetro.venturelogic.com/ ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
[Boston.pm] IE7 and JS image object
Hey all, I know this is not so much a JavaScript group, but I figured someone might have heard of what I am running into. If not, feel free to ignore this message. Situation: I am using JavaScript to create an image. It needs to be loaded, and i need to see its request in the apache logs. Problem: The code I am using works in every situation except on IE7 on Windows (the image loads and exists in the temporary internet files folder, but there is no request for the image in the apache logs). I have found a way to make it work in IE7, but the solution confounds me. Original code: var img_src = ..; var my_img = new Image(1,1); my_img.src = img_src; [That's the code that works everywhere but in IE7] The Fix: var img_src = ..; var my_img = new Image(1,1); my_img.onload = function() {} my_img.src = img_src; Here's the REALLY interesting point: I can replace 'onload' with 'onerror' and it works. But if I do not have that onload or onerror, I do not get the image request in my logs. Does anyone have any idea how/why this might happen? Thanks. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] IE7 and JS image object
Thanks guys, But sadly I've actually already been down this road. Part of the img src does include a large random number. On top of that I have also checked the temporary internet folder and I see multiple copies (with different random numbers) of the same image there. I have run this test with a cleared cache, and with previous copies in cache. the results do not vary. This makes no sense to me either. Which is why I'm asking for help. I have reduced my script down to JUST creating an image with a random number as its query string, and my results STILL do not vary. [shrug] I agree that this does not make sense. But this IS what I am faced with.. I've tried to disprove this as many ways as i can think of... --Alex On Nov 12, 2007 4:28 PM, Ben Tilly [EMAIL PROTECTED] wrote: On 11/12/07, Alex Brelsfoard [EMAIL PROTECTED] wrote: Hey all, I know this is not so much a JavaScript group, but I figured someone might have heard of what I am running into. If not, feel free to ignore this message. Situation: I am using JavaScript to create an image. It needs to be loaded, and i need to see its request in the apache logs. Problem: The code I am using works in every situation except on IE7 on Windows (the image loads and exists in the temporary internet files folder, but there is no request for the image in the apache logs). I have found a way to make it work in IE7, but the solution confounds me. Original code: var img_src = ..; var my_img = new Image(1,1); my_img.src = img_src; [That's the code that works everywhere but in IE7] The Fix: var img_src = ..; var my_img = new Image(1,1); my_img.onload = function() {} my_img.src = img_src; Here's the REALLY interesting point: I can replace 'onload' with 'onerror' and it works. But if I do not have that onload or onerror, I do not get the image request in my logs. Does anyone have any idea how/why this might happen? Obvioulsy IE 7 has a more aggressive caching algorithm, and your extra function gets in the way of that algorithm. For further details we'd have to know the details of said caching algorithm. (As Tom Metro says, your technique should be regarded as unreliable, even though it works now.) Cheers, Ben ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] quick XML::Twig / variable scope problem
Thank you all very much. I think this gives me all the answers I need (and then some). I needed to move forward on this project, so for the moment I have taken the ugly route ad made the variables global. But I hope to try applying some of these better methods by the middle of the week. I will post again to sa what I finally went with. Thanks again. --Alex On 8/27/07, mirod [EMAIL PROTECTED] wrote: Alex Brelsfoard wrote: sub main { my $catalog_timestamp; [...] my $catalog_settings = XML::Twig-new( twig_handlers = { 'Item'= \get_catalog_field_names, 'Catalog' = \get_catalog_timestamp, } ); [...] sub get_catalog_timestamp { my ($twig, $elt) = @_; # get the PublishTimeStamp attribute $catalog_timestamp = $elt-att('PublishTimestamp'); $twig-purge(); } However I get an error from this. Global symbol $catalog_timestamp requires explicit package name The error references the $catalog_timestamp = $elt-att('PublishTimestamp'); line. As per the error message ;--) $catalog_timestamp is in scope in the main sub, but not in the rest of the file. 2 options: make it global to the file by declaring it outside of the main sub, or (cleaner), pass it to the handler via a closure: my $catalog_settings= XML::Twig-new( twig_handlers = { 'Item' = sub { get_catalog_field_names( @_, $catalog_timestamp); } ... sub get_catalog_timestamp { my ($twig, $elt, $catalog_timestamp) = @_; ... Does this help? -- mirod ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
[Boston.pm] merge and compare help
Hi All, I'm back and with a new algorithm/solution I need help with. I have two csv files, sorted by the first column (ID). Each file may have all the same, none of the same, or some of the same ID's. I would like to take these two files, and make one out of them. Two tricks: - When I come across the same ID in each file I need to merge those two lines (don't worry about the merge, I can handle that). - I want to be looking at the least number of lines from each file as possible at any one time (optimally I would like to only be looking at one of each file at the same time). Basically we are dealing with large files here and I don't want to kill my RAM by storing all the data from both files into a hash or some other object. I have an algorithm I like, I'm just not certain how to implement it: 1. Examine the ID of the first line of each file. 2. If they are the same, then merge and print the merge to the final output file.. 3. If they are not the same, find the lesser one and have it print its contents to the final output file until its ID is the same or greater than the other file's. 4. repeat. Any advice on how to do this? Thanks. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
[Boston.pm] quick XML::Twig / variable scope problem
Hi all, I'm trying to do something I see as relatively simple. I would like to call a function that declares a few variables and then runs some XML::Twig processes which in turn access update said original variables. But I'm getting an error from my twig functions when they try to access the before-defined variables. Right now my code is looking a little something like: main(); sub main { my $catalog_timestamp; my $objinfo_timestamp; my %fields; open(my $cataloginfo_fh, catalog.xml) || die Could not open catalog.xml for reading: $!\n; open(my $objinfo_fh, objinfo.xml) || die Could not open objinfo.xml for reading: $!\n; open(my $new_fh, output.csv) || die could not write to output.csv\n; # Need to get the header info first, to be able to make the haeder line. # Only go hrough the file if something was submit for that file. if (defined $cataloginfo_fh) { my $catalog_settings = XML::Twig-new( twig_handlers = { 'Item'= \get_catalog_field_names, 'Catalog' = \get_catalog_timestamp, } ); $catalog_settings-parse($cataloginfo_fh); } if (defined $objinfo_fh) { my $objinfo_settings = XML::Twig-new( twig_handlers = { 'Product' = \get_objinfo_field_names, 'Published' = \get_objinfo_timestamp, } ); $objinfo_settings-parse($objinfo_fh); } close($cataloginfo_fh); close($objinfo_fh); close($new_fh); } An example of the twig functions: sub get_catalog_timestamp { my ($twig, $elt) = @_; # get the PublishTimeStamp attribute $catalog_timestamp = $elt-att('PublishTimestamp'); $twig-purge(); } However I get an error from this. Global symbol $catalog_timestamp requires explicit package name The error references the $catalog_timestamp = $elt-att('PublishTimestamp'); line. I kind of get the feeling I'm doing a stupid perl mistake. But I clearly do not know what. Any help would be very much appreciated. thanks. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
[Boston.pm] [job] WEB DEVELOPER - PERL, JAVASCRIPT, CSS MYSQL
This is a virtual company, so you get to work out of your home office. This is a great company; I've been working for them for a few months now and have been loving it. MUST BE EXCELLENT WITH PERL. MUST UNDERSTAND ALGORITHMIC COMPLEXITY AND KNOW HOW TO APPLY IT TO YOUR WORK. MUST BE EXCELLENT WITH BOTH CSS JAVASCRIPT SingleFeed is seeking Web Developers skilled in both the front- and back-end developer arts (individuals with superior skills one on or the other should also apply). Do you rock the DOM? Do you query the DB with grace and efficiency? Is cross-browser compatibility second nature? Do you make algorithmic complexity simply elegant? Do you have an eye towards cross-browser visual and functional perfection? Are you able to make your Perl a scalable gem? YES?! Then we would like to hear from you! Send us your resume today at [EMAIL PROTECTED] You have the option of being the first employee in the NYC SingleFeed office or telecommuting. We are seeking a FT, versatile web developer with experience in JavaScript, CSS, Perl, and mySQL. This developer will be a self-driven worker with attention to detail. A plus, if you have experience working on UI (or designing user interfaces/experiences). Individual will work from home or in an office in Manhattan (depending on preference). The environment is that of a fun and friendly start-up. We are seeking to build a team of passionate, team-oriented people. Web application developer must have experience building flexible, cross-browser compatible, scalable web applications with 1-3 years of experience using: - Perl(CGI/mod_perl), - JavaScript(Ajax/Json - ok, no one has 3 years of Ajax, but you get the picture), - CSS(cross browser) and - MySQL (data modeling and ANSI SQL) Additional consideration will be given to candidates with following experience: - XML(Xslt/Xpath, Web Services, DTD/XML Schema) - UI Development/Design (with Attention to Detail) - Web Page Design (Web 2.0 / AJAX) - Technical Specification creation and writing - Comet, Cometd, Reverse AJAX, etc. About Comparison Ventures, Inc. SingleFeed, a Comparison Ventures, Inc. company, helps small and medium sized online merchants quickly and easily syndicate their products to multiple shopping comparison engines like Google Base, Yahoo! Shopping, Shopping.com, Shopzilla, and PriceGrabber. As opposed to automated XML data feed submission solutions, SingleFeed focuses on data feed optimization, so merchants have the best chance of succeeding on the shopping comparison engines. SingleFeed was co-founded by Brian Smith and Jeremy Horn. Contact me, Alex Brelsfoard, with immediate questions and info on how to apply. ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
[Boston.pm] CRYPT::RSA problem
Hi All, I'm just trying to run the example code to test out for functionality, but I'm getting an error: Can't call method encryptblock on an undefined value at RSA.pm line 97 This is the example code I'm using (straight from CPAN): - my $rsa = new Crypt::RSA; my ($public, $private) = $rsa-keygen ( Identity = 'Lord Macbeth [EMAIL PROTECTED]', Size = 1024, Password = 'A day so foul fair', Verbosity = 1, ) or die $rsa-errstr(); my $cyphertext = $rsa-encrypt ( Message= $message, Key= $public, Armour = 1, ) || die $rsa-errstr(); my $plaintext = $rsa-decrypt ( Cyphertext = $cyphertext, Key= $private, Armour = 1, ) || die $rsa-errstr(); --- This is the line in RSA.pm the error is referring to: --- my $blocksize = blocksize ( $$self{es}-encryptblock (Key = $key), length($plaintext) ); --- Any ideas of what's going on? or how to test to find out what's going on? Google didn't produce much help. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Reading a variable CSV file with embeded newlines
Once again, thank you all. This helps alot. --Alex On 6/8/07, Guillermo Roditi [EMAIL PROTECTED] wrote: Oops. i went too fast. thats a preprocess command that i use with App::Cmd (highly recommended by the way) $args is an arrayref of filepaths read_file is provided by File::Slurp the regex is what you are looking for. The problem sucks since its a badly formatted file, but i normally just run that as a preprocessor and then use CSV_XS On 6/8/07, Ben Tilly [EMAIL PROTECTED] wrote: On 6/8/07, Gyepi SAM [EMAIL PROTECTED] wrote: On Fri, Jun 08, 2007 at 03:26:56PM -0400, Alex Brelsfoard wrote: I have a CSV file where each line may NOT have the same number of fields. One item per line. xSV is line oriented: as long as each line is well formed it should be parsed correctly. Making sense of the data may be more difficult though. Yup. But occasionally a field in an item will have one or more newlines in it. How can I break this up correctly? Embedded newlines are OK as long as the field is quoted. However, not all tools will parse the field correctly. Last time I checked, Text::CSV and Text::CSV_XS do not. I suspect Text::xSV will be better behaved. There are other, non Perl, tools that should work fine as well. I had thought that Text::CSV did handle that case, but I just checked and it does not. :-( Text::xSV does this correctly, though not speedily. Here is sample code: use strict; use Text::xSV; my $csv = Text::xSV-new( filename = foo.csv, row_size_warning = 0, # Stop warnings for variable size rows. ); while (my @row = $csv-get_row()) { # Do something here. } Cheers, Ben ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
[Boston.pm] Reading a variable CSV file with embeded newlines
OK, so I thought we'd talked about something like this before, but I couldn't find it. I have a CSV file where each line may NOT have the same number of fields. One item per line. But occasionally a field in an item will have one or more newlines in it. How can I break this up correctly? Thanks. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Calling a function that will return to where the grandparent called the parent
Thank you all very much. This has been a big help. This is what I was looking for. --Alex On 5/31/07, Bob Rogers [EMAIL PROTECTED] wrote: From: Gyepi SAM [EMAIL PROTECTED] Date: Thu, 31 May 2007 15:22:32 -0400 Hi Alex, What you're asking is possible, especially since you only asked for quick and easy and said nothing about elegant ;) The situation you describe is known as a 'condition' in Lisp, which allows you to define the catch and handle exceptional conditions in your program, including *restarting* the offending piece of code (presumably after changing program state to prevent looping) . . . Well, the notion of restarting also includes such things as skip the operation, suppress the warning, etc. The try the same thing again restarts are mostly intended for use by interactive debuggers, where looping is not a problem. The thing I find most impressive about the Common Lisp condition system is that it allows the signalling (detection) of an error, the provision of restart/retry code, and the decision of which restart, if any, to take (handling) to be implemented by three different people writing at different times and communicating only through software documentation. See [1] for a general overview of Lisp conditions. However, since Alex seems to have control over all of the code involved, there is a simpler approach. The following version of your Plort example uses a callback [2] that closes over the done: label instead of using eval/die: #! /usr/bin/perl -w use strict; use warnings; use vars qw($callback); sub Plort { print in Plort, calling Foo()\n; local $callback = sub { print In callback.\n; goto DONE; }; Foo(); print in Plort, returned from Foo() [not]\n; DONE: print in Plort, done with Foo()\n; } sub Foo { print in Foo, calling Error()\n; Error(); print in Foo, back from Error, but you'll never see this line; } sub Error { print in Error, invoking callback.\n; $callback-(); } Plort(); Note that this script works in Perl 5.8.1, but not in 5.6, where the lexical sub is not allowed to goto a label that is in the containing lexical scope. I don't know exactly when this feature was added/bug was fixed. Running this produces the following output: [EMAIL PROTECTED] perl-condition.pl in Plort, calling Foo() in Foo, calling Error() in Error, invoking callback. In callback. in Plort, done with Foo() [EMAIL PROTECTED] Two advantages of this technique spring to mind: 1. It is transparent to eval/die, so it doesn't muck up other error processing, an unfortunate weakness of resignalling [3]. In particular, introducing an eval to the internals of Foo can never intercept the nonlocal exit performed by the callback. 2. The notion of how many levels to exit (the parent/grandparent thing) doesn't have to be hardwired. The Error sub can be called at arbitrary points within the implementation of Foo, at different levels, and will still do the right thing in each case. HTH, -- Bob Rogers http://rgrjr.dyndns.org/ [1] Kent M. Pitman, Condition Handling in the Lisp Language Family, http://www.nhplace.com/kent/Papers/Condition-Handling-2001.html [2] Need I say what else I could have called it? ;-} [3] Perl 6 will do this better. ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
[Boston.pm] online learning sites
I am looking for a website like elementk.com that offers a lot of online courses to learn programming languages, desktop applications, network/system utilities, etc. It's fine for the site to be a pay-for site (like elementk). I'm just looking for a list of sites that I might be able to use. Basically I'm looking to get my employer to pay for it, but I wanted to be able to give them a few options. Any ideas? Thanks. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] LARGE MySQL Database
Very cool. Good idea. Thanks. --Alex On 5/9/06, Mike Kruckenberg [EMAIL PROTECTED] wrote: You might try stopping by the MySQL meetup that happens at MIT each month (free soda/pizza): http://mysql.meetup.com/137 There's a pretty regular crowd of serious users there, a couple of them are working with huge amounts of data. One individual that comes somewhat regularly has over a terabyte of data in InnoDB that has a wealth of knowledge of how to tune it appropriately. That doesn't answer your questions immediately, but might in the long term. On May 9, 2006, at 5:52 PM, Steve Revilak wrote: Date: Mon, 8 May 2006 17:24:17 -0400 From: Alex Brelsfoard To: boston-pm@mail.pm.org Subject: [Boston.pm] LARGE MySQL Database Basically I am dealing with using, storing, and sorting a LOT of data in a mysql database. With all the data in the table it makes for 404.8 Million rows. In a backup sql file that makes just under 80GB. I an using the InnoDB engine. I was just wondering if anyone else has had experience working with databases this large, and using MySQL. I've run into some smaller problems along the way due to the immensity of this table. In the end, to do what we want I will be creating a smaller table, with a subset of entries from the original. But the original needs to exist as well. I'm looking for heads up warning for things I should watch out for due to the size of this thing, or any suggestions on speedier sorting and querying. I've dealt with large volumes of data with innodb and MySQL. Not quite as large as yours -- maybe 200 million rows with 12 GB dump file. If you haven't normalized the pants out of the table, that's probably a good place to start. Anything you can do to trim a few bytes off the row size will make a big difference in the size of the overall table. (Is this table part of a data warehouse?). Smaller data will always be faster than bigger data. Of course, any structural change on a table that big won't be a quick one. For an internal system, that might not be a big deal. For a production system, it will probably be painful. For general server tuning, a few things to try - Make innodb_buffer_pool_size as big as you can, without causing the machine to swap. - if you're doing lots of writes (or your big table-table copy), set innodb_log_file_size to be a sizable percentage of innodb_buffer_pool_size; 30% or so. That will help to speed up normal operations (innodb will have to spend less time flushing pages out do disk). However, if you have an unclean shutdown, recovery will take longer. On my `big' innodb database, we're using two 200M innodb logs. That sped up bulk inserts a *lot*. - if some of the data is very rarely used, you might consider putting that portion of the data into archive tables. The downside of archive tables is that they don't support indexing. But they're very compact (just a blob of zlib data, more or less). Finally, if you haven't run across these http://dev.mysql.com/doc/refman/4.1/en/innodb-tuning.html http://dev.mysql.com/doc/refman/4.1/en/innodb-configuration.html Of course, some of this depends on what the data is, and what kind of queries you're running against it. Measuring performance before and after is an important step in the process. hth Steve ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] LARGE MySQL Database
Thanks all for the feedback. It's comforting to know that other people have had large mysql databases. As things stand, my database is setup well enough (I'm confident with the indexes and normalization). As for the proper engine to use for my situation, I found this quote: InnoDB has been designed for maximum performance when processing large data volumes. Its CPU efficiency is probably not matched by any other disk-based relational database engine. on the following page: http://dev.mysql.com/doc/refman/5.0/en/innodb-overview.html Unless I'm understanding this incorrectly, innodb IS the best choice for what i'm doing: reads on a very large database. Thanks for the suggestions on innodb_buffer_pool_size. This server is dedicated to the use of this database, so it looks like I should seriously play with this. But one question... how/where do I edit these variables? I normaly have a sysadmin to help me with these things, but such is not the case these days. Thanks again for everyone's feedback. Definitely a lot of food for thought. --Alex On 5/9/06, Aaron Sherman [EMAIL PROTECTED] wrote: Steve Revilak wrote: Basically I am dealing with using, storing, and sorting a LOT of data in a mysql database. With all the data in the table it makes for 404.8 Million rows. In a backup sql file that makes just under 80GB. OK, so you're dealing with a tiny database. mysql select count(*) from the_log; +---+ | count(*) | +---+ | 449349136 | +---+ 1 row in set (0.00 sec) Real table name changed to protect the innocent. The row size is around 128 bytes. I have so few rows right now because I just purged 2005 data. I an using the InnoDB engine. Could be good, but probably a mistake. MyISAM is much more suited to large amounts of data. Unless you need transactional integrity on this particular data, I would dump InnoDB ASAP and go with MyISAM. If you *think* you need transactional integrity, consider the possibility that you might not, and that what you might actually need is transactional integrity on the smaller quantity of data that you have in other tables. Often such a large table represents some sort of external data such as a log file or a list of users which is either updated from an external source (logs) or is only inserted to most of the time (users). For both situations, there are better solutions than the overkill of InnoDB. If you haven't normalized the pants out of the table, that's probably a good place to start. Anything you can do to trim a few bytes off the row size will make a big difference in the size of the overall table. (Is this table part of a data warehouse?). Smaller data will always be faster than bigger data. I don't mean any offense, but I could not disagree more with ... well, every sentence. First off, normalization is the antithesis of performance, as it almost always results in more joins. It's the right thing to do in many cases, but think twice before normalizing the pants out of the table for performance. It won't be a win. The row size is ignorable, unless you've constructed your data and your indexes poorly. If you need to fetch every record, then of course, you want to have as little data as possible, but if you just need to fetch key records or compute summary information, then row size is not your most important concern by far. Smaller data vs. bigger data is orders of magnitude less important than less data vs. more data, and the way you reduce the AMOUNT of data is to use indexes wisely. This reduces the amount of data that any given query must interact with, rather than trying to reduce the data in the table. You can also, as one other person pointed out, use merge tables (a MyISAM feature) to break the data up, but with only 80GB of data, I would not worry about that just yet. Other things to look at: The tuning parameters for the database. Ideally, you want to be able to suck all of the indexes for your giant table into RAM. That means you need lots of RAM, and it also means that you need to hack the MySQL configs. There's a great book on MySQL tuning from O'Reilly that I suggest you check out. ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
[Boston.pm] LARGE MySQL Database
Howdy all, I know this isn't specifically a Perl question. But I AM using Perl with this project. Basically I am dealing with using, storing, and sorting a LOT of data in a mysql database. With all the data in the table it makes for 404.8 Million rows. In a backup sql file that makes just under 80GB. I an using the InnoDB engine. I was just wondering if anyone else has had experience working with databases this large, and using MySQL. I've run into some smaller problems along the way due to the immensity of this table. In the end, to do what we want I will be creating a smaller table, with a subset of entries from the original. But the original needs to exist as well. I'm looking for heads up warning for things I should watch out for due to the size of this thing, or any suggestions on speedier sorting and querying. Thanks a lot. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
[Boston.pm] parsing CSV string with a comma in it
Hello all, I know there's gotta be a nice and easy way to do this. Basically take, for example, the following file: --FILE-- item1a,item2a,item3a part1, item3a part2,item4a,item5a,item6a item1b,item2b,item3b part1, item3b part2,item4b,item5b,item6b .. --FILE-- So, when reading in this file I need to parse each line out into the proper segments: [open file] while (FILE) { my ($item1,$item2,$item3,$item4,$item5,$item6) = [parse $_] } [close file] What would be the best way to handle this? Should I use something like Text::CSV handle this? I would prefer to not need an extra module, but am willing to use one if necessary. Thanks. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
[Boston.pm] one more upload question
Hello All, I know that I have asked a couple questions along this line before, but I think I can be a little more specific with my question this time. Basically, I want to do the following lines withOUT using the CGI.pm qery method: my $query = new CGI; my $file = $query-upload('file'); What is it exactly that the upload function here does? Can I do this manually? I know this may seem kind of like re-inventing the wheel. But let's just leave it at This is what I want to do. To paint the fuller picture the below code is what I want to do without reading in the file through CGI.pm: - CODE open (UPLOAD, $path) || Error(Could not open file for writing: $path,1); my $query = new CGI; my $file = $query-upload('file'); if ($file) { while ($bytesread=read($file,$buffer,1024)) { print UPLOAD $buffer; } }else { Error(File ($file) is undefined.,1); } close (UPLOAD); - CODE What do you think guys? This CAN'T be that tricky. Thanks for any thoughts or advice. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Pretty Graphs with Perl
OK, so I now have the graph being built and being displayed in my html through an image tag. I'm still trying out GD::Graph printing through an IMG tag calling my script for now. I will try other methods next. However, I'm having some difficulty putting dynamic data into the plots. For example. Say I read in my parameters handed into my graph-building script and produce these variables: # Width of graph my $width = $param{'width'}; # height of graph my $height = $param{'height'}; # Y Axis max value my $yMax = $param{'yMax'}; # Now let's setup the data for the graph: my @data = ([1st,2nd,3rd,4th,5th,6th,7th, 8th, 9th] ); # all datasets separated by :: my $ds=1; # dataset counter # go through each dataset one at a time. foreach my $dataset(split(/::/, $param{'x'})) { my $i=0; # Go through each item in the dataset foreach my $num (split(/,/, $dataset)) { $data[$ds][$i++] = $num; } $ds++; } For the sake of making things easier, let's say that each dataset has exactly 10 integers separated by commas, and there are 2 datasets. So $param{'x'} would look something like this: 1,2,3,4,5,6,7,8,9,10::13,12,10,8,8,6,4,3,1,0 I get a broken image when I try to execute this (with the rest of the code listed below). If I manually setup @data it works fine. But if I try to us the data sent to the script, then it doesn't work. I have tested @data to make sure that my info is being stored; I simply do a print statment and take a look at specific spots in @data, like $data[1][4]. It it DOES print out the correct value '5'. I've tried several methods, but for some reason I can't seem to put the data in correctly. I know I must be doing something silly and small. Any ideas? Thanks. --Alex P.S. Ann, you're probably right that at some point I will need to hand some of this information to my script differently, as I am likely to surpass the 2048 character limit. But for now I'm just doing tiny tests :) Code: -- my $graph = GD::Graph::lines-new($width, $height); $graph-set( x_label = $param{'xLabel'}, y_label = $param{'yLabel'}, title = $param{'title'}, # Show the grid long_ticks = 0, # Show values on top of each bar show_values = 1, # Draw datasets in 'solid', 'dashed', 'dotted' and 'dotted-dashed' lines line_types = [1, 2, 3, 4], # Set the thickness of line line_width = 1, # Setting the max Y value y_max_value = $yMax, # Setting the number of values to show on Y axis y_tick_number = $yMax, # skip every __ values to display on Y axis y_label_skip = 1, dclrs = ['blue', 'green', 'red', 'cyan'] ) or die $graph-error; my $format = $graph-export_format; print header(image/$format); binmode STDOUT; print $graph-plot([EMAIL PROTECTED])-$format(); On 12/6/05, Ricker, William [EMAIL PROTECTED] wrote: * *Does anyone who has/does use GD::Graph know if there's an easy way to * *embed the output graphs into HTML. * *Basically I'd like to be able to print a bunch of HTML, then the graph, * *then some more HTML. [WDR] The basic techniques are to either (a) img href=../graphs/123456789.png Generate the graph to a 2nd file named with a random number (for security) or a serial number (if no security needed) my $thisgraph; # uniq name $this_graph = sprintf %s/%d.png, $graphdir, rand($bignumber) while -r $thisgraph; print qq{img href=$this_graph size=$normal_size}; put_to_file($gd-png(), $this_graph); where put_to_file is something like (from GD::Image png method notes) sub put_to_file { my ($data, $fn)[EMAIL PROTECTED]; my $fh; open $fh, $fh or die; binmode $fh; print $fh $data or die; close $fh or die; } (b) img href=/scripts/imagemaker?x=17y=42title=%22Foo%20Bar%22xname=Xyname=Y Put the code that decides what to do from the Request in a module, and call it from both the CGI or action module that generates the HTML page (which generates the img link) and the CGI or action module that generates the dynamic graphic (in response to the img link). Some amount of setup work (varies with app) would have to be redone or saved in DB or some other place (with unique names!), but at least the code is reused in a module. In this case, you put all the request parameters that the graph module needs on the IMG URI, or copy all the request parms to be safe if you don't know; since it's a module, it should know. One module, one script could do both Page and Image requests, with a arg difference (or HTTP context wanting text/html or image/*?) determining which to generate. A has efficiency advantages in that any shared setup work for the page and the graphic is done once. B allows someone to statically deep link or bookmark an image.
Re: [Boston.pm] Pretty Graphs with Perl
Just replacing my dataset collection method with your dataset collection method seems to have fixed things up. Wonderful. Now I can really get testing! Thanks all. --Alex On 12/7/05, Ronald J Kimball [EMAIL PROTECTED] wrote: On Wed, Dec 07, 2005 at 09:39:45AM -0500, Alex Brelsfoard wrote: my $ds=1; # dataset counter # go through each dataset one at a time. foreach my $dataset(split(/::/, $param{'x'})) { my $i=0; # Go through each item in the dataset foreach my $num (split(/,/, $dataset)) { $data[$ds][$i++] = $num; } $ds++; } For the sake of making things easier, let's say that each dataset has exactly 10 integers separated by commas, and there are 2 datasets. So $param{'x'} would look something like this: 1,2,3,4,5,6,7,8,9,10::13,12,10,8,8,6,4,3,1,0 The code seems to work fine for me, but I wonder why you don't just do this: foreach my $dataset (split /::/, $param{'x'}) { push @data, [split /,/, $dataset]; } I get a broken image when I try to execute this (with the rest of the code listed below). If I manually setup @data it works fine. But if I try to us the data sent to the script, then it doesn't work. I have tested @data to make sure that my info is being stored; I simply do a print statment and take a look at specific spots in @data, like $data[1][4]. It it DOES print out the correct value '5'. I've tried several methods, but for some reason I can't seem to put the data in correctly. If you're only looking at specific spots in @data, then you could be overlooking where the actual problem is. I'd suggest doing a dump of @data with Data::Dumper or Data::Dump. I'd also check for errors and warnings from the script, either in the web server logs or by running the script from the command line. Ronald ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] re PHP Succeeding / Perl vs Python / etc
Where's a good place to go to start learning Ruby? On 11/7/05, Ben Tilly [EMAIL PROTECTED] wrote: On 11/7/05, Bogart Salzberg [EMAIL PROTECTED] wrote: [...] I would be curious to hear from someone who actually knows Python/ Ruby and Perl. Which one would he/she rather use to accomplish typical tasks of varying scopes? Forget benchmarks and keystrokes for a moment. Which one would he/she rather use? [...] Personally I would not want to use Python. Their attitude towards closures makes inconvenient a family of techniques that I use. YMMV as to whether that matters to you. Between Perl and Ruby, I believe that raw programming is more productive in Ruby but it is missing CPAN. So if I wanted to build something complex which there isn't much prior art for, then I'd be inclined to recommend Ruby. But for smaller jobs, Perl wins because you don't have to write significant pieces. Cheers, Ben ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] XML::Twig RE: XML::XPath
Thanks Bill, But my server does not have Twig installed. And I doubt they will. I might try and install it in my own space (don't know how much they'd like that...). But for now I'd like to see if I could make either XML::DOM or XML::XPATH work. Thanks. --Alex On 10/27/05, Ricker, William [EMAIL PROTECTED] wrote: How do I pull out multiple KEYWORDs from this XML file using this style code? [Example with XML::XPath omitted] I prefer XML::Twig's variation of XPaths, which allow Perl regex matching too. http://search.cpan.org/~mirod/XML-Twig-3.22/Twig.pm http://xmltwig.com/xmltwig/ I used it yesterday to solve a problem that XSL and XPath query couldn't do from Java. Bill -- Not speaking for the Firm. ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
[Boston.pm] Using Perl to communicate to a Palm device
Has anyone here used Perl to communicate to a Palm device? What I am primarily concerned with is updating the calendar with a specific event. I have a scheduling system, calendar system, and event's registration system that I'd like to create functions for. Basically someone would view an event they would like to remember, click a link which would calla Perl function to create a PDB file which the user is then asked to download or open. This would then send the file in preparation to be hotsync'd. Make sense? If anyone has any good resources (modules, web sites, code, etc.) I would greatly appreciate any advice. Thanks. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Using Perl to communicate to a Palm device
Uri, I found http://www.pilot-link.org/ . This sounds like what you're talking about. I'll take a look at see what I can find. Kag, I found p5-Palm right after I sent my email. Do you know how easy it is to update the Palm's Calendar through this module? Thanks, both of you. --Alex On 10/26/05, Kenneth A Graves [EMAIL PROTECTED] wrote: On Wed, 2005-10-26 at 10:00, Alex Brelsfoard wrote: Has anyone here used Perl to communicate to a Palm device? What I am primarily concerned with is updating the calendar with a specific event. I have a scheduling system, calendar system, and event's registration system that I'd like to create functions for. Basically someone would view an event they would like to remember, click a link which would calla Perl function to create a PDB file which the user is then asked to download or open. This would then send the file in preparation to be hotsync'd. Make sense? If anyone has any good resources (modules, web sites, code, etc.) I would greatly appreciate any advice. I haven't used it for much more than variants on the pdbdump script that comes with the distribution, but http://search.cpan.org/~arensb/p5-Palm-1.3.0/ should have all of the PDB-related functions you need. --kag ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
[Boston.pm] XML::XPath
OK, so I'm new to handling XML in Perl. I think I've got most of what I need figured out, but I'm running into some difficutly in handling one situation. Each DOC has more than one KEYWORD entry. How do I pull out multiple KEYWORDs from this XML file using this style code? use XML::XPath; my $file = blah.xml; my $xml = XML::XPath-new(filename = $file); print p\n; foreach my $item ($xml-find('//DOC')-get_nodelist){ print $item-find('NUMBER')-string_value.br\n; print $item-find('KEYWORD')-string_value.br\n; } print /p\n; Also, does anyone know of any good site(s) for Perl XML::XPath syntax/examples? Thanks a lot. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
[Boston.pm] Printing files with SSI's using Apache 2
Our servers are upgrading to Apache 2 soon, and I wanted to get a head start on one feature that I know you can do using Apache2. I need some of my scripts to read in HTML header and footer files, process ALL the SSI stuff in them, and print them out accordingly. I am currently doing this with the SSI module but it doesn't handle many SSI calls, such as if statements. I'm wondering what the procedure will be with Apache2? Any ideas/suggestions? Thanks. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] DBI connection to an Oracle db
Thanks very much. With some small changes from my dba I was able to get things working nicely. yippee. --Alex On 9/16/05, Ricker, William [EMAIL PROTECTED] wrote: Do we need this installed? Probably. I don't think you can even build DBD::Oracle without having the Oracle client libraries on the machine. Indeed. See Tim Bunce's recommendations on building DBI and DBD::*, or the DBI bundle README file. Tim recommends building Perl from sources, then DBI and DBD::* in sequence to ensure that things link just so. http://search.cpan.org/src/TIMB/DBI-1.46/README http://dbi.perl.org/ Bill ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
[Boston.pm] DBI connection to an Oracle db
OK, I know this should be easy and straight forward. But I'm having difficulty connecting to an Oracle database. I am working on a machine that is connected, by lan, to the oracle server. This is some of the code I've tried: my $databaseName = 'nameOfDatabase'; my $dbuser = 'me'; my $dbpass = 'myPass'; my $hostname = 'my.oracle.server'; my $dbh = DBI-connect(DBI:Oracle: $databaseName,$dbuser,$dbpass) || Error(Cannot connect to database); my $sth = $dbh-prepare(show tables); $sth-execute; print brbrtable class=\data\ cellspacing=\1\\n; while (my @results = $sth-fetchrow_array) { print tr\n; foreach my $result(@results) { print td$result/td\n; } print /tr\n; } print /table\n; All that happens is I get the Cannot connect to database error. The connection is not working. I noticed that there is no specification of where the database is being hosted. Granted all the examples I found for using DBI to connect to an oracle database never specified one either. But I just figured that it was because their oracle db is on the same server. Mine is not. So I've also tried: my $dbh = DBI-connect(DBI:Oracle:host=$hostname;database=$databaseName,$dbuser,$dbpass) || Error(Cannot connect to database); But this didn't change the outcome at all. I checked with the database administrator and my server has access to the database. What am I doing wrong? I connect to MySQL servers all the time. But I can't seem to connect to this oracle database. Oh, I also checked to make sure that an Oracle driver is installed for DBI, and it IS. Any ideas? Thanks. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] DBI connection to an Oracle db
Thanks that does clarify quite a bit. Would I get the sid from the database administrator? Or is this something else? Thanks. --Alex On 9/15/05, Ronald J Kimball [EMAIL PROTECTED] wrote: On Thu, Sep 15, 2005 at 01:30:54PM -0400, Alex Brelsfoard wrote: my $databaseName = 'nameOfDatabase'; my $dbuser = 'me'; my $dbpass = 'myPass'; my $hostname = 'my.oracle.server'; my $dbh = DBI-connect(DBI:Oracle: $databaseName,$dbuser,$dbpass) || Error(Cannot connect to database); All that happens is I get the Cannot connect to database error. The connection is not working. I noticed that there is no specification of where the database is being hosted. Granted all the examples I found for using DBI to connect to an oracle database never specified one either. But I just figured that it was because their oracle db is on the same server. Mine is not. If you use the database name syntax, then the ORACLE_HOME environment variable must be set, and the database name must be defined in the tnsnames.ora file, which will specify the host and sid for the database. (I'm not sure a space is allowed before the database name, but maybe it's just ignored.) my $dbh = DBI-connect(dbi:Oracle:$databaseName,$dbuser,$dbpass) If the database name is not defined in tnsnames.ora, you can specify host and sid in the connect instead. my $dbh = DBI-connect(dbi:Oracle:host=$hostname;sid=$sid,$dbuser,$dbpass) HTH, Ronald ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
[Boston.pm] taking in info from command-line command
OK, so I know there's an easy-ish way to handle this situation. But I'm currently running in circles, not finding the solution. Basically what I'm trying to do is run a system command (with either `command` or system(commnad) ) and retrieve the printed result form the command into a variable of some sort. So think of it this way: my $info = `ls`; or for Windows users: my $info = `dir`; If I run this from the command line it will print the results (because the command was run), but the output is NOT put into $info. I don't care what kind of variable (scalar, array, etc.) this information is stored in, but all the ways I've been trying are NOT working. I guess it's important to know that this will in the end be used in a web app. Thanks for any help. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Reading Cookies
Thanks everyone for your help. I played around with the location of some of the code and some of the parameters of the cookies per your suggestions. Things seem to be behaving now. Thanks very much. --Alex Quoting Kenneth A Graves [EMAIL PROTECTED]: On Wed, 2005-06-29 at 12:10, Alex Brelsfoard wrote: OK, Now, my fixed code to be able to write cookies in any browser is as follows: -- my $cookie = $q-cookie( -name= $COOKIENAME, -value = $cookieContent, -domain = www.wpi.edu, -expires = +1h, -path= /cgi-bin/Regi, -secure = 1 ); print Set-Cookie: $cookie\n; -- However, once I write the cookie this way, my cookie retrieval function no longer works. Try piece-wise changing this code. If you aren't always coming in via https://, then you don't want -secure=1. If you aren't always accessing the cookie from below /cgi-bin/Regi, then you want a less restrictive path. And if you are in a virtual host situation where the requesting URL might not be www.wpi.edu, then you need to change the domain. I'd start with eliminating (or weakening) the path and secure options first, since they don't seem to be in the home-baked cookie you were using earlier. --kag ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
[Boston.pm] Writing Cookies in Safari
OK, so my code for writing cookies works in every browser except Safari. I have tried using two different methods of using CGI.PM. In both cases the cookies continue to write correctly in all browsers except Safari. Here is the code I started with and have reverted back to: -- my $cookie = Set-Cookie: . $COOKIENAME=$cookieContent; . Host=www.wpi.edu; . expires=+1h\n; print $cookie; -- Any ideas of how to do this and get it to work on Safari. I can't believe that this is so complicated. I can tell you that there is NO chance that anythign is being printed in any way before this code is reached. Any ideas? Thanks. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Writing Cookies in Safari
OK, So I mangled things around and now I can get the cookie written using CGI.PM It looks something like this: my $q = new CGI; my $cookie = $q-cookie( -name= $COOKIENAME, -value = $cookieContent, -domain = www.wpi.edu, -expires = +1h, -path= /cgi-bin/Regi, -secure = 1 ); print $q-header(-cookie=$cookie); But this has introduced a new problem. The very next thing I am doing in my script is forwarding the user to a different script, just with a simple print Location: ...\n\n command. But now that the header has been printed with CGI, this does not work. Is there any way for me to forward the user on to another page at this point? Any advice? Thanks again. --Alex Quoting [EMAIL PROTECTED]: Quoting Philipp Hanes [EMAIL PROTECTED]: Here is the code I started with and have reverted back to: -- my $cookie = Set-Cookie: . $COOKIENAME=$cookieContent; . Host=www.wpi.edu; . expires=+1h\n; print $cookie; -- One thing I notice is that the RFC mentions Domain and not Host http://www.faqs.org/rfcs/rfc2965.html Also, Version is required, according to that document. It's been a long time since I built cookies by hand, but perhaps the cookie is being rejected because it does not conform? ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Writing Cookies in Safari --update
Ugh.. OK, step by stepping it. I've got the forwarding working, however, now my script has stopped reading the cookies. Not only can I not ready MY cookie, but I can't ready ANY cookie. This function was working perfectly fine. I didn't touch it at all while IO was testing the writing of the cookie. But now that the cookie can be written correctly in all browsers it will not read at all. I have even tried printing out ALL the cookies. It prints nothing. poop. Here's what I've got: -- my %cookies = fetch CGI::Cookie; my $userInfo = $cookies{$COOKIENAME}-value; -- I get an error on the second line of that code: Can't call method value on an undefined value at functions.pl line 45. My brain is melting. any help would be much appreciated. Thanks. --Alex Quoting Alex Brelsfoard [EMAIL PROTECTED]: OK, So I mangled things around and now I can get the cookie written using CGI.PM It looks something like this: my $q = new CGI; my $cookie = $q-cookie( -name= $COOKIENAME, -value = $cookieContent, -domain = www.wpi.edu, -expires = +1h, -path= /cgi-bin/Regi, -secure = 1 ); print $q-header(-cookie=$cookie); But this has introduced a new problem. The very next thing I am doing in my script is forwarding the user to a different script, just with a simple print Location: ...\n\n command. But now that the header has been printed with CGI, this does not work. Is there any way for me to forward the user on to another page at this point? Any advice? Thanks again. --Alex Quoting [EMAIL PROTECTED]: Quoting Philipp Hanes [EMAIL PROTECTED]: Here is the code I started with and have reverted back to: -- my $cookie = Set-Cookie: . $COOKIENAME=$cookieContent; . Host=www.wpi.edu; . expires=+1h\n; print $cookie; -- One thing I notice is that the RFC mentions Domain and not Host http://www.faqs.org/rfcs/rfc2965.html Also, Version is required, according to that document. It's been a long time since I built cookies by hand, but perhaps the cookie is being rejected because it does not conform? ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] GoogleGeoCoder
Very cool. This could be VERY useful. Nice work. --Alex Quoting Joel Gwynn [EMAIL PROTECTED]: Allow me to add the latest Me Too! to the Google Maps frenzy. I cooked up a simple wrapper around GoogleMaps to provide a geocoding function. http://joelman.com/cgi-bin/GoogleGeoCode.cgi Given an address, it returns either: 1. A hashref containing the lat/long of the address or in the case of multiple matches: 2. An arrayref of hashrefs of lat/longs Comments are welcome; this is my first time releasing a module into the wild, so be nice ;) Joel ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
[Boston.pm] Empty radio and checkboxes not passed to perl script
OK, so I figured out, the hard way, a while ago that when you submit a form with a checkbox or radio button with nothing checked, said checkbox or radio button's field name does NOT get sent, via the browser, to my perl script. It's as if it does not exist. Is there a way to guarantee that the field names will be passed to my script? The following ideas are options I would _not_ like to follow if possible: - set a default checkbox or redio button (so something is always filled in). - use a hidden field to list of all the fields in the form. - have the perl script read the HTML code from the page and make its own list. - javascript I kinda understand why the browser doesn't send this information (no value to hold onto), but there HAS to be a solution for this. Seems frightfully stupid not to have an easy option out there for something like this. Thanks. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Empty radio and checkboxes not passed to perl scr ipt
Thanks. It's good to know that someone else has noticed this oddity. Sad to say that mny of my user turn off javascript. So I'm am going to have to deal with this on the perl side I've created a script to build a hidden field for me that lists all the non-hidden form fields. So for the moment I will be using that. I also plan on creating a module for my script that will go to the requesting page and read the HTML and decipher all the appropriate fields. But this feature will have to be used sparingly. Just seems like a lot of work for something that should have been handled by the browsers. --Alex The following ideas are options I would _not_ like to follow if possible: - set a default checkbox or redio button (so something is always filled in). - use a hidden field to list of all the fields in the form. - have the perl script read the HTML code from the page and make its own list. - javascript I kinda understand why the browser doesn't send this information (no value to hold onto), but there HAS to be a solution for this. Seems frightfully stupid not to have an easy option out there for something like this. No solution other than the ones you mentioned, that I'm aware of. What we've done is generally a hidden field that gets fiddled with via JavaScript when the checkbox is changed. Then the back-end code just looks at the hidden field, and can be totally oblivious to what's really going on in the HTML. Yup, seems stupid to me, each time I run into it again, too. I'd be curious if someone has come up with something better. Doubtful, though. good luck philipp ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Empty radio and checkboxes not passed to perl scr ipt
Forgive my ignorance, but why would it be a problem not to have these? Picture a web form that is some sort of a survey. When that survey is submit the perl script writes out the answers onto a file. That file is tab delimited. Now picture the first person going to the form and filling everything out, including all checkboxes and radio buttons. Now the second person comes along and chooses not to fill in a radio button. When that form's information is sent to the script it is missing that radio buttons field name and therefore misses that tab, and all the results get skewed. Information becomes invalid, people get unhappy, heads are lost, cats and dogs start getting married, and all the worlds wine turns into bags of turnips. In other words, not terribly fun. --Alex On 5/26/05, Philipp Hanes [EMAIL PROTECTED] wrote: The following ideas are options I would _not_ like to follow if possible: - set a default checkbox or redio button (so something is always filled in). - use a hidden field to list of all the fields in the form. - have the perl script read the HTML code from the page and make its own list. - javascript I kinda understand why the browser doesn't send this information (no value to hold onto), but there HAS to be a solution for this. Seems frightfully stupid not to have an easy option out there for something like this. No solution other than the ones you mentioned, that I'm aware of. What we've done is generally a hidden field that gets fiddled with via JavaScript when the checkbox is changed. Then the back-end code just looks at the hidden field, and can be totally oblivious to what's really going on in the HTML. Yup, seems stupid to me, each time I run into it again, too. I'd be curious if someone has come up with something better. Doubtful, though. good luck philipp ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Empty radio and checkboxes not passed to perl scr ipt
On Thu, 26 May 2005, Alex Brelsfoard wrote: Picture a web form that is some sort of a survey. When that survey is submit the perl script writes out the answers onto a file. That file is tab delimited. Stop right there, doctor, I think we've found the problem. Actually the problem exists BEFORE this part. You see, the script never receives the field name and therefore does NOTHING with. It only knows to do with what it is given. So my storage format (not decided be me for the record) is not the issue. Think of it this way: My perl script reads in all the data sent to it, creating a list of fields. Then I spit out the values associated with those fields (who cares how). But when a checkbox is NOT filled in, that field name is NOT sent to my script. So the list of fields is one field shorter than it should be. And with dynamic or otherwise changing field names. yeah I'm screwed. A little clearer? --Alex If you used a more robust storage format, this problem would go away, right? For simple, you could just do something like the Windows INI format, which is just blocks of key/value pairs, and can be driven from Perl -- provided you don't want to just roll your own code -- using a module like Config::IniFiles or Config::IniHash: http://search.cpan.org/~gcarls/Config-IniFiles/IniFiles.pm http://search.cpan.org/~jenda/Config-IniHash/IniHash.pm Or you could get fancy and use a tied hash, a BDB database, a SQLite database, or a proper database server. The key thing to keep in mind is that you're currently describing a brittle format for maintaining lists of key/value pairs, but there's lots of other ways to go about this. In other words, not terribly fun. Thankfully, these calamities are easily preventable :-) -- Chris Devers ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Empty radio and checkboxes not passed to perl scr ipt
Thanks Sibu. But the problems is that even the names of the checkboxes and radio buttons are going to be dynamic. I really can't hard code any names like this. Thanks. --Alex Hi, We use something like following at the Perl level to check for radio button and check boxes that are not passed from HTML form. #-- # At CGI save level, receive all the params using CGI object. my $cgi = $self-query(); my @array = $cgi-param; # Make a key value pair of normal HTML elements from form and also extract checkbox group and multi-list selection box # values in to a single comma separated value. my %form = map { $_ = scalar @{[ $cgi-param( $_ ) ]} == 1 ? $cgi-param( $_ ) : join(,, $cgi-param( $_ ) ) } @array; my $form = setHTMLTagValues(\%form}; foreach (sort keys %$form) { # Save to database or do whatever you want to do. } #-- sub setHTMLTagValues { my $hash = shift; # You can add different profiles for each forms used here. my @array = ('Radio1','Radio2','Check1'); # Set any value so that the script finds the name of the missing HTML tag while processing. map{ $hash-[EMAIL PROTECTED] = '' if(!exists( $hash-{$_} )); } @array; return($hash); } HTH Thanks Sibu Thomas Liaison Inernational Inc Watertown, MA -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alex Brelsfoard Sent: Thursday, May 26, 2005 10:56 AM To: Joel Gwynn Cc: boston-pm@mail.pm.org Subject: Re: [Boston.pm] Empty radio and checkboxes not passed to perl scr ipt Forgive my ignorance, but why would it be a problem not to have these? Picture a web form that is some sort of a survey. When that survey is submit the perl script writes out the answers onto a file. That file is tab delimited. Now picture the first person going to the form and filling everything out, including all checkboxes and radio buttons. Now the second person comes along and chooses not to fill in a radio button. When that form's information is sent to the script it is missing that radio buttons field name and therefore misses that tab, and all the results get skewed. Information becomes invalid, people get unhappy, heads are lost, cats and dogs start getting married, and all the worlds wine turns into bags of turnips. In other words, not terribly fun. --Alex On 5/26/05, Philipp Hanes [EMAIL PROTECTED] wrote: The following ideas are options I would _not_ like to follow if possible: - set a default checkbox or redio button (so something is always filled in). - use a hidden field to list of all the fields in the form. - have the perl script read the HTML code from the page and make its own list. - javascript I kinda understand why the browser doesn't send this information (no value to hold onto), but there HAS to be a solution for this. Seems frightfully stupid not to have an easy option out there for something like this. No solution other than the ones you mentioned, that I'm aware of. What we've done is generally a hidden field that gets fiddled with via JavaScript when the checkbox is changed. Then the back-end code just looks at the hidden field, and can be totally oblivious to what's really going on in the HTML. Yup, seems stupid to me, each time I run into it again, too. I'd be curious if someone has come up with something better. Doubtful, though. good luck philipp ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Empty radio and checkboxes not passed to perl scr ipt
Yeah, but still we need to remember to put that hidden field in to hold the place of the checkbox's name. Part of my problem is that there are MANY differen humans who are making forms who use my script. WAY too much human error availability. My helper script that reads the HTML to create a list of fields is a bit safer (though still not the answer I'm looking for). shrug --Alex On May 26, 2005, at 11:22 AM, Alex Brelsfoard wrote: This is indeed the case. If browsers reliably submitted form fields in the same order they were listed in the HTML source, then you could double up with a hidden form field like form method=get input type=hidden name=sign_me_up value=0 input type=checkbox name=sign_me_up input type=submit value=Go /form and then receive either form.html?sign_me_up=0 or form.html?sign_me_up=0sign_me_up=on and have the second value clobber the first, but I've heard they don't. Also, CGI.pm would treat it as a multiple select and even parsing it yourself would get confusing if any multiple selects actually were tacked on. The browser is supposed to submit a supplied checkbox 'value' if checked. So you could create a special value like 'rutabaga' or '4kj5h245kjh245' that is extremely unlikely to appear in any other input type, and process fields with this value so that the field is considered true whether the hidden field with the zero comes before or after it. form method=get input type=hidden name=sign_me_up value=0 input type=checkbox name=sign_me_up value=4kj5h245kjh245 input type=submit value=Go /form Bogart ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Empty radio and checkboxes not passed to perl script
Well, it's all moot for me anyways. Many of my users will have javascript turned off. So I am used to NOT relying on javascript for anything. --Alex CD == Chris Devers [EMAIL PROTECTED] writes: CD On Thu, 26 May 2005, Uri Guttman wrote: [...] the common falacy of using javascript for data validation which leads to dropping that from the server. CD What fallacy is this ? CD There's nothing wrong with using Javascript to validate form data, and CD if you do it well, you can provide better and more immediate feedback to CD the user without having to make round trips back forth with the server CD to do the same thing. The application ends up feeling more responsive CD and the bandwidth load on the server is reduced. I see nothing at all CD wrong with using Javascript this way. CD The fallacy is failing to validate things on the *server*. that was my point. i may have not stated it well. but the OP's mentioning of using javashit to force some default value or something on an unchecked radio button is related to this. since you can submit via LWP and not run any JS, the server must always validate. so the JS answer is just plain no good. CD Properly done, validation should happen on *both* sides, but minimally CD it has to happen on your side. it doesn't ever have to be done on the client side. that is totally a 'user unfriendly' design choice and irrelevant to the OP's problem. it can be nicer for complex forms when it tells you that you missed a required value and such. many times it can be annoying but that is about UI and not validation. uri -- Uri Guttman -- [EMAIL PROTECTED] http://www.stemsystems.com --Perl Consulting, Stem Development, Systems Architecture, Design and Coding- Search or Offer Perl Jobs http://jobs.perl.org ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] HTML Renderer
You might also want to lookin into Image::Magick. It does some pretty impressive things and I could have sworn I read somehwere that it could do just that. I have used Image:Magick before and it's very fun and easy. I would definitely suggest looking into it. I will too if I get some time later. --Alex I'm looking for a server-based object that will do a virtual screen capture of a web page and save the result as a jpg. Sort of like http://bettersearch.g-blog.net/ ideally, it would take a url as an argument, and return a jpg. Is there such a beast? ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
[Boston.pm] sending a user to the middle of a page from a form post
OK, so here's what we've got. We have a perl CGI that spits out a form based on some info in a db. A user will fill out that form and hit submit. the submission actually goes to the same CGI which now interprets what it needs to do (basically its handed search criteria). It then spits out a long html page. Here's where my question comes in. Is there any way to have the content all spat out and then send some sort of message to the browser telling it to go to a specific anchor point on that page? Ideas? Thanks. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] (also) Perl
I think we're still getting ahead of ourselves here. YES, we are all Perl programmers and love Perl. That doesn't mean we have to see eye-to-eye on ANYTHING else. It'd be nice. But who are we kidding. We're all different. I bring this up to help wash over some of these extraneous issues: Another worst case for certification is that the community bifurcates from those who are rabidly anti-certification, and they take their efforts and talents elsewhere. And their patches. And stop maintaining their modules. A good programmer is a good programmer. A good person is a good person. If someone is going to stop programming in Perl simply because it becomes popular (and therfore flooded with lesser programmers), then that person is REALLY immature and (I hate to say it) an idiot. There are good reasons to do a lot of things. But stopping from doing something good that you love simply because other people are doing it too just sounds a little too a-la-13-year-old for me to really put much care into. Good riddens I say. - there is no demonstrable evidence that there is a mass of programmers ready to use Perl, if only there were a certification they could get We're talking need based. If a certification program were created, then managers would want more Perl programmers, then the need for new Perl programmers would increase, and people would respond. That IS demonstrated. It's economics 101. This is incredibly well documented. - there is no demonstrable evidence that there is a pool of employers that do not use Perl simply because there are no certified applicants We've listed several instances where the manager/boss simply doesn't know enough to know that Perl is a good thing. This whole discussion is in an attempt to find ways to make managers see that Perl is real and respectable. we believe that certification would HELP in this manner. - Many Perl trainers are vehemently anti-certification. A certification without a supporting training curriculum is dead in the water. Again, if people want to be stupid, they can be. If you're a talented Perl programmer who can train other people, then you're in good standing to make more money and teach MORE people how to program Perl better than if they learned elsewhere or on their own. If you want to flee because it gets popular... again you're immature and an idiot. Sorry. Plus there are, as you said plenty of other Perl Gurus (some on this list) who are definitely capable, and probably willing. Again we're trying to better the Perl communittee. If trainers are going to run away now, then they don't have the Perl comunittee in their list of interests. - Lots of programmers have a whole litany of excuses as to why they avoid using Perl. Ugly code is one. Excessive use of punctuation is another. Impenetrable regular expressions a third. Odd OOP practices a fourth. And so on. Lack of certification options is almost never a reason for programmers to not use Perl. Again, you're talking about programmers here. Better programming practices can be solved in a number of different ways and times. Right now, we're trying to convince the bosses. The bosses are not going to know or understand any of the above. Perl is NOT the solution to all problems. But it IS the solution to far more problems than managers are aware. - Another reason why Perl is a minority language is that it's not used in academic curricula. Certification will not solve that problem, either. We'll still have a glut of VB, Java and C# programmers after a certification is done. Actually WPI, and other education institutions are starting to ban the use of PHP and other languages due to bugginess and insecurities. WPI does most of its programming in Perl; by the end of the summer we shoudl be entirely PHP-free. And proud of it! - One reason why many shops avoid Perl is the lack of vendor support. Certification does nothing to address this. Verndors avoid Perl, because you don't NEED anything to program perl. So they can't make any money off it. This is actually a selling point ot managers. Perl is WAY cheaper than most other languages that you can compare it to. You don't need any expensive software or hardware to use it. - Even with a certification program, the underlying problems with Perl still need to be addressed: mod_perl is too hard to manage in many situations, applications like RT take entirely too much work to install, and so on. [1] Again, back on the programming side of things. Certificaiton might actually help with this. It might open up more opportunities for further education and training in Perl. Once Java certification came about a lot of people wanted to learn more. So more training facilities openned up to do
Re: [Boston.pm] advocacy
See, now we're talking Alex Brelsfoard wrote: What about a website advertising scheme? Make a really neat/interesting/technological website based out of Perl and then see if we could get some companies to advertsie it (such as O'Reilly, Apache, and Google)? Why make something that already exists? If Amazon, Yahoo, Ticketmaster, etc. are already using Perl in a big way, then why not put effort into making that more visible? Well it's just one of many possible idea. I was hoping for more ideas based off it. Such as your email ;) Tom Metro wrote: One way is through a silly button campaign. Built with Perl, Powered by Perl, whatever. We've all seen them around for other products. I've even seen them for Perl, though I don't recall there being any standard or effort to encourage them. I like it. I like it a lot. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] advocacy
When it comes to large companies, that real estate becomes valuable territory and they're not going to donate it for free. The technology you use is an internal decision. It has no relevance to the customer. What is the business case for putting it out there? If you're going to ruin your branding by advertising something, any healthy business is going to advertise something that makes them money. But if we already KNOW that they use Perl, and all we're asking for is a little stamp somewhere saying Made with Perl or whatever that's not really giving anything away. I understand if developing companies don't want to divulge such information. But what is Amazon really worried about? --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] academic use of Perl
Adam Turoff wrote: - Another reason why Perl is a minority language is that it's not used in academic curricula. An interesting point. Sean Quinlan writes: I agree. I'd love to hear suggestions how to work on that. We teach some Perl at BU, both under the bioinformatics program and in some short tutorials, and I'm hoping to expand on that. I seem to recall Harvard having some courses. To be effective at growing the pool of Perl programmers I think Perl needs to be used in a general course that isn't specifically about Perl or some specialty that is already well entrenched with Perl. I wish to clerify a comment about WPI's policy on Perl. My previous statment was from the NON-academic side of WPI. So the school's servers do no accept PHP. But the courses at WPI accept just about all languages. Courses are taught non-language specific. but seeing as how PHP is no longer supported on our servers, students can no longer run tests on our servers unless they use an acceptable programming language. Perl is becoming more common among our students for this very reason. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] advocacy
Strictly speaking I don't think advertisement did much for Java. Sure, you see lots of ads for Java related products now, which maintains a high visibility for Java, but they exist because the Java market exists. Sure it did. Again, we're talking more about managers and boss types. When a boss decides a companmy is a competitor do you really think that they are not going to find out how their prodecuts are made? And if they go to their competitor's site and see that it was Made with Java, do you really think that this will not peak their interest? If they didn't know anything about Java before then, after then they know that Java was being used by someone they respected. Ads may not be THE answer for Perl, but I can has to help. IMHO. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] (also) Perl
The crux of the problem, is that these questions aren't getting answered: - Can we create a certification that will deliver benefits X, Y and Z? Yes. No one said it would be easy or happen tomorrow. - Is certification a necessary precondition for X, Y and Z? - Aren't problems X', Y' and Z' really caused by something else, not the lack of certification? Certification is not Necessary for anything. It's just something trying to help out a situation. It's not THE solution. It's part of the solution. - Are X, Y and Z important? Desirable? Achievable? Importatn enough for us to argue over it. I know that doesn't really mean much. But the lack of respect that Perl gets has caused a lot of pain, problems, and waste (of time, money, and effort). - Shouldn't we really be focusing on A, B and C instead? We should keep our minds and attention available to a lot of things. As I said, this is not THE solution; it is merely a part of it. Other things need to be considered as well. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] (also) Perl --appologizing
I'm sorry everyone. When I first brought up the question of certification I was really just looking for a way to communicate to people who don't know anything about Perl. I love Perl. I think it can and does do some wonderful things. When I heard the sad story of someone arguing with his manager about Perl it just sparked a feeling in me, reminding me of each time I had to explain why Perl is so good to someone who really should have already know about it. I figured if I emailed my buddies on the Boston.pm list we'd get somewhere. It pains me to see good things get hidden away. You all have always been so friendly, helpful, and full of love for Perl that I figured we might be able to do something. I'm sorry this ended up being such a sensitive subject. I'm still interested in helping to communicate Perl to the world, but I think all these discussions should move off the list, at least for now. Thanks. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] (also) Perl
True programmers aren't the ones we need to tell about Perl. I meant budding web programmers. Are these true programmers? I hope so. Web scripter just doesn't sound as good. We'll call them true programmer's in training. ;) But honestly, MOST true programmers have already heard about Perl, and know it's value. Some will still like Java more, or simply enjoy programming other languages more. But they KNOW about Perl, and they know of its strengths. As far as file/text parsing there really isn't much better out there. Really, if new web programmers want to do some sort of online form to do something they will learn about Perl. I am less worried about convincing new programmers as I am convincing the manegerials out there. The other problem is that JavaScript is a client-side language. Which means that people can see/steal JavaScript code more easily than Perl code. Yes, JavaScript has its niche. It's like the smelly, grimy village idiot who tends the pigs: obnoxious but indispensable. Perl would settle for just being indispensable. Perl doesn't NEED a niche, but it might benefit from finding one on the desktop. I think part of the problem is that it is an open source system that doesn't have a fund for advertising. I think if we simply saw some commercials on tv talking about Perl, or telling about all it's success stories. Heck even if they're just like the Intel commercials simply saying Yeah, here we are. We're Perl. We're cool. Yeah, so like us. It wouldn't take many to make a difference. But don't get me wrong, any new uses/implementations we can think of for Perl, the better. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] (also) Perl
I was not aware that so much discussion about Perl certification had already taken place (though it makes sense that is has). It DOES sound like quite a tough pickle. But you have to imagine, if any group of people were to be able to find a way to make a proper certification program, wouldn't it be a PerlMonger group? Though, I do see what you're saying Uri. You can't really look at Perl coding (or other coding) as simply... well... coding. There's a mentality and thought process to make coding be good coding. This DOES make making a good certification program rather difficult. Still, it makes you wonder if it would be possible... --Alex AB == Alex Brelsfoard [EMAIL PROTECTED] writes: AB I like this idea. I think Perl certification WOULD make the world happier. AB Then again, I like Greg's idea. AB Think maybe some of us PerlMongers could get together and actually start AB up a real Perl certification program? oy!! perl cert has been argued at length in many fora with no victor. my sense is the majority don't want it since it will be only used by those who don't know perl :) ever find an MSCE who actually knew something? most certified computer people just pass a test but don't really know the subject. and mangler who hire based on required certs just don't get it and they get what they deserve. setting up a cert group is a major project. note that most certs are sponsored by the corp behind the product and perl doesn't have a corp. or they are crapola ones like brainbench. perl is also too broad and deep to properly create a standardized test. does it cover OO, CGI, CPAN, regexes, data structures, etc and how deep? specific modules (i have seen that and it is very dumb. you can always read the docs if you don't know a module)? i judge a perl (or any coder) by how they think, interact with problems, how they solved problems in the past, etc. this is best done with a general interview and getting them to talk about their past projects. see the depth of their knowledge in their project areas. see if they have the big picture and attention to detail. see how they use their experience and skills to solve the project problems. see how fast they pick up on project info you give them. those are all untestable skills and they are much more important than any rote test. if they have those skills, they can learn what is needed on the job. if all they can do is parrot book learning, then you will get a parrot. uri -- Uri Guttman -- [EMAIL PROTECTED] http://www.stemsystems.com --Perl Consulting, Stem Development, Systems Architecture, Design and Coding- Search or Offer Perl Jobs http://jobs.perl.org ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] (also) Perl
So no Perl certification? ;) joking. I'm glad this was discussed though. It's always nice to know that there are other people out there who realize that good coding happens from good general knowledge of programming principles, not knowing all the syntax in a language. Plus I had no idea that Perl certification had been thought of/attempted before. Truly, I was simply looking for a way to advertise Perl as being something serious in today's technology. Guess it's back to the drawing board. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Simple switch statement question
I have a quick (hopefully) question on how to do a simple switch statement. The term you want is substitution, rather than switch, which usually has other meanings in a programming context. True, sorry. I was typing in a hurry. Looking back that IS a bit misleading, and uh wrong. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] (also) Perl
Thanks Greg, Yeah, it's easy to get side-tracked on an issue like this. Fighting for Perl's cause is kind of fresh in my mind these days. Mostly because I feel like I have to _fight_ for it. At least lately. I've been explaining things about Perl to those who know nothing about it and therefore think is is a stupid and useless language (because if it wasn't stupid and useless they would know more about it). ugh. It would just be nice if we could do something to make it a little bit clearer to the mass public the power and importance of Perl. And thus help Mike and Nameless Coporation. Even if we did have a bunch more doofs walking around with useless certificates, at least more people would know about Perl. And then I wouldn't need to explain things so much ;) Again, thanks. --Alex Alex Brelsfoard said: So no Perl certification? Alex, You're argument got derailed by a non-sequitor. Manager Mike works at Nameless Corporation and Mike doesn't want his projects using Perl. Your argument was that if some company provided certification, then Mike might allow Perl on his projects. That may actually be a valid claim/argument. The responses you got against certification were no one who has a certificate knows anything and so on. Nothing to do with whether or not certification will convince Mike to allow perl. Now, once Mike allows perl on the project, if the engineering manager, Eve, then decides to hire only programers with certification, then that's a separate problem. One would assume that Eve would have a slightly better grasp on reality than Mike, and so wouldn't put so much stock in certification to make/break a hiring decision. If Mike does allow perl because of certification and Eve is a smart enough engineer/programmer to know not to put too much stock in certification and simply hires the best programmers, then the worst that will happen is an occaisonal dunderhead will get hired with certification and think he knows everything. But at that point, you as a programmer on the project get to use perl, and you just have to put up with a moron coworker. I've lost count of how many places I've worked, but everywhere I've been, there's been a moron. So it isn't any worse than any other job, except you get to use perl. So, if Certification convinces Mike to allow perl, and Eve isn't an idiot, it's an overall win. ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] short-listing languages for applications software development
Well, perhaps we should look at this not so much in the manner of logic, but perhaps scare tactics. For example, WPI recently went through its statistics on hack and hack attempts against the school servers (I know not really a corporate environment, but I'll get to my point). It turns out that over 90% of the hack/hack attempts on the school's servers were done through weaknesses in PHP. If that doesn't scare them, then remind them that the off-the-shelf installation of PHP gives su-root access to anyone who can write PHP; not terribly safe/smart. Not to mention a lot of people who write in PHP (not all) never studied actual programming and therefore do not follow good programming procedures. The list goes on, so I'll shut up about PHP now. Well, you get my point. Start knocking them off one by one. Though C# is not as insecure and scary and PHP, it still has its bugs. the main item I didn't like is that it is not type safe, there are only three variables types About this, you should really ask him why this is a bad thing. I can think up my own reasons, but I'm wondering if thinking along the lines of more is better. Which is NOT always the case. And, if all else fails. Remind everyone that Perl is simply cheaper to write in. You don't need any expensive editors or compilers. You rarely need to purchase any extra hardware. And it's a truly flexible language. Lastly (promise), see if you can dig up some articles explaining how perl has become much more of a Object Oriented Programming language. Frequently this makes it sound more impressive to those who don't already love the language. Good luck. HTH. --Alex Here is an email I received internally regarding the shortlist of languages for future software development. I must add that this is a corporate environment. I responded saying that Perl has one of the richest data structures that I know of. Strong typing is actually a bad thing as far as I am concerned. How can I rebut this arguement in a better way? Actually, there is a hidden agenda to standardize on C# here! I took out Perl. After looking at www.perl.org and the language more, the main item I didn't like is that it is not type safe, there are only three variables types ( http://perlpod.com/5.8.4/pod/perlintro.html#Perl%20variable%20types). Yikes! Although ti has many of the characteristics we listed, it still seems to be used for scripting than for more robust programming. I left in PHP, it is widely used. If we want to remove PHP, I have no real argument, just that it's a viable language that has the characteristics we listed. I added Cold Fusion as a web language. It is also a widely used web language and has the characteristics we listed. I would prefer it more than PHP. __ Ranga Nathan / CSG Systems Programmer - Specialist; Technical Services; BAX Global Inc. Irvine-California Tel: 714-442-7591 Fax: 714-442-2840 ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Re: Need to open a new window in perl
Ah yes, well this is where it gets a little different. I am aware of many ways of opening a new window. But this link os coming from the Links bar of my browser. Currently I am using JavaScript to grab information about the page you are currently viewing and then sends you to my script: javascript:location.href='http://www.breltech.com/MYSCRIPT.cgi?url='+encodeURIComponent(location.href)+'title='+encodeURIComponent(document.title) Really what I would like to have happen on top of this is have it all open in a new window. And I've been having problems doing that. I don't mind if I do this in JavaScript. I just need to find a way to do it. Thanks. --Alex I'm sure this will already have been pointed out, by the time this posts, but isn't this the equivalent of the following? (on first web page, square brackets traded for angle brackets, so as not to confuse webmail clients.) [a href=yourscript.cgi target=_blank]Start my CGI Script in a new window[/a] I mean, the point is to start the script in a new browser window, without forcing the user to leave the current window, right? If you'd like even more control over the script window that pops up, you could open it via JavaScript window.open method, specifying width, height, border, scroll bars, buttons, etc. You'd just have to specify the URI as your CGI script. Of course, I may have misunderstood your question. I hope this helps. --- Stephen ~runester~ Jarjoura [EMAIL PROTECTED] wrote: From: Alex Brelsfoard Subject: [Boston.pm] Need to open a new window in perl Date: Wed, 12 Jan 2005 18:18:01 -0600 (CST) To: boston-pm@mail.pm.org OK, so here's what I'm trying to do: 1. A link sends you to my script. 2. My script immediately sends that page back to where it came from. 3. My script creates a new window, and continues to do stuff on it. Make sense? I know there's some way to do this with CGI but I'm not at all sure how. In fact I'm a bit confused by the directions I read online about it. Any help would be greatly appreaciated. Thank. --Alex ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] reading in a directory
Yeah, I'm not too excited about creating a connection to a user's desktop to browse it either. But since there's no easy way to send multiple file addresses through html I'm running out of options. And, yeah (you'll love this), my mother uses a Mac. And I was hoping to make this whole procedure platform independent. I know I could be wishing upon a star here. But I gotta try. --Alex On Tue, 2004-12-07 at 16:31, Alex Brelsfoard wrote: Wow, well it's good to see we're all on the same page. Three replies all suggesting the same option.. zipped files. Yeah here's the trick. I'm trying to make this process easier for my mother, not myself. So in the end, this is adding another layer... So, if I don't want to do the zipped files idea (which is a kinda snazzy idea btw) Why not? If she is using XP, then, IIRC, she can zip up a directory as a right click option (been a while). WinZip, properly installed, should also provide a click-menu way of compressing a directory. You might have to experiment with configurations to get the right zip settings/unzipping commands to cooperate at both ends, but since it's you and your mother, I expect you have a fair amount of control over that aspect. But if you like the concept, I'd be surprised if an hour or two experimentation didn't find a workable method, even for your mother. Anyone know if there is a MS version of stuffit? On Tue, Dec 07, 2004 at 02:13:16PM -0600, Alex Brelsfoard wrote: You could use Java applets or MS ActiveX (or whatever it's called now) for multiple uploads. Otherwise, you're stuck with uploading single files. The very idea of giving a web browser the power to browse my directory tree and upload files I didn't explicitly indicate gives me hives. ActiveX == gaping security hole, JMHO -- Sean Quinlan [EMAIL PROTECTED] ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] reading in a directory
Thanks all for the great feedback. Yeah, I think the main problem is that I am trying to access remote files from a server-side program, and this is a security violation (rightfully so). So this means (to do this the perfect beautiful way) I will need to create a module to my perl app to be sent over to the end user when trying to do a batch upload (such as a java app). Though I am planning on learning Java soon, when I write this module in Java, I will probably be tempted to re-write the entire thing in Java We'll see. I'm thinking until I have learned another programming language that can be run on the user's side, I will probably just have to do a large number of single selection input fields. I can't remember who at this point, but someone wondered why I didn't just use the html input field and hit ctrl-a. This is exaclty what I would love to do, but if you create that html form with the use of that 'input type=file' field you will notice that it does not let you do ctrl-a. It will only ever select one file at a time. sigh I may at some point try some sort of VB or C# bit. But I really don't like those languages... at all. Thanks again all. --Alex On Tue, 2004-12-07 at 16:31, Alex Brelsfoard wrote: Wow, well it's good to see we're all on the same page. Three replies all suggesting the same option.. zipped files. Yeah here's the trick. I'm trying to make this process easier for my mother, not myself. So in the end, this is adding another layer... So, if I don't want to do the zipped files idea (which is a kinda snazzy idea btw) Why not? If she is using XP, then, IIRC, she can zip up a directory as a right click option (been a while). WinZip, properly installed, should also provide a click-menu way of compressing a directory. You might have to experiment with configurations to get the right zip settings/unzipping commands to cooperate at both ends, but since it's you and your mother, I expect you have a fair amount of control over that aspect. But if you like the concept, I'd be surprised if an hour or two experimentation didn't find a workable method, even for your mother. Anyone know if there is a MS version of stuffit? On Tue, Dec 07, 2004 at 02:13:16PM -0600, Alex Brelsfoard wrote: You could use Java applets or MS ActiveX (or whatever it's called now) for multiple uploads. Otherwise, you're stuck with uploading single files. The very idea of giving a web browser the power to browse my directory tree and upload files I didn't explicitly indicate gives me hives. ActiveX == gaping security hole, JMHO -- Sean Quinlan [EMAIL PROTECTED] ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] reading in a directory
I have an online photo album that all my friends and family use to share photos and comments on these photos with each other. It's fairly robust, and was [EMAIL PROTECTED] fun to create. But that is the ultimate destination for her pictures. She has a digital camera and might be able to swing the use of a FTP client. But the idea of this is that everyone is lazy and busy. So I need to make this dreafully easy for the uploader or uploads will not occur. Sad but true. --Alex Alex Brelsfoard wrote: Yeah, I'm not too excited about creating a connection to a user's desktop to browse it either. But since there's no easy way to send multiple file addresses through html I'm running out of options. One of the online photo processors (ofofo maybe?) used to have a java droplet of some sort where you'd crank it up and just drop images onto it. It was slick when it worked, but it was a little flakey. And, yeah (you'll love this), my mother uses a Mac. And I was hoping to make this whole procedure platform independent. I know I could be wishing upon a star here. But I gotta try. Hrm. The easiest thing, by a huge long shot, would be for her to have a .mac account and just use iPhoto. Okay, maybe not the cheapest ($100/yr). But she'd really point and click pretty effortlessly. Assuming, of course, that your goal is just for her to be able to share photos. I know, it's not as satisfying as writing your own solution. But it is really the seamless and easy solution. It's not what I do with my own photos. But if my mom were wanting to share photos, that's what I'd have her do. --d ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] reading in a directory
Sounds like a neat idea. But I am very inexperienced in TK. Can you point me to a good place online to do some studying? --Alex AB == Alex Brelsfoard [EMAIL PROTECTED] writes: AB I have an online photo album that all my friends and family use to AB share photos and comments on these photos with each other. It's AB fairly robust, and was [EMAIL PROTECTED] fun to create. But that is the AB ultimate destination for her pictures. She has a digital camera AB and might be able to swing the use of a FTP client. But the idea AB of this is that everyone is lazy and busy. So I need to make this AB dreafully easy for the uploader or uploads will not occur. Sad AB but true. then just write a simple tk or cli app that does the ftp. it can list the local files, she can click on them and it ftps them. probably less work than doing client and server java (and it is pure perl). browsers were never designed to do much and they are overloaded to the max now. classic marketplace beating out quality (in terms of the http/browser platform for all things). uri -- Uri Guttman -- [EMAIL PROTECTED] http://www.stemsystems.com --Perl Consulting, Stem Development, Systems Architecture, Design and Coding- Search or Offer Perl Jobs http://jobs.perl.org ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
[Boston.pm] reading in a directory
Howdy all. I have a quick (hopefully) and easy (hopefully) question you might be able to help me with. I would like to create a form (html) that takes in a little bit of info. Most importantly I want it to give the user an option to select a directory from their hard drive. Much like the input type=file option, only with this I want to select a directory. Once that directory is selected and the form submitted I then plan on reading in the names of each file. I will do more there, but I know what I'm doing past there. So the two parts I need help with are: 1) how to select a folder through an html form (being generated by perl) 2) how to read the contents of said folder (would the regular readdir() function work here). Any suggestions here? Thanks. --Alex ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] anyone with gmail account? Is the spam filter good?
I have had my gmail account for only a few months. but I have not had ANY spam yet. I have not done much to test it. But one of my friends has been using it longer and for his main email address. He still is raving about it (in a good way). As far as I have heard it's doing a pretty good job. --Alex I am thinking of subscribing to gmail but want to know if the spam filter is effective. Any experiences? __ Ranga Nathan / CSG Systems Programmer - Specialist; Technical Services; BAX Global Inc. Irvine-California Tel: 714-442-7591 Fax: 714-442-2840 ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Tech/Social Meeting Followup, Kwiki, Randal
Can I just say that I HATE traffic?! I was planning/trying to make it last night. However my 1 hour commute ended up taking 2 1/2 hours. Then, in order to save time (I thought), I tried to take the green line to Lechemere and then walk from there. However I am apparently last to know that the green line is no longer traveling in that direction (construction). So I ended up getting to the general area ~8:30pm. I then had difficulty finding the place. So I just threw up my arms and walked home (didn't feel like dealing with any other form of transportation). So, I'm sorry for not making it. I swear I will make it to one of these meetings eventually If ever the Fates let me. --Alex We had 9 people at the tech meeting last night. As we waited for people to show up, we watched Larry's screensaver and looked at Ian's photos of mushrooms. After a quick review the plan (the Boston.pm website is outdated and lacking in content, so we want to set up a Kwiki), Ian got started setting up the Kwiki. Unfortunately, we immediately hit a snag: inexplicable internal server errors. We spent some time looking for the error logs, fiddling with paths and permissions, and examining Charlotte.pm's Kwiki set up, without success. Aaron finally solved the problem when he pointed out that Kwiki had created a .htaccess file. Apparently the Apache config on www.pm.org does not like .htaccess files with Deny directives. So, Boston.pm now has a working Kwiki! http://boston.pm.org/kwiki/ Updates are already being made to the site. Ian will continue to upgrade our Kwiki setup on the backend, adding new plugins, possibly changing the theme, and so on. After we finished set up the Kwiki, we headed over to Cambridge Brewing Company for drinks and food. Randal surprised us all by showing up around 9:30 or 10, after his other commitment had finished. We hope to schedule something with Randal next week, probably out towards Milford. We'll plan this further once Randal has confirmed his schedule for next week. Ronald ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Setting cookies in different browsers
AB I am not using CGI to handle the information coming in from forms. It's a AB long story, but believe me, it works out better this way. URI i don't believe you. show us proof. 99% of home rolled cgi solutions URI have bugs and security holes. are you part of the 1% who knows all the URI little nooks and crannies of the cgi spec? CGI.pm does know them all and URI handles them all correctly. I am most certainly NOT one who knows all the nooks and crannies. However this is a larger project that I am only picking up my part on. Changing things to use CGI.pm would require a LOT of re-coding. Plus these are things that I should know about. Understanding them better makes me a better coder. I would always rather learn that lean on an already created package. Don't get me wrong of course, I love CGI.PM. Bless them for making it. And I do use it plenty. But I believe this project is going to be done mostly by hand. As for the security, I'm pretty sure that we doing a good job with that. At least good enough for this project. AB The advice you guys gave me did indeed fix the problem for mozilla AB (haven't tested Safari yet) I really just needed teh \n URI see, with cgi.pm you wouldn't have to worry about multiple browsers as URI it has been tested with them all. True true. Thanks for your input Uri. --Alex ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Setting cookies in different browsers
Thanks. Good stuff. --Alex - Original Message - From: Jeremy Muhlich To: [EMAIL PROTECTED] Sent: Wednesday, September 01, 2004 3:30 PM Subject: Re: [Boston.pm] Setting cookies in different browsers On Wed, 2004-09-01 at 14:53, Alex Brelsfoard wrote: I am most certainly NOT one who knows all the nooks and crannies. However this is a larger project that I am only picking up my part on. Changing things to use CGI.pm would require a LOT of re-coding. Plus these are things that I should know about. Understanding them better makes me a better coder. I would always rather learn that lean on an already created package. Leaning on an already package doesn't preclude you from understanding the underlying mechanism; that's part of what Open Source is about. In fact you'll probably learn even MORE from poring over the CGI.pm source than from trying to implement parameter parsing or header generation from scratch. Lincoln Stein and others have already run into the corner cases and tricky bits and dealt with them, so you don't have to learn the hard way. Anyway, you can use *just* CGI's header generation if you like. It's very orthogonal like that. Here's an example of the header and cookie functionality: use CGI qw(header cookie); my $cookie = cookie(-name= 'session_id', -expires = '+1h', -value = '1123'); print header(-content_type = 'text/html', -cookie = $cookie); This prints: Set-Cookie: session_id=1123; path=/; expires=Wed, 01-Sep-2004 20:28:57 GMT Date: Wed, 01 Sep 2004 19:28:57 GMT Content-Type: text/html; charset=ISO-8859-1 -- Jeremy ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
[Boston.pm] Setting cookies in different browsers
OK, so here's my situation. I have a web applicaiton that you log into and it writes a tiny little userID cookie to the browser. This all works beautifully in IE. However, in Mozilla and Safari it's a different story. In Sfari, the cookie is not written at all. In Mozilla the writing of the cookie interferes with the html header and makes the next page to come up appear as plain text. Can anyone give me some advice to stablize this app? I am currently using the followin code to write the cookie: my $cookie = Set-Cookie: . $COOKIENAME=$userID; . domain=.breltech.com; . expires=+1d; print $cookie; . print Content-type: text/html\n\n; suggestions? --Alex ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Setting cookies in different browsers
On Tue, Aug 31, 2004 at 01:46:35PM -0500, Alex Brelsfoard wrote: I am currently using the followin code to write the cookie: my $cookie = Set-Cookie: . $COOKIENAME=$userID; . domain=.breltech.com; . expires=+1d; print $cookie; . print Content-type: text/html\n\n; Are you print a newline somewhere in between those two lines of code? I'd suggest changing the first line to print $cookie\n; or even print Set-Cookie: $cookie\n; Thanks I will try that. or even using CGI to create the cooking instead of doing it by hand. I started out using CGI, but it got in the way of other things I was doing --Alex ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Setting cookies in different browsers
On 31 Aug 2004, at 3:05 PM, Alex Brelsfoard wrote: or even using CGI to create the cooking instead of doing it by hand. I started out using CGI, but it got in the way of other things I was doing How did it get in the way? If you use it in the object-oriented interface, and don't use it to create the actual form fields, it's handy for just handling certain kinds of overhead, and properly parsing the data sent... Ricky I am not using CGI to handle the information coming in from forms. It's a long story, but believe me, it works out better this way. The advice you guys gave me did indeed fix the problem for mozilla (haven't tested Safari yet) I really just needed teh \n Thanks much! ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Re: Uploading a picture with perl
hi ( 04.08.02 19:32 -0400 ) Alex Brelsfoard: But I am a bit curious to know if there is a way to do this without using CGI.pm. sure, mod_perl [much faster, lighter]. the interface is a bit better than CGI.pm, but not a whole lot. i just think it's a tricky thing to be doing anyway [uploading files]. Perhaps I should start looking into using mod_perl then. Because even with Ron and Sean's suggestions, I am still not able to get this function to work. (sorry guys, thanks though). #I list these two lines up at the top of my file. use CGI qw/:standard/; $query = new CGI; # Here is my function: sub UploadPicture { my $photoID = $_[0]; # ID # for photo my $file = $_[1]; # field name from form my $picLoc = $_[2]; #any extra directory needed. my $filepath = $UPLOAD_DIR/$picLoc$photoID$file\.jpg; # Already did statement outside this function. my $picture = $query-upload($file); open (UPLOAD, $filepath) || Error(Could not write: $filepath); while ($bytesread=read($picture,$buffer,1024)) { print UPLOAD $buffer; } close (UPLOAD); } I take in all the variables with the use of CGI as well, just to keep things consistant. But I still keep getting zero byte files As a side note, I do hope to elarn how to use ImageMagik at some point as well. Any advice on this would be MUCH appreciated. --Alex ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Re: Uploading a picture with perl
Thanks Richard, everyone. I tried your (Richard) code also. It bombs on No File Specified. Looks like somehow it can't grab ahold of the file I'm trying to upload. There must be something in the rest of my cod that is interfering with all this. But I really can't imagine what. The rest of my code is truly very simple. I decided to try once more with some of my original upload code (which DOES work on a simpler version of this app I'm creating). I know this might not be the prettiest thing around..., but here is an example of the code I'm using to take in one of the pictures: # Checking if you submitted a front side of a web-friendly picture. if ($query-param('webFront')) { #Take in the field's value. $webFrontPic = $query-param('webFront'); #Do the actual uploading... UploadPicture($photoID, $webFrontPic,'webFront'); print Selected $webFrontPic to be uploaded as the web frontbr\n; }else { Error(No Web Friendly front side picture was submitted); } Again, here is the code I am now using for the upload function: sub UploadPicture { my $photoID = $_[0]; my $file = $_[1]; my $picLoc = $_[2]; my $filepath = $UPLOAD_DIR/$picLoc$photoID$file\.jpg; $upload_filehandle = $query-upload($file); open UPLOADFILE, $filepath; while ( $upload_filehandle ) { print UPLOADFILE; } close UPLOADFILE; } ..ideas? --Alex Here is some code I've written that does work... It's using CGI.pm. What follows is short snippets of the code, not the whole thing... at the start of the file: #!perl use strict; use warnings; use CGI; use CGI::Carp qw/fatalsToBrowser/; my $q = new CGI; later on, I create the form: form method=post action=/path/to/script enctype=multipart/form-data File to upload: input type=file size=40 name=databr / input type=submit value=Upload file /form then, I use the following code to retrieve the file: # first, we need to grab the uploaded file's file handle, and check # to see if there was an error during the send my $fh = $q-upload('data'); if (!$fh and $q-cgi_error) { die(File upload error: . $q-cgi_error); } elsif (!$fh) { die(No file specified); } my $fname = output_file; # at this point, we have a good file that has been uploaded open(my $out, , $WORKING_DIR/$fname) or die(Could not create file: $!); # we make sure that we have raw character discipline binmode($fh, :raw); binmode($out, :raw); # now, read the data using buffered IO my $bytesread; my $buffer; while($bytesread = read($fh, $buffer, 1024)) { print $out $buffer; } # read returns undef on an error. I don't know where this error gets stored # but I'm guessing $! if (!defined($bytesread)) { die(An error occured while trying to write the file: $!); } # now close the files... close($fh) or die(couldn't close uploaded file: $!); close($out) or die(couldn't close copied file: $!); you can obviously modify this code as needed, but it looks fairly close to what you need. Hopefully, people won't find that I've made too many ugly mistakes, or forgotten to check some important return codes (although if I have, please let me know...) HTH, Ricky ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Re: Uploading a picture with perl
Upon further testing I verified that the statement my $picture = $query-upload($file); is indeed returning undefined. What would cause that? I do know that $file DOES contain valid information (the correct name of the field holding the file to be uploaded). --Alex Thanks Richard, everyone. I tried your (Richard) code also. It bombs on No File Specified. Looks like somehow it can't grab ahold of the file I'm trying to upload. There must be something in the rest of my cod that is interfering with all this. But I really can't imagine what. The rest of my code is truly very simple. I decided to try once more with some of my original upload code (which DOES work on a simpler version of this app I'm creating). I know this might not be the prettiest thing around..., but here is an example of the code I'm using to take in one of the pictures: # Checking if you submitted a front side of a web-friendly picture. if ($query-param('webFront')) { #Take in the field's value. $webFrontPic = $query-param('webFront'); #Do the actual uploading... UploadPicture($photoID, $webFrontPic,'webFront'); print Selected $webFrontPic to be uploaded as the web frontbr\n; }else { Error(No Web Friendly front side picture was submitted); } Again, here is the code I am now using for the upload function: sub UploadPicture { my $photoID = $_[0]; my $file = $_[1]; my $picLoc = $_[2]; my $filepath = $UPLOAD_DIR/$picLoc$photoID$file\.jpg; $upload_filehandle = $query-upload($file); open UPLOADFILE, $filepath; while ( $upload_filehandle ) { print UPLOADFILE; } close UPLOADFILE; } ..ideas? --Alex Here is some code I've written that does work... It's using CGI.pm. What follows is short snippets of the code, not the whole thing... at the start of the file: #!perl use strict; use warnings; use CGI; use CGI::Carp qw/fatalsToBrowser/; my $q = new CGI; later on, I create the form: form method=post action=/path/to/script enctype=multipart/form-data File to upload: input type=file size=40 name=databr / input type=submit value=Upload file /form then, I use the following code to retrieve the file: # first, we need to grab the uploaded file's file handle, and check # to see if there was an error during the send my $fh = $q-upload('data'); if (!$fh and $q-cgi_error) { die(File upload error: . $q-cgi_error); } elsif (!$fh) { die(No file specified); } my $fname = output_file; # at this point, we have a good file that has been uploaded open(my $out, , $WORKING_DIR/$fname) or die(Could not create file: $!); # we make sure that we have raw character discipline binmode($fh, :raw); binmode($out, :raw); # now, read the data using buffered IO my $bytesread; my $buffer; while($bytesread = read($fh, $buffer, 1024)) { print $out $buffer; } # read returns undef on an error. I don't know where this error gets stored # but I'm guessing $! if (!defined($bytesread)) { die(An error occured while trying to write the file: $!); } # now close the files... close($fh) or die(couldn't close uploaded file: $!); close($out) or die(couldn't close copied file: $!); you can obviously modify this code as needed, but it looks fairly close to what you need. Hopefully, people won't find that I've made too many ugly mistakes, or forgotten to check some important return codes (although if I have, please let me know...) HTH, Ricky ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] Re: Uploading a picture with perl
I am not at all certain of what I did differently. I was playing around with all of your suggestions. And one of my attempts ACTUALLY WORKED! So thank you all very much for your help. I have tested it several times now. If you are still curious and want to see what I've got (code), I'll be happy to post it. --Alex ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
[Boston.pm] Re: Uploading a picture with perl
Ron, Sean, Thank you both. I will give it a try. Sean, no worries, I have a two-layered security system in place, and plenty of well-placed warnings. I'm perfectly happy using CGI.pm (and am currently on this project). But I am a bit curious to know if there is a way to do this without using CGI.pm. --Alex ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] reading in HTML with SSI and processing in perl
At 04:56 PM 7/14/2004, you wrote: Saddly, yes I am committed to having to use SSI. I have used HTML::Template before, and enjoyed it. The problem is that I am trying to create an all-emcompassing email form script that does EVERYTHING. Our current setup is that we have header and footer files for each and ever page, read in by yup SSI. So, when I have this script print out a page I am having it read in the appropriate header and footer files and throw them up on the page as well. So far everything is working great. It's just that one if statement that is not working Any other ideas? :P Heh, sounds like fun. I suppose you could get Josh to move to Apache 2.0, so you could rung the mod_include filter after mod_cgi, but then, you probably want this done before next summer. ;) Heh. It would take longer. I don't have time to keep pestering him enough to get him to get it done by next summer. --Alex ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
[Boston.pm] reading in HTML with SSI and processing in perl
Found the solution. It's wasn't having difficulties with the set commends. It was having trouble reading the folllowing line: !--#if expr=$HTTP_USER_AGENT != /WebTV/ -- my script didn't process anything within this if statement. Once I removed this if statement, everythign worked out fine. Thanks anyway. And sorry to bother. --Alex P.S. If anyone knows why it did not accept that line I would love to know. Otherwise I'll try to deal without it... I hate to bug you all with a perl question like this seeing as I am new to the group. But I'm getting kinda stuck on this one. I am simply trying to read in an external html file (to be used as the header of a web page) and then print it out. That sounds nice and easy. However, the header file contains SSI, and not just an include, and sets and echos. I've been trying to get CGI::SSI to work, but, near as I can tell, it's not understanding the set commands or the if/else commands in SSI. Do you guys have any suggestions on this one? I KNOW there has to be a way --Alex WPI ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm
Re: [Boston.pm] reading in HTML with SSI and processing in perl
On Wed, 14 Jul 2004, Alex Brelsfoard wrote: I've been trying to get CGI::SSI to work, but, near as I can tell, it's not understanding the set commands or the if/else commands in SSI. Do you guys have any suggestions on this one? I KNOW there has to be a way I know this isn't the answer you were looking for, but have you considered the possibility of re-writing this in a proper template language rather than trying to meld CGI and SSI? You're trying to do something reasonably sophisticated, and glueing together CGI SSI seems like a messy way to do something that would be dirt easy with HTML::Template, Template Toolkit, or Mason. Are you really bound to this approach, or would an alternative be an option? I think in the long run you'll have a much easier time with this if you could go about the problem in a different way. -- Chris Devers Saddly, yes I am committed to having to use SSI. I have used HTML::Template before, and enjoyed it. The problem is that I am trying to create an all-emcompassing email form script that does EVERYTHING. Our current setup is that we have header and footer files for each and ever page, read in by yup SSI. So, when I have this script print out a page I am having it read in the appropriate header and footer files and throw them up on the page as well. So far everything is working great. It's just that one if statement that is not working Any other ideas? :P Thanks. --Alex ___ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm