Author Topic: code help because i'm a big stupid idiot.  (Read 3034 times)

Offline linear

  • High Priest of Operations
  • OMG Mod
  • PLA Army
  • *****
  • Posts: 558
  • 1337 13V3L: +47/-79
  • United Phone Losers
    • United Phone Losers
code help because i'm a big stupid idiot.
« on: November 06, 2008, 03:38:36 PM »
what's a quick and dirty way to render a set of data as a word doc?

or at least a page that when printed is 5(down)x2(across) blocks for printing data sets.

it can be perl, php, or javascript.


Offline liife

  • PLA Nation Citizen
  • *
  • Posts: 1056
  • 1337 13V3L: +8/-5
Re: code help because i'm a big stupid idiot.
« Reply #1 on: November 07, 2008, 07:18:15 AM »
I don't know.
It looks like you got hit in the face with that egg and you want to eat it too.

Offline trevelyn

  • Administrator
  • Elite Cactus Squad
  • Ninja Phone Loser
  • *****
  • Posts: 1687
  • 1337 13V3L: +183/-22
  • He likes cans and taking pictures in cans!
    • WeakNet Labs
Re: code help because i'm a big stupid idiot.
« Reply #2 on: November 07, 2008, 10:42:57 AM »
here buddy:  try using Perl:

Quote
#!/usr/bin/perl
open (FILE, "file.txt");
@lines = <FILE>;
close (FILE);
chomp @lines;
print "$lines[0] $lines[1]\n";
print "$lines[2] $lines[3]\n";
print "$lines[4] $lines[5]\n";
print "$lines[6] $lines[7]\n";
print "$lines[8] $lines[9]\n";
print "\n";
print "$lines[10] $lines[11]\n";
print "$lines[12] $lines[13]\n";
# go on from there...
exit;

that's if the file you give it "file.txt" is line by line.  :)

Edit: jesus christ already with the red bold el oh el's.  I had to edit this whole damned post cos i used el oh el as the filehandle and el oh el dot tee ecks tee as the file!
« Last Edit: November 07, 2008, 10:45:04 AM by trevelyn »

Offline trevelyn

  • Administrator
  • Elite Cactus Squad
  • Ninja Phone Loser
  • *****
  • Posts: 1687
  • 1337 13V3L: +183/-22
  • He likes cans and taking pictures in cans!
    • WeakNet Labs
Re: code help because i'm a big stupid idiot.
« Reply #3 on: November 07, 2008, 11:02:03 AM »
yo, wait, i thought of two things.. If the file is HUGE you won't want to code the whole thing, so stick the block into a while loop. and the highest element of the set @lines would be $#lines.  Also, if the file is NOT line by line, just make it that way with sed using regexp's.  :)
« Last Edit: November 07, 2008, 11:04:37 AM by trevelyn »

Offline trevelyn

  • Administrator
  • Elite Cactus Squad
  • Ninja Phone Loser
  • *****
  • Posts: 1687
  • 1337 13V3L: +183/-22
  • He likes cans and taking pictures in cans!
    • WeakNet Labs
Re: code help because i'm a big stupid idiot.
« Reply #4 on: November 07, 2008, 11:15:18 AM »
here, check it out, i recoded it for you! :)

Quote
#!/usr/bin/perl
$n = 0;
open (FILE, "file.txt");
@lines = <FILE>;
close (FILE);
chomp @lines; $m = $#lines;
until ($n > $m) { print "$lines[$n]"; $n++; print " $lines[$n]\n"; $n++;
print "$lines[$n]"; $n++; print " $lines[$n]\n"; $n++;
print "$lines[$n]"; $n++; print " $lines[$n]\n"; $n++;
print "$lines[$n]"; $n++; print " $lines[$n]\n"; $n++;
print "$lines[$n]"; $n++; print " $lines[$n]\n"; $n++;
print "\n"; }
* trevelyn <-- just another perl hacker.

Offline trevelyn

  • Administrator
  • Elite Cactus Squad
  • Ninja Phone Loser
  • *****
  • Posts: 1687
  • 1337 13V3L: +183/-22
  • He likes cans and taking pictures in cans!
    • WeakNet Labs
Re: code help because i'm a big stupid idiot.
« Reply #5 on: November 07, 2008, 11:20:11 AM »
youre taking way too long to respond so i'll post a sed statement too, here is what you do if you wanna get rid of space in a file (to make it work with the above scripts:

Quote
cat file.txt | sed 's/ /\n/g'

yay! this is fun!

Offline linear

  • High Priest of Operations
  • OMG Mod
  • PLA Army
  • *****
  • Posts: 558
  • 1337 13V3L: +47/-79
  • United Phone Losers
    • United Phone Losers
Re: code help because i'm a big stupid idiot.
« Reply #6 on: November 07, 2008, 11:26:52 AM »
thanks so much, you're amazing!

I'll let you know how it goes.


Offline ApprenticePhreak

  • PLA Junkie
  • *****
  • Posts: 825
  • 1337 13V3L: +48/-12
Re: code help because i'm a big stupid idiot.
« Reply #7 on: November 07, 2008, 11:33:27 AM »
I still owe Trev some illegally downloaded books. I've got the time today, so maybe you'll get some today! OMGHAX!2131#!@#1

Offline trevelyn

  • Administrator
  • Elite Cactus Squad
  • Ninja Phone Loser
  • *****
  • Posts: 1687
  • 1337 13V3L: +183/-22
  • He likes cans and taking pictures in cans!
    • WeakNet Labs
Re: code help because i'm a big stupid idiot.
« Reply #8 on: November 07, 2008, 11:52:11 AM »
i luv you guys. i love pla.  and today it's my birthday. 11-7-1980.

Offline ApprenticePhreak

  • PLA Junkie
  • *****
  • Posts: 825
  • 1337 13V3L: +48/-12
Re: code help because i'm a big stupid idiot.
« Reply #9 on: November 07, 2008, 12:21:47 PM »
HAPPY BIRTHDAY TREVELYN! YOU'RE WASTING YOUR LIFE HERE JUST LIKE THE REST OF US~~~~  :nonsense:

Offline Nod

  • Quando omni flunkus moritati
  • Elite Cactus Squad
  • Ninja Phone Loser
  • *****
  • Posts: 3725
  • 1337 13V3L: +210/-138
  • 212-389-1318
    • twitter: @mrnudnik
Re: code help because i'm a big stupid idiot.
« Reply #10 on: November 07, 2008, 01:14:46 PM »
HAPPY BIRTHDAY TREV! WE LOVE YOU TOO!
I HATE the bridge.
Meme Roth is a Food Nazi Cunt

Offline trevelyn

  • Administrator
  • Elite Cactus Squad
  • Ninja Phone Loser
  • *****
  • Posts: 1687
  • 1337 13V3L: +183/-22
  • He likes cans and taking pictures in cans!
    • WeakNet Labs
Re: code help because i'm a big stupid idiot.
« Reply #11 on: November 07, 2008, 01:15:49 PM »
thanks! :D

Offline Nod

  • Quando omni flunkus moritati
  • Elite Cactus Squad
  • Ninja Phone Loser
  • *****
  • Posts: 3725
  • 1337 13V3L: +210/-138
  • 212-389-1318
    • twitter: @mrnudnik
Re: code help because i'm a big stupid idiot.
« Reply #12 on: November 07, 2008, 01:17:18 PM »
Can I mail you my phone and have you do all the neat stuff I want with it? I'll gladly send you a cookie.
I HATE the bridge.
Meme Roth is a Food Nazi Cunt

Offline murd0c

  • PLA Public Relations
  • Administrator
  • Ninja Phone Loser
  • *****
  • Posts: 1344
  • 1337 13V3L: +169/-74
    • murd0c dot net
Re: code help because i'm a big stupid idiot.
« Reply #13 on: November 07, 2008, 01:25:41 PM »
i luv you guys. i love pla.  and today it's my birthday. 11-7-1980.

Did you get my letter yet?

Offline Nod

  • Quando omni flunkus moritati
  • Elite Cactus Squad
  • Ninja Phone Loser
  • *****
  • Posts: 3725
  • 1337 13V3L: +210/-138
  • 212-389-1318
    • twitter: @mrnudnik
Re: code help because i'm a big stupid idiot.
« Reply #14 on: November 07, 2008, 01:29:49 PM »
I WANT A LETTER FROM MURD0C! But I don't want him to have my address 'cause I'm afraid he'll find me and buttrape me.
I HATE the bridge.
Meme Roth is a Food Nazi Cunt