Language: perl, 288 lines. AppleScript, 20 lines [folder actions].Difficulty: mediumExperience Gained: substantial
neat stuff:
use sigtrap qw(die normal-signals die error-signals);$SIG{__DIE__} = sub { print "$0: $_\n" for @_; `$CD msgbox --text "$0 Died" --style warning --informative-text "$_" --button1 "Abort"` for @_;};
$SIG{__DIE__} = sub { print "$0: $_\n" for @_; `$CD msgbox --text "$0 Died" --style warning --informative-text "$_" --button1 "Abort"` for @_;};
So any unchecked signal has $CD (Cocoa Dialog) pop a dialog so I can see it even when it is running as a folder action. I have this also setup for pseudo signal __WARN__.
Here is a regexp for matching status lines of rsync to get progress info out of them for a progress bar:
if(m/\((\d+),\s+(\d{1,3}\.\d)%\sof\s(\d+)\)$/){print $fh "$2 ($2"."%) $1 of $3 files transferred\n";}
― absolutego (ex machina), Monday, 4 April 2005 05:16 (twenty years ago)
LEVEL UP
― Gravel Puzzleworth (Gregory Henry), Monday, 4 April 2005 05:42 (twenty years ago)
― latebloomer: strawman knockdowner (latebloomer), Monday, 4 April 2005 05:43 (twenty years ago)
― Alex in LA (deangulberry), Monday, 4 April 2005 06:15 (twenty years ago)
― absolutego (ex machina), Monday, 4 April 2005 06:51 (twenty years ago)
― Andrew (enneff), Monday, 4 April 2005 07:07 (twenty years ago)
― g-kit (g-kit), Monday, 4 April 2005 07:08 (twenty years ago)
― absolutego (ex machina), Monday, 4 April 2005 07:11 (twenty years ago)
― g-kit (g-kit), Monday, 4 April 2005 07:14 (twenty years ago)
― g-kit (g-kit), Monday, 4 April 2005 07:15 (twenty years ago)
― absolutego (ex machina), Monday, 4 April 2005 07:16 (twenty years ago)
― g-kit (g-kit), Monday, 4 April 2005 07:18 (twenty years ago)
― carson dial (carson dial), Monday, 4 April 2005 07:21 (twenty years ago)
Help me subvert their evil plans!
― Colonel Poo (Colonel Poo), Monday, 4 April 2005 08:15 (twenty years ago)
― dog latin (dog latin), Monday, 4 April 2005 08:50 (twenty years ago)
I will post up a link to my crazy zombie text adventure game when it's finished. yall excited?
― Ste (Fuzzy), Monday, 4 April 2005 08:52 (twenty years ago)
i think you can use regedit to find the filename of the wallpaper in the registry then write a reg script that changes that value.
(mine's "My Computer / HKEY_CURRENT_USER / Control Panel / Desktop / Wallpaper" but then i'm on win2k so...)
.reg files:http://support.microsoft.com/kb/310516/
― koogs (koogs), Monday, 4 April 2005 09:15 (twenty years ago)
― Colonel Poo (Colonel Poo), Monday, 4 April 2005 09:22 (twenty years ago)
using System;using System.Runtime.InteropServices;class MainClass{ [DllImport("user32.dll", CharSet=CharSet.Auto)] public static extern int SystemParametersInfo (int uAction , int uParam , string lpvParam , int fuWinIni) ; public static void Main(string[] args) { SystemParametersInfo(20, 0, args[0], 0x1 | 0x2); }}
― willdabeast, Monday, 4 April 2005 09:40 (twenty years ago)
― Mr Noodles (Mr Noodles), Monday, 4 April 2005 10:38 (twenty years ago)
― caitlin (caitlin), Monday, 4 April 2005 10:39 (twenty years ago)
― Mr Noodles (Mr Noodles), Monday, 4 April 2005 11:20 (twenty years ago)
― Colonel Poo (Colonel Poo), Monday, 4 April 2005 11:21 (twenty years ago)
#!/usr/bin/perlprint $ARGV[0],"\n";$file=$ARGV[0];open(F,"<$file") or die "can't read";@lines=<F>;close(F);srand (time ^ $$ ^ scalar @lines);die "no more urls" if(scalar @lines==0);$line = int rand(scalar @lines);$lines[$line] =~ s/\#.*$//; # strip anchor linkschomp $lines[$line];print `open '$lines[$line]'`;print STDERR "only ",(scalar @lines)-1," lines to go!\n";print "$lines[$line]","\n";undef $lines[$line];open(F,">$file") or die "can't write";foreach (@lines){ print F $_;}close(F);
$line = int rand(scalar @lines);$lines[$line] =~ s/\#.*$//; # strip anchor linkschomp $lines[$line];print `open '$lines[$line]'`;print STDERR "only ",(scalar @lines)-1," lines to go!\n";print "$lines[$line]","\n";undef $lines[$line];open(F,">$file") or die "can't write";foreach (@lines){ print F $_;}close(F);
― absolutego (ex machina), Monday, 4 April 2005 21:31 (twenty years ago)
― o. nate (onate), Monday, 4 April 2005 21:37 (twenty years ago)
― Hari A$hur$t (Toaster), Monday, 4 April 2005 21:40 (twenty years ago)
― o. nate (onate), Monday, 4 April 2005 21:44 (twenty years ago)
― absolutego (ex machina), Monday, 4 April 2005 21:48 (twenty years ago)
― o. nate (onate), Monday, 4 April 2005 21:53 (twenty years ago)
― absolutego (ex machina), Monday, 4 April 2005 22:32 (twenty years ago)
― Mr Noodles (Mr Noodles), Monday, 4 April 2005 22:48 (twenty years ago)
― Alex in LA (deangulberry), Monday, 4 April 2005 22:50 (twenty years ago)
― absolutego (ex machina), Monday, 4 April 2005 22:50 (twenty years ago)
― absolutego (ex machina), Monday, 4 April 2005 22:52 (twenty years ago)
― shieldforyoureyes, Monday, 4 April 2005 22:54 (twenty years ago)
― absolutego (ex machina), Monday, 4 April 2005 22:58 (twenty years ago)
I am!
― Jordan (Jordan), Monday, 4 April 2005 23:02 (twenty years ago)
― absolutego (ex machina), Monday, 4 April 2005 23:04 (twenty years ago)
― ken c (ken c), Monday, 4 April 2005 23:06 (twenty years ago)
― absolutego (ex machina), Monday, 4 April 2005 23:08 (twenty years ago)
― stephen morris (stephen morris), Monday, 4 April 2005 23:17 (twenty years ago)
― stephen morris (stephen morris), Monday, 4 April 2005 23:18 (twenty years ago)
That still doesn't make up for being here until 7:30 at night. :(
― Jordan (Jordan), Monday, 4 April 2005 23:24 (twenty years ago)
So I can be reminded how fun it was for him to break Alan's work after a rash of phpBB attacks? The last thing I need is after a day of dealing with bankers and brokers is to have a student use published attacks to pick on a volunteer’s code. No one picked at G's holes right after he ported from Greenspun so I don't see why he has the right to try and take a run at Alan's work.
― Mr Noodles (Mr Noodles), Monday, 4 April 2005 23:34 (twenty years ago)
I'm not sure how phpBB relates to ILX.
The last thing I need is after a day of dealing with bankers and brokers is to have a student use published attacks to pick on a volunteer’s code.
What "published attacks"? Are you talking out of your ass? To construe any annoying crap I have pulled on ILX as an 'attack' is moronic.
No one picked at G's holes right after he ported from Greenspun so I don't see why he has the right to try and take a run at Alan's work.
Yes and now they're fixed. Time to get one perspective, grudge bearer.
― absolutego (ex machina), Monday, 4 April 2005 23:56 (twenty years ago)
― absolutego (ex machina), Tuesday, 5 April 2005 00:24 (twenty years ago)
― Remy (x Jeremy), Tuesday, 5 April 2005 00:29 (twenty years ago)
― Mr Noodles (Mr Noodles), Tuesday, 5 April 2005 02:28 (twenty years ago)
― Ian John50n (orion), Tuesday, 5 April 2005 02:34 (twenty years ago)
― Mr Noodles (Mr Noodles), Tuesday, 5 April 2005 02:44 (twenty years ago)
fake rock critics are the art of pretend knowing. bullshitter revealed!m.
― msp (mspa), Wednesday, 6 April 2005 06:53 (twenty years ago)
― absolutego (ex machina), Wednesday, 6 April 2005 07:31 (twenty years ago)
― shieldforyoureyes, Wednesday, 6 April 2005 09:36 (twenty years ago)
― msp (mspa), Wednesday, 6 April 2005 12:41 (twenty years ago)
This isn't the case for most problems, which have dependencies inbuilt. To solve these efficiently you have to work harder and use a MIMD-style machine/approach. The problems you're trying to solve (more quickly by parallelizing constituent parts) are split into sub-problems (as ever), but unfortunately there are dependencies between these sub-problems, which means you need to co-ordinate effort if you're going to execute sub-problems in parallel. There are various topologies for letting MIMD processors talk to each other efficiently and some are described in this document: http://carbon.cudenver.edu/~galaghba/mimd.html
It doesn't look to have changed a lot since I did this stuff at uni, although it's not clear when this article was written.
― KeefW (kmw), Wednesday, 6 April 2005 16:43 (twenty years ago)
― shieldforyoureyes, Wednesday, 6 April 2005 19:50 (twenty years ago)
― Alex in TCBY (ex machina), Wednesday, 6 April 2005 20:46 (twenty years ago)
― shieldforyoureyes, Wednesday, 6 April 2005 21:46 (twenty years ago)
Oh sorry, fair enough. I've never heard of a CM5.
I'm not convinced this stuff is going anywhere though... It's been around for ages, with little impact on the mainstream (outside maybe graphics cards). That said, the grid thing's been around since Andrew Tanenbaum's Amoeba in around 1988 and it's hitting the headlines now, so you never know.
― KeefW (kmw), Wednesday, 6 April 2005 22:49 (twenty years ago)
― Alex in TCBY (ex machina), Thursday, 7 April 2005 01:57 (twenty years ago)
m.
― msp (mspa), Thursday, 7 April 2005 04:27 (twenty years ago)
Sun SunfireIBM Regatta Power4Linux TreadMarks / Cashmere 2-L clusters (some kind of memory channel interconnect)
Parallelism is now.
― Alex in TCBY (ex machina), Thursday, 7 April 2005 05:01 (twenty years ago)
for most businesses... a blade server is the closest thing to parallelism... that's what i see. shared memory = a pool of connections to a transactional database. the big problem with specialized hardware is the cost. and parts breaking and ruining an entire system board in the process. blade servers that are hot swappable alongside hotswappable disc arrays make better production sense. round robin the requests on the network. clusters.
my boss keeps talking grids. we've got weighty computations that just involve large amounts of rollups and sorting... it'd be great to have all the state's spare machines crunching. WAY cheaper than legacy mainframe time too. it's insane how expensive and lame those machines are. omg, like a small cluster of desktops could probably wallop that old school shit. not to mention getting away from fixed width text databases and stuff. ughness. it's shocking what our local, state, and federal gov uses to do ze computational tasks. old money contracts. it smells like $50 bottles of ketchup in defense spending.
anyway, sorry... this rant is entirely removed from programming feats.m.
― msp (mspa), Thursday, 7 April 2005 17:58 (twenty years ago)
MULTIPLE CORES ARE GOING TO BE THE DEFAULT IN LIKE 5 YEARS. WE HAVE MODERN OPERATING SYSTEMS THAT SUPPORT THIS.
― Alex in TCBY (ex machina), Thursday, 7 April 2005 20:22 (twenty years ago)
i'm just glad that there are people tending to these matters...
― ronny longjohns (ronny longjohns), Friday, 8 April 2005 00:24 (twenty years ago)
― Where is Erasto B. Mpemba? (ex machina), Friday, 8 April 2005 00:30 (twenty years ago)
werdness.m.
― msp (mspa), Friday, 8 April 2005 03:07 (twenty years ago)
― Where is Erasto B. Mpemba? (ex machina), Friday, 8 April 2005 03:55 (twenty years ago)
the windows is very guilty of this i'm thinking. (that might be why i've heard it cause i live in windows land too much.)
― msp (mspa), Friday, 8 April 2005 04:19 (twenty years ago)
― msp (mspa), Friday, 8 April 2005 04:32 (twenty years ago)
― caitlin (caitlin), Friday, 8 April 2005 06:34 (twenty years ago)
However, the SIMD/MIMD chat above is not the same thing.
Grid and parallel processing works fine seamlessly, i.e. requires no input from programmers when one OS process does not span more than one processor. Shared memory makes no difference, since the memory allocated to a given process is protected in the same way it is on your PC (other than the explicit 'shared memory' OS calls mentioned by Jonathan; these are a special case and typically used for IPC rather than collusion on parallel problems). In a nutshell, it works no differently to a single processor machine, except that something decides "why not run it on this processor instead of that one because it's not doing much right now".
SIMD and MIMD are when individual programs/processes collude to solve a problem using multiple processors with which to do that. You could do it by forking if you wanted; that would be basically the same thing; albeit, with less facilities to help you reach your goal. The equivalent would be that the OS said 'In this program, I've got a loop doing something 100 times; I've worked out there are no dependencies between iterations of the loop; therefore, I'll put each iteration on an individual processor so that it goes faster'
There are well-defined cases that live in a grey area; the one about data sources you make earlier fits here. All programs pull data sources from a single connection pool. This can work because it has been very well defined what the job of the connection pool is. However, each process using the connection pool will all execute fully on a single processor.
On another point: whilst it is true that a few PCs will beat an S/390 style mainframe in terms of processing; they won't come close to it in terms of I/O, which is typically what you need an in online transaction processing environment. That's not to say they're not overpriced; alternatives do exist. Lots of companies are pretty well locked in by assembler programs and older Cobol programs that cannot be ported easily to other systems. Looks like your problem is one of computation though, where parallel processors and grids are where you will score.
― KeefW (kmw), Friday, 8 April 2005 12:18 (twenty years ago)
― Where is Erasto B. Mpemba? (ex machina), Friday, 8 April 2005 13:39 (twenty years ago)
http://www.sharcnet.ca/past_workshops/excel_slides/IntroParallel_Waterloo.pdf
I think the point I failed to make above is related to this point:
'In this program, I've got a loop doing something 100 times; I've worked out there are no dependencies between iterations of the loop; therefore, I'll put each iteration on an individual processor so that it goes faster'
Is not possible to do in the general case automatically, i.e. you can't get the compiler to do it. It's theoretically possible, but I believe it's an NP-complete problem; that's to say, it's intractable.
Being an NP-complete problem means that programmers have to do the work themselves, using heuristics and intuition. This is why it is so hard and why it will not catch on in the mainstream. Compilers have been built that use heuristics themselves; maybe there is some mileage in this; your professor might know.
― KeefW (kmw), Friday, 8 April 2005 14:24 (twenty years ago)
― msp (mspa), Friday, 8 April 2005 15:21 (twenty years ago)
tons of pdfs there! (that is my class)
― Where is Erasto B. Mpemba? (ex machina), Friday, 8 April 2005 15:52 (twenty years ago)
― shieldforyoureyes, Friday, 8 April 2005 19:35 (twenty years ago)
those machines are cool. the people admining them in my case are just very disinterested in change.m.
― msp (mspa), Friday, 8 April 2005 20:21 (twenty years ago)
Agree about the reliability thing, although I think some of this is down to software as well as hardware, in that OS/390 is over 40 years old; CICS & IMS DB/DC are over 35 years old and DB2 20 years old. Given that the bulk of what these machines do is largely characterized by these four pieces of software, it's not too surprising that they're pretty stable.
IBM's top end Unix machines (P/690s) have, I believe largely the same reliable kind of hardware; they're just often running much younger and much less stable software.
msp... Tell me about it! It's not easy getting to data. How do you do it where you work?
― KeefW (kmw), Friday, 8 April 2005 20:23 (twenty years ago)
― Sterling Clover (s_clover), Saturday, 9 April 2005 03:10 (twenty years ago)
it is solved and we will be seeing this stuff soon. right now the tools to solve it require some "graduate student" coaxing though to work right.... according to my prof
i am durnk
― The Scottish Restauranteer (ex machina), Saturday, 9 April 2005 06:36 (twenty years ago)
- Avoidance of race conditions etc. by appropriately grained locking mechanisms; i.e. putting 'synchronized' in the right place to maximise throughput whilst ensuring there are no reentrancy-related defects
- Optimal load balancing of program components on multiple processors
The second is the hard problem to solve (not to trivialize the first); although executable code bound at runtime would seem to make the first an impossible problem to solve in that case too.
Sterling: I would agree with what you say in general. Not sure about recursion/iteration. There is I guess a case in functional languages like the aforementioned Haskell as well as Lisp/Scheme and ML etc, where recursion is the only option, that since in these languages side-effects are not possible in functions, that this makes them easier to make assumptions about and therefore parallelize.
Additionally Jonathan, I think you're being optimistic about seeing this stuff any time soon... Time will tell.
- OO: invented 1967, Norway, Simula-67. Hyped late '80s, enters widespread use mid '90s.
- GUI 'WIMP' interface: Douglas Engelbart 1968. Enters mainstream in 1983; Apple Lisa. Widespread in '90s.
- Grid computing: Amoeba development completed in 1983. Being hyped now. Yet to enter mainstream in any significant way; other than say SETI.
- Databases: it's a good bet the contents of your bank account are stored in a pre-relational database.
It never ceases to amaze me what a remarkably conservative industry computing really is!
― KeefW (kmw), Sunday, 10 April 2005 18:13 (twenty years ago)
― Open your eyes; you can fly! (ex machina), Thursday, 21 April 2005 21:54 (twenty years ago)
― Levinicus (nordicskilla), Thursday, 21 April 2005 21:57 (twenty years ago)
Anyway:
1) perl -MCPAN -e "install Mac::Glue" is insane. It does tons of text to speech during make test!!!
2) http://wizardishungry.com/mrtg/ ... I am adding MORE STATISTICS as we speak.
― Open your eyes; you can fly! (ex machina), Thursday, 21 April 2005 22:33 (twenty years ago)
― caitlin oh no (caitxa1), Thursday, 21 April 2005 23:10 (twenty years ago)
― WORF (ex machina), Thursday, 21 April 2005 23:31 (twenty years ago)
Do you work for a direct marketing company?
Not exactly, no.
i didn't think adam was a programmer! i thought he made films.
No Caitlin, this is how I get money to make films.
― Levinicus (nordicskilla), Friday, 22 April 2005 00:24 (twenty years ago)
nice graphics wih... also besides perldsc, perlLOL is useful. (for the lazy.)
this perl class i took in my sophomore year ruled... our book was the man pages.... i think i read that forwards and backwards. i convinced all my profs that semester to let me code my other projects in perl. crypto being the main class. we did a text based simulation of the enigma machine... extra credit that was required for the grad students was to CRACK THE FREAKIN THING. which, he attempted to explain how to crack it but i was baffled by his poor teaching skills. thank god i was a peon undergrad.
― msp (mspa), Friday, 22 April 2005 02:12 (twenty years ago)
set state to 0 -- This state means that we think that I am home because of Bluetooth.
trytell application "iSync"activatesynchronizedo shell script "sleep 45" -- for some reason there seem to be some races here... it should work fineif sync status is (not 1) thenset state to sync status -- This means I am not home. Try Emailingend ifquitend tellon errorset state to 1end try
if state is 1 then
-- email cellphone heretrytell application "Mail"
set theSender to "me@gmail.com"set theAddress to "me@fone"
set theSubject to "Wakeup Jon."set theBody to "There's probably something you need to do soon."
set newMessage to make new outgoing message with properties {subject:theSubject, content:theBody, sender:theSender, address:theAddress}
tell newMessage
make new to recipient with properties {address:theAddress}
end tell
send newMessage
end tellon errorset state to 2end tryend if
if state is not 1 then -- Try to wake me with iTunestryset volume 100 -- systell application "iTunes"activateset sound volume to 100 -- itunesset this_playlist to (playlist named "WAKEUP STUPID")play this_playlistend tellon error -- play anything to wake me upset state to 3end tryend if
if state is 3 then -- uhhhhhhhtrytell application "iTunes"
set this_playlist to (playlist named "Library")play this_playlist
end tellon errorset state to 4end tryend if
if state is 4 then -- UGHHHHHtrysay "Good mornin', good mornin'!We've danced the whole night through,good mornin', good mornin' to you. Good mornin', good mornin'! It's great to stay up late, good mornin', good mornin' to you."beepbeepbeepbeepbeepbeepbeepbeep
end tryend if
― THE JAMES DEAN OF THE OLD TESTAMENT (ex machina), Monday, 27 June 2005 06:27 (twenty years ago)
I need some good tutorials on Python and wxPython. Anybody got any pointers, other than the usual ones?
― kingfish, Friday, 15 June 2007 22:16 (eighteen years ago)
SHOW THEM TO ME
― Alan, Friday, 15 June 2007 22:20 (eighteen years ago)
http://www.ibiblio.org/obp/thinkCSpy/
this is what I'm using to get spun up on editing and writing new cron jobs for analysis. unfortunately it would appear that anything worthwhile is also going to call for me to have to dig out Statistics for Dummies as well
― TOMBOT, Friday, 15 June 2007 22:26 (eighteen years ago)
I wrote a ruby script to allow LDAP queries/updates from instant messaging clients (xmpp) it uses a bot so you can do simple stuff easily.
― Jarlrmai, Friday, 15 June 2007 23:12 (eighteen years ago)
I wrote a Python tutorial as part of my Masters. http://pentangle.net/python/
I keep meaning to update it and maybe hawk it to some educational publishers. Too busy though.
Yesterday I successfully ported some code from column major IDL to row major Python. For a while all my galaxies were rotated 45˚, but I think I squashed all the array[x,y]s. I am still dealing with some horrible cancellation errors though. Mother fucking floating points.
― caek, Friday, 15 June 2007 23:39 (eighteen years ago)
a friend had a nice idea and wasn't too difficult to write a script for - myspace playlists - supply a list of names and get back an m3u file of all the tracks on the relevant pages. 50 lines of bash, half of them blank or comments.
― koogs, Tuesday, 10 July 2007 08:51 (eighteen years ago)
http://www.mullsports.com/frogger.rar
been working on 2d games lately, and started doing a frogger game. use keys Z,X,K,M to move. All you can do so far is jump on the logs and turtles and die in the water. I have traffic too but not put it in yet. soon.
― Ant Attack.. (Ste), Tuesday, 3 February 2009 23:29 (seventeen years ago)
I could tell you, but then you'd know too much.
― Mr. Snrub, Tuesday, 3 February 2009 23:37 (seventeen years ago)
Just spent two days trying to track down a problem with an Arduino project. Turns out the fault is a memory leak in the Strings library. m%^$%^$^ fu$%ing f$%^ (as my code was displaying on the LCD as leak milled RAM)
― second dullest ILXor since 1929 (snoball), Saturday, 14 July 2012 10:04 (thirteen years ago)