Recent Notes

Displaying keyword search results 1 - 10
Created by Dr. Xi on October 12, 2013 13:06:55    Last update: October 12, 2013 13:06:55
Generate the ssh keys: $ ssh-keygen -t rsa Generating public/private r... Convert the ssh public key to PEM format: $ cd .ssh ~/.ssh$ ssh-keygen -f mykey.pub -e -m...
Created by Dr. Xi on May 02, 2011 15:59:37    Last update: February 25, 2012 09:16:37
This code snippet gets the default keystore used by the Java keytool and displays the list of aliases along with the key type (certificate or private key). import java.io.File; import java.io.FileInputSt... The default keystore used by the above code is: $HOME/.keystore .
Created by Dr. Xi on February 06, 2012 12:14:11    Last update: February 07, 2012 15:39:35
Oracle sqlplus command line tools does not support command line editing out-of-the-box. But on Linux there's a handy utility that enables command line editing with any command line tool: rlwrap - readline wrapper. Install rlwrap: $ sudo apt-get install rlwrap Create a keywords file .sql.dict (optional, but convenient): false null true access add as asc begin by chec... It would be nice to add the tables names also. Create an alias for sqlplus (put it in .bashrc ): alias sqlplus='rlwrap -f $HOME/.sql.dict sqlplus'
Created by Fang on December 06, 2011 19:03:25    Last update: December 07, 2011 08:54:11
Our custom tag, as implemented in the previous note , is broken when a template is used. Create a template file ( home-template.xhtml ): <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Stric... and a test page that uses it ( home.xhtml ): <?xml version="1.0" encoding="UTF-8"?> <ui:comp... Then request the page with URL: http://localhost:8080/facelet-demo/home.jsf?name=Jack . You'll find that our hello tag works inside ui:repeat but fails to get the value defined by ui:param ! What's the problem? Our hello tag implementation evaluated the EL with the wrong EL context! This is the corrected implementation: package com.example; import java.io.IOExcep...
Created by Fang on October 28, 2011 13:49:40    Last update: October 30, 2011 19:23:25
This is a simple example to demonstrate the templating power of JSF facelets. If you've used struts tiles before, you'll recognize the simplicity of templating with facelets. I've stripped out everything else except the pages themselves, just to put our focus on facelets. This is a Maven based project, and you need Tomcat (or any servlet container) to run the resulting webapp. To begin with this is the list of files: ./pom.xml ./src/main/webapp/home.xhtml ./src... I left faces-config.xml in there for completeness sake, it may not be needed. The Maven POM ( pom.xml ): <?xml version="1.0" encoding="UTF-8"?> <project... Web app configuration ( WEB-INF/web.xml ): <?xml version="1.0" encoding="UTF-8"?> <web-app... Empty WEB-INF/faces-config.xml : <?xml version="1.0" encoding="UTF-8"?> <!-- Thi... index.jsp is simply a redirect to home.jsf : <% response.sendRedirect("home.jsf"); %>...
Created by freyo on September 07, 2011 16:46:14    Last update: September 07, 2011 19:23:00
The Android unit test framework is based on JUnit 3 , not JUnit 4. Test cases have to extend junit.framework.TestCase or a subclass (such as android.test.InstrumentationTestCase ). Tests are identified by public methods whose name starts with test , not methods annotated with @Test (as in JUnit 4). An Android test suite is packaged as an APK, just like the application being tested. To create a test package, first you need to identify the application package it is testing. Google suggests to put the test package source in a directory named tests/ alongside the src/ directory of the main application. At runtime, Android instrumentation loads both the test package and the application under test into the same process. Therefore, the tests can invoke methods on...
Created by freyo on April 12, 2011 15:13:32    Last update: May 03, 2011 15:20:55
Create new project $ tools/android create project \ > --package co... Edit res/values/string.xml , add strings for the main screen. <?xml version="1.0" encoding="utf-8"?> <resourc... Add widgets to main layout ( res/layout/main.xml ). <?xml version="1.0" encoding="utf-8"?> <LinearL... Edit src/com/android/apkinfo/GetAPKPermissions.java and change contents to: package com.android.apkinfo; import android... Install the debug package to the emulator: ant install The screen should look like: Add display permissions activity. Start by creating a new layout res/layout/display_permissions.xml : <?xml version="1.0" encoding="utf-8"?> <LinearL... Add the strings used by the new Activity ( res/values/strings.xml ): <?xml version="1.0" encoding="utf-8"?> <resourc... Add the Display Permissions Activity ( src/com/android/apkinfo/DisplayPermissions.java ): package com.android.apkinfo; import android... Change src/com/android/apkinfo/GetAPKPermissions.java to invoke the Display Permissions Activity: package com.android.apkinfo; import android... Declare Display Permissions Activity in AndroidManifest.xml : <?xml version="1.0" encoding="utf-8"?> <manifes......
Created by Dr. Xi on April 27, 2011 11:57:36    Last update: April 27, 2011 11:58:35
This is a sample struts-config.xml file for Struts 1.x . <?xml version="1.0" encoding="UTF-8"?> <!DO...
Created by freyo on April 18, 2011 15:08:21    Last update: April 18, 2011 15:12:20
Generate android project $ ~/android-sdk-linux_86/tools/android create proj... Create XML file res/xml/books.xml : <?xml version="1.0"?> <catalog> <book id=... Edit layout ( res/layout/main.xml ): <?xml version="1.0" encoding="utf-8"?> <Lin... Edit code ( src/com/android/xmlres/XMLResource.java ): package com.android.xmlres; import java.io.... Change activity label from app_name to booklist ( AndroidManifest.xml ): <?xml version="1.0" encoding="utf-8"?> <manifes... Add value for string resource ( res/values/string.xml ): <?xml version="1.0" encoding="utf-8"?> <resourc... Deploy and test: ant install
Created by Fang on March 23, 2010 03:50:11    Last update: August 18, 2010 21:59:52
This is a simple web application with a single servlet and a single JSP page. It is intended to be a test bed for JSTL tags. You may want to store all syntax, rules, and exceptions in your head, but in my opinion nothing beats a simple test program that allows you play with it all you want. So here it is (build with Maven ). Prerequisites: Maven: http://maven.apache.org/ . You don't need any prior knowledge of Maven, but you need to install the binary. JBoss: http://jboss.org/jbossas/downloads/ , or Tomcat: http://tomcat.apache.org/ if you don't run the SQL tests. You need to know how to deploy a web application (shh! Don't tell your boss it's just copying a file to the deployment folder). Steps: The directory...
Previous  1 2 Next