Can you hack it? Right Click Script

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 6 / 10)
Loading ... Loading ...

As my previous post Enable / Disable Right Click Script I mention how to disable and enable right click in a web browser. However i find out a script which is unable to hack it. Put below into your html code

<body oncontextmenu="return false">

For Example

<html><title>Can you hack the right click?</title>
<body oncontextmenu="return false">  
javascript:void(document.oncontextmenu=null)
<br>
<br>
Script above is not going to enable this back anymore, 
do you know how to hack it?
</body>
</html>

Please access here to try hack this script. If you know how enable it back, please inform me. Thanks

Enable / Disable Right Click Script

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 6 / 10)
Loading ... Loading ...

Sometime i really no idea why so many webmasters using disable right click to protect their own content. Here are two disable right click script i found from web

1) http://www.dynamicdrive.com/dynamicindex9/noright.htm

2) http://www.users.totalise.co.uk/~bigoleg/javascript/javascript_disable_right_click.html

Right click is mean less, because this is so easy to enable it back. Just copy following script and put into address bar of the browser. Right click will be enable again

javascript:void(document.oncontextmenu=null)

Even i do not have a script on hand, i also can “CTRL + U” or click View-> Page Source in Firefox to view the source code, ya it may be can stop some newbies to copy image but it is just no point to do it, this is so easy to hack.

Java Web Start (Jnlp) Tutorial - UnOfficial Guide

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (2 votes, average: 8.5 / 10)
Loading ... Loading ...

Here is a brief explanation about Java Web Start from SUN

“Java Web Start is a mechanism for program delivery through a standard Web server. Typically initiated through the browser, these programs are deployed to the client and executed outside the scope of the browser. Once deployed, the programs do not need to be downloaded again, and they can automatically download updates on startup without requiring the user to go through the whole installation process again.”

This Java Web Start (Jnlp) Tutorial - UnOfficial Guide will guide you to do following

1) Create a simple AWT program and jar it as TestJnlp.jar
2) Add keystroke into TestJnlp.jar
3) Create a Jnlp file
4) Put all into Tomcat Folder
5) Access TestJnlp.jar from web through http://localhost:8080/Test.Jnlp

1) Install Java JDK/JRE version above 1.5 and Tomcat

2) Create a simple Java AWT program, file structure as picture below

AWT Source code

package com.mkyong;
 
import java.awt.*;
import javax.swing.*;
import java.net.*;
import javax.jnlp.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
 
public class TestJnlp {
  static BasicService basicService = null;
  public static void main(String args[]) {
    JFrame frame = new JFrame("Mkyong Jnlp UnOfficial Guide");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JLabel label = new JLabel();
    Container content = frame.getContentPane();
    content.add(label, BorderLayout.CENTER);
    String message = "Jnln Hello Word";
 
    label.setText(message);
 
    try {
      basicService = (BasicService)
        ServiceManager.lookup("javax.jnlp.BasicService");
    } catch (UnavailableServiceException e) {
      System.err.println("Lookup failed: " + e);
    }
 
    JButton button = new JButton("http://www.mkyong.com");
 
    ActionListener listener = new ActionListener() {
      public void actionPerformed(ActionEvent actionEvent) {
        try {
          URL url = new URL(actionEvent.getActionCommand());
          basicService.showDocument(url);
        } catch (MalformedURLException ignored) {
        }
      }
    };
 
    button.addActionListener(listener);
 
    content.add(button, BorderLayout.SOUTH);
    frame.pack();
    frame.show();
  }
}

P.S If “import javax.jnlp.*;” not found, please include jnlp library which located at JRE/lib/javaws.jar.

3) Jar It , located to java class file folder and issue following command in command prompt

jar -cf TestJnlp.jar *.*

4) Same location, Add keystroke name “testkeys”

keytool -genkey -keystore testKeys -alias jdc

It will ask for keystroke password, first name, last name , organization’s unit…etc..just fill them all.

5) Same location, Attached newly keystroke “testkeys” to TestJnlp.jar file

jarsigner -keystore testKeys TestJnlp.jar jdc

It will ask password for your newly created keystroke

6) Copy TestJnlp.jar to tomcat default web server folder.

C:\Program Files\Apache\Tomcat 6.0\webapps\ROOT

7) Create Test.jnlp file to execute TestJnlp.jar.

<?xml version="1.0" encoding="utf-8"?> 
<jnlp spec="1.0+" codebase="http://localhost:8080/" href="Test.jnlp">
	<information>
		<title>Jnlp Testing</title>
		<vendor>YONG MOOK KIM</vendor>
		<homepage href="http://localhost:8080/" />
		<description>Testing Testing</description>
	</information>
	<security>
		<all-permissions/>
	</security>
	<resources>
		<j2se version="1.6+" />
		<jar href="TestJnlp.jar" />
	</resources>
	<application-desc main-class="com.mkyong.TestJnlp" />
</jnlp>

Configuration is quite simple, please change accordingly.

8 ) Copy Test.jnlp to tomcat default web server folder also.

C:\Program Files\Apache\Tomcat 6.0\webapps\ROOT

9) Start Tomcat

C:\Tomcat folder\bin\tomcat6.exe

P.S Latest Tomcat like version 6, it already configure jnlp in web.xml properly. If jnlp is not response, please add following statement in your web.xml which located in tomcat conf folder.

  <mime-mapping>
    <extension>jnlp</extension>
    <mime-type>application/x-java-jnlp-file</mime-type>
  </mime-mapping>

10) Access URL http://localhost:8080/Test.jnlp, download Test.jnlp and double click on it

11) It will run as following if everything go fine

11) If you want to execute it again, just double click on Test.jnlp that you downloaded just now, it is no need to visit http://localhost:8080/Test.jnlp again

12) Done

java.lang.UnsupportedClassVersionError: Bad version number in .class file

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 3 / 10)
Loading ... Loading ...

This is always cause by conflict between different Java JDK compiler and runtime. It very happened in IDE compiler like Esclipse or Netbean, Web Server like Tomcat, JBoss which set a different version in JAVA_HOME or CLASSPATH environment variable.

For Example,
I use a JDK1.5 to compile a class file, but i run in JDK1.6 runtime. It will cause

java.lang.UnsupportedClassVersionError: 
Bad version number in .class file

This is same with Web Server, we have to make sure we are using same JDK version to compile it and run it.

Firefox Top 10 shortcut keys

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 7 / 10)
Loading ... Loading ...

Here i provided top 10 Firefox shortcut keys that everyone is using it now ~

10) Text size too small on a website , i want to increase it

Shortcut : Ctrl + + (plus sign)
Action :  Increase text size

Increase too much , i want to decrease it again

Shortcut : Ctrl + - (minus sign)
Action : Decrease text size

Froget how many time i increase or decrease, please restore to default size

Shortcut : Ctrl + 0
Action : Restore normal text size

9) Wow.. pretty girl image and video i want enlarge my screen

Shortcut : F11
Action : Switch between full-screen/normal view

8 ) I remember i visited a very good website yesterday, but i didn’t bookmark it, i want it back

Shortcut : Ctrl + H
Action : Open/close the History pane

7) I want to show all websites i bookmark ~

Shortcut : Ctrl + B
Action : Open/close the Bookmarks pane

6) Wow..this website is great, i want my browser to remember it

Shortcut : Ctrl + D
Action : Add a bookmark (defaults to the active page)

5) I want a new tab ~

Shortcut : Ctrl + T
Action : Open a new tab in the current Firefox window

4) Too many tabs already, i want to close some

Shortcut : Ctrl + W
Action : Close current tab in the current Firefox window

3) Too many tabs and i want to close all….shut it down

Shortcut : ALT + F4
Action : Close current Firefox window

2) Too slow…. refresh…blink blink blink…

Shortcut : F5 / Ctrl + R
Action : Refresh

1) Hot…i used it everyday. Lazy ~ type google and below shortcut key ~

Shortcut : Ctrl + Enter
Action : Add “www.” to the beginning and “.com” to the end of the text in the Location bar

I still left one more, it is not consider as a shortcut, but i think everyone is using it everyday.. Click Click Click…too many sites or links to visit~

Shortcut : Ctrl + Left Mouse Click
Action : Open a new tab with website you clicked

If you want to know full Firefox shortcut keys , please visit following site http://support.mozilla.com/en-US/kb/Keyboard+shortcuts

Page Template dropdown missing in WordPress 2.5

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 4 / 10)
Loading ... Loading ...

Today i want to create a new page template for different display purpose, however after i created a new page template as following content

<?php
/*
Template Name: New Template
*/
?>

save it as “newtemplate.php” and uploaded to theme folder.

However when i want to create a new page and choose my newly created page template. I can not find any Page Template drop down in my WordPress 2.5, it will automatically display in WordPress version < 2.5 . What's wrong with version2.5? After try and error few time i find the following solution is work for me.

1) Design -> Theme Editor -> Page Template (page.php) (Default Page Template)

2)Append following code at top of the page.php (Template name can be anything)

<?php
/* 
Template Name: Default
*/
?>

3) Saved it.

4) Page template drop down is display in write page now.

I really do not know why this happened? Is this a bug in WordPress 2.5? No idea, however above solution is work for me. Hope Help.

How to install Tomcat in Ubuntu

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (2 votes, average: 6 / 10)
Loading ... Loading ...

Install Tomcat in Ubuntu is very easy. We can either install manually or with help of apt-get install.


Apt-get Install

1) Find a correct tomcat package to install

sudo apt-cache search tomcat

2) Install all Tomcat package with following command

sudo apt-get install tomcat5.5-webapps
sudo apt-get install tomcat5.5-admin
sudo apt-get install tomcat5.5

3) Done

apt-get help Ubuntu to configure almost everything and create a script put inside init.d folder for Tomcat auto startup script. we can start/stop/restart Tomcat with following command

/etc/init.d/tomcat5.5 start
/etc/init.d/tomcat5.5 stop
/etc/init.d/tomcat5.5 restart

apt-get help to create a share folder in /usr/share also, please access

cd /usr/share/tomcat5.5

and issue a ls -lh in /usr/share/tomcat5.5 to find out the rest of the Tomcat location.

drwxr-xr-x bin
drwxr-xr-x common
lrwxrwxrwx conf -> /etc/tomcat5.5
lrwxrwxrwx doc -> ../doc/tomcat5.5
lrwxrwxrwx logs -> /var/lib/tomcat5.5/logs
drwxr-xr-x server
lrwxrwxrwx shared -> /var/lib/tomcat5.5/shared
lrwxrwxrwx temp -> /var/lib/tomcat5.5/temp
lrwxrwxrwx webapps -> /var/lib/tomcat5.5/webapps
lrwxrwxrwx work -> /var/lib/tomcat5.5/work


Manually Install


This is even more easy that apt-get

1) Visit http://tomcat.apache.org/ to download Tomcat

2) Unzip it with tar -zxvf Tomcatxxx.tar

tar -zxvf apache-tomcat-6.0.16.tar.gz

3) No make or configuration required, just change to tomcat bin folder to start or stop Tomcat

:~/Desktop/apache-tomcat-6.0.16/bin$ sh startup.sh
:~/Desktop/apache-tomcat-6.0.16/bin$ sh shutdown.sh

4) Done

Personally i more prefer to install application manually, because it give full control of where application folder should be store.

Find a package with Apt command - Ubuntu

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 4 / 10)
Loading ... Loading ...

apt-get install is a useful command in Ubuntu, it can help user easily install application, it just like yum in fedora core.however, sometime we do not know exactly what package name to be install. Here is apt-cache search come to place and solve it. We can search a package name available to install with following command

sudo apt-cache search <package-name>

For example, i want to install java sdk in Ubuntu, but i do not know the exatly package name to install, i can issue following command to search “java sdk”.

sudo apt-cache search java sdk

Got it, just install it with following command

sudo apt-get install sun-java6-sdk

Digg Digg Wordpress Plugin

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (5 votes, average: 9 / 10)
Loading ... Loading ...

This is a very simple digg button plugin. This plugin is use to add digg button into wordpress content. Just like how it look like in this website.

Features
Add Digg Button Into Wordpress Content

31/07/2008 Updated
Setup screen (Setting–>DiggDigg) to let user choose where user want to display Digg button.

Four template provided
1)Left Float Content
2)Right Float Content
3)Before Content
4)After Content

Download Here
http://www.mkyong.com/download/digg-digg.zip

How to Install
Copy Digg Digg plugin folder to wordpress plugin folder and activate it.

How to use

Add Digg button with prefix template
1) After activated, click “setting –> Digg Digg” to access Digg Digg setup screen.
2) Choose where you want Digg button to display in post content
3) Saved.

Add Digg button to anywhere you like
Add following code to where you want digg vote button to display. like Single Post (single.php)

<?php if(function_exists(’digg_digg_generate’)) { digg_digg_generate(); } ?>

For example, below is code that use in this website

<div style=”float:right”>
<?php if(function_exists(’digg_digg_generate’)) { digg_digg_generate(); } ?>
</div>

Here a sample of my single.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php get_header(); ?>
 
<div id="content">
  <div class="postwrap">
    <?php if (class_exists('bcn_breadcrumb'))
{ echo '<div class="breadcrumb">';
// New breadcrumb object
$mybreadcrumb = new bcn_breadcrumb;
// Assemble the breadcrumb
$mybreadcrumb->assemble();
// Display the breadcrumb
$mybreadcrumb->display(); echo '</div>';
} ?>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <div class="post" id="post-<?php the_ID(); ?>">
      <div class="posthead">
        <h1>
           <a title="<?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark">
            <?php the_title(); ?>
           </a>
          <br><br>
           <?php if(function_exists("gltr_build_flags_bar")) { gltr_build_flags_bar(); } ?>
        </h1>
        <small class="postauthor">Posted by
        <?php the_author() ?>
        <?php edit_post_link('Edit'); ?> 
        </small>
        <?php if(function_exists('the_ratings')) { the_ratings(); } ?>
        <p class="postdate"> <small class="month">
          <?php the_time('M') ?>
          </small> <small class="day">
          <?php the_time('j') ?>
          </small> </p>
      </div>
 
 
 
      <div class="postcontent">
         <div style="float:right">
          <br>
         <?php if(function_exists('digg_digg_generate')) { digg_digg_generate(); } ?>
         </div>
        <?php the_content('Read the rest of this entry &raquo;'); ?>
        <?php if(function_exists('the_ratings')) { the_ratings(); } ?>
      </div>
 
      .................

If you have any idea , please share it to me if you do not mind.

Tomcat 5.5.25 is suck… Give Up

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 4 / 10)
Loading ... Loading ...

Ah………After upgraded to Tomcat 5.5.25, i just feel suck, it cause so many errors in my web applications, which didnt happened in my previous Tomcat 5.5.23 deployment.

For Example

1) java.security.AccessControlException: access denied (logging.properties read)


2) java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)

3) Caused by: org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Something unusual has occured to cause the driver to fail. Please report this exception.)
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Something unusual has occured to cause the driver to fail. Please report this exception.)

I decided to give up Tomcat 5.5, and install Tomcat 6.x. Great my web application deployed without any error at Tomcat6.x. So Just said sorry to Tomcat 5.5.25…cause you are to difficult to configure for me ~