07 Jul, 05:52AM in sunny Singapore!

Recent Posts by LatecomerX

Subscribe to Recent Posts by LatecomerX

  • Moderator
    is juggling between poly life, work and DotA.
    LatecomerX's Avatar
    1,870 posts since May '07
    • <?php

      $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
      mysql_select_db($dbname);
      $query = "SELECT name,type,MIN(totalprice) FROM transactions GROUP BY name,type";
      $result = mysql_query($query) or die(mysql_error());

      $data = '';
      while ($row = mysql_fetch_array($result) {
      $data .= 'Name: ' . $row['name'] . ', Type: ' . $row['type'] . " ";
      }

      $myFile = "testFile.txt";
      file_put_contents($myFile, $data, FILE_APPEND);

      ?>

  • Moderator
    is juggling between poly life, work and DotA.
    LatecomerX's Avatar
    1,870 posts since May '07
    • Originally posted by Trcyng:

      ok you see...

       

      SInce

       

      $myFile = "testFile.txt"; // is specific the file
      $fh = fopen($myFile, 'a') or die("can't open file"); //open
      $stringData = "New Stuff 1 "; //write in (This is I am trying to put data here from  database)
      fwrite($fh, $stringData);
      $stringData = "New Stuff 2 "; //write in (This is I am trying to put data here from  database)

      fwrite($fh, $stringData);
      fclose($fh);

      Just a question before we continue, are you developing on PHP 4 or PHP 5?

       

  • is juggling between poly life, work and DotA.
    LatecomerX's Avatar
    1,870 posts since May '07
  • Moderator
    is juggling between poly life, work and DotA.
    LatecomerX's Avatar
    1,870 posts since May '07
    • Originally posted by Trcyng:

      Is there any easier examples based on the codes below??

      <?php

      $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
      mysql_select_db($dbname);
       
       
      $query = "SELECT name,type,MIN(totalprice) FROM transactions GROUP BY name,type";
      $result = mysql_query($query) or die(mysql_error());

      $myFile = "testFile.txt"; //Specific Flie
      $fh = fopen($myFile, 'a') or die("can't open file"); //open file
      $stringData = "New Stuff 1 ";
      fwrite($fh, $stringData);

      $stringData = "THE SQL COMMAND CODES MAYBE $query ???"; // HELP NEEDED HERE
      fwrite($fh, $stringData);


      $stringData = "New Stuff 2 ";
      fwrite($fh, $stringData);


      fclose($fh);

      I can't tell what you are trying to achieve from your code. Why are you storing the SQL query string in the text file? And there's no function call to fetch the data from $result.

       

  • is juggling between poly life, work and DotA.
    LatecomerX's Avatar
    1,870 posts since May '07
    • Well, don't you think you're lucky that it only took you a D&T textbook to reveal the worm in that bad apple, when some others might have lent their friends thousands of dollars only to find them vanished into thin air on the following day?

       

  • is juggling between poly life, work and DotA.
    LatecomerX's Avatar
    1,870 posts since May '07
  • is juggling between poly life, work and DotA.
    LatecomerX's Avatar
    1,870 posts since May '07
    • "We are accepting a maximum of 500 completed surveys only, so click here to participate in this survey NOW!"

      "Premier membership is not immediate... I can only add PM after the survey is over and I get the list of emails that are completed. But don't worry - you will surely get it!"

      Need 500 members who are 30+ lau aunties wor. But maybe we do have that many aunties here. 

       

  • is juggling between poly life, work and DotA.
    LatecomerX's Avatar
    1,870 posts since May '07
  • Moderator
    is juggling between poly life, work and DotA.
    LatecomerX's Avatar
    1,870 posts since May '07
    • It would actually be "New Stuff1 New Stuff2 ". The text file would only contain one single line. And there's no WHERE clause in an INSERT statement. The code to write text into a file can be simpler with the file_put_contents() function if you happen to be using PHP 5 (see example below). If you want to query the database and save the output into a text file, it would be something like this:

      Database

      Table: some_table

      id - user - score
      1 - Dokuro - 12345
      2 - Zakuro - 2345
      3 - Sakura - 345

      Application

      <?php

      $db = new mysqli('localhost', 'database_username', 'database_password', 'name_of_database'); // establish a database connection

      $result = $db->query("SELECT user FROM some_table WHERE id = 1"); // query the database
      $row = $result->fetch_array(); // retrieves a row from the query result as an array
      $name = $row['user']; // get the value stored in the "user" column from the row retrieved

      for ($i = 1; $i <= 4; $i++) { // writes the name 4 times in the file
      file_put_contents('filename.text', $name . "\r\n", FILE_APPEND); // "\r\n" is used to "push" any following text onto the next line
      }

      ?>

      Resulting Text File (filename.text)

      Dokuro
      Dokuro
      Dokuro
      Dokuro

       

      Edited by LatecomerX 04 Jul `08, 10:38PM
  • Moderator
    is juggling between poly life, work and DotA.
    LatecomerX's Avatar
    1,870 posts since May '07
    • Originally posted by Evo4eva:

      ermm,i want to noe the code for reading in the first alphabet as a input only.
      eg: NAME   den take in N only....help me?...lol..

      Assuming you already know how to get input using the Scanner class, just chain the charAt() method after calling the next() method.

      http://forums.macrumors.com/showthread.php?t=148798#post_message_1729620

      More information about the charAt() method here.

      http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#charAt(int)

      Basically, what you are doing here is, when you call the next() method, it returns a String object which contains the input from the user (it's actually a token of the user input but we won't talk about it here). The charAt() method, coming from the String class, allows you to pick a character out of a String object. Say, for example, a user types in "sgForums" as input. If I want to retrieve the 3rd letter 'F', the offset of the letter would be 2 (skip 2 letters), thus I would call next().charAt(2) from a Scanner object.

      If you don't understand any part of my post, please don't hesitate to clarify with me.

       

  • is juggling between poly life, work and DotA.
    LatecomerX's Avatar
    1,870 posts since May '07
    • Please perform a Wuxi Fingerhold on your joystick. And flex your pinky after that.

       

  • is juggling between poly life, work and DotA.
    LatecomerX's Avatar
    1,870 posts since May '07
    • "Teacher, I need some sperm cell samples to study them under the microscope. Can you help me, please?" 

       

  • is juggling between poly life, work and DotA.
    LatecomerX's Avatar
    1,870 posts since May '07
    • Take it easy. The announcement is not even out and you're looking down on yourself already.

      Those who have a similar CCA during their secondary education would definitely gain an upper hand in getting into the competition. Who knows, maybe they have committed as much time as you do into their CCA while they were still secondary students. But as the Chinese always say, "学如逆水行舟,不进则退". If they actually don't bother to turn up for any more practice sessions, thumbs up for you - you're one big step closer to beating them this year, if not next year.

      Just ask yourself, are you really passionate about your CCA? Because no one would give up what they love just because of the obstacles they face in pursuit of their dreams. If, say, you've just joined a CCA about playing DotA. Then your team got pwned by another who has played it for 5 years and they were like gulping coke and munching pizzas while they cleared your team. You don't say "zzz. we too n00bs le. tio pwnzor by pr0s sia. i wan quit dota liao sio.", but look forward to the next match, hoping to defeat them with lots of training in between.

      I wish you all the best.

       

  • is juggling between poly life, work and DotA.
    LatecomerX's Avatar
    1,870 posts since May '07
    • Originally posted by ghast.:

      i suggest u tell her friends about it. maybe her friends can help to tell her abt it more conveniently. she probably wont lose her temper on her frens that easily

      I can tell you, if he does that, the next quarrel will start with "euu lather tok to my frens than me izit? euu dun rikes me anymore har?'" bla bla bla. I think it would be better for TS to approach her directly in a more discreet manner instead; simply remind her about her promise tactfully (eg. in a joking tone) every time she throws her tantrum.

       

  • is juggling between poly life, work and DotA.
    LatecomerX's Avatar
    1,870 posts since May '07
    • Originally posted by bus555:

      Anyway, guess the person who create the "girl" somehow must be like took 50 mins to complete it

      It depends on whether you are doing it manually, or by using a software like AscGen.

       

  • Moderator
    is juggling between poly life, work and DotA.
    LatecomerX's Avatar
    1,870 posts since May '07
    • The download speed you get on torrents very much depend on the number of users seeding (providing) the files you are downloading. Think of these seeders as water taps somewhere far far away from you and Singnet as a water pipe bringing water from the taps to your house. If the water taps can only output small amounts of water, having a bigger pipe wouldn't bring you more water no matter what.

      Try this torrent, seeded by 1200+ users as of now, which should be able to use up your entire downstream of 8mbps, assuming that there is no issue with the configuration you have for uTorrent and you did not cap your download.

      http://releases.ubuntu.com/8.04/ubuntu-8.04-desktop-i386.iso.torrent

       

  • Moderator
    is juggling between poly life, work and DotA.
    LatecomerX's Avatar
    1,870 posts since May '07
    • Originally posted by ndmmxiaomayi:

      http://cuteworm.com/

      Know anything about this?

      There was a conflict between the owner of Zion, a VPN in the form of an mIRC add-on script once popular among gamers, versus one of the main programmers of Zion otherwise known as CuteWorm (a Singaporean in fact).

      What CuteWorm did was that he exposed one of the vulnerabilities in Zion which allowed remote code execution and pointed out where the code can be located within the script. He has also advised visitors on his site to boycott Zion and use alternatives instead. Coincidentally, there was a new patch for Zion around the same time which seemed to have removed it, but on top of that, it modifies the hosts file on the system to point cuteworm.com to their own servers (ZincPlay.com, 66.212.25.134) so that no one using Zion will be able to access CuteWorm's site and find out that the existence of the vulnerability, on the pretext of protecting its users from TrojanH.CuteWorm (which probably didn't exist).

      I think they have resolved the issue among themselves already, I guess, seeing that there's once again a download link for Zion on CuteWorm's site (it was previously removed when the vulnerability was exposed).

      Long time short, speaking as an ex-user of Zion, Zion sucked, just like its owner.

       

      Edited by LatecomerX 03 Jul `08, 4:15AM
  • Moderator
    is juggling between poly life, work and DotA.
    LatecomerX's Avatar
    1,870 posts since May '07
    • Once again, change the encoding of the XML file to UTF-8.

      <?xml version="1.0" encoding="utf-8"?>

       

  • is juggling between poly life, work and DotA.
    LatecomerX's Avatar
    1,870 posts since May '07
    • Originally posted by weiyang999:

      i loves too...i like armpit too

      So fast come out of jail liao ah?

       

  • is juggling between poly life, work and DotA.
    LatecomerX's Avatar
    1,870 posts since May '07
    • I have recently read an interesting article which seems to apply in this case regarding school bullying and I would like share it here.

      Excerpts from Why Nerds Are Unpopular:

      "Nerds would find their unpopularity more bearable if it merely caused them to be ignored. Unfortunately, to be unpopular in school is to be actively persecuted.

      Why? Once again, anyone currently in school might think this a strange question to ask. How could things be any other way? But they could be. Adults don't normally persecute nerds. Why do teenage kids do it?

      Partly because teenagers are still half children, and many children are just intrinsically cruel. Some torture nerds for the same reason they pull the legs off spiders. Before you develop a conscience, torture is amusing.

      Another reason kids persecute nerds is to make themselves feel better. When you tread water, you lift yourself up by pushing water down. Likewise, in any social hierarchy, people unsure of their own position will try to emphasize it by maltreating those they think rank below. I've read that this is why poor whites in the United States are the group most hostile to blacks.

      But I think the main reason other kids persecute nerds is that it's part of the mechanism of popularity. Popularity is only partially about individual attractiveness. It's much more about alliances. To become more popular, you need to be constantly doing things that bring you close to other popular people, and nothing brings people closer than a common enemy.

      Like a politician who wants to distract voters from bad times at home, you can create an enemy if there isn't a real one. By singling out and persecuting a nerd, a group of kids from higher in the hierarchy create bonds between themselves. Attacking an outsider makes them all insiders. This is why the worst cases of bullying happen with groups. Ask any nerd: you get much worse treatment from a group of kids than from any individual bully, however sadistic.

      If it's any consolation to the nerds, it's nothing personal. The group of kids who band together to pick on you are doing the same thing, and for the same reason, as a bunch of guys who get together to go hunting. They don't actually hate you. They just need something to chase."

      ----------

      "Bullying was only part of the problem. Another problem, and possibly an even worse one, was that we never had anything real to work on. Humans like to work; in most of the world, your work is your identity. And all the work we did was pointless, or seemed so at the time.

      ...

      Teenage kids used to have a more active role in society. In pre-industrial times, they were all apprentices of one sort or another, whether in shops or on farms or even on warships. They weren't left to create their own societies. They were junior members of adult societies.

      ...

      What happened? We're up against a hard one here. The cause of this problem is the same as the cause of so many present ills: specialization. As jobs become more specialized, we have to train longer for them. Kids in pre-industrial times started working at about 14 at the latest; kids on farms, where most people lived, began far earlier. Now kids who go to college don't start working full-time till 21 or 22. With some degrees, like MDs and PhDs, you may not finish your training till 30."

       

      Edited by LatecomerX 02 Jul `08, 2:50AM
  • is juggling between poly life, work and DotA.
    LatecomerX's Avatar
    1,870 posts since May '07
    • Originally posted by Deino:

      everyone deserves to die...but at the same time they deserve to live too...

      everyone deserve their own judgement also...but that doesn't mean they have the right to execute their judgement...

       

      Me don't understand what you are trying to express. Mind elaborating?

       

  • is juggling between poly life, work and DotA.
    LatecomerX's Avatar
    1,870 posts since May '07
    • Originally posted by Daisuke-kun:

      intelligent people dun kill demselves.

      they plan up a counterattack on the bullies.

      i have to say something to this boy.

      You don't deserve to live if you can't handle this.

      You don't have the right to judge whether he deserves to live for

      i. you are not him
      ii. you are not in anyway related to him
      iii. you don't know how much stress he was under from all that bullying.

      A person, no matter how intelligent he is, will break down under immense pressure.

       

  • is juggling between poly life, work and DotA.
    LatecomerX's Avatar
    1,870 posts since May '07
    • Originally posted by fudgester:

      Self-fulfilling prophecy.

      You are becoming more and more short-tempered this month precisely because you believe in what your friend predicted.

      Chances are that you're not more or less short-tempered than before.... you simply perceive yourself as being more short-tempered because of what your friend said.

      So don't think so much about all this stuff.

      Yep, it may turn out to be a self-fulfilling prophecy if you believe what your friend said was true. An example would be that you decide to go overseas on a ship instead of a plane because of the prediction, and Mas Selamat happened to be on that ship. Just believe that it's just a random guess by your friend and put it at the back of your mind.

       

  • Moderator
    is juggling between poly life, work and DotA.
    LatecomerX's Avatar
    1,870 posts since May '07
    • Originally posted by XiaoWangZi:

      malware? what is that. Wad program should i use to scan?

      A good anti-virus program will do the job nicely.

       

  • Moderator
    is juggling between poly life, work and DotA.
    LatecomerX's Avatar
    1,870 posts since May '07