code logs -> 2009 -> Sun, 18 Oct 2009< code.20091017.log - code.20091019.log >
--- Log opened Sun Oct 18 00:00:20 2009
00:24 orthia [Orthianz@Nightstar-96dafcb1.xnet.co.nz] has quit [[NS] Quit: ]
00:30 You're now known as TheWatcher[T-2]
00:32 You're now known as TheWatcher[zZzZ]
00:42 * Vornicus considers calculators.
00:44
<@Vornicus>
I'm trying to imagine the kind of shit you could get away with on $200 of calculator nowadays. In 1997 it bought you 384 kb of battery-backed memory, an abysmally slow graph drawing system, and a monochrome screen.
00:47
<@Vornicus>
In 2009, I think you could pull several megabytes of RAM, a full-color screen, multiple gigabytes of flash storage, a full CAS suite...
00:49
<@Vornicus>
But no, TI still sells their 84 series for that price, and it hasn't improved since the 90s.
00:50
<@Vornicus>
Well, okay. They did add USB to it.
00:50
<@ToxicFrog>
Well, yes, of course they do, because they have a captive market.
00:50
<@ToxicFrog>
See also: textbook manufacturers.
00:53 * Vornicus ponders a CAS for iPhone.
01:29
< Alek>
actually, the 84 series did get their ram upgraded.
01:29
< Alek>
all their calcs got ram upgrades, software, etc.
01:29
< Alek>
not as much as they perhaps should have, but still.
01:36 Orthia [Orthianz@Nightstar-96dafcb1.xnet.co.nz] has joined #Code
03:18 Attilla [The.Attilla@FBC920.65CFFF.E56E70.387AF5] has quit [[NS] Quit: ]
04:12
< GeekSoldier>
that's why I had an HP 48 GX all throughout high school.
04:21 Orthia is now known as Reivthia
05:05 Syloqs-AFH [Syloq@is.an.awesome.Network.Administrator.on.Nightstar.Net] has quit [Connection reset by peer]
06:40 AnnoDomini [farkoff@Nightstar-a2ae8ddc.adsl.tpnet.pl] has joined #Code
06:40 mode/#code [+o AnnoDomini] by Reiver
07:36 Derakon is now known as Derakon[AFK]
07:49 Vornicus is now known as Vornicus-Latens
07:59
<@jerith>
Programmable calculators just aren't as necessary in the age of the ubiquitous laptop.
08:11
< Reivthia>
Still a handy thing to have sometimes, though
08:12
< Rhamphoryncus>
Other than the set of buttons, can you replace it with linux on a cellphone?
08:13
<@jerith>
The smarter calculators often have extra math hardware.
08:13
<@jerith>
But that's just a performance thing.
08:14
<@jerith>
I suppose you can't run Linux on a cellphone that doesn't at least to floating point.
08:14
< Rhamphoryncus>
Which is low volume (comparatively), and could easily be surpassed by a mass produced generic CPU..
08:15
<@jerith>
Most of the reasons for having the extra hradware are gone now.
08:16
<@jerith>
I can actually buy a netbook cheaper than a reasonable programmable calculator and get a vasty more powerful and flexible device.
08:16
<@jerith>
*vastly
08:16
<@jerith>
The only reason to prefer the calculator these days is form factor.
08:17
< Rhamphoryncus>
'xactly
08:17
<@jerith>
The people who really need the functionality in a portable package carry laptops these days.
08:17
< Rhamphoryncus>
It's a 200 dollar set of buttons
08:18
<@jerith>
Not as easy to use while standing on a construction site, perhaps, but certainly no big deal either.
08:19
< Reivthia>
Rham: The buttons, in terms of usability, are huge
08:19 * jerith hasn't used his 48G in years.
08:19
< Reivthia>
But the fundamental 'LCD screen + CPU + Math Software' is fundamentally the same, yes
08:19
< Rhamphoryncus>
I don't disagree
08:20
<@jerith>
Reivthia: Not compared to a full keyboard and Matlab (or even Octave).
08:20
< Reivthia>
jerith: Ha. You are paying for Matlab in this arguement, I assume?
08:20
<@jerith>
Any phone able to run the software is likely to have a decent keyboard or a touchscreen.
08:21
<@jerith>
Reivthia: I'd argue that the people who need the features have Matlab at the office anyway.
08:21
< Reivthia>
Yeah, but you don't take the office with you.
08:21
< Reivthia>
The problem with the programmable calculator, cost-wise, is that it's a low demand niche sector
08:21
< Reivthia>
Thus they lose the efficiency of scale. This is pretty common.
08:21
<@jerith>
But Octave if pretty good if you don't need some of the more obscure libraries Matlab ships with.
08:22
<@jerith>
Reivthia: I take the office with me all the time. Laptops are a great alternative to desktops these days.
08:22
< Reivthia>
Secondary advantage: You can take a programmable calculator with you into a secure location.
08:22
< Reivthia>
A laptop or cellphone, maybe not.
08:23
< Reivthia>
They certainly wouldn't let me take one into an exam. :P
08:23
<@jerith>
Meh. I could have cheated just as easily with my HP as I could have with a cellphone or a laptop.
08:24
< Reivthia>
How?
08:24
< Reivthia>
I doubt it had a wireless connection~
08:25
<@jerith>
Technically, I *did* cheat with my programmable calculator once. I accidentally forgot to clear it properly and noticed afterwards that all my code (which I hadn't used, because I didn't know it was there) was still around.
08:25
<@jerith>
Mine does. It's short-range IR, but still.
08:27
<@jerith>
In any situation where a programmable calculator is more useful than a standard scientific one, having a laptop is unlikely to be more of a problem cheating-wise.
08:28
< Reivthia>
See, I don't get that.
08:28
< Reivthia>
Our math tests were open book
08:28
<@jerith>
The only issues would be communications, and that's easy enough to monitor.
08:28
< Reivthia>
So it's not the storage of information that was the concern.
08:28
< GeekSoldier>
Many standardized tests still forbid the use of a laptop/netbook, thus necessitating a calculator of some form.
08:28
< Reivthia>
It was, y'know, google. :p
08:28
<@jerith>
Or no harder than monitoring for note-passing or whatever.
08:29
< Reivthia>
Except it requires -technology-, which demands both hardware, education and expertise.
08:29
< Reivthia>
Cheaper to leave 'em behind.
08:29
<@jerith>
Reivthia: No, it requires observant invigilators.
08:30
<@jerith>
Anyways, I've never had to use any of the features of my programmable in an exam.
08:30
<@jerith>
Well, beyond the basic mathematical operations.
08:32
<@jerith>
I did once save some time by writing an interative numerical approximation proglet, but that's mostly because I'm a better coder than number-puncher.
08:33
<@jerith>
The calculator /was/ very useful between exams, though.
08:33
<@jerith>
But only because I didn't own any other portable computing devices.
08:34
< GeekSoldier>
my HP helped get get 5/5 on the AP physics exam way back in '99.
08:34
< Reivthia>
They have advantages in being small, with a usable interface, and capable of doing what's required.
08:34
< Reivthia>
Yes, you can do it on plenty of other similar devices.
08:34
< Reivthia>
Yes, you can do it on cheaper devices.
08:34
<@jerith>
Programming it taught me quite a lot about the algorithms I was using, and saved me quite a lot of time doing assignments and whatever.
08:34
< Reivthia>
But you cannot do it on a similar sized cheaper device and do it as efficiently.
08:35
<@jerith>
Reivthia: Only because nobody has put the effort into writing such an app for the iphone or android or whatever.
08:36
<@jerith>
The interface issues are completely negated by having a full keyboard or a touchscreen.
08:36
<@jerith>
All else is software.
08:36
<@jerith>
On the other hand, there's something to be said for the sheer ruggedness of the older HPs.
08:37
<@jerith>
A friend of my dad's managed to drop his on a construction site and it got run over by a backhoe or something. Still worked perfectly, despite the dents.
08:38
<@jerith>
(He was lucky in that it didn't crack the screen.)
08:38
<@jerith>
That was, in fact, the stated reason many people I know got HP rather than TI.
08:39
<@jerith>
And why the 48 was popular even after the release of the theoretically superior 49.
08:40 * jerith considers.
08:40
<@jerith>
Also, tools are bigger and more complex these days.
08:40
<@jerith>
And more specialised.
08:41
< GeekSoldier>
the 49 was not that great, but I heard that the 50 series has fixed many issues.
08:41
<@jerith>
The 49 swapped out the venerable CPU (I forget what) in favour of a higher-spec ARM (I think) core.
08:42
<@jerith>
And then ran an emulator.
08:43
<@jerith>
I haven't seen the 50. I graduated before it was available here (and possibly before it was released at all) and am no longer amongst the target market for such devices.
08:43
<@jerith>
Programmers tend not to use them.
08:43
< GeekSoldier>
I really wish I could find my old 48.
08:44
< Reivthia>
I call bullshit on the touchscreen bit
08:44
< Reivthia>
The average phone touch screen is /not/ that good for rapidly punching numbers at.
08:44
<@jerith>
Reivthia: The iphone screen is usable.
08:45
<@jerith>
Enough to type on, at least.
08:45
<@jerith>
And it has the advantage of being reconfigurable.
08:45
< GeekSoldier>
I can achieve a decent rate on my BlackBerry Storm.
08:45
< Reivthia>
Would you take it in favor of a calculator when you want to do some quick math?
08:45
< GeekSoldier>
not at all
08:46
<@jerith>
My 48G isn't even low-batterying at me. :-)
08:46
<@jerith>
Reivthia: I would, since my calculator wouldn't be with me.
08:46
< Reivthia>
You were going somewhere you could reasonably expect to do some on-the-spot math.
08:46
< Reivthia>
EG, a tour of a construction site or the like.
08:46
< GeekSoldier>
I had a holster for my 48 long before I had one for my cell.
08:46
< Reivthia>
This is the enviroment the fancy calculators have a place in...
08:47
<@jerith>
On-the-spot math is the exception rather than the rule.
08:47
< Reivthia>
The one where 'sit down and use my laptop after booting it up' is simply impractical.
08:47 GeekSoldier [Rob@Nightstar-e86e3e0d.ip.cablemo.net] has quit [Client closed the connection]
08:47
< Reivthia>
And this is why programmable calculators aren't that popular, yes
08:47
< Reivthia>
But it does not negate their utility nonetheless
08:48
< Reivthia>
And if your job does demand on-the-spot calculation stuff? You're going to get one of those calculators and become proficient in it.
08:48
<@jerith>
But personally, I'd carry a netbook with appropriate software on it. I can use that on the fly as well.
08:48
<@jerith>
I'm not saying they aren't useful, I'm saying their time is passing.
08:48
< Reivthia>
Not walking around a construction site, you can't.
08:48
<@jerith>
Yes I can.
08:48
< Reivthia>
Balanced on one hand, I guess?
08:49 GeekSoldier [Rob@Nightstar-e86e3e0d.ip.cablemo.net] has joined #Code
08:49
<@jerith>
I haven't *done* it on a construction site, but I've done it in other places.
08:49 * Reivthia suspects the real problem here, jerith, is that you are a programmer, not a mathemitican/engineer.
08:49
<@jerith>
The one I have has a gap between the base and the screen suitable for fingers.
08:50
<@jerith>
I am as much an engineer as I am a programmer.
08:50
< Reivthia>
Thus your needs, and more importaintly your perception of your needs, is vastly different to the devices intended audience.
08:50
<@jerith>
I was in the device's intended audience for a number of years.
08:51 * Reivthia has seen several cases of engineery types grabbing their calculator and quickly spitting out a spot of math while walking along chatting. Cannot imagine it being so straightforward on a laptop, especially in an enviroment you probably don't want a laptop...
08:51
<@jerith>
The needs of the audience have changed, as has the ability of technology to deliver.
08:51
< Reivthia>
(Note: This was being done all the time in the engineering shop we worked in. There were quite a number of sparks, dust, etc.)
08:51
< Reivthia>
(This was two years ago.)
08:52
<@jerith>
If the caculator was a tool I used on a daily basis, then it would suit.
08:52
< Reivthia>
Which I am arguing is the intended audience, yes.
08:52
<@jerith>
If the laptop was the tool I used on a daily basis, then it would be preferable.
08:53
< Reivthia>
If you're using your laptop as a calculator for hours on end each day, you'd still argue the laptop as being a preferable solution? :)
08:54
<@jerith>
If I'm using my laptop as a calculator for hours on end each day in an environment where the laptop is a more suitable device, then yes.
08:55
< Reivthia>
http://project-apollo.net/pie/true_space_secrets.jpg
08:55
<@jerith>
If I'm spending all my time in the workshop or on-site, then a rugged machine is preferable.
08:56
<@jerith>
Let me change my position a bit, theough.
08:56
<@jerith>
*though
08:56
<@jerith>
The needs of most of the target audience have changed.
08:57
<@jerith>
There will always be people for whom a rugged programmable calculator is the best solution.
08:57
<@jerith>
Just as there are those for whom a sliderule is the best solution.
08:57
< Reivthia>
(In spaaaace!)
08:57
<@jerith>
Both groups will slowly dwindle as better tools become available.
08:58
<@jerith>
No, you'd use an abacus in space. ;-)
08:58
<@jerith>
(Was that a Clarke or an Asimov story?)
08:59
< Reivthia>
I'm not sure, but NASA still sends up slide rules IIRC
08:59 GeekSoldier [Rob@Nightstar-e86e3e0d.ip.cablemo.net] has quit [Ping timeout: 121 seconds]
08:59
<@jerith>
Sliderules don't need power and are immune to EMP and rad damage.
09:00 gnolaptop [drwest@Nightstar-dda66373.dialup.ice.net] has joined #Code
09:00
<@jerith>
Sliderules also foster an innate appreciation of orders of magnitude, which calculators don't.
09:01
<@jerith>
I'm much more willing to trust an off-the-cuff estimate from a guy with a sliderule than a similar guy with a calculator.
09:02 GeekSoldier [Rob@Nightstar-e86e3e0d.ip.cablemo.net] has joined #Code
09:04 * gnolaptop is reminded of high school.
09:04
< gnolaptop>
Where the method used was more important than the actual answer.
09:04
<@jerith>
In the next few years, you're likely to get better functionality out of a mass-produced portable computing device marketed as a cellphone than you can get from a programmable calculator.
09:04
< gnolaptop>
Except if the answer was "clearly unreasonable".
09:04
<@jerith>
gnolaptop: That's always the case when they're trying to teach you the method. ;-)
09:05
< gnolaptop>
And I approve!
09:05
<@jerith>
Sliderules make you keep all the orders of magnitude in your head.
09:05
<@jerith>
Calculators train you to read the numbers off the screen.
09:05
< gnolaptop>
But I like the fact that there was still a built-in "if it's orders of magnitude wrong, you're still going to score /zero/ even if the method was right" rule.
09:06
< gnolaptop>
Because, as you said, people tended to just read whatever the calculator spit out without questioning the answer.
09:06
<@jerith>
We had a sort of half-half system. The method was important, but so was the answer.
09:07
<@jerith>
Just writing down the answer could get you enough to almost pass.
09:07
<@jerith>
So could getting the method right all the way through but using the wrong numbers.
09:09
< gnolaptop>
Just writing down the answer without an explanation gave us zero points.
09:09
<@jerith>
But I've seen people punch numbers into a calculator and then go looking for megafarad capacitors.
09:10
< gnolaptop>
>_<
09:11
<@jerith>
Yeah.
09:11
<@jerith>
Because the multiplied instead of dividing or something.
09:11
< gnolaptop>
That's more a failure of the appreciation of magnitude of units used though.
09:11
< gnolaptop>
-the
09:12
< gnolaptop>
Any decent course should teach people that a Farad is a ginormous unit.
09:12
<@jerith>
Sure.
09:12
<@jerith>
And intellectually they know that.
09:12
< gnolaptop>
Ah. But the calculator says...
09:13
<@jerith>
But they also know that the...
09:13
<@jerith>
Yes.
09:13
< gnolaptop>
See also: GPS.
09:16
< gnolaptop>
People (usually with little to know boating experience) around here have been known to run aground because even though they could clearly see the shoals ahead, the GPS told them they were on open water.
09:16
< gnolaptop>
argh
09:16
< gnolaptop>
s/know/no
09:16 * gnolaptop got home at 0430 and types accordingly.
09:17
< gnolaptop>
If reality and the GPS disagree, the GPS is obviously right.
09:18
< gnolaptop>
It's Infallible.
09:18
<@jerith>
Overreliance on technology.
09:18
<@jerith>
The machine is a substitute for the skill.
09:19
<@jerith>
I used to amuse people by insisting on spending time understanding the libraries I was using instead of just using them.
09:19
< gnolaptop>
Well, it /is/ a cognitive artifact. :)
09:20
<@jerith>
It stopped being amusing to them when I pointed out the limitations and edge cases that were breaking their code and showed them how mine didn't hit those.
09:21
< gnolaptop>
In their defense, most libraries are woefully underdocumented.
09:22
<@jerith>
Frustratingly true.
09:22
<@jerith>
Which is why I usually read the code.
09:23
<@jerith>
Often as a first resort.
09:24
<@jerith>
Yet another reason to prefer Python to most other languages. The code's more readable on average.
09:29
< gnolaptop>
I'm still not sure if that's a feature of the language or the people using it though.
09:30 GeekSoldier [Rob@Nightstar-e86e3e0d.ip.cablemo.net] has quit [Ping timeout: 121 seconds]
09:32
<@jerith>
The language.
09:32
<@jerith>
The indentation-based blocks enforce readable indentation.
09:33
<@jerith>
And the syntax encourages clear code.
09:33
<@jerith>
It's possible to write unreadable Python, but it takes effort.
09:34
<@McMartin>
LIST INCOMPREHENSIONS
09:34
< Alek>
meh
09:34
<@jerith>
As compared to Perl or C, where it's much easier.
09:34 GeekSoldier [Rob@Nightstar-e86e3e0d.ip.cablemo.net] has joined #Code
09:35 * jerith is guilty of multiple-nested list incomprehensions.
09:35
<@McMartin>
(I love list comprehensions with all my vile heart.)
09:35
<@McMartin>
(This is one of several reasons I picked up Haskell rather rapidly)
09:35
<@jerith>
I just with the syntax were more like that of Haskell or Erlang.
09:35
<@jerith>
Speaking of which, I must get back into Haskell.
09:36
< Alek>
while indentation-based blocks may be more readable, I prefer a language that's not whitespace-sensitive, but using an editor that automatically indents based on the nesting level. if you know what I mean.
09:36
<@jerith>
Alek: All languages are whitespace-sensitive to some degree.
09:36
< Alek>
cause keeping track of what your indentation level is, could get fuzzy.
09:36
< Alek>
well. true enough. but other than the basic stuff.
09:37
< Alek>
I meant the leading whitespace.
09:37
<@jerith>
Try splitting arithmetic across lines, for example.
09:37
<@jerith>
The following is syntactically valid Ruby and doesn't do what you may expect:
09:37
<@jerith>
foo = (2 * 3
09:38
<@jerith>
+ 4 * 5)
09:38
<@jerith>
What would you expect the value of foo to be there?
09:38
< Alek>
so what does it do then?
09:38
< Alek>
26?
09:39
<@jerith>
foo == 20
09:39 * Alek doesn't know as many languages as he'd like...
09:39
< Alek>
... what
09:39
<@jerith>
The newline terminates expressions.
09:39
<@jerith>
Multiple expressions within parentheses are allowed.
09:40
< Alek>
wait, if... what
09:40
<@jerith>
The return value of the parenthetical block is that of the last expression.
09:40
< Alek>
ah
09:40
< Alek>
why would you WANT that?
09:40
<@jerith>
'+' is a unary operator matching '-'.
09:40
< Alek>
...
09:40
< Alek>
sorry, I'm a little confused here
09:41
<@jerith>
if (some_initialiser; some_expression)
09:41
<@jerith>
do_something
09:41
<@jerith>
end
09:41
<@jerith>
That kind of thing.
09:41
<@jerith>
There are cases where it's useful.
09:41
< Alek>
hm.
09:41
< Alek>
I guess I can see how that might work.
09:41
<@jerith>
And it makes perfect sense once you understand it.
09:42
<@jerith>
But it has bitten me more than once.
09:42
< Alek>
to put it in other words, the parenthetical block is a call to another function, where you're allowed to perform as many operations as you want, but the return value is the last operation?
09:42
<@jerith>
Not quite, but close enough.
09:43
< Alek>
well, that's the closest I can think of in my experience.
09:43
< Alek>
how does it differ?
09:43
< Alek>
well, besides the obvious fact that it's right inside instead of being a call to a separate location.
09:43
<@jerith>
It's a block/scope thing, no function calls involved.
09:43
<@jerith>
Ruby's weirder than most languages in that way.
09:44
<@jerith>
Mostly because it tries to have its cake and eat it with its block/lambda syntax.
09:45
<@jerith>
Scoping rules get... intricate.
09:46
<@jerith>
Anyway, whitespace-based blocks are no harder to work with than begin/end or braces.
09:46
<@jerith>
And they increase code density, which is a bonus.
09:49
<@jerith>
Python has a special place in my heart for being fairly small (in terms of syntax I have to keep in my head), being fairly well-designed, having an above average standard library and encouraging more readable code.
09:50
<@jerith>
Anyways, I must wander off for a while. Errands, breakfast, etc.
09:51 GeekSoldier [Rob@Nightstar-e86e3e0d.ip.cablemo.net] has quit [Ping timeout: 121 seconds]
09:52 GeekSoldier [Rob@Nightstar-e86e3e0d.ip.cablemo.net] has joined #Code
09:56 GeekSoldier [Rob@Nightstar-e86e3e0d.ip.cablemo.net] has quit [Ping timeout: 121 seconds]
10:04 GeekSoldier [Rob@Nightstar-e86e3e0d.ip.cablemo.net] has joined #Code
10:18 Rhamphoryncus [rhamph@Nightstar-a62bd960.abhsia.telus.net] has quit [Client exited]
10:24 You're now known as TheWatcher
11:00 AnnoDomini is now known as AnnoDominir
11:20
<@AnnoDominir>
What's a recursive data structure?
11:24 gnolaptop [drwest@Nightstar-dda66373.dialup.ice.net] has quit [Client closed the connection]
11:25
<@McMartin>
One that contains [a pointer or reference to] an object of its own type as a member.
11:26
<@McMartin>
Tree structures like a file system's directory structure are recursive; they contain subtrees.
11:27
<@AnnoDominir>
I seep.
11:27 GeekSoldier [Rob@Nightstar-e86e3e0d.ip.cablemo.net] has quit [Ping timeout: 121 seconds]
11:29 gnolaptop [drwest@Nightstar-7d29e748.dialup.ice.net] has joined #Code
11:31
<@McMartin>
If you're getting an error about having one, it means that it isn't actually a pointer or reference to one (4-8 bytes depending on platform) but a nominal embedded copy thereof
11:31
<@McMartin>
This would, of course, produce an endless regression and thus an object of infinite size, and so the compiler will call you on this
11:32
<@AnnoDominir>
No, no, I'm studying for my diploma defense tomorrow.
11:33 GeekSoldier [Rob@Nightstar-e86e3e0d.ip.cablemo.net] has joined #Code
11:36 gnolaptop [drwest@Nightstar-7d29e748.dialup.ice.net] has quit [[NS] Quit: Ex-Chat]
11:42
<@AnnoDominir>
I'm trying to understand what 'hashing' means in context of data searching, and failing.
11:43 GeekSoldier [Rob@Nightstar-e86e3e0d.ip.cablemo.net] has quit [Client closed the connection]
11:44 GeekSoldier [Rob@Nightstar-e86e3e0d.ip.cablemo.net] has joined #Code
11:45
<@McMartin>
That's a huge topic
11:46
<@McMartin>
I'd start by reading about what a "hash table" is and then from there to discussions of hash functions they can use
11:51
<@AnnoDominir>
Maybe later, then.
11:54 GeekSoldier [Rob@Nightstar-e86e3e0d.ip.cablemo.net] has quit [Ping timeout: 121 seconds]
11:56
< EvilDarkLord>
I need some simple profiling done on a Java program, just checking which functions eat all my cycles. Any suggestions?
11:56 GeekSoldier [Rob@Nightstar-e86e3e0d.ip.cablemo.net] has joined #Code
11:57
<@AnnoDominir>
System.out.println("This is function X"); ?
11:57
< EvilDarkLord>
Thanks, but I'm pretty sure there are automated tools out there.
11:58
<@AnnoDominir>
Yes, but in my experience, they require more work than this.
11:58
< EvilDarkLord>
More like functionMap[functionName] += timeItTookToRunThisFunction in any case.
11:59
<@AnnoDominir>
How many functions do you have?
12:00
< EvilDarkLord>
Enough that I could do this manually, but I don't want to do it manually because I don't really need to improve the performance. It's just that it would be nice to do so, and might raise my grade a little :)
12:01
<@AnnoDominir>
You could write your own class for this. :P
12:01 * EvilDarkLord is doing a local search program for minimizing the amount of different node types in a graph that are needed for there to be no adjacent nodes of the same type.
12:03
< EvilDarkLord>
My current program is performing a little poorly, and this is not entirely because I'm doing thing inefficiently, it's more likely the simple algorithm I chose. Nevertheless, there may be a lot of room for improvement in brute efficiency.
12:03
< EvilDarkLord>
*things
12:05
< Alek>
brute efficiency?
12:05
< Alek>
sounds like an oxymoron. >_>
12:07
<@AnnoDominir>
Post in Sidequest.
12:10
< EvilDarkLord>
McMartin? You know everything about Java. :)
12:10
< EvilDarkLord>
To recap, I need to profile a program, see which functions eat all my cycles.
12:25
<@TheWatcher>
http://ejp.sourceforge.net/ ?
12:26
<@TheWatcher>
Or, hells, http://java-source.net/open-source/profilers ?
12:32 GeekSoldier [Rob@Nightstar-e86e3e0d.ip.cablemo.net] has quit [Ping timeout: 121 seconds]
12:34 Attilla [The.Attilla@FBC920.65CFFF.E56E70.387AF5] has joined #Code
12:34 mode/#code [+o Attilla] by Reiver
12:36 GeekSoldier [Rob@Nightstar-e86e3e0d.ip.cablemo.net] has joined #Code
13:08 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has joined #Code
14:10 AnnoDominir [farkoff@Nightstar-a2ae8ddc.adsl.tpnet.pl] has quit [Ping timeout: 121 seconds]
14:17 AnnoDomini [farkoff@Nightstar-2cffdc77.adsl.tpnet.pl] has joined #Code
14:17 mode/#code [+o AnnoDomini] by Reiver
14:26 AnnoDomini [farkoff@Nightstar-2cffdc77.adsl.tpnet.pl] has quit [Ping timeout: 121 seconds]
14:29 AnnoDomini [farkoff@Nightstar-05dd1f3f.adsl.tpnet.pl] has joined #Code
14:29 mode/#code [+o AnnoDomini] by Reiver
14:45
< SmithKurosaki>
I have a strange / easy C question: With global variables, if you initialize then in the global scope to 0 will that affect if they are written to, or will it go crunch if I don't initialize them there
14:45 AnnoDomini [farkoff@Nightstar-05dd1f3f.adsl.tpnet.pl] has quit [Ping timeout: 121 seconds]
14:51 AnnoDomini [farkoff@Nightstar-cffebf7b.adsl.tpnet.pl] has joined #Code
14:51 mode/#code [+o AnnoDomini] by Reiver
14:53
<@jerith>
I don't understand the question, SmithKurosaki.
14:55
< SmithKurosaki>
OK, I have global: int a; and in main I have a=0; There is a bunch of code between the global and where a =0; afaik, that will cause errors, but if I make global int a = 0; then will it be able to properly alter the value
14:55
< SmithKurosaki>
I normally ask TF, but he is still sleeping
15:00
<@jerith>
Not initialising it shouldn't cause any problems at all, so long as you don't try to use its value before you assign to it.
15:03
< SmithKurosaki>
In the program's flow, no
15:03
<@jerith>
Then you should be fine.
15:03
<@jerith>
Are you getting an error?
15:05 * SmithKurosaki flails
15:05
< SmithKurosaki>
I am getting logic errors
15:06
<@jerith>
Pastebin the code?
15:07
< SmithKurosaki>
I am using an array basedd stack to do postfix
15:09
< SmithKurosaki>
http://lua.pastey.net/126754
15:15
<@jerith>
Segfaulting?
15:16
< SmithKurosaki>
Yup
15:17
< SmithKurosaki>
I haven't commented my code yet, sorry
15:17
<@jerith>
What are you calling it with?
15:17
< SmithKurosaki>
What is it?
15:19
<@jerith>
It look like you're reading the first argument on the command line and operating on it.
15:20
< SmithKurosaki>
Yea, it's supposed to be like 12+53-*
15:24
<@jerith>
First thing, you're treating characters as if they are integers.
15:25
<@jerith>
So you're operating on their ASCII values rather than the digits.
15:25
< SmithKurosaki>
I would also like to give stack a limit of 50
15:25
<@jerith>
Second thing, you have a pointer to nowhere.
15:25
< SmithKurosaki>
hmm
15:26
<@jerith>
Unless you want to mess with dynamic memory allocation (which you probably don't), you need to turn that into an array.
15:27
< SmithKurosaki>
That is what I was trying to do, but when I try running it, the stack array keeps starting at 49 instead of 0
15:28
<@jerith>
While 'int a[50]' and 'int *a' are the same type, the former allocates memory and initialises memory for you.
15:29
< SmithKurosaki>
Ok, I was thinking that, but the array is starting at 49 for some reason, and it was going over as well
15:30
<@jerith>
The array is starting at 49 because the first character you're giving it is '1', which is 49 ASCII.
15:30
< SmithKurosaki>
AHHHH
15:30
< SmithKurosaki>
push(atoi(argv[1][i])); ->Postfix.c:47: warning: passing argument 1 of atoi makes pointer from integer without a ca
15:30
<@jerith>
The segfault is because you're trying to store that in position 0 of an array that has not been initialised.
15:30
< SmithKurosaki>
I always forget the problem with this one
15:31
< SmithKurosaki>
(That has been fixed)
15:31
<@jerith>
atoi() takes a sting.
15:31
<@jerith>
*string
15:31
< SmithKurosaki>
Damn
15:31
< SmithKurosaki>
Hmm
15:31
<@jerith>
You can use sprintf().
15:32
<@jerith>
Or you can use "digit - '0'" and exploit the fact that digits have sequential character codes.
15:32
< SmithKurosaki>
That sounds easier
15:33
<@jerith>
You should also do bounds checking to make sure you don't run off the ends of your array.
15:34
< SmithKurosaki>
Thank you very much\
15:34
<@jerith>
"./a.out 12+++" will read from before the front.
15:34
< SmithKurosaki>
(It is working logically, so all I have to do is empty and full checks
15:35
<@jerith>
Since this is in the chunk of memory your code has access to, it might *look* like it works while actually operating on garbage data.
15:35
<@jerith>
And if you write to it, you can trash all sorts of exciting things. :-)
15:36
< SmithKurosaki>
Cool
15:44
< SmithKurosaki>
Well, too bad it's not good with spaces
15:45
<@jerith>
You can require spaces between terms/operators and iterate over argv instead of argv[1].
15:46
< SmithKurosaki>
Riiight
15:46
< SmithKurosaki>
I need to be able to accept both
15:49
< SmithKurosaki>
./a.out 12+53-*
15:49
< SmithKurosaki>
The stack is empty, you have too many operators in your equation0
15:49
< SmithKurosaki>
0
15:49
< SmithKurosaki>
Floating point exception (core dumped)
15:49
< SmithKurosaki>
That's new
15:50
< SmithKurosaki>
That worked before, then I added the string array, and things went bad
15:50
< SmithKurosaki>
http://lua.pastey.net/126756
15:56
<@jerith>
argv[0] is "./a.out" ;-)
15:56
<@jerith>
You want to start at 1 when traversing argv.
15:57
< SmithKurosaki>
Riiiht
15:57 crem [moo@Nightstar-8ca3eea7.adsl.mgts.by] has quit [Connection reset by peer]
15:57
< SmithKurosaki>
I thought of that before I found out how argv worked
15:58
< SmithKurosaki>
That's awesome. It made it through all the calculations and then segfaulted
15:59
<@ToxicFrog>
Time to use gdb!
16:00
< SmithKurosaki>
...
16:00
< SmithKurosaki>
Ass
16:00
< SmithKurosaki>
:p
16:00
<@ToxicFrog>
?
16:00
< SmithKurosaki>
You were razzing me about it last night
16:00
<@ToxicFrog>
??
16:00
< SmithKurosaki>
-g
16:01
<@ToxicFrog>
That wasn't razzing, that was good advice.
16:01
< SmithKurosaki>
Also, I have never had to use gdb, I have always just used valgrind
16:01
<@ToxicFrog>
Using it to track down segfaults is pretty easy
16:01
<@ToxicFrog>
$ gdb
16:01
<@ToxicFrog>
(gdb) file program-name
16:01
< SmithKurosaki>
heh
16:01
<@ToxicFrog>
(gdb) run program-arguments
16:01
<@ToxicFrog>
Program exited with signal 11 (segmentation fault)
16:01
<@ToxicFrog>
(gdb) where
16:01
< SmithKurosaki>
Cool
16:02
< SmithKurosaki>
I am having trouble parsing the syntax without demonstration
16:02
<@ToxicFrog>
(you can also go 'core core-file; where', but depending on how it crashed the contents of the corefile might be corrupt
16:02
<@ToxicFrog>
Syntax for what?
16:02
< SmithKurosaki>
the gdb commands
16:03
<@ToxicFrog>
I just gave you examples
16:04 crem [moo@Nightstar-8ca3eea7.adsl.mgts.by] has joined #Code
16:07
<@ToxicFrog>
Ok. type 'gdb' to start the debugger. You now have a gdb prompt.
16:08
<@ToxicFrog>
At that prompt, 'file program-name' to load the program you want to debug - eg, 'file thumbpeg' or 'file a.out'
16:08
< SmithKurosaki>
kk
16:08
<@ToxicFrog>
It'll burble about loading symbols (or 'no debugging symbols found') if you forgot to compile with -g)
16:08
< SmithKurosaki>
Ok
16:09
<@ToxicFrog>
Then, 'run arguments' - for example, 'run "12+53-*"' to pass the program the single argument "12+53*"
16:09
<@ToxicFrog>
And then, once it crashes, "where"
16:09
< SmithKurosaki>
Thank you
16:13
< SmithKurosaki>
Program received signal SIGSEGV, Segmentation fault.
16:13
< SmithKurosaki>
0xb7ee2743 in strlen () from /lib/libc.so.6
16:13
< SmithKurosaki>
(gdb) where
16:13
< SmithKurosaki>
#0 0xb7ee2743 in strlen () from /lib/libc.so.6
16:13
< SmithKurosaki>
#1 0x080487dd in main (argc=2, argv=0xbffff284) at Postfix.c:51
16:13
< SmithKurosaki>
So, it goes through the entire program and then crashes on my strlen(argv[j])
16:14
< SmithKurosaki>
Or something like that
16:14
<@ToxicFrog>
Ok, what does this suggest to you? What would cause strlen to crash?
16:14
< SmithKurosaki>
No clue
16:14
< SmithKurosaki>
Do you need a link to the code?
16:14
<@ToxicFrog>
No.
16:15
< SmithKurosaki>
kk
16:15
<@ToxicFrog>
Take a guess.
16:15
< SmithKurosaki>
I honestly do not know
16:15
<@ToxicFrog>
...passing it an invalid pointer.
16:16
< SmithKurosaki>
It wasn't doing this when I had argv[1], but that doesn't allow for spaces
16:16
<@ToxicFrog>
Um
16:16
<@ToxicFrog>
Spaces have nothing to do with that
16:17
<@ToxicFrog>
./a.out "1 2 3 + *" -- oh look, everything is in argv[1]
16:17
< SmithKurosaki>
No
16:17
< SmithKurosaki>
12+53-* != 1 2 + 5 3 - * in my code
16:18
< SmithKurosaki>
The one with spaces would read 1 and then stop
16:18
<@ToxicFrog>
Your parser doesn't handle spaces? It needs to.
16:18
<@ToxicFrog>
But we can set that aside for now.
16:19
<@ToxicFrog>
Confirming what's happening with the segfault comes first.
16:19
< SmithKurosaki>
Well, I have it if (' ') then continue;
16:19
< SmithKurosaki>
But I have a feeling that is not right
16:19
<@ToxicFrog>
You can examine variables in gdb with the 'print' command, and change which stack frame you're looking at with 'up', 'down', or 'frame n'
16:19
<@ToxicFrog>
So try:
16:19
<@ToxicFrog>
frame 1
16:19
<@ToxicFrog>
print argc
16:20
< SmithKurosaki>
#1 0x080487dd in main (argc=2, argv=0xbffff284) at Postfix.c:51
16:20
< SmithKurosaki>
51 for (int i=0; i<strlen(argv[j]); i++)
16:20
< SmithKurosaki>
argc = 2
16:21
< SmithKurosaki>
*$1=2, (assuming it's argc)
16:22
<@ToxicFrog>
Each thing you prent gets a $n so you can refer to it later
16:22
<@ToxicFrog>
So. If strlen is crashing, it's likely that argv[j] is invalid, yes?
16:22
<@ToxicFrog>
So, ask it what j is.
16:23
< SmithKurosaki>
j =2
16:25
< SmithKurosaki>
I really need to get this done so I can do the other part of this....
16:26
<@ToxicFrog>
If argc == 2, what's the highest valid index in argv?
16:26
< SmithKurosaki>
2
16:27
<@ToxicFrog>
Oh? What's the lowest index, then?
16:27
< SmithKurosaki>
I don't understand
16:28
<@ToxicFrog>
argc is not the highest index in argv, it's the number of elements - 'argument count'
16:29
<@ToxicFrog>
if argc is 2, valid indexes in argv are 0 and 1
16:32
< SmithKurosaki>
Ok
16:33
<@ToxicFrog>
This is easy to fix, or you can stop messing about with multiple arguments entirely since it's not relevant to the final version of the program
16:33
< SmithKurosaki>
True
16:33
< SmithKurosaki>
At the same time 12+ and 1 2 + -> 1 2 +
16:33
< SmithKurosaki>
Wait, nvm
16:40 AnnoDomini [farkoff@Nightstar-cffebf7b.adsl.tpnet.pl] has quit [Ping timeout: 121 seconds]
16:42 AnnoDomini [farkoff@Nightstar-05a8e020.adsl.tpnet.pl] has joined #Code
16:42 mode/#code [+o AnnoDomini] by Reiver
17:06 Derakon[AFK] is now known as Derakon
17:28 Rhamphoryncus [rhamph@Nightstar-a62bd960.abhsia.telus.net] has joined #Code
18:30 AnnoDomini [farkoff@Nightstar-05a8e020.adsl.tpnet.pl] has quit [Ping timeout: 121 seconds]
18:31 AnnoDomini [farkoff@Nightstar-79274642.adsl.tpnet.pl] has joined #Code
18:31 mode/#code [+o AnnoDomini] by Reiver
19:44
<@McMartin>
Much belated: You can get basic profiling info by passing -Xprof on the java commandline
19:57 Vornicus-Latens [vorn@ServerAdministrator.Nightstar.Net] has quit [[NS] Quit: Leaving]
19:59 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has joined #Code
19:59 mode/#code [+o Vornicus] by Reiver
21:06
< EvilDarkLord>
Thanks.
21:38
<@MyCatVerbs>
jerith: The fact that Python code is readable is one of my least favourite things about it.
21:38
<@MyCatVerbs>
jerith: People seem to use the fact as an excuse to massively underdocument.
21:39
<@MyCatVerbs>
On the opposing gripping appendage, I'm used to BSD. So maybe I'm kinda spoiled by good documentation most of the rest of the time.
21:39
<@McMartin>
It's also worth noting that Python's integrated documentation mechanism is actually quite good.
21:40
<@MyCatVerbs>
__doc__! I love this and I wish more languages had it.
21:40
<@MyCatVerbs>
Not necessarily at runtime, but at least special-case it so that I can use it at the REPL.
21:43 * MyCatVerbs pokes the topic.
21:43
<@MyCatVerbs>
McMartin: thanks for correcting the German again. :)
21:45 AnnoDomini [farkoff@Nightstar-79274642.adsl.tpnet.pl] has quit [[NS] Quit: Astro Cat will play for you... the Symphony of Space.]
22:04 Rhamphoryncus [rhamph@Nightstar-a62bd960.abhsia.telus.net] has quit [Client exited]
22:08 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has quit [[NS] Quit: ]
22:11 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has joined #Code
22:11 mode/#code [+o Vornicus] by Reiver
23:22 McMartin [mcmartin@Nightstar-cd8a4fac.pltn13.sbcglobal.net] has quit [Operation timed out]
23:26 McMartin [mcmartin@Nightstar-cd8a4fac.pltn13.sbcglobal.net] has joined #Code
23:26 mode/#code [+o McMartin] by Reiver
23:35 You're now known as TheWatcher[T-2]
23:37 You're now known as TheWatcher[zZzZ]
23:59
<@McMartin>
http://hkn.eecs.berkeley.edu/~mcmartin/whut.png
--- Log closed Mon Oct 19 00:00:25 2009
code logs -> 2009 -> Sun, 18 Oct 2009< code.20091017.log - code.20091019.log >