Welcome to LjGww's Blog

Here we will see...

Pages

Wednesday, May 25, 2011

Mobile web

I am contemplating how to adopt a web site to be more suitable for the mobile phones. I have stepped on a set of solutions that may provide an answer to this question and cover more than one phone type.

http://mashable.com/2010/08/11/cross-platform-mobile-development-tools/

Writing application for each phone seems a bit tedious business. I guess that producers will hit the wall of cross compatibility. It is cool to have a native app for your phone, but multi-phone development is costly, and maintenance of several lines of mutually exclusive phone os-es applications even more. Thus I guess we will go to a deadend with specific apps (except for games and system utilities for each phone). Already top 10 apps on iPhone are games - I've seen nothing serious.

Sunday, May 22, 2011

Cloud

As every IT hype in the past couple of decades it goes in the same fashion. Someone yells some buzz, then everyone buzz the buzz, and then some catastrophic event spins the buzz....

What I have heard in last years - virtualization, virtualization, cluster, cluster, cloud, cloud, cloud, cloud, cloud, cloud.

While you try to explain that you need to backup, your manager hits you with the $$$ speech. And it goes then they fork $$$ more than they saved $$$ before, to do the remedy.

It is hard to keep repeating: there is no silver bullet solution! You cannot shoot a problem with one solution. But that part hardly gets understood.

http://www.bbc.co.uk/news/business-13451990

Wednesday, May 18, 2011

Going, not going...

Past several days have been switching and resting. Little bit of graphical design fiddling with HTML divs and trying to make something working. Found that divs are very hard to control if one is working in percentage world. Now I understand designers why they go to fixed pixels. HTML is not easy to control. At the end I needed to combine TABLE and DIV approach to align things and I am still not satisfied with the result. It could come as crazy statement but HTML/CSS is not covering "floating" layouts easily - a lot of tricks.

When I get saturated with HTML design, then I switch to PHP. Kohana is coming good. Just controller/view system is doing great job. Make template, make control, populate template, do some HTML design. In iterations.

When I get tired, I get out of the circle, read articles, email, messages... and along the way I have stepped on a HTML/JavaScript that may surprise you - whole linux in a browser "terminal" window. Furthermore it turns out that this person  Fabrice Bellard is making a whole simulation of the Terminal and 80x06 and Linux on top in JavaScript! For me this is amazing! A unix/processor emulator within the browser. Try it for yourself: http://bellard.org/jslinux/ Note that you need at least Firefox 4 or Chrome 11 (not the latest Chrome 12). Script will tell you if it is going to work in your browser. This makes my day. There are things worth making.

Another thing I have stepped on is purely mathematical X^4+X^2=1. It says 85% of people cannot solve this. After all this programming, I also found out that I completely forgot some algebraic transformations. Yes I can solve this by using computers - what a waste of CPU cycles, but that would be beside the point. 

Tuesday, May 10, 2011

Where I'm heading?

PHP I personally find a very balanced solution for writing web site automation. Quick enough, can be scaled, is not dependant of platform, browser neutral, well documented, easy to use... I find this as benefit. Of course some will toss in its OO approach, extensive libraries and a lot of third party know-how. Nice.

It is not my favorite though from the aspect of the language - I am fan of ruby and C++, and reasoning behind this is currently out of scope for this writeup. I wanted something else here.

PHP have very nice OO system, simple, effective, just enough not to get into the way and just enough that you can "organize" concept in chunks of convenience.

How do I jump on writing a "large" application in PHP?

I can make libraries myself, use a lot of PEAR stuff to do side-work but this requires analysis of the whole system. This is time consuming. You can't write large library of things overnight.

As Internet user I step on common sites like Facebook and Twitter, news sites, shopping sites, banking sites, repositories, personal views (like this one I am writing).

All of them are some sort of an application. Many of them possibly written from scratch as PHP was once upon a time a "form" processor. Yes I have used it very very early :)

If you wish to build a web site, that is nothing easier today. Start simply by creating a blog. Couple of clicks here, couple of configurations there and hey! there is decent web site.

If you wish to go deeper there is plethora of ready-made software for various purpose - wanna discuss - internet forums - wanna publish/edit web site - a number of cms-es. Wanna imitate facebook success and have something in between discussion and publishing - hey there is social network softwares.

Many things on the web come nowadays as SaaS. Which is great concept - people who make software make it at one place and people who use it pay some rent to use it.

But how to write your own application by not "twisting" cms'es?

Not that I find this approach wrong, on the contrary - twisting cms-es is great method to make your web site and possibly automate it with some plug-in here and there. It really depends on a need.

So after many talks with friend here and there, I got a suggestion: Prado framework. Quick glimpse over its functionality and you realize this is large animal to chew on. But somewhere on the road I also got hinted to Yii as being "successor" of Prado. Looked fresh and more inviting.

Spend days trying to understand nuts and bolts of it. Acquired a book. Hmmm.

After a lot of clicks and trial and error i managed to make something.

It turns out not to be too complicated. But I had some sort of not being really happy with it. Yii (and I presume Prado) are absolutely great to write web application - for example - you want to write a ledger application.... You develop database model and Yii helps you to make code that runs about it. This is great but not exactly what I am looking for. I want to make large application that is web site too. Second thing is that Yii is several tenths of megabytes of upload. This is less of a problem because you need to upload library only once to a target web server and then you changes/uploads are relatively minor.

Still I wanted some flexibility, something that balances structure and help and from another side offers me more openness.... to be what I want it to be.

So i went to research PHP frameworks a bit more. There are some resources on the net that compare them. Which is not very useful not even mentioning all of them. But after some time I stepped on something smaller than Yii - Kohana. Again - couple of days to understand what is going on in there. But some comparisons emerge from the beginning. Kohana is much smaller than Yii (ad hoc about 5 times smaller) - not too large to upload. It defines structure but do not impose design. You can write whatever you want from scratch. Do not take me wrong - with Yii you can do the same, it has "themes" as for customization, but Kohana opens me a flexibility needed to build how I want it to be.

Now to my knowing and investigation Kohana is "new kid on the block", it still lacks a lot of documentation and experience of third kind, but looks to me promising. I am of adventurous kind, and possibly if I am more "strict" I would possibly contemplate Code Igniter as being longer around.

The choice has not been made yet. I first want to 'understand' what all these framework want to solve and offer and then choose one that I find most suitable.

On a track side there are some thoughts. But they do belong to another section of this blog.




Sunday, February 13, 2011

Okay

Let's C where am I...... First, I am on Mac OS X (macosx) so many choices are based on decision shall something will run on what I have.

I got the idea about Eclipse... a particular one Eclipse for PHP. Okay.

This is the story: I want to write some complex project in PHP. I can do it with good ascii editor, since I am on Mac, barebones is my choice of text edit tool, barebones have been market leader for ascii and mac for years, to my knowing (if you know something better, let me know). No means for full fledged barebones,  so excellent free version for now. Recommended.

Writing php code goes in development circles. Type, save, switch to browser, hope it works, go back edit, save... I do not mind that mantra - it is everyday's programmers prayer. Yet, it would be helpful if there is some easier way. Hop, jumps in friend of mine that spends his days in Java and says "Eclipse!". I say, OOOOkay but I am not Java, and he says "but Eclipse is not only for Java".

Then it starts.....

Got eclipse for PHP. Gosh.... took me about 2-3 days to get myself familiar with it. I admit. Not easy. And I am not new to RAD/IDE's seen many in many years. But, after some wrestling with Eclipse, I got an idea how to make it work with XAMPP. Not very logical solution for me, but it works.

Strange animal Eclipse for PHP.

Now. If you just get an eclipse for php on its own you may find yourself puzzling how to make it to "debug" the code as it nicely allows to "edit" code and "run" it (although even this "run" is a bit awkward since the only browser it "recognizes" is Mozilla and "internal" browser. Wander why.

I am fond of some other browser namely Camino and Chrome (shall I link it? no.... - google it). However Eclipse gives up on finding these two in "production". 

Second thing that puzzles me with EfP (Eclipse for PHP) is that there is no "deployment" i would expect. Okay PHP is not "compiled" so "build" is a bit awkward to contemplate yet it would be logical to be a "copy" to a web server "build" folder. Wander why this is not done in this way. Only way I made it work is to use "source" directly from web servers folders (see above XAMPP - it makes "local" web server).  Okay it could be because you may be confused with double sources in two different places but still it is logical for me to have "source" and "build" and then remote "deployment".

Third thing that have caught interest in along the research about PHP tools, is CVS systems, not that I need to share code but out of curiosity.... By researching some pointers I stepped on PHPunit that propose to be used to "test" PHP code. From one side PHP comes with PEAR which is in my view an extendable "class library" - extremely nice thing from PHP makers and contributors - many useful tools!

So I have found git and github since it seems to be place of choice for PHPunit.

Took me several hours to configure git.... Luckilly i've been on UNIXes for years.... surely not mac staff. On the way I found a problem that I need "root" access for Mac (which is disabled) and found excellent hint on Mac OS X Hints

GitX is still puzzling me as to be proposed "easy" git interface (in which I do not find myself around except to browse what I managed to do with git on a command line) Nice tool but still poorly documented. Maybe by the time it would develop into something more useful than kind-a viewer (as I see it).

Retracing from "git"-ting i found that Eclipse uses SVN. Okay will try to do it later sometimes.

Gone back to Eclipse. This time debugger.... Eh. Seems that there are some two ways to make it work. One of ways is to have Zend Engine.

Zend being commercial, is kind to have a "community" edition. And there is version of Eclipse bound (as far as I understand) with Zend and its called PDT

That did not click with XAMPP i am using. So I have grabbed Zend Server separately in order to be able to debug.

It took me a while to understand how Zend was supposed to work. Which is much worse, Zend tends to "live" out of MacOSX file tree and gets installed in "Darwin" UNIX places (which makes tedious other things).

I also grabbed "bound" version but it turned out to be older than latest Eclipse for PHP.

So another hurdle with setting Eclipse to work with Zend Server.... and found out that it does not like Apache "URL rewriting" systems. Whenever you find yourself between several producers - apache, php, zend, eclipse... it starts to feel like "bermuda triangle" lot of resources - do this with this, do that with that.... pretty tedious to find your way around. So it comes handy years of hacking httpd.conf (as to change default users so I can edit files from MacOSX) and other UNIX skills. Zend Controller that comes with Zend Server is maximally puzzling application (did not find what it is for as yet).

But I managed to make it working .... 

Result:

XAMPP working on standard web ports
Zend Server working on ports 10000+
Eclipse debugging PHP code as PHP script and as WEB script...
Two workspaces - one for XAMPP one for Zend.
now I am set to explore some PHP code.....

And so it goes on my GitHub https://github.com/ljgww