Tech Experiment


Apple iPhone SDK Out in the Wild!

This has been long awaited my many hardcore iPhone fans as well as companies looking to get a jump start on this new market. Along with the software update, Apple also announced that venture capital firm Kleiner Perkins has created a $100 million “iFund” to fund software development on both the iPhone and iPod Touch.

Developers will be provided pretty loose restrictions on what will be aloud to be used, so expect too see some really kick ass apps coming out soon. Apple has said it will keep 30 percent of the revenue from applications sold through Apple Store, but will not charge developers credit card, hosting or marking fees. The developers themselves get to set prices for applications. Apple’s developer program costs $99 to join.

A quote from http://blogs.zdnet.com/Apple/?p=1388…a little fluff from Apple never hurts right?

“Today, we’re witnessing history: that’s the launching of the SDK, the creation of the third great platform, the iPhone and the iPod Touch. Think about it. What the iPhone is all about is in your pocket, you have something that’s broadband, and connected all the time. It’s persona, it knows who you are and where you are. That’s a big deal, a really big deal. It’s bigger than the personal computer.”

“So, [iFund] is about this great opportunity. But more than the money, it’s really about the people, the entrepreneurs, it’s about the great team at Apple, and most of all it’s about the great talent that we can recruit together and go build these amazing companies.”

The SDK can be found here http://developer.apple.com/iphone/program/. Though I wouldn’t get to excited, because as some of my co-workers found out this morning, it will take a bit of time to download. The SDK is over a 2GB in size (ouch right! Take that Facebook and Google).

Posted in Apple, Personal by Jay on the March 8th, 2008

Building URL (HTTP GET) Query Dynamically

Probably one of the most tedious parts of web development is hand coding a URL with several parameters attached to it. Most beginning developers are use to hand coding URL’s when developing dynamic web apps, much like this.



http_build_query() function. (You could easily build a similar function yourself if needed).




Posted in PHP by Jay on the April 29th, 2007 

HTTP POST without cURL library - PHP

Found this interesting function that can handle a HTTP POST without using redirects or any special hacks. This is extremely useful for sending data over a secure HTTPS POST or to another web site. cURL is probably the better choice here, but if you don’t have the library avaliable, (like many developers because of strict hosting solutions), this function might be your best bet.

Anyway on to the code. I found this awesome code snippet at: http://netevil.org/node.php?nid=937

I encourage you to check out some other parts of this guys site, pretty good stuff.


 array(
                  ‘method’ => ‘POST’,
                  ‘content’ => $data
               ));
     if ($optional_headers !== null) {
        $params['http']['header'] = $optional_headers;
     }
     $ctx = stream_context_create($params);
     $fp = @fopen($url, ‘rb’, false, $ctx);
     if (!$fp) {
        throw new Exception(”Problem with $url, $php_errormsg”);
     }
     $response = @stream_get_contents($fp);
     if ($response === false) {
        throw new Exception(”Problem reading data from $url, $php_errormsg”);
     }
     return $response;
  } 

?>

Posted in PHP by Jay on the April 29th, 2007

Microsoft Windows Vista to harm iPod Sales?

Documentation updates on Apple’s web site indicates that Apple is urging iPod owners to stay clear of using their iPod on Windows Vista because it could possibly harm the iPod (corruption of hard drive and files on device).

So the question is, will this actually harm Apple’s iPod sales? Doubtful, since Apple will evently provide an update to the iTunes software and really most customers will not even notice the issue. It does question whether Microsoft has been withholding competitors ability to update software packages for Vista or is Apple just trying to make Microsoft look bad. Either way, I predict that this will be merly be overlooked by the major of customers.

As for iTunes not being updated, it is also interesting to note that Microsoft’s own Zune software package (which is a rival music player) did not work with Windows Vista until only recently. Sounds like Microsoft is having some real internal communications problems.

Posted in Apple, Apple iPod, Apple iTunes, Microsoft, Windows Vista by Jay on the February 3rd, 2007

Google Updates Page Rank (It’s been a while)

So I checked out Runman’s blog today and he made a post about Google Page Rank being Updated. The first thing I did was quick check all my sites to see if my page rank was increased.

Now let me say that I haven’t really been trying to build any rankings on any particular site, but I feel that a few probably should automatically out rank this site because of the following:

1) This site is not even 6 months old

2) I have hardly any back links or even content

3) I have almost 0 traffic going to this site

While checking my rankings I noticed that this site actually got a 1/10 page rank (nothing to be proud of). The odd thing is that another site I own has some high quality back links, is over a year old, and has more content, but it didn’t even go up (actually still at 0/10). Weird right. So does Google weigh blogs better then normal sites since I have been linked to sites like Technorati?

I think I will do some more experimenting :).

Posted in Google, Page Rank, Personal, SEO by Jay on the January 12th, 2007

A Note on Python & Programming Guidlelines

Today I had to go through the mundane task of fixing other programmers code. Not that I’m a better programmer, but nothing is worse then going through unorganized, undocumented, and messy code.

My biggest hint to any new programmer is to be as organized as possible. Organization does take time. Each programmer really does evolve with experience, but most newbies just don’t take the extra time to be organized. Believe me, when I look at code I made two or three years ago, I really kick myself for being stupid and lazy. I end up rewriting programs or spending extra time figuring out algorithms (The old algorithms are usually inefficient to boot!).

The other reason I’m writing this article (kinda relative to the above comments) is because I have been meaning to share the following document that I found for python coding guidelines. Most of the points made in this document can be applied to any scripting language. It’s not that long, but I would recommend at least skimming it.

http://jaynes.colorado.edu/PythonGuidelines.html

If this document does not help, I would recommend looking at other highly experienced programmers code to see how they keep organized. Take a look at a few open source projects, I guarantee it will help.

Posted in Open Source, PHP, Programming, Python by Jay on the December 20th, 2006

FC5 Boot GDM - init levels

Red Hat & Fedora versions all have different run levels. These run levels determine different operational and security states of the Linux/Unix system.

The use of the ‘init’ command under the root user will allow you to change the level. For example.

If the current level is at 3 and you want to be at 5 do the following:

su root
init 5

The following table explains all the run levels for Red Hat/Fedora Distributions.

Run Level Description
0 Halt
1 Single user mode
2 Multiuser, without NFS
3 Full multiuser mode
4 unused
5 x11
6 reboot

GDM, the GUI startup interface for most linux distributions, needs to use the 5th run level to operate at startup. Some times the run level is at 3 for some linux distros and it needs to be changed to 5. To change the run level at startup, do the following:

Open the following file under the root account:

/etc/inittab

and there should be a line like

id:3:initdefault:

Change the 3 to a 5, and you should be fine.

(Note: if you do a text install of Fedora, it will automatically set the run level to 3. Once you follow the above instructions, GDM will start up automatically as it should.)

Posted in Fedora, Linux, Red Hat by Jay on the December 3rd, 2006

“The War Is Over, and Linux Has Won” - REALLY?

I refreshed Slashdot tonight to find this headline on the first page. The headline comes from the article found below.

http://blogs.zdnet.com/open-source/?p=837

Have I been under a rock for the last few years? I didn’t notice Linux over throwing the server or desktop market. Is there some other “war” that Linux has won? The article above states that Linux has victoriously won the “war” with Microsoft and other competitors, but I just don’t see how. I’m a huge fan of Linux/open source products and I proudly run Linux on 75% of my computers (Can’t get away from Windows because of some applications.).

It’s funny how this article leads everyone to believe Linux has won. Then it kind of slides into saying that it is expected to win. Well, winning and expecting to win are two different things. Anything could happen in the next year or so and with Microsoft’s new product lineups, I don’t see any large changes in trends.

I do expect to see small migrations to Linux, but corporate America is still afraid of Linux. Why do I say that? The average IT guy is not, but those same IT guys are not the ones making the ultimate decisions and paying the bill. Executives are choosing Microsoft, not because it’s the best product and can’t be beaten, but because it’s a reputable company. An executive knows that Microsoft will be around for a while and it’s a secure choice.

Servers are a great start to getting Linux into the mainstream, but it’s not the answer. I hope that Linux doesn’t get pigeon holed for being a great server OS and being known as just that.

So what do I feel Linux needs to do to win the desktop war? One answer will not solve this problem. I feel we need to reflect on the past and try to learn from it. Microsoft won the OS war in the first place because they provided people with a cheap OS that was easy to use. Most importantly, they provided useful applications such as Microsoft Office.

Below are some ways Linux can win the desktop war:

1) Microsoft Office needs to be on Linux.

Before you get upset and start screaming, let me explain. I know there is Open Office, Star Office, Abiword, ect. They are great pieces of software, but I’m sorry they are just not as good as Microsoft Office. Now I know what your going to say. Microsoft Office is the devil, it’s an inferior piece of software, and it crashes all the time. Please, step back and take a look at the big picture. Microsoft Office gets the job done for corporate America.

2) Corporate America and schools need to use Linux on the desktop first.

Make people use it at school and work; then will want to use it at home (well not everyone)

3) Better gaming support.

There are hardly any games for Linux, so why would the average Joe want to invest into an OS that won’t allow them to play their favorite games.

4) Better hardware support for everything, especially new technologies.
5) More easily accessible applications.

I know there are a million open source applications to do almost anything, but the average Joe does know that. Go ask your neighbor what Source Forge or Freshmeat is.

Once I start to see Linux applications at Best Buy, then I’ll feel that Linux is starting to win the OS war. The average Joe does not want to spend three hours finding a program and then another ten trying to compile it. People denounce RPM’s, but this is probably one of the smartest ideas and best directions for Linux. YUM is my personal favorite, but you still have to know the name of the applications you want to install. Getting Linux apps can be a real pain in the ass, end of story.

6) Better support, less “figure it out yourself n00b!!”( no wonder why people don’t want to use Linux)

I know making eye candying is a big thing right now, but everyone needs to remember that is not the reason why people will stay with Linux. People use computers to do work, play games, socialize, and use the Internet. The open source community needs to focus on more useful applications, usability, and speed. Without these three ingredients, Linux is useless to companies and the average person. Linux has not won the “war” and probably won’t for a while.

P.S. Sorry if my spelling and grammer are off tonite. Writing this article when I’m a little sick.

Posted in Linux, Microsoft, Open Source by Jay on the November 11th, 2006

PHP Fatal error: Class ‘DomDocument’

The following error occurs when trying DomDocument Object in PHP for XML operations: PHP Fatal error: Class ‘DomDocument’

Solution:

PHP.net Documentation

Introduction
The DOM extension is the replacement for the DOM XML extension from PHP 4. The extension still contains many old functions, but they should no longer be used. In particular, functions that are not object-oriented should be avoided. The extension allows you to operate on an XML document with the DOM API.

Installation
There is no installation needed to use these functions; they are part of the PHP core.

Since the Installation section of the PHP site describes this module as already installed as part of the PHP core, one would think no other work would be required. But if you install a fresh copy of PHP/Apache and then try to run a script with these function calls, you will get several errors.

Basically many will tell you that you need to recompile php with the option to enable Dom Functions, but this is untrue. The following is all you should have to do in FC4:

Open the linux command line interface and type the following commands:

su root
yum install php-xml

Allow the installation to happen through YUM, restart Apache service (service httpd restart) and all should be well.

Posted in PHP by Jay on the November 9th, 2006

Reading and Writing CSV Files with Python

Reading CSV files can be a real pain, especially when the file is badly formatted. Accounting for badly formatted files can be difficult and can cause a lot of headaches.

Python has a very useful library to help with parsing and writing CSV files. The library is not totally full proof, but it does account for almost ever possible problem, plus it correctly writes CSV files.

The following is an example of how to read a CSV file:

import csv

reader = csv.reader(open("test.csv"), delimiter=",")

for column1, column2, column3 in reader:
    print column1, column2

The next example shows how to write a CSV file from an array variable:

import csv
import sys

data = [
    ("And Now For Something Completely Different", 1971, "Ian MacNaughton"),
    ("Monty Python And The Holy Grail", 1975, "Terry Gilliam, Terry Jones"),
    ("Monty Python's Life Of Brian", 1979, "Terry Jones"),
    ("Monty Python Live At The Hollywood Bowl", 1982, "Terry Hughes"),
    ("Monty Python's The Meaning Of Life", 1983, "Terry Jones")
]

writer = csv.writer(open(”test.csv”), delimiter=”,”)

for item in data:
    writer.writerow(item)

OR

import csv
import sys

data = [
    ("And Now For Something Completely Different", 1971, "Ian MacNaughton"),
    ("Monty Python And The Holy Grail", 1975, "Terry Gilliam, Terry Jones"),
    ("Monty Python's Life Of Brian", 1979, "Terry Jones"),
    ("Monty Python Live At The Hollywood Bowl", 1982, "Terry Hughes"),
    ("Monty Python's The Meaning Of Life", 1983, "Terry Jones")
]

writer = csv.writer(open(”test.csv”), delimiter=”,”)
writer.writerows(data)

CSV Output:

And Now For Something Completely Different,1971,Ian MacNaughton
Monty Python And The Holy Grail,1975,"Terry Gilliam, Terry Jones"
Monty Python's Life Of Brian,1979,Terry Jones
Monty Python Live At The Hollywood Bowl,1982,Terry Hughes
Monty Python's The Meaning Of Life,1983,Terry Jones

More examples can be found on http://docs.python.org/dev/lib/csv-examples.html (Python Documentation Pages)

Posted in Python by Jay on the November 4th, 2006
Next Page »