|
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 June 30 2013 01:04 3FFA wrote: I'm curious, what steps(if any) do you guys take before you sit down and start actually programming? Do you write Pseudo-code? Do you write an outline of what you'll do? Do you draw a map of some kind? etc. Long abstract discussions with PMs, co-workers. Design docs. Lots of drawing boxes & lines on whiteboards. Think and map out system in head. Read lots of existing code. Think and map out new code in head.
Write tests, haha no I don't write tests first. Fuck that.
Write all code.
Write unit tests. Go back and rewrite code that wasn't easy to unit test because I fucked up.
Write integration tests. Go back and rewrite code that wasn't easy to write integration tests for because I fucked up.
Write monitoring code. Write logging code. Go back and maybe test the monitoring code. Do more productionization bullshit blah blah blah...
The actual writing of code is the easy part
|
On June 30 2013 01:04 3FFA wrote: I'm curious, what steps(if any) do you guys take before you sit down and start actually programming? Do you write Pseudo-code? Do you write an outline of what you'll do? Do you draw a map of some kind? etc. Depends what I'm doing. The harder or less clear it is, the more I tend to map it out and/or run my thoughts by my manager. The main thing is usually keeping edge cases in mind and taking an approach that is maintainable and performs well. We have a lot of edge cases on my current project and lacking requirements from the client.
Simple things I rarely spend much, if any, time to plan.
You'll come to hate all test code you have to write.
|
I've been working my way through the MIT OCW computer science stuff, and have gotten stuck on a problem set here. While I managed to do the first two problems, the final one has gotten me completely stuck. This is what I first came up with, but the output I get isn't even close to what it should be. I'm certain the problem is with my while loop, so I changed it to this, however that gives me no output and I'm on the verge of giving up as I have no idea what to do :/
|
On July 01 2013 02:37 kollin wrote:I've been working my way through the MIT OCW computer science stuff, and have gotten stuck on a problem set here. While I managed to do the first two problems, the final one has gotten me completely stuck. This is what I first came up with, but the output I get isn't even close to what it should be. I'm certain the problem is with my while loop, so I changed it to this, however that gives me no output and I'm on the verge of giving up as I have no idea what to do :/
Have you checked out the wikipedia article? There's example pseudo code:
INPUT: Function f, endpoint values a, b, tolerance TOL, maximum iterations NMAX CONDITIONS: a < b, either f(a) < 0 and f(b) > 0 or f(a) > 0 and f(b) < 0 OUTPUT: value which differs from a root of f(x)=0 by less than TOL
N ← 1 While N ≤ NMAX { limit iterations to prevent infinite loop c ← (a + b)/2 new midpoint If (f(c) = 0 or (b – a)/2 < TOL then { solution found Output(c) Stop } N ← N + 1 increment step counter If sign(f(c)) = sign(f(a)) then a ← c else b ← c new interval } Output("Method failed.") max number of steps exceeded
The function would be the same as in your 2nd problem, the interval and tolerance are given as well (in the pdf). NMAX should be a high enough value, but you can go for an infinite loop as well (while true :p)
|
What would the tolerance be? Sorry if I'm being obtuse, but I can't work it out XD
|
The bisection method is actually binary searching, I see now. The principle of binary searching is pretty simple, an example would be the 'guess my number' game:
There's an interval (for example 1-100), and you start guessing in the middle of this interval. You then get to know wether the answer is higher or lower than this center value (50 in the example), and start the process again until you've found the correct value.
So you got your lower- and upperbound, what you need to do is check if the middle of this range is the correct value to pay off correctly in exactly 12 months. If it's too low (so you dont reach the amount necesairy to pay off everything including monthly interest), you can replace your lower bound by this value. If it's too high, the other way around. You keep doing this until your value is within the tolerance range (it has to be correct to the cent, so 0.01) 
If you want I can give an example in c or c++, python is on my list of languages to learn soon... EDIT: Implementation in c++, I tried to comment enough for you to understand  Small note tho, this code assumes there's always a 12 month period to pay off, modifying it to see if it could be done in fewer months shouldn't be much of an issue though.
|
|
|
Thanks for the replies.
Since Mathlab is free for me (University Licence, yay!) figured that I should really start with that. But I am keeping in mind to maybe do a Python Tutorial to have at least a little overview of what programming actually can do.
|
I'm trying to send keyboard input to a (preferably background) window, specifically Open Broadcaster Software. From what I can find out, I need to use PostMessage if I want it to remain a background window. However, I can't get that to work.
Relevant code:
HWND obs; obs = FindWindow(NULL, "Open Broadcaster Software v0.522b"); if(!obs) { printf("Failed to get obs Window"); } else { printf("success"); }
PostMessage(obs,WM_KEYDOWN,VK_F8,0); PostMessage(obs,WM_KEYUP,VK_F8,0);
It prints success but the scene doesn't change in OBS (which is of course what I'm trying to do. The scene hotkey works fine if OBS is in the foreground and I manually change it.)
Does anyone here know what I'm doing wrong?
|
Does anyone else really enjoy coding on rainy days compared to sunny ones?
|
Can anybody please explain to me how does compareTo work in java for strings? I can't seem to wrap my head around it :/
Like:
System.out.print("Comparing \"axe\" with \"dog\" produces "); int i = "axe".compareTo("dog"); System.out.println(i); The output is -3. But what does it actually compare?
|
|
|
|
|
Does it hurt your job chances if your university BSc degree is called 'Computer Information Systems' instead of 'Software Development' or 'Computer Science'? My Computer Science department offers these programmes:
Computer Information Systems: http://intranet.csc.liv.ac.uk/teaching/programmes/programme.php?pcode=G500 Software Development: http://intranet.csc.liv.ac.uk/teaching/programmes/programme.php?pcode=G610 Computer Science: http://intranet.csc.liv.ac.uk/teaching/programmes/programme.php?pcode=G400
I have noticed that what I have in 'Software Development' in year 3 (final year) is possible to have with 'Computer Information Systems' as well. I just need to check what the mandatory module is, but I think all modules are overlapped anyway.
I need to make a decision because I screwed one module, and I probably can't go to re-sit in August, so my only chance is to change my programme to CIS.
If this helps, I'm planning to do software programming once I graduate.
Edit: Is it ok to compensate for this if I get MSc in Software Engineering or is this not possible to freely choose MSC Software Engineering if you didn't take BSc Software Engineering? I'm just curious if there is hope, so anything you can help with is welcome. I usually prefer answers from already professional developers. 
|
I'm trying to find a pixel with a certain color in java.
for (int i = MIN_XY.y; i < MAX_XY.y; i++) { for (int j = MIN_XY.x; j < MAX_XY.x; j++) { if (screen.getPixelColor(j, i).equals(RINGCOLOR)) { xy[0] = j; xy[1] = i; return xy; } } }
It works, but is incredibly slow. Is there a better way to do it?
|
It is much faster if you take a screen capture of the area you're interested in and then search the pixel data of the image.
BufferedImage image = screen.createScreenCapture(new Rectangle(X_MIN, Y_MIN, X_MAX, Y_MAX)) Array[int] pixelColors = ((DataBufferInt) image.getRaster.getDataBuffer).getData
Then simpyl iteratore over pixelColors and compare to YOURCOLOR.getRGB
|
On July 02 2013 06:56 darkness wrote:Does it hurt your job chances if your university BSc degree is called 'Computer Information Systems' instead of 'Software Development' or 'Computer Science'? My Computer Science department offers these programmes: Computer Information Systems: http://intranet.csc.liv.ac.uk/teaching/programmes/programme.php?pcode=G500Software Development: http://intranet.csc.liv.ac.uk/teaching/programmes/programme.php?pcode=G610Computer Science: http://intranet.csc.liv.ac.uk/teaching/programmes/programme.php?pcode=G400I have noticed that what I have in 'Software Development' in year 3 (final year) is possible to have with 'Computer Information Systems' as well. I just need to check what the mandatory module is, but I think all modules are overlapped anyway. I need to make a decision because I screwed one module, and I probably can't go to re-sit in August, so my only chance is to change my programme to CIS. If this helps, I'm planning to do software programming once I graduate. Edit: Is it ok to compensate for this if I get MSc in Software Engineering or is this not possible to freely choose MSC Software Engineering if you didn't take BSc Software Engineering? I'm just curious if there is hope, so anything you can help with is welcome. I usually prefer answers from already professional developers.  at the end of the day, your skills, not your degree, will get you a job.
|
On July 02 2013 10:43 Release wrote:Show nested quote +On July 02 2013 06:56 darkness wrote:Does it hurt your job chances if your university BSc degree is called 'Computer Information Systems' instead of 'Software Development' or 'Computer Science'? My Computer Science department offers these programmes: Computer Information Systems: http://intranet.csc.liv.ac.uk/teaching/programmes/programme.php?pcode=G500Software Development: http://intranet.csc.liv.ac.uk/teaching/programmes/programme.php?pcode=G610Computer Science: http://intranet.csc.liv.ac.uk/teaching/programmes/programme.php?pcode=G400I have noticed that what I have in 'Software Development' in year 3 (final year) is possible to have with 'Computer Information Systems' as well. I just need to check what the mandatory module is, but I think all modules are overlapped anyway. I need to make a decision because I screwed one module, and I probably can't go to re-sit in August, so my only chance is to change my programme to CIS. If this helps, I'm planning to do software programming once I graduate. Edit: Is it ok to compensate for this if I get MSc in Software Engineering or is this not possible to freely choose MSC Software Engineering if you didn't take BSc Software Engineering? I'm just curious if there is hope, so anything you can help with is welcome. I usually prefer answers from already professional developers.  at the end of the day, your skills, not your degree, will get you a job. People need to take this to heart.
Network >> Portfolio >>>>>>>>>>>> degree
|
On July 01 2013 16:51 Birdie wrote:I'm trying to send keyboard input to a (preferably background) window, specifically Open Broadcaster Software. From what I can find out, I need to use PostMessage if I want it to remain a background window. However, I can't get that to work. Relevant code:
HWND obs; obs = FindWindow(NULL, "Open Broadcaster Software v0.522b"); if(!obs) { printf("Failed to get obs Window"); } else { printf("success"); }
PostMessage(obs,WM_KEYDOWN,VK_F8,0); PostMessage(obs,WM_KEYUP,VK_F8,0);
It prints success but the scene doesn't change in OBS (which is of course what I'm trying to do. The scene hotkey works fine if OBS is in the foreground and I manually change it.) Does anyone here know what I'm doing wrong?
There's really not a proper way to send a keyboard input to a window without activating it. http://blogs.msdn.com/b/oldnewthing/archive/2005/05/30/423202.aspx
|
Did anyone else ever experience a programmers block or know someone who experienced it?
Whenever i write a program, after it reaches a certain size my brain keeps saying "It's all wrong! It should be done better! It's bad, messy and slow!" when those parts are actually working and then it blanks whenever i actually try to finish another part or improve those parts. I program since 23 years and this only started to happen at my last job. The last 6 month i didn't program at all, hoping that taking a break would fix it, but it still happens and makes me really concerned about my future work. It's like i have to unlearn anything i learned in the last few years.
On July 01 2013 16:51 Birdie wrote:I'm trying to send keyboard input to a (preferably background) window, specifically Open Broadcaster Software. From what I can find out, I need to use PostMessage if I want it to remain a background window. However, I can't get that to work. Relevant code:
HWND obs; obs = FindWindow(NULL, "Open Broadcaster Software v0.522b"); if(!obs) { printf("Failed to get obs Window"); } else { printf("success"); }
PostMessage(obs,WM_KEYDOWN,VK_F8,0); PostMessage(obs,WM_KEYUP,VK_F8,0);
It prints success but the scene doesn't change in OBS (which is of course what I'm trying to do. The scene hotkey works fine if OBS is in the foreground and I manually change it.) Does anyone here know what I'm doing wrong?
I don't have much experience with that particular topic but it could be that the check for keyboard input and the message processing in OBS are async, so if the key down/key up are too close to each other, the process might miss it. You could try adding a short sleep, e.g. 200ms between the key down and key up to check if it changes anything.
|
|
|
|
|
|