Monday, March 29, 2010

Ranting about Software Piracy

Dear Blog,

I just read an article called Software Piracy - It's Not Right, but How Do We Fix It?

The answer is punishment against those that do it. He says that 75% of people will stop right away (stop dead). LOL! Are you serious? There have been attacks already, so it's been done! Piracy lives, punishment fails. Remember Napster? Remember KaZaa? See PirateBay? Piracy is like a weed, you clip it, it only grows back nastier and heavier than ever.

Sorry, but if I was 100% against piracy, punishment is too uncreative of a solution. Creative solutions could be the game developers themselves distributing "fake" versions of the game on Pirate Bay or something that will delete your save games at a certain date. Haha! Some hackers would be pissed! Maybe have a renaming function in the game for those implementing constant online protection. Like the main character could be renamed IHeartPinkPonies and the end boss could be PinkPony, or something ridiculous like that.

Anyway, what I'm trying to say, punishment will scatter the pirates, but pissing them off will bring them out. But not only that, it may burn them out as they get frustrated with accidently downloading "junk".

As of right now... it's too easy. Jump on a torrent site, start up the program to see if it works, and bam! You got new software! The comments on these torrent trackers help too! They have people saying, "yup, it works" or "don't download this, it's junk".

If you want to hurt piracy, think outside the box and be creative. I think it'll take a pirate to hurt the pirates. But either way, piracy will live.

Last thought: If people would spend half their energy on doing something (creative) about piracy that they use complaining about piracy, I think the whole industry would be somewhere else right now.

- ETdoFresh

Tuesday, March 23, 2010

New Life

Dear Blog,

Did you know that life can be bought for only a few bucks? What!? Alright, well, if you are looking for a cool activity to do with a loved one (spouse, child, girlfriend, whatever), why don't you create some new life?

Colleen and I were at the grocery store, and I decided I needed some mint. I could buy 10 - 15 leaves for 2.99 or I could buy a plant for 2.99. I went with the latter (and got two!). Well this was great! Colleen also bought a upside-down strawberry garden that starts from seeds.

Anyway, then it started getting serious. We cleaned out this huge weed pile we had by the A/C unit, and placed pine needles there and planted flowers. So cheap (like $0.89 for each plant). I also trimmed the fig tree, because it was getting a little to estate hungry (took up way too much room).

Then we bought seeds. We bought a little DIY mini green house, and seeds for all around $10 - $15. I think just growing mint and herbs pays for itself, but with patience, I'm going to try and grow many different things from seeds. I printed cool little graphics and taped it to the edge of the green house (plastic box) so I can tell what's what!

Hopefully we can make beautiful flowers, herbs, and vegetables grow in our backyard. But it's a cheap hobby (if you choose it to be) and you make life in your very own backyard (or your patio pot). I guess I gotta be prepared to take care of them once they start sprouting, until they are strong enough to survive on their own.

- ETdoFresh

Tuesday, March 9, 2010

D.E.A.L.

Dear Blog,

Four Hour Workweek was an interesting read. I have some friends that say it was an OK book, and other's say it was complete bologna (in nice terms). Anway, I gave it a read, and it was a good self-help book to get ya motivated.

DEAL is the acronym the majority of the chapters seem to go through. Define what you want (cost, style, quantity, etc.). Eliminate all the excess activities that don't get you results. The author mentioned Pareto's Principle where 80% of what you are doing is only giving you 20% your output, and vice versa, 20% of what you are doing is giving you 80% of your output. Automate your tasks so you don't have to be part of the machine you call your job. The author challenges everyone to hire a person in India or wherever most economical to gain experience not only automating some mundane tasks, but to gain experience "bossing" someone else around. Liberate your life! Find out what to do with the free time you have. Travel, Vagabond, etc.

Good stuff, but I don't think I'll be able to follow in his footsteps exactly. I like to work, and not really sure if I can define what I want exactly or eliminate all the things I think bring me happiness just yet. Once I get fed up with my career again, I may give this a shot.

- E.T.

Monday, March 1, 2010

How to make a Simple XML Socket Server with PHP and Windows 7 / Vista

Dear Blog,

Today we are going to discuss how make a simple XML socket server using PHP (as a command line server) and Flash as the client. I assume that PHP has been installed with the "sockets plug-in".

First let's associate a new type of file to Windows, called PHS, or PHP Script. (I borrowed the following from this site) Open up a command prompt window and...

ASSOC .phs=PHPScript
FTYPE PHPScript=[path to]\php.exe -f "%1" -- %*
set PATHEXT=.phs;%PATHEXT%

Now evertime you click on a phs file, it should open up in PHP CLI (Command Line Interface).

After that, we simply create a PHS like the following that will run as your server (borrowed from here and tweaked to work here)...

<?php 
echo "Starting XML Socket Server\n";

// Set time limit to indefinite execution 
set_time_limit (0); 

// Set the ip and port we will listen on 
$address = 'localhost'; 
$port = 9001; 
$max_clients = 10; 

// Array that will hold client information 
$client = array(); 

// Create a TCP Stream socket 
$sock = socket_create(AF_INET, SOCK_STREAM, 0); 
// Bind the socket to an address/port 
socket_bind($sock, $address, $port) or die('Could not bind to address'); 
// Start listening for connections 
socket_listen($sock); 

// Loop continuously 
while (true) { 
    // Setup clients listen socket for reading 
    $read[0] = $sock; 
    for ($i = 0; $i < $max_clients; $i++) 
    { 
        if (isset($client[$i]) && $client[$i]['sock'] != NULL) {
            $read[$i + 1] = $client[$i]['sock'] ; 
  }
    } 
    // Set up a blocking call to socket_select()
 $temp = array();
    $ready = socket_select($read,$temp,$temp,NULL); 
    /* if a new connection is being made add it to the client array */ 
    if (in_array($sock, $read)) { 
        for ($i = 0; $i < $max_clients; $i++) { 
   if (!isset($client[$i])) { 
                $client[$i]['sock'] = socket_accept($sock); 
                break; 
            } 
            elseif ($i == $max_clients - 1) {
                print ("too many clients") ;
   }
        }
        if (--$ready <= 0) {
            continue; 
  }
    } // end if in_array 
     
    // If a client is trying to write - handle it now 
    for ($i = 0; $i < $max_clients; $i++) { // for each client
  if (isset($client[$i])) {
         if (in_array($client[$i]['sock'] , $read)) { 
             $input = socket_read($client[$i]['sock'] , 1024); 
             if ($input == NULL) { 
                 // Zero length string meaning disconnected 
                 unset($client[$i]); 
             } 
             $n = trim($input); 
             if ($input == 'exit') { 
                 // requested disconnect 
                 socket_close($client[$i]['sock']); 
             } elseif ($input) { 
     echo "Client $i sends:\n$input\n\n"; 
                 // strip white spaces and write back to user 
                 $output = ereg_replace("[ \t\n\r]","",$input).chr(0); 
                 socket_write($client[$i]['sock'],$output); 
             } 
         } else { 
             // Close the socket 
             socket_close($client[$i]['sock']); 
             unset($client[$i]); 
         }
  }
    } 
} // end while 
// Close the master sockets 
socket_close($sock); 
?>

Double click that file, and you should have an XML Socket Server that repeats whatever you send it.

Now open up flash, and have it connect and send something to the server. If everything works, you should see the response in the trace portion of your flash window. Done! (I included the Flash file I made here).

Hope this helps someone in cyber-world!

- ETdoFresh