richieking 44 Master Poster

look dont take thing personal buddy.

I was just showing another way to your psedo.

;)

richieking 44 Master Poster

as much as i know for now. YEPEEEEE
;)

richieking 44 Master Poster

OOP need clean encaps.
Class must contain all the dirty job done inside.

griswolf edited

name=raw_input("name: ")

class Employee:
  def empDetails(self,name,rate=6): #default value init
    self.name = name
    self.rate = rate

# for fun, lets make a global function to pretty-print an Employee's name and rate
# it would probably be better if it were a member function, but leave it for now
  def print_Employee(self):
       print("%s earns $%d.00 per hour"%(self.name,self.rate))
# create an employee "Raj" at minimum rate

raj=Employee(); # Class initialise into class object

raj.empDetails(name)#Better abstraction of data
# show Raj's info
raj.print_Employee()
# create an employee "San" at $15.00 rate
san=Employee()
san.empDetails("fred",15)
# show San's info
san.print_Employee()
richieking 44 Master Poster

OOP need clean encaps.
Class must contain all the dirty job done inside.

griswolf edited

name=raw_input("name: ")

class Employee:
  def empDetails(self,name,rate=6): #default value init
    self.name = name
    self.rate = rate

# for fun, lets make a global function to pretty-print an Employee's name and rate
# it would probably be better if it were a member function, but leave it for now
  def print_Employee(self):
       print("%s earns $%d.00 per hour"%(self.name,self.rate))
# create an employee "Raj" at minimum rate

raj=Employee(); # Class initialise into class object

raj.empDetails(name)#Better abstraction of data
# show Raj's info
raj.print_Employee()
# create an employee "San" at $15.00 rate
san=Employee()
san.empDetails("fred",15)
# show San's info
san.print_Employee()
richieking 44 Master Poster

;)

richieking 44 Master Poster

Optimise the class like ***


name=raw_input("name: ")

class Employee:
def empDetails(self,name,rate=6): #default value init
self.name = name
self.rate = rate

# for fun, lets make a global function to pretty-print an Employee's name and rate
# it would probably be better if it were a member function, but leave it for now
def print_Employee(self):
print("%s earns $%d.00 per hour"%(self.name,self.rate))
# create an employee "Raj" at minimum rate

raj=Employee(); # Class initialise into class object

raj.empDetails(name)#Better abstraction of data
# show Raj's info
raj.print_Employee()
# create an employee "San" at $15.00 rate
san=Employee()
san.empDetails("fred",15)
# show San's info
san.print_Employee()

richieking 44 Master Poster

yep 47-51 will do the trick friend. ;)

richieking 44 Master Poster

Why do you log-in 2 times???? line 28 , 52

optimise your code well cos it may lead to bug.

once you login, the connection stays until the programe exists.
Creating server object 2 times means 2 different object.
Your code can be small and effective if you work on that.

Besides all that, i think you are not doing bad buddy.
;)

richieking 44 Master Poster

I just tried your code. works ok on my UBUNTU.

change the data type on line 34 to accept float or provide information about the datatype to use. Or Or ... make availability for the 2 datatype.

Files stuff..... The logic of opening the same file 2 time not really good.
If you will be writing and reading, just open the file r+.
Also write data to your file after each session so that you can format your inputs.
Besides everything works fine.

explore ;)

richieking 44 Master Poster

on line 29 do int type casting for your raw input.

you are checking string with while loop for int.
not good really.

besides i dont see what you want really.

;)

richieking 44 Master Poster

SUNTOM
WILDBAMABOY just pointed you the way. That is how python deals with error checking.

you need to try and except.

Just like c++ try catch thing.

;)

richieking 44 Master Poster

check your indentation from for loop to end.

Also why not do things the easy way.??

;)

richieking 44 Master Poster

Well python comes in handy

very straight forward ;)

richieking 44 Master Poster

Thats the beauty of programming. Flavors flavors flavor.

What ever turns you on ;)

richieking 44 Master Poster

Well i think mitchems just said it all.

Look no one needs the actual data. just make a dummy one for love sake ok?

We are all interested in challenges as prog. junkies.
Make us a dummy data to play with ok?
;)

richieking 44 Master Poster

I dont really do more java stuff at the moment. i do more of C++,perl,php and now trying my hands on assembler. Who knows???

;)

richieking 44 Master Poster

I just need a copy of your file or something more concrete to work on. You see giving abstract info is always not the best.
I still dont get you good friend.

richieking 44 Master Poster

Not at all. I got used to that. It was a big deal but once you start working like that. You develop your style and speed.

I also got my libraries and templates already.
All these started from quick fixing stuff. You get bored with IDE's taking long to load.

;)

richieking 44 Master Poster

In the above example there is nothing to remove. You will find that replacing print(s/\",'*//,$_); with a simple print; will give the same output.

Well sorry to divert a little from here.

simple Print will not remove quotes in a hash my good friend.
I know you know that yourself. ;)
...

richieking 44 Master Poster

Well but i prefer nano or vim.

and manually make and compile .
;)

richieking 44 Master Poster

At least why cant people look around before they post something?

And please post your code. Show that you are doing something yourself.
We are not workers but helpers. ;)

richieking 44 Master Poster

hmmmm i am not a windows guy but you can google around.

;)

richieking 44 Master Poster

Can you post your code at least.???

What have you done so far.?

Need more info ok ;)

richieking 44 Master Poster

You want simple one.
Check this out.

my @S=("hello","ben","foo",,"","bar","rose","world","foo",'loo');

foreach (@S)
{
	print(s/\",'*//,$_);
	print "\t";
	}




## OUT PUT

hello    ben     foo    bar     rose    world    loo
richieking 44 Master Poster

how is your file formated....?

Yep you can read from a file into an array and check or straight from the file.
To an array if you care about speed.

I dont see any problem with $Major in this check up.

;)

post your file ok? Need to look through.

richieking 44 Master Poster

Perl module installation is very simple.

perl Makefile.PL
make
make test
make install # You may need to be root
make clean # or make realclean

navigate to the folder you saved the downloaded tar. just extract it.

using your CMD line. change to SU mode.
Run the above snippet from the CMD in su mode.
JOB DONE.! :)

Start using your module brother.

richieking 44 Master Poster

Its coding, very little character counts.

$result = "mysql_query($query)";

no need for the " " sign.
;)

richieking 44 Master Poster

Storing images in a php array is the one of the ways.
You can also get the from the folder.
OR from DB

Its all up to your taste .


Its very simple. ;)

richieking 44 Master Poster

Why dont you try perl, ;)

richieking 44 Master Poster

You can do that but i will advice you to store your paths in DB.
As folder grows, sorting becomes a very big issue.

1. You must have a very logical naming for your images. eg. the big image named big2233.png and the small one sm2233.png. ID.

2.In this case you can go to the image folder and request for the images but you still must have something that connects this image to a USER/PERSON.


Give some more info ok?.
post your code. ;)

richieking 44 Master Poster

k_manimuthu,

Yep i like your snippet. That should provide the dates. ;)

richieking 44 Master Poster

I dont get him either.???

Can someone be very specific here with what they want.??

richieking 44 Master Poster

You are welcome anytime good friend.
just leave me a good tip ;)

richieking 44 Master Poster

I dont get you.

How do you start your app.??
Give me how it should work in step by step.

ok ;)

richieking 44 Master Poster

more screen shot

SERVER Waiting for client connection on port 9000
IO::Socket::INET=GLOB(0x87c3b98)Welcome. Sim is ready.
IO::Socket::INET=GLOB(0x87c3b98)enter details

wwwww nnnnn kkkkk lllll iiiii

IO::Socket::INET=GLOB(0x87c3b98)this is usr input: wwwww nnnnn kkkkk lllll iiiii

IO::Socket::INET=GLOB(0x87c3b98)This is priority nnnnn
IO::Socket::INET=GLOB(0x87c3b98)This is Location kkkkk
IO::Socket::INET=GLOB(0x87c3b98)Welcome. Sim is ready.
IO::Socket::INET=GLOB(0x87c3b98)enter details

SERVER Waiting for client connection on port 9000
IO::Socket::INET=GLOB(0x88adb98)Welcome. Sim is ready.
IO::Socket::INET=GLOB(0x88adb98)enter details

The king Jesus 4333 Kingdom
IO::Socket::INET=GLOB(0x88adb98)this is usr input: The king Jesus 4333 Kingdom
IO::Socket::INET=GLOB(0x88adb98)This is priority king
IO::Socket::INET=GLOB(0x88adb98)This is Location Jesus
IO::Socket::INET=GLOB(0x88adb98)Welcome. Sim is ready.
IO::Socket::INET=GLOB(0x88adb98)enter details

Ithink I love this perl
IO::Socket::INET=GLOB(0x88adb98)this is usr input: Ithink I love this perl
IO::Socket::INET=GLOB(0x88adb98)This is priority I
IO::Socket::INET=GLOB(0x88adb98)This is Location love
IO::Socket::INET=GLOB(0x88adb98)Welcome. Sim is ready.
IO::Socket::INET=GLOB(0x88adb98)enter details

Hope you are happy now. ;)

richieking 44 Master Poster

Screen shot brother.

SERVER Waiting for client connection on port 9000
IO::Socket::INET=GLOB(0x87c3b98)Welcome. Sim is ready.
IO::Socket::INET=GLOB(0x87c3b98)enter details
richieking 44 Master Poster

Restart your Activeperl before you run the code ok?

This is working 100%.

I can post a screenshot if you want. ;)

richieking 44 Master Poster
#!/usr/bin/perl -w 

use strict;
use warnings;

sub nap {
    sleep 1;
    }

        use IO::Socket; 
        use Net::hostent;              # for OO version of gethostbyaddr 
    my $PORT = 9000;




        my $server = IO::Socket::INET->new(
                                 LocalAddr => 'localhost',
                                 LocalPort => $PORT,
                                 Proto     => 'tcp') or die ("error connection\n");

        
        
        

    print "SERVER Waiting for client connection on port $PORT\n";

         while ( $server->sockname()) {
             
          $server->autoflush(1);
      print $server, "Welcome. Sim is ready.\r\n";
         ≉##Waiting    

print $server, "enter details\r\n\n";    
≉    ##waiting    
my $nrecord = <>;        
chomp $nrecord;    
&nap;##Waiting    
        
(my $Record,my $Priority, my $Location,my $filename,my $time)= split(m/ /,$nrecord); 
print $server ,"this is usr input: $nrecord\r\n";
    
&nap;##Waiting        
print  $server, "This is priority $Priority\r\n";    
&nap;##waiting    
print $server,"This is Location $Location\r\n";

}

Just run this code.

Happy man ;)

richieking 44 Master Poster

Hay its working. I just installed the module. wait on the line. i am checking other stuffs ok? ;)

richieking 44 Master Poster

check with this http://search.cpan.org/~gbarr/IO-1.25/lib/IO/Socket/INET.pm.

your defination must be like one of this

richieking 44 Master Poster

Did you run this in CMD prompt?

The line 18 got nothing to do with syntax. Check with you module and how you initialize the socket.

I dont have IO Socket , only IO Socket SSl.

just a litle busy with thing but i wanna help you.

The problem is check your socket defination. The rest of the code must work. thats 100%

richieking 44 Master Poster

i meant the tool you are using to write your perl code. Active perl for windows.??

I just dont remember the last time i prog. on windows....

thats all good ;)

richieking 44 Master Poster

Try this ,

I have fix the errors .

#!/usr/bin/perl -w 

use strict;
use warnings;

sub nap {
    sleep 1;
    }

        use IO::Socket; 
        use Net::hostent;              # for OO version of gethostbyaddr 
    my $PORT = 9000;




        my $server = IO::Socket::INET->new( Proto     => 'tcp',
                                         LocalPort => $PORT,
                                         Listen    => 5,
                                         Reuse     => 1) or die "can't setup server";

    print "SERVER Waiting for client connection on port $PORT\n";

         while (my $client = $server->accept()) {
          $client->autoflush(1);
      print $client "Welcome. Sim is ready.\r\n";
         &nap;##Waiting    

print $client, "enter details\r\n\n";    
&nap;    ##waiting    
my $nrecord = <>;        
chomp;    
&nap;##Waiting    
        
(my $Record,my $Priority, my $Location,my $filename,my $time)= split(m/ /,$nrecord); 
print $client ,"this is usr input: $nrecord\r\n";
    
&nap;##Waiting        
print  $client, "This is priority $Priority\r\n";    
&nap;##waiting    
print $client ,"This is Location $Location\r\n";

}

hope it helps ;)

richieking 44 Master Poster

you have a bug in your code.

on line 12,13.

That is not how to read an array.
when reading scalar from array its like this

$foo= $foo[0]

## if its a hash
$foo= $foo{bar};

Allow strict. ok?

what ide are you using?
;)

richieking 44 Master Poster
#!/usr/bin/perl
print "enter details\n\n";
		$nrecord = <>;
		chomp;
		print "this is usr input: $nrecord\r\n";
		($Record,$Priority,$Location,$filename,$time)= split(m/ /,$nrecord);

		print  "This is priority $Priority\r\n";
		print "This is Location $Location\r\n";

i just put on try this piece of your code and it works. check it out.
run this via a cmd prompt. ;)

richieking 44 Master Poster

very strange. My works as expected.
chomp $nrecord before split ok?

And make sure split / / is only a space not more.
:)

richieking 44 Master Poster

Hi mate Thanks for your reply. I can get the code i am new to php tutorial and still studying. How I can keep it simple? can u help? i certainly can handle a file to download, but in this case I can not upload multiple do not know why. i try i still have this error code.

The multi upload code should work without problem. Just change the upload dir to what ever path and make sure you have a read write permission.

;)

richieking 44 Master Poster

Hi,
Before you can work on a data, the user must enter the data or you must have the data source.

on line 6 if the $nrecord takes the cmd arg. The code must work with the split.

OK run the code again and print $nrecord if it contains any data.

;)

richieking 44 Master Poster

Get life, Firefox rocks!!!!!!!!!!! ;)
Just like my UBUNTU BABY ;)

richieking 44 Master Poster

You can also store them in an array as you wanted.

using

print "enter your name\n";
$takeIn=<>;
chomp $takeIn;
@d=$takeIn

## use shift on the array to add the additional data user enters.

Then iterate the array to get the all the user entered info.

Thats also simple ;)