Welcome to the E-Blah Community!
We would like to welcome you to our community and invite you to register an account or login.
Being a registered member is important, as it gives you several advantages over the normal Guest status. After registering you will be able to download files and images, post messages, and access member-only portions of the forum - just to name a few. Registration is quick and simple, and only takes about a minute of your time.

E-Blah Community    General Discussion    Chit - Chat  ›  QUICK! Need help! PERL programmers!
Users Browsing Forum
No Members and 1 Guests

QUICK! Need help! PERL programmers!  This thread currently has 1,153 views. Print
2 Pages 1 2 » Recommend Thread
tylermenezes
January 27, 2007, 12:06am Report to Moderator Report to Moderator

Anybody here speak Python? HHHSSSSSSSSSSSSSS!
Posts: 201
Gender: Male
Posts Per Day: 0.21
Reputation: 90.48%
Reputation Score: +19 / -2
Time Online: 1 days 5 hours 56 minutes
Location: Redmond, Washington
Age: 16
Okay Justin, could you please help me here. Your E-Blah expertise would be of GREAT help...

I'm designing a PERL script for my school's library and I need to have it done by Monday, Jan. 29, 2007! My school's library has what they call "library passes" because everyone at my school hangs out in the library during lunch and plays video games on the computers. People can get a pass in the morning for that day, or can ask a librarian for a pass for the entire quarter.

What I need your help with is creating the member system. The one in E-Blah is great, so maybe you can help here? What I need to do:
  • Be able to issue daily passes, good only for one day.
  • Be able to issue semester passes, issued for, say "Quarter 1", valid until the librarian changes the semester
  • Get able to get a list of all students (semester passes and daily lunch passes) that can be in the library that day.


I already have the console, login, and request pass features done, but there's no way for the librarians to issue passes, because I have no idea how to store names, quarter pass (boolean), and valid date (if quarter pass is false).

Again, PLEASE help. I need this by Monday, because that's the start of the new quarter, and they said if I could get it done by then they'd love to use it. I'm reading a book I bought on PERL, but I'll never finish it in time, and I know VERY little about the language. I don't have any money to donate right now, but if you help I'll donate as soon as I get some.


Thanks so much! If you need a copy of the existing code, it's attached.



This post contains attachments; to download them you must login.



Logged Offline
Site Site Private Message Private message
Justin
January 27, 2007, 1:42am Report to Moderator Report to Moderator

The E-Blah Developer
E-Blah Programmer
Posts: 15,075
Gender: Male
Posts Per Day: 6.52
Reputation: 93.40%
Reputation Score: +297 / -21
Time Online: 36 days 23 hours 27 minutes
Location: Tallassee, AL
Age: 22
You want a full scaled member back end in a few days?  Ouch.  It's not that hard, but if you don't know much perl it will be.

I'd try to do it with XML myself.  Just do it that way.  I'm not sure how you'd do the other stuff, it's something you'd have to actually plan out.  You'll want to get the current time, probably, and add X amount of days to it to state how long it's valid for (then the code blocks it if it goes over those dates, etc).


I do installs for $25 and upgrades for $20.
Technical support is always free.

  Donate to E-Blah!  

My Websites: Revolution Reality (My Blog)  |  MinistryTalk.com  |  Portfolio

"But you, O Lord, are a compassionate and gracious God, slow to anger, abounding in love and faithfulness." — Psalm 86:15 NIV

Logged Offline
Site Site Private Message Private message Reply: 1 - 21
tylermenezes
January 27, 2007, 1:49am Report to Moderator Report to Moderator

Anybody here speak Python? HHHSSSSSSSSSSSSSS!
Posts: 201
Gender: Male
Posts Per Day: 0.21
Reputation: 90.48%
Reputation Score: +19 / -2
Time Online: 1 days 5 hours 56 minutes
Location: Redmond, Washington
Age: 16
I just really need some way of having PERL process a file with user information in it like:

\n - new person
| - seporator

something like that, I could probably do the processing code, but I have no idea how to get the processing into arrays. If you could give me some example code to seperate:

username|quarter(1/0)|dateissued|lunch(1/2/3)

into arrays named "username", "quarter", "dateissued", and "lunch" then I could do the rest. I already figured out to do date arrhythmic and revoking of passes.

If XML would be easier, let me know. Keep in mind that if it requires an additional Perl module, my website server host won't install it. I kind of like the way E-Blah does it though. Everything I need is there in the Eblah code somewhere... Member deletions, date registered, ranks, etc. if you could even give me some guidance as to how you did this for E-Blah, that would be really helpful.

Thanks!


Thanks for the help!


Logged Offline
Site Site Private Message Private message Reply: 2 - 21
Justin
January 27, 2007, 12:03pm Report to Moderator Report to Moderator

The E-Blah Developer
E-Blah Programmer
Posts: 15,075
Gender: Male
Posts Per Day: 6.52
Reputation: 93.40%
Reputation Score: +297 / -21
Time Online: 36 days 23 hours 27 minutes
Location: Tallassee, AL
Age: 22
($username,$quarter,$dateisued,$lunch) = split(/\|/,$string);

Just do a for each and then you'll have your variables.


I do installs for $25 and upgrades for $20.
Technical support is always free.

  Donate to E-Blah!  

My Websites: Revolution Reality (My Blog)  |  MinistryTalk.com  |  Portfolio

"But you, O Lord, are a compassionate and gracious God, slow to anger, abounding in love and faithfulness." — Psalm 86:15 NIV

Logged Offline
Site Site Private Message Private message Reply: 3 - 21
tylermenezes
January 27, 2007, 3:47pm Report to Moderator Report to Moderator

Anybody here speak Python? HHHSSSSSSSSSSSSSS!
Posts: 201
Gender: Male
Posts Per Day: 0.21
Reputation: 90.48%
Reputation Score: +19 / -2
Time Online: 1 days 5 hours 56 minutes
Location: Redmond, Washington
Age: 16
Thanks you so much!

How could I load a specific member though? i.e.

Tyler|1||2
Justin|0|January 27 2007|1

and someone is looking for a member named Tyler so I look for a line starting with Tyler?


Thanks again, again!


Logged Offline
Site Site Private Message Private message Reply: 4 - 21
Justin
January 27, 2007, 4:06pm Report to Moderator Report to Moderator

The E-Blah Developer
E-Blah Programmer
Posts: 15,075
Gender: Male
Posts Per Day: 6.52
Reputation: 93.40%
Reputation Score: +297 / -21
Time Online: 36 days 23 hours 27 minutes
Location: Tallassee, AL
Age: 22
foreach(@line) { ... }


I do installs for $25 and upgrades for $20.
Technical support is always free.

  Donate to E-Blah!  

My Websites: Revolution Reality (My Blog)  |  MinistryTalk.com  |  Portfolio

"But you, O Lord, are a compassionate and gracious God, slow to anger, abounding in love and faithfulness." — Psalm 86:15 NIV

Logged Offline
Site Site Private Message Private message Reply: 5 - 21
tylermenezes
January 27, 2007, 5:19pm Report to Moderator Report to Moderator

Anybody here speak Python? HHHSSSSSSSSSSSSSS!
Posts: 201
Gender: Male
Posts Per Day: 0.21
Reputation: 90.48%
Reputation Score: +19 / -2
Time Online: 1 days 5 hours 56 minutes
Location: Redmond, Washington
Age: 16
So that will look for each new line in the file?

My code should look like:

open(FH3,"./libpass/list.txt");
$memberdb = <FH3>;
close (FH3);
foreach(@line) {
($username,$quarter,$dateisued,$lunch) = split(/\|/,$memberdb);
print "Name: $username<br />Quarter: $quarter<br />Date: $date<br />Lunch: $lunch<p />"
}

And that would give me

Name: Tyler
Quarter: 3
Date:
Lunch: 2

Name: Justin
Quarter:
Date: January 27 2007
Lunch: 1


Is this correct?

Thanks again, again, again!


Logged Offline
Site Site Private Message Private message Reply: 6 - 21
Justin
January 27, 2007, 5:23pm Report to Moderator Report to Moderator

The E-Blah Developer
E-Blah Programmer
Posts: 15,075
Gender: Male
Posts Per Day: 6.52
Reputation: 93.40%
Reputation Score: +297 / -21
Time Online: 36 days 23 hours 27 minutes
Location: Tallassee, AL
Age: 22
More like this ...

Code
open(FH3,"./libpass/list.txt");
@memberdb = <FH3>;
close (FH3);
chomp @memberdb;
foreach $arraystring (@memberdb) {
($username,$quarter,$dateisued,$lunch) = split(/\|/,$arraystring);
print "Name: $username<br />Quarter: $quarter<br />Date: $date<br />Lunch: $lunch<p />"
}


I do installs for $25 and upgrades for $20.
Technical support is always free.

  Donate to E-Blah!  

My Websites: Revolution Reality (My Blog)  |  MinistryTalk.com  |  Portfolio

"But you, O Lord, are a compassionate and gracious God, slow to anger, abounding in love and faithfulness." — Psalm 86:15 NIV

Logged Offline
Site Site Private Message Private message Reply: 7 - 21
tylermenezes
January 27, 2007, 5:52pm Report to Moderator Report to Moderator

Anybody here speak Python? HHHSSSSSSSSSSSSSS!
Posts: 201
Gender: Male
Posts Per Day: 0.21
Reputation: 90.48%
Reputation Score: +19 / -2
Time Online: 1 days 5 hours 56 minutes
Location: Redmond, Washington
Age: 16
THANK YOU SO MUCH!!!

One final queston: How can I use something (probably regex) to only return members with lunch 3, or name "Tyler"?

If you want to see what I'm working on: http://www.programsandwebsites.com/libpass/index.pl?action=login&login=grizzlies


Logged Offline
Site Site Private Message Private message Reply: 8 - 21
Justin
January 27, 2007, 6:07pm Report to Moderator Report to Moderator

The E-Blah Developer
E-Blah Programmer
Posts: 15,075
Gender: Male
Posts Per Day: 6.52
Reputation: 93.40%
Reputation Score: +297 / -21
Time Online: 36 days 23 hours 27 minutes
Location: Tallassee, AL
Age: 22
Umm, just do the foreach and then do:

if($line =~ /\QTyler\E/sig) { ... }


I do installs for $25 and upgrades for $20.
Technical support is always free.

  Donate to E-Blah!  

My Websites: Revolution Reality (My Blog)  |  MinistryTalk.com  |  Portfolio

"But you, O Lord, are a compassionate and gracious God, slow to anger, abounding in love and faithfulness." — Psalm 86:15 NIV

Logged Offline
Site Site Private Message Private message Reply: 9 - 21
tylermenezes
January 27, 2007, 6:10pm Report to Moderator Report to Moderator

Anybody here speak Python? HHHSSSSSSSSSSSSSS!
Posts: 201
Gender: Male
Posts Per Day: 0.21
Reputation: 90.48%
Reputation Score: +19 / -2
Time Online: 1 days 5 hours 56 minutes
Location: Redmond, Washington
Age: 16
Thanks! You rock!

Line should be $arraystring though, right?


I actually do have one queston, what could I use to delete a member's line, assuming I know the member's full name ($username)?


Logged Offline
Site Site Private Message Private message Reply: 10 - 21
Justin
January 27, 2007, 6:14pm Report to Moderator Report to Moderator

The E-Blah Developer
E-Blah Programmer
Posts: 15,075
Gender: Male
Posts Per Day: 6.52
Reputation: 93.40%
Reputation Score: +297 / -21
Time Online: 36 days 23 hours 27 minutes
Location: Tallassee, AL
Age: 22
Just add the old stuff, minus the old username, into an array, then write it to file.  Or write it to file and don't stick it into an array, which is faster.


I do installs for $25 and upgrades for $20.
Technical support is always free.

  Donate to E-Blah!  

My Websites: Revolution Reality (My Blog)  |  MinistryTalk.com  |  Portfolio

"But you, O Lord, are a compassionate and gracious God, slow to anger, abounding in love and faithfulness." — Psalm 86:15 NIV

Logged Offline
Site Site Private Message Private message Reply: 11 - 21
tylermenezes
January 27, 2007, 7:43pm Report to Moderator Report to Moderator

Anybody here speak Python? HHHSSSSSSSSSSSSSS!
Posts: 201
Gender: Male
Posts Per Day: 0.21
Reputation: 90.48%
Reputation Score: +19 / -2
Time Online: 1 days 5 hours 56 minutes
Location: Redmond, Washington
Age: 16
How could I do that? I'm new to PERL remember, I know the print method, how to set cookies, use lines, and if lines, but that's it.


Logged Offline
Site Site Private Message Private message Reply: 12 - 21
Justin
January 27, 2007, 8:16pm Report to Moderator Report to Moderator

The E-Blah Developer
E-Blah Programmer
Posts: 15,075
Gender: Male
Posts Per Day: 6.52
Reputation: 93.40%
Reputation Score: +297 / -21
Time Online: 36 days 23 hours 27 minutes
Location: Tallassee, AL
Age: 22
A loop that gets rid of the stuff you don't want.  Use next; ...


I do installs for $25 and upgrades for $20.
Technical support is always free.

  Donate to E-Blah!  

My Websites: Revolution Reality (My Blog)  |  MinistryTalk.com  |  Portfolio

"But you, O Lord, are a compassionate and gracious God, slow to anger, abounding in love and faithfulness." — Psalm 86:15 NIV

Logged Offline
Site Site Private Message Private message Reply: 13 - 21
tylermenezes
January 27, 2007, 9:03pm Report to Moderator Report to Moderator

Anybody here speak Python? HHHSSSSSSSSSSSSSS!
Posts: 201
Gender: Male
Posts Per Day: 0.21
Reputation: 90.48%
Reputation Score: +19 / -2
Time Online: 1 days 5 hours 56 minutes
Location: Redmond, Washington
Age: 16
Ok, here's what I've got:

Code
sub deleteuser{
my $td = shift;

	$openpg = "$dir/list.txt";
open(FH3,"$openpg");
@memberdb = <FH3>;
close (FH3);


chomp @memberdb;
foreach $arraystring (@memberdb) {	
($username,$quarter,$dateisued,$lunch) = split(/\|/,$arraystring);
push(@usernames, $username);
push(@quarters, $quarter);
push(@dateissueds, $dateisued);
push(@lunches, $lunch);
}
$count = 0;
foreach $user (@usernames) {
	if($user eq $td){
	delete @usernames[$count];
	delete @quarters[$count];
	delete @dateissueds[$count];
	delete @lunches[$count];	
	$count--;
	}
$count++;
}
$c2 = "0";
foreach $user (@usernames){
if($ct eq "0"){
$user = "\n$user";
}
$openpg = "$dir/list.txt";
open(FH4,">$openpg");
print FH4 "$user|$quarters[$ct]|@dateissueds[$ct]|@lunches[$ct]";
close (FH4);
print "$user|$quarters[$ct]|@dateissueds[$ct]|@lunches[$ct]<br>";
$c2++;
}

}


This works, but it has a few strange problems. If I try to delete "Joe Smith" and there's also a user named "John Smith", they're both deleted. Could you tell me what I'm doing wrong?


Logged Offline
Site Site Private Message Private message Reply: 14 - 21
2 Pages 1 2 » Recommend Thread
Print

E-Blah Community    General Discussion    Chit - Chat  ›  QUICK! Need help! PERL programmers!