Rudimentary Art of Programming & Development

Promoting Open Source, Always…

Archive for May 2008

Netscape Browser is dead

without comments

On March 1st, 2008, AOL stop all supports as well as security updates.

AOL recommends Firefox or Flock as migration options.

Netscape has officially passed away.

Resources:

Written by didip

May 29, 2008 at 7:17 am

Posted in web dev

Tagged with , , , ,

Languages Numeric Types

with one comment

C & C++ References:

C Trivia:

  • In C, long is both modifier and data type.
  • Long Long Int is not available in C++
  • <limits.h> header contains max & min information of numeric types.

C & C++ Numerical Types:

  • ShortInt — 2 bytes and 16 bits
  • Int — 2 bytes and 32 bits
  • Long Int — 2 bytes and 32 bits
  • Long Long Int (C only) — 4 bytes and 64 bits
  • Double — 64 bits

CPython Reference:

CPython Numerical Types:

  • Int ( use Long Int in C ) — 32 bits precision.
  • Float (use Double in C) — 64 bits precision.
  • Long — Unlimited precision.
  • Complex (use Double in C)

Java References:

Java Primitive Numerical Types:

  • Short — 2 bytes and 16 bits
  • Int — 2 bytes and 32 bits
  • Long — 8 bytes
  • Float — 4 bytes
  • Double — 8 bytes

Java Other Numerical Types:

  • BigInt
  • BigDecimal

PHP References:

PHP Trivia:

  • There’s no real concept of numeric data type in PHP (PHP 4.2 and newer supporters can argue me on this).
  • You don’t set date type on numeric variables, PHP determines data type for you.
  • 32 bit systems have a maximum signed integer range of -2147483648 to 2147483647.
  • The maximum signed integer value for 64 bit systems is 9223372036854775807.

PHP Numerical “Types”:

  • bool
  • integer
  • float

Perl References:

Perl Numerical Types:

  • Integer
  • Float
  • Decimal

Perl Trivia:

  • Decimal strings may have an exponential notation part, as in "12.34e-56".

Written by didip

May 23, 2008 at 11:03 pm

PHP Date Time

without comments

is more or less annoying. Before fanbois comment me to oblivion, let me explain why.

DateTime and DateTimeZone are objects. They can be created using new DateTime() and new DateTimeZone() calls.

Why is it not documented anywhere? Instead, the documentation points to global function calls.

The global function for new DateTime is date_create(), while global function for new DateTimeZone is timezone_open(). How intuitive.

Talk about intuitiveness. date() does not return DateTime object. It returns string, but of course, that’s how it always be.

Now let’s talk about timezone_open(…). If you pass an invalid parameter, it WILL return false, but, it will also throw:

Warning: timezone_open() [function.timezone_open]: Unknown or bad timezone

Damn, that behavior is reported here.

More about timezone, did you know that you can call setTimezone() on DateTime object? I found it out by lucky guess. Where’s that documented on php.net?

Finally, when calling dateObject->format(‘U’), I was expecting to get “Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)” –> pulled from php.net. But I didn’t get such results.

The seconds returned was not based on UTC timezone. It was based on the default php.ini, which was local timezone (PST).

So make sure before formatting to UTC, you call:

dateObject->setTimezone(new DateTimeZone(‘UTC’)) or

dateObject->setTimezone(timezone_open(‘UTC’)) or

don’t even bother creating object, just use: gmmktime()

Have fun with DateTime!

References:

Written by didip

May 11, 2008 at 9:52 pm

Posted in for dummies, php, tutorial

Tagged with , , ,

SWFObject: Embedding SWF using Javascript

without comments

SWFObject is a javascript open source project that generates SWF <embed> html tags.

Seems so trivial, why do I or readers need this?

Advantages of SWFObject:

  • It can generates embed tags dynamically.
  • It worries about multi-browsers support, so that you don’t have to.
  • There are multiple ways of embedding SWF, with SWFObject, you don’t have to worry about that.

Why you should use SWFObject (from its wiki page):

Resources:

Written by didip

May 11, 2008 at 8:56 pm

Microsoft did not buy Yahoo!

without comments

Written by didip

May 5, 2008 at 2:47 pm

Posted in Uncategorized

Tagged with ,

Actionscript: Associative vs List-like Array

without comments

Constructing Arrays

In Actionscript, Associative array is not defined using Array type. To construct associative array, one must use Object type.

e.g. var assocArray:Object = new Object();

Array type is strictly behaving like an ordered, numerically indexed, list.

e.g. var regArray:Array = ['a', 'b', 'c'];

Arrays Length

Array type has length property. This length property can be used in for loop.

e.g. for(var i:int = 0; i < array.length; i++) { … }

On the other hand, Object does not have length property. In order to loop through every property in an Object, one can use a different syntax of for loop.

e.g. for(var i:String in assocArray) { trace(assocArray[i]); }

References

Flex 3 Langref – Object

Flex 3 Langref – Array

Written by didip

May 1, 2008 at 1:29 pm