code logs -> 2013 -> Sun, 24 Mar 2013< code.20130323.log - code.20130325.log >
--- Log opened Sun Mar 24 00:00:14 2013
00:14 syksleep is now known as Syk
00:15 You're now known as TheWatcher[T-2]
00:16 You're now known as TheWatcher[zZzZ]
00:42 Tarinaky [tarinaky@Nightstar-dd7e4a05.net] has quit [Ping timeout: 121 seconds]
01:01 Tarinaky [tarinaky@Nightstar-dd7e4a05.net] has joined #code
01:01 mode/#code [+o Tarinaky] by ChanServ
01:08 celticminstrel [celticminst@Nightstar-e83b3651.cable.rogers.com] has quit [[NS] Quit: KABOOM! It seems that I have exploded. Please wait while I reinstall the universe.]
01:08 celticminstrel [celticminst@Nightstar-e83b3651.cable.rogers.com] has joined #code
01:08 mode/#code [+o celticminstrel] by ChanServ
01:54 Kindamoody[zZz] is now known as Kindamoody
02:00 mac [mac@Nightstar-fe8a1f12.il.comcast.net] has joined #code
02:01
< mac>
silly question i've never used for statements like this before but I was wondering if you can have a logical OR ( || ) in the update statements.
02:09
<@celticminstrel>
I have no idea what you are talking about.
02:12
< mac>
I could paste the line I'm talking about.
02:22
<@Tarinaky>
Can someone remind me who is it here who works at a Uni in... I think Manchester?
02:23
<@Tarinaky>
It's coming up to be time for end of year assignments and I saw this on reddit http://i.imgur.com/6irlFw1.gif
02:51
<@[R]>
mac: SQL?
02:51
< mac>
no it was C++
02:52
< mac>
i figured it out, i just changed the logic so it worked without needing an or.
02:52
<@[R]>
What library?
02:53
< mac>
standard
03:25
<&ToxicFrog>
Is there some context we're missing?
03:25
<&ToxicFrog>
For statements like what?
03:34
< mac>
here is an example of what i was trying to do, for(int i; i<test||i>test; test=less||test=more), not exactly what i was trying to do but that's more or less how it was set up
03:35
<&Derakon>
Oh, the assignment portion of a for loop.
03:35
<&Derakon>
"update statement" is just horrifically vague; I thought you were talking about SQL.
03:35
<&Derakon>
As a general rule, C will let you do all kinds of horrible things that you should not do.
03:35
<&Derakon>
I don't know if that particular thing is syntactically valid, but it's dumb.
03:38
< mac>
well it actually wont work for what i wanted to do so i just did it differently. but yeah.
03:39
<@celticminstrel>
For that sort of thing I'd use the comma operator.
03:39
<@celticminstrel>
for(int i; i<test||i>test; test=less, test=more)
03:39
<@celticminstrel>
Assuming of course that that gives the logic I actually want.
03:40
<@celticminstrel>
Also, || in C/C++ returns a boolean, unlike in PHP or Python or others.
03:42
< mac>
mhumm
03:56
<@celticminstrel>
No idea whether that last was relevant here.
03:57
<@celticminstrel>
Side note, I think "test=less||test=more" binds as "test=(less||test)=more", doesn't it? Which would be an error.
04:02 VirusJTG [VirusJTG@Nightstar-09c31e7a.sta.comporium.net] has quit [[NS] Quit: Program Shutting down]
04:10
<&ToxicFrog>
celticminstrel: are you sure it would be? x = y = z is valid C.
04:11
<&ToxicFrog>
mac: what were you actually trying to do with it?
04:11
<&Derakon>
Presumably he was trying to do "foo gets this value, or if that value is false, it gets this other value".
04:11
<&Derakon>
Taking advantage of the short-circuit boolean logic.
04:12
< mac>
this is what i actually did for (int num=max,tempnum=target; (guess>target)||(guess<target); (tempnum=target-guess,num=num/2,guess=guess+((tempnum/abs(tempnum))*num)))
04:12 * Derakon winces.
04:12
<&Derakon>
Is there any particular reason why this had to all be within the for loop statement itself?
04:12
< mac>
The goal was to write a loop that would get closer to a random number, but to do that in one line.
04:13
<@celticminstrel>
ToxicFrog: Because (less||test) is not an l-value?
04:13
<&ToxicFrog>
celticminstrel: oh right.
04:13
<&ToxicFrog>
mac: you can replace (guess > target)||(guess < target) with simply guess != target
04:13
< mac>
the example i posted earlier was really not what i had at all, i just wanted to give an example
04:13
< mac>
well yeah
04:15
< mac>
I just changed it to that, thanks. Lol.
04:16
<@celticminstrel>
Pffft.
04:17
<@celticminstrel>
Well, it's not the same if your values are only partially ordered, but that's not the case here.
04:20
<@Alek>
oh God what! http://pics.nase-bohren.de/blingedout.jpg
04:20
<~Vornicus>
wtf
05:21 mac [mac@Nightstar-fe8a1f12.il.comcast.net] has quit [[NS] Quit: This computer has gone to sleep]
05:24 * McMartin wonders, pre-google-searching, if there are any good HTML5 LOGO implementations
05:24 * McMartin then goes to search for some.
05:25 * McMartin gets dozens of pages of the HTML5 logo graphic. -_-
05:29 Derakon is now known as Derakon[AFK]
05:33
<@celticminstrel>
XD
05:33
<@celticminstrel>
Try "html turtle graphics"?
05:33
<@celticminstrel>
Or something more like that/
05:33
<@celticminstrel>
?
05:34 * McMartin managed to find http://www.calormen.com/logo/ which seems pretty good
05:34
<@celticminstrel>
...
05:34
<@celticminstrel>
Is it just a coincidence that that domain name references Narnia?
05:34
<&McMartin>
Though the turtle doesn't animate, which makes it less fun.
05:34
<&McMartin>
Probably? I paid little attention to it~
05:35 * celticminstrel draws a square and pentagon. :D
05:36
<@celticminstrel>
But... I'm not sure I like how the turtle is centred on its location...
05:38
<@celticminstrel>
What I'm used to is the pen location corresponding to the midpoint of the base of the turtle.
05:39 celticminstrel [celticminst@Nightstar-e83b3651.cable.rogers.com] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
06:05 Rhamphoryncus [rhamph@Nightstar-f8b1f87b.abhsia.telus.net] has quit [Ping timeout: 121 seconds]
06:19 Rhamphoryncus [rhamph@Nightstar-f8b1f87b.abhsia.telus.net] has joined #code
06:20 mode/#code [+o Rhamphoryncus] by ChanServ
06:23
< JustBob>
So, coders, you should be horrified by this: In my final matlab project, I named the variables used w1x1, w1x2, u1x1, u1x2, w2x1, w2x2, u2x1, u2x2, w1u1x1, w1u2x1, etc. For seven different iterations.
06:25
< Syk>
cool
06:26
<&McMartin>
We've all been there
06:26
<&McMartin>
Before we learned about arrays >_>
06:27
< JustBob>
Those were arrays. :p
06:28
< JustBob>
MatLab handles arrays weirdly, though. It's easier to just create a new array than to pull, say, 'only the row of values' from an array.
06:28
< JustBob>
Only the second row, that is.
06:29
<&McMartin>
Oh, they're full grids instead of chains?
06:29
< JustBob>
Hence why it winds up being w1x1 and w1x2, rather than being w1[x1, x2, etc.]
06:29
< JustBob>
Yeah. Well, matrix formatted data.
06:30
< JustBob>
So it's /possible/ to do something like 'slap this data on there as the second row,' then 'add this as the third row,' but honestly... Just creating a new one saves you code.
08:05 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has quit [[NS] Quit: Leaving]
08:12 OrthiaLap [orthia@Nightstar-fae4ee48.ihug.co.nz] has joined #code
09:08 You're now known as TheWatcher
09:45 Alek [omegaboot@Nightstar-56dbba0f.in.comcast.net] has quit [Ping timeout: 121 seconds]
09:48 Alek [omegaboot@Nightstar-56dbba0f.in.comcast.net] has joined #code
09:49 mode/#code [+o Alek] by ChanServ
10:55 OrthiaLap [orthia@Nightstar-fae4ee48.ihug.co.nz] has quit [Ping timeout: 121 seconds]
11:55 VirusJTG [VirusJTG@Nightstar-09c31e7a.sta.comporium.net] has joined #code
12:52 Kindamoody is now known as Kindamoody|out
12:57 mac [mac@Nightstar-f5917731.emhril.sbcglobal.net] has joined #code
13:05 RichyB [richardb@Nightstar-9432feec.bb.sky.com] has joined #code
13:06 mac [mac@Nightstar-f5917731.emhril.sbcglobal.net] has left #code ["Leaving"]
14:57 celticminstrel [celticminst@Nightstar-e83b3651.cable.rogers.com] has joined #code
14:57 mode/#code [+o celticminstrel] by ChanServ
15:01 VirusJTG_ [VirusJTG@Nightstar-09c31e7a.sta.comporium.net] has joined #code
15:04 VirusJTG [VirusJTG@Nightstar-09c31e7a.sta.comporium.net] has quit [Ping timeout: 121 seconds]
15:19 VirusJTG [VirusJTG@Nightstar-09c31e7a.sta.comporium.net] has joined #code
15:21 VirusJTG_ [VirusJTG@Nightstar-09c31e7a.sta.comporium.net] has quit [Ping timeout: 121 seconds]
15:51 RichyB [richardb@Nightstar-9432feec.bb.sky.com] has quit [Ping timeout: 121 seconds]
16:02 Derakon [Derakon@Nightstar-a3b183ae.ca.comcast.net] has joined #code
16:02 mode/#code [+ao Derakon Derakon] by ChanServ
16:05 Derakon[AFK] [Derakon@Nightstar-a3b183ae.ca.comcast.net] has quit [Ping timeout: 121 seconds]
16:41 d4de [olorin@687AAB.418D22.D394B7.F781AC] has quit [Ping timeout: 121 seconds]
16:55 Syk is now known as syksleep
16:57 RichyB [richardb@Nightstar-9432feec.bb.sky.com] has joined #code
17:27 RichyB [richardb@Nightstar-9432feec.bb.sky.com] has quit [[NS] Quit: >:3 This is BunThulhu. Copy him into your quit message to help him take over the Internet.]
17:27 RichyB [richardb@Nightstar-9432feec.bb.sky.com] has joined #code
17:37 RichyB [richardb@Nightstar-9432feec.bb.sky.com] has quit [Ping timeout: 121 seconds]
17:55 [R] is now known as Vasi
18:18 iospace is now known as io\sick
18:26 Rhamphoryncus [rhamph@Nightstar-f8b1f87b.abhsia.telus.net] has quit [Ping timeout: 121 seconds]
18:41 Rhamphoryncus [rhamph@Nightstar-f8b1f87b.abhsia.telus.net] has joined #code
18:41 mode/#code [+o Rhamphoryncus] by ChanServ
19:01 Adoray_ [Adoray@490720.85CA0C.12F966.66ED37] has joined #code
19:02
< Adoray_>
hey guys
19:02
< Adoray_>
im super new to programming, did a bit in high school, but i'm basically a total noob
19:02
< Adoray_>
trying to introduce myself to python
19:03
< Adoray_>
got a bunch of questions and no real starting point
19:03
< Adoray_>
but what im trying to do is make a bot for irc
19:04
< Adoray_>
currently i've got a bot up and running using some mirc scripts ive found online
19:04
< Adoray_>
however, they aren't setup as i would like them to be, and in addition, i'd like to add some more feature to the bot that these scripts dont cover
19:05
< Adoray_>
a dear friend gave me some code to a bot they wrote in python that should help me start to understand python and how to impliment the scripts
19:06
< Adoray_>
work backward kind of thing
19:06
< Adoray_>
so ive got python 2.7 going, and im doing some tutorials online, but it's all pretty intimidating at this point and im not sure what to do currently
19:07
<@celticminstrel>
...
19:07
< Adoray_>
or should i /part?
19:08
< Adoray_>
sorry to intrude..
19:08
<@celticminstrel>
I'm just thinking how this is a less than ideal first project in programming. :P
19:08
<@celticminstrel>
You need to either deal with sockets, or find a library that handles that for you.
19:09
<@EvilDarkLord>
Well, he's got a ready-made bot to experiment with.
19:09 Kindamoody|out is now known as Kindamoody
19:10
<@EvilDarkLord>
Plenty of others available on the internets too if you just google for python ircbot. But I guess if you want to do it this way, then you should start by reading the code and seeing if you can change how some command works.
19:10
< Adoray_>
im going to sound like a moron to you guys
19:11
<@Vasi>
It's fine
19:11
< Adoray_>
:$ so, how do i read the code
19:11
< Adoray_>
ive got a bunch of files
19:11
<@Vasi>
Do you have the bot running?
19:12
< Adoray_>
no
19:12
< Adoray_>
how do i run it?
19:12
<@EvilDarkLord>
Get instructions on how to run the bot if necessary, and set it up in a private channel somewhere.
19:12
<@Vasi>
I'd suggest doing that. Then finding the command handling function and working from there.
19:13
< Adoray_>
i have a different bot running currently
19:13
< Adoray_>
in mirc
19:13
<@EvilDarkLord>
Sure. But if you want to do stuff with this bot, you'll need to get it up and running.
19:13
< Adoray_>
like, what application do i use to see the code, i have a bunch of files from the bot zip
19:14
<&ToxicFrog>
Adoray_: any text editor.
19:14
< Adoray_>
right, so i need the instructions on how to get this seperate python but running, sorry
19:14
<&ToxicFrog>
Ideally, one that actually understands the language, and will do syntax hilighting and stuff
19:14
< Adoray_>
hey ToxicFrog :)
19:14
<@EvilDarkLord>
A text editor of your choice. Preferably one with syntax highlighting.
19:14
< Adoray_>
i didnt want to keep bothering you so i thought i'd bother these guys ;)
19:14
<&ToxicFrog>
What OS are you on?
19:15
< Adoray_>
w7
19:15
< Adoray_>
notepad ++?
19:15
<&ToxicFrog>
Ok, try Notepad++ or JEdit
19:15
< Adoray_>
kk thats what ive got currently
19:15
< Adoray_>
which file is the code file? lancow?
19:15
<&ToxicFrog>
Er
19:15
<@EvilDarkLord>
Any file with a .py extension.
19:15
<&ToxicFrog>
lancow is a launcher script, a linux shell script IIRC
19:15
<&ToxicFrog>
Yep: https://github.com/ToxicFrog/lancow/blob/master/lancow
19:15
< Adoray_>
mm kk thx, setup then
19:15
<&ToxicFrog>
All the .py files are python source code.
19:16
< Adoray_>
ah, yea i double clicked that which did nothing :|
19:17
< Adoray_>
so ive got setup.py open in note++
19:17
<&ToxicFrog>
Windows has no idea what to do with it by default.
19:17
<&ToxicFrog>
I should note that I've only ever run this bot on linux. I don't know if it supports windows. If it does, I don't know how to get it running.
19:18
< Adoray_>
dont really have a way of running linux :(
19:18
< Adoray_>
but i'd rather learn how you have written your alias script for example and try impliementing that into my current bot
19:18
<&ToxicFrog>
But, quick tour: the stuff in the root directory is setup/launcher stuff. setup.py is the installer, rehash/lancow are launcher scripts, the ALLCAPS stuff is documentation.
19:18
< Adoray_>
no idea if thats possible, no idea what im doing at all, but i know what i want, lol
19:18
<&ToxicFrog>
scripts/madcow is the actual starting point for the bot
19:19
<&ToxicFrog>
madcow/* is the bot itself, divided into a bunch of different subcomponents; madcow/modules/ are the actual commands.
19:19
<&ToxicFrog>
So, e.g., madcow/modules/alias.py is the alias command.
19:20
<&ToxicFrog>
That said
19:20
< Adoray_>
understood
19:21
<&ToxicFrog>
The reason I went with madcow for this project is that all of the IRC bot support stuff is built in. The alias command doesn't need to know anything about how to communicate with IRC; it gets all of that for free, and will be automatically called by the parts of the bot that actually interface with IRC.
19:21
<&ToxicFrog>
Basically, I didn't feel like writing an IRC bot, so I took an existing bot and adjusted its configuration and wrote a few new features in.
19:21
< Adoray_>
mm
19:22
< Adoray_>
still a lot of work though
19:22
<&ToxicFrog>
So, on the one hand, the bot as a whole is way more complicated than what you're working on it because it's a general-purpose, extensible, bot framework, and the bits I wrote gloss over a lot of ugly details because the existing framework handles those.
19:23
< Adoray_>
understood
19:23
<&ToxicFrog>
(which is all just a long-winded way of saying, the source is all there, but unless you want to run your own madcow/lancow-based bot, I don't know how much if it you'll find useful)
19:25
< Adoray_>
mostly just looking into the alias and wikimedia modules and maybe the factoids
19:26
<&ToxicFrog>
Wikimedia module consists mostly of configuration, and of really ugly code to peel apart HTML from the wiki and extract the juicy bits.
19:27
< Adoray_>
this is why i hate my parents lol
19:27
< Adoray_>
i wanted to learn to program and play piano in grades 4-5
19:28
< Adoray_>
and they told me it was too nerdy and put me in hockey :|
19:28
< Adoray_>
such a useful skill, being able to play hockey
19:29
<&ToxicFrog>
Oh right, and as for having no way to run linux - you could always set it up in a VM and use that. May not be worth it for a one-off project, but it's an option.
19:31
< Adoray_>
yea im pretty much just staring at this code like.. "welp, fuck it:
19:31
<&ToxicFrog>
celmin was not kidding when he said this is a bit hairy for a first project.
19:31
<@EvilDarkLord>
Adoray_: You could also learn python in general from one of the tutorials around and then use an irc library.
19:32
<@celticminstrel>
EvilDarkLord: Um, having a mirc bot won't help you create a python bot.
19:32
<&ToxicFrog>
madcow is a sixty thousand line project built over the course of about five years.
19:32
< Adoray_>
reading thru this currently: http://cscircles.cemc.uwaterloo.ca/2-functions/
19:32
< Adoray_>
may as well be chinese
19:32
<&ToxicFrog>
You probably want to start with CSCircles or another beginner's tutorial, then work on some smaller projects (a really simple bot isn't honestly that hard)
19:33
<@EvilDarkLord>
celticminstrel: Well, he knows what he *wants*. He can probably get there eventually.
19:33
<@celticminstrel>
Oh wait. I missed the part about him having a python bot written by a friend.
19:33
<&ToxicFrog>
celticminstrel: the python bot in question is a madcow fork on my github. Parts of it are illustrative but it's not at all a beginner's project.
19:33
< Adoray_>
i think weve come to the conclusion that this bot is too convoluted for me to start to tackle
19:34
< Adoray_>
mm
19:34
<&ToxicFrog>
Writing individual modules for it isn't too hard, writing an entirely new bot using MC as a basis kind of is.
19:34
< Adoray_>
yea
19:34
< Adoray_>
well learning how to do these modules i want in mirc would be pointless if i could learn python at the same time
19:34
<@EvilDarkLord>
Writing an entirely new bot using the simplest examples on the internets as a basis might be possible.
19:35
<&ToxicFrog>
Python is a generally more useful - and pleasant - language, yes~
19:36
<@celticminstrel>
I could show my IRC bot, but it's kinda not suitable for public eyes.
19:36
<@celticminstrel>
Mainly because data (such as NickServ passwords) is hardcoded.
19:36
<@celticminstrel>
(Or channels to join)
19:36
<@celticminstrel>
(But mainly the passwords)
19:36
<@EvilDarkLord>
Can you remove the passwords from the files with any ease?
19:38
<&ToxicFrog>
You should fix that and then put it on github.
19:40
<&ToxicFrog>
Anyways. I must away to procure food.
19:40
<&ToxicFrog>
Adoray_, good luck. Feel free to ask questions if you're having trouble with the cscircles stuff.
19:40
< Adoray_>
thx guys
19:44 Kindamoody is now known as Kindamoody[zZz]
19:53
<@celticminstrel>
I intend to at some point. <_<
19:53
<@celticminstrel>
Fix that, I mean.
19:54
<@celticminstrel>
But I haven't gotten around to it yet.
19:55
<@celticminstrel>
It means changing stuff to use some kind of config file.
19:55
<@celticminstrel>
Though I suppose I could "cheat" and make the config file a Python module.
20:00
<&ToxicFrog>
That's a pretty common approach.
20:00
<&ToxicFrog>
Make the config file python source that returns a dict of settings, or something that can trivially be turned to/from python data structures, like JSON.
20:13 Rhamphoryncus [rhamph@Nightstar-f8b1f87b.abhsia.telus.net] has quit [Ping timeout: 121 seconds]
20:15 Rhamphoryncus [rhamph@Nightstar-948421b4.abhsia.telus.net] has joined #code
20:15 mode/#code [+o Rhamphoryncus] by ChanServ
20:18 Rhamphoryncus [rhamph@Nightstar-948421b4.abhsia.telus.net] has quit [Operation timed out]
20:28 himi [fow035@Nightstar-5d05bada.internode.on.net] has quit [Ping timeout: 121 seconds]
20:37
<@celticminstrel>
...now I have less excuse to put it off. :|
20:42 RichyB [richardb@Nightstar-86656b6c.cable.virginmedia.com] has joined #code
20:47
<&McMartin>
JSON is safer: "hey, let's use code injection as our config format" is more than a little dodgy =P
20:51
<&ToxicFrog>
In general, if the user is capable of editing the configuration file to insert malicious code, they're also capable of just running python pwnz0rship.py directly.
20:55
<@celticminstrel>
I'm not sure about putting it on github though, since all the history with config stuff (especially passwords) in the file would be there. I'd have to do major history rewrites.
21:15
<&ToxicFrog>
If you do want to make it public at some point, git filter-branch is the command you want.
21:18 d4de [olorin@687AAB.418D22.9DB427.23B365] has joined #code
21:23
<@celticminstrel>
Ooh?
21:24
<@celticminstrel>
...that sounds incredibly complex. >_>
21:24 * celticminstrel did git help filter-branch
21:25
<&ToxicFrog>
filter-branch is basically a map over git history
21:27
<&ToxicFrog>
Conceptually, it automatically checks out each commit, runs a command, and then commits the result.
21:27
<@celticminstrel>
The question then is whether the changes I would need to do can be done with a single command. >_>
21:30
<@celticminstrel>
I seem to only have 26 commits in history though.
22:16 Vasi is now known as [R]
22:30 himi [fow035@D741F1.243F35.CADC30.81D435] has joined #code
22:30 mode/#code [+o himi] by ChanServ
22:42 Adoray_ [Adoray@490720.85CA0C.12F966.66ED37] has quit [Ping timeout: 121 seconds]
22:54
<&McMartin>
Hm. Should I work on Ophis or on Project Monocle?
22:54
<@Reiv>
The latter is cooler
22:54
<@Reiv>
This suggests the former is more useful.
22:55
<&McMartin>
Only kind of
22:55
<&McMartin>
One is formatting text from a binary
22:55
<&McMartin>
The other the drawing rectangles with something that already has a prototype in a different language
22:56
<&McMartin>
Both are kind of useless, though someone did actually ask for the Ophis bit and it's what's nominally blocking a 2.1 release
23:33 Rhamphoryncus [rhamph@Nightstar-948421b4.abhsia.telus.net] has joined #code
23:33 mode/#code [+o Rhamphoryncus] by ChanServ
23:34
<@Rhamphoryncus>
Anybody here have minecraft handy and willing to test if my server is accessible through my firewall?
--- Log closed Mon Mar 25 00:00:29 2013
code logs -> 2013 -> Sun, 24 Mar 2013< code.20130323.log - code.20130325.log >

[ Latest log file ]