|
Yeah, I was going about the whole thing wrong, trying to break up the line into words or such. I just needed to do a match on <em> or </em>, and if it matches, first substitute either of those tags for a blank space, and then do a substitution of every word to make it word+dashes around it. code:
And yes, I know I am using {} instead of // for RE in this, and also tons of useless whitespace (via the x at the end). Edit - Ugh, now that I think of it, this solution breaks on this line though: "<em> blah </em> blah" by making both blahs have dashes BUT OH WELL. I'd never use RE for actual html conversion anyhow. jeeves fucked around with this message at 22:06 on Jul 16, 2012 |
# ? Jul 16, 2012 21:55 |
|
|
# ? May 21, 2024 15:02 |
|
Sizzler Manager posted:As I understand it, if you use .. inside an if like this, it starts returning true as soon as the left hand side matches, and it stays true over multiple lines until the right side matches. That's roughly correct; it's a language feature borrowed from sed and awk. Its behavior is determined by list/scalar context. And it gets a little crazy. http://perldoc.perl.org/perlop.html#Range-Operators
|
# ? Jul 17, 2012 04:18 |
|
Hey, so I'm forcing myself to learn Perl so I can use this (of course) Perl-specific bioinformatics API. Is there any reason a declared variable would reset after a foreach loop? Here's the specific part of my code that is going awry.code:
|
# ? Aug 2, 2012 19:52 |
|
slightlyslow posted:Hey, so I'm forcing myself to learn Perl so I can use this (of course) Perl-specific bioinformatics API. Is there any reason a declared variable would reset after a foreach loop? Here's the specific part of my code that is going awry.
|
# ? Aug 2, 2012 20:10 |
|
Yeah, I'm using strict/warnings and am not getting anything. The $num_genes variable is incrementing correctly inside the foreach loop. Hm, looking more closely that bit of code is part of an eval block and seems to be exiting out early. I think I need to do some more debugging before asking for more help. Thanks though! OK, so I neglected to actually check which errors were being thrown. One of the function returns was different from what I expected and caused the screwup. Sorry about that. slightlyslow fucked around with this message at 20:28 on Aug 2, 2012 |
# ? Aug 2, 2012 20:19 |
|
What is state of developers were you work? (assuming you do Perl full time) We lost three people recently and it's been really hard to find developers of that caliber to replace them. How are you guys coping with the current state of the industry?
|
# ? Aug 4, 2012 01:15 |
|
Lots of resumes, all terrible.
|
# ? Aug 4, 2012 03:01 |
|
Triple Tech posted:What is state of developers were you work? (assuming you do Perl full time) We lost three people recently and it's been really hard to find developers of that caliber to replace them. How are you guys coping with the current state of the industry?
|
# ? Aug 4, 2012 06:20 |
|
We deal with the shortage by churning through as many voice and face-to-face interviews as possible. Even then we can't hire quickly enough, it's hard to find good Perl dudes BTW we're literally always hiring, so if you're a good Perl dude and are willing to relocate, send me a PM.
|
# ? Aug 4, 2012 11:43 |
|
Mario Incandenza posted:We deal with the shortage by churning through as many voice and face-to-face interviews as possible. Even then we can't hire quickly enough, it's hard to find good Perl dudes Relocate to where?
|
# ? Aug 4, 2012 12:24 |
|
I've started asking for code examples. Everyone who makes it to round 2 gets an example spec and is expected to write a unix daemon that implements that spec. Doesn't matter what language, I figure a good programmer can learn Perl faster than we can turn a bad programmer into a good one. Similarly, if anyone wants a Perl job in the Bay Area. I think we re-locate, but I'm not sure.
|
# ? Aug 4, 2012 22:52 |
|
het posted:It's been difficult, nobody's really hit our sweet spot for Unix knowledge, programming acumen, and knowledge of stuff like Perl or ruby. So far our best bets (granted, this is in a Unix systems programming context) have been transitioning Ops people (sysadmins) who show some promise with scripting languages. Other than that it's been a mix of newbies who can't code their way out of a paper bag and older C coders (half of whom still can't code their way out of a paper bag). We had one kid we really wanted but either he got cold feet about moving, our HR dept/boss hosed up giving him a good offer, or we hosed up the interview (probably one of the last two). This gives me hope. (NOT SOLICITING) I've got a skillset that pretty much exactly shows what you're looking for, and am moving to Denver or the PNW in the next 12-18 months and have been polishing up the resume and learning more about Perl and languages in general. Sorry for the jobchat derail, it's interesting to hear what the market's like here and there.
|
# ? Aug 6, 2012 15:17 |
|
Yeah, this recent discussion has me wanting to get of my rear end and finish school, or at the least do more with perl than my typical hacky ten line scripts. For that side of things I think part of my problem is the lack of a good reference, is something like the camel book good for that? (hey, 4th ed is out and the ebook is half off this week...)
|
# ? Aug 6, 2012 15:45 |
|
prefect posted:Relocate to where?
|
# ? Aug 6, 2012 17:17 |
|
Mario Incandenza posted:Amsterdam. If I spoke Hollandaise, I'd be on the next plane.
|
# ? Aug 6, 2012 17:20 |
|
Mario Incandenza posted:Amsterdam.
|
# ? Aug 6, 2012 19:01 |
|
prefect posted:If I spoke Hollandaise, I'd be on the next plane. According to Curtis Poe, it's really not bad for an American Perl programmer to move to Amsterdam and pick up the language while he's there
|
# ? Aug 6, 2012 21:44 |
|
I'm trying to look at an FTP directory and find files with a modification date of today (the current day). I found this code that opens a directory and reads its date, but it doesn't always work. When I run this in /home/username it correctly prints all of the files and their dates. When I run this elsewhere, like /lib or the FTP directory, it always prints "31121969" (December 31, 1969). Why is this? Is it a permission thing? Does this date have any significance? code:
|
# ? Aug 10, 2012 14:00 |
|
A lot of computer systems count the date as time forward since Dec 31st, 1969. I would assume that the value it's returning is "0" or it's substituting "0" as a return due to some permissions snafu.
|
# ? Aug 10, 2012 14:10 |
|
$_ was coming up empty; changing "while (readdir(D))" to "while ($_ = readdir(D))" fixed that. edit: don't know why it would work sometimes and not others, perlfunc has this though: quote:If you're planning to filetest the return values out of a "readdir", you'd better prepend
|
# ? Aug 10, 2012 14:18 |
|
spoon0042 posted:$_ was coming up empty; changing "while (readdir(D))" to "while ($_ = readdir(D))" fixed that. code:
e2; apparently there's a mdtm function that gives the file's modification date in Net::FTP. sigh. Clanpot Shake fucked around with this message at 15:54 on Aug 10, 2012 |
# ? Aug 10, 2012 14:39 |
|
Clanpot Shake posted:Before making this change it always printed the filename, so it wasn't empty. I made this change and the output is the same. I then prepended the file path to the filename and it works now. Weird. I'm doing the FTP thing in an old script of mine already, I'll pull it up tomorrow if you want to take a look.
|
# ? Aug 13, 2012 05:26 |
|
Clanpot Shake posted:e; now I have to get this to work with an FTP directory listing which is apparently a whole different beast.
|
# ? Aug 13, 2012 05:32 |
|
I'm trying to kill a particular process (foo) from within a perl script (bar). I'm trying the command: code:
Any idea what is going wrong? code:
|
# ? Aug 15, 2012 00:26 |
|
This doesn't answer your question, but generally stuff like that is sort of a red flag to me; it looks like writing a shell script in perl, which generally ends up being ugly. That said, I can't see any reason it would kill the perl script unless "foo" were in the command line for the perl script, which I'm assuming you ruled out already (I also notice you don't have grep -v grep in your pipeline but that probably won't hurt anything in this context) edit: oh yeah, good point vvvvvvvvvvvv het fucked around with this message at 04:17 on Aug 15, 2012 |
# ? Aug 15, 2012 03:13 |
|
GTGastby posted:I'm trying to kill a particular process (foo) from within a perl script (bar). It could be the $2 being interpolated due to the double quotes, but you should probably re-write it to use something like Proc::ProcessTable and kill().
|
# ? Aug 15, 2012 04:13 |
|
Ninja Rope posted:It could be the $2 being interpolated due to the double quotes, but you should probably re-write it to use something like Proc::ProcessTable and kill(). Thanks guys. Duly noted about the shell script - I went with this approach because it's seemingly very difficult to compare time in a shell script - ie "if it's past 6pm, then kill this job". This is undoubtedly a horrible hack job any way you look at it. I'll look into ProcessTable and kill(). Was hoping to avoid those because it will involve looping and arrays and I'm bad at perl.
|
# ? Aug 15, 2012 05:55 |
|
GTGastby posted:Thanks guys. Duly noted about the shell script - I went with this approach because it's seemingly very difficult to compare time in a shell script - ie "if it's past 6pm, then kill this job". This is undoubtedly a horrible hack job any way you look at it. Perl code:
|
# ? Aug 15, 2012 06:09 |
|
I'm making some sort of tiny stupid mistake, and i've spent way too much time trying to figure it out. It has to do with the chomp at line 27 and the assignment of $_ to $away on line 28. For some reason, it deletes the first character of $away if I print it, or if I do print "$away | $away" it might print " | NEVV" (instead of "NEV | NEV"). http://pastebin.com/saiTHRQN EDIT: Problem was extra formatting at the end of each line in the source file, naturally uG fucked around with this message at 19:06 on Aug 15, 2012 |
# ? Aug 15, 2012 18:39 |
|
uG posted:if I do print "$away | $away" it might print " | NEVV" (instead of "NEV | NEV"). which can be useful: perl -CS -Mutf8 -e'while(++$|){for(qw(✭ ✮ ★ ✯ ✫ ☆ ✩)){print"\r$_ throbbing, please wait… $_ ";select$u,$u,$u,0.1}}'
|
# ? Aug 16, 2012 04:16 |
|
So, who's going to be at YAPC::EU next week?
|
# ? Aug 16, 2012 08:35 |
|
I like the idea of DBIx::Class::Validation for my Catalyst app's API, but I don't like that I seemingly have to do the validation on my forms separately. I've used HTML::FormHandler before but didn't think it was very elegant when it came to validating API input. I could use FormValidator::Simple with DBIx::Class::Validation and as Catalyst::Plugin::FormValidator::Simple, but it seems i'd still be left with declaring the same constraints twice. What do you guys do for input validation when you have forms and an API?
|
# ? Aug 20, 2012 05:55 |
|
Anyone have any tricks for designing complex data structures? I've been doing it in my head but it ends up taking longer than it should to wrap my head around it. I'd like an easy way to (visually, preferably) layout a hash of arrays of hashes and the like to make sure I'm getting all the key pieces.
|
# ? Aug 20, 2012 09:38 |
|
code:
|
# ? Aug 20, 2012 23:04 |
|
syphon posted:
One of these days, I'm going to write a Data::Dumper::Graphviz module and then pass out from pure happiness. (Graphviz is awesome.) Edit: Oh, poo poo, there's already GraphViz2::Data::Dumper! (I made a questionable career choice a few years ago, and have been stuck in VBScript-land since.) prefect fucked around with this message at 23:18 on Aug 20, 2012 |
# ? Aug 20, 2012 23:15 |
|
EVGA Longoria posted:Anyone have any tricks for designing complex data structures? I've been doing it in my head but it ends up taking longer than it should to wrap my head around it. I'd like an easy way to (visually, preferably) layout a hash of arrays of hashes and the like to make sure I'm getting all the key pieces. Maybe you just need to mitigate its complexity? What are you designing? Arrays for collections, hashes for objects. Dunzo.
|
# ? Aug 21, 2012 10:48 |
|
Triple Tech posted:Maybe you just need to mitigate its complexity? What are you designing? It was slightly more complex with that, but I ended up getting it done. In a vaguely related sense of things, does anyone have good sources for DBIx::Class? Specifically, an introduction? I'm familiar with ORMs to some extent, but this would be my first time really using one in more than the most basic way, and I'd like to do it right. Neither Modern Perl nor Higher Order Perl go into this that I can find.
|
# ? Aug 24, 2012 23:57 |
|
The docs for DBIx::Class are pretty thorough and are probably your best bet.
|
# ? Aug 25, 2012 05:35 |
|
I've got a problem that requires some deeper knowledge of of Unix file permissions than I have. I have a script that moves files from one directory to another (really a map of several dozen source->dest directories but that isn't important). One of the destination directories (call it Inbound) is watched by another process I have no control over. What it does is look for the files that I'm moving, and when it sees them moves them to another folder for processing. The trouble is, it doesn't appear to wait for the file to be completely written - it will just grab whatever portion of the file is there when it checks. This is causing some errors. I've been using the CPAN File module to move files from A to B, but that isn't going to work for this. I need to move the files to this particular directory with no read permissions (000, ideally), then chmod them to another value (I've been given this value). How can I move files with no read permissions?
|
# ? Sep 5, 2012 21:14 |
|
|
# ? May 21, 2024 15:02 |
|
You don't have to copy a file's contents to move it. You can create a hard link at the new location and unlink the old location.
|
# ? Sep 6, 2012 00:03 |