|
Clock Explosion posted:and that Java won't let you bind to port 80, they don't notice each other's presence, and thus, the server just stays still, no matter what you do on the HTML page. java can bind to port 80 just fine. Your java server running on some high port isn't going to "notice" connections hitting some webserver on the same system unless you explicitly connect to it. quote:If you need to use sockets on odd ports, I think your only options are PHP(or some other language that you can run server-side like Perl) or a Java applet(which will basically run like poo poo). the applet security context doesn't permit outgoing tcp connections to other hosts/ports.
|
# ? Oct 4, 2008 16:05 |
|
|
# ? May 14, 2024 04:44 |
|
I just realized that an assignment (in C) I have to turn in for class uses libraries which don't exist on the school computers. I'm using perl compatible regular expressions (which seem a billion times better/easier to use than the posix regex.h library) but my code won't compile on at school because pcre.h is missing. I have a feeling its impossible or at least a huge pain in the rear end to link a compiled pcre library to my code because I obviously don't have privileges to install pcre. Should I refactor my code to use regex.h or is it possible to compile the pcre library to a personal directory and link it from there? Would I still tell pass gcc the -lpcre argument or would that look different?
|
# ? Oct 7, 2008 15:27 |
|
tripwire posted:Should I refactor my code to use regex.h or is it possible to compile the pcre library to a personal directory and link it from there? Would I still tell pass gcc the -lpcre argument or would that look different? Whether it's worth the refactor trouble or not is just the inverse of the question "Will you be penalized for requiring compilation of pcre locally?" which is a question for your TA. As for gcc, you'll still pass it -lpcre but you'll also pass it -Lpath/to/local/library (reference).
|
# ? Oct 7, 2008 15:37 |
|
csammis posted:Whether it's worth the refactor trouble or not is just the inverse of the question "Will you be penalized for requiring compilation of pcre locally?" which is a question for your TA. As for gcc, you'll still pass it -lpcre but you'll also pass it -Lpath/to/local/library (reference). Thanks. I just got it compiled locally but I think I'm just going to end up re factoring it because I doubt the TA would want to deal with the hassle of compiling and linking pcre.
|
# ? Oct 7, 2008 16:03 |
|
Hey, at least you realized that the school computers don't have pcre before turning in the assignment. Developing on personal machines and creating unresolvable dependencies bit many a programming student when I was in college
|
# ? Oct 7, 2008 16:06 |
|
Blergh, a related question: in perl compatible RE you can group things together but avoid capturing substrings there by putting a question mark and a colon after the left parenthesis. So if your expression is "(?:abc)(123)" without quotes, and you match the string "abc123" you would expect that it only captures the substring "123". How do you do this without perl compatible RE? I'm trying to go through the reference for regex.h but I'm just getting dumbfounded and I'm sure someone must know this off the top of their head.
|
# ? Oct 7, 2008 17:53 |
|
tripwire posted:Blergh, a related question: in perl compatible RE you can group things together but avoid capturing substrings there by putting a question mark and a colon after the left parenthesis. I don't know, but can't you just ignore \1 and just look at \2?
|
# ? Oct 7, 2008 18:22 |
|
JoeNotCharles posted:I don't know, but can't you just ignore \1 and just look at \2? I'm trying to match an HTTP request. Part of this request is the URI which is a string that corresponds to a file/resource on the computer. The first character of the URI is always a slash (/) and theres some non-special characters optionally following that. A slash followed by a slash is illegal, as are spaces, line breaks, carraige feeds and other bric a brack you wouldn't want in filename. In PCRE I was capturing the URI with this pattern: (/(?:[^\r\n/ ]+(?:/[^\r\n/ ]+)*)?) It wants a slash first, optionally followed by one or more valid characters, followed by slash with some more characters which can appear many times or not at all. How do I codify that as a regular expression which doesn't use nested backreferences? I want to apply the * operator (zero or many times) on the nested substring but I don't want to capture the nested substring because that will fuckup later captures I have to do. tripwire fucked around with this message at 18:33 on Oct 7, 2008 |
# ? Oct 7, 2008 18:31 |
|
*EDIT* SOLVED Need some big brains to help get my javascript working, specifically setting the focus in Firefox. I got it working in IE but not sure how to get it working in Firefox. I'll continue to google. Thanks for anything. if(ie4 || ie5) { //(this works in IE) contentFrameDoc.frames['id'].focus(); contentFrameDoc.frames['id'].document.getElementById('text').focus(); } else { //(this doesn't work in Firefox) contentFrameDoc.*needed document in hurr*. getElementById('id').focus(); contentFrameDoc.*needed document in hurr*. getElementById('id').contentDocument.getElementById('text').focus(); } RonniePudding fucked around with this message at 18:57 on Oct 7, 2008 |
# ? Oct 7, 2008 18:36 |
|
RonniePudding posted:Need some big brains to help get my javascript working, specifically setting the focus in Firefox. I got it working in IE but not sure how to get it working in Firefox. I'll continue to google. Thanks for anything. Check the web development megathread too
|
# ? Oct 7, 2008 18:47 |
|
tripwire posted:In PCRE I was capturing the URI with this pattern: Do you absolutely have to do this with regular expressions? It's pretty straightforward with strchr and strrchr.
|
# ? Oct 8, 2008 01:38 |
|
rjmccall posted:Do you absolutely have to do this with regular expressions? It's pretty straightforward with strchr and strrchr. Well it doesn't absolutely have to be done with regular expressions, but how would I validate the URI without them? I guess I could make a big wack of if statements that do roughly the same thing, it just seems kludgy.
|
# ? Oct 8, 2008 04:08 |
|
tripwire posted:Well it doesn't absolutely have to be done with regular expressions, but how would I validate the URI without them? I guess I could make a big wack of if statements that do roughly the same thing, it just seems kludgy. You find a series of if statements more kludgy than (/(?:[^\r\n/ ]+(?:/[^\r\n/ ]+)*)?)? That's crazy talk.
|
# ? Oct 8, 2008 04:22 |
|
tripwire posted:Well it doesn't absolutely have to be done with regular expressions, but how would I validate the URI without them? I guess I could make a big wack of if statements that do roughly the same thing, it just seems kludgy. That regexp is validating exactly three things: that there aren't any CR or LF characters in the URI (which is probably guaranteed by your parser anyway), that the URI starts with a slash, and that all the components are non-empty. You'll need to do better validation than that anyway (e.g. to invalidate URIs like /mysite/../../../etc/passwd), and that validation will need to look at individual components, so....
|
# ? Oct 8, 2008 09:16 |
|
Hey guys, a friend of mine makes 3D models in 3DMax. I want to make a game with him, but don't know where to start. Obviously, I'll be doing the programming part. Are there any good basic tutorials for this (C++, C#, or Java preferred)?
|
# ? Oct 8, 2008 11:25 |
|
I'm working on my programming skills at the moment, all self taught (thank god for a language like python to start with), is it normal at this level of programming skill to frequently hit a wall in understanding a concept? I feel like I'm constantly having to take deep breaths when trying to visualise how stuff is actually working, please tell me it gets easier and less daunting, that this is just a beginner phase thing that wears out after a while!
|
# ? Oct 8, 2008 11:29 |
|
It depends what you're learning from. If you are constantly hitting a wall it might be that your learning technique and materials aren't suited to you, or that you are trying to learn too quickly. Learning doesn't normally get easier - it still requires a lot of work, patience and thought in any subject - but once you have the fundamentals nailed down, you don't have to learn as much to understand things. What I would suggest is: Be a little more patient - if it takes you longer to understand something you may well come away with a better understanding of it. Try different materials - look for slides, video lectures, books, exercises to learn from instead of just one source of information. You may find that learning from one is prefferable to the others. Talk to other people - you could ask for help in this forum rather than asking for reassurance.
|
# ? Oct 8, 2008 12:12 |
|
The Dissonant posted:Hey guys, a friend of mine makes 3D models in 3DMax. I want to make a game with him, but don't know where to start. Obviously, I'll be doing the programming part. Are there any good basic tutorials for this (C++, C#, or Java preferred)? Game development megathread - should find plenty of resources there. Otherwise, this question goes waaaay beyond a single post in a general questions thread. Game development can get very complex.
|
# ? Oct 8, 2008 15:25 |
|
tripwire posted:but I don't want to capture the nested substring because that will fuckup later captures I have to do. Are you sure? In Perl anyway this doesn't apply; each open paren indicates a new capture. As in, open paren in the regex literal. Nesting doesn't create new captures. It becomes really easy to reason about how substrings are being captured once you internalize this. code:
|
# ? Oct 8, 2008 15:46 |
|
rjmccall posted:That regexp is validating exactly three things: that there aren't any CR or LF characters in the URI (which is probably guaranteed by your parser anyway), that the URI starts with a slash, and that all the components are non-empty. You'll need to do better validation than that anyway (e.g. to invalidate URIs like /mysite/../../../etc/passwd), and that validation will need to look at individual components, so.... There is no parser, I'm using a big regex to parse the whole thing. The whole perl compatible regexp looks like this: (POST|GET|HEAD|LINK|PUT|DELETE) (/(?:[^\r\n/ ]+(?:/[^\r\n/ ]+)*)?) HTTP/(1.[10])\r\n((?:[^\r\n]*\r\n)*)\r\n This won't work in the posix api because you can't access captured group by name, you have to access them by order in which they appeared. The URI could contain a variable amount of capture groups in it, as could the headers. Since I don't get to use things like (:? to stop a group from capturing I don't know how to validate the URI directly with regex. Sartak posted:Are you sure? In Perl anyway this doesn't apply; each open paren indicates a new capture. As in, open paren in the regex literal. Nesting doesn't create new captures. It becomes really easy to reason about how substrings are being captured once you internalize this. tripwire fucked around with this message at 18:09 on Oct 8, 2008 |
# ? Oct 8, 2008 18:03 |
|
tripwire posted:This won't work in the posix api because you can't access captured group by name, you have to access them by order in which they appeared. The URI could contain a variable amount of capture groups in it, as could the headers. Please reread my post, because this is exactly the point I address. tripwire posted:Like I posted earlier, If I was using perl I wouldn't have this problem. I'm forced to use the posix regex.h api which doesn't support captures in nearly as easy a way. I know. I was just using Perl as an example. Just try it with your regex library. I bet it'll work.
|
# ? Oct 8, 2008 18:12 |
|
Sartak posted:Please reread my post, because this is exactly the point I address. Sorry I'm an idiot and didn't understand you. It turns out you were completely right. Now I'm having frustrations because when my server serves a file it truncates on binary zero. Programming in C is a painful but educational experience.
|
# ? Oct 8, 2008 21:16 |
|
tripwire posted:There is no parser, I'm using a big regex to parse the whole thing. The whole perl compatible regexp looks like this: Incidentally, RFC 2616 says you should ignore initial CRLFs in HTTP requests. Anyway, HTTP is a line-based protocol, and you have to keep reading the header until you get to an empty line, so I assume you're just looping on a read-and-append until this regexp matches — in which case you'll never actually detect failure anyway.
|
# ? Oct 8, 2008 22:13 |
|
rjmccall posted:Incidentally, RFC 2616 says you should ignore initial CRLFs in HTTP requests. Nah, I have a method which harvests characters from a socket until it reads two CRLFs in a row, then it passes the string over to the parsing function. I'm mostly finished now, but If anyone wants to help a c noob out and give me pointers on which things I've mangled up and how to fix it, I've put my web server code up here: http://pastebin.com/m1478ea14 I know for a fact that I've completely hosed up on dynamically allocating; I thought I had it figured out but I was getting hard crashes from double freeing/corruption so I just removed every offending free() until it stopped complaining. If someone can tell me when/how to allocate in the context of that program without causing corruption I'd really appreciate it.
|
# ? Oct 8, 2008 22:25 |
|
tripwire posted:I know for a fact that I've completely hosed up on dynamically allocating; I thought I had it figured out but I was getting hard crashes from double freeing/corruption so I just removed every offending free() until it stopped complaining. If someone can tell me when/how to allocate in the context of that program without causing corruption I'd really appreciate it. code:
|
# ? Oct 9, 2008 02:12 |
|
My school had a programming contest yesterday, and I can't seem to think of an efficient algorithm for problem #6. http://www.cs.mtsu.edu/~zdong/programmingContest/Problems08F.doc It seems like it would just be the max of all-pairs shortest path, but the worst case have up to 998^2 vertices, and Floyd-Warshall is O(V^3), which would be 1E18 runs of the loop, in addition to 998^4 integers to hold in memory. I thought about looking at a breadth first search with memoization? This won't alleviate the memory issues, but it should run much faster. I think there has to be some sort of way to take advantage of this being a 2D graph, since the number of edges will be reduced drastically, but at this point I'm running into a mental wall on the next step. Does anyone have any suggestions? If so, can you also provide a website link or name of something I can search for to read up on?
|
# ? Oct 9, 2008 04:50 |
|
Hey, was wondering what kind of software you guys use to plan out your programs before writing (if you ever do)? I'm trying to start a little personal project that involves a lot of network crap like keeping track of packets throughout a series of nodes. So I guess I'm looking for some kind of charting software that'll let me abstract the project before I start coding.
|
# ? Oct 10, 2008 04:27 |
|
Feral Integral posted:Hey, was wondering what kind of software you guys use to plan out your programs before writing (if you ever do)? I'm trying to start a little personal project that involves a lot of network crap like keeping track of packets throughout a series of nodes. So I guess I'm looking for some kind of charting software that'll let me abstract the project before I start coding. Pencil and paper. A plain text editor if I'm feeling ambitious.
|
# ? Oct 10, 2008 05:03 |
|
Avenging Dentist posted:Pencil and paper. A plain text editor if I'm feeling ambitious. I prefer a whiteboard myself
|
# ? Oct 10, 2008 05:05 |
|
chocojosh posted:I prefer a whiteboard myself I dream of a whiteboard But yeah, nothing beats being able to physically scrawl out your process. Much quicker than notepad or anything. I'm using C to try and parse some strings. I've got some statements like this: sprintf(cFirstPair,"%.2s", cSingleCommand); cSingleCommand is four characters. cFirstPair returns the first two. Is there any easy method to return the second pair? Or, better yet, just enter each pair into a function separately, something like this: function(cSingleCommand[0] + cSingleCommand[1],cSingleCommand[2] + cSingleCommand[3]); Except you know, actually have it work. I don't want to have to use a million intermediate variables
|
# ? Oct 10, 2008 07:48 |
|
ante posted:Is there any easy method to return the second pair? cSingleCommand+2
|
# ? Oct 10, 2008 07:53 |
|
Avenging Dentist posted:cSingleCommand+2 I actually tried that, but I realize my problem goes further than that. Take a look at this: Assume cSingleCommand = ABCD This code: code:
code:
code:
code:
I hate C style strings so much.
|
# ? Oct 10, 2008 08:04 |
|
I can only conclude that you're doing it wrong. You're probably not allocating space for the null terminator and one string is clobbering the other.
|
# ? Oct 10, 2008 08:09 |
|
Avenging Dentist posted:I can only conclude that you're doing it wrong. You are absolutely right, thank you. This is what happens when you've been writing code for 7 consecutive hours.
|
# ? Oct 10, 2008 08:21 |
|
I'm not a coder but am trying to bastardise a vb script so please be gentle if I've done something stupid. I'm trying to store an eventid to report out of system log, I have it working with hardcoded id like intNumberID = 6008 I have user input working for hy hostname strComputer = InputBox("Computer Name", "Enter Computer Name you want to report against") But I want user input like that for my intNumberID intNumberID = InputBox("Enter the Event ID Number you want to report on", "Event ID") doesn't work for some reason?
|
# ? Oct 10, 2008 14:10 |
|
ignore this.
eHacked fucked around with this message at 19:22 on Oct 10, 2008 |
# ? Oct 10, 2008 15:31 |
|
glint posted:I'm not a coder but am trying to bastardise a vb script so please be gentle if I've done something stupid.
|
# ? Oct 10, 2008 16:23 |
|
How would I go about creating a search to look through a server to find a file the user wants and link it back to the user? The files are pdf's but I only want to search it by the file names. The actual search form would be on an intranet page, on a seperate server from the actual files. If my wording is confusing let me know, I'm pretty confused by it too and have no other way to explain it.
|
# ? Oct 10, 2008 19:54 |
|
tehclayzor posted:How would I go about creating a search to look through a server to find a file the user wants and link it back to the user? The files are pdf's but I only want to search it by the file names. I've never used Indexing Service (assuming you're on Windows), but I remembered this from Atwood a while back. Maybe it could get you going in the right direction.
|
# ? Oct 10, 2008 20:07 |
|
|
# ? May 14, 2024 04:44 |
|
Yeah I meant to mention that i already had links to an index on the intranet page. I'll look through this Indexing Service thing. Thanks!
|
# ? Oct 10, 2008 20:10 |