Displaying keyword search results 31 - 40
Created by Dr. Xi on July 14, 2011 09:28:57 Last update: July 14, 2011 09:28:57
Java arrays are fixed size, so you have to make a new array with smaller size and copy the data. For JDK6 and above:
// import java.util.Arrays; newArray = Arrays.c...Before that (using Object as example):
Object newArray = new Object [newSize] ; Syst...
Created by woolf on July 04, 2011 10:16:11 Last update: July 04, 2011 12:09:44
The following procedure will clear out the NVRAM and set dd-wrt back to default values: With the unit powered on, press and hold the reset button on back of unit for 30 seconds Without releasing the reset button, unplug the unit and hold reset for another 30 seconds Plug the unit back in still holding the reset button a final 30 seconds This procedure should be done before and after every firmware upgrade/downgrade. The firmware writes information to the Nvram . A hard reset clears that information. If you don't clear it properly, parts of the old information be present with the new firmware, which can make it not operate properly.
Created by woolf on June 25, 2011 10:55:08 Last update: June 25, 2011 10:57:15
My C drive was seriously fragmented with about 20% free space. So I ran the built-in Windows disk defrag utility. To my surprise it doesn't work at all! I tried to defragment multiple times and every time it comes back without doing much work. Then I realized that perhaps it didn't know how to get the job done and needed some help. Here's the list of things I did to help the defragmentor out: Relocate the paging file to a different drive and reboot. If the paging file ( pagefile.sys ) is seriously fragmented, it can't be defragmented, and in turn it blocks other files from being defragmented. If you only have one drive (C:), try to make it smaller or eliminate it entirely for...
Created by magnum on June 23, 2011 13:44:21 Last update: June 23, 2011 13:59:26
Fedora/Redhat List current status (for httpd):
# chkconfig --list httpdWarning: this works only when one of /etc/rc runlevel .d/ K NN name or /etc/rc runlevel .d/ S NN name exists. It exports wrong status when both K and S scripts exist (in which case the status should be enabled). Enable sshd for run levels 2, 3, 5:
# chkconfig --level 2,3,5 sshd onDisable sshd for run levels 2, 3, 5:
# chkconfig --level 2,3,5 sshd offBy default, the on and off options affect only runlevels 2, 3, 4, and 5. Debian/Ubuntu Add apache2 with defaults :
# update-rc.d apache2 defaultsIf defaults is used then update-rc.d will make links to start the service in runlevels 2, 3, 4, 5 and to stop...
Created by freyo on June 10, 2011 07:30:24 Last update: June 10, 2011 07:31:41
Makefile to put a pre-built APK in the system image.
include $(CLEAR_VARS) LOCAL_MODULE := YouTu...
Created by freyo on June 09, 2011 15:52:12 Last update: June 09, 2011 15:52:30
Follow these steps to add a device administrator application to Android, i.e., make the application appear in the "Select device administrators" screen (Settings -> Location & Security -> Select device administrators): Add a receiver in AndroidManifest.xml :
<receiver android:name="android.app.admin.DeviceAd...All elements and attributes listed above are needed. The attribute android:description must be a string resource, not a literal string. The meta-data element points to an XML resource. Create the meta-data resource res/xml/admin_app_resource.xml :
<device-admin xmlns:android="http://schemas.androi...Define values for string resources ( res/values/strings.xml ):
<?xml version="1.0" encoding="utf-8"?> <resourc...
Created by freyo on June 08, 2011 09:06:49 Last update: June 08, 2011 09:07:49
The built-in Calculator application has a jar file dependency ( Android.mk ):
LOCAL_PATH := $(call my-dir) include $(CLEAR_VA...So we can just copy that and: Change libarity to libmydependency Change arity-2.1.2.jar to mydependency-10.3.4.jar Add libmydependency to build/core/user_tags.mk , next to libarity
Created by alfa on June 02, 2011 15:26:37 Last update: June 02, 2011 15:26:37
While doing some Java reflection code, I noticed the method Class.isSynthetic() , which the JavaDoc says returns " true if and only if this class is a synthetic class as defined by the Java Language Specification". However, there's no definition of "synthetic class" in the JLS ! The only thing that I can find that remotely resembles a definition is in the JVM spec , where it defines the synthetic attribute : "The Synthetic attribute is a fixed-length attribute in the attributes table of ClassFile (§4.1), field_info (§4.5), and method_info (§4.6) structures. A class member that does not appear in the source code must be marked using a Synthetic attribute." By this definition, a default constructor, which does not appear in the source code, should...
Created by alfa on May 24, 2011 14:51:29 Last update: May 24, 2011 14:51:29
The following code generates warning "warning: [unchecked] unchecked call to getMethod" when compiled:
Class c = Class.forName("MyClass"); Method m = ...This is because the method getMethod is parameterized , while the variable c is not parameterized. There are two ways to eliminate this warning: Make c parameterized:
Class<?> c = Class.forName("MyClass"); Meth...Suppress the warning with annotation:
Class c = Class.forName("MyClass"); @SuppressWa...
Created by freyo on May 16, 2011 12:13:34 Last update: May 16, 2011 12:17:17
By Android documentation , odex files are "Optimized DEX" files, which can be created in at least three different ways: The VM does it "just in time". The output goes into a special dalvik-cache directory. This works on the desktop and engineering-only device builds where the permissions on the dalvik-cache directory are not restricted. On production devices, this is not allowed. The system installer does it when an application is first added. It has the privileges required to write to dalvik-cache . The build system does it ahead of time. The relevant jar / apk files are present, but the classes.dex is stripped out. The optimized DEX is stored next to the original zip archive, not in dalvik-cache , and is part of the system...