Paul's Programming Notes     Archive     Feed     Github

PhoneGap Build - cordova-2.4.0.js

If you're using Phonegap Build, you don't need to include cordova-2.4.0.js or any other specific version of cordova/phonegap. Just use phonegap.js, but you don't actually need to include phonegap.js in the file you upload to Phonegap Build.

Quote from the Phonegap Build site:
"Once you've included the necessary assets, remove the phonegap.js (cordova.js) as Build will automatically inject it during compile time."

Sharepoint Lists Crashing

If your sharepoint lists crash IE as soon as they open, try disabling the following IE addons:
Sharepoint spreadsheet Launcher
Sharepoint export database~

Open File With Excel Macro


This macro will ask the user to input an excel file, then open that excel file:

Sub RunMacro()
   
Dim vaFiles As Variant
Dim i As Long

vaFiles = Application.GetOpenFilename _
         (FileFilter:="Excel Filer (*.xls),*.xls", _
         Title:="Open File(s)", MultiSelect:=False)

If Not IsArray(vaFiles) Then Exit Sub

With Application
    .ScreenUpdating = False
   
    For i = 1 To UBound(vaFiles)
        Workbooks.Open vaFiles(i)
    Next i
   
    .ScreenUpdating = True
End With

End Sub

Java - Swing's Nimbus Look & Feel

Since Java SE 6 Update 10, Java has had an updated interface called Nimbus. Comparison pictures are below.

All I needed to do to use it was add this import to the top of the .java file with my main() method: import javax.swing.UIManager.*;

And this code to the top of the main() method (http://stackoverflow.com/questions/4617615/how-to-set-nimbus-look-and-feel-in-main):

public static void main(String[] args) {
try {
    for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
            UIManager.setLookAndFeel(info.getClassName());
            break;
        }
    }
} catch (Exception e) {
    // If Nimbus is not available, fall back to cross-platform
    try {
        UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
    } catch (Exception ex) {
        // not worth my time
    }
}
new Controller();
}

Default:

Nimbus:

Note: This blog post says it is slightly slower than the default: http://www.pushing-pixels.org/2008/06/17/lightbeam-measuring-performance-of-swing-look-and-feels.html

Ljava.lang.String; Error

This is a simple one. You're asking java to return an Array as a string.

Solution: Put Arrays.toString( ) around your Array.

Jquery Slideup Jerking Effect In IE9

This website has code to help get rid of the jerking effect on Jquery SlideUp in IE9: https://siderite.dev/blog/jquery-slideup-flickers-in-internet.html

You just add this code after you include your Jquery library:

(function(){
// Define overriding method.
jQuery.fx.prototype.hide = function(){

// Remember where we started, so that we can go back to it later
this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
this.options.hide = true;

// Begin the animation
this.custom(this.cur(), 1);
}
})();

Raspberry Pi - No Ethernet Caused By Charger

I was using the following charger, but I couldn't get my Raspberry Pi to connect over Ethernet (ethernet lights showed no link): http://www.amazon.com/gp/product/B0038HYPZS

The charger was definitely the problem. I swapped it with a Motorola OEM charger and the Ethernet started working again. I did some quick googling, and haven't seen many reports of this issue yet. I have the Model B, Rev 2.0 board with 512MB RAM.