code logs -> 2008 -> Thu, 20 Mar 2008< code.20080319.log - code.20080321.log >
--- Log opened Thu Mar 20 00:00:56 2008
01:04
<@McMartin>
Argh.
01:04
<@McMartin>
I can't tell if this is windows's fault or OS X's.
01:05 * McMartin is trying to spawn a subprocess that opens a file using whatever app is associated with it.
01:05
<@McMartin>
In OS X this is basically system("open %s" % fname), suitably modified to avoid shell injection.
01:06
<@McMartin>
In the Win32 command line you can do the same thing with "start", but start isn't a program you can't exec or system it.
01:07
<@McMartin>
Hrm. You can't exec it. You *can* system it.
01:14
<@ToxicFrog>
It's a shell command
01:14
<@ToxicFrog>
So system works, since it feeds that command to the shell, but start doesn't, since it's not a seperate binary.
01:14
<@ToxicFrog>
The w32api function, by the way, is ShellExecute() and friends.
01:23 * McMartin is kind of hoping to not have to ship additional binaries with the Windows version.
01:23
<@McMartin>
Hm.
01:23
<@McMartin>
I wonder if I can make a .bat file.
01:24
<@McMartin>
Answer: Wackiness Ensues
01:28
<@McMartin>
Aha, it's because start takes two arguments secretly, and OVERRIDES ONE if there's a space in it.
01:28
<@McMartin>
so, for instance
01:28
<@McMartin>
C:\>start "Weishaupt Scholars.zblorb"
01:28
<@McMartin>
Does not mean "find the file than handles said file and make it go
01:28
<@McMartin>
It means "start a new command shell with 'Weishaupt Scholars.zblorb' as the status line"
01:29
<@McMartin>
C:\>start "Any string" "Weishaupt Scholars.zblorb" works fine though.
01:31
<@McMartin>
Victory
01:32
<@C_tiger>
I think you should make Any String = "Killing kittens, kicking puppies"
01:33
<@McMartin>
"WinBlorple Shell", as it happens.
01:35
<@McMartin>
The idea here is that since Windows and Mac have standard associations for IF files, the launcher will on those OSes default to "ask the OS what to launch with, use that".
01:35
<@McMartin>
On Unix this is less uniform so the user has to configure it on their own, though "xterm -e nfrotz" is a good start for Z-Code.
01:37
<@ToxicFrog>
Most desktop environments provide some means of doing this, too - eg, for GNOME it's "gnome-open filename" - but it's different for each desktop, of course
01:37
<@McMartin>
And most terps on Unix do not register themselves that way.
01:37
<@ToxicFrog>
Depends on the distro and how you install them, but yes.
01:38
<@McMartin>
Blorple's downloads so far are about 10:1 in favor of Windows, anyway, so as long as I can make that work, I'm find.
01:38
<@McMartin>
fine.
01:39
<@McMartin>
Well, OK. 3:1.
02:15 * Vornicus is slowly becoming more command-line-oriented
02:15
<@Vornicus>
I wanted to open an application but didn't want to hunt it down in my applications folder, so I went over to my command line and typed "open -a <Application>"
02:24
<@C_tiger>
Mac?
02:24
<@McMartin>
Yeah
02:25 * McMartin has to do that a lot anyway because his .apps are freshly generated.
03:50 gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Quit: Z?]
05:26 The_Mighty_END [~Zeratul@58.6.44.ns-20543] has quit [Quit: Ciao, off to play some DOOM!]
06:39 C_tiger [~c_wyz@Nightstar-24064.nycmny.east.verizon.net] has quit [Ping Timeout]
06:47 C_tiger [~c_wyz@Nightstar-15759.nycmny.east.verizon.net] has joined #code
06:47 mode/#code [+o C_tiger] by ChanServ
08:57 ASCIISkull [~none@Nightstar-7066.dyn.optonline.net] has joined #code
08:58 AFKSkull [~none@Nightstar-7066.dyn.optonline.net] has quit [Ping Timeout]
08:58 ASCIISkull is now known as NSGuest-5614
09:11 Vornicus is now known as Vornicus-Latens
09:36 gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code
09:36 mode/#code [+o gnolam] by ChanServ
10:06 NSGuest-5614 is now known as AFKSkull
12:20 AbuDhabi [AnnoDomini@83.21.46.ns-3998] has joined #Code
12:20 AnnoDomini [AnnoDomini@83.21.65.ns-3934] has quit [Ping Timeout]
12:55
< AbuDhabi>
Hm. Suppose I have a database for a internet music shop. I have tables with employee (1 table), customer (1 table), merchandise (3 tables), and order (2 tables) data. How is access control handled in such situations?
12:56
< AbuDhabi>
I mean, I know what the default password for the database is, but where is it stored?
12:56
< AbuDhabi>
Should I somehow store user account/password details in a table or something?
12:58
< AbuDhabi>
I want to divide users into three categories - administrators (can do anything), employees (can handle orders and edit merchandise data, and see most things), and clients (can place orders, and can see merchandise, their own personal data and their orders).
13:38
<@C_tiger>
I dunno, I'm pondering doing something similar and handling access control via the UI ... it's probably not ideal but it works.
13:39
< AbuDhabi>
I have never done anything like this before, and don't really know where to start or how it's done in reality.
13:39
<@C_tiger>
Neither have I, so I shouldn't give advice.
13:46 C_tiger [~c_wyz@Nightstar-15759.nycmny.east.verizon.net] has quit [Ping Timeout]
14:26 C_tiger [~c_wyz@Nightstar-25481.nycmny.east.verizon.net] has joined #code
14:26 mode/#code [+o C_tiger] by ChanServ
16:31
<@jerith>
AbuDhabi: You want to store a password hash (NOT the password) in the users table.
16:32
<@jerith>
There are several approaches you could take with the permissions, depending on how much effort you want to expend and how much flexibility you want.
16:36
<@jerith>
The easy way is to store a user_type field, which is an integer. Clients are the most restricted, so they get 0. Employees get 1, admins get 2.
16:37
<@jerith>
Then every operation has a ">= LEVEL_REQUIRED" check.
16:59 GeekSoldier|bed [~Rob@Nightstar-9183.dip.t-dialin.net] has joined #code
17:00 GeekSoldier|bed is now known as GeekSoldier
17:33 Attilla [~The.Attil@194.72.70.ns-11849] has quit [Quit: <Insert Humorous and/or serious exit message here>]
17:49 Attilla [~The.Attil@194.72.70.ns-11849] has joined #code
17:49 mode/#code [+o Attilla] by ChanServ
17:53 * AbuDhabi returns from napping.
17:55
< AbuDhabi>
What's a password hash, exactly?
17:56
<@Attilla>
Some companies (especially catering companies) try sending you your password by more covert means. An example includes chopping up the password and adding it to potato, flour and onion before frying it.
17:58
< AbuDhabi>
Also, I'm not sure what you describe, jerith, is easily possible where users are separated into two or more tables like CLIENTS and EMPLOYEES.
17:58
<@Attilla>
Okay maybe not, but it's plausible, right?
17:59
< AbuDhabi>
Maybe not. ;p
17:59
<@Attilla>
(That is, to my answer, not your table thing)
17:59
<@Attilla>
It's been a while since i've done databases.
18:13 Finale [~c0cb88fe@Nightstar-29731.dsl.in-addr.zen.co.uk] has joined #code
18:13
< Finale>
a few pretty urgent questions...
18:14
< Finale>
anyone awake?
18:14
< Finale>
>_>
18:15
< AbuDhabi>
That's not really urgent.
18:16
< GeekSoldier>
awake, yes.
18:17
< Finale>
is there a way to .getline() multiple variables on the same line, when the separator is a space?
18:18
< GeekSoldier>
python?
18:18
< Finale>
c++
18:18
< GeekSoldier>
oh.
18:19
< Jeff>
I think so.
18:19
< GeekSoldier>
put the line into a temp string, the parse at the spaces. I'm sure there's a more eloquent way, but I'm not that familiar with C++
18:24 Finale [~c0cb88fe@Nightstar-29731.dsl.in-addr.zen.co.uk] has quit [Quit: CGI:IRC (Ping timeout)]
18:28
< AFKSkull>
you could always do a search replace spaces into line breaks, semicolons, or whatever if that makes it easier
18:28 GeekSoldier [~Rob@Nightstar-9183.dip.t-dialin.net] has quit [Ping Timeout]
18:28
< AbuDhabi>
AFKSkull: He pinged out.
18:29 Finale [~c0cb88fe@Nightstar-29731.dsl.in-addr.zen.co.uk] has joined #code
18:29
< Finale>
gah. mouse crashed, computer crashed. what'd I miss?
18:29
< AFKSkull>
hrm, so he did
18:29 GeekSoldier [~Rob@Nightstar-8582.dip.t-dialin.net] has joined #code
18:29 mode/#code [+o GeekSoldier] by ChanServ
18:31
< Finale>
I basically need to get several different variables off each line of the file. and they're separated by a space each.
18:32
< AbuDhabi>
Are they a fixed length?
18:33
< Finale>
each one has a specific length, on each line, but they have different lengths from each other.
18:33
< Finale>
as in:
18:33
< AbuDhabi>
If you know how long each of the variables is in the line, it's trivial to select each of them from the line using... wait a moment.
18:34
< Finale>
8 50 norm 23654567\n5 25 soup 00011001
18:34
< Finale>
NOT using binary mode, btw.
18:34
< AbuDhabi>
So the first is 1 character, second is 2 characters, third is 4 characters and so on - always?
18:34
< Finale>
basically.
18:35
< AbuDhabi>
Use substr().
18:35
< AbuDhabi>
It's a string function.
18:35
<@ToxicFrog>
Can't you just go:
18:35
<@ToxicFrog>
fin >> int1;
18:35
<@ToxicFrog>
fin >> int2;
18:35
<@ToxicFrog>
fin >> str1;
18:35
<@ToxicFrog>
fin >> int3;
18:35
<@ToxicFrog>
...
18:36
<@ToxicFrog>
(alternately, use a language with decent string manipulation and split())
18:36
< AbuDhabi>
string_variable.substr(n,m); // gives a string of up to m characters from n position in the string.
18:37
< Finale>
so I have to read from the fstream object to a string first... then substr it up into variables.... ok.
18:39
<@GeekSoldier>
TF: that's why I was hoping it was Python. :)
18:39
<@ToxicFrog>
Well, yes, it's not exactly elegant, but we're talking C++ here
18:39
<@ToxicFrog>
So elegance is pretty much dead no matter how we handle this problem
18:39
<@ToxicFrog>
And this is probably the easiest way to do it.
18:39
<@GeekSoldier>
heh, true.
18:41
<@ToxicFrog>
No taffing about with cstring or String manipulation, no atoi() hackiness.
18:43
< Finale>
!!! can you pass string variables to .open ?
18:44
< AbuDhabi>
Uh, sure.
18:44
< Finale>
interesting alternative to fixed-length char arrays, but I dunno if my teacher will approve... -_-
18:44
<@ToxicFrog>
Er
18:44
< AbuDhabi>
string_variable.c_str();
18:44
<@ToxicFrog>
I thought you were reading this from a file?
18:44
< AbuDhabi>
If it gives you problems.
18:45
<@ToxicFrog>
ifstream fin = new ifstream(filename);
18:45
<@ToxicFrog>
/* now you just read in the values with >> */
18:47
< Finale>
ok, I'm a bit confused here.
18:47
< Finale>
also
18:47
< Finale>
do string positions begin from 0 like arrays, or from 1?
18:48
<@ToxicFrog>
0.
18:48
< Finale>
good.
18:48
<@ToxicFrog>
What's confusing?
18:48
< Finale>
what you guys were just saying.
18:48
< Finale>
yes, I'm reading it from a file... but I was thinking of also making the filename variable a string instead of a char array.
18:49
< AbuDhabi>
I'm not certain how ToxicFrog's solution would work, but I'm pretty sure it will.
18:50
<@ToxicFrog>
ifstream overloads operator>>
18:50
< Finale>
please explain.
18:50
<@ToxicFrog>
So that ifstream >> variable attempts to read from the stream data representing a value of the corresponding type and store it in the value.
18:50
<@ToxicFrog>
Basically, like ofstream's << in reverse.
18:50
< Finale>
yes, well.
18:50
<@ToxicFrog>
So, if you have a file containing "1 2 3 4"
18:50
<@ToxicFrog>
And you go:
18:51
<@ToxicFrog>
ifstream fin = new ifstream(filename);
18:51
<@ToxicFrog>
int foo;
18:51
< AbuDhabi>
And it leaves the pointer at the place it last finished?
18:51
<@ToxicFrog>
fin >> foo;
18:51
<@ToxicFrog>
foo is now 1 and the stream pointer should at the space between the 1 and the 2.
18:51
<@ToxicFrog>
It's been a while since I used this, but IIRC it skips whitespace not unlike fscanf.
18:52
<@ToxicFrog>
http://www.cplusplus.com/reference/iostream/istream/operator%3E%3E.html
18:53
<@ToxicFrog>
You can in fact go, IIRC:
18:53
<@ToxicFrog>
int foo[4];
18:53
<@ToxicFrog>
fin >> foo[1] >> foo[2] >> foo[3] >> foo[4];
18:54
<@ToxicFrog>
At which point foo will be { 1, 2, 3, 4 } and fin will be at the end of the file.
18:54
<@ToxicFrog>
Finale: does that explain things?
18:54
< Finale>
hrm.
18:54
< Finale>
it might...
18:54
< Finale>
except for strings including whitespace.
18:55
< Finale>
that's what breaks this, the fact that some of the string variables I need to get include whitespace.
18:56
<@ToxicFrog>
Oh.
18:56
<@ToxicFrog>
So you might have something like:
18:56
<@ToxicFrog>
"1 2345 foo bar baz 999"
18:56
< Finale>
yea
18:56
<@ToxicFrog>
And need to read it as: 1, 2345, "foo bar baz", 999 ?
18:57
< Finale>
in fact, more like "1 2345 foo bar baz 999"
18:57
< Finale>
where all but one of the whitespaces between baz and 999 have to be included in the max width of 999.
18:57
< Finale>
but THAT probably doesn't matter.
18:57
<@ToxicFrog>
Aah.
18:58
<@ToxicFrog>
This is the point (well, actually, this is well past the point) where I'd toss C++.
18:58
< Finale>
AND... I'm late. -_-
18:58
<@ToxicFrog>
This would be easy if the string were at the end of the line.
18:59
<@ToxicFrog>
Then it's just read three ints, unset skip-whitespace, and read the rest of the line.
18:59
< Finale>
yeah, I know. -_-
18:59
< Finale>
wait, how do you unset skip-whitespace? >_>
18:59
<@ToxicFrog>
http://www.cplusplus.com/reference/iostream/istream/operator%3E%3E.html
19:00
<@ToxicFrog>
Look for the "manipulators", in particular skipws and noskipws
19:00
<@ToxicFrog>
you can click on them for additional information on their behaviour
19:02
< Finale>
you know what, I think I'll just use .get and .ignore. -_-
19:02
< Finale>
probably the simplest way.
19:02
< Finale>
.ignore(1)
19:04
< Finale>
or no, not .get
19:04
< Finale>
that only gets one char.
19:05
< Finale>
hrm.
19:05
< Finale>
>>, >>, .ignore, .getline, >> ...... will that work?
19:07
< Finale>
or.... can you use >> setw(x) >> for a string with whitespaces?
19:07 Vornicus-Latens is now known as Vornicus
19:12
< Finale>
well? -_-
19:12
< Finale>
dangit. -_-
19:15 Attilla [~The.Attil@194.72.70.ns-11849] has quit [Quit: <Insert Humorous and/or serious exit message here>]
19:15
< Finale>
hrm.
19:15
< Finale>
well, we'll see. -_-
19:18
< Finale>
aaaagh
19:18
< Finale>
I give up. -_-
19:28 Attilla [~The.Attil@194.72.70.ns-11849] has joined #code
19:28 mode/#code [+o Attilla] by ChanServ
19:34 Finale [~c0cb88fe@Nightstar-29731.dsl.in-addr.zen.co.uk] has quit [Quit: CGI:IRC 0.5.9 (2006/06/06)]
19:44 gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Ping Timeout]
19:50 gnolam [lenin@85.8.5.ns-20483] has joined #Code
19:50 mode/#code [+o gnolam] by ChanServ
19:51 Thaqui [~Thaqui@222.154.187.ns-2601] has joined #code
19:51 mode/#code [+o Thaqui] by ChanServ
20:18 C_tiger [~c_wyz@Nightstar-25481.nycmny.east.verizon.net] has quit [Ping Timeout]
20:27 C_tiger [~c_wyz@Nightstar-15947.nycmny.east.verizon.net] has joined #code
20:27 mode/#code [+o C_tiger] by ChanServ
21:05 gnolam [lenin@85.8.5.ns-20483] has quit [Ping Timeout]
21:07 gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code
21:07 mode/#code [+o gnolam] by ChanServ
21:45 gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Ping Timeout]
21:51 gnolam [lenin@85.8.5.ns-20483] has joined #Code
21:51 mode/#code [+o gnolam] by ChanServ
21:54 gnolam [lenin@85.8.5.ns-20483] has quit [Ping Timeout]
22:00 gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code
22:00 mode/#code [+o gnolam] by ChanServ
22:00 Bobsentme [Bobsentme@Nightstar-26335.dsl.sfldmi.sbcglobal.net] has joined #Code
22:04
< Bobsentme>
Gotta ask: Assembler language: Still valuable, or, "WHO THE HELL STILL KNOWS ASSEMBLER!?!"
22:05 * AbuDhabi has had three semesters of it so far.
22:06
< AbuDhabi>
Personally, I think it's very neat to know it.
22:06
< Bobsentme>
I think so too...but am not sure if I should take it.
22:06
< AbuDhabi>
"take it"?
22:06
< Bobsentme>
Learn it, study it, etc, at my college.
22:07
< AbuDhabi>
Ah, yes. You get to choose.
22:07
< Bobsentme>
...
22:07
< Bobsentme>
Um, you don't?
22:07
< AbuDhabi>
Nope.
22:07
< Bobsentme>
Ok
22:07
< AbuDhabi>
Everything is compulsory in most post-Soviet country universities.
22:08
< Bobsentme>
I can see both an upside, and downside to that.
22:12
< AbuDhabi>
Personally, I would select this course. It's nifty to know that you can write a program that takes up a number of bytes that you can count on your fingers.
22:13
< Bobsentme>
:)
22:13
<@ToxicFrog>
It is still valuable.
22:13
< Bobsentme>
I think it would be useful just for the knowledge of knowing how to code very powerful things with very little space.
22:13
< AbuDhabi>
HelloWorld takes up ~20 bytes, and most of that is the string itself.
22:13
<@ToxicFrog>
If you're doing systems programming or reverse engineering work, you'll need it.
22:13
<@ToxicFrog>
Even if you aren't, a knowledge of how machine code works is useful when playing with compilers and interpreters.
22:14
< Bobsentme>
ok
22:23
<@ToxicFrog>
It worries me when the simulator starts giving me results in femtoAmperes.
22:24
<@Vornicus>
Analog hurts my brain.
22:25
<@ToxicFrog>
It was fine until we got into second-order circuits.
22:26 * Vornicus likes digital because if pressed he can simulate it on a gate level with excel.
22:26
<@ToxicFrog>
Heh.
22:26
<@ToxicFrog>
Digital is much nicer, yes.
22:27 Bobsentme [Bobsentme@Nightstar-26335.dsl.sfldmi.sbcglobal.net] has left #code [Thanks for the advice]
22:52 GeekSoldier [~Rob@Nightstar-8582.dip.t-dialin.net] has quit [Ping Timeout]
22:56 GeekSoldier [~Rob@Nightstar-9471.dip.t-dialin.net] has joined #code
22:56 mode/#code [+o GeekSoldier] by ChanServ
--- Log closed Fri Mar 21 00:00:07 2008
code logs -> 2008 -> Thu, 20 Mar 2008< code.20080319.log - code.20080321.log >