This text is replaced by the Flash movie.

Archive for March, 2009

EdiMax – Broadband router

March 19th, 2009
If you want to show the page you are currently working on to your client, but have no time to upload and fix some settings on the remote site and you are using Bayantel DSL broadband - you can use your PC as the host and show the website you are working on.

To do this follow these instruction:

1. Go to Status > Internet Connection - See your IP Address - this IP is live and can be view remotely
Getting Obtained IP Address

2. Then go to NAT > Virtual Server >

Check Enable Virtual Server
add the IP and PORT number

for example in the image
Virtual Server

I use Port 80 for Apache
81 for IIS
3000 for Rails

To get your Local Network IP address, open your console command prompt and type   ipconfig 
Obtain Local Network IP

Testing Rails
Webrick Rails

Once you got disconnected, your IP address will change again just do the number 1 process again to obtain your PC new IP address.

Running Rails at 3000
Webrick RORails

Right way to use sql…

March 3rd, 2009
Right way to use sql join with conditions (Displaying no match data).
After hours trying to figure out what's wrong with my query for displaying list of cities with how many Lease/Sale were there. The problem was getting the cities even not yet added on Lease or Sale type, that means I need to list cities that has no match yet or 0 count.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?
global $mainframe;
$ebconfig = &$mainframe->getParams();
$prop_Type = $ebconfig->get('prop_type', "Lease");
 
 
$db_city =& JFactory::getDBO();
$query_city = "SELECT t1.city, t1.id, COUNT( t2.propCity ) AS city_count
FROM #__listing_city AS t1
LEFT OUTER JOIN #__listing_listings AS t2 ON t2.propCity = t1.city
WHERE t2.propType = '$prop_Type' AND t2.published = 1
GROUP BY t1.city
ORDER BY t1.city ASC";
?>


The code above does not display the cities that has no match on another table. The where clause was giving the problem...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?
global $mainframe;
$ebconfig = &$mainframe->getParams();
$prop_Type = $ebconfig->get('prop_type', "Lease");
 
 
$db_city =& JFactory::getDBO();
$query_city = "SELECT t1.city, t1.id, COUNT( t2.propCity ) AS city_count
FROM #__listing_city AS t1
LEFT OUTER JOIN #__listing_listings AS t2 ON t2.propCity = t1.city
AND t2.published = 1 AND t2.propType = '$prop_Type'
GROUP BY t1.city
ORDER BY t1.city ASC";
?>


Instead putting the condition on "ON Clause" after the matching table condition, fixed the problem.