Monthly Archives: March 2004

Wonderful Wonderful email things

Here are a couple of email utilities to deal with annoying websites asking for an email address for no need at all:

First is Mailinator . There is no signup, no passwords. Just give out any [email protected] and then go and check the email on mailinator. No password. Basically your email address is your password! The emails will get deleted after "some" time. Amazing piece of work! However, the spammy websites get smart and start rejecting anyone registering with mailinator.com address. But mailinator gets smarter: there are many other "mirrors" for mailinator that you can use. fastacura.com, fastnissan.com, fasttoyota.com etc. Each of the domains forwards the email to mailinator.

Second is Jetable which can act as a limited-time email forwarder. You enter your real email address and enter time limit 1-8 days and it gives you a new address (something like [email protected]) which is valid (and forwards email to your real address for the specified time).

I kind of see the value in jetable.org, but who is to guarantee that jetable.org won't start spamming your real email address ? The issue with mailinator is that of privacy (which is countered by using obscure email address). e.g. md5(string). Another issue is about the mail getting deleted. People have stepped up to solve this problem as well! There is a utility to keep scanning mailinator and forward any received email to your real email address from your desktop. Look here!

PHP Database abstraction class…

php.justinvincent.com

ezSQL Database Class - A class that makes it ridiculously easy to use mySQL, Oracle8, Inerbase/Firebase, PostgreSQL, SQLite (PHP), SQLite (C++), MS-SQL database(s) within your PHP/C++ script. Includes lots of examples making it very easy to understand how to work with databases. ezSQL has excellent debug functions making it lightning-fast to see what�s going on in your SQL code. ezSQL can dramatically decrease development time and in most cases will streamline your code and make things run faster.

EZ Results Paging Class - EZ Results is a paging class that can be formatted in any way you choose. Have a read through the documentation to see just how unlimited it is. Once you start working with it you will be amazed at how quickly you can prototype pages. Supports mySQL & Oracle.

Translate Perl code to PHP!

arrays

hashes

data structures

array split/join

case conversion

string comparisons

functions

string matching operations

basename/dirname

environment variables

POST/GET parameters

HTML elements

URL encode

MySQL database access


� Perl arrays � Php arrays
@a = (); # empty
 
@a = ( 'xx', 11, 33.5, );
 
@a = 12..33;
 
$a[2] = 'something';
 
$len = scalar(@a);
# or
$len = @a;
 
@a3 = ('xx', @a1, @a2);
 
($x, $y) = @a;
 
push
pop
shift
unshift
splice
 
foreach $i (@a) { .. }
$a = array();  # empty
 
$a = array( 'xx', 11, 33.5, );
 
$a = range(12,33);
 
$a[2] = 'something';
 
$len = count($a);
 
 
 
$a3 = array_merge('xx', $a1, $a2);
 
list($x, $y) = @a;
 
array_push
array_pop
array_shift
array_unshift
array_splice
 
foreach ($a as $i) { .. }


� Perl hashes � Php hashes
%h = ();
 
%h = ( 'x' => 'y',
       'z' => 'w',
     );
 
$h{'x'} = 7;
 
while (($key,$value) = each(%h))
{ .. }
# %h is automatically "reset"
# for another iteration
 
$a = keys(%h);
$b = values(%h);
 
delete $h{'x'};
$h = array();
 
$h = array( 'x' => 'y',
            'z' => 'w',
          );
 
$h['x'] = 7;
 
while (list($key,$value) = each($h))
{ .. }
# must reset before reusing $h
reset($h);
 
$a = array_keys($h);
$b = array_values($h);
 
unset( $h['x'] );


� Perl data structures � Php data structures
%h = ('a'=>13, 'b'=>25);
@x = ('hi', 'there', 'all',);
 
@mix = ( \%h, \@x,
         [33..39],
	 { x=>15, yy=>23, },
       );
 
$mix[0]->{'b'}  # == 25
$mix[0]{'b'}    # == 25
$mix[1]->[2]    # == 35
$mix[1][2]      # == 35
$h = array('a'=>13, 'b'=>25);
$x = array('hi', 'there', 'all',);
 
$mix = array($h, $x,
	     range(33,39),
	     array('x'=>15, 'yy'=>23),
	    );
 
$mix[0]['b']  # == 25
 
$mix[1][2]    # == 35
 


� Perl array split/join � Php array split/join
@a = split( '\|', $s );
 
@a = split( '\s+', $s );
 
 
$s = join( '|', @a );
$a = preg_split( '/\|/', $s,
            -1, PREG_SPLIT_NO_EMPTY );
$a = preg_split( '/\s+/', $s,
            -1, PREG_SPLIT_NO_EMPTY );
 
$s = join( '|', $a );


� Perl case conversion

� Php case conversion

$s = lc($s);
$s = uc($s);
 
$s =~ tr/a-z/A-Z/;
$s = strtolower($s);
$s = strtoupper($s);
 
 


� Perl string comparisons � Php string comparisons
$s1 eq $s2
 
 
 
$s1 lt $s2
strcmp($s1,$s2) == 0
# or
$s1 === $s2
 
strcmp($s1,$s2) < 0


� Perl functions � Php functions
sub foo {
 my @args = @_;
}
 
sub foo {
 $x = 5;
}
 
 
 
 
 
foo2( \@a, \%h );
function foo() {
 $args = func_get_args();
}
 
function foo() {
 global $x;
 $x = 5;
}
 
function foo2($x, $y) {
}
 
foo2( $a, $h );


� Perl string matching operations � Php string matching operations
$s =~ m/(\w+)/;
$substr = $1;
 
@all = m/(\w+)/g;
 
 
$s =~ s/\s+/X/;
$s =~ s/\s+/X/g;
 
$s =~ s/^\s+|\s+$//g;
preg_match( "/(\w+)/", $s, $match );
$substr = $match[1];
 
preg_match_all( "/(\w+)/", $s, $match );
$all = $match[0];
 
$s = preg_replace( "/\s+/", 'X', $s, 1 );
$s = preg_replace( "/\s+/", 'X', $s );
 
$s = rtrim($s);


� Perl basename/dirname

� Php basename/dirname
use File::Basename;
 
$b = basename($path);
$d = dirname($path);

 
 
$b = basename($path);
$d = dirname($path);


� Perl environment variables

� Php environment variables
%ENV
 
$ENV{REQUEST_METHOD}
 
$ARGV[$i]
 
$0

$_SERVER
 
$_SERVER[REQUEST_METHOD]
 
$argv[$i+1]
 
$argv[0]  # Php/CGI only


� Perl POST/GET parameters � Php POST/GET parameters
#form/hyperlink parameters:
# s : single-valued
# m : multi-valued
 
use CGI (:standard);
 
 
 
 
 
$s = param('s');
@m = param('m');
 
@param_names = param();
#form/hyperlink parameters:
# s   : single-valued
# m[] : multi-valued
#       (such as multi-selections
#        and checkbox groups)
 
$PARAM = array_merge(
   $HTTP_GET_VARS, $HTTP_POST_VARS
  );
 
$s = $PARAM[s];  # a scalar
$m = $PARAM[m];  # an array
 
$param_names = array_keys($PARAM);
 


� Perl HTML elements

� Php HTML elements

use CGI (:standard);
 
 
 
 
 
 
 
$ref = "x.cgi";
a({href=>$ref}, "yy")
 
textfield({name=>"yy", size=>5})
 
password({name=>"yy", size=>5})
 
textarea({name=>"yy",
	  cols=>5, rows=>2})
 
submit({value=>"yy"})
 
button( {name=>"xx",
	 value=>"yy",
         onclick=>"submit()",
        }
      )
 
%labels = (0=>'a',1=>'q',2=>'x');
popup_menu( { name=>"xx",
              values=>[0..2],
              labels=>\%labels,
              size=>4,
	    }
          )
 
 
@a = ('xx','yy','zz');
radio_group( { name=>'nn',
               values=> \@a,
               default=>'_',
               linebreak=>1,
	     }
           )
 
%labels = ('xx'=>'L1','yy'=>'L2');
@a = keys( %labels );
checkbox_group( { name=>'nn',
                  values=> \@a,
		  labels=> \%labels,
	        }
              )
 
table(
       Tr(
           [
	     td(['a','b']),
             td(['x','y']),
	   ]
         )
     )

# The Perl/CGI functions have the
# additional property of "stability"
# when used in reentrant forms.
# The values of the HTML elements are
# set according to the incoming
# parameter values for those elements.
# The versions below are not stable.
 
$ref = "x.php";
<a href="<?php echo $ref?>">yy</a>
 
<input type=text name=yy size=5>
 
<input type=password name=yy size=5>
 
<textarea name=yy cols=5 rows=2>

</textarea>
 
<input type=submit value=yy>
 
<input type=button
  name=xx value=yy
  onclick="submit()">
 
 
 
<select name=xx size=4>
<?php
$labels = array(0=>'a',1=>'q',2=>'x');
foreach (range(0,2) as $_)
  echo "<option value='$_'>",
       $labels[$_];
?>

</select>
 
$a = array('xx','yy','zz');
foreach ($a as $_)
  echo "<input type=radio
         name=nn value='$_'>$_<br>";
 
 
 
 
$labels = array('xx'=>'L1','yy'=>'L2');
foreach (array_keys($labels) as $_)
  echo "<input type=checkbox
         name=nn value='$_'>",
         $labels[$_];
 
 
 
<table>
<tr>
<td>a</td><td>b</td>

</tr>
<tr>
<td>x</td><td>y</td>
</tr>
</table>


� Perl URL encode

� Php URL encode

use URI::Escape;
 
uri_escape($val)
uri_unescape($val)
 
 
urlencode($val)
urldecode($val)


� Perl MySQL database access

� Php MySQL database access

use DBI;
$dbh = DBI->connect(
  'DBI:mysql:test:host',$usr,$pwd
);
 
 
$dbh->do( $sql_op )
 
$query = $dbh->prepare( $sql_op );
$query->execute();
 
while(@record = $query->fetchrow())
{ .. }
 
 
 
$dbh->quote($val);
 
 
 
$dbh = mysql_connect(
  'host', $usr, $pwd
);
mysql_select_db('test', $dbh)
 
mysql_query( $sql_op );
 
$results = mysql_query( $sql_op );
 
 
while($record =
        mysql_fetch_row($results))
{ .. }
 
 
mysql_quote($val)
#--------------------------- using:
function mysql_quote( $val )
{
  return
    "'" .
    preg_replace( "/'/", "'",
      preg_replace( '/\/', '',
		    $val
                  )
                )
    . "'";
}
 

Dnyaneshwari – English transliteration and translation!

Dnyaneshwari - Bhaavarth Diipikaa: a commentary on the Bhagavad Gita

English translation of philosophical part of Dnyneshwari (1290 AD). Dnyaneshwari is a commentary on Gita, written 700 years ago by Saint Dnyneshwar (Jnanesvara or Gnanadeva) (1274-1297). It brings Vedanta and other spiritual philosophies to common man. It explains the various paths a person can take for spiritual progress and ultimate liberation.

Apart from mythical stories, not much is known about the life of Dnyaneshwar and his brothers. Judging purely by their writings, they lead a hard life. In 1296 AD, Dnyaneshwara, aged 25, walked into a stone-walled room in Alandi near Pune. He had it closed and passed away in samadhi (a state of spiritual liberation). The room has not been opened since then and Alandi has been a revered place. None of his siblings were to enjoy a long worldly life either and passed away within months of Dnyaneshwar's samadhi.

Budding Entrepreneurship

Ross Mayfield's Weblog: Budding Entrepreneurship

Excerpt:

If you were about to graduate from college and had an interest in becoming an entrepreneur, what would you do?

That's the gist of an I received in an email from Taylor Brooks, an entrepreneurship major pondering the big questions and asking for advice. With permission, I am answering this openly and hopefully drawing in better experts than myself.

Change your major. I am kidding, but seriously, the best undergraduate studies can give you are critical thinking and communication skills. Entrepreneurship can give you exposure to concepts of risk so you might take the right ones. But surveying different disciplines from politics to art to science gives you different ways to look at the world, helps you understand different people and makes life more enjoyable. Innovations and business opportunities happen where disciplines collide.

Start a business. Lots of people will give you advice to just get out there and start doing it. The smallest of ventures will teach you big things.

Connect with the Net. Your business doesn't have to be in Tech, in fact, most things are not. But dorm room ventures that leverage the Net can produce, market and distribute with a minimal investment. You don't have to be Michael Dell to do this. Even a simple service with a web front-end can get you going. And in absence of code, elbow grease will get you a long way.

Take responsibility beyond your years. I have never had a job I have been qualified for. Strive to put yourself in difficult situations. Go work with a non-profit, where they treat and trust interns as full-time employees out of necessity.

Go abroad. Not only is the world a very big place and has much to teach us, but expatriates are given greater responsibility because who you are is of greater difference. Go teach and practice entrepreneurship in a developing country.

Experiment at the margin. This is what Al Osborne at Anderson, my professor of entrepreneurship, says entrepreneurs do. Start with what you know and can do, then extend it a little bit. Right now you at least know the market of students and their parent's money. Tweak the idea, implement, take stock and tweak again. Iterate.

Have fun with failure. Make mistakes and make them often. Make them early, because the only consequence decisions have early in life is what you learn from them. Persist.

Take time for strategy. When you are in the midst of blocking and tackling, its hard to step back and gain perspective. Understanding trends and focusing your mission can not only save you time, but even save your business.

Pay yourself. Its so easy to forget to pay yourself when you are driven by passion, but don't forget that is why you are working.

Service the desire. When I was a kid I bought a book, "how to make money with your Apple II+," written by some other kid. None of the business ideas made sense to me. Except publishing that book.

Do different. No matter what you do, do your own thing. Differentiation is perhaps the most important attribute of a successful venture. Not just for standing out in a crowded marketplace, but doing the little things inside the company in a way that is better than your competition. And if you can't invent a great positioning or process, you can always excel at personal service.

Work with good people. Life is too short for anything else, and good people do good things.

Stick to ethics. Money isn't worth getting into trouble or ill repute. And you will soon find out how small the world really is and how it iterates upon you.

Be a businessperson. In his last years, my grandfather told me: the difference between an entrepreneur and a businessman is that while an entreprenuer is in it for the fast buck, a businessman makes a lasting contribution to his community. Times and terminology have changed, but the difference between a social entrepreneur and a self-interested entrepreneur has not.

Start a weblog. Had to say it, see below, follow the links, you get the idea. Have a learning journey with other people. I would recommend a bunch of books, but get to them in context.

Now by some measures, I'm not an expert, just a guy passing on a few learnings of my own. I'm hoping that some of the Entrepreneurs and VCs in blogspace can chip in their own.

February 29, 2004 | Permalink
TrackBack

TrackBack URL for this entry:
http://www.typepad.com/t/trackback/504935

Listed below are links to weblogs that reference Budding Entrepreneurship:

� Interesting tips from one entreprenuer to another from Erik Benson's Morale-O-Meter
http://ross.typepad.com/blog/2004/02/budding_entrepr.html... [Read More]

Tracked on March 1, 2004 12:24 AM

� Open Letter about Doing It Yourself from seanbonner
Go read this letter that Ross Mayfield just posted in response to being asked about graduating from college and becoming... [Read More]

Tracked on March 1, 2004 09:21 AM

� Open Letter about Doing It Yourself from seanbonner
Go read this letter that Ross Mayfield just posted in response to being asked about graduating from college and becoming... [Read More]

Tracked on March 1, 2004 09:23 AM

� great tips for budding entrepreneurs from anil dash's daily links
http://ross.typepad.com/blog/2004/02/budding_entrepr.html... [Read More]

Tracked on March 1, 2004 10:50 AM
Comments

Great advice to *all* undergraduates. It seems that there are few jobs out there (at least interesting ones) that don't require a degree of entrepreneurship, if not a degree *in* entrepreneurship. I've just printed it out and hung it on my door in the hopes that someone will read it and be inspired!

Posted by: Alex Halavais at March 1, 2004 05:45 AM

Students and new grads have a bit more flexibility on the "pay yourself" clause than 40-year-olds with kids and a mortgage. This offers the opportunity to do more with less money...

http://webseitz.fluxent.com/wiki/z2004-03-01-MayfieldEntrepreneurAdvice

Posted by: Bill Seitz at March 1, 2004 08:59 AM

Great letter! It's funny because I dropped out of college to start my own company and when faced with the decision to either go to grad school or start her own company, my wife opted for giving it a shot rather than more schooling. Years later that was obviously the best choice, you learn things no one could ever teach you.

Posted by: sean bonner at March 1, 2004 09:23 AM

i'm nowhere near being an undergraduate anymore, but i find the advice helpful, or at least affirming.

Posted by: denise at March 1, 2004 12:22 PM