Categories
discuss

What’s a good JavaScript plugin color picker? [closed]

I make a lot of web applications and from time to time I need a color picker. What’s one that I can use like an API and doesn’t require a lot of code to plug in? I also need it to work in all browsers.

Answer

Farbtastic is a nice jQuery color picker

But apparently doesn’t work in IE6

Here is another jQuery color picker that looks nice, not sure about it compatibility though.

Categories
discuss

How can I open Java .class files in a human-readable way?

I’m trying to figure out what a Java applet’s class file is doing under the hood. Opening it up with Notepad or Textpad just shows a bunch of gobbledy-gook.

Is there any way to wrangle it back into a somewhat-readable format so I can try to figure out what it’s doing?

  • Environment == Windows w/ VS 2008 installed.

Answer

jd-gui is the best decompiler at the moment. it can handle newer features in Java, as compared to the getting-dusty JAD.

Categories
discuss

Formatting a long timestamp into a Date with JSTL

I am pulling a long timestamp from a database, but want to present it as a Date using Tags only, no embedded java in the JSP.

I’ve created my own tag to do this because I was unable to get the parseDate and formatDate tags to work, but that’s not to say they don’t work.

Any advice?

Thanks.

Answer

The parseDate and formatDate tags work, but they work with Date objects. You can call new java.util.Date(longvalue) to get a date object, then pass that to the standard tag.

somewhere other than the jsp create your date object.

long longvalue = ...;//from database.
java.util.Date dateValue = new java.util.Date(longvalue);
request.setAttribute("dateValue", dateValue);

put it on the request and then you can access it in your tag like this.

<fmt:formatDate value="${dateValue}" pattern="MM/dd/yyyy HH:mm"/>
Categories
discuss

How to make jQuery effects run in sequence, not simultaneously?

How do I have two effects in jQuery run in sequence, not simultaneously? Take this piece of code for example:

$("#show-projects").click(function() {
    $(".page:visible").fadeOut("normal");
    $("#projects").fadeIn("normal");
});

The fadeOut and the fadeIn run simultaneously, how do I make them run one after the other?

Answer

You can supply a callback to the effects functions that run after the effect has completed.

$("#show-projects").click(function() {
    $(".page:visible").fadeOut("normal", function() {
        $("#projects").fadeIn("normal");
    });
});
Categories
discuss

Dropdownlist width in IE

In IE, the dropdown-list takes the same width as the dropbox (I hope I am making sense) whereas in Firefox the dropdown-list’s width varies according to the content.

This basically means that I have to make sure that the dropbox is wide enough to display the longest selection possible. This makes my page look very ugly 🙁

Is there any workaround for this problem? How can I use CSS to set different widths for dropbox and the dropdownlist?

Answer

Here’s another jQuery based example. In contrary to all the other answers posted here, it takes all keyboard and mouse events into account, especially clicks:

if (!$.support.leadingWhitespace) { // if IE6/7/8
    $('select.wide')
        .bind('focus mouseover', function() { $(this).addClass('expand').removeClass('clicked'); })
        .bind('click', function() { $(this).toggleClass('clicked'); })
        .bind('mouseout', function() { if (!$(this).hasClass('clicked')) { $(this).removeClass('expand'); }})
        .bind('blur', function() { $(this).removeClass('expand clicked'); });
}

Use it in combination with this piece of CSS:

select {
    width: 150px; /* Or whatever width you want. */
}
select.expand {
    width: auto;
}

All you need to do is to add the class wide to the dropdown element(s) in question.

<select class="wide">
    ...
</select>

Here is a jsfiddle example. Hope this helps.

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..