Showing posts with label tools. Show all posts
Showing posts with label tools. Show all posts

Sunday, February 25, 2007

Ease your recursion

Ever wanted to have an easy way of building a recursive tree ?
Or something like that ?
Or even without understanding much of recursion or always thinking how was this done and so one ?

Well I eased your life a bit ;P



<?php
/**
* Function that builds a category tree with recursion
* (it selects only id, [your specified field] and parent_id
* from the selected table)
*
* @param string $spacer
* @param string $table_name
* @param string $field_name
* @param integer $start_id
* @param string $link
* @param string $request_param
* @param string $link_style
*/
function buildRecursionTree($spacer = '>>' , $table_name ,
$field_name , $start_id = '0' ,
$link , $request_param ,
$link_style) {
global $db;

$sql = "SELECT `id`,`$field_name`,`parent_id`
FROM `$table_name`
WHERE `parent_id`='$start_id'";
$result = $db->query($sql);
while (list($id,$name,$parent_id) = $db->fetch_array($result)) {
$spacer_next = " ".$spacer;
?>
<?=$spacer?>
<a href="'<?="$link?">?<?=$request_param?>=<?=$id?>'
style='<?=$link_style?>' >
<?=$name?>
</a>
<br/>
<?
buildRecursionTree($spacer_next , $table_name ,
$field_name , $id ,
$link , $request_param ,
$link_style);
}
}
?>


And now some sample usage ;)


<?
$spacer = "<img src='images/arrow.png' border='0' />";
$table_name = "categories";
$field_name = "name";
$start_id = "0";
$link = "index.php";
$request_param = "category";
$link_style = "color: #000000; font-family: arial;
font-size: 11px;
text-decoration: none;";
buildRecursionTree($spacer , $table_name , $field_name ,
$start_id ,
$link , $request_param , $link_style);
?>


Well easy enough huh !
See the sample result yourself ;)

Прочети цялата статия...

Wednesday, February 14, 2007

Ruby - the power of simplicity

I expect that most of you have already heard of RUBY.
If not! Well RUBY is the new hot programming language... as always new doesn't really mean it has been released yesterday but it is a newcomer to the world of programming language popularity.

Why is ruby hot?
Well RUBY is all about simplicity.
You know when you switched from C or Java to PHP when developing web based applications and saw how PHP deals fast and easy with web oriented stuff... so does RUBY.
Actually RUBY has been planed all around web application development. It focus on simplicity and elegance. It is a mix between PHP,PYTHON and maybe JAVA. You know! Everything in RUBY is an object! Yes! That is true :) everything is an object so for the object oriented developers it is really a good one ;)
But what is a programming language without the TOOLS.

RUBY ON RAILS
Ruby on Rails is a framework that will help you deploy everything almost out of the box. It is really made simple, elegant and very very powerful!
The actual idea of Ruby and Ruby on Rails is to enable the developer to focus on the actual problems ... what the user see and get... not the background stuff and all the silly little problems but the actual problems and solving them.

If you think I am over happy with ruby and I talk this because I am a ruby developer you can see the statistics at TIOBE
Yes that is right :) RUBY has gained an enormous popularity recently and stepped 10 positions above. Eventually I should tell you that the trends for 2007 are like this:
1. Microsoft Vista entering slowly on Desktop PC
2. Ruby gaining vast popularity among web developers
3. ...

Hmmm sounds good right ? :)
So to make you over happy I will tell you more on Ruby on Rails.

Ruby on Rails is the software you need for ruby development.
You remember when I said about making something almost out of the box ?
Well ruby on rails enables you to have UNIT testing on the fly... database stuff that generates by default and you know it is really a good software. The people from 37signals have really done again a great job with this peace of software.
What really makes people like RUBY and RUBY ON RAILS is that 37signals designed Rails with simplicity, elegance and POWER in mind. All you need to setup for the proper development of an application is made simple and powerful and you can come up with UNIT TESTS (for example) in the blink of an eye... it is made automatically for you.

But enough talking you can see more about RUBY on http://www.ruby-lang.org/

Прочети цялата статия...

Sunday, February 04, 2007

Google Desktop to kick Yahoo! Widgets


According to recent researches Google Desktop is getting far more acceptable by the users than the Yahoo! Widgets. Why so?

This article is intended to give a clue on why people are using Google Desktop or having a sweet spot for it.

Google Desktop is a simple!





The widgets you use with Google Desktop are simple and elegant. They give you just enough swing to do the job you want to do. You have your calender, your gmail and so on... what so ever you say! Yahoo! has integrated their services with their widgets long ago too. Yes! In fact Yahoo! widgets are currently more powerful than the Google one but their approach is far too different from the Google one.
Yahoo uses a widget engine which operates and loads every widget like another process unlike Google widget engine which loads the widgets "within it's own process".
But really is this good ?
Yes! It is!

Google Desktop is by far faster than Yahoo! Widgets ... Yahoo! Widgets get the upper hand if running one widget but putting like 10 widgets running on both engines Google Desktop is by far the WINNER!

Beside benchmarking and a bit of technological difference Google is much more different and powerful than Yahoo in the sense of SEARCH.
Well as we know the giant ;) in that view GOOGLE of course is always oriented towards information and finding it... weather, news, shopping, mapping ... Google finds it ;) Yahoo long ago saw this and is by far the best concurrent of Google but when speaking for the Desktop Widgets Yahoo! really didn't throw much search capability in it.
Google have!

Here is a short list of comparison between the two products
Google | Yahoo!
G simplicity and usability
Y more complexity

G search oriented
Y design oriented

G being fast when dealing with more than 5 widgets
Y getting slower with more than 5 widgets

G integrated company services
Y integrated company sercices

G developers ease and support is good
Y developers support and ease is good because of being on the market longer than the opponent

G simple design and functionality ... having simple, elegant widgets for the everyday tasks
Y complex and good design but user experience isn't good with some of the widgets
for the everyday work




After giving a short summarization of all that is on the internet and my own research I like to put a few words about the services and the products both Companies offer and why I personally have switched to Google Desktop.


1. Having the Yahoo! Widget engine working with more than 5 widgets rendered my NOTEBOOK (which is not the cutting edge stuff) useless sometimes when developing software

2. Most of the widgets couldn't be resized and so on fitting more comfortably on my desktop unlike Google Desktop which can resize every single widget so you can make it fit better

3. This one is because I personally like GMail instead of Yahoo! Mail which is more colorful and so on... :) so using a Google account is more integrated with every single service of Google unlike Yahoo! (which isn't far behind)

4. TODO lists, Scratch Pads and so on statistics and note takers the everyday task widgets on Google Desktop far more suits me than what Yahoo! had offered.




And the conclusion is!
My research shows that people seeking information and IT people (programmers/developers,administrators,webmasters) are more comfortable with and prefer Google Desktop while most of the so called normal average desktop users and designers and people that are always creative(sometimes meaning over creative) and so on likes the beauty of Yahoo! Widgets.

I personally find Google Desktop more robust and "TO DO THE WORK" software but this is my experience!

So what do you say ?

Comments on the topic are highly appreciated...

Прочети цялата статия...

Saturday, February 03, 2007

Basic SEO - steps to improve your SERP

Well I've been asked to write about SEO.

For those that don't know what SEO is it is the short of Search Engine Optimization. But what does this really mean ? It means that if a good SEO is in place your web page will display on top of the results in some search engine for a certain keyword.
For those that don't know what SERP is ;) it stands for: search engine results page

Sounds like interesting stuff?




Well here are a few steps to actually achieve this:

BASIC

1. Use H1 html tag to display your title

2. Use H2 for the subtitle

3. Keywords meta, title, description, url, h1 and h2 tags should have something in common if they are the same the satisfaction will be 100% ... so the use of a term like "findacar" for example if used right in all the stuff of the web page shall bring you very good results in search engines with the search term "FIND A CAR"

4. Do bold or strong whenever possible ... Google thinks it is important and raises results for your page for the tagged word

5. Do not use a lot of keywords in the meta

6. New content is very positive... a forum on your site shall bring enough new data for the day

7. Making your sign in the forums at the bottom of your post to be a link at your site will both increase traffic(which is the most powerful SEO) and will give a link to your page(SITES THAT LINK TO YOURS IS CONSIDERED KEY FUNDAMENTAL IN MOST OF THE SEARCH ENGINES FOR DISPLAYING... ESPECIALLY GOOGLE)

8. Don't waist your energy on giving links off your site... it will decrease your overall SEO... especially the Google results for your site

interesting

The GOOGLE Page Rank algorithm is LINK based!
It will place you more on top if major PG(Page Rank) sites give a link to yours. So a fundamental concept is to have more inbound links (to your site) ... at the opposite side external links (on your site pointing to an other site) will decrease your PG.


ADVANCED

1. The Google algorithm is strongly working depending on links... a good practice is the management of your own links(your inside site navigation and so on links) too!
The very first thing is: NOT HAVING BROKEN LINKS

2. NOT HAVING A TREE STRUCTURE OF LINKS THAT THE CRAWLER WILL CRAW AND END ON A PAGE WHERE IT CAN'T MOVE FROM IT... EXAMPLE NOT HAVING LINKS THAT ARE POINTING BACK TO YOUR HOMEPAGE

3. Having as much links that the crawler needs to crawl ... so not only to have on all the pages the home link but also many others so that the bot stays on your site much longer and finds more info... it is questionable the methods of how the crawler really works but this is tested stuff believe me!

EXPERT

If not used right this might be considered gray or even BLACK hatting so please be ethical,moral and so on on this one! I DO NOT ENCOURAGE THE USE OF ANY BLACK HAT STRATEGIES!!! I am writing strongly white hat strategies which are 100% acceptable from the SEARCH ENGINES policy and terms of service and so on...
This tips are not straight forward so it might be a good idea to check wikipedia or search Google for ideas about this.

1. Making use of the SLASHDOT effect

2. Making use of the DIGG effect

3. Making use of GOOD INFORMATION

This is the most important one!
IF YOUR SITE HAS VALUABLE CONTENT THERE IS A 99% PROBABILITY OF PEOPLE LINKING TO IT AND MAKING ENORMOUS AMOUNT OF TRAFFIC WHICH IS OUR MING GOAL!!! WHY DID I PUT THIS HERE? WELL PUBLISHING AND INTRODUCING INFORMATION IS NOT SO EASY AND IS ACTUALLY THE MOST TIME CONSUMING AND HARD CONCEPT OFF ALL. MAKE SURE YOU WILL INTRODUCE THE INFORMATION IN AS MORE HTML-ALIZED VERSION TO THE AUDIENCE AND MAKE IT SHORT AND PAGINATED. ALSO IF YOU SKIPP MOST OF THE JAVASCRIPT AND FLASH EXTRAS IT WILL BE POSITIVE FOR YOUR SEO. MAKING W3C VALIDATIONS WILL ALSO BE VERY USEFUL AND WILL MAKE POSITIVE SEO RESULTS!




Making more simple and html-lized as well as friendly and more standard compliant sites will be the most powerful SEO from the view of the development process. The next thing is introducing valuable information!

Hope this one article was useful!




Want to try your SEO skills ?
Wonder how ?
Here is a link to a contest where you can try and will a small price ;)
http://bgwebmast.org/


Прочети цялата статия...

Thursday, January 18, 2007

iptables to brake free from the ISP jail

You are asking yourself about the title of this right?
Well I received a couple of e-mail from bulgarian people about how to overcome the local restrictions we have in our country. For information I will say unlike other countries Bulgarian ISPs are doing everything possible to make you unable to share your internet traffic. So let's get started.

This is fast and I am going to ask you to read additional materials about what I will type here.

So first you got a linux box.
Second you need iptables.
Then open a console/terminal and authorize yourself as a root (the command is "su -").

The first thing to do when root is type in:
> iptables -t nat -A POSTROUTING -s IPADDRESS -j MASQUERADE

You should substitute IPADDRESS with the ip address of the host which we want to provide internet to. Basically many people don't use MASQUERADE but SOURCE NAT but this has a drawback with a certain configuration cause if you change addresses or if you have a dynamic address you can't use it.

> iptable -t mangle -A PREROUTING -j TTL --ttl-set 126
> iptable -t mangle -A POSTROUTING -s 192.168.4.0/255.255.255.0 -j TTL --ttl-inc 1

The first line is the thing we actually need.
It alters the TTL so it does not expire ;)
You can have the second one line in order to set the TTL from the other host to the same as it has come from your host! This is made for the reason your ISP doesn't understand that you have a host behind you.

Make sure to change the address in the example to the one you need!

So if you need more info about the commands and iptables please refer to http://www.netfilter.org/

Прочети цялата статия...

Wednesday, January 17, 2007

Adobe Flash ver. 9 released


The end of FLASH sites not functioning well on a LINUX BOX is over!
Finally you can enjoy FLASH 9 on a Linux BOX.

You can download version 9 of Adobe Flash player for Linux as:
- tar.gz
- rpm

I remind the fans of Flash that ActionScript, the language Adobe is using in Flash will soon be released OpenSource!

Happy new FLASH version ;)

Прочети цялата статия...

Wednesday, January 03, 2007

IDE vs Editors

In this article I will try to obsolete any believes that standard text editors or even the more advanced ones are not only bad but evil!



First you might want to look just at the above pictures.
What you will prefer to write on?
Maybe in bed I will want the Book 'cause it is better than a personal computer but is it really faster than it? What if I make a mistake? I'll have to rewrite it... on the PC I will do undo or just retype it. Hmmm clever isn't it?!?!

Well the same basics are there for IDE vs Text Editors.

I will give a real example again. Consider the following situation at work.
You have a server where you host the project a boss tells you to "LOGIN" to it and make some changes... ok there are some great editors like JEdit which have many plug-ins and can have a build in client or what so ever... so OK. Then you need to, let's say find the bug in the design. What a horrible task. Yes you will need to look at all the spicy code in there an fix some unclosed tag. Then you need to add some functionality and can't remember the PHP function name for striping some characters... oh my!


I think you already got the picture!
You are faced in the worst case scenario with lack of highlighting, tag completion, ftp client ... and so on.

With an IDE(Integrated Development Environment) you got all this if not more.
Even in the best case scenario the TEXT EDITOR will lack one of your needs like say SVN client. But with an IDE you got it all there build in or with plug-ins that just work with the environment.

My boss told me that using an IDE leads to some BAD habits like not remembering all the function names or like using a function that you don't actually know what it does. But that ain't true.
IDE is giving you all the details and corrects your silly mistakes... and all the experience you will gain just by writing and looking at the code is enough to make sure you know what you are doing. An IDE is the Swiss knife of a modern DEVELOPER.

There are some good choices like Eclipse and ZDE (Zend inc) for PHP for example.
And there are plenty more... for other languages too... both free and paid.

But what I really wanted to say is that using a text editor leads to bad habits like writing text instead of code. This is not right to do and shall not be tolerated within the mind of developer.
A real developer should know what he's doing and just use the tools to be more productive, not waste time on silly mistakes or facing trouble with some software or hardware issues that ain't he's work.

So what you say ?
I will appreciate if you drop some comments so I know I provoked your mind to think about the topic... or just that you support me ;-)

So have fun with your code instead of hating it!

Прочети цялата статия...