code logs -> 2013 -> Wed, 12 Jun 2013< code.20130611.log - code.20130613.log >
--- Log opened Wed Jun 12 00:00:52 2013
00:05
< Turaiel>
What would I use in place of constants in C#?
00:05 himi [fow035@Nightstar-5d05bada.internode.on.net] has quit [Ping timeout: 121 seconds]
00:12 himi [fow035@Nightstar-5d05bada.internode.on.net] has joined #code
00:12 mode/#code [+o himi] by ChanServ
00:16
<@McMartin>
C# has "const"
00:26 You're now known as TheWatcher[T-2]
00:28
<~Vornicus>
So, you use constants, in place of constants.
00:30
< Turaiel>
Makes sense :P
00:30 You're now known as TheWatcher[zZzZ]
00:40
< Turaiel>
What would the best way to represent a local resource be?
00:40
< Turaiel>
I want to store the image "defaultclip.png" in a variable, but I don't know what type I should use
00:41
<@McMartin>
That problem can get arbitrarily difficult
00:41
<@McMartin>
Does WPF has an Image class?
00:41
<@McMartin>
In Java you'd use java.awt.Image
00:41
< Turaiel>
Yeah, also an ImageSource class
00:41
<@McMartin>
.NET probably has some equivalent
00:42
< Turaiel>
But I'm not trying to store the whole image
00:42
< Turaiel>
Just a reference to it
00:42
<@McMartin>
As in "when needed, load this file"?
00:42
<@McMartin>
Or as in "I only want to load it once"?
00:42
< Turaiel>
The former
00:43
< Turaiel>
Do I just make it a string called "defaultclip.png"?
00:43
< Turaiel>
Or is there some format I need to use to represent a local resource?
00:43
<@McMartin>
I'd just use a string, for this.
00:44
<@McMartin>
I mean
00:44
<@McMartin>
This is about half the problem I'm trying to solve in Project Monocle~
00:44
<@McMartin>
But I also want to solve the "only load it once" problem and the "... and I want to attach app-specific metadata to it depending on what *kind* of image it is"
00:44
< Turaiel>
In the XAML it seems to use an ImageSource
00:45
<@McMartin>
I have no real experience with XAML
00:48
< Turaiel>
Sigh
00:48
< Turaiel>
I hate constructors
00:49 Typh[Offline] is now known as Typherix
00:52
< Turaiel>
McMartin, if you have time, does this look like reasonable code? http://pastebin.com/pa4E3FSy
00:53
<@McMartin>
You can abbreviate a lot of this
00:53
<@McMartin>
public string Title { get; set; } is actually equivalent to all your references to _Title.
00:55
< Turaiel>
Beyond the setters and getters, is there anything else I can change?
00:55
<@McMartin>
I'm not superfamiliar with the System.Windows.Media namespace, but I don't see anythign wrong
00:58
< Turaiel>
The constructor feels wrong
00:58
< Turaiel>
Probably just because of the names I'm using
00:59
<@McMartin>
You can also just skip the constructor, have an empty one
00:59
< Turaiel>
Hm?
01:00
<@McMartin>
And then use the syntax where you go new Media() { Title = "foo"; Color = ...; /* etc */ };
01:00
< Turaiel>
Hmm... that seems like it'd be useful
01:11 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has quit [[NS] Quit: ]
01:55
<@McMartin>
These are all reasons why it's super-hard to go back to Java from C#.
01:58 Typherix is now known as Typh[Offline]
02:03 RichyB [RichyB@D553D1.68E9F7.02BB7C.3AF784] has quit [[NS] Quit: Gone.]
02:06 RichyB [RichyB@D553D1.68E9F7.02BB7C.3AF784] has joined #code
02:15 Typh[Offline] is now known as Typherix
02:21 Derakon [Derakon@Nightstar-a3b183ae.ca.comcast.net] has quit [Connection reset by peer]
02:23 Derakon [Derakon@Nightstar-a3b183ae.ca.comcast.net] has joined #code
02:23 mode/#code [+ao Derakon Derakon] by ChanServ
02:57 Vorntastic [Vorn@Nightstar-cbb269da.sub-70-211-4.myvzw.com] has joined #code
03:51 VirusJTG_ [VirusJTG@Nightstar-09c31e7a.sta.comporium.net] has quit [[NS] Quit: Program Shutting down]
04:10 Kindamoody[zZz] is now known as Kindamoody
04:13 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has joined #code
04:13 mode/#code [+qo Vornicus Vornicus] by ChanServ
04:15 Vorntastic [Vorn@Nightstar-cbb269da.sub-70-211-4.myvzw.com] has quit [[NS] Quit: Bye]
05:44 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has quit [[NS] Quit: Leaving]
05:49 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has joined #code
05:49 mode/#code [+qo Vornicus Vornicus] by ChanServ
06:29 ErikMesoy|sleep is now known as ErikMesoy
06:32 Derakon is now known as Derakon[AFK]
06:35 AverageJoe [evil1@Nightstar-4b668a07.ph.cox.net] has joined #code
06:38 Syk [the@Nightstar-2b84c472.iinet.net.au] has quit [[NS] Quit: leaving]
06:38 Syka [the@Nightstar-2b84c472.iinet.net.au] has joined #code
06:49 Turaiel is now known as Turaiel[Offline]
06:51 Typherix is now known as Typh|offline
06:57 Kindamoody is now known as Kindamoody|out
07:49 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.]
08:12 AverageJoe [evil1@Nightstar-4b668a07.ph.cox.net] has quit [[NS] Quit: Leaving]
08:25 Pandemic [VirusJTG@Nightstar-09c31e7a.sta.comporium.net] has quit [[NS] Quit: shutting down!]
08:47 Derakon [Derakon@Nightstar-a3b183ae.ca.comcast.net] has joined #code
08:47 mode/#code [+ao Derakon Derakon] by ChanServ
08:48 Derakon[AFK] [Derakon@Nightstar-a3b183ae.ca.comcast.net] has quit [Ping timeout: 121 seconds]
09:07 Alek [omegaboot@Nightstar-56dbba0f.in.comcast.net] has quit [Ping timeout: 121 seconds]
09:11 Alek [omegaboot@Nightstar-56dbba0f.in.comcast.net] has joined #code
09:11 mode/#code [+o Alek] by ChanServ
09:23 You're now known as TheWatcher
12:48 Pandemic [VirusJTG@Nightstar-09c31e7a.sta.comporium.net] has joined #code
12:48 mode/#code [+o Pandemic] by ChanServ
13:23 Thalass|sleeeep is now known as Thalass
13:36 Thalass is now known as Thalass|KSP
14:22 Thalass|KSP is now known as Thalass
14:30 Thalass is now known as Thalass|shooty
14:40 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has quit [Client closed the connection]
14:51 celticminstrel [celticminst@Nightstar-e83b3651.cable.rogers.com] has joined #code
14:51 mode/#code [+o celticminstrel] by ChanServ
16:27 gnolam [lenin@Nightstar-b2aa51c5.cust.bredbandsbolaget.se] has quit [[NS] Quit: Das Reboot]
16:31 gnolam [lenin@Nightstar-b2aa51c5.cust.bredbandsbolaget.se] has joined #code
16:31 mode/#code [+o gnolam] by ChanServ
16:48 Thalass|shooty is now known as Thalass|sleepify
16:56 Turaiel[Offline] is now known as Turaiel
17:41 d4de [olorin@687AAB.418D22.0FE7A6.AD32C2] has quit [Ping timeout: 121 seconds]
17:49 d4de [olorin@687AAB.418D22.DF8670.FB17E8] has joined #code
17:56 d4de [olorin@687AAB.418D22.DF8670.FB17E8] has quit [Ping timeout: 121 seconds]
18:34 Typh|offline is now known as Typherix
18:57 Derakon [Derakon@Nightstar-a3b183ae.ca.comcast.net] has quit [Ping timeout: 121 seconds]
19:40 Kindamoody|out is now known as Kindamoody
19:50 * ToxicFrog learns about Swearjure, looks on in horror and/or awe
19:51
<@McMartin>
?
19:52
<@Tamber>
That is horrific.
19:52
<@Tamber>
http://hypirion.com/musings/swearjure , presumably
19:53
< ErikMesoy>
someone has Copious Spare Time
19:54
< ErikMesoy>
err, Free Time
19:55
<&ToxicFrog>
McMartin: Tamber has it.
20:05
<&ToxicFrog>
The linter objects to me using map/filter/lambda rather than list comprehensions.
20:05
<&ToxicFrog>
All of my hate.
20:06
<@McMartin>
Python?
20:08
<&ToxicFrog>
Yes.
20:15
< Syka>
ToxicFrog: there is an easy syka solution to this
20:15 * Syka holds up her pylint.conf that disables eight warnings :D
20:16
< Syka>
"Too many public methods!" fuck you, i'll have all the methods, I want *adds R0904 to the list*
20:16
<&ToxicFrog>
Oh, this isn't pylint. It is gpylint, and its compliance is enforced by nuclear failsafes^W^W the version control server.
20:20 Turaiel is now known as Turaiel[Offline]
20:41 Derakon [chriswei@Nightstar-a3b183ae.ca.comcast.net] has joined #code
20:41 mode/#code [+ao Derakon Derakon] by ChanServ
20:41 * Derakon ponders game serialization for Pyrel.
20:42
<&Derakon>
Am I missing anything, or am I basically completely boned if any of my state takes the form of lambda function pointers?
20:43
<&Derakon>
(I have entities that basically count down until 0 and then call a function; sometimes that function is a lambda)
20:44
<&ToxicFrog>
Are python functions not serializeable?
20:45
<&Derakon>
A quick google suggests you can serialize the bytecode and reconstruct it, but the main thing is the lambda's context.
20:45
<&Derakon>
In extreme cases this could amount to a single lambda reconstructing the entire game state.
20:46
<&Derakon>
What I wanted to do initially was to write [de]serialization functions for all Things (in-game entities) and Containers (aggregations of Things), encode the relationships between the two in the savefile, and reconstruct everything back up on load.
20:47
<&Derakon>
But that doesn't handle lambdas.
20:47
<&Derakon>
(I think I can make it handle ordinary function references though)
20:49
<&Derakon>
I can just forbid lambdas in anything that needs to be serialized, of course, but they're so handy. ;_;
20:49
<&Derakon>
53 lambdas in the codebase currently.
20:49
<&ToxicFrog>
I thought python had an existing lib for serializing All The Things.
20:49
<@McMartin>
Ripping explicit function pointers out of my APIs was a major thing I had to do for Monocle.
20:50
<&Derakon>
TF: mm, I admit I haven't deeply investigated Python's serializers.
20:50
<&Derakon>
Ideally I would like a savefile that's relatively legible.
20:51
<&Derakon>
That may be being greedy though.
20:52 Kindamoody is now known as Kindamoody[zZz]
20:55
<&Derakon>
There are also some security issues with blindly using the pickle module for [de]serialization -- create a custom malicious object that, in its serialize function, does something nasty, and stick it into the pickled file; voila, when loaded, the file is nasty.
20:55
<&Derakon>
So there's good reasons to want to have a more formal save/load procedure.
20:56
<&Derakon>
Just like I don't store game resource data in Python files.
21:29 Typherix [Typherix@Nightstar-7dc8031d.mi.comcast.net] has quit [[NS] Quit: ZNC - http://znc.in]
21:31 Turaiel[Offline] [Brandon@Nightstar-7dc8031d.mi.comcast.net] has quit [Connection reset by peer]
21:32 Typherix [Typherix@Nightstar-7dc8031d.mi.comcast.net] has joined #code
21:34 Turaiel[Offline] [Brandon@Nightstar-7dc8031d.mi.comcast.net] has joined #code
21:40 Derakon [chriswei@Nightstar-a3b183ae.ca.comcast.net] has quit [Ping timeout: 121 seconds]
21:43 Derakon [Derakon@Nightstar-a3b183ae.ca.comcast.net] has joined #code
21:43 mode/#code [+ao Derakon Derakon] by ChanServ
21:57
<@McMartin>
Oh, MS
21:57 Derakon_ [chriswei@Nightstar-a3b183ae.ca.comcast.net] has joined #code
21:57
<@McMartin>
waitformultipleobjectsex
21:58
<@McMartin>
Someone didn't think that name through carefully enough
21:58
<@froztbyte>
hahaha
21:58
<@froztbyte>
nice
22:02 Derakon__ [chriswei@Nightstar-a3b183ae.ca.comcast.net] has joined #code
22:05 Derakon_ [chriswei@Nightstar-a3b183ae.ca.comcast.net] has quit [Ping timeout: 121 seconds]
22:05 Derakon [Derakon@Nightstar-a3b183ae.ca.comcast.net] has quit [Ping timeout: 121 seconds]
22:06 Derakon [Derakon@Nightstar-a3b183ae.ca.comcast.net] has joined #code
22:06 mode/#code [+ao Derakon Derakon] by ChanServ
23:07 ErikMesoy is now known as ErikMesoy|sleep
23:17 Derakon_ [chriswei@Nightstar-a3b183ae.ca.comcast.net] has joined #code
23:20 Derakon__ [chriswei@Nightstar-a3b183ae.ca.comcast.net] has quit [Ping timeout: 121 seconds]
23:20 Derakon [Derakon@Nightstar-a3b183ae.ca.comcast.net] has quit [Ping timeout: 121 seconds]
23:23 Derakon [Derakon@Nightstar-a3b183ae.ca.comcast.net] has joined #code
23:23 mode/#code [+ao Derakon Derakon] by ChanServ
23:26 VirusJTG [VirusJTG@Nightstar-09c31e7a.sta.comporium.net] has joined #code
23:33
<@McMartin>
"Note: This function is unreliable and should not be used."
23:39
<@celticminstrel>
How many times it is used? :P
23:45
<@McMartin>
In this code, zero
23:57 Turaiel[Offline] is now known as Turaiel
--- Log closed Thu Jun 13 00:00:07 2013
code logs -> 2013 -> Wed, 12 Jun 2013< code.20130611.log - code.20130613.log >

[ Latest log file ]