5 killer facts about the fortune 500


The fortune 500 is a really cool list to be in. It’s the super list of heavyweights of the American economy.

Being an entrepreneur, I always keep hearing about issues faced by startups and what you should do to make sure that you don’t go into the red. So today I thought about trying out a few of my number processing skills with the Fortune 500 list, and the results were really interesting!

Here are some of the interesting ones

1. 50 out of 498 which reported their profit/loss figures were in a loss. That’s about 10.04%

2. Among the profitable ones, the average profit margin was 8.00%

3. 122 out of 498 (one fourth – 24.5%) had a profit margins of less than 2%

4. The combined revenue of all 500 was 10,737,356.8 million USD. To put it in perspective, it’s about 8 times India’s GDP, a little over twice that of China’s, 3 quarters of that of the US, and 2000 times that of Rwanda!

5. Corning has the highest profit margin – 54%

Here’s the complete list, do let me know what do you think?

Subscribe | Tagged | 1 Comment

iOS Deployments over the web using PHP


Deployments over iOS are quite painful. When a developer sends you a release you can try on your phone, they send over two files – something.mobileprovision and youApp.ipa. The first file lists the devices on which your app will run and the second one is the actual binary. In iOS 4, the mobile provisioning is also included inside your .ipa file, but on the older OS it wasn’t the case. So with each release, you need to ensure that you send both the files.

Now, once you receive the files, you need to drag both of them to iTunes. If iTunes accepts them (which also depends on the version of iTunes you have installed), then you can connect your device and sync the new app so that it installs on your device.

Anyways, so this means that you need a machine everywhere to install the app. Also, you need to make sure that you sync with your own iTunes otherwise all the other apps that you have will get deleted!

Not only that, if you develop applications the way we do, you can expect a new release every 3-5 days. Coupled with the time difference of 12 hours with most of our clients, the time wastage increases manifold.

So, when Apple came out saying that they have wifi-deployment, we were really excited. Though as always turning the excitement into actual work and ensuring that you create a system to send releases to your clients takes a lot of time.

Last week, we finally managed to get the damn thing live for our clients!

This is why I thought I might go into some details about what is required to get such a system live. Here are the things that you need:

1. The concept of deployment on the web is simple. There are two files that need to be installed on the device to get your application to run. As explained above, one is the something.mobileprovision file and the other is the yourApp.ipa. Apple introduced the concept of another file called manifest.plist which will link both the files and if you click on a link to this manifest.plist, you get an option asking you if you would like to install this application. If you click yes, the app gets downloaded and installs itself.

2. Considering that iOS is just around the corner, we’ll forget about the older OS (by that I mean 3.x). Now, if we’re working with iOS 4.x (in case you aren’t, please save yourself the tyranny of supporting older devices and show this and this to your clients. Believe me, they will agree to skip OS3 if you show this.)

Okay, now that your clients have agreed to skype iOS 3, you can smile and start with the next steps.

3. Now, all you need to do, is give the developer an option to upload the .ipa file. The .ipa file contains the mobile provisioning file inside it, so you don’t need to ask them to upload anything else.

To upload the file, I used this really cool code – http://valums.com/ajax-upload/. It allows everything that you can hopefully want to upload. The steps to do it are simple, and are available on their website. Do let me know if you have any issues with it.

4. Okay, now you have a form to upload your file, and once your file reaches the server, the interesting part starts. Here is how I am handling the upload

5. Now that you have the values, you need to create manifest.plist, which will look something like this:

6. That is it!

I should point out here that the cool script which lets me read the binary plist data is by Rodney Rehm which can be found here – https://github.com/rodneyrehm/CFPropertyList

Thanks for sticking around till the end, and do let me know if you have any issues with creating your own.

Subscribe | Tagged , , , , , , , , | 3 Comments

The best comment ever on an iPhone app!

Colors has taken the tech world by storm. Partly because of the app and partly because of massive amount of funding that they received.

Everything about the app and the company is really impressive, but Adhip pointed out something even better – the first review on the Appstore by ghostmoth.

You find the company web site. It has no instructions. No “About us!” link. No tutorial, or feature lists, or forums, or support, or contacts, or FAQs. You can almost hear the developers laughing at you! “Silly user, sniffing around our website looking for information! We gather information, we don’t give it out!”

You conquered Myst. You understood the end of Lost. You can do this! You’re not going to let this new adventure game genre get the best of you! You will master this if it takes all weekend. You discover a button to create a group! You wonder what a group is. Progress, of sorts.

But at least you know it’s just a game, and not actually an app to share photos. And now you also know that you are alone. And you’re uncool. And not very clever. Because Color told you so.

You can read the rest here.

Do you think you’ve ever seen a better review?

Subscribe | Tagged , , | 3 Comments

Installing PHP Pear on Mac OSX 10.6 with PHP 5.3.3

Simplegeo is getting really hot these days and we have a couple of projects where we’re using it. It was Friday night and seemed like a good time to go and test some of the scripts that we had been building all week long, so I was just about to get started when I realized that Pear wasn’t installed on my Mac.

I did a quick look around and found a pretty useful link on ClickOnTyler. Though, I just got a strange error when I tried it out.

Sudhanshus-MacBook-Pro:~ sudhanshuraheja$ sudo php -q go-pear.php
Password:
PHP Deprecated: Assigning the return value of new by reference is deprecated in /Users/sudhanshuraheja/go-pear.php on line 733
Deprecated: Assigning the return value of new by reference is deprecated in /Users/sudhanshuraheja/go-pear.php on line 733
Sorry! Your PHP version is too new (5.3.3) for this go-pear.
Instead use http://pear.php.net/go-pear.phar for a more stable and current
version of go-pear, more suited to your PHP version.
Thank you for your coopertion and sorry for the inconvenience!

This is how I eventually got it to work


Sudhanshus-MacBook-Pro:~ sudhanshuraheja$ curl http://pear.php.net/go-pear.phar > go-pear.phar
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3591k 100 3591k 0 0 20771 0 0:02:57 0:02:57 --:--:-- 22439

Sudhanshus-MacBook-Pro:~ sudhanshuraheja$ sudo php -d detect_unicode=0 go-pear.phar

Below is a suggested file layout for your new PEAR installation. To
change individual locations, type the number in front of the
directory. Type 'all' to change all of them or simply press Enter to
accept these locations.

1. Installation base ($prefix) : /Users/sudhanshuraheja/pear
2. Temporary directory for processing : /tmp/pear/install
3. Temporary directory for downloads : /tmp/pear/install
4. Binaries directory : /Users/sudhanshuraheja/pear/bin
5. PHP code directory ($php_dir) : /Users/sudhanshuraheja/pear/share/pear
6. Documentation directory : /Users/sudhanshuraheja/pear/docs
7. Data directory : /Users/sudhanshuraheja/pear/data
8. User-modifiable configuration files directory : /Users/sudhanshuraheja/pear/cfg
9. Public Web Files directory : /Users/sudhanshuraheja/pear/www
10. Tests directory : /Users/sudhanshuraheja/pear/tests
11. Name of configuration file : /Users/sudhanshuraheja/.pearrc

1-11, 'all' or Enter to continue: 1
(Use $prefix as a shortcut for '/Users/sudhanshuraheja/pear', etc.)
Installation base ($prefix) [/Users/sudhanshuraheja/pear] : /usr/local/pear

So, it basically did everything on it’s own and in the end just asked me the following, to which I said Y
Would you like to alter php.ini ? [Y/n] : Y

Finally, a little test to see if things worked
Sudhanshus-MacBook-Pro:~ sudhanshuraheja$ /usr/local/pear/bin/pear

And yes, it worked!

Subscribe | Tagged , , , , | 6 Comments

Ecommerce in India

Just read a great post by Mahesh Murthy on Quora about how Ecommerce in India is already getting big.

For the last few years, whenever you hear about E-commerce in India, you hear the sad old issues about people dont’ have / don’t use credit cards and that people don’t buy stuff till they can touch and feel things AND ask you for a discount. What Mahesh says in that post is quite the opposite.

Here are some interesting points from the post about India :

- India has 105 million internet users and about 103 million TV sets on cable and satellite networks! I thought this was really important!

- IRCTC does over $1.2 billion every year I guess everybody knows this

- Dell and MetalJunction also probably do over $1 billion in online sales every year. Which is important because people are paying where they see value.

- Flipkart sells CDs and Books worth more than $2 million every month. This is important because Flipkart has atlesat 5 competitors and most of them are also selling a decent amount. The combined sum would be really huge, and we haven’t even talked about the travel segment

- The largest non travel E-commerce business in India is still Amazon.com. This is interesting because ordering from Amazon is a little silly here because it takes really long to get the books. People still buy stuff from there!

What does all of this mean? This means that if you had any plans to start a site with E-commerce and weren’t sure if India is a good market, you should leave whatever you were going to do today and get started with your site because you’re already a little late!

Source : What is required to make E-commerce in India a commonly used consumer transaction?

Subscribe | Tagged , , , , | Leave a comment

Creating New vs Repairing the Old

My car broke down again today morning and it resulted in another trip to the service station next door. The guys there are usually helpful, though they do charge a little more than I would like. The starter had some problem and it didn’t do what it was made to do – start the car. So they opened it up and within five minutes I was told that it was faulty and had to be replaced.

Now, service stations here love to replace any part which doesn’t work as expected. It’s easy to do, plus it makes money for the company, so the management doesn’t have issues. However, it’s not always the best approach. So I asked them to open it up and find out which part had a problem. It took slightly long, but they eventually managed to pin point what was wrong. (Though, I will need another post to tell you if it worked happily ever after or not)

I see the same problem regularly in development as well. If you outsource to one company and then later ask another company to work on the same code base, they will almost always say that you need to rebuild the whole thing to get it to work properly. Sometimes, I agree, that is the only way out. But more often than not, it is not. The only way to avoid it is to find out the factors involved and trying to find solutions based on that. In our case here, there are two forces in play

1. The billing for fixing something is a lot lesser than the billing for creating something again.
2. If it always more difficult to fix somebody else’s code than writing you own.

So if you need to save yourself from a situation where your software team tells you that something needs to be completely rewritten, you need to provide forces which act against these two.

For the first case, I believe it makes a lot more sense to offer extra billing for the hours that you put in for fixing than you do for regular development. The reason is that if you write something new, and it breaks, you are the one who is responsible. Nobody likes taking up responsibility, and hence it always makes more sense to be able to bill more and at the same time make fewer changes. On the contrary, if you push the company to do the bug fixing at rates lower than usual (which some people ask for, since it’s only Fixing!), you can be sure that they’re not going to do it too well.

For the second case, the reason why it’s more difficult to debug an unknown code is unfamiliarity. When you write something yourself, you know the gotchas and the hacks, even if there are no comments talking about those. So the chances of screwing things up are a lot lesser. If you try to do it with somebody else’s code, you would need to go through the whole system to find out who does what so that you don’t break some other piece of code with your changes. The only solution in this case, is to give the developer time to go over the complete system without fixing anything at first. With time, things start looking more simple.

All in all, it’s just about time and money. If you want to avoid a 15,000 dollar cost and a three month timeline, you should ensure that the parties who are going to work on the change, know that they have incentive to fix it in lesser time and by making less changes, and you’ll end up winning.

The comments are open, please do let me know what do you think.

Subscribe | Tagged , , , , | Leave a comment

How to decide which clients to work with

We have been building iPhone apps for over two years now. When we started, there were hardly any clients and we had to make do with the projects that we got. For the first six months, we never once took a project which took more than three weeks to build. Infact, there was one, which we did in three days flat!

Things changed quickly in late 2009. Almost everybody wanted an iPhone app. For the first time ever, we started getting more requests than we could possibly handle, and we decided that the first come first serve model that we had followed till then had to go. It was really frustrating to let a really cool project go because we didn’t have the time to take it up. That was when we decided to get a little picky with the type of clients that we worked with.

Now, getting picky with clients is a little tricky. It is usually difficult to find out about how the client will turn out before starting the project, so you might commit to something you think is really cool, but it might not feel the same two months down the line. So we started choosing clients based on a lot of different parameters – if it was a startup or not, if we thought that the product would do well or not, what kind of project does the company usually work on.

Most of the companies pay a lot of attention to what the client’s experience with their company was, but for one, I think that it more important to track how was your teams experience with the client. I can not say this for product companies but for services firms, this part is really important. If you and your team is going to spend the next six months putting your heart and soul into making a product for somebody, you should be sure that you work with somebody who appreciates the effort that you put in. The company gets paid, sure. But nothing kills the team’s morale more than an uptight client.

Anyways, after working with lots of clients from across the globe, we believe that we have finally reached a conclusion about how should you go ahead and rate your clients before you start working with them. It won’t work for every company, but it might give you a blueprint of how you should decide for yourself.

The first step is finding out how important the project is for the client. If it’s an internal software where they would have to force their team to work with the software that you make, we usually just say no. If it’s a startup, you know for sure it’s important and you give them more points. If there are two founders, lots of points, if three, lesser, five or more, really low points. If some of founders have left jobs, more points. If at least one of the founders is a techie and can answer questions, more points. If at least one of the founders has great marketing experience, more points. If there are two founders and both have stunning resumes, and both have left jobs, maximum marks. If it’s a huge company, and if you can ensure that the one guy who’s hiring you is going to stick around and can help you, then more points. Usually if it’s a huge company, nothing’s more important for them than their lunch breaks (we’ve met some exceptions as well, but they’re rare).

The second step if finding out if the client can take that product and make it really huge. This is slightly tricky, and sometimes even when people do everything right, things don’t work out fine. That is okay, it’s just the way it is. So the best you can do, is rate them on qualities you think founders / project managers should have and act accordingly. The most important property, is the ability to decide. It isn’t as common as you’d think, and more the number of founders, the slower this is. The best way to find this out is to get on a call with all the founders, ask them small questions which can be answered quickly (like we think that so and so feature [insert really small feature here] from your spec is useless, should we remove it). The point is to track how much time do they take to decide and WHO decides. That is the only person that you want to talk to from now on. If there isn’t one, things will be hard.

The third step is to find out how far out are they with the associated parts of the development process. This means that if the wireframes have been done, APIs are ready, content creation is in progress etc. This is really important because at the end of it you’re a services company. Your job is to build a great product quickly and help them get it to the market as soon as possible. You won’t get good feedback from them if the product doesn’t go live in the time that you promised, even if it was their fault. It’s your job to tell them what do they need to do. If the wireframes are not ready, it could take 4-16 weeks before you start development. Just tell them to come back later. If the wireframes are there, but they seem like a quick hack job, you should start discussions on wireframes, but ensure that you tell them clearly that this is just the preparation, you can’t start till it’s finalized and they’re looking for 2-4 weeks before start. Next, is to check the APIs. If the APIs haven’t been started, development is going to be a bitch, because you’ll have to struggle with now only your bugs but also those in the API. If some of the APIs are there, you should push them to finish them before you commit on the timelines. You should also sit down and start testing each to the API calls to measure how stable they are. All in all, their attention to detail and level of preparation would shine through in the first week itself. So keep the option open to stop work after a week if you think that they’re not worth it.

There are a few other things as well, but this is more or less it. If I feel the client fits us on these levels, we introduce them to the team who try to evaluate if they feel that they might like to work with this client or not. If they don’t we make sure that we help the client find somebody else who can help them.

All in all, spend as much time as you can in finding out more and thinking about the clients that you work with. These relationships will be the ones that help define your network and the kind and quality of work that you and your company will do in the later years. This is not something to be left to chance.

Subscribe | Tagged , , , , | Leave a comment

The Quintessential Non Disclosure Agreement

If you run a company, you really can’t get away without signing an NDA. You need to sign one before you can talk to anybody. This is why I thought we should have a discussion about how is an NDA structured. So here we go:

1. The Title and the Recitals

Here we define who is Agreement between, where are each of them located. This also ensures that the first paragraph of your agreement discloses what the rest of the Agreement is really about. There isn’t much you can do to change it, though I have seen some slight variation in this from time to time.

This NON-DISCLOSURE AGREEMENT (this “Agreement”) is made as of July 22, 2010 (“Effective Date”) between

OOMPA LOOMPA PVT. LTD. (“Party A”), a company incorporated under the Indian Companies Act, 1956, with its principal place of Charlies’s Chocolate Factory

and

STONED MONK PVT. LTD. (“Party B”), a company incorporated under the Indian Companies Act, 1956, with its principal place of business at Some Random Place.

Party A and Party B (together referred to as the “Parties” and individually referred to as a “Party”) wish to disclose to each other certain Confidential Information (as defined below) in connection with the purpose of disclosure specified and acknowledged by the Parties as set forth below (the “Purpose”).

Each of the words in quotes eg. “Party” and “Purpose” etc, are called the Recitals. Sometimes they are mentioned separately in another paragraph for more clarity. But I believe it’s usually done where there are a lot of things to be mentioned.

2. Purpose

Like all of us, every document must have it’s purpose. Here the companies declare what they would like to agree on. For an NDA, it’s usually something like this:

Party A and Party B wish to share certain “Confidential Information” in connection with exploring the prospects of a business relationship. The exchange of Confidential Information here under is for the limited purpose of allowing each party to evaluate and develop potential business opportunities with the other.

3. The Terms

Now we are on to the juicy stuff. This is the part which mentions your rights and duties. The number of terms varies from client to client. I have seen it varying from 5 to 35. The beginning is usually like the following

This Agreement sets forth the terms under which Confidential Information disclosed by one Party (“Discloser”) to the other Party (“Recipient”) is to be treated. In consideration of the mutual promises and covenants contained in this Agreement, the Parties hereby agree to the following:

4. Popular Terms

Some of the terms are very popular and keep coming up in NDA after NDA. Some are very specific to a company. So here is a list of the terms, depending on the their popularity in the NDA.

#1

“Confidential Information” means all information disclosed by the Discloser hereunder that should reasonably be understood by the Recipient, because of legends or other markings, the circumstances of disclosure, or the nature of the information itself, to be proprietary and confidential to the Discloser, an affiliate of the Discloser or a third party, and includes information relating to the Discloser’s business, including, without limitation, business plans, proposals, forecasts, financial data, customer and prospect lists and information, personnel data, contract information, properties, methods of operation, software (including, without limitation, source code, specifications, data, works-in-process, alpha and beta versions, design documents and documentation), trade secrets, inventions, discoveries, know-how, and other intellectual property. “Confidential Information” includes such information that was disclosed by Discloser to Recipient prior to the date hereof as well as information currently provided and to be provided during the term of this Agreement specified and acknowledged by the Parties below (the “Term”). The existence of discussions between the Parties and the terms or Purpose of this Agreement also shall be deemed Confidential Information. Confidential Information may be disclosed in written or other tangible form (including as recorded on magnetic, optical or other storage media) or by electronic, oral, visual or other means.

This is by and far the most popular among the terms. It basically says that just don’t tell anybody what we’re telling you.

#2

Recipient shall take reasonable security precautions, using at least the same degree of care used to protect its own important confidential or proprietary information, but in any case no less than a reasonable degree of care, to keep the Confidential Information confidential. Recipient shall not disclose, make available or permit or suffer to be made available the Discloser’s Confidential Information to any person or entity other than Recipient’s employees, consultants and advisors who have a need to know such information to fulfill the Purpose, and who are bound to protect the received Confidential Information from unauthorized use and disclosure under the terms of a written agreement containing disclosure and use restrictions that are at least as protective of the Confidential Information as those set forth in this Agreement. Except as permitted by the previous sentence, in no event shall Recipient disclose, make available or permit or suffer to be made available the Discloser’s Confidential Information to any affiliate of Recipient or any person associated with any affiliate of Recipient.

#3

The restrictions of this Agreement on the use and disclosure of Confidential Information shall not apply to information that Recipient can prove: (a) was publicly known at the time of Discloser’s communication thereof to Recipient; (b) becomes publicly known through no action or fault of Recipient subsequent to the time of Discloser’s communication thereof to Recipient; (c) was in Recipient’s possession free of any obligation of confidence at the time of Discloser’s communication thereof to Recipient; (d) is developed by Recipient independently of and without reference to any of Discloser’s Confidential Information or other information that Discloser disclosed in confidence to any third party; (e) is rightfully obtained by Recipient from third parties authorized to make such disclosure without restriction; or (f) is identified by Discloser in writing as no longer proprietary or confidential.

#4

In the event that Recipient is required by law, regulation, or court order to disclose any of Discloser’s Confidential Information, Recipient shall promptly notify Discloser in writing prior to making any such disclosure in order to facilitate Discloser seeking a protective order or other appropriate remedy from the proper authority. Recipient agrees to cooperate with Discloser in seeking such order or other remedy. Recipient further agrees that if Discloser is not successful in precluding the requesting legal body from requiring the disclosure of the Confidential Information, it will furnish only that portion of the Confidential Information which is legally required, will promptly provide Discloser with a copy of the information so furnished, and will exercise all reasonable efforts to obtain reliable assurances that the receiving party will accord it confidential treatment.

#5

Recipient shall notify Discloser immediately upon discovery of any unauthorized use or disclosure of Confidential Information, or any breach of this Agreement by Recipient, and will cooperate with Discloser in every reasonable way to assist Discloser in regaining possession of the Confidential Information, mitigating the consequences of its disclosure, and preventing its further unauthorized use.

#6

No licenses or rights under patent, copyright, trademark, trade secret or other intellectual property laws are granted or implied by this Agreement. None of the Parties is obligated under this Agreement to purchase from or provide to the other Party any service or product.

#7

This Agreement shall automatically terminate upon the expiration of the Term, provided, however, that prior to such termination, either Party may terminate this Agreement at any time by written notice to the other. Notwithstanding such expiration or termination, and regardless of the outcome of discussions relating to the Purpose, all of Recipient’s nondisclosure obligations pursuant to this Agreement shall remain in full force and effect for One (1) year after the date of such expiration or termination with respect to any Confidential Information received prior to such expiration or termination.

#8

Beginning on the Effective Date of this Agreement and continuing until one (1) year after its expiration or termination for any reason, neither party will, for itself or any other person or entity, directly or indirectly solicit and either hire as an employee or retain as a consultant any person who was an employee of the other during the six (6) months prior to the termination date hereof. However, the Parties agree that general solicitation through such means as advertising and job fairs shall not be deemed a violation of this provision.

#9

No failure or delay in exercising any right, power, or privilege arising under this Agreement shall operate as a waiver thereof, nor shall any single or partial exercise thereof preclude any other or further exercise thereof or the exercise of any such right, power, or privilege.

#10

This Agreement is the complete agreement of the Parties concerning the subject matter hereof and supersedes and terminates any prior such agreements with such subject matter. This Agreement may not be amended or in any manner modified except by a written instrument signed by authorized representatives of both Parties. This Agreement shall be governed and construed in accordance with the laws of India without regard to its choice of law provisions. By signing this Agreement, both Parties agree to submit to the exclusive jurisdiction and venue of courts located in or serving Pune, Maharashtra, India. Each Party shall bear its own costs and expenses if it employs attorneys to enforce any rights arising out of or relating to this Agreement.

#11

If any provision of this Agreement is found to be unenforceable, it shall be deemed severed from this Agreement and the remainder shall be enforced as fully as possible and the unenforceable provision shall be deemed modified to the limited extent required to permit its enforcement in a manner most closely representing the effect intended by the Parties

#12

Notices for each of the companies shall be sent to
_____________________________________________________
_____________________________________________________
_____________________________________________________

_____________________________________________________
_____________________________________________________
_____________________________________________________

Signatues

Finally, you ask each of the participants to add a name, title, date and get their signatures.

PS. I am not a lawyer and I am not authorize to tell you how to write your NDA. So please use this at your own discretion.

Subscribe | Tagged , , , , , | 4 Comments

Moving to WordPress 3.0

I’m glad to say that after a good six months of lying in the dust, I finally managed to salvage this blog last week.

There are a few major changes that have happened. One, I moved the blog from one on my company’s servers, to a new VPS I bought from Prgmr.com. Second, I upgrade to the super awesome WordPress 3.0 engine. Third, This also meant that I now had access to the TwentyTen theme by the wordpress guys.

Prgmr.com is probably one of the best and cheapest VPS hosting that you will find. I found out about them via a blog post comparing Slicehost, Linode, Prgmr, Rackspace and Amazon by the guys who run WasItUp.com. The study is quite intensive and I think Prgmr really came out with flying colors.

I am currently on a VPS with 256MB RAM and runs Ubuntu 10.04. If you pay yearly, it costs just about $6.4 per month! However, wordpress did start behaving a little badly when I moved here and I had to tweak the apache config quite a bit to finally get it to work. I will try to elaborate on that in another post. In case you still have performance issues (slow loading etc), do let me know.

Google too has a part to play in bringing down the performance. A few months back, search.com managed to get hold of my domain somehow. So sudhanshuraheja.com was showing the search.com homepage and google managed to save all of it’s links as those of this blog. So as soon as I took the blog live, GoogleBot crushed it! It took me a decent amount of time to find out what was wrong.

Also, we have migrated a lot of our clients to WordPress 3.0, but I had myself never really used it until now. And I must say that this is quite a bit more advanced than they had about a year back. We haven’t used custom posts here, but the menu is using the cool new feature from WordPress.

I am also using Hyper Cache instead of W3 Total Cache this time. I have heard some good words about it and I really have been trying to use it for quite some time. Also, we’re using the Redirection plugin, as suggested by Labnol.

The main image on the home page was created by Abhinit. You can find some more of his vxt art on our company blog.

PS. I have been having a WordPress vs Drupal discussion with one of my friends, and just to showcase how easy it was to do things in Drupal, he created a website to showcase his point. You can have a look at it here. No custom plugins have been built, and the complete site has used open plugins available in the market. Have a look at it and let me know if you think Drupal is much better than WordPress at making sites like this.

PPS. Changed the caching plugin from Hyper Cache to W3 Super Cache. The CDN support in Super Cache is irreplaceable. Using Rackspace Cloud on this blog now.

Subscribe | Tagged , , | 1 Comment

Introducing Generatrix

For the last few months, we have been working on creating our own PHP framework which can help us build applications quickly and safely. The result is called Generatrix and it is now hosted on Github.com

Here is a brief Introduction :

Introduction

Generatrix is a MVC framework for PHP5 which is not inspired by existing frameworks but by our belief in Magic. Our idea was to create a framework, where everything works like magic. Some of the concepts might feel a little different if you’ve worked on other frameworks before, but trust me, whatever we have here, does work like magic.

If you find a bug, please fork this and fix it up. We would be indebited to you for life. If you need our help, let me know. If you are using this for a college project, apply to us and we will recruit you. If you are using this for a commercial project, you can either pay us $500 a year or send us a thank you email. We value each of them equally. If you think it sucks, or just want to get friendly, or want to buy us a beer, or want to talk business, or if you just want to spam us, you can drop us an email at contact@vxtindia.com.

So, what can this thing do for you?

There are a lot of features planned, but here is the list of features which are already working

1. Database Mapping

One major problem with databases is that everytime you change something in the DB, it’s a pain to go and change the same details in the application as well. To fix this issue, we have created a file called databases.php which **automatically** creates classes for each table in your database so that you can directly start accessing them in your code. You would need the command line to do this. Once you are at the root of the app, you can do this – $ ./generatrix prepareModel . As soon as you do this, the code will check if a file called app/model/databases.php is already present. If it is, it will give you the instructions to delete it. If not, we will create a new file. So if the name of your table is cars, you would now have a class classed ‘cars’ which you can use as – $cars = new cars($this->getDb);

2. Create new Controllers / Views automatically

To create a new view, you don’t have to write any code. You can just type the following on the comand line – $ ./generatrix addPage test . It will automatically create two files – app/controllers/testController.php and
app/view/testView.php with the basic code already present.

3. Caching Pages

In the file app/settings/config.json, you can set cache-pages as ‘true’ and set the time to any number of seconds. Now, all your pages will automatically be cached in a file for that duration.

4. Caching Database Queries

In the occasional case that you need to cache database queries, you can set cache-db as ‘true’ in app/settings/config.json and your queries will start coming from a cache.

5. Better Debug Options

Instead of using the regular var_dump and print_r, which don’t display your objects and arrays properly, we have a new function called ‘display()’ which will highlight the error on the page so that you can see the problem clearly. You can also change the call to display_system() etc to show the message in a different way. You can also stop debugging for production servers, but mentioning ‘debug-values’ as ‘false’ in app/settings/config.json . All errors are automatically caught and displayed with the display_error() call. The values output are different depending on if you are viewing them on the browser or CLI ( or ‘\n’)

6. Automatic URL Rewriting

All URLs are automatically rewritten in Generatrix. By default a url like http://vxtindia.com/contacts/view would send the request to app/controllers/contactsController.php and call the funtion view() in that file. Once that gets executed, it will call app/views/contactsView.php and call the function view() there.

7. Custom URL Rewriting

Since automatic URL rewriting is such a pain at times, we added a way to map your controllers and functions, so that you can choose which parameter in the url should be the controller and which should be the function that gets called automatically. You can do so by setting ‘use-catch-all’ to ‘true’ in app/settings/config.json and editing the file app/settings/mapping.php

8. Database Integration

Unluckily we can only access one database right now. In case you need to access it, all you have to do is enter the details in app/settings/config.json . There will only be one common database object, which will only get created when you make a call to the database. If you don’t, the object never initializes.

9. Database Prefixes

You can also use database prefixes, as we have used ‘cv_’ in the example. If you do that, your class names won’t show cv_ in the name. For example, if you are using WordPress, and you want to access the wp_users table, you can set the ‘database-prefix’ value to ‘wp_’ and your class name would now only be ‘user’.

10. Use jquery from Google’s Servers

If you want to use any of the javascript libraries hosted by google, you can just enter the version number for that file in app/settings/config.json and that file will be loaded automatically. You can use this to load Jquery, JqueryUI, Prototype, Scriptalicious, MooTools, Dojo, SWFObject, YUI or EXT Core.

11. EMail to your heart’s content

PHPMailer is included by default, so you can call it whenever you like without downloading and installing it!

12. Works with CLI as well

Any url that can run in the browser can also work in CLI!! I know that’s way too cool. To give you an example, if you have your login page as http://vxtindia.com/user/login, you can see the exact same output on CLI by typing ./index.php user login . This works like a charm when you use **cronjobs**

13. Automatically Require Files

All files in app/model, app/controllers, app/views and app/external are automatically included in the system. So you can call them without thinking twice.

14. Break Views in SubViews to reuse!

Since only the view gets called automatically, you can break a page into subviews. You can reuse that subview in any of the views again.

15. Tell the Controller that you’re using JSON

The Controller has an option called is_html which if set to false means that you’re writing a JSON or XML response. In that case, it doesn’t try to include the DOCTYPE automatically. And well, this is the next point.

16. Set DOCTYPE

For all your pages, you can set the doctype automatically by mentioning it the file app/settings/config.json

17. Automatically loads Blueprint-CSS

We love Blueprint so much that we load it automatically in the code for each page. So you can just start typing class=’span-24′ and it will work. If your page width is not 950px, you can also edit the values in the file
public/style/generated.phpx . The .phpx extension is include in .htaccess so you don’t have to worry about it. You can just change the variable $total_width to whatever value you like and it should work!

18. Controls for extra functionality

A control is piece of code which contains HTML, CSS and JS for the complete part. You can include any control by simply calling $this->loadControl(). The most popular is going to be Table Control

19. Create Tables of the fly

Using javascript from datatables.net, we convert tables into searchable, paginated data tables as soon as you use the control ‘tables’ by calling $this->loadControl(‘table’, …).

20. Database Interactions

All calls to the database returns Associative Arrays. When you select, you get a new row from each new row in the database. When you insert you get the insert_id as the response (again in an array). We can also log the timing required for each database call, if you’re worried about your performance. Also doing simple selects, inserts, deletes are easier that you can imagine!

21. Curl included by default

So you don’t have to download a new version everytime! You can use the class Curl in the system.

22. Export Database

To export the complete database, you can just type the following on the command line – $ ./generatrix exportDb

23. Links, Redirection

Writing relative links is always a problem, so we have made sure that you don’t have to do that at all! To write the absolute url, you need to call the function href(‘/user/login’) and the parameters are from the root of Generatrix and not of the server. Redirections works in a similar way. You only need to mention the path from the Generatrix root.

24. You love Timthumb, So do we.

A function call to image($path, $height, $width), returns the path using timthumb.php. For example, I have an image at http://vxtindia.com/test/something/vercingetorix.gif, and I need to display it in size 50×50, we can go – image(‘/test/something/vercingetorix.gif’, 50, 50).

25. Include external Classes

To include any external class in the code, just copy it to app/external and it will automatically be loaded. If you have a folder, you can move the folder to the external folder and write a file outside which access the values inside the new folder.

Want it? Get it here

Subscribe | Tagged , , , , | Leave a comment