IRC Log Viewer » #firebreath » 2011-01-01

IRC Nick Time (GMT-7) Message
taxilian 00:01 Happy New Year everyone!
FB_GitHubBot 00:01 FireBreath: firebreath-1.4 Richard Bateman * 617846e (2 files in 2 dirs): Added experimental support for optional parameters ... -
kylehuff 01:01 Happy New Year!
taxilian 08:01 man; I feel like I've done nothing but lounge around *all year*
kylehuff 09:01 hey, I've so far slept all year
taxilian 09:01 well, at least I'm in good company, then
hows the plugin going?
kylehuff 09:01 it hasn't gone much at all the last few weeks
taxilian 09:01 hehe. I've noticed that you've more been dropping in now and again to let us know you're still around than actually working on anything here =] work getting crazy, or just taking well-needed time off?
kylehuff 09:01 work keeps getting in the way. (not that I would complain about being employed in this decade)
taxilian 09:01 hehe. yeah, employment is nice
I don't actually know if I'll be employed in March or not
or rather, I don't know if I'll be employed at the same place
kylehuff 09:01 I don't care much for the employment, just the paycheck, really..
taxilian 10:01 lol
I have been very fortunate in my work; I've managed to find work that I enjoy
it is something I am very grateful for
kylehuff 10:01 I unfortunately, allowed myself to get burned out.
taxilian 10:01 that's always hard
kylehuff 10:01 maybe scorched out is a better word.. lol
taxilian 10:01 do anything fun for new years eve?
kylehuff 10:01 just watch through the window with my wife and kids.. so, more special than fun, really..
taxilian 10:01 spending time with the family sounds like both to me
it will be fun when my kids are old enough to participate in any of these holidays
kylehuff 10:01 heh, careful there.. they grow too damn fast already...
taxilian 10:01 oh, don't get me wrong… I'm enjoying now as well =]
I still don't feel like I'm old enough to have kids, but I don't feel anywhere near 27 either :-P (old man me and all, right? =])
kylehuff 10:01 lol.. I hate that..
I still view myself as a teenager.. which is odd, because I thought of myself as adult when I was teenager mostly.. lol
taxilian 10:01 lol. I think I'd be a lot better teenager now than I was then… :-P
kylehuff 10:01 yeah, I hear you there...
taxilian 10:01 on an unrelated side note… I hate multiple inheritance and related problems
grr. this is really, really annoying… I'm actually in a situation where I need to use multiple inheritance, but I also need to use boost::enable_shared_from_this on both base classes. I dont' think you can actually do that… pretty sure you can't, in fact
kylehuff 10:01 well, it should come as a comfort that I have absolutely no idea what you are talking, which makes you the most competent party involved in that matter at them moment..
taxilian 10:01 lol. no, no, that scares me more :-P I definitely don't feel like I should be the most competent party in here, and it really scares me sometimes how much everyone expects me to know the right answers to everything :-P
and yet, it also annoys me when I suggest something and people throw the idea out, so I guess I'm just a walking contradiction =]
or at least wildly inconsistent
kylehuff 10:01 yeah, I despise when people do that... I try not to commit that retched sin.
taxilian 10:01 hehe. the funniest thing is that I can totally understand their perspective; still drives me crazy sometimes, though =]
every time someone complains that "I put the build directory in source control because we don't want to put cmake on the build server, and…" or something similar… I just want to hit my head against the wall
kylehuff 10:01 lol
taxilian 10:01 and yet I start looking at Google Omaha, which uses scons and a convoluted build setup, and my first thought is "I wonder if I could just convert this to CMake...
our own ideas are invariably better than anyone elses, right? =]
kylehuff 10:01 well, I quite certain my ideas are. =c )
taxilian 10:01 =]
kylehuff 10:01 oh yeah, I saw the 1.4 alpha announcement. is the issue with the linux plugin binary still present where it links against gtk and it's depends even though you are using the no gui flag?
taxilian 10:01 yeah, I'm afraid so; I haven't had time to address it
I plan to fix that before the release, though
if you want to add an issue that'll make sure I don't forget
kylehuff 10:01 ok.. no worries.. I still have 15 other todo items before I am ready for the alpha release of the extension
taxilian 10:01 =]
it's pretty cool, though; I've been trying to update one of the examples (indexeddb) to use 1.4 (it's still pre-1.2) and I found some cool boost tricks I didn't know before. mainly, boost::optional
kylehuff 10:01 oh yeah? what does optional do?
taxilian 10:01 a tiny bit of tweaking to my new variant code and you can now have optional parameters in your JSAPI methods
kylehuff 10:01 ahh
taxilian 10:01 hmm
or at least, if what is sent in doesn't match it will let it through without an error
come to think of it I might need to do a little more tweaking to have complete optional support
anyway, I have the building blocks now
I really like the new variant and conversion stuff
kylehuff 10:01 I don't think I am using any that actually.. I think all my objects are string and a few bool. (granted, I am more than likely doing it wrong...)
taxilian 10:01 lol
what is a keylist?
kylehuff 10:01 a list of GPG/PGP Public Keys
taxilian 10:01 ok.. why return it as a single string instead of as an array of strings?
kylehuff 10:01 my only requirement was being able to accept the string in as return value and parse it as JSON
taxilian 10:01 json? I'm confused… why would you want it to be JSON?
seems like it would be a lot easier to just return an object or an array...
kylehuff 10:01 I use JSON.parse to convert it to dictionary (safely, without calling exec) and then I can select individual keys out of the object
taxilian 10:01 you could just return it as a dictionary
no need for json
FB::VariantMap ret; ret["somekey"] = "somevalue";
return ret
kylehuff 10:01 that would probably save a lot of "string" conversion
taxilian 10:01 probably =]
kylehuff 10:01 at least in a VM, it is really slow on windows to build the keylist
taxilian 10:01 firebreath has full support for objects and arrays (a dictionary is always an object in javascript)
well, it's hard to say for certain if that would be affected by this
but it's just silly to return json when you could return a normal JS object =]
this might help, but probably wouldn't be a huge difference
kylehuff 10:01 agreed, I think it would at least make it more readable.. that is some ugly code..
taxilian 10:01 actually, nevermind; yeah, that'd be a lot faster, since you're building the json string yourself
yeah. FB::VariantMap status; status["considered"] = result->considered; etc
don't worry about converting to "1" or "0"; bool is fine
you're trying too hard, my friend =]
dare to be lazy
kylehuff 10:01 lol
well, I had started out without firebreath - I sat down to see if I could interact with libgpgme and make it do what I needed (it is kind of a strange library, and I am also not a programmer), so I had all of that creating and returing JSON'ish strings before I even downloaded firebreath.
I never dreamed I would be able to return real objects from the plugin
taxilian 10:01 lol. well, you can =]
if it were me, also, I would probably make gpgGenKey accept a dict/object and a callback, then call the callback instead of an event
events are good, but this is more of an asynchronous call, and my personal preference has always been that an asynchronous call should accept a callback function as its last parameter
hmm. also change progress_cb so that instead of passing a const char* what you use an ENUM or something; that'll get called far too often to do a string compare
anyway, those are some suggestions; on the whole, though, it's not half as bad as you act =] those are really nitpicky things
looks fine to me, for the most part
kylehuff 10:01 with progress_cb I am not sure if I can change the parameters, it is a method of libgpgme
taxilian 10:01 oh, also a minor performance tip; in the spirit of "avoid premateur pessimization". Any time you accept a std::string in your functions, unless for some reason you need to change the input value make it a const string& instead of just a string; this keeps the compiler from creating an extra copy of the string
you gotta be kidding me...
okay =]
kylehuff 10:01 yeah, it is kind of stupid.. like I said, libgpgme is an odd library..
while it is doing it the work, it reports back, and I can't control how it does, and it fails if I don't pass the specific data types..
taxilian 10:01 also, in gpgauth.cpp line 1477 where you embed the PGP block? doing all that concatenation can be expensive; it'd be better to put it all in one "line", where you seperate each line with \
fair enough
string text = "-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n" \
"Version: GnuPG v1.4.6 (GNU/Linux)\r\n"\
that way it puts it all in at the same time instead of continually having to allocate more memory
again, probably not a big deal, just mentioning it
oh, that's a test
yeah, that definitely doesn't matter
kylehuff 10:01 oh, yeah, that will (thank God) go away, that was only for CLI testing.. once I move to VariantMap, I probably won't be using this from the CLI anymore
taxilian 10:01 :-P
kylehuff 10:01 lol. yeah, just for testing/debug
taxilian 11:01 =] sorry, hope that's not annoying; it just always bugs me to do something in a wrong or unoptimal way for a long time and then find out that someone could have saved me hours/days of trouble with a few simple suggestions, so I tend to automatically do that for others when I can =]
and there is a lot to know about C++ that isn't intuitive… until you know it already, at least
kylehuff 11:01 No, not at all! I really *really* appreciate your tips.. if I seem unresponsive, it is because I am adding things to my todo! =c )
taxilian 11:01 hehe. no problem =]
besides, I expect this to become an example of using FireBreath, so it's in my interest to have it written well, right? ;-)
kylehuff 11:01 lol.. true
so, with the gpgGenKey progress callback (where I am currently using FireEvent), is there an example of accepting a JS method as a parameter to one of my plugin methods?
(most of what FireBreath does is black magic to me.._
taxilian 11:01 it's pretty easy; just have the param be const FB::JSObjectPtr&
hmm; if that callback is beyond your control, though, that could be trickier
hmm. is there any way of uniquely identifying the callback request?
so I don't see anything here to prevent more than one genkey call at a time
but if there are more than one, how do you tell them apart?
kylehuff 11:01 no, currently there is no differentiation, just, the extension knows if a genkey is in progress, and doesn't allow the invocation of another (since that would use up all of the entropy)
taxilian 11:01 lol. wait… how exactly do you "use up" entropy? =]
"gee, thank goodness.. we're out of entropy, so things should be stable now"
kylehuff 11:01 well, the system returns semi-random data to the library when asked, and then marks it as consumed. the system requires "random activity" to generate more random data. (HDD use, input events, IRQ events, etc).. anyway, that is slow to build
taxilian 11:01 makes sense, I suppose
this is purely stylistic, so it's up to you how you do it; the current event approach works. I personally would probably pass in two callbacks, one for status and one for completion (or maybe even just one callback but pass status as one of the parameters.
you can just have a FB::JSObjectPtr in your API class that keeps it until time to call, then call .reset() on the shared_ptr to release it
if you choose to do it that way
one way or another, I would add a flag to detect if it's currently processing a key that you can check from javascript (isBusy or something) and throw an exception if it's called a second time before completed
maybe even have an abort method? I dunno. that's up to you =] I'm just brainstorming
since I'm sure you don't have enough to do yet =]
kylehuff 11:01 lol
this is the definition of the progress_cb (from the gpg library) static void progress_cb (void *hook, const char *what, int type, int current, int total)
the first paramter is the only paramter that doesn't get generated from libgpgme
all of the others come from the library, when I call the gpg libraries genKey method, it allows me to specify a single callback
taxilian 11:01 yeah, that's fairly standardish; I just can't believe they use a const char to tell you what it is
I just thought it was your callback
kylehuff 11:01 yeah, and that "what" parameter is just the "what" the genkey method is doing.. it has like, 3 possible values. "primegen" "waiting" and "complete" lol.. it is almost useless.
taxilian 11:01 yeah
a simple enum would be much more efficient
'course, if you know there are only 3 possible values, you could just check the first character
again, this is kinda premature optimization, but still =]
kylehuff 11:01 so, that is why I was passing a pointer to "self", so I can figure out what the possible status is and call whichever method I want from there. (current, FireEvent)
well, maybe premature, but I think it is good having someone who knows what they are talking about to critique it..
taxilian 11:01 would you like to borrow a C++ book on best practices? I don't know if you're planning to do enough C++ that it matters, but it's a great book
kylehuff 11:01 I would love that, I hope to do a lot of C/C++. I like it for some reason. however, I probably won't be able to do much of it - if everything goes as planned or close to it, I will be leaving for the military.
taxilian 11:01 which branch and when?
kylehuff 11:01 about 4-5 months
the branch, I haven't worked out yet.. it will either be Army or Marines
taxilian 11:01 cool. What led to that decision?
kylehuff 11:01 a strong conviction.
taxilian 11:01 then it sounds like you'll be an asset to whichever branch you join
taxilian 15:01 kylehuff: lol. I just realized that we've been talking in PM; didn't even realize
was thinking I was in the channel
kylehuff 15:01 haha.. I didn't notice either
so, I moved all the code from the methods in the included cpp files into the PluginAPI file, but I have an oddity that maybe you can point to the cause
taxilian 15:01 okay;
kylehuff 15:01 at line 39 of the link below, I have defined 3 methods, the first with parameters, and the other two without. the other two just call the first with some specified parameters, getPrivateKeyList calls getKeyList("", 1) and getPublicKeyList calls getKeylist("", 0), however, in the plugin, getPrivateKeyList() does exactly what I expect, but getPublicKeyList() only works if I pass it parameters...
taxilian 15:01
kylehuff 15:01 lol
got it
I forgot to change that one..
thanks; I was so busy questioning if I was doing the whole definition of the methods correctly that I forgot about how the methods get registered...
yay, it works.. now I can change all of that hideous string crap into objects..
jshanab 15:01 Where are the logs written when logging is enabled on a plugin
taxilian 15:01 nowhere by default, I'm afriad
except on windows
where they go to the debug console
that's one of the things I still need to resolve — a good way to specify where to log to
jshanab 15:01 I hate the widows event viewer, I write my logs to /var/log/programname or c:/var/log/programname :-) if windows can have a etc/hosts file, why not
taxilian 15:01 hehe
well, you can specify it
it's not not a "good" way
jshanab 15:01 Ask during FbGen and store it in PluginConfig.cmake
taxilian 15:01 look at src/PluginAuto/log4cplus/log4cplus.cpp
that is certainly one option; the problem is that we really need more control than that
it probably needs to be at runtime, which means a new FactoryBase function
but I want to write some utilities to help find the path
find Appdata, etc
jshanab 15:01 OH, like deployment time choices. Sounds like we will need some kind of parameter that can be manipulated thru the browser. like the about or windows extension prperties
exuseme, moving to 2nd monitor...
jshanab_ 15:01 remote desktop sucks, double remote desktop is sucks^2
taxilian 15:01 lol
yeah; it's not really that big of a problem, it's just not one I've taken the time to solve yet
jshanab_ 15:01 I added a whole bunch to my plugin and it builds and installs, but now it doesn't load. If I attach to firefox, i'll see the breaks point flash and then nothing. All javascript then are an error.
So I am trying to find the earliest entry point to place the breakpoint on
taxilian 15:01 on firefox? the earliest point — absolute earliest — is NP_Initialize
in np_winmain.cpp in your plugin project
jshanab_ 15:01 thanks
taxilian 15:01 the next earliest is in NpapiPluginModule :: npp_new
that's where it creates the instance
the first is module load
jshanab_ 15:01 because of some added libraries, I am guessing it is failing on that load
trying to use SDL instead of GDI for the video frames
HUmm, something seriously wrong, it flashes breakpoint and exits on NP_Initialize
taxilian 15:01 what version of firefox?
if you've added dynamic link libs, that could do it
jshanab_ 15:01 3.6 something, but same one I have been using
taxilian 15:01 hmm
that's really odd
make sure you completely quit the browser and the attach before you load the page the first time
but you probably know that
jshanab_ 15:01 I am thinking something didn't link or , oh, hey maybe I do need to exit all browsers, i then d to keep a lot open
taxilian 15:01 could be, I suppose
jshanab_ 16:01 I have found that VS2010 has a few bugs where it gets confused. You end up editing and recompiling and rebuilding and eventually you shut it down and reopen and suddenly there are files "changed" yuo re-compile and it works. like it gets 2 copies of a file open and gets confused as to which is valid. Wasted 4 hours on that the other night
kylehuff 16:01 so, if I have an FB::VariantMap my_map; can I add other maps/lists to that map after I have created it? or would I need to create the map/list that will be children and add them as pointer right after creating the parent map/list? (not entirely sure if my question makes sense)
taxilian 16:01 jshanab_: yeah, sometimes the best thing to do is delete the build dir, prep again, and reload the project
kylehuff: yes
you can put anything you want in it; it's a map of variants =]
you can build a map that has arrays of maps with arrays and JSAPI objects
disclaimer: FireBreath tries hard to make sure you *can* do about anything; just because you can doesn't mean you should.
jshanab_ 16:01 VS2010 "Not Responding" @#[email protected] Microshaft. This happens 3-4 times a day. grrr I am done for a saturday
taxilian 16:01 hehe
jshanab_ 16:01 In desperation I ran our archiver in Wine on ubuntu, it is still running
kylehuff 16:01 taxilian: I guess my question was more regarding the fact that I am iterating through an object, and I when I create the instance for my_map, I don't know what it's children will be yet, but they will also be maps.
taxilian 16:01 this is an output type, right?
jshanab_ 16:01 taxilian. VS2010 does this on it's own, even in non-firebreath projects, it especially unstable across remote desktop
kylehuff 16:01 taxilian: not sure what you mean.. it is an object I will be returning, yes..
taxilian 16:01 then just create the FB::VariantMap
it's an alias for std::map<std::string, FB::variant>
since the value type is a variant, you can put anything you want in for values, including other FB::VariantMap or FB::VariantLists
anything supported
don't need to know that when you create it, because it's a variant
it's almost like dyanmic typing in c++; cool, eh?
kylehuff 16:01 hmm, okay.. I think I get it.. thanks!
taxilian 16:01 btw, guys, feel free to help me with the new wiki page I've started:
don't worry about accidently putting something inaccurate; I'll keep an eye on it and fix it if you do =]
kylehuff 16:01 taxilian: I was wrong; I totally don't get it.. =c ) this fictional code might help illustrate where I am confused about setting the values;
taxilian 16:01 hang on
kylehuff 16:01 when you have time mate; I don't mean to monopolize your time. (I'm on the phone since I asked anyway.)
taxilian 16:01
you create the highest level (furthest right) object first, then add it
kylehuff 16:01 taxilian: okay, perfect. that is I was failing to ask before.. thank you..
kylehuff 17:01 this FB::VariantMap is awesome! I no longer have to worry about a field having characters that would otherwise break JSON.parse()..
taxilian 21:01 kylehuff: reading a bit more I suspect you haven't pushed your latest changes
so I'll wait 'til you do to look over it more
kylehuff 21:01 taxilian: that is correct; I am about to commit the change to using VariantMap
taxilian 21:01 cool
I have to admit; VariantMap and VariantList support is one of my favorite features
kylehuff 22:01 yeah, I love returning an object instead of a string to parse..
taxilian 22:01 and it goes both ways; you can pass in objects and arrays. it's just… beautiful =]
kylehuff 22:01 really? awesome..
it could be just me, but it seems returning the keylist is actually slower than it was before...
taxilian 22:01 hmm. it could be slightly slower; if it's a complex structure then it has to create all the objects to populate them
let's see; are you still using FireEvent?
kylehuff 22:01 for the moment, yes.. I didn't touch any of the key generation or singing methods.. the big thing I wanted to commit was the return of the keylist..
taxilian 22:01 ok; you could try calling FireEvent on the main thread instead of from the secondary thread
that may sound funny, since it does make the call asynchronous
but it doesn't (yet) batch the whole thing to an asynchronous call
I should probably change that
so it's probably using cross-thread marshalling to populate the object
kylehuff 22:01 I hope to get to playing around with that tomorrow. I also need to fix all of my error values, they are still JSON strings..
taxilian 22:01 try using host->ScheduleOnMainThread(boost::bind(shared_ptr(), &MyObjectAPI::FireEvent, event, FB::variant_list_of()..)
I'll look into making that whole process asynchronous; it should be anyway
just isn't yet
taxilian 23:01 kylehuff: If I were you, insrtead of passing 1 : 0 for things like expired, revoked, etc I would just use true : false
but that's me
kylehuff 23:01 hmm, yeah, I changed some things to use bool since my last push, but I hadn't thought about those. I will change those over too! (I was stuck using 1:0 because otherwise I would have had to use a string "true" : "false", since I was using the JSON parser.)
taxilian 23:01 fair enough
no longer a problem, though ;-)
I'm finally making some progress on this plugin
well, I've been making progress
but it has been mind-numbingly slow
I think I must be crazy to even be finishing it
kylehuff 23:01 which plugin is that?
taxilian 23:01
that's just my fork of it
see the google code page for the real one
it was written to use FireBreath 1.1, I think
and it uses more JSAPI objects than any other plugin I've heard of — whether on FireBreath or not
kylehuff 23:01 lol