|
Jerry SanDisky posted:stuff If you care less about words than strings of characters you can also use: Python code:
|
# ? Feb 3, 2013 00:19 |
|
|
# ? May 30, 2024 00:55 |
|
Orzo posted:Oops, sorry, no it wouldn't and I read your original question incorrectly, I didn't see that you had to actually list the sets. But, at least it verifies your count! Nah, you read it right. I was just checking to make sure I wasn't missing a painfully obvious solution that was different from mine. Also that my number of states was correct. nielsm posted:Well yes it will. Yeah, I just got the "actual" count and list by doing it like I said and treating them as a 7 digit base 3 number. That way the class for a set can even have a nice numerical value for sorting / searching in lists as well as whatever other bullshit I want. Thanks for all the help.
|
# ? Feb 3, 2013 00:41 |
|
Did anyone give the Facebook Hacker's Cup a try this year? I made it past the qualifying rounds but that's as far as I'm going. It was rough! I'm self taught and don't have much experience with thinking in algorithms, so it was a pretty exciting exercise. The first round was simple enough, but the second round they made their test inputs HUGE and I guess it really tests how efficient your program runs. I wrote in PHP since it's what I know best, and although my sample inputs ran in milliseconds, it choked on the actual input for each of the problems. Are there any similar competitions/problem sets online somewhere that I can work through? I always pay attention to efficiency in my JavaScript and things like that, but this took it to a new extreme and I'm really interested in learning more.
|
# ? Feb 3, 2013 01:43 |
|
Project Euler, perhaps? It's a (large) series of math-focused programming problems. In most cases, there'll be an "easy" version of a problem that can be brute-forced, and then a "hard" version later on that's the same type of problem but with a much larger input, requiring a more elegant approach.
|
# ? Feb 3, 2013 01:48 |
|
Orzo posted:Hey, I know I already responded to this earlier, but could you possibly elaborate on this? Could you show me what part of the docs suggests this? I've browsed through them too, but I don't remember seeing anything that suggests returning functions inside functions is invalid.
|
# ? Feb 3, 2013 02:17 |
|
What's the general opinion of Codecademy around here? I recently came back to it and it seems to have gotten out of its growing pains. It doesn't crash and everything seems to work properly now. Is it worth my time? Will I actually get anything out of it beyond a too-basic-to-do-anything familiarity? I'm burning through JS, but I think that's mostly the C I learned during my Math degree.
|
# ? Feb 3, 2013 04:36 |
|
biochemist posted:Did anyone give the Facebook Hacker's Cup a try this year? I made it past the qualifying rounds but that's as far as I'm going. It was rough! I'm self taught and don't have much experience with thinking in algorithms, so it was a pretty exciting exercise. The first round was simple enough, but the second round they made their test inputs HUGE and I guess it really tests how efficient your program runs. I wrote in PHP since it's what I know best, and although my sample inputs ran in milliseconds, it choked on the actual input for each of the problems. I did. I was traveling, so I only did the beautiful strings, which was pretty easy. I used a regex to filter out non-alphabet characters, lowercased all of the characters, then constructed a multiset (using Guava) that counted the occurrence of each letter. From there it was a simple mater of iterating over it in sorted order from most occurrences to least. Totally used the poo poo out of Guava to do the hard stuff, so I'm not sure if I'll continue doing more.
|
# ? Feb 3, 2013 07:12 |
|
Doctor w-rw-rw- posted:I did. I was traveling, so I only did the beautiful strings, which was pretty easy. I used a regex to filter out non-alphabet characters, lowercased all of the characters, then constructed a multiset (using Guava) that counted the occurrence of each letter. From there it was a simple mater of iterating over it in sorted order from most occurrences to least. Totally used the poo poo out of Guava to do the hard stuff, so I'm not sure if I'll continue doing more. Nice. I used a PHP sanitize string function to remove non-alphabet characters, exploded them into an array, and counted them up into another array, then pretty much did what you did. Round 1 (I think they were calling the round with Beautiful Strings the qualifying round) had problems that you had to think a little bit harder about solutions for. One question involved calculating how many possible positions you could place an image on a monitor without the image falling on a dead pixel. The test cases were along the lines of a 4x4 pixel monitor with 1 dead pixel and a 1x1 pixel image. I way overthought it and iterated through all of the possible starting positions and didn't count them if they fell on a dead pixel- my local server timed out when the real inputs involved 1,000,000 x 1,000,000 pixel monitors. I think the real solution would have been (width of monitor - width of image) x (height of monitor - height of image) for total number of starting positions and then for each dead pixel, you lose all of the starting positions north and west of the dead pixel by the width and height of the image (unless they go outside of X=0 or Y=0). It's a much easier solution than what I baked up, but I hit the ground running and started writing code before I really thought about the bounds of the inputs. Pretty cool exercise though, it really reinforces a lot of best practices that you read about but don't get many chances to implement.
|
# ? Feb 5, 2013 16:24 |
|
biochemist posted:and then for each dead pixel, you lose all of the starting positions north and west of the dead pixel by the width and height of the image (unless they go outside of X=0 or Y=0).
|
# ? Feb 5, 2013 17:36 |
Plorkyeran posted:You also have to handle dead pixels which are fewer pixels than the image size apart. Just position the image such that the dead/stuck pixels are over where it should be that color anyway
|
|
# ? Feb 5, 2013 17:41 |
|
Oh poo poo, I missed Round 1. I got pretty caught up in writing a League of Legends game file parser in Go. Oh well.
|
# ? Feb 5, 2013 18:52 |
|
I've got a custom-built appliance that I need to make an interface for. I have a manual (in Japanese, ugh) with specifications for packets, but the problem is that I've never done anything this low-level before and don't even know what keywords I should be looking for. The commands have a STX, command, data length, flags, ETX, BCC. Responses have STX, ACK, data length, error code, ETX, BCC. What do all of those abbreviations mean? What are some terms I should be googling for to find good documentation for this kind of thing? Will scapy be useful for this? I have zero clue where to start...
|
# ? Feb 5, 2013 22:47 |
|
How about programming conferences? Last year I did Microsoft TechEd, which wasn't as interesting as I had hoped. There was a little too much general IT in it, and most of the .NET stuff was talking about the new async/await syntax in the same way, over and over. So I was hoping for something else. It doesn't even have to be as huge. I was looking down a generic list of upcoming events and saw Code Palousa: http://lanyrd.com/2013/codepalousa/ At least by topic, it seems kind of interesting. Is there anything for general software development conferences I should be thinking about? I'm interested in technologies, techniques, planning stuff, kind of the whole discipline. I would prefer something that isn't too focused on one language.
|
# ? Feb 5, 2013 23:02 |
|
tarepanda posted:I've got a custom-built appliance that I need to make an interface for. I have a manual (in Japanese, ugh) with specifications for packets, but the problem is that I've never done anything this low-level before and don't even know what keywords I should be looking for. I've done a fair amount of work in interfacing with old in-house protocol and from how varied things can be it's hard to say whether Scapy suits the job or not, though from the look of it I can't imagine there's much it can't do. If you're lucky you'll be dealing with a common transport protocol (TCP/IP or IPX or UDP) and your actual interface will be entirely represented in the packet payload, which is amazingly easy work if you have all that documented. My recommendation would be to look into something like Wireshark and capture some actual traffic to and from your appliance to client, and see if you can derive any additional knowledge from that. IIRC the *standard* STX and ETX values are 0x02 and 0x03 (possibly both preceded by a DLE 0x10) and ACK is 0x06, though depending on how rowdy your appliance developers were it could be anything, but those are good values to look for to start with. The Gripper fucked around with this message at 23:24 on Feb 5, 2013 |
# ? Feb 5, 2013 23:20 |
|
Plorkyeran posted:You also have to handle dead pixels which are fewer pixels than the image size apart. How would you do this efficiently? Add each bad starting loc to an array and count unique entries in it? Do it mathematically somehow?
|
# ? Feb 5, 2013 23:25 |
|
biochemist posted:How would you do this efficiently? Add each bad starting loc to an array and count unique entries in it? Do it mathematically somehow? If it's the former then I hate the question (I dealt with nesting algorithms in sheet metal manufacture and it's a huge processing time vs. accuracy problem). If it's the latter then you shouldn't need to bother with handling dead pixels which are close together specifically, since blacklisting pixels left and up from each dead pixel the width and height of the image would result in no leftover non-blacklisted pixel where an image could be placed that would overlap with a dead pixel. So I'd subtract the number of pixels in the blacklisted region from the 1 trillion pixel total (1 million x 1 million), determine edges of the screen where an image can't be placed due to exceeding screen boundaries, and subtract pixels that haven't already been subtracted by the dead pixel blacklisting part. Result should be the count of pixels where placing an image wouldn't overlap with a dead pixel or screen boundary. Good chance I've gotten some assumption there wrong, though!
|
# ? Feb 5, 2013 23:52 |
|
biochemist posted:How would you do this efficiently? Add each bad starting loc to an array and count unique entries in it? Do it mathematically somehow? Given: a screen of H x W and an image of h x w. For each dead pixel (x,y), queue up an event that turns it off at time x and turns it back on at time x+w. (I am assuming that pixels are 0-indexed.) Also queue up an end-of-screen event at time W. You will be keeping a sorted multiset D of "currently" dead rows. For an event at time t, D will tell you the rows an image beginning at x-w (that is, not reaching all the way into column t) cannot overlap. Seed this set with -1 and H to represent the top and bottom of the screen. You will need to remember the last time tprev of an event. This starts at 0. You will also need to remember total, the running total of allowed image locations, also obviously starting at 0. For each event: 1. If the time is less than w, or if t = tprev, just skip to step 5. 2. Compute the total number of valid top-of-image rows given the currently-dead rows in D: 2a. For each successive gap (between entries y0 and y1) in D, this is min(y1-y0-h, 0). You need only consider each multi-entry once. 3. Multiply this sum by t - tprev, the number of columns configured exactly like this. 4. Add that result to total. 5. If the event is the end-of-screen event, stop; the final result is total. 6. Otherwise, add or remove a dead row from D as required by the event. 7. Set tprev to t.
|
# ? Feb 6, 2013 01:45 |
|
I'm writing a .NET/C# thing that sets up Sublime Text 2 with GCC for programming/building in C, to make things simple for my poor undergrad friends who find this poo poo hard I'm trying to get the sublime text build system working so it builds and then executes a single C file, however I'm having trouble getting the "and execute" part to work well: so far i've got: code:
if I use: code:
If I simply start it, the stdout stuff gets redirected to the sublime text shell thing properly, but it doesn't let you interact with it code:
e: ahahaha literally after posting it i cracked this. You gotta use code:
Mr SuperAwesome fucked around with this message at 19:30 on Feb 6, 2013 |
# ? Feb 6, 2013 19:26 |
If your friend can't learn to open a console window, switch directory and type 'make poo poo' to get poo poo.c compiled then maybe he should find another line of study. Basic use of make is really simple and you shouldn't be writing C if a command line gives you nightmares.
|
|
# ? Feb 6, 2013 19:39 |
|
Seeing how a couple of people have expressed interest, I figured I'd post this write-up that I found through the Facebook group. http://notes.tweakblogs.net/blog/8674/facebook-hacker-cup-2013-round-1-problem-analysis.html
|
# ? Feb 7, 2013 04:43 |
|
Cross-posting this from the Game Dev thread in Games. UC Berkeley is going to be doing AI and graphics programming courses through edX. AI starts a week from Monday, graphics programming a month from then.
|
# ? Feb 8, 2013 06:52 |
|
Got a licensing question. (I think there used to be a thread for it, but I guess it got archived) I'm using a modified (stripped-down) form of some Apache projects. This means I have to add a notice to every modified file that I have modified it. How exactly is this notice supposed to be worded, and where do I put it? As an example, this is one of the files I've modified locally.
|
# ? Feb 8, 2013 19:31 |
|
The file you linked is released under the Apache 2 license. The first thing to note is that the clause in that license regarding derivative works only really applies if you are redistributing the derivative work. If you aren't distributing it, then you are free to modify it as you see fit without worrying about clearly marking the changes. Assuming you are redistributing it then you need to follow the rules in section 4:quote:4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: All it really says that pertains to your question is that you have to clearly mark the files you've changed (I would do this with an obvious comment at the top of the file). If your change was to remove files, then you should put a new file in (possibly in the NOTICE file they mention) indicating what you carved out. I am not a lawyer, but following those general guidelines has been enough to satisfy people doing due diligence before investing large amounts of money at previous places I have worked. Edit: spelling, grammar armorer fucked around with this message at 19:48 on Feb 8, 2013 |
# ? Feb 8, 2013 19:43 |
|
Wolfgang Pauli posted:Cross-posting this from the Game Dev thread in Games. UC Berkeley is going to be doing AI and graphics programming courses through edX. AI starts a week from Monday, graphics programming a month from then. The AI class is CS188, taught by Dan Klein, who is a fantastic instructor. Highly recommended.
|
# ? Feb 8, 2013 19:47 |
|
Wolfgang Pauli posted:Cross-posting this from the Game Dev thread in Games. UC Berkeley is going to be doing AI and graphics programming courses through edX. AI starts a week from Monday, graphics programming a month from then. It has a stats prereq and I never took stats. Should I go through the stats class first or will it be simple enough to pick up along the way?
|
# ? Feb 8, 2013 20:59 |
|
Munkeymon posted:It has a stats prereq and I never took stats. Should I go through the stats class first or will it be simple enough to pick up along the way? If you have a really, really solid grasp of probabilities then you might be able to scrape by. If not, you'll need to study up and review beforehand and make sure you've got them down, or,you'll get pretty lost. It's not that it gets hyper-mathematical, but the midterms and finals were absolutely loving brutal if you didn't have them down, since a lot of the material does need a solid grasp of probabilities.
|
# ? Feb 8, 2013 22:51 |
|
Doctor w-rw-rw- posted:If you have a really, really solid grasp of probabilities then you might be able to scrape by. If not, you'll need to study up and review beforehand and make sure you've got them down, or,you'll get pretty lost. It's not that it gets hyper-mathematical, but the midterms and finals were absolutely loving brutal if you didn't have them down, since a lot of the material does need a solid grasp of probabilities. I can calculate my odds of winning the lottery, but I'm guessing that doesn't quite cut it. Guess I could take the stats class and watch out for more relevant stuff later.
|
# ? Feb 8, 2013 22:56 |
|
This is a javascript question- Trying to round a variable up with this code: code:
|
# ? Feb 10, 2013 04:35 |
|
Brady posted:This is a javascript question- Probably because you have to set timeElapsed to the ceil value. So replace that line with timeElapsed = Math.ceil(timeElapsed);
|
# ? Feb 10, 2013 04:39 |
|
Brady posted:This is a javascript question- timeElapsed = Math.ceil(timeElapsed / 15)
|
# ? Feb 10, 2013 04:42 |
|
I see. Thanks for the help guys.
|
# ? Feb 10, 2013 04:48 |
|
Javascript doesn't have pass by reference at all.
|
# ? Feb 10, 2013 05:27 |
|
I have a workflow problem that's been driving me nuts lately. I do development on a cross-platform codebase that I can run locally on my laptop, and also on our Solaris server at the office. Often times during execution of the program, an error will pop up that doesn't happen because of platform differences. Whether its memory alignment or endianness issues, I have to debug it. Unfortunately, this happens a lot when I'm at home on the weekend while the process is running (it's a data compiler for geospatial data), and it takes a long time to run. I've found that vim runs terribly slow on the Solaris server. Not sure why, maybe it's my gigantic vim configuration, but it seems like a lot of disk access is slow on the server. Syntax highlighting is dog slow on large files, etc. etc. and it's near impossible to work on it. So majority of the time I just mount the codebase over NFS and edit the files locally. This works great, however, when I'm at home, NFS remote mount is out of the question. I COULD keep pushing to the git repo, but that means a ton of pushes while I debug, then finally rebasing all the changes and making them into a single commit. Having to constantly push for a few line changes is driving me up the wall. Any suggestions for a workaround on this? Or am I just going to have to suck it up?
|
# ? Feb 10, 2013 19:22 |
|
Can you remote into your workstation and work on stuff from there? Or is your workstation your laptop, and you're worried about latency with NFS-mounting stuff at home? Or are you able to SSH into the server from anywhere, but can only mount the drive over NFS from the office? You could set up some autocmds to sync changed files to the server whenever you write them locally, or something.
|
# ? Feb 10, 2013 19:32 |
|
Is your home network connection really slow? SSHFS with compression might suffice. Suck it up with Solaris vi would be the most convenient.
|
# ? Feb 10, 2013 20:21 |
|
Had a question about a Windows batch file. I'm trying to run a file from it, and I'm doing something like;code:
code:
|
# ? Feb 11, 2013 00:57 |
|
Jabor posted:Can you remote into your workstation and work on stuff from there? Or is your workstation your laptop, and you're worried about latency with NFS-mounting stuff at home? Or are you able to SSH into the server from anywhere, but can only mount the drive over NFS from the office? My workstation is my laptop, and latency over NFS would be a problem. However, this post got me thinking of a solution, we have a VMware server that has a bunch of test servers I can use to access vim from and mount the NFS share. I can do everything I need without having to do a bunch of git commits. Now I don't have to figure out why vim on Solaris is so damned slow, or waste my time trying to get decent performance in a text editor.
|
# ? Feb 11, 2013 05:19 |
|
Azerban posted:Had a question about a Windows batch file. I'm trying to run a file from it, and I'm doing something like; code:
|
# ? Feb 11, 2013 16:56 |
|
In addition to the edX courses I already posted, Coursera is offering part 1 of the Algorithms class they run through Princeton. It's Java-based and is going to cover searching and sorting. It's already begun and the first assignments are due in a week, so jump in before then. Part 2 starts next month and is going to get into Algorithms of Note that carry fancy names like Dijkstra and Kosaraju.
|
# ? Feb 12, 2013 03:09 |
|
|
# ? May 30, 2024 00:55 |
|
Jethro posted:I think you need to put an additional set of quotes around the whole thing. One of the billion things I tried. I buckled and rewrote the drat thing in Powershell, problem solved.
|
# ? Feb 12, 2013 04:30 |