Posts

SQL joins graphically simplified...

Image
SQL[structured query language] is the language to get data from a DB. It let you retrieve data from a simple "select *" to many customized ways. "JOIN" is the keyword to retrieve data from multiple tables with a given relationship "ON". There are few more keywords used with JOIN, and some are optional. ex: INNER, OUTER,LEFT,RIGHT,FULL,CROSS,... those keywords depends on the DB you are using. As given early JOIN give us the opportunity to retrieve rows which are related on two tables. So those could be able to show in a Cartesian Venn diagram. So i have created two sample tables and added sample data to those. lets see how this can be simulated. First lets create sample tables: CREATE TABLE tblleft ( id_customer int(10), customer_name varchar(10) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; insert into tblleft (id_customer, customer_name) values (1, 'amara'); insert into tblleft (id_customer, customer_name) values (2, 'dasun'); insert...

Prevent XSS and request forgery and other common attack patterns | [: GaB :]

It looks like two-third of the attacks are based on three vectors: 1.  SQL injection  (25%) $id="1;DROP TABLE users"; mysql_query("SELECT * FROM bars WHERE id=".$id); It is deeply shocking how many "developers" still don't get the message not to execute SQL commands forged from user input. Or at least, why are they still employed? This attack would be the most simple to prevent. You just always have to *escape* strings which are parameters of the sql query coming in as request parameters. If in doubt, what do I mean by that, simply escape *all* parameters of a query. Or better use queries parameterized as "SELECT ... WHERE id=? AND type=?"-s, your language must have a way to pass the values safely afterwards. But stop, why in the world are these guys still writing any SQL queries in the first place?! Because script kiddies don't know what a persistence framework is. Stop handcrafting  CRUD DAOs. 2.  Cross-site scripting a.k.a. XSS ...

Favorite Text circle on console

Here is a small code snippets for displaying famous charactor circle on the console.... you may enjoy it!!! private String circle() {         if ((System.currentTimeMillis() - startTime) < 100) {             startTime = System.currentTimeMillis();             return "\r" + current + "\t";         }                if (current == '|') {             current = '/';         } else if (current == '/') {             current = '-';         } else if (current == '-') {             current = '\\';         } else {             current = '|';         }  ...

deploying war file on Weblogic server by using ant scripts

Auto deploying war file on Weblogic server by using ant scripts server="t3://${weblogic.adminhost}:${weblogic.adminport}" classpath="${weblogic.classpath}" username="${weblogic.user}" password="${weblogic.password}" component="${app.name}:${app.name}" debug="true"; classname="weblogic.ant.taskdefs.management.WLDeploy" classpath="C:/bea/weblogic81/server/lib/weblogic.jar" name="wldeploy"; debug="true" password="tropicAl" source="${build}/test.war" targets="fwmgb-ms01" user="system" verbose="true"; classpathref="weblogic.classpath" ; user="${weblogic.user}" password="${weblogic.password}" adminurl="t3://${weblogic.adminhost}:${weblogic.adminport}" source="dist/${app.name.war}" action="deploy"; message="Successfully Deployed ...

Lakdasun Trip Reports Archive » Kirigalpoththa Hike on 1st of January 2011

Lakdasun Trip Reports Archive » Kirigalpoththa Hike on 1st of January 2011

install Pulse- Audio Equalizer on Ubuntu 10.10

sudo add-apt-repository ppa:nilarimogard/webupd8 sudo apt-get update; sudo apt-get install pulseaudio-equalizer

Forwarding apache requests to Tomcat servlet container

Image
Most web applications todays are using favorite Apache web server for its proven architecture and free apache license. Tomcat is same as a very famous servlet container or java application server.  Although tomcat itself can be access as a simple web server, for production environments it may lack some features like load-balancing, redundancy, etc. So the best way to use is to integrate those two application, and finally its a great combination for enterprise applications for excess performance and ease of maintenance. The theory behind is to use a middle tier connector called mod_jk.so module which communicate using AJP(Apache JSer Protocol ) version 1.3, best of currently available stable version.See the following figure for graphical view. Here in this small steps guide i configure an Apache2 to a single instance of Tomcat6.Any comments and improvements are welcome at the end. installations: install apache2;Web server who list...