|
Otto Skorzeny posted:Oh hurr mental parse failure For 1.6 it's working: "testing split".split("\\W"). Here's what I would use to parse your special stuff, bet it'll get just about everything: myString.split("[^\\w'-]");
|
# ? Mar 15, 2010 21:14 |
|
|
# ? May 3, 2024 03:46 |
|
Thanks guys. I think I'm just going to have to roll my own "grammar," string parser, or whatever you want to call it. Time to convert javascript into java. If I steal your code I'll leave you in a comment "GOON GRAMMAR IS THE GREATEST"
|
# ? Mar 15, 2010 21:15 |
|
ToastedZergling posted:Thanks guys. I think I'm just going to have to roll my own "grammar," string parser, or whatever you want to call it. Time to convert javascript into java. A grammar is something separate from regular expressions, although they use some similar concepts. For an example, see the right sidebar on http://json.org , which contains the grammar describing JSON.
|
# ? Mar 15, 2010 21:19 |
|
ToastedZergling posted:tldr; I prefer leveraging existing frameworks than writing custom parsing I doubt there's such a thing, here are a couple of reasons: Yahoo! Mail: The best web-based email! .NET Rocks! - My .NET Story E*TRADE del.icio.us Mercedes-Benz Fake edit: good luck
|
# ? Mar 15, 2010 21:19 |
|
I am in posted:I doubt there's such a thing, here are a couple of reasons: *cries* These are some great edge cases to think about. But it's a good thing we're dealing with medical terms and not too many wacky brand names.
|
# ? Mar 15, 2010 21:27 |
fletcher posted:Why does this work fine the first time, but subsequent calls give me the "you must be a registered user to view this page..." Bump! This is driving me nuts!
|
|
# ? Mar 16, 2010 21:29 |
|
fletcher posted:Bump! This is driving me nuts! Can't answer your actual question, but I wrote a scraper-type thing using WebDriver: http://code.google.com/p/selenium/wiki/GettingStarted
|
# ? Mar 16, 2010 21:50 |
|
fletcher posted:Bump! This is driving me nuts! I looked at the cookie that is sent with Firebug. These keys have values: sessionid, __utma, aduserid, bbuserid, bbpassword and sessionhash. Try to catch them all from your browser and see if it works. It's hard to say why it works the first time without knowing the internals of the forums software.
|
# ? Mar 16, 2010 23:24 |
I am in posted:I looked at the cookie that is sent with Firebug. These keys have values: sessionid, __utma, aduserid, bbuserid, bbpassword and sessionhash. I was doing it before in PHP with just the bbuserid and bbpassword so I don't think that's the issue. I'm trying to do this on Google App Engine now. fletcher fucked around with this message at 00:11 on Mar 17, 2010 |
|
# ? Mar 16, 2010 23:45 |
|
I'm trying to run a program (.exe) from inside Java, and read its results, but Java is getting completely different results from cmd.exe. cmd.exe gets the correct results. The program takes in a string and an int and hashes the first X characters. Using cmd: Z:\>hashlittle.exe a 1 58d68708 Java gets "8ba9414b" instead. Help? code:
Z:\>hashlittle.exe a 0 deadbeef Java gets "31b8a510". Edit: It works now. I don't know where or how I fixed it. Oh, except that I'm using a different compilation of the hashlittle file. Z:\>hashlittle.exe a 1 58d68708 Z:\>hashlittleB.exe a 1 58d68708 But hashlittleB.exe works in Java and hashlittle.exe doesn't. Malloc Voidstar fucked around with this message at 05:45 on Mar 17, 2010 |
# ? Mar 17, 2010 04:54 |
|
fletcher posted:Why does this work fine the first time, but subsequent calls give me the "you must be a registered user to view this page..." I can't seem to reproduce the issue just invoking that method from a test program.
|
# ? Mar 17, 2010 06:06 |
|
Otto Skorzeny posted:A grammar is something separate from regular expressions, although they use some similar concepts. Not entirely separate, since one is a subset of the other.
|
# ? Mar 17, 2010 06:23 |
|
Could anyone recommend to me a way to send SMS messages using java? So far I see that I can get a GMS modem or use a web service that java can access, or a java library that uses a web service or hell I don't know. These are things I learned from google, and there are many .jars out there that claim to be the best at sending sms.
|
# ? Mar 18, 2010 19:35 |
|
Kaltag posted:Could anyone recommend to me a way to send SMS messages using java? So far I see that I can get a GMS modem or use a web service that java can access, or a java library that uses a web service or hell I don't know. These are things I learned from google, and there are many .jars out there that claim to be the best at sending sms. Most companies have a email drop that works for sending SMS messages. Just send an email to the persons mailbox and it will get sent to their phone. There are other more in depth ways, but that one works surprisingly well.
|
# ? Mar 18, 2010 19:51 |
|
HFX posted:Most companies have a email drop that works for sending SMS messages. Just send an email to the persons mailbox and it will get sent to their phone. There are other more in depth ways, but that one works surprisingly well. This is the easiest way to go. From: http://www.makeuseof.com/tag/email-to-sms/ Free Email To SMS Gateways (Major US Carriers) Carrier Email to SMS Gateway Alltel [10-digit phone number]@message.alltel.com Example: 1234567890@message.alltel.com AT&T (formerly Cingular) [10-digit phone number]@txt.att.net [10-digit phone number]@mms.att.net (MMS) [10-digit phone number]@cingularme.com Example: 1234567890@txt.att.net Boost Mobile [10-digit phone number]@myboostmobile.com Example: 1234567890@myboostmobile.com Nextel (now Sprint Nextel) [10-digit telephone number]@messaging.nextel.com Example: 1234567890@messaging.nextel.com Sprint PCS (now Sprint Nextel) [10-digit phone number]@messaging.sprintpcs.com [10-digit phone number]@pm.sprint.com (MMS) Example: 1234567890@messaging.sprintpcs.com T-Mobile [10-digit phone number]@tmomail.net Example: 1234567890@tmomail.net US Cellular [10-digit phone number]email.uscc.net (SMS) [10-digit phone number]@mms.uscc.net (MMS) Example: 1234567890@email.uscc.net Verizon [10-digit phone number]@vtext.com [10-digit phone number]@vzwpix.com (MMS) Example: 1234567890@vtext.com Virgin Mobile USA [10-digit phone number]@vmobl.com Example: 1234567890@vmobl.com
|
# ? Mar 22, 2010 07:03 |
|
Surface posted:Free Email To SMS Gateways (Major US Carriers) These work with varying levels of success, so I'm not sure if I'd depend on them for anything critical. I've been generalizing the e-mail notification mechanism on the server I work on to provide different kinds of notifications, like SMS and Twitter. I tested out the e-mail->SMS gateway using my number on AT&T and the messages I sent were either completely lost or arrived 12 hours later. I think what we're going to end up doing is using some of the sample code out there that sends post requests directly to Google Voice (since it lacks a real API) to send text messages through that. It didn't appear that there was anything in the TOS preventing it.
|
# ? Mar 22, 2010 13:36 |
|
Would something like this be any use to you? http://www.bulksms.com/ There's a few companies that do this sort of thing, this one has various methods for sending the texts including an actual API.
|
# ? Mar 22, 2010 15:26 |
|
chippy posted:Would something like this be any use to you? We use these guys at work. They're very good, but their API doesn't quite do everything we need so we've had to cut some corners.
|
# ? Mar 22, 2010 15:49 |
|
I'd like to get better with Tomcat in general and am looking for a few webapps that I could configure as part of the process, to spark more interest. Things like, cacti/mtrg, streaming audio/video, or xbmc/file sharing (Note: These are just guidelines so don't necessarily take them literally.) Something for the experience of setting it up and getting it running without getting bored to tears along the way.
|
# ? Mar 23, 2010 01:02 |
|
I don't want to have to know what carriers my targets are using. I also don't want to use anything "free" lest my customers get loving ads or end up on a mailing list. Also, security is an issue. I actually found http://www.message-media.com/ and they had a fairly simple api I was able to import to eclipse and I talked to their sales people and got 50 free texts to test with. I guess later you end up buying bulk once your poo poo hits mainstream. As the program I am working on gets more serious we'll probably just start integrating a gsm modem and proper provider.
|
# ? Mar 23, 2010 14:57 |
Is there a way to check and see if anything has been written to a HttpServletResponse?
|
|
# ? Mar 26, 2010 08:59 |
|
fletcher posted:Is there a way to check and see if anything has been written to a HttpServletResponse? isCommintted() may be what you're looking for in ServletResponse.
|
# ? Mar 26, 2010 17:04 |
I am in posted:isCommintted() may be what you're looking for in ServletResponse. Sounded promising but didn't work quite the way I wanted. I've got the main entry point to my webapp which does my user authentication and then it hands it off to another controller based on the request. If it gets back to my main servlet and nothing has been written using to getOutputStream().write() yet I want to print out some sort of error page. code:
|
|
# ? Mar 26, 2010 18:25 |
|
fletcher posted:Sounded promising but didn't work quite the way I wanted. I've got the main entry point to my webapp which does my user authentication and then it hands it off to another controller based on the request. If it gets back to my main servlet and nothing has been written using to getOutputStream().write() yet I want to print out some sort of error page. You can wrap HttpServletResponse with your own implementation that will facade the setters and outputstream so you can detect if data has been sent to the class.
|
# ? Mar 26, 2010 18:52 |
|
You could wrap the original HttpServletResponse like this:code:
E: beaten!
|
# ? Mar 26, 2010 19:00 |
I am in posted:You could wrap the original HttpServletResponse like this: drat! That was kinda what I had originally done but I thought I was doing it wrong so I got rid of it. Is it common to extend HttpServletRequestWrapper and HttpServletResponseWrapper? It seems like it might be convenient to put information about the logged in user and stuff in a custom request object since I pass the request/response objects around to so many methods. Basically how I have it setup now is: Request hits MainServlet.java with url like http://site.com/articles/today -MainServlet.java does everything in a try/catch, logs/emails me on exceptions. Displays friendly error page to user on exception, 99% of the time exceptions will be handled in the other controllers with more specific error message -authenticate user if credentials supplied -parse URL to figure out what controller to instantiate (articles = ArticleController.java) -call doGet or doPost in ArticleController.java, writes to response.getOutputStream() -now i'm back in MainServlet.java, 99% of the time a response should already be written. want to avoid a blank page if one hasn't been written yet though fletcher fucked around with this message at 20:01 on Mar 26, 2010 |
|
# ? Mar 26, 2010 19:57 |
|
fletcher posted:drat! That was kinda what I had originally done but I thought I was doing it wrong so I got rid of it. You know you can map error responses to servlet actions via the error-page declarations in your web.xml?
|
# ? Mar 26, 2010 20:43 |
TRex EaterofCars posted:You know you can map error responses to servlet actions via the error-page declarations in your web.xml? I did not! That sounds like what I need to be doing. Am I supposed to have more than 1 servlet defined in web.xml with url-patterns to map things like /articles to ArticleController.java? And if I use the error-page stuff, do I not need to be doing everything in 1 main try/catch? fletcher fucked around with this message at 21:00 on Mar 26, 2010 |
|
# ? Mar 26, 2010 20:57 |
|
fletcher posted:I did not! That sounds like what I need to be doing. Am I supposed to have more than 1 servlet defined in web.xml with url-patterns to map things like /articles to ArticleController.java? You can do pretty much anything you want, but it would be best to have a servlet to handle errors separate from the servlets that handle regular traffic. Map the error handling to the error servlet and write your logging/emailing code there so you don't pollute your main servlet with poo poo.
|
# ? Mar 26, 2010 21:10 |
TRex EaterofCars posted:You can do pretty much anything you want, but it would be best to have a servlet to handle errors separate from the servlets that handle regular traffic. Map the error handling to the error servlet and write your logging/emailing code there so you don't pollute your main servlet with poo poo. Something like this? web.xml code:
|
|
# ? Mar 26, 2010 22:52 |
|
I came across something rather odd that I couldn't figure out-code:
code:
Any thoughts? What am I missing here?
|
# ? Mar 27, 2010 02:30 |
|
Internet Janitor posted:Any thoughts? What am I missing here? This appears to be a perfect storm of weirdness involving the way Java handles varargs and generics. The signature of Arrays.asList is the following: code:
code:
code:
Why doesn't it try T = Character instead? The compiler is choosing the "path of least conversions", so to speak. It's "easier/less effort" to treat the array as the object that it is instead of boxing every element in the array for you. That's why your final example works, because you've explicitly done the boxing for it already: code:
|
# ? Mar 27, 2010 03:26 |
|
Flobbster posted:This is just another illustration of one of those wonderful edge cases in Java generics that lead me to detest the way they've implemented them. I believe I follow you- thanks for the explanation. I hadn't even realized Arrays.asList() took a vararg! Always better to run into this kind of subtle thing on a personal project than with a production codebase, at any rate...
|
# ? Mar 27, 2010 03:47 |
|
I'm just getting into generics in java and I can't figure out how to compare to generic variables. code:
incompatible types required: boolean found: int this is the if statement inside the insert function. help?
|
# ? Mar 29, 2010 23:55 |
|
The if-statement require a boolean but compareTo return an integer. http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Comparable.html#compareTo%28java.lang.Object%29
|
# ? Mar 30, 2010 00:04 |
|
thanks
|
# ? Mar 30, 2010 00:16 |
|
Necc0 posted:I'm just getting into generics in java and I can't figure out how to compare to generic variables. You can just use E instead of Comparable<E> in your method signature, there is no need for casting. code:
|
# ? Mar 30, 2010 11:57 |
|
I'm trying to make a deep copy of a LinkedList<ArrayList<String>> Doesn't seem to be working for me, I have a feeling it is only creating a swallow copy of the arrayList<String> I've tried two methods code:
code:
|
# ? Mar 30, 2010 19:56 |
|
Brain Candy posted:You can just use E instead of Comparable<E> in your method signature, there is yeah since I'm new to generics I thought my problem had something to do with how I was handling the objects, not the actual logic in the if statement.
|
# ? Mar 30, 2010 19:57 |
|
|
# ? May 3, 2024 03:46 |
|
karuna posted:I'm trying to make a deep copy of a LinkedList<ArrayList<String>> code:
|
# ? Mar 30, 2010 20:08 |