Jump to content


Check out our Community Blogs

thechef

Member Since 22 Dec 2009
Offline Last Active Jun 20 2012 08:09 PM
-----

#625918 How to unauthorise parameter passing through URL as in GET?

Posted by thechef on 08 April 2012 - 11:03 AM

Calling "request.getMethod()" will tell you the HTTP method used, i.e. GET, POST, PUT, etc.
  • 1


#625905 Speed Up Algorithm

Posted by thechef on 08 April 2012 - 09:18 AM

I'd say 99% of timeout errors are due to an insufficient algorithm not subtleties in the code. To speed this up, you need to look at your while loop. It looks at every single letter of word "T" for every word "W", making it an order N-squared algorithm. Think about parsing word "T" into a tree structure that alphabetizes its nodes. Then, for each letter in word "W", you can easily find if the letter is in "T". Here is an example for a T of "AARDVARK":

A -> A -> A -> K
A -> A -> A -> R
A -> A -> D ...
A -> A -> K ...
A -> A -> R ...
A -> A -> V ...
A -> D -> A ...
A -> D -> K
A -> D -> R ...
A -> D -> V ...
A -> K
A -> R ...
A -> V ...

I'll let you fill in the rest. Now, finding a letter is order log(N) because the letters are ordered, and your algorithm takes almost half as much time.

I hope that makes sense, and happy coding!
  • 1


#625895 AuthenticationFailedException :((

Posted by thechef on 08 April 2012 - 04:32 AM

Have you seen this tutorial? It looks like they use a password authenticator to abstract their username and password.

http://www.mkyong.co...l-smtp-example/
  • 1


#625894 Is there a way to open a url trough proxy

Posted by thechef on 08 April 2012 - 04:19 AM

It looks like you have to set a couple system properties, as in:
Properties props = System.getProperties();
props.put("http.proxyHost", "proxyhostname");
props.put("http.proxyPort", "proxyhostport");

Happy coding!
  • 1


#550152 high school programming quiz help

Posted by thechef on 01 April 2010 - 03:13 PM

Actually, #5 is valid because of order of operation. The multiplication is done before the division, so it works out to being (1 + (2*3) / 2) which is 4. You are right about the teacher though; he/she needs to do a little debugging on her tests before just throwing them out there, hoping nobody will notice.
  • -1


#547320 Starting out

Posted by thechef on 16 March 2010 - 08:51 PM

Gumbi, don't worry about your age. I pretty much didn't start until college (19 yrs). I have to work a lot harder than the people who started at 12, but at the end of the day I don't think it matters. As far as books go, you can probably get about anything to teach you the basics of a language. There are a ton of good online references for that. For higher-level programming strategies, I have Code Complete 2 by Steve McConnell that is a pretty good resource.

Good luck coding!
  • -1


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download