Recent Notes

Displaying keyword search results 21 - 30
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 voodoo on March 04, 2011 12:11:33    Last update: April 13, 2011 13:55:13
By default SELinux blocks execstack permission. According to Ulrich Drepper : "As the name suggests, this error is raised if a program tries to make its stack (or parts thereof) executable with an mprotect call. This should never, ever be necessary. Stack memory is not executable on most OSes these days and this won't change. Executable stack memory is one of the biggest security problems. An execstack error might in fact be most likely raised by malicious code." You can check if a library/application requires execstack by using the execstack utility: execstack -q PATHTOPROGRAM You can try to clean the flag and see if the application still runs: execstack -c PATHTOPROGRAM To allow execstack for cc1 : # grep cc1 /var/log/audit/audit.log | audit2allow ...
Created by jinx on April 10, 2011 21:15:46    Last update: April 10, 2011 21:23:04
When developing in PHP, it's frustrating to have errors in the code but no error message displays. According to the PHP manual, the display_errors setting controls whether errors are displayed. You can either change it in php.ini : ; This directive controls whether or not and where... or set it in your code: <?php ini_set('display_errors', 'On'); fsdlf... But when you have syntax errors in your code, the ini_set function may not even get a chance to execute. So the only reliable way is to set it in php.ini : <?php // nothing gets displayed when display_er...
Created by Dr. Xi on March 02, 2011 11:39:18    Last update: March 09, 2011 12:19:30
Some peculiarities about Java PrintWriter: PrintWriter never throws any exceptions. From JavaDoc : Methods in this class never throw I/O exceptions, although some of its constructors may. The client may inquire as to whether any errors have occurred by invoking checkError(). When error occurs, you'll never know anything more than that it occured, because checkError returns boolean. When a character is out of the range of the character encoding of the PrintWriter, it prints a question mark (?). But this is not an error. Test code: import java.io.*; public class TestPrintWri... Latin1 test result: java TestPrintWriter iso-8859-1 | od -bc 000000... UTF-8 test result: java TestPrintWriter utf-8 | od -bc 0000000 141... Also, the constructor throws a FileNotFoundException when you try to write to a...
Created by Dr. Xi on January 31, 2011 16:14:06    Last update: January 31, 2011 16:14:06
Sometimes ClassCastException happens when apprently a class is casted to the same class or a parent class. The exception looks like this: java.lang.ClassCastException: X cannot be cast to ... where Y may be the same as X , or a parent class of X . The cause of this error is that X and Y are loaded by different class loaders. You can use the FindClass utility to find all occurances of X and Y in the deployment tree. If there's no duplication of X and Y in the deployment tree, JNDI lookups may be the culprit. Suppose X is loaded by class loader LX and registered under name jndi/Resource . In the context of another loader LY , your code may be looking up...
Created by James on January 10, 2011 16:37:20    Last update: January 10, 2011 16:37:20
The following page injects CSS rules with JavaScript. It works fine in Firefox and Chrome. <html> <head> <script type="text/javascrip... But in IE, it breaks with "Unknown runtime error" (seemed like it's trying to interpret the curly brackets in the CSS as JavaScript blocks!): In order to make it work in IE, the code need to be changed to: <html> <head> <script type="text/javascrip... The tricks to identify IE and insert new CSS rules came from Paul Irish .
Created by nogeek on August 02, 2010 15:24:58    Last update: August 02, 2010 15:24:58
Troubleshooting wifi connectivity is always a headache. I just spent 4 days fixing (actually, finding a workaround for) this problem. Everything worked fine when my PC is connected to a monitor. Then I switched display to my LCD TV with HDMI integrated sound and video. Then my wifi stopped working. The signal strength is perfect and I verified my password a million times (I'm using WPA-PSK). When I tried to connect, it simply fails. No error message, not even an error code! I suspected the HDMI integrated sound driver so I switched sound to the native Realtek driver, still no hope. Then I upgraded the wifi driver to the latest, it didn't help. Uninstalled and reinstalled the driver and rebooted, no difference. What was the...
Created by voodoo on July 11, 2009 15:14:55    Last update: July 29, 2010 22:45:48
cURL is a command line tool for transferring files with URL syntax. The main purpose and use for cURL is to automate unattended file transfers or sequences of operations. It's really easy to see HTTP headers with curl: C:\>curl --head http://www.google.com HTTP/1.0 ... or, headers and page together (dump headers to stdout): $ curl --dump-header - http://www.google.com HTTP/... Download openssl from openssl.org: curl http://www.openssl.org/source/openssl-0.9.6m.... C:\>curl --help Usage: curl [options...] <url> ...
Created by Dr. Xi on April 06, 2010 22:55:13    Last update: April 06, 2010 22:56:38
These are the steps to diagnose the "javax.jms.Destination found at the specified destination-location" error an MDB in the Oracle application server (oc4j) environment. The data source is correctly configured and connection can be successfully established. Test this from the Oracle AS em console. The destination queue exists and is started. If you are using PL/SQL Developer, you can check this by right clicking on the queue name and make sure that "Enqueue Enabled" and "Dequeue Enabled" are checked. Deployment descriptors are correctly set up. The database user used for the JDBC connection pool has the proper privileges to enqueue and dequeue. Usually this means that the database user is assigned the AQ_USER_ROLE . The ultimate test is to run some PL/SQL code in the oc4j...
Created by Dr. Xi on February 10, 2010 23:39:37    Last update: February 10, 2010 23:39:37
Example web.xml that includes most frequently used elements. This sample is for Servlet Specification 2.4. <?xml version="1.0" encoding="UTF-8"?> <web-ap...
Previous  1 2 3 4 Next