Tuesday, November 17, 2009

A Hard Problem

Probably not a "very hard" problem.

I've put in a bit of thought about the code style switcher - drawn some diagrams and such. The thing which is irking me at the moment is style switches in a revision controlled system.

Inevitably, there are going to be conflicts. Lots of conflicts. You can do nice things like make whitespace not count, but the different styles mentioned earlier don't all become erased in an "all whitespace is the same" world.

So... either you would need better diffing tools, a different means of describing the formatting of code-data, or a revision system that doesn't handle conflicts the same way

the other option is to have everyone "throw away" their repositories overnight, while the code is refactored to a different style, then they all come back and check out new copies. This could work, but it's not really feasible. Just think about how much code Googlers and Microserfs would have to check out, working on Office or Google Docs. Just think about how many little things they'd have going on as personal branches, all the half-finished code. Things that would have to be meticulously gone over and backed up, or lost. This option is nigh impossible for other reasons.

So, better diffing tools, a different means of describing the formatting of code-data (maybe partially compiled semi-object files, which your editor interprets? Oooh let's zoom in on that.

You could build a symbol tree and go through a large glomp of the compilation process but pull in a ton of data about the code itself, and then store those partially-compiled files. Then in your editor, you have specific stylesets which get applied to the code, and you pull the code out of the object file by interpreting it. You want to change styles? Just change styles and click. The program does the best-compile-possible (either takes the old object file and uses that, or compiles yours, or compiles as much of yours as is compilable and leaves chunks out) and then reinterprets the code outward. Oh that's fancy.

I'm taking compilers next semester; this is my new Awesome.

Wednesday, November 4, 2009

code style switcher

It can't be hard to write a linter that will go through code and make

if(){
}


into

if()
{
}


or (this is messy, I don't want to fight with blogspot's syntax today, I'm sure you get it)

if()
{
}


and all combinatorial groupings therein

well, maybe it can be hard, but I'm going to do it. I'm sick of reading people's code that doesn't agree to preconformed styles, and it shouldn't be a human's job to fix it.

Also, control over what styles for while, switch, if, methods, classes, would be useful.

Probably exists.


OOOH and convert spaces to tabs or vice versa, with control of how many spaces a tabstop is!

generally it just prettifies your code! I'm sure this exists. But it would be so fun to make! #isgoingtodoitanyway

Monday, November 2, 2009

bash on windows update

I looked into it this morning, and many people have tried this out. I went with the last of those three links, because it spoke of Unix Utilities and it was just a "download, extract, set PATH" sort of install process, which is one I grok.

Unfortunately, it didn't exactly pan out. I posted at TechSutram's blog (where I got the instructions from):

I just followed these instructions - I'm quite happy to have some additional unix utils on my command line (cat, less, rm) - but I could not get bash itself to work.

It will run fine, but reports "bash: warning: could not find /tmp, please create!" - I tried creating a "tmp" within C:\Users\myusername (where I set my HOME environment to), and also within C:\bash, but this did not stop the error.

Not so bad though, right? Just a warning. Well, actually it's worse: immediately after opening bash, a command like "ls" will display files in the good old fashioned style, then dump this to me: "[sig] C:\bash\bash.exe 1000 (0) call_handler: couldn't get context of main thread, error 998", and hang. After a CTRL+C, you end up with "[sig] bash 1000 (28) call_handler: couldn't get context of main thread, error 998", and now the terminal is entirely nonresponsive.

I'm running 64-bit Win7 Ultimate on an Intel Core2, about 4gb of ram and the rest is unimportant. I'm guessing this is a 64-bit issue or just a "Win7 is different" issue, which is causing some DLL call to fail or return differently and muck things up.
And I'm happy with the situation to some extent. I've now got the ability to string some bashfu together on my command line, and I'm closer to having UNIX available on this crazy Windows stuff, but I'm not quite there.

I'll keep looking, and if I find something that's not 2+ years old or broken, I'll report back.

Sunday, November 1, 2009

some more

instead of AIs, use people playing videogames:

I read the headline "more US residents playing farmville than there are farmers in the US"

Why not have those decisions impact the real world? Risk and reward come into play, in a good way. We don't need heavy mental lifting to be done by machines which aren't yet well equipped, but we can advance the state of the art of robotic machinery and workers, and let swarms of game players control the machinery through a heavily abstracted system of interaction and reward. Offer a small stipend, which increases based on personal success, and you have some seriously cool potential. Not just farms - anything labour intensive that could be roboticised except for the difficult decisions and analyses occasionally required.

is there an optimal svn usage?


if there's a set of operations which should pretty much always be done in order to have consistent backups and a well maintained repository, that should be automated. This is quite likely to already have been done / not be as useful as it sounded in my head when I first thought it.

why isn't everything under revision control and on/offline accessible what the hell

also, all apps should be networked/backed up/offline-networked. ex: your word documents are automatically backed up to your server and when you turn on your work computer they are automatically beamed down, with a full revision history

this is probably already done - is it done well?

windows bash

windows needs the linux command line in a fashion that integrates fully into windows. The only thing I really dislike about windows is not having scp, ssh, grep, cat, vim, vimdiff, ps, forward slashes, that sort of thing in my command line. I am aware that cygwin effectively provides this, but it does not (in my experience) integrate into the actual windows system. You are provided with a way to use linux while you are booted into windows. It's like a really shitty VM.

I want to be able to use my Windows system, use its interfaces and files and utilities and windowsisms, but make it so that when I pop open a command line I'm using what looks like UNIX. This should not be difficult. I intend to write a simple shell / collection of windows ported utilities and, after using it a bit, make it available to other people. I really want this.

Could already be done - I'll probably glance around a bit first.


That's all for this week.