|
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. |
On March 07 2012 20:17 Fryght wrote:Show nested quote +On March 07 2012 10:38 tec27 wrote:On March 07 2012 01:13 supereddie wrote:I never said anything about AJAX (or polling) - using this with a game is not a good idea. server-sent events however, are viable in my opinion (and part of the html5 'standard'). I think streaming is possible, as long a you have a suitable protocol (like rtp, rtsp, mms) and the browser supports the codec. WebSockets tend to be better for games, since it allows for bi-directional communicatiton, although its less well supported and a tad harder to set up on certain platforms. Still, http://socket.io/ is a really nice library that makes utilizing WebSockets pretty painless (and has server components for a bunch of languages). Yeah, I've looked into WebSockets, but a while back there was little to no support across the browser boards. Really hope they would get everyone in line. But CSS3 makes very skeptical. I mean, CSS3 is not exactly rocket science and has been around quite long already, yet there is no standard still and we have browser specific implementations *shudder*
I've used WebSockets and the socket.io library pretty smoothly before. You cut out some browsers due to incompatibility, but that can actually be a good thing at times. It frees up what you can do in other regards. The same can be said about canvas. Does IE7 support <insert functionality here>? It doesn't matter because it doesn't support the entire canvas object and so it's a moot point.
Yeah, you lose some potential users, but unless your Zynga, your target audience is probably net savvy enough to be running a pretty up to date browser and so you don't really lose out that much.
|
Sorry guys, I'm going to ask something slightly off topic, but given the concentration of programmers here I thought it might be a good place to ask.
I did finance in college but somehow got into the IT industry after that. Since the systems I work with require occasional writing of scripts (which are not done by me at the moment), I think learning some programming skills would be good so that I can do it, and from what I see I find it quite interesting. I've been working on CodeAcademy a bit.
The question is: which course should I do? I have two choices. One is an online diploma course in Information technology, comprising of the following modules: C Programming Object Oriented Analysis & Design Mathematics for Computing Computer and Information Processing Project: Web Publishing with HTML Database Design and management Essentials of Networking and Network Security
Drawbacks is it will all be done online, except for the exams for which I will go to the center.
The other option is I just go to a local training center for a Java course then sit for the Sun Java certifications.
I do feel that I want a formal cert because in my part of the world, certs count for more in terms of getting a job I think, so learning on my own is a good idea, but perhaps make it harder to prove my skills to employers.
So I'm not sure which option to take.
|
Hyrule18977 Posts
The first one. Learning a language and getting certs is great and all, but learning design practices and the theories and general methodologies behind programming is by far the better option.
|
The first one if you want to go deeper and plan on being a "full programmer".
The second one if you want to "just make stuff that will help me to automate some trivial thing".
|
On March 10 2012 03:13 targ wrote: Sorry guys, I'm going to ask something slightly off topic, but given the concentration of programmers here I thought it might be a good place to ask.
I did finance in college but somehow got into the IT industry after that. Since the systems I work with require occasional writing of scripts (which are not done by me at the moment), I think learning some programming skills would be good so that I can do it, and from what I see I find it quite interesting. I've been working on CodeAcademy a bit.
The question is: which course should I do? I have two choices. One is an online diploma course in Information technology, comprising of the following modules: C Programming Object Oriented Analysis & Design Mathematics for Computing Computer and Information Processing Project: Web Publishing with HTML Database Design and management Essentials of Networking and Network Security
Drawbacks is it will all be done online, except for the exams for which I will go to the center.
The other option is I just go to a local training center for a Java course then sit for the Sun Java certifications.
I do feel that I want a formal cert because in my part of the world, certs count for more in terms of getting a job I think, so learning on my own is a good idea, but perhaps make it harder to prove my skills to employers.
So I'm not sure which option to take.
If you're motivated you can replace the stuff in the 1st courses with good books/online resources. Employers won't care about the online course completion. People can get through without putting in the extra work necessary to truly grasp the point of it all. This is true even for b.s. in computer science. The value of such accomplishments has diminished over time. In the long run it's all about what you are capable of. C Programming: I would look at the syllabus if it's available. If you're learning dynamic memory management/pointers then that course will provide something that the java course won't. Otherwise there will be a lot of overlap (looping structures/conditionals/stuff you learned on code academy..) and you will feel it's a waste of time. Even then, things like pointers are difficult to work with at first, but if you can get a general understanding of them that's all you need. From the sounds of it you'll never need to touch them in the line of work you're looking for, so the general understanding can be learned on your own.
Object Oriented Analysis & Design: After you take a java course just get the book Headfirst Design Patterns (OReilly) and it will cover more than that class will, and it will do a better job.
Mathematics for computing: Khan academy
Computer and Information Processing: probably useless, would have to see syllabus
Web publishing with html: Chances are your instructor will dump a framework on you that you'll never use. HTML is very easy to learn on your own.
Database Design: http://www.amazon.com/Sams-Teach-Yourself-SQL-Minutes/dp/0672325675. That class will probably offer 1 lecture on actual relational database design at the end of the course, you can learn about database interaction way better from that book (just pick a dbms: http://dbconvert.com/overview.php ). After that you'll be prepared to learn as you do stuff or take a more advanced course somewhere if required.
Essentials of networking and network security: There is a lot of overhead to this so an introductory class might be helpful, still plenty of other resources to learn from.
I'd do option B
|
Hi, I am thinking about learning to jump into programming, but I have no idea where to start. I am hoping to work either as a physicist/astronomer or something in economics ( hopefully with a firm, not a school). First, what language should I start working with and second, how do you start from scratch? Also I am planning on taking a CS class next semester, or maybe during the summer :D.
|
I'd opt for option A. Programming is not just the familiarity of a particular programming language, it needs a wide range of skills and knowledge*. More than likely you do not yet have these. Java on the other hand, is very easy to pick up, and certifications are near useless.
*: For the record I'm employed as a Java programmer, and I barely knew Java before joining. We mainly do maintenance work like writing and fixing tests, fixing and refactoring production code. Basic knowledge of linux, regular expressions, revision control, Ant build scripts, editors, file managers, et cetera are a must. Hobby projects, team work experience, knowledge of Scrum, Agile, XP are huge advantages.
Related: http://www.codinghorror.com/blog/2012/03/how-to-hire-a-programmer.html
|
On March 09 2012 14:33 visual77 wrote:Show nested quote +On March 07 2012 20:17 Fryght wrote:On March 07 2012 10:38 tec27 wrote:On March 07 2012 01:13 supereddie wrote:I never said anything about AJAX (or polling) - using this with a game is not a good idea. server-sent events however, are viable in my opinion (and part of the html5 'standard'). I think streaming is possible, as long a you have a suitable protocol (like rtp, rtsp, mms) and the browser supports the codec. WebSockets tend to be better for games, since it allows for bi-directional communicatiton, although its less well supported and a tad harder to set up on certain platforms. Still, http://socket.io/ is a really nice library that makes utilizing WebSockets pretty painless (and has server components for a bunch of languages). Yeah, I've looked into WebSockets, but a while back there was little to no support across the browser boards. Really hope they would get everyone in line. But CSS3 makes very skeptical. I mean, CSS3 is not exactly rocket science and has been around quite long already, yet there is no standard still and we have browser specific implementations *shudder* I've used WebSockets and the socket.io library pretty smoothly before. You cut out some browsers due to incompatibility, but that can actually be a good thing at times. It frees up what you can do in other regards. The same can be said about canvas. Does IE7 support <insert functionality here>? It doesn't matter because it doesn't support the entire canvas object and so it's a moot point. Yeah, you lose some potential users, but unless your Zynga, your target audience is probably net savvy enough to be running a pretty up to date browser and so you don't really lose out that much.
Differences between Chrome and Firefox are already pretty big. A lot of support is 'experimental'. Bit too volatile for my taste.
As for the guy asking about what course to take, I'd go with the online one. Like others have said, Java can be picked up fairly easily if you have understanding of programming concepts. Certifications are probably only going to be considered a plus if you are going to work specifically in the language you got the certification for. Experience is usually valued much more, however.
Another option would be to buy a few O'Reilly books on a subject you're interested in. Lynda.com has some ok entry level stuff to get you started if you are looking for specifics.
Mostly it just depends on what area you are looking at to get into. But as a general rule, the language you are using is merely the tool. Without knowing how to plan and then how to build an house, having a hammer is not going to help you much. But having the hammer, you can keep whacking on things until you figure out how to build the house :D But then again, at a professional level "Hey, I gave it a shot!" is not really acceptable, so knowing how to properly plan and structure things is the most important, I'd say :p
|
Thanks for the advice guys, I see most of the responses is for Option A for a better grounding, though thanks alot to the guy for Option B who listed out all those resources, that will be very helpful for me. I'm going to give a bit more thought to the options based on my current schedule.
|
edit: Forgot to mention this is C# 4.0
What is wrong with this regex?
The program input is coming from an html file. I am reading that html file line by line and dumping that in to a StringWriter. The StringWriter is then passing the body of text as a single string (THE INCOMING TEXT HAS \r\n's (NOT SHOWN) after each <br> tag IF THAT IS RELEVANT):
<!-- saved from url=(0126)http://www.wunderground.com/history/airport/KMTO/2012/3/9/DailyHistory.html?req_city=NA&req_state=NA&req_statename=NA&format=1 --> <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head>.....truncated<br> 12:53 AM,34.0,27.0,75,30.39,10.0,West,10.4,-,N/A,,Clear,280,2012-03-09 06:53:00<br> 1:53 AM,35.1,26.1,70,30.40,10.0,West,8.1,-,N/A,,Clear,270,2012-03-09 07:53:00<br> 2:53 AM,36.0,25.0,64,30.39,10.0,West,9.2,-,N/A,,Clear,260,2012-03-09 08:53:00<br> 3:53 AM,36.0,25.0,64,30.39,10.0,WSW,6.9,-,N/A,,Clear,250,2012-03-09 09:53:00<br> 4:53 AM,36.0,25.0,64,30.42,10.0,West,10.4,-,N/A,,Clear,270,2012-03-09 10:53:00<br> 5:53 AM,34.0,26.1,73,30.44,10.0,WNW,11.5,-,N/A,,Clear,290,2012-03-09 11:53:00<br> 6:53 AM,34.0,26.1,73,30.45,10.0,WNW,15.0,-,N/A,,Clear,300,2012-03-09 12:53:00<br> 7:53 AM,36.0,26.1,67,30.49,10.0,NW,18.4,-,N/A,,Clear,320,2012-03-09 13:53:00<br> 8:53 AM,37.0,25.0,62,30.51,10.0,NNW,18.4,-,N/A,,Clear,330,2012-03-09 14:53:00<br> 10:53 AM,41.0,23.0,49,30.54,10.0,NW,17.3,21.9,N/A,,Clear,320,2012-03-09 16:53:00<br> 11:53 AM,43.0,19.9,40,30.54,10.0,NNW,11.5,23.0,N/A,,Clear,340,2012-03-09 17:53:00<br> 12:53 PM,44.1,19.9,38,30.52,10.0,North,12.7,23.0,N/A,,Clear,350,2012-03-09 18:53:00<br> 1:53 PM,45.0,21.0,39,30.51,10.0,North,11.5,-,N/A,,Clear,350,2012-03-09 19:53:00<br> 2:53 PM,46.0,21.9,39,30.50,10.0,North,-9999.0,-,N/A,,Clear,0,2012-03-09 20:53:00<br> 3:53 PM,45.0,21.0,39,30.50,10.0,North,11.5,-,N/A,,Clear,350,2012-03-09 21:53:00<br> 4:53 PM,44.1,19.9,38,30.50,10.0,North,10.4,-,N/A,,Clear,360,2012-03-09 22:53:00<br> 5:53 PM,39.0,21.0,49,30.51,10.0,North,6.9,-,N/A,,Clear,360,2012-03-09 23:53:00<br> 6:53 PM,36.0,21.0,55,30.52,10.0,North,5.8,-,N/A,,Clear,350,2012-03-10 00:53:00<br> 7:53 PM,35.1,21.9,59,30.53,10.0,North,4.6,-,N/A,,Clear,10,2012-03-10 01:53:00<br> 8:53 PM,30.9,21.0,67,30.53,10.0,Calm,Calm,-,N/A,,Clear,0,2012-03-10 02:53:00<br> 9:53 PM,32.0,19.9,61,30.53,10.0,Calm,Calm,-,N/A,,Clear,0,2012-03-10 03:53:00<br> 10:53 PM,33.1,16.0,50,30.52,10.0,East,3.5,-,N/A,,Clear,80,2012-03-10 04:53:00<br> 11:53 PM,33.1,15.1,48,30.52,10.0,Calm,Calm,-,N/A,,Clear,0,2012-03-10 05:53:00<br> </body></html>
I wrote a regular expression that is intended to grab each of the timestamps up until the line break, but it only gets the first..
Relevant Code:
private static void ProcessBody(string text) { Regex CONTENT = new Regex(@"(?<content>\d{1,2}:\d{1,2} [AP]M.+)<br>", RegexOptions.Multiline);; if (text != string.Empty) { Match contentMatch = CONTENT.Match(text);
if (contentMatch.Success) { Console.WriteLine(contentMatch.Groups["content"].Captures.Count); Console.WriteLine(contentMatch.Groups["content"].Captures[0]); } } }
The output of this program is:
1 12:53 AM,34.0,27.0,75,30.39,10.0,West,10.4,-,N/A,,Clear,280,2012-03-09 06:53:00
Any ideas of how to get it to capture all of them?
|
http://www.dotnetperls.com/regex-matches
// Program that uses Regex.Matches method [C#]
using System; using System.Text.RegularExpressions;
class Program { static void Main() { // Input string. const string value = @"said shed see spear spread super";
// Get a collection of matches. MatchCollection matches = Regex.Matches(value, @"s\w+d");
// Use foreach loop. foreach (Match match in matches) { foreach (Capture capture in match.Captures) { Console.WriteLine("Index={0}, Value={1}", capture.Index, capture.Value); } } } }
// Output
// Index=0, Value=said // Index=5, Value=shed // Index=20, Value=spread
|
On March 11 2012 13:01 Sluggy wrote:edit: Forgot to mention this is C# 4.0 What is wrong with this regex? The program input is coming from an html file. I am reading that html file line by line and dumping that in to a StringWriter. The StringWriter is then passing the body of text as a single string (THE INCOMING TEXT HAS \r\n's (NOT SHOWN) after each <br> tag IF THAT IS RELEVANT): <!-- saved from url=(0126)http://www.wunderground.com/history/airport/KMTO/2012/3/9/DailyHistory.html?req_city=NA&req_state=NA&req_statename=NA&format=1 --> <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head>.....truncated<br> 12:53 AM,34.0,27.0,75,30.39,10.0,West,10.4,-,N/A,,Clear,280,2012-03-09 06:53:00<br> 1:53 AM,35.1,26.1,70,30.40,10.0,West,8.1,-,N/A,,Clear,270,2012-03-09 07:53:00<br> 2:53 AM,36.0,25.0,64,30.39,10.0,West,9.2,-,N/A,,Clear,260,2012-03-09 08:53:00<br> 3:53 AM,36.0,25.0,64,30.39,10.0,WSW,6.9,-,N/A,,Clear,250,2012-03-09 09:53:00<br> 4:53 AM,36.0,25.0,64,30.42,10.0,West,10.4,-,N/A,,Clear,270,2012-03-09 10:53:00<br> 5:53 AM,34.0,26.1,73,30.44,10.0,WNW,11.5,-,N/A,,Clear,290,2012-03-09 11:53:00<br> 6:53 AM,34.0,26.1,73,30.45,10.0,WNW,15.0,-,N/A,,Clear,300,2012-03-09 12:53:00<br> 7:53 AM,36.0,26.1,67,30.49,10.0,NW,18.4,-,N/A,,Clear,320,2012-03-09 13:53:00<br> 8:53 AM,37.0,25.0,62,30.51,10.0,NNW,18.4,-,N/A,,Clear,330,2012-03-09 14:53:00<br> 10:53 AM,41.0,23.0,49,30.54,10.0,NW,17.3,21.9,N/A,,Clear,320,2012-03-09 16:53:00<br> 11:53 AM,43.0,19.9,40,30.54,10.0,NNW,11.5,23.0,N/A,,Clear,340,2012-03-09 17:53:00<br> 12:53 PM,44.1,19.9,38,30.52,10.0,North,12.7,23.0,N/A,,Clear,350,2012-03-09 18:53:00<br> 1:53 PM,45.0,21.0,39,30.51,10.0,North,11.5,-,N/A,,Clear,350,2012-03-09 19:53:00<br> 2:53 PM,46.0,21.9,39,30.50,10.0,North,-9999.0,-,N/A,,Clear,0,2012-03-09 20:53:00<br> 3:53 PM,45.0,21.0,39,30.50,10.0,North,11.5,-,N/A,,Clear,350,2012-03-09 21:53:00<br> 4:53 PM,44.1,19.9,38,30.50,10.0,North,10.4,-,N/A,,Clear,360,2012-03-09 22:53:00<br> 5:53 PM,39.0,21.0,49,30.51,10.0,North,6.9,-,N/A,,Clear,360,2012-03-09 23:53:00<br> 6:53 PM,36.0,21.0,55,30.52,10.0,North,5.8,-,N/A,,Clear,350,2012-03-10 00:53:00<br> 7:53 PM,35.1,21.9,59,30.53,10.0,North,4.6,-,N/A,,Clear,10,2012-03-10 01:53:00<br> 8:53 PM,30.9,21.0,67,30.53,10.0,Calm,Calm,-,N/A,,Clear,0,2012-03-10 02:53:00<br> 9:53 PM,32.0,19.9,61,30.53,10.0,Calm,Calm,-,N/A,,Clear,0,2012-03-10 03:53:00<br> 10:53 PM,33.1,16.0,50,30.52,10.0,East,3.5,-,N/A,,Clear,80,2012-03-10 04:53:00<br> 11:53 PM,33.1,15.1,48,30.52,10.0,Calm,Calm,-,N/A,,Clear,0,2012-03-10 05:53:00<br> </body></html>
I wrote a regular expression that is intended to grab each of the timestamps up until the line break, but it only gets the first.. Relevant Code: private static void ProcessBody(string text) { Regex CONTENT = new Regex(@"(?<content>\d{1,2}:\d{1,2} [AP]M.+)<br>", RegexOptions.Multiline);; if (text != string.Empty) { Match contentMatch = CONTENT.Match(text);
if (contentMatch.Success) { Console.WriteLine(contentMatch.Groups["content"].Captures.Count); Console.WriteLine(contentMatch.Groups["content"].Captures[0]); } } }
The output of this program is: 1 12:53 AM,34.0,27.0,75,30.39,10.0,West,10.4,-,N/A,,Clear,280,2012-03-09 06:53:00 Any ideas of how to get it to capture all of them?
http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454
Use a tool for parsing html instead of regular expressions.
|
I am not 100% sure, but I believe this is the best place to post this question.
I am very interested in creating an offline, interactive document. Basically something that I can create, link audio to text, pictures ect. The important part is that it is completely function-able and editable offline, and that it works fine when I send it to someone else (i.e. it doesn't loose function-ability do to certain directories changing, simply because it is on another computer.) I think I can do this with a PDF perhaps, but I am not sure. Also, the program used to create this document needs to be some sort of freeware. I don't care if it looks like a webpage from 1998, it just has to function like I stated above.
I haven't written any sort of HTML for many years, so anything with very little or no coding (ie Frontpage) would be very helpful.
Apologies in advance if there is an easy solution for this and I am just behind with the times or HTML.
|
On March 12 2012 00:24 IMlemon wrote:Show nested quote +On March 11 2012 13:01 Sluggy wrote:edit: Forgot to mention this is C# 4.0 What is wrong with this regex? The program input is coming from an html file. I am reading that html file line by line and dumping that in to a StringWriter. The StringWriter is then passing the body of text as a single string (THE INCOMING TEXT HAS \r\n's (NOT SHOWN) after each <br> tag IF THAT IS RELEVANT): <!-- saved from url=(0126)http://www.wunderground.com/history/airport/KMTO/2012/3/9/DailyHistory.html?req_city=NA&req_state=NA&req_statename=NA&format=1 --> <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head>.....truncated<br> 12:53 AM,34.0,27.0,75,30.39,10.0,West,10.4,-,N/A,,Clear,280,2012-03-09 06:53:00<br> 1:53 AM,35.1,26.1,70,30.40,10.0,West,8.1,-,N/A,,Clear,270,2012-03-09 07:53:00<br> 2:53 AM,36.0,25.0,64,30.39,10.0,West,9.2,-,N/A,,Clear,260,2012-03-09 08:53:00<br> 3:53 AM,36.0,25.0,64,30.39,10.0,WSW,6.9,-,N/A,,Clear,250,2012-03-09 09:53:00<br> 4:53 AM,36.0,25.0,64,30.42,10.0,West,10.4,-,N/A,,Clear,270,2012-03-09 10:53:00<br> 5:53 AM,34.0,26.1,73,30.44,10.0,WNW,11.5,-,N/A,,Clear,290,2012-03-09 11:53:00<br> 6:53 AM,34.0,26.1,73,30.45,10.0,WNW,15.0,-,N/A,,Clear,300,2012-03-09 12:53:00<br> 7:53 AM,36.0,26.1,67,30.49,10.0,NW,18.4,-,N/A,,Clear,320,2012-03-09 13:53:00<br> 8:53 AM,37.0,25.0,62,30.51,10.0,NNW,18.4,-,N/A,,Clear,330,2012-03-09 14:53:00<br> 10:53 AM,41.0,23.0,49,30.54,10.0,NW,17.3,21.9,N/A,,Clear,320,2012-03-09 16:53:00<br> 11:53 AM,43.0,19.9,40,30.54,10.0,NNW,11.5,23.0,N/A,,Clear,340,2012-03-09 17:53:00<br> 12:53 PM,44.1,19.9,38,30.52,10.0,North,12.7,23.0,N/A,,Clear,350,2012-03-09 18:53:00<br> 1:53 PM,45.0,21.0,39,30.51,10.0,North,11.5,-,N/A,,Clear,350,2012-03-09 19:53:00<br> 2:53 PM,46.0,21.9,39,30.50,10.0,North,-9999.0,-,N/A,,Clear,0,2012-03-09 20:53:00<br> 3:53 PM,45.0,21.0,39,30.50,10.0,North,11.5,-,N/A,,Clear,350,2012-03-09 21:53:00<br> 4:53 PM,44.1,19.9,38,30.50,10.0,North,10.4,-,N/A,,Clear,360,2012-03-09 22:53:00<br> 5:53 PM,39.0,21.0,49,30.51,10.0,North,6.9,-,N/A,,Clear,360,2012-03-09 23:53:00<br> 6:53 PM,36.0,21.0,55,30.52,10.0,North,5.8,-,N/A,,Clear,350,2012-03-10 00:53:00<br> 7:53 PM,35.1,21.9,59,30.53,10.0,North,4.6,-,N/A,,Clear,10,2012-03-10 01:53:00<br> 8:53 PM,30.9,21.0,67,30.53,10.0,Calm,Calm,-,N/A,,Clear,0,2012-03-10 02:53:00<br> 9:53 PM,32.0,19.9,61,30.53,10.0,Calm,Calm,-,N/A,,Clear,0,2012-03-10 03:53:00<br> 10:53 PM,33.1,16.0,50,30.52,10.0,East,3.5,-,N/A,,Clear,80,2012-03-10 04:53:00<br> 11:53 PM,33.1,15.1,48,30.52,10.0,Calm,Calm,-,N/A,,Clear,0,2012-03-10 05:53:00<br> </body></html>
I wrote a regular expression that is intended to grab each of the timestamps up until the line break, but it only gets the first.. Relevant Code: private static void ProcessBody(string text) { Regex CONTENT = new Regex(@"(?<content>\d{1,2}:\d{1,2} [AP]M.+)<br>", RegexOptions.Multiline);; if (text != string.Empty) { Match contentMatch = CONTENT.Match(text);
if (contentMatch.Success) { Console.WriteLine(contentMatch.Groups["content"].Captures.Count); Console.WriteLine(contentMatch.Groups["content"].Captures[0]); } } }
The output of this program is: 1 12:53 AM,34.0,27.0,75,30.39,10.0,West,10.4,-,N/A,,Clear,280,2012-03-09 06:53:00 Any ideas of how to get it to capture all of them? http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454Use a tool for parsing html instead of regular expressions.
Your comment lead me to check out HtmlAgilityPack which helped do what I needed here and greatly simplify another portion of the program (pulling stuff directly from the site), so thanks for that 
That being said, I know html and regex don't always go well together, but I think for this example getting 23 captures out of that should be possible. I don't think it's the <br> tags that are breaking the code. So if someone could either explain the details of why I can't do this simple task with regex, or show the proper way, I would appreciate it!.
|
On March 12 2012 10:51 Days wrote:Hey guys in some desperate need of help for this java programming hw! I have been racking my brains all day with this. The assignment is as follows: Write a class called Cashier that directs a cashier how to cash goods and give change to customers. The typical cashier operations are as follows: (a) Cashier clears the cash register machine. (b) Cashier enters the name and the price of each item in the cash registering machine. (c) The customer tenders an amount of money to pay for the goods (We assume the amount covers the total). (d) The cash machine computes: i. The number of items purchased ii. The total amount of purchase iii. The average price of each item iv. The number of coin denominations that the customer should receive. That is, the number of silver dollars, quarters, dimes, nickels, and cents the customer should receive in turn. Now I have created a class cashier and a test class cashier, I have also added a GetData class. The problem lies in the first part of my TestCashier class in which errors compile, shown here: String name = GetData.getWord(“Enter name of item”); double price = GetData.getDouble(“Enter price of item”); c.add(name, price);
name = GetData.getWord(“Enter name of item”); price = GetData.getDouble(“Enter price of item”); c.add(name, price); name = GetData.getWord(“Enter name of item”); price = GetData.getDouble(“Enter price of item”); c.add(name, price);
It says that the name and price is already defined in main(java.lang.String[arg]) Please if someone could help me out on this I will love you forever!
|
What does the error say? You define a variable with the same name more than one time. Example of why the error occurs here Just googled your error BTW, did you do that? An error you don't understand? First step: google it
So you have to make sure you only have the definition of the name variable one time "String name" <-- you define the 'name' variable here.
Ofcourse same story for variable 'price'. GL
|
On March 12 2012 12:21 alwinuz wrote:What does the error say? You define a variable with the same name more than one time. Example of why the error occurs hereJust googled your error BTW, did you do that? An error you don't understand? First step: google it So you have to make sure you only have the definition of the name variable one time "String name" <-- you define the 'name' variable here. Ofcourse same story for variable 'price'. GL 
I have made sure I only defined the variable once, I don't think that is the problem.
|
Perhaps post the entire code? (As a link to a file or in spoiler-tags, so that it doesn't litter the forums too much) Errors when compiling need not be directly related to the line referenced by the compiler.
|
Kentor
United States5784 Posts
On March 12 2012 12:29 Days wrote:Show nested quote +On March 12 2012 12:21 alwinuz wrote:What does the error say? You define a variable with the same name more than one time. Example of why the error occurs hereJust googled your error BTW, did you do that? An error you don't understand? First step: google it So you have to make sure you only have the definition of the name variable one time "String name" <-- you define the 'name' variable here. Ofcourse same story for variable 'price'. GL  I have made sure I only defined the variable once, I don't think that is the problem.  post the entire code. and know the difference between defining a variable and declaring a variable. You may not declare a variable twice in the same scope.
the error message should really be you've already declared the variable instead of define. -_-
|
Might I ask a question about design and theory? We've decided with a couple of buddies to make a simple 2D turn based space combat game. The problem is, it's been ages since I did any real maths/physics and I'm not sure how to approach one thing...
Stuff I need: 1. Ship position - pretty obvious, (x, y) coordinates on a grid. 2. Ship bearing and speed - also obvious, vector originating from ship position. 3. Ship relation to each other - this one is problematic.
What I need: I must know in which of the 4 90 degrees arcs of a ship is another ship. One way to do it (although I'm not sure if that's the optimal way) would be to get another grid centered on the ship position and rotated 45 degrees. This way, by checking other ship's position on this "personal" grid I'd know in which arc it is (x, y) = front, (-x, y) = left, (x, -y) = right, (-x, -y) = rear. Comparing the vectors will then also give me info if the ships are closing, abeam or moving away in certain arc.
Is there a better way of doing it?
|
|
|
|