Subversion with Visual studio 2008: free open source svn client AnkhSVN
Posted on | April 13, 2008 | No Comments
Recently I have installed Microsoft Visual Studio team system, 2008. This studio simply rocks. Enhanced speed is giving me a joyful experience!
Anyway, version controlling is a major issue for any development and I never liked VSS nor used it, rather I am used to with using subversion. For windows, I like TortoiseSVN. Its simply superb and simple.
But, human mind wants more
I needed a subversion client for my visual studio ! Google gave a suggestion : AnkhSVN!!! An excellent opensource( cheers ), free and quality tool for visual studio. Just look at some screen shots :
Enjoy !
Firefox round corner css only, no gif
Posted on | March 27, 2008 | 5 Comments
Every border has its own set of native functions support some cool features to the developers. Like IE has gradient feature built in!
One nice feature of Firefox is to support rounded corner without any extra hassle. With no gif at all!
here is how:
-moz-border-radius:20px
Lazy enough? Just copy the code and see yourself!
<div style=’-moz-border-radius:20px;background-color:#ff0000′>
Hello rounded Firefox world !
</div>
See the effect here:
Hello rounded Firefox world !
Orchid mvc framework tutorial : Basic example showing how to write a simple hello world application
Posted on | March 22, 2008 | No Comments
Originally from orchid blog at: http://orchid.phpxperts.net/2008/03/18/creating-a-basic-app-with-orchid/
Ok, lets try to create baby out of orchid
Take her at your place for date:
Copy the orchid folder to a location of choice where you like to host the app.
Make sure she is vergin
There should not be any app folder inside the orchid folder. If any, remove it.
Get inside of her, make her move…
Open up a console, go to the orchid directory. run:
$php cli.php skeleton test
You will find a new folder named app is created in orchid directory.
The last drop….
run the following command:
$php cli.php controller main
Bingo.. orchid is a very good mother and wont take 9 months to create a baby. You can see your baby at:
http://localhost/learn/test/orchidframework/index.php?main
Don’t forget to change the url as required for your setup.
Examining the baby:
in orchid/app/controllers folder a new file is created named main.php
and two more files in orchid/app/views/main/ folder naming base.php and hello.php.
What they do is really simple and easy to understand.
Here is the controller file content:
class main extends controller
{
function base()
{
$this->view->set(”name”,’main’);
}function hello()
{
$this->view->set(”param1″,’World’);
}
}
and hello.php and base.php are normal php files.
http://localhost/learn/test/orchidframework/index.php?main
This line executes the base method of the controller named main. ‘Base’ method is called implicitly if no explicit method is asked for.
and http://localhost/learn/test/orchidframework/index.php?main/hello
calls the hello method of the controller main.
Simple, eh ?
Just one more thing, you can pass values to the view from controller. Look at the hello method once again.
$this->view->set(’param1′,’world’);
And here how the param1 is used in hello.php
Hello <?=$param1;?>
Orchid’s baby is really smart, right ?!!
Cheers ![]()
PHP Active record with relational foreign key support
Posted on | March 22, 2008 | 6 Comments
Many a time i wished I could find a php active record or active model that will support relational table. Failure on this, I wrote my own and named it as ActiveRelationalRecord.
Say, I have two tables posts(idposts,title,body) and comments(idcomments,comment,date). Now, using Active relational record I can do the following:
$arr = new ActiveRelationalRecord();
//$arr->init(’posts’,$_POST);
$arr->init(’posts’,array(’idposts’=>’12′));
$arr->addRelation(’comments’);
//$arr->addRelation(’anotherrelationaltable’);
echo $arr->title ;
echo $arr->body;
$comms = $arr->comment;
foreach($comms as $com)
{
echo $com;
echo ‘<br/>’;
}
// $arcom = new ActiveRelationalRecord();
//$idcomms = $arr->idcomments;
//foreach($idcomms as $idcom)
//{
//$arcom->init(’comments’,array(’idcomments’=>$idcom));
//echo $arcom->date;
//echo ‘<br/>’;
//}
Or, say you have two tables, user(idusers,name,password) and userdetails(iduserdetails,email,telephone) .
So, ARR can help in the following way:
$arr = new ActiveRelationalRecord();
$arr->init(’users’,array(’idusers’=>’34′));
$arr->addRelation(’userdetails’);
echo $arr->name;
echo $arr->email;
Finally, I don’t like the idea that an ActiveRecord or Model should have functions like find which will return multiple
record. For such utility , there should be some resultset type class.
Lastly, in future I will update the relational query to associate with a class.
Any more idea plz ?
How to set Google analytics on joomla 1.5 to see number of visitors
Posted on | March 18, 2008 | 3 Comments
Google analytics is a powerful tool to know the site visit status. You can easily sign up with google analytics from www.google.com/analytics and register a domain. You will be provided with two codes, one for legacy which has limited features and another is new code with lots of features to enable various kind of graphs and stats for your site.
Copy the desired code and paste it on the footer.php in joomla. This file can be found on JOOMLA_DIR/includes/ directory.
It may take some time to reflect the status on google analytics due to built in cacheing feature of joomla. Wait for some time and you will get lots of information on google analytics when it is enabled.
![]()
Joomla 1.5 SEO friendly url how to
Posted on | March 18, 2008 | 6 Comments
Creating SEO friendly url in Joomla 1.5 is very easy. You don’t need to download any modules now. Just follow the steps below:
1. Login to Administration panel.
2. Go to Site->Global Configuration from menu.
3. Change the SEO settings:
4. Almost done. Now just rename the htaccess.txt to .htaccess.
Bingo.. you are done !!
Run windows XP, vista in Linux with InnotTek Virtual Machine
Posted on | March 14, 2008 | 2 Comments
Many of us abandoned windows and landed on linux. But many of us also works in web development. A great twist between the brow appears when we need to test on Internet Explorer ( IE ).
So, how test web pages in Linux on Internet Exploer and IE7 ?
Solution is brought to you by InnoTek virtual Box ! Using virtual box you can install both windows xp and windows vista side by side. Not anly these two crap, also anything including another distro of Linux itself
VirtualBox can be found in the synaptic repository for Ubuntu 7.10. I have not checked it any earlier version. Or you can directly download it from: http://www.virtualbox.org
Additional Links:
Happy Linuxing ![]()
index.php : Stepping into php Orchid framework
Posted on | March 13, 2008 | 6 Comments
Recently I had the opportunity to involve in php orchid framework developed by Hasin Hayder. This is a MVC framework with lots of feature a system would ever need. Many of these features are already implemented while some are still under development. And surely there will be some other feature which will be recommended by YOU.
I am going to write a series of articles stating my journey into Orchid. This will help me to store the knowledge that I learned and help as a documentation.
index.php:
All request is first come to index.php. It has only four line:
include(”core/ini.php”);
initializer::initialize();
$router = loader::load(”router”);
dispatcher::dispatch($router);
The ini file defines the __autoload function which dyanmically includes the necessary definition files for the required object. The search path includes
“/core/main”,
“/core/libraries”,
“/core/main/dbdrivers”,
“/core/main/cache”,
“/core/helpers”,
“/app/models”,
“/app/views”
initializer::initialize();
initializer is a class resides in “/core/main” directory having a static function initialze(). Any extra initializing will take place here. At present, Wednesday, March 12 2008, the function is blank.
$router = loader::load(”router”);
Here the $router object is loaded by the loader. Router is responsible to extract the controller and action information from the url.
dispatcher::dispatch($router);
Dispatcher, as the name implies, finds the controller and calls the action. If there is no redirection request, it loads the view and shows the output.
Thats it so far.
Cheers.
svn failed to commit, file or resource is locked !
Posted on | March 13, 2008 | 8 Comments
Some times while committing a file or folder using svn it says the resource is locked ! It happens if we forcefully cancel an ongoing update or commit, say by using Ctr+C.
To unlock the resource use:
$svn cleanup
This will unlock the content. Now do commit ![]()
Select a random row from large mysql table in an optimized way.
Posted on | March 10, 2008 | 4 Comments
Random — This simple pronounced and apparently gentle looking word can make your brain randomly scattered.
We often need to select a random row from a table. … cutting short.. less time.
Prob: Need a random row from a table name ‘Dim’ which has 1,000,000 rows.
{selected only pad, i am in hurry :(}
1.
Create a stored procedure:
create procedure getDimRandom()
begin
declare cnt INT default 0;
DECLARE cur1 CURSOR FOR SELECT count(*) FROM dim;
open cur1;
fetch cur1 into cnt;
select pad from dim where pad=round(rand()*cnt);
end
Time: 1.32 sec max in 10 try
Prob: I like it
2. select floor(rand()*99999), pad from dim where pad = floor(0 + rand()*99999) limit 0,1;
Prob: here i used 99999 hard coded. can be passed from script page like php, perl.
Time: 4.32 sec max in 10 try
3. select pad, rand() as rnd from dim order by rnd limit 1
or select pad from dim order by rand() limit 1.
Time: 4.56 sec max in 10 try
horrible way:
bye for now.. check back later.



