Categories
discuss

jQuery, Animate opacity to 1 then remove the opacity property to make it better looking on IE

I tried the jQuery fadeIn animation in all browsers and it work good, but not that much on IE. the Alpha png images are so creepy after appending the CSS opacity, but i have an idea and i don’t know how to implement it using jQuery.

The idea is to fadeIn the element and when the animation is finished it will automatically remove the opacity property in order to make the picture quality better.

How to do that?

Note: i’m using Animate and not FadeIn.

Thanks

Answer

You can do this:

$(selector).animate({opacity: 1}, function() {
  $(this).get(0).style.removeAttribute('filter');
});

The filter IE uses is what causes ClearType to basically turn off. Remove that style attribute after the fade completes like the code above to restore ClearType to working order. You can also find replacement fadeIn(), fadeOut() and fadeTo() methods that deal with this issue here: http://malsup.com/jquery/fadetest.html

Categories
discuss

How to get the path to the lib folder for an installed package

Shared libraries .so files are placed in lib/armeabi in an apk file.

I have read after installation the libs gets extracted to /data/data/application_package/lib

How can I get the exact path to this directory in my application at run time? Is this directory readable by the application? Or is only executeable access allowed? If it is readable – Is this still true for copy protected applications?

Answer

You can get the exact path with:

String libraryPath = getContext().getApplicationInfo().dataDir + "/lib";

The directory and its files are readable by the application.

The unix permissions are set to rwxr-x--x. So applications with the same group can read the files.

Categories
discuss

Why can’t this SimpleDateFormat parse this date string?

The SimpleDateFormat:

SimpleDateFormat pdf = new SimpleDateFormat("MM dd yyyy hh:mm:ss:SSSaa");

The exception thrown by pdf.parse("Mar 30 2010 5:27:40:140PM");:

java.text.ParseException: Unparseable date: "Mar 30 2010 5:27:40:140PM"

Any ideas?


Edit: thanks for the fast answers. You were all correct, I just missed that one key sentence in the SimpleDateFormat docs – I should probably call it a day.

Answer

From SimpleDateFormat javadocs:

Month: If the number of pattern letters is 3 or more, the month is interpreted as text; otherwise, it is interpreted as a number.

Try to use pattern like “MMM dd yyyy”

Categories
discuss

Java: equivalent to C’s strnicmp? (both startsWith and ignoreCase)

 String string1 = "abCdefGhijklMnopQrstuvwYz";
 String string2 = "ABC";

I had been using string1.startsWith(string2), which would return false in the above example, but now I need to ignore case sensitivity, and there is not a String.startsWithIgnoreCase().

Besides doing

 string1.toLowerCase.startsWith(string2.toLowerCase());

is there an efficient way to see if string1 starts with string2 in a case-insensitive way?

Answer

The regionMatches method has a case sensitive parameter.

Categories
discuss

Glassfish OpenSSO instructions (where to download OpenSSO)?

According to the tutorial, I should go to OpenSSO and download an “express build”. However, the download links on the OpenSSO site for the “Express Build 7” appear to require logging in via an account with a paid support contract.

How can one currently download the OpenSSO wars?

Answer

You may want to try OpenAM.

I also noticed this.. http://download.java.net/general/opensso/webstartnew/ which will download the bits for testing. And guess what… there is an opensso.war and the like ‘in there’ that were produced about the same time as the tutorial was written.

Source: stackoverflow
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Privacy Policy, and Copyright Policy. Content is available under CC BY-SA 3.0 unless otherwise noted. The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 © No Copyrights, All Questions are retrived from public domain..