Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Using a calculation to place locations

by kcott (Abbot)
on May 07, 2013 at 14:16 UTC ( #1032489=note: print w/ replies, xml ) Need Help??


in reply to Using a calculation to place locations

G'day Hasharray,

Welcome to the monastery.

This technique appears to do what you want.

$ perl -Mstrict -Mwarnings -e ' my $X_initial = "80"; my $Y_initial = "80"; my $MAX_X = 240; my ($cur_x, $cur_y) = ($X_initial, $Y_initial); for (0 .. 20) { if ($cur_x > $MAX_X) { $cur_x = $X_initial; $cur_y += $Y_initial; print "\n"; } print " \t$_:$cur_x/$cur_y"; $cur_x += $X_initial; } print "\n"; ' 0:80/80 1:160/80 2:240/80 3:80/160 4:160/160 5:240/160 6:80/240 7:160/240 8:240/240 9:80/320 10:160/320 11:240/320 12:80/400 13:160/400 14:240/400 15:80/480 16:160/480 17:240/480 18:80/560 19:160/560 20:240/560

I'll leave you to translate that into your XML-populating code.

-- Ken


Comment on Re: Using a calculation to place locations
Download Code
Re^2: Using a calculation to place locations
by Hasharray (Novice) on May 07, 2013 at 17:50 UTC
    Dude! You rock! Thanks a mill, really appreciate it!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1032489]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2015-07-04 21:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls