|
My understanding is that that code is provided, and he's supposed to implement operators on pointCls and lineCls so that it actually works.
|
# ¿ May 9, 2012 03:20 |
|
|
# ¿ May 14, 2024 01:24 |
|
The definition of "design pattern" is basically "a nifty trick to work around a shortcoming in your language of choice".
|
# ¿ May 16, 2012 03:25 |
|
On windows, the WS_EX_LAYERED or WS_EX_TRANSPARENT styles are a couple of options, depending on what exactly you want to do.
|
# ¿ Jun 4, 2012 06:39 |
|
Suspicious Dish posted:Windows doesn't have a way for security reasons. I don't know about OS X. You probably can by making a fullscreen window with WS_EX_TRANSPARENT and WS_EX_TOPMOST. And your painting would consist of grabbing the existing output buffer and playing around with it. Of course this doesn't quite work if anyone other topmost windows show up, but that's something you'd just have to accept.
|
# ¿ Jun 4, 2012 07:37 |
|
GrumpyDoctor posted:This is essentially what I want to do, but it wouldn't be worth the developer time/running time tradeoff to actually roll it myself so I was trying to figure out if someone had already done the heavy lifting somewhere. Depending on your language, pretty much any SortedSet implementation has subset operations already defined for you.
|
# ¿ Jun 26, 2012 09:46 |
|
tef posted:Can you break down the larger jobs into smaller jobs? Assuming no value is gained from a partially-completed job, the only time this is ever worthwhile is if you suspend a job when a newly-arrived one is better to spend processing time on. In all other cases, the result is strictly worse than if you were to process one task to completion before moving on to the next.
|
# ¿ Jul 27, 2012 09:12 |
|
Boris Galerkin posted:That ' mark completely messes up my syntax highlighting. Everything changes color, possibly because it's waiting for a closing ' mark. I'm using the Solarized theme if this makes any difference. Set fortran_dialect so the syntax highlighter knows you're using Fortran77.
|
# ¿ Jul 28, 2012 01:27 |
|
Sounds like it's treating those IV values as characters. Is Base64 decoding to UTF-8 or something?
|
# ¿ Aug 5, 2012 03:09 |
|
How much faster does your application run if you turn off core parking?
|
# ¿ Aug 15, 2012 04:02 |
|
Basically Google wants you to use their API, because then they don't need to send you hundreds of bytes of HTML boilerplate on every request, which just wastes their time/bandwidth and yours.
|
# ¿ Aug 24, 2012 04:28 |
|
Vaginal Engineer posted:This may be a stupid question, but why not just enter the value into the appropriate column instead of all values in one column? This would get rid of the need for tagging the entries with categories, since the column they are in would indicate their category. Because itemizing everything in one vertical list (sorted by date) is better for all the non-categorical things you want balance sheets and ledgers to do.
|
# ¿ Sep 3, 2012 03:15 |
|
Grundulum posted:I'm attempting to modernize a poorly-written program in Fortran (still, for anyone who reads this thread regularly), and the latest monstrosity goes something like this. I apologize in advance for the lack of indentation, but I don't even know how to parse the loop structure here. Looking at what gets executed each iteration: 1. Code block 2 is always executed 2. Code block 1 is executed if the condition is true. 3. Code block 3 is executed if the condition is false. The one complication is that code block 1 is executed once before you reach the loop proper. There might also be some complication around the last time through the loop, but that's hard to tell without knowing what the exit conditions are. Does this help?
|
# ¿ Sep 30, 2012 05:51 |
|
Or if you're going to do it that way just roll code block 3 up with code block 1.code:
|
# ¿ Sep 30, 2012 06:01 |
|
Doing everything without taking your hands off the keyboard is pretty neat. It's hard to appreciate how much time you lose to mousing or hammering on the arrow keys unless you're actually fluent in an alternative. The downside is that it really is a total-immersion editor, and there's not a lot of point in just dabbling in it. Go big or don't bother.
|
# ¿ Oct 9, 2012 02:57 |
|
ToxicFrog posted:Oh, I totally agree; thing is, this is also something you can do in good non-vim editors. It's not that I consider this an unimportant feature, but nor is it a vim-exclusive one. Well yeah, I guess emacs works too. But I think that looking for one "killer feature" that's exclusive to a single editor is a bit of a distraction - you could point to any feature of any other text editor, and I could point out that other editors have that feature as well. The strength of vim is essentially the extensibility - you start with a bare bones editor for very quick plain text editing, and it's very easy to build that up into something optimized for what you use it for. Other editors have similar ecosystems, of course - there's a reason vi/emacs is a traditional flame war topic - but that doesn't mean that they're "better" than vim, just "different".
|
# ¿ Oct 9, 2012 03:20 |
|
Vi does have the advantage of being usable over SSH and also being preinstalled literally just about everywhere you'd ever want to SSH to.
|
# ¿ Oct 9, 2012 04:27 |
|
shrughes posted:That would be more like I would think it's more like: foreach ( var v in someCollection)
|
# ¿ Oct 17, 2012 02:13 |
|
Generally, if you need a comment explaining how some code works, that code is way too clever and you should simplify it. And then write a comment explaining it, because chances are it'll still too clever for you once you come back to it in a month.
|
# ¿ Oct 22, 2012 06:34 |
|
If you change some code, and that makes a comment outdated, just delete the loving comment. If it's still important to have a comment there, the person reviewing your code (you are doing code reviews, right?) can just ask you to write one.
|
# ¿ Oct 25, 2012 00:29 |
|
There are specific cases where partial classes and methods are useful, and they're not particularly useful in more general programming. One example where they are useful is for interacting with automatically generated code - having autogenerated code live in its own file, entirely separate from code written by you, is really handy. The Visual Studio designer does this, for example - when you ask it to create a form, it makes a *.cs file for you to write your code, and a *.designer.cs file which is where it puts the code it generates for that form. That way it can easily modify the *.designer.cs file when you make changes to the form, without worrying about messing up the code you've written.
|
# ¿ Oct 31, 2012 13:56 |
|
Hard NOP Life posted:That could actually be a solution to the problem though :P If you're building a desktop application on anything, that isn't a decade old shitbox, no, it isn't.
|
# ¿ Nov 2, 2012 00:00 |
|
Essentially yeah, the host maintains its own page tables separate from the guest OS. When the guest OS updates its page tables in any way, the host makes a corresponding change to the "real" page tables so they keep matching. When the guest OS maps virtual address A to point to physical address B. That gets trapped by the virtualization layer, which then updates the "real" page tables to point that virtual address A to the actual memory behind what the guest thinks of as physical address B.
|
# ¿ Nov 13, 2012 10:55 |
|
I doubt the data just appears out of the blue, there's likely to be some javascript that polls something and updates the page when new data arrives. The correct solution is probably to figure out where that javascript is getting the data from and looking there yourself.
|
# ¿ Dec 2, 2012 10:36 |
|
Suspicious Dish posted:It seems absurdly silly to build up walls of access control, and then poke right through them. "I personally can't think of a use case for this feature, hence the feature is and will always be terrible". It makes writing unit tests a whole lot less clunky
|
# ¿ Dec 9, 2012 10:36 |
|
Your language probably has a way to say "Sort this sequence of things, using this function that I'm going to provide whenever you need to compare two of them". Figure out what that is, and you've reduced the problem to "How can I compare two of these strings and tell which one is 'bigger'?" The fiddly way is to start at the end of the string, and manually convert it to an integer character by character until you find a non-digit character. The lazy way is to use a regex or something to pull out the last series of digits, and then convert that to a number or whatever. Pick whichever one you feel like, really.
|
# ¿ Dec 10, 2012 09:38 |
|
So does the data on your site belong to the user, or to the other service? Does the user have a login to sign in to your site, or do they just log in to the other service and the other service automatically has access? Is your site essentially acting like a glorified database?
|
# ¿ Dec 19, 2012 05:56 |
|
I think the 1 on the end of his example is a red herring - the 1 in the output is actually the 2 that's been chopped down to fit. I think. At least, that's all I can come up with that fits "easiest to solve imperatively".
|
# ¿ Jan 3, 2013 02:05 |
|
nielsm posted:So the shortest prefix that adds to at least X? That's my reading, yes.
|
# ¿ Jan 3, 2013 02:09 |
|
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 |
|
Sure - it's just doing long division in base 256 or 65536 instead of base 2 (base 2 long division being effectively what you're doing with a bit-by-bit variant). Another option is to approximate the result, and then use Newton's method to refine that approximation until you have your answer exactly.
|
# ¿ Feb 17, 2013 23:09 |
|
Zhentar posted:You are? They only just took out 16-bit mode from Vista. 32-bit Windows is going to be here to stay for a long time coming. Not shipping a 32-bit OS doesn't mean removing the ability to run 32-bit applications. Just knowing that everyone running {windows released in the past X years} is capable of running a 64-bit app (instead of some of them not being able to, because whoever set up their system installed 32 bit Windows because they're a goddamned idiot) would do a lot to help 64-bit adoption.
|
# ¿ Feb 21, 2013 21:54 |
|
It's really more of a determination to support old, shoddily-written software that just so happened to work most of the time.
|
# ¿ Feb 21, 2013 23:39 |
|
JawnV6 posted:
In a hypothetical world where Microsoft didn't release a 32-bit version of that particular OS? Probably 2 or 3 years. That's about how long it takes before games start requiring the new DirectX version, right?
|
# ¿ Feb 22, 2013 02:52 |
|
Just Cause 2 came out in 2010, didn't support DX9. A bunch of other stuff in 2011 and 2012. (Ignoring first-party stuff like Halo 2) So I guess 4 or 5 years afterwards is when you'd consider not supporting earlier OS versions, depending on what that gets you.
|
# ¿ Feb 22, 2013 05:17 |
|
Yeah there's really not a whole lot of a reason to make a 64-bit game when your console version absolutely has to fit in 0.5 GB today. Even if high-def textures for the PC version literally quadruple your memory usage you're still fine for 32-bit address space. I would expect to see more 64-bit PC games once people start to actually make use of all the memory the next generation of consoles will have.
|
# ¿ Feb 22, 2013 07:41 |
|
pokeyman posted:I thought Zhentar was pointing to some kind of perfect storm for date conversion. Like maybe February 12, 2013 EST was a simultaneous Daylight Saving Time switch, leap second, 31-bit overflow, Julian new year, and floating-point rounding issue. If you wanted one of those, just look at a February 29th that existed in some parts of the world but not others.
|
# ¿ Mar 19, 2013 05:17 |
|
The general idea would be to use a counter local to a particular work element, and then afterwards you can sum up all those individual counters to get your total.
|
# ¿ May 9, 2013 05:15 |
|
If order is not important, you can still shard the work across work elements and concatenate all the saved arrays at the end. If order is important, you could still do that, you'd just need to break things up differently - have individual work elements process contiguous chunks rather than interleaving them. Whatever you do be sure to profile this on real data.
|
# ¿ May 9, 2013 05:55 |
|
The most common way is to break it up into chunks small enough to fit into memory, sort those chunks, and then do a multiway merge to combine them back together.
|
# ¿ May 16, 2013 04:52 |
|
|
# ¿ May 14, 2024 01:24 |
|
A multiway merge is pretty straightforward to implement - essentially you want to maintain a heap consisting of the lowest element from each merge file. The merge proceeds by peeking at the lowest element in the heap, writing it to the output, then replacing it with the next element from the same input file. Add some buffering to cut down on disk reads and that's essentially the second part of an external sort (and you already seem to understand the first part well enough).
|
# ¿ May 17, 2013 00:55 |