Recent Notes

Displaying notes 41 - 50
Created by James on January 16, 2012 10:05:10    Last update: January 16, 2012 10:06:13
There are two ways to get the submit button: Use the :submit selector (note the space between the form name and :submit ): $('#the-form-id :submit') Use attribute selector (also, space between form id and attribute selector): $('#the-form-id [type="submit"] ') // or $(... jQuery recommends the latter if you are concerned about performance: Because :submit is a jQuery extension and not part of the CSS specification, queries using :submit cannot take advantage of the performance boost provided by the native DOM querySelectorAll() method. For better performance in modern browsers, use [type="submit"] instead.
Created by lokf on January 13, 2012 14:10:42    Last update: January 13, 2012 14:10:42
For some reason I don't know writing to files in Android is very complicated and tedious. Here is some code for those who might need it. Apps should write in the SD in the directory /Android/data/package_name/files/ so that it is deleted with the app uninstall. package randomname; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.nio.ByteBuffer; import android.content.Context; import android.os.Environment; import android.util.Log; public class FileIOLibrary { String packageName; boolean mExternalStorageAvailable = false; boolean mExternalStorageWriteable = false; FileIOLibrary(String packageNamep) { this.packageName=packageNamep; } public boolean isExternalStorageAvailable() { updateExternalStorageState(); return mExternalStorageAvailable; } public boolean isExternalStorageWritable() { updateExternalStorageState(); return mExternalStorageWriteable; } /** * writes the current state of SD card to the corresponding variables */ void updateExternalStorageState() {...
Created by Dr. Xi on January 09, 2012 09:13:38    Last update: January 09, 2012 09:14:18
Unlike CVS, svn does not have a tag command, you create a new tag with copy : $ svn copy http://svn.example.com/repos/calc/trunk... The -r flag may be used to create a tag from an earlier revision: -r [--revision] ARG : ARG (some commands al...
Created by Dr. Xi on January 06, 2012 14:02:09    Last update: January 06, 2012 14:02:09
In Java, the OS temporary directory is identified by the system property java.io.tmpdir : public class TmpDir { public static void ma...
Created by Dr. Xi on January 06, 2012 13:44:55    Last update: January 06, 2012 13:44:55
To exclude CVS directories: grep -R -l --exclude-dir=CVS 'string_to_find‘ src ... To exclude .svn directories: grep -R -l --exclude-dir=.svn 'string_to_find‘ src...
Created by torstello on January 06, 2012 07:32:25    Last update: January 06, 2012 07:32:25
rdoc documentation: usage(*args) Display usage information ... put something like this on top of your script: # == Synopsis # Blah blah blah. # ... method to display it def output_usage RDoc::usage('usa... bind it to the '-h' option via optionparser opts.on('-h', '--help') { output_help } ... source http://blog.toddwerth.com/entries/5
Created by Dr. Xi on January 04, 2012 16:28:27    Last update: January 04, 2012 16:28:27
Steps to enable SSI (Server Side Include) in Apache HTTPD: Enable mod_include . In httpd.conf , update directive: AllowOverride Options FileInfo In .htaccess : Options +Includes AddType text/html .shtml A... Files with extension .shtml will be processed with SSI. You may want to enable mod_cgi to include output from CGI programs: <!--#include virtual="/cgi-bin/counter.pl" --> To control caching : Use the XBitHack Full configuration. This tells Apache to determine the last modified date by looking only at the date of the originally requested file, ignoring the modification date of any included files. Use the directives provided by mod_expires to set an explicit expiration time on your files, thereby letting browsers and proxies know that it is acceptable to cache them.
Created by Fang on January 04, 2012 11:44:15    Last update: January 04, 2012 11:44:15
With this markup: <h:outputText value="#{msg.name}:"/> <h:inputTe... the validation message looks like this: j_id1283414979_4c7f5b98:name: size must be between... Add label attribute to get rid of the ugly field name: <h:outputText value="#{msg.name}:"/> <h:inputTe...
Created by Fang on January 04, 2012 11:14:46    Last update: January 04, 2012 11:14:46
Assume that your messages are defined in MessageResources.properties , this is how you load and use the messages: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Stric... In MessageResources.properties : pageTitle = JSF Resource Bundle Example page.he...
Created by Fang on January 04, 2012 09:54:05    Last update: January 04, 2012 09:54:05
There are two ways to validate a form with JSF: jsf validation on the page with <f:validate...> tags (for example: <f:validateLength> , <f:validateRegex> , etc.), or JSR303 bean validation. This note is about how to customize messages for JSR303 bean validation. The validation message is specified in the message attribute for each validation annotation type. The mesage attribute is not a literal string, but a string that is interpolated in various ways. For example, the default validation message for AssertFalse is {javax.validation.constraints.AssertFalse.message} , which is replaced with the corresponding string in ValidationMessages.properties (or ValidationMessages_tr.properties , ValidationMessages_es.properties , depending on the locale). This is the contents of ValidationMessages.properties in the hibernate validator reference implementation: javax.validation.constraints.AssertFalse.message =... To customize the messages, just provide the new value in...
Previous  1 2 3 4 5 6 7 8 9 10 Next