Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Jabor
Jul 16, 2010

#1 Loser at SpaceChem
My understanding is that that code is provided, and he's supposed to implement operators on pointCls and lineCls so that it actually works.

Adbot
ADBOT LOVES YOU

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
The definition of "design pattern" is basically "a nifty trick to work around a shortcoming in your language of choice".

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
On windows, the WS_EX_LAYERED or WS_EX_TRANSPARENT styles are a couple of options, depending on what exactly you want to do.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

Suspicious Dish posted:

Windows doesn't have a way for security reasons. I don't know about OS X.

Your graphics driver might have a way to run a DirectX pixel shader or OpenGL fragment shader to postprocess the contents on the screen.

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.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

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.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

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.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

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.

Is there a setting or something I can adjust to fix this? Right now what I do is just delete the offending ' mark, but it's a little bit annoying because I have to remember to add it back before I commit or else other people complain about it when I push it upstream.

Set fortran_dialect so the syntax highlighter knows you're using Fortran77.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
Sounds like it's treating those IV values as characters. Is Base64 decoding to UTF-8 or something?

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
How much faster does your application run if you turn off core parking?

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
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.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

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.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

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.

code:
5702 continue

  code block 1

2001 continue

  code block 2

  if(condition 1) goto 5702

  code block 3

  goto 2001
How can this be turned into a proper nested loop structure?

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?

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
Or if you're going to do it that way just roll code block 3 up with code block 1.

code:
first_iter = true

do while true
  if (first_iter OR condition1) then
    code block 1
    first_iter = false
  else
    code block 3
  endif
  
  code block 2
end do

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
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.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

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".

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
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.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

shrughes posted:

That would be more like

code:
foreach ( var v in some-
                Collection)

I would think it's more like:

foreach ( var v in someCollection)

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
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.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
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.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
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.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

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.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
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.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
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.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

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 :ssh:

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
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.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
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?

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
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".

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

nielsm posted:

So the shortest prefix that adds to at least X?

That's my reading, yes.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
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.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
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.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

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.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
It's really more of a determination to support old, shoddily-written software that just so happened to work most of the time.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

JawnV6 posted:

:allears:

Care to take a stab at the low end of X? As in after what year could we maybe possibly begin to say that?

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?

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
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.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
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.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

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.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
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.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
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.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
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.

Adbot
ADBOT LOVES YOU

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
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).

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply