Posts

string - Check if enum exists in Java -

Is it anyway to check whether a value exists by comparing a given string? I can not find any such work that I can try to use the valueOf method and catch the exception but I'v was taught that catching the runtime exception is not a good practice. Have any ideas? I do not think there is an underlying way without catching it is no exception. You can use something in return: public stable MyEnum asMyEnum (string str) {for (MyEnum me: MyEnum.values ​​()) {if (me.name () EqualsIgnoreCase (str)) me back; } Return tap; } Edit: As John Skeet notes, value () each time it is called when a private backing array Cloning works by. If performance is important, you can call value () only once, cache arrays, and iterate through it. In addition, if your enum has too many values, the map sketch map option is likely to perform better than any other move.

Is there any way to save an image an default.png programmatically on the iphone? -

I am writing an app for the iPhone and I will send an image to it as the default.png for the next blogging. Would like to save Is this possible? It seems that the sandbox does not allow you to overwrite anything in your local file system. No, you can not do this, it is possible to create a symbolic link in your documents folders. Then to rewrite the place that indicates it, but functionality was removed in 3.0. You need a bug with Apple to explain your needs.

plugins - Is it possible to type style sheets in Firebug fast and convenient ? (as in Aptana) -

For example, when I write the first brackets in Aptana, the second appears immediately, then I just need the press, it creates some white space, and I can type more a little feature That saves a lot of time! But this is not so in firebug. So, is it possible to use that feature in firebug? Is there a firebug plugin that allows to do this? Thank you in advance) I web for editing my CSS Developer plugin, while Firebug is good to test one or two things quickly, to remove styles from Firebug and back in your source file always seemed like a pain to me Web Developer Plugin (CSS -> Edit CSS), you can choose from your entire stylesheet Can see that it will be live live by. You can save your changes using the Save button, or copy everything that I do and paste it into my file. I know that this is not a "fancy" IDE, autocomplete or brace- With balance (it's like Notepad), but I can admit it is so good that it is far away to remove the obstruction and see the change ...

iphone - I am (also) having trouble making connections between code and Interface Builder -

I have only one question about this, but there is a better description of the problem. Using Inteface Builder (IB) I am unable to connect a button to the View Controller ("File Owner") in Apple's sample. It is only related to "first responder", yet somehow, the sample has completed it (see image). To keep it the other way, if I sample a movie player, open "Main Wando.xb" in IB and select "Button" and "My Movie View Controller" (see image) Delete the connection between the beaches, I'm unable to recreate that connection . I know that this should be a nasty question, but I would like to be incredibly grateful for anyone who can help me on this. In advance, Open the MyOverlayView and TabBarController This is connected to the IBAction on the view controller for the "Local" tab, to make it again: Open MyOverlayView and TabBarController Right-click on the round button in to bring MyOverlayView ...

jQuery tabs with both Ajax and static div's -

I am posting form data on a page that is using the jQuery tab because you post data to ajax query (With at least one ton of extra work and making it unsafe), I'm loading the active tab as the actual device on the page. & lt; Script type = "text / javascript" & gt; $ (Document) .ready (function () {$ ('# tab'). Tab ({selected: 3});}); & Lt; / Script & gt; & Lt; Div id = "tabs" style = "margin-top: 10px" & gt; & Lt; Ul & gt; & Lt; Li & gt; & Lt; A href = "myprofile.php" & gt; My profile & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "mycompany.php" & gt; My company & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "manageusers.php" & gt; Manage users & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#management" & gt...

java - Directed notifyAll() -

If I can do a question. Suppose that my main thread creates 3 threads. These 3 threads wait on a fixed object () Then inform the main thread to notify all the objects. How can I ensure with Thread 2, and only Thread 2, when notifications from Thread 1 and Thread 3 are ignored and come back in the waiting position? In short, how can I direct my notification to a selected thread? If I'm not mistaken, doing so in Java 5 would be very simple. Will create a different situation and the main thread will only satisfy the condition in which thread 2 is waiting. However, how would I solve it in pre5? Cheers, Vic You should keep in mind that threads without any notify without ease. So you always need some kind of condition. The common form of code is: synchronize (lock ob) {while (Condition!) {LockObj.wait (); }} Threads that perform specific actions may be due to performance due to just being awake. Consider this for java.util.concurrent.locks , but note that th...

win32 dll in C# .net -

Can # .net be used to create a win32 dll, if possible, someone should tell me how to To do? AFAIK, writing unmanaged code is not possible C #. You are stuck with C / C ++ You can, however, write COM components in C # that can be called from any Windows application.