Recent Notes

Displaying keyword search results 91 - 100
Created by freyo on April 18, 2011 20:47:08    Last update: April 18, 2011 20:51:16
This is a step by step guide to get you started with Android development. It is not intended to be systematic. For that purpose, Google's Android Developer's Guide is the best choice. The purpose of this tutorial is to get you started with Android coding as quickly as possible, with the least amount of fuss. I believe that nothing beats hands on experience when you are learning a new thing. Preparations: Download and install the Android SDK. Make sure you download at least one Android platform and the SDK Platform-tools (step 4 of the installation guide). For the purposes of this tutorial, you don't need Eclipse. Download and install Apache Ant . First steps: Create an AVD (Android Virtual Device) Start the Android emulator with...
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 freyo on April 12, 2011 13:05:33    Last update: April 12, 2011 13:06:26
android:sharedUserId (from Android doc): The name of a Linux user ID that will be shared with other applications. By default, Android assigns each application its own unique user ID. However, if this attribute is set to the same value for two or more applications, they will all share the same ID — provided that they are also signed by the same certificate. Application with the same user ID can access each other's data and, if desired, run in the same process. Declare sharedUserId in AndroidManifest.xml : <manifest xmlns:android="http://schemas.android.co... Retrieve sharedUserId programmatically: import android.content.pm.PackageManager; impor...
Created by Dr. Xi on April 01, 2011 12:59:10    Last update: April 04, 2011 14:14:17
To configure Tomcat HTTP Basic Authentication with SSL: Configure web app for basic authentication (add these in web.xml ): <security-constraint> <web-resource-collec... Three elements are needed for this to work: security-constraint with the url-pattern to protect, login-config for the type of authentication method to use, and security-role for the role name(s) used in the security-constraint . Add login info to conf/tomcat-users.xml : <tomcat-users> <role rolename="testUserRole... Turn on SSL in conf/server.xml : <Connector port="8443" protocol="HTTP/1.1" SSLEnab... For default keystore file ${user.home}/.keystore , the keystoreFile attribute can be omitted. Otherwise, add keystoreFile="/path/to/keystore/file" . The setup is different if you are using APR .
Created by freyo on April 01, 2011 15:46:16    Last update: April 01, 2011 15:47:57
Follow these steps to build your first app that allows you to enter input and click a button: Start from the Hello World example. Edit res/layout/main.xml , change the contents to: <?xml version="1.0" encoding="utf-8"?> <LinearL... This adds a text input field and a button to the screen. It also declaratively binds an event handler ( onClick="sayHi" ) to the button. Add the string resources ( res/values/strings.xml ): <?xml version="1.0" encoding="utf-8"?> <resourc... Implement the event handler ( src/com/android/helloworld/HelloWorld.java ): package com.android.helloworld; import andr... Change the Activity label to Greeting ( AndroidManifest.xml ): <?xml version="1.0" encoding="utf-8"?> <manifes... Reinstall the debug package to the emulator: ant install The screen should look like this:
Created by Dr. Xi on March 24, 2011 12:11:14    Last update: March 24, 2011 12:22:03
This is the task: your client wants to know how the web application is used. That is pretty easy. A plethora of commercial tools or any of the free log analysis tools such as analog and AWStats would fit the bill. But here's the catch: they want to know not only what pages are visited by how many people and when, but also who logged in and did what. Your application is using form based authentication and therefore, everyone is anonymous in the web access log. What to do? This is a servlet filter that generates a web access log with authenticated user info that can be fed to log analysis tools such as analog and AWStats . Filter code (the output format is Apache...
Created by nogeek on March 21, 2011 15:31:26    Last update: March 21, 2011 15:32:35
Inventory list for configuring a JDBC data source in JBoss: Put *-ds.xml configuration file in server/yourServer/deploy , e.g., hsqldb-ds.xml Other needed files in server/yourServer/deploy : jboss-local-jdbc.rar , jboss-xa-jdbc.rar , jca-jboss-beans.xml , transaction-jboss-beans.xml Copy jboss-jca.deployer directory to server/yourServer/deployers Copy standardjbosscmp-jdbc.xml to server/yourServer/conf Make sure the following lines appear in server/yourServer/conf/jboss-service.xml <mbean code="org.jboss.ejb.plugins.cmp.jdbc.metada...
Created by magnum on March 02, 2011 19:38:41    Last update: March 02, 2011 19:38:41
Once you apply a filter to a URL pattern: <filter-mapping> <filter-name>theFilter</fi... there's no option in web.xml to exclude a more specific pattern such as: /public/* . But you can put the exclusion logic in the filter itself: <filter> <filter-name>theFilter</filter-nam... And in the filter code: public void init(FilterConfig cfg) throws ServletE...
Created by magnum on March 02, 2011 19:35:16    Last update: March 02, 2011 19:36:16
Two steps to configure a servlet filter in web.xml : Define the filter Apply the filter to a URL pattern and/or a servlet web.xml fragment: <!-- Declare the filter --> <filter> <fi...
Created by Dr. Xi on November 23, 2010 20:20:01    Last update: March 01, 2011 13:38:51
I tried to find a GZIP compression servlet filter to compress a large log file that we send down to the browser. Most of the implementations I found were overly complicated and many buggy. This is a simple implementation that worked for me. The filter: package filter.demo; import java.io.*; i... Config web.xml : <filter> <filter-name>gzipFilter</filte... The ugly anonymous inner class could have been avoided if the servlet API did not insist on ServletResponse.getOutputStream returning the bogus ServletOutputStream class (instead of the plain OutputStream ). Additional Note: In an earlier version of this filter, the gzip headers were added in doFilter , like this: // This is NOT good! if (supportsGzip) { ... It turned out that the ServletResponse methods sendError bypasses the gzip...
Previous  5 6 7 8 9 10 11 12 13 14 Next