|
Orzo posted:Yes, I read the opening post I just thought someone might have a more precise suggestion for someone who knows C# inside and out. I guess I'm looking for an approach that assumes the reader knows how programming works but at the same time starts from step 1 on the C++ language. Tbh beyond the basics knowing c# will be more of a hindrance when your preconceptions work. Try accelerated c++
|
# ? Apr 29, 2011 00:45 |
|
|
# ? May 16, 2024 11:23 |
|
I have another Win32 keyboard input question; for those that remember, I was having some trouble with LAlt and RAlt being correctly detected and I was quickly helped with that. Now I've rewritten my left and right key detection routine so that left and right keys are properly handled when pressed/released while the other key is down (i.e. holding right control down and then tapping left control will correctly register keydown and keyup events for left control). This isn't hard at all, but the snag I've run into is with shift. If both shift keys are held down and then one is released, only one keyup event is sent as expected, but GetKeyState and GetAsyncKeyState will return that neither shift key is held down, so another keyup event is never sent and during the first keyup event (when the first shift key is released), you cant tell what shift it was, because both return as up, and the right shift isn't an extended key like control and alt. At this point, I'm thinking this bug makes it impossible to handle both shift keys down together like the other left and right-hand keys. Has anyone dealt with this; am I truly out of luck here? I spent a lot of time tracking the error to the Win32 API, and even more time trying to find a possible solution, but I just can't see a way without some way to properly poll what key is down or what shift was just released.
|
# ? Apr 30, 2011 07:32 |
|
Javascript question: I am trying to replace part of a url string so I can output it as a variable to be used by a simple redirect script for mobile users. Example: url is https://www.mysite.com/foo.html?id=randomstring&anotherrandomstring I need it changed to: https://www.mysite.com/mobile.html?id=randomstring&anotherrandomstring Everything else in the url stays the same, including the id's on the end - those being dependant on the logged in user reading the page. Basically I want to swap in the word "mobile", then do a little js routine that grabs that new url and sends iphone, android, etc users on their merry way. Any guidance?
|
# ? May 2, 2011 04:17 |
|
Ixian posted:url is https://www.mysite.com/foo.html?id=randomstring&anotherrandomstring code:
|
# ? May 2, 2011 06:29 |
|
That'll work, but you're probably better off doing 301/302 server redirects for SEO reasons. (e.g. with apache url rewrites or the ASP/php/etc. equivalent)
|
# ? May 2, 2011 19:22 |
|
Scaramouche posted:That'll work, but you're probably better off doing 301/302 server redirects for SEO reasons. (e.g. with apache url rewrites or the ASP/php/etc. equivalent) Agreed, but he asked for JavaScript. :-)
|
# ? May 3, 2011 01:10 |
|
I've been working on learning Action script and I've been running into a few roadblocks. I'm hoping some of you guys can point me in the right direction for a book or some specific tutorials. I'm trying to make my code OO. So far, I feel like I have the basics of working with classes -- but I'm having a hell of a time organizing my code before I start working. I usually end up just coding in a straight line until things get so messy I give up. The best way I can articulate my main question is to give an example. Right now I'm working on an inventory system for a classic RPG style game. I have no idea how to split it up into classes or where to put the functionality. Should the 'Item' class hold the code for drag/drop and interactive functions? Should the interactive stuff be its own class? Should I make an 'inventory manager' class that handles an array of items? I can make it all work -- but I'm clueless as to how to organize it all efficiently. I'm rip roarin' and ready to code, but I don't want to get too used to coding dirty. If anyone could point me in the right direction I would be grateful.
|
# ? May 3, 2011 03:30 |
|
Baldbeard posted:I'm having a hell of a time organizing my code before I start working. I usually end up just coding in a straight line until things get so messy I give up. Don't organize before you start working, organize as you work. Do one thing look at how it interacts with everything else you have, reorganize. You'll end up changing a lot of things a lot of times but as you do it you'll start making less changes as you get used to how things fit together and evolve a sense of design. This advice is additive to whatever anyone else says. Learn by doing.
|
# ? May 3, 2011 04:34 |
|
Lonely Wolf posted:Don't organize before you start working, organize as you work. Do one thing look at how it interacts with everything else you have, reorganize. You'll end up changing a lot of things a lot of times but as you do it you'll start making less changes as you get used to how things fit together and evolve a sense of design. This advice is additive to whatever anyone else says. Learn by doing. I'd just like to add that you'll probably make some terrible choice and paint yourself into a corner and have to do major refactoring multiple times. This is normal, and don't feel bad about it. It would be worse if you didn't realize you were making mistakes and stuck with it.
|
# ? May 3, 2011 12:25 |
|
Thanks for the encouragement, I will keep chugging along. I'm probably just frustrated because when it comes to coding, I've noticed that there is a great wealth of 'just getting started basics' and 'advanced' resources, with a desert plateau somewhere in the middle.
|
# ? May 3, 2011 14:56 |
|
Alright, I'm not sure where this goes, so I'll just put it here and hopefully it'll get seen. Some emails were sent containing page.php?key=<number> and, for some reason, a bunch of users are having trouble with the ? getting auto-mangled into %3f when they click on the links in their email clients. I'm trying to come up with a quick server-side fix for this using RewriteRule, but none of these are matching: code:
|
# ? May 3, 2011 15:29 |
|
Munkeymon posted:Alright, I'm not sure where this goes, so I'll just put it here and hopefully it'll get seen. I confirm that the last one ought to match, unless you're confused about what you're getting over the wire. If these rules are in <virtualhost> context,and not htaccess/Directory, the anchor is wrong since what you're matching against will always start with a slash (you can just add it the slash)
|
# ? May 3, 2011 18:52 |
|
Baldbeard posted:Thanks for the encouragement, I will keep chugging along. I'm probably just frustrated because when it comes to coding, I've noticed that there is a great wealth of 'just getting started basics' and 'advanced' resources, with a desert plateau somewhere in the middle. The middle is occupied by "rewriting your own terrible code a bajillion times." There isn't any way around it.
|
# ? May 3, 2011 19:06 |
|
covener posted:I confirm that the last one ought to match, unless you're confused about what you're getting over the wire. If these rules are in <virtualhost> context,and not htaccess/Directory, the anchor is wrong since what you're matching against will always start with a slash (you can just add it the slash) It's not in <virualhost>. I think the problem may be that my test machine is Windows so ? just isn't a valid character in a path because when I do this: code:
|
# ? May 3, 2011 19:17 |
|
pokeyman posted:Agreed, but he asked for JavaScript. :-) Of course, and your solution was right. It's just that javascript might not be... the best solution for a redirect problem.
|
# ? May 3, 2011 19:21 |
|
Munkeymon posted:It's not in <virualhost>. I think the problem may be that my test machine is Windows so ? just isn't a valid character in a path because when I do this: I'm not entirely clear on the applicability of this to the original problem, in this context the bare ? would terminate the URL-path and start the substituted query string. Perhaps the common thread is that you have some windows specific thing blowing up long before htaccess rewritess can even be processed due to the invalid URI->FS mapping. In that case, you should move your rewrites out of htaccess/Directory and into VirtualHost context -- they run earlier there in the Apache API. Fix the anchor and tack on a PT flag as well.
|
# ? May 3, 2011 19:43 |
|
covener posted:I'm not entirely clear on the applicability of this to the original problem, in this context the bare ? would terminate the URL-path and start the substituted query string. I was trying to figure out whether it thought there was a query string or not by setting up a situation where I could only get two responses and which one I got depended on the presence of a non-empty QS. It turns out that in my local setup at least, there's a comedy third option which is to fail with an error without hitting a rewrite rule (or I'm misunderstanding something which is quite possible). quote:In that case, you should move your rewrites out of htaccess/Directory and into VirtualHost context -- they run earlier there in the Apache API. Fix the anchor and tack on a PT flag as well. I tried moving the rules into my <Directory settings for my local webroot and it didn't change anything. We don't use virtual hosts by decree from on high, so I'm not even going to try setting one up for a test.
|
# ? May 3, 2011 21:14 |
|
Baldbeard posted:Thanks for the encouragement, I will keep chugging along. I find that I often realize I need a refactor, but I keep struggling with what I've got until I reach a breaking point. Then I do the refactor and it feels so good!
|
# ? May 3, 2011 23:13 |
|
Munkeymon posted:We don't use virtual hosts by decree from on high, so I'm not even going to try setting one up for a test. The equivalent to VH context in that case would simply be at the bottom of your apache configuration, not inside any other context -- which acts as like a catch-all vhost. This would get your rules running earlier.
|
# ? May 4, 2011 02:58 |
|
Alright, I'm on the road to learning the basics of python, and picking it up fairly decently. Should I get a more advanced book for python, or should I look at learning another language? e: More information: I have no specific need for any one language. I'm just learning stuff to learn right now. Would it be better to have a basic knowledge of all languages or have a firm grasp of one? Gothmog1065 fucked around with this message at 19:03 on May 4, 2011 |
# ? May 4, 2011 18:57 |
Learning another language is never bad, although the choice of which one can be important I'd suggest to keep using Python to write still more programs. Try to hold off on buying another book, instead see if how much you can pick up from reading library documentation on things you haven't worked with yet. It's a good skill to be able to figure out how to use a library from just its reference documentation. As for a second language I'd suggest something C-like. Either pure C, C++ or C#. Java if you're feeling extra masochistic. Two reasons, first is to try a different kind of syntax (on some points more strict and others less strict than Python) and second to use a more strongly typed language. Maybe also try dabbling with an SQL database and learn some basic relational database theory and the SQL query language. Python comes with the SQLite library that allows you to work with an SQL database without installing a database server. Yes I just wrote Structured Query Language query language.
|
|
# ? May 4, 2011 19:36 |
|
nielsm posted:C, C++ or C#. Java None of these languages are more strongly typed than Python. C in particular is weakly typed. Perhaps you mean a static type system?
|
# ? May 4, 2011 20:07 |
Lysidas posted:None of these languages are more strongly typed than Python. C in particular is weakly typed. Perhaps you mean a static type system? You're probably right. Statically checked types is my point of suggesting those languages at least.
|
|
# ? May 4, 2011 20:11 |
|
Learn erlang! it is munctional
|
# ? May 4, 2011 22:02 |
|
This isn't working:code:
code:
Deviant fucked around with this message at 20:26 on May 5, 2011 |
# ? May 5, 2011 20:20 |
|
Deviant posted:Any idea why? This is on a Solaris 10 system, ksh shell Single quoted strings do not resolve variables inside of them by default. Try double quotes.
|
# ? May 5, 2011 20:40 |
|
baquerd posted:Single quoted strings do not resolve variables inside of them by default. Try double quotes. That was my first thought. Been there, done that. No dice. code:
code:
|
# ? May 5, 2011 21:18 |
|
Deviant posted:
I don't know anything about sed but I am reasonably sure that a regular expression substitution like that won't work unless you escape the slashes in $TARGET somehow. code:
code:
|
# ? May 5, 2011 22:15 |
|
Does anyone know much about Processing? The reason being is, I'm stuck with a probably trivial problem, regarding sine waves (I think). If you imagine having a series of circles (in an ArrayList) that move from offscreen towards the centre of the screen in a straight line, this is pretty simple enough for me to code, if (x > width/2) { x--; }, same for y, and so on... It's having those circle objects 'snake' their way around, that's confusing me. I suppose similar to this, in a way, http://www.openprocessing.org/visuals/?visualID=6545 though not necessarily that complex, a simple S shape approach is what I'm looking for here, hence the sine wave? Any pointers would be appreciated, thanks...hoping to turn these circles into enemy objects at some point..
|
# ? May 5, 2011 23:33 |
|
MrDog posted:Does anyone know much about Processing? The reason being is, I'm stuck with a probably trivial problem, regarding sine waves (I think). I'm not entirely sure what you are asking, but I think that I understand enough to be able to point you at parametric equations. Basic idea being that X and Y coordinates are functions of (at least) one other parameter (t). As t changes, X and Y evolve. So basically your different points in the snake will have different starting t's but the size of delta-t will be the same. So all circles will follow after one another. Using parametric equations you can make a ton of different patterns. Alternately, you could vary the equations for X(t) and Y(t) over time to get a seemingly random movement. Hope this helps somewhat?
|
# ? May 6, 2011 02:17 |
|
This is kind of a silly question but it's been vexing me (CJ for job, coder for hobby) for years. Let's say you have an array, and you want to output that array in a comma separated list. Any trivial way of doing this, let's say code:
What's the best way to avoid that. Like what do they teach you in university to do in such a case.
|
# ? May 6, 2011 14:45 |
|
if(i < a.length-1){ put a comma }
|
# ? May 6, 2011 14:56 |
|
So I've grown to the point with my clients in terms of relations that they're asking for pretty hectic dba type work. Note: this is 99% MySQL as that is what I've focused on in terms of database analysis. I'm able to identify queries that cause locking issues, basic schema overhaul and tweaking variables to assist with databases but I need a better grasp of how MySQL as a whole works and better-tweaking database schema. Like I can use explain on a query and have a rough idea on what to do in regards to indexing but I want to know how it works under the hood as I've seen in the past that while you might optimize one query that added index might affect others so that they run slower. Anyone have some good books to suggest that I can read over to better-understand this stuff? I've read a lot of o'reilly books like high performance mysql . As an aside I had identified some queries a client was causing issues with and he ended up hiring Percona to look over his server and they said the same things. So that was a nice ego booster but I really would like to be able to tell clients "Hey, do this as MySQL sucks at this." My major points of focus are InnoDB and MyISAM.
|
# ? May 6, 2011 15:04 |
|
peak debt posted:This is kind of a silly question but it's been vexing me (CJ for job, coder for hobby) for years. http://msdn.microsoft.com/en-us/library/57a79xd0.aspx or nearest equivalent.
|
# ? May 6, 2011 15:46 |
|
peak debt posted:This is kind of a silly question but it's been vexing me (CJ for job, coder for hobby) for years. Write the obvious code that does it and worry less about one-liners i.e, in pseudocode if (len > 0) { print a[0] for (n in 1 ... len-1) { print ", ",a[n] } }
|
# ? May 6, 2011 17:31 |
|
peak debt posted:What's the best way to avoid that. Like what do they teach you in university to do in such a case. I just have to tell you that you wont be taught such trivial things if you study computer science at the university. Programming is merely a heavily employed tool and not the focus of study.
|
# ? May 6, 2011 19:30 |
|
I'm looking at getting a Master's degree, but I'd like to do it part-time, and online if possible. I see that the University of Illinois offers an online "Master of Computer Science" (http://courses.illinois.edu/cis/2011/fall/programs/graduate/computer_science.html). This is a non-thesis program, which differentiates it from the standard "Master of Science, Computer Science." What disadvantages would such a program entail? If I wanted a PhD in the future, would this be problematic? Would employers view MCS differently than MSCS? Is this really not a big deal at all?
|
# ? May 6, 2011 19:59 |
|
_aaron posted:I'm looking at getting a Master's degree, but I'd like to do it part-time, and online if possible. I see that the University of Illinois offers an online "Master of Computer Science" (http://courses.illinois.edu/cis/2011/fall/programs/graduate/computer_science.html). This is a non-thesis program, which differentiates it from the standard "Master of Science, Computer Science." What disadvantages would such a program entail? If I wanted a PhD in the future, would this be problematic? Would employers view MCS differently than MSCS? Is this really not a big deal at all? Some employers might care, but others won't. If you really want to do a PhD, there are a number of reasons why a traditional master's degree is a much better choice.
|
# ? May 6, 2011 21:54 |
|
ultrafilter posted:If you really want to do a PhD, there are a number of reasons why a traditional master's degree is a much better choice. I'm not the one who was asking, and I believe you, but what are some of those reasons?
|
# ? May 6, 2011 22:17 |
|
|
# ? May 16, 2024 11:23 |
|
pokeyman posted:I'm not the one who was asking, and I believe you, but what are some of those reasons? Most PhD's don't get a masters then just "decide" to go get the doctorate unless they want to stick around for 4-6 more years working on it. PhD's that get it done are PhD students their first year in graduate school, even if their program includes a Masters as well. Your entire academic career will shift dramatically if you try to get in to the PhD club and you will want to be focusing on that out of the gate.
|
# ? May 6, 2011 22:41 |