code logs -> 2011 -> Fri, 18 Feb 2011< code.20110217.log - code.20110219.log >
--- Log opened Fri Feb 18 00:00:03 2011
00:07 Vornicus-Latens is now known as Vornicus
01:04 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has quit [[NS] Quit: Z?]
02:04 Attilla [Some.Dude@Nightstar-92c9199f.cable.virginmedia.com] has quit [Ping timeout: 121 seconds]
02:27 Kindamoody is now known as Kindamoody|afk
03:24 Kindamoody|afk is now known as Kindamoody
03:48 Derakon [Derakon@Nightstar-cfae48c3.ca.comcast.net] has joined #code
03:48 mode/#code [+o Derakon] by Reiver
04:26 cpux is now known as shade_of_cpux
05:10 Kindamoody is now known as Kindamoody[zZz]
06:04 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
06:05 SmithKurosaki [smith@DCDEB4.F95CFD.2EEAA4.B1AE3D] has quit [Ping timeout: 121 seconds]
06:38 Derakon is now known as Derakon[AFK]
06:43 AnnoDomini [annodomini@Nightstar-d990db47.adsl.tpnet.pl] has joined #code
06:43 mode/#code [+o AnnoDomini] by Reiver
07:05 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has joined #code
08:58 You're now known as TheWatcher
09:07 Kindamoody[zZz] is now known as Kindamoody
09:43
<@AnnoDomini>
http://pastie.org/1578057 <- Does anyone know why this wouldn't display anything in the console when getch() is commented out?
09:43
<@AnnoDomini>
The delay works fine, as far as I'm able to tell (if I set a large FRAME_DELAY, it takes a moment after getch() for the screen to refresh).
09:44
<@AnnoDomini>
Ah! Found it. Need to refresh().
09:47
< gnolam>
What's with the all the "long int"ing?
09:49
<@AnnoDomini>
What do you mean?
09:51
< gnolam>
Well, first off it's a bit unusual to write out the int.
09:51
< gnolam>
Second, you're not actually guaranteed that it's any different from a regular int.
09:52
<@AnnoDomini>
I should use just 'long'?
09:52
< gnolam>
Third, if you're worried about your frame counter overflowing you should make it unsigned.
09:55
< gnolam>
(Also, a regular unsigned 4 byte integer used as a tick counter can run for about three years without overflowing at a 50 Hz tick rate)
09:57
<@AnnoDomini>
Huh. I wonder what SDL_GetTicks() uses if it's documented to overflow after 50 days or so.
09:59
< gnolam>
They're counting milliseconds.
10:00
< gnolam>
(2^32 - 1)/(1000*60*60*24) ~= 50
10:01
<@TheWatcher>
AD: the sizes of integer types vary between compilers and architectures, some treat int as 32 and long as 64, while some treat 'int' and 'long' as synonyms for 32 (except those that treat it as 16 bit. Yes, there are some.) and require 'long long' for 64bit. If it matters, you should be using types you know the size of for certain - use things like int32_t or uint32_t etc if your system has them
10:08
<@AnnoDomini>
Uhuh.
10:35 Attilla [Some.Dude@Nightstar-92c9199f.cable.virginmedia.com] has joined #code
10:35 mode/#code [+o Attilla] by Reiver
10:38 AnnoDomini [annodomini@Nightstar-d990db47.adsl.tpnet.pl] has quit [Ping timeout: 121 seconds]
10:40 AnnoDomini [annodomini@Nightstar-19fb19d9.adsl.tpnet.pl] has joined #code
10:40 mode/#code [+o AnnoDomini] by Reiver
11:11 Vornicus is now known as Vornicus-Latens
11:16
<@AnnoDomini>
How do I read a keystroke from the buffer using curses, without having to essentially pause the program with getch()? Is that possible, even?
11:17
<@Vornicus-Latens>
oh flibble I used to know how to do this.
11:23
<@AnnoDomini>
If I were using conio, I'd use kbhit(), but I don't see anything like that here.
11:27
<@AnnoDomini>
I think I've found it.
11:27
<@TheWatcher>
Set the timeout to -1?
11:27
<@TheWatcher>
Sorr, set it to 0
11:28
<@TheWatcher>
I always get those mixed up
11:34
<@AnnoDomini>
nodelay(stdscr,true);
12:03
<@AnnoDomini>
Does anyone know how to use SDL's audio stuff?
12:55
<@AnnoDomini>
http://2t.no-ip.com/~abudhabi/pub/programming/wizna/Wizna01.zip <- This silly game brought to you by a morning's worth of work.
12:55
<@AnnoDomini>
Not especially work-safe, unless your boss doesn't mind gunfire.
12:56
<@AnnoDomini>
This is a 32-bit Linux binary, BTW.
14:36 Kindamoody is now known as Kindamoody|out
15:23 Tarinaky [Tarinaky@Nightstar-f349ca6d.plus.com] has joined #code
15:58 celticminstrel [celticminst@Nightstar-f8b608eb.cable.rogers.com] has joined #code
16:11 Rhamphoryncus [rhamph@C06FE3.F5723C.BE3FEB.9D4666] has quit [Client exited]
16:16 Derakon [chriswei@Nightstar-cfae48c3.ca.comcast.net] has joined #code
16:17 mode/#code [+o Derakon] by Reiver
16:17
<@Derakon>
Well, that's the one thing I didn't expect to have happen.
16:17
<@Derakon>
The disk clone actually worked.
16:17
<@Derakon>
All I had to do was tweak the computer's network identity and it's back online and ready to rock.
16:17
<@Derakon>
(Until the next time a critical file gets munged by a bad sector, but we can put off replacing its drive for a few days at least)
16:35
< gnolam>
http://www.lysator.liu.se/~gnolam/pictures/protection.jpg
16:57
<@Derakon>
Where would I find files that are executed on login for all users on the system?
17:00
<@Derakon>
Nemmind, pretty sure I found what I wanted. /etc/bash.bashrc
17:00
<@jerith>
Also /etc/profile.
17:01
<@jerith>
AIUI, /etc/profile (and ~/.profile) are run at login, but bashrc is run for every bash start.
17:01
<@Derakon>
Yeah.
17:02
<@Derakon>
The particular issue I wanted to fix is that my remote process invocation program does not use bash, and thus wasn't getting important environment variables set up.
17:02
<@Derakon>
So if I just manually source the bash.bashrc file then I should be good to go.
17:02
<@jerith>
An Ubuntu box?
17:02
<@Derakon>
Um...not certain.
17:02
<@jerith>
They use dash unless you explicitly specify bash.
17:02
<@jerith>
Rather, /bin/sh is not bash.
17:02
<@Derakon>
Yes, I know that. :)
17:04
<@jerith>
My discovery of that is the reason I always use #!/bin/bash instead of #!/bin/sh these days.
17:05
<@Derakon>
I suppose that would also work.
17:18 Tarinaky is now known as Bob
--- Log closed Fri Feb 18 17:33:19 2011
--- Log opened Fri Feb 18 17:33:31 2011
17:33 TheWatcher [chris@Nightstar-b4529b0c.zen.co.uk] has joined #code
17:33 Irssi: #code: Total of 28 nicks [8 ops, 0 halfops, 0 voices, 20 normal]
17:33 mode/#code [+o TheWatcher] by Reiver
17:34 Irssi: Join to #code was synced in 48 secs
18:03 Bob is now known as Caeldir
18:03
<@Derakon>
Standard behavior for a program is to return 0 on success, or the error code on failure, yes?
18:03
<@Derakon>
Just so I haven't completely forgotten how these things work?
18:05
<@ToxicFrog>
Yes.
18:05
<@ToxicFrog>
You can also use the EXIT_SUCCESS and EXIT_FAILURE macros (or language equivalent)
18:08 AnnoDomini is now known as EbonDragon
18:21 EbonDragon is now known as Ed
18:44
<@Derakon>
Debugging this would be so much easier if I could get an interactive shell that had the same environment settings as the environment I get when my program connects to the server.
18:44
<@Derakon>
As it stands, everything works automatically when I log in manually, and doesn't work at all when my program does.
18:51
<@Derakon>
...oh.
18:52
<@Derakon>
/etc/bash.bashrc isn't doing anything because it only does something if the environment variable $PS1 is set.
18:52
<@Derakon>
Which apparently is automatically getting set somewhere else for interactive shells.
18:53
<@Derakon>
To the value "\u@\h:\w\$", which I guess is some kind of prompt formatter?
18:55
< Namegduf>
Yeah, that's what PS1 is.
18:55
< Namegduf>
I hate the interactive/login/neither/both distinction.
18:55
< Namegduf>
It makes setting environmental variables horrible.
18:58 Vornicus-Latens is now known as Vornicus
19:02
<@ToxicFrog>
Derakon: PS1 is the prompt, yes. Testing if it's set is a common way to distinguish interactive vs noninteractive shells.
19:03
<@Derakon>
Yeah, the problem in this case being that the stuff behind that check needs to be done for non-interactive prompts as well.
19:04
<@Derakon>
(Adding a specific path to the environment so that shells can submit jobs to a queue. That path got changed and the bash.bashrc file was updated, but my program which had been using hardcoded paths broke)
19:05
<@Derakon>
(There's also some junk from Sebastian setting up his own environment the way he likes it in a global resource file, but that won't hurt non-interactive shells any)
19:07
<@ToxicFrog>
That kind of stuff should probably go in /etc/profile, which will get run for all login shells (including non-interactive ones)
19:08
<@Derakon>
Fancy that. /etc/profile executes /etc/bash.bashrc
19:08
<@Derakon>
Welcome to Failure Town, where we do things at right angles to reality!
19:08
<@ToxicFrog>
...why does that matter?
19:08
<@Derakon>
Just saying that we don't necessarily take the sensible approach.
19:09
<@ToxicFrog>
IME, that's how it generally works; it looks something like this:
19:09
<@Derakon>
Which, as you noted, would be to put the non-shell-specific stuff in /etc/profile and the bash-specific stuff in /etc/bash.bashrc
19:09
<@ToxicFrog>
if (it's an interactive shell) run the global bashrc;
19:09
<@ToxicFrog>
do a bunch of other setup which is not specific to interactive shells;
19:10
<@ToxicFrog>
For example, mine sources bashrc and then does some fallback PS1-tuning if it's interactive, but then whether it's interactive or not it runs everything in /etc/profile.d and does a bunch of other environment setup.
19:10
<@ToxicFrog>
So, for example:
19:10
<@ToxicFrog>
$ ssh orias echo '$PS1' # set if shell is interactive
19:10
<@Derakon>
So what if the user is using zsh instead of bash?
19:10
<@ToxicFrog>
# no output
19:10
<@ToxicFrog>
$ ssh orias echo '$PROFILEREAD' # set if /etc/profile was executed
19:10
<@ToxicFrog>
true
19:11
<@ToxicFrog>
Then you do the equivalent setup in zsh's startup files, presumably...but what's the actual situation here?
19:11
<@Derakon>
/etc/profile sources /etc/bash.bashrc regardless of which shell the user is using, and regardless of whether or not it is interactive.
19:12
<@ToxicFrog>
I mean, I thought your situation was something like 'my program does ssh user@host foo, which fails, but if I ssh in and then run foo normally, it works; this is because the environment variables foo depends on set in bashrc rather than profile'
19:12
<@Derakon>
/etc/bash.bashrc checks if the shell is interactive, and if it is modifies $PATH so the user can access the queue.
19:13
<@ToxicFrog>
Oh. In that case the answer is "zsh, since it is not bash, reads its login script from /etc/zprofile'
19:13
<@ToxicFrog>
/etc/profile is a bash-specific file.
19:13
<@Derakon>
...oh, I thought /etc/profile was shell-agnostic.
19:13
<@Derakon>
My mistake.
19:13
<@ToxicFrog>
Or possibly a sh-specific one.
19:13 EvilDarkLord [jjlehto3@Nightstar-f1ccbb45.hut.fi] has quit [Ping timeout: 121 seconds]
19:13
<@ToxicFrog>
No. It's not even syntactically valid in csh, for example.
19:15
<@Derakon>
And thus my ongoing education in how Linux works under the covers. ¬.¬
19:15
<@ToxicFrog>
But, anyways. In bash, environment changes you want to have even for non-interactive shells go in /etc/profile (or, if your system supports it, /etc/profile.d/*, which is a much more maintainable choice).
19:17
<@ToxicFrog>
on SUSE, at least, profile.d holds startup scripts for all shells with appropriate extensions, which get run automatically; so for example it contains a scala.csh (set up scala $PATH et al for csh) and scala.sh (equivalent for Bourne shell and derivatives)
19:18
<@ToxicFrog>
I don't know what distro you're using but it is likely to have the same setup, in which case you can just write a script to set up PATH accordingly and name it /etc/profile.d/queue_path.sh and it should just work.
19:18
<@Derakon>
We don't have an /etc/profile.d
19:18
<@Derakon>
Doesn't mean one couldn't be created though.
19:20
<@ToxicFrog>
Right. Bear in mind that it's not an automatic thing, though; typically there's a simple loop in /etc/profile that reads its contents.
19:20
<@ToxicFrog>
So if you don't have one, it's likely that your /etc/profile isn't written to look for one in the first place.
19:20
<@Derakon>
Right.
19:20
<@Derakon>
It's not that there's automatically code to deal with /etc/profile.d; it's that the convention is to have /etc/profile.d.
19:20
<@ToxicFrog>
Yes.
19:21
<@Derakon>
Thanks.
21:14 Kindamoody|out is now known as Kindamoody
21:22
<@Derakon>
There. 207 lines on using live CDs, cygwin, and dd to backup and restore Windows hard drives.
21:24
<@ToxicFrog>
?
21:29
<@Derakon>
Documenting what I spent this week doing.
21:29
<@Derakon>
So that in the future when I've been hit by a bus, they can carry on without me.
21:36 Outpost[college] [NSwebIRC@Nightstar-fb34d99e.temple.edu] has joined #code
21:36
< Outpost[college]>
Is there anyone good with proofs of correctness and loop invariants? I haven't worked with those in years and I'm a tad lost on my project.
21:49
<@ToxicFrog>
I'm pretty rusty.
21:49
< Alek>
http://notalwaysright.com/get-the-correct-word-step-by-step/10195
21:49 * Alek passes ToxicFrog the deoxidizer.
21:49
< Outpost[college]>
Same, but I got someone I know helping me, I think I should be okay, thanks though TF
21:51
<@Derakon>
http://www.gizmag.com/aerovironment-nano-hummingbird/17918/
22:01 Derakon [chriswei@Nightstar-cfae48c3.ca.comcast.net] has quit [[NS] Quit: leaving]
22:48 Outpost[college] [NSwebIRC@Nightstar-fb34d99e.temple.edu] has quit [[NS] Quit: Page closed]
22:49 Ed [annodomini@Nightstar-19fb19d9.adsl.tpnet.pl] has quit [[NS] Quit: Sleep.]
23:20 Derakon[AFK] is now known as Derakon
23:42 celticminstrel is now known as celmin|away
23:56 Rhamphoryncus [rhamph@C06FE3.F5723C.BE3FEB.9D4666] has joined #code
--- Log closed Sat Feb 19 00:00:04 2011
code logs -> 2011 -> Fri, 18 Feb 2011< code.20110217.log - code.20110219.log >