So what i've been up to lately?

Well apart from working and being happy scout at blubolt were we hack the sh*t out of php, solr, memcahced, nginx, mysql and various scalable deployment technics, i've been diddling around with few "edge" technologies like nodejs, redis, mongodb.., on my own.(oh and hacking some stuff in C just so that i remember the bits and bytes - and who doesn't like being near the "metal")

 

So i guess i should give you my opinion on the tech stack that i just mentioned, alrighty:

 

* Php ->

There are many people who hate it, think its old, newbie language, but thats actually opposite of that in my opinion.

Its not old - its mature, newbie language - easy to start, but hard to master.

With all the 5* introduced features - namespaces, closures, traits(upcoming in 5.4), call type hinting, other..,

Sure as any language it has its own hiccups mainly needle, haystack problem.

On web development front, php is on par or maybe even ahead of C#/Java, i love its PhpDoc and the IDE support is just amazing.

Php - mature modular oop language, best suited for web development(it was made for that) from small to enterprise level.

* Nodejs ->

The hot new stuff that everyone is talking about. It recently reached 0.6v so its still quite young.

So whats nodejs? Basically its Javascript on steroids, no, no its actually javascript on server side powered by googles V8 engine(chrome).

Were it really shines is - it has evented I/O as all the core methods are async, not to mention that you can both code client and server side in js.

People have already started using it in web development building sinatra(mustache) or mvc(geddy) like frameworks, but in my opinion its not very suited for that(well unless you use some "sugar" or other libraries that help you deal with the nesting), atleast not yet. 

I think the best things to develop with node are various internet and file management services in example - irc bots, rest web service, site scrawlers, websockets.

P.S: As nodejs(V8) is still Ecma3 with some Ecma5 features i suggest looking at some "sugar" - coffeescript.

* Nginx -> 

Nginx is a free, open-source, high-performance HTTP server and reverse proxy. - Don't know what else to say, thats absolutely correct.

Its written in c, supports custom modules(geoip, tcp, ...), and deals with the 10k problem just fine.

Basic and most useful functionality = spawn workers and proxy request.

* Solr ->

Google search at your finger tips, well almost.

Solr open source search server - was originally developed by CNET and then passed to apache.

If you have small, medium, big, any size haystack, if you need to find a needle in that haystack and you need to do that often - solr is here to help you.

Index the haystack with various parameters, query/search for your needle - be happy - its that easy simple, written in Java, open source.

* Scala -> 

Scala, scala oh dear scala why are you running on JVM? Well actually it makes sense, you can use the wast java libraries and combine that with scala you get one powerful rapid development environment.

Scala is a programming language that is - type safe, can do both oop and functional programming(feels like crossover between java, javascript and python), currently runs on JVM(and thats the only thing i hate about scala, but some people love scala for that).

 

* Go ->

Google's new programming language Go. Roots lie in C, is compiled language, that means it will compile to an executable. 

Runs super fast(also fast compile times), has various concurrency mechanics(channels, goroutines, defers) that means its very scalable, its statically typed, feels like a dynamically typed(but its not), interpreted language.

I really liked it(maybe even more then Scala(no JVM, ye!)), but the problem for me was, that mostly i do web development, and in web dev you need rapidness and flexibility, so even though Go feels like dynamically typed language it isn't(and you can forget that sometimes), i would use Go for any low level app that requires very efficient computer resources use - basically for task that you would normally consider using C/C++ i would use Go.

Go has great potential, so i won't say that i wont use it in web dev ever, because i might, and some people are already doing it.

 

* redis/memcached -> 

Well as you all probably know memcached is the de facto tool for in memory data caching and one of the first things you use to make your app more responsive/scalable.

We could say that Redis is the younger more cooler little brother of memcached, but by that i just mean that it is younger project and by no means is less stable then memcached.

Redis expands on memcached caching idea and adds more features to the field.

 

The key features that i like:

* Pub/Sub messaging

* Some data types(list, hashes, sets, ...)

* Sorting

* Can easily implement job queue

* In disk - permanent store

So my verdict is - if you need any of my mentioned features use Redis, else use Memcached.

 

* mongodb -> 

MongoDB document based NoSql database - still generally young project(even if it hit v2 recently).

Actually haven't used that much, but from my point of view the key features are:

* Replication

* Sharding

* Read, Write speed (need to be aware of write locks), in optimized cases you don't even have to use caching(memcached, redis) 

Probably best case scenario for mongo is when building something similar to analytics system, were you need to do many writes and reads, without changing the data and then doing a map-reduce on that data for statistics. 

Also you should be aware(read upon) mongodbs shortcomings, like for example if you have small data sets and large data sets(that are several times bigger then your ram), mongo can get slow its due to fragmentation and minimum cache granularity.

Other example is that if you delete entries from mongo it actually marks them as freed/deleted, but it does not compact the data on the fly, thus your data ends looking like a house full of rat holes and the only thing you can do about it is to take down your db and run "repair" on it, but in most cases thats not an option.

From quick glance mongodb can look very shiny it has good documentation, many libraries, its documents are bson(binary json, one more win for javascript), replications, sharding.

But as with each database it requires maintenance and knowledge of its pitfalls.

* mysql/postgresql ->

Those two are quite similar(and distinct), both are ACID, and both are rmdbs.

More and more companies are currently switching from mysql(as it was acquired by oracle) to postgresql or other solutions(nosqls).

Thus i also would like to say, that when possible, Im using postgres instead mysql.

I won't go into the details of comparing them(as actually Im not that big of an expert), but in many ways they look and feel the same.

Few features of Postgres that i like and that are probably the most noticeable from mysql:

* Procedures and procedure storage(plsql, other scripting language support)

* Schemas - this is cool, as it allows to store your tables in more modular way.

* Has better user access control then mysql - basically you can have various roles with certain access permissions.

 

Note: before using any technology you should always check if there are developments tools available.

Out of Ram

Last week i was thinking that we humans have really bad memory. 

Our memory is like computer Ram, you know/remember what you are doing now, what you did yesterday, but just go back three days back in your mind and the memories start getting very vague.

Sure we flush our Ram to our hard drives(brain) but only snapshots, snapshots being - most important abstracted events.

As an example lets take my blog, i started it late 2010, i know that i shared some of my code here, but what exactly i couldn't recall, without opening the blog page and viewing it.

So yeah our memory sucks.. and its no mystery at all, as we all know that, but maybe haven't thought about this in depth. Just imagine if you could remember each books content that you read in your life, that would be simply awesome, would make us really smart, what advances could we archive then?, but the sad reality is that we are forgetful, so the only thing we can do is research this so that hopefully one day we make these wonder drugs, who will add more Ram to our brains so that we can recall every moment of our lives, thus expanding our lifespan mentally.

 

Conclusion of this article is that - I want more RAM!,

But because i am not getting any, will resume writing this blog.