IRC Log Viewer » #firebreath » 2011-10-04

IRC Nick Time (GMT-7) Message
dougma 01:10 anyone tried printing plugins on safari mac... i'm giving up.
i think my problem is that i have a multi page document... plugins on the not-visible pages don't print!
linearray 02:10 what exactly are you trying to do?
dougma 02:10 layout a series of pages with a bunch pf plugins and have command-p printing them all
linearray 02:10 sounds painful
dougma 02:10 yes
i wouldn't recommend anyone do the same
when i say series of pages, it's one long html page which the browser breaks into multiple pages when it prints it out.
B_ 04:10 hi
Guest3009 04:10 hi
pgas 04:10 hi
Guest3009 04:10 i have created the dll using firebreath
my requirement is such that i also want to use this dll in windows application
i want to know how to acceess the method inside firebreath?
dougma 04:10 the same as accessing any method in any dll from any windows app?
pgas 04:10 dunno, but i'd say it's rather orthogonal to using firebreath since the way I see it the benefit of fb is to abstract the plugin interface
dougma 04:10 nicely put.
Guest3009 04:10 std::string PT009API::echoCustom(const std::string& msg); is the method
registerMethod("echoCustom", make_method(this, &PT009API::echoCustom)); is the registration
from separate windows application i am successfully loaded dll
using api LoadLibrary();
wat next?
to call the method?
dougma 04:10 you know firebreath is for web browser plugins right?
pgas 04:10 (like I said yesterday I would use a core lib with my application logic and use this lib from the .exe and from firebreath)
Guest3009 04:10 s. my requireement is that same dll i also want to use for windows application
using javascript i can succefully able to call the method like plugin().echoCustom(val);
but i want to know how to call from the windows application?
dougma 04:10 firebreath can't help you with that.
you're on your own
Guest3009 04:10 i gone the article "Enable hosting in native applications". i want to know what is exact means?
dougma 04:10 i don't know of that article
Guest3009 04:10 http://jira.firebreath.org/browse/FIREBREATH-44
FireBreathBot 04:10 FIREBREATH-44: Summary: Enable hosting in native applications.
FIREBREATH-44: Assigned To: richard
FIREBREATH-44: Priority: Major, Status: Resolved, http://jira.firebreath.org/browse/FIREBREATH-44
dougma 04:10 oh right, activex
you need to learn about COM and IDispatch interfaces
and OLE
that route is totally non-trivial
Guest3009 04:10 thats wat i am asking is there any direct access method from the firebreath, cuz that article statement is misleading
thats my point of view anyway
dougma 04:10 well... first you need to instantiate the plugin and then you need to invoke its methods via its IDispatch
but that's easier said than done.
Guest3009 04:10 may i know how to instantiate the plugin from a simple C program?
dougma 04:10 you need to learn about COM
Guest3009 04:10 thank you for the help buddy. I am going through firebreath, its really intresting. i have done some thing with ativex directly with lot of complex to feel, this one simpler to follow steps
dougma 04:10 i feel you're doing it the wrong way... but good luck
linearray 05:10 does anyone know why many people enter this channel with a nickname and then switch to a generic Guest* one?
hm, maybe because their original nickname is registered
taxilian 08:10 linearray: Yeah.. The original nick is registered, so it renames them. They generally are using the web interface and dont understand IRC
kylehuff 10:10 so, I have an FB::VariantMap that I am packing a bunch of values into (including other FB::VariantMap objects), and on return to the browser if the number of values is large/complex, it is really slow to return as an object (probably to be expected) -- am I using it wrong? should I be using something better suited for this?
taxilian 10:10 does that object change?
are you creating it from a different thread?
kylehuff 10:10 not a different thread, no, I don't call any thread specifically for that, and it just gets created and then returned on each call of the method
taxilian 10:10 can you reuse the same object?
kylehuff 10:10 not likely, because of the propensity for each item to be different on each call (trust relationship changes)
taxilian 10:10 hmm. well, you could try generating it as a JSON string
might be faster
fewer calls to the browser
this is Chrome only, no?
kylehuff 10:10 it rarely gets called more than once in normal usage, but, that one time, with 50 or more keys takes a several minutes.
well, yes, presently, however there that is only because I have not found a way to make it secure in firefox
taxilian 10:10 well, iether way, if you know that the browser will support JSON natively, you can probably create a string json doc and then use the browser's json parser to create the js object
that may very possibly be faster, since it only involves one call to the browser
kylehuff 10:10 okay, I know I can do it that way (I had it that way originally), I only moved to using the VariantMap for better security. (the idea was that if I am not parsing JSON strings returned from plugin, it is less of a chance that a malicious plugin could be injected into my extension and cause the extension to parse a malicious JSON string)
taxilian 10:10 well, you can call the browser JSON api from the plugin
I'm not actaully 100% sure that'll be faster, but it seems reasonable
kylehuff 10:10 oh, there is an idea... I am more comfortable with that if it is faster (and I can figure it out... lol)
kylehuff 12:10 so, rather than change from the usage of a VariantMap to JSON parsable string, would it be just as well to convert the VariantMap to a string? the bottle-neck was never the VariantMap itself, just seemed to be the whatever conversion takes place when returning it to the browser
taxilian 12:10 you could certainly try that
write a function to convert VariantMap to a JSON object and use jsoncpp to make a json string
kylehuff 12:10 I sat down to convert from a VariantMap to a string, and all this concatenating of strings adds a lot of tedious code that is easy to break with a small change. I will continue my current conversion to see how much of a performance boost I get using chrome to parse the JSON, but I was thinking about end result and how messy the string route is.
taxilian 12:10 well, like I said; use jsoncpp
that's safer anyway
kylehuff 12:10 looking at the docs for jsoncpp now
oh, cool, jsoncpp is already used in firebreath
taxilian 12:10 oh, yeah, btw, you can add_firebreath_library(jsoncpp)
kylehuff 12:10 is there something that FireBreath can't make easier for me?!
taxilian 12:10 probably not
kylehuff 12:10 that list would probably be shorter...
taxilian 12:10 just remembered that I wrote variantToJsonValue
so you can use that to convert your VariantMap to a Json::Value object
kylehuff 12:10 lol -- awsome..
taxilian 12:10 https://github.com/firebreath/FireBreath/blob/master/src/libs/jsoncpp/fbjson.cpp
kylehuff 12:10 you make this way too easy on me
taxilian 12:10 sorry, I'll try to do better in the future
kylehuff 12:10 hehe
manoj 13:10 hey ya'll ... i'm trying to build firebreath for the first time on my windows machine
and i get this error... i see that there is a post on the forum, but no replies... so thought of checking here
..\..\src\PluginCore\Win\SystemHelpersWin.cpp(20) : error C2065: 'REFKNOWNFOLDERID' : undeclared identifier
oh, i'm using vs2008
taxilian 13:10 manoj: update
that bug was fixed yesterday
manoj 13:10 oh cool... let me update
thanks :)
kylehuff 14:10 okay, this might be a stupid question, but I'm not clear on how to make the "Json" namespace available. I've added the library via "add_firebreath_library(jsoncpp)" in my PluginConfig.cmake, but do I also need to #include something or declare something? I looked at the FBTestPlugin example, but I don't see anything about the namespace for the library added (log4cplus)
taxilian 14:10 you'll need to #include something
if you look at https://github.com/firebreath/FireBreath/blob/master/src/libs/jsoncpp/CMakeLists.txt you can see the include directories that are added
relative to that, it looks like you need to include something like #include "json/json.h"
and/or #include "fbjson.h"
https://github.com/firebreath/FireBreath/blob/master/src/libs/jsoncpp/include/fbjson.h
kylehuff 14:10 oh, okay. that makes sense. my confusion was mostly that I didn't understand what "add_firebreath_library()" was actually doing
taxilian 14:10 it basically just includes the cmake project at src/libs/<library>
but you can add other library directories
so that it searches in those locations
kylehuff 14:10 okay, that is what I thought, but in the FBTestPlugin example I didn't see any mention of including log4cplus (which, I may have missed).
taxilian 14:10 that one is a special case
it's included, but by FireBreath itself
kylehuff 14:10 aahh... that explains it! =c ) I was using that as an example to try to figure out what was supposed to happen, which was a poor choice on my part.
taxilian 14:10 someone should probably make an example that uses another library
or even an example firebreath library
but I don't have time
kylehuff 14:10 once I figure out how this works, I will put that on my todo list; I'll just create an example that converts a VariantMap to JSON using jsoncpp
taxilian 14:10 cool
if you can find a reasonable way to benchmark the performance difference of the two methods of returning data, I'd be really interested
kylehuff 14:10 okay, I will try to come up with something
kylehuff 16:10 taxilian: phenomenally faster to serialize it using jsoncpp and use the browsers JSON.parse method. went from ~10 seconds for my test case to about 1.5 seconds
and that was using the Json::StyleWriter to convert the object; Json::FastWriter is probably even faster, if the name implies anything
taxilian 16:10 wow. what about if you're just returning a very small object? can you do that a bunch of times and see what it the diff is?
oh, yeah; no reason to use StyleWriter
I don't care if the json looks good or not =]
kylehuff 16:10 yeah, me too, I just didn't immediately notice the FastWriter class.
taxilian 16:10 I might have to write a function to quickly create a FB::JSObjectPtr from a FB::VariantMap using that method
I can't just do it automatically, because a. JSON isn't always available in the browser, and b. if you were returning other JSAPI objects in the VariantMap they wouldn't work
kylehuff 16:10 anyway, I will try doing a bunch of small objects, both just VariantMap and VariantMap objects converted to json and then parsed and see what the result is.
taxilian 16:10 cool
thanks
I appreciate you taking the time
a wiki page on using this method would be really cool too, if you have time =]
and maybe try some arrays
nir 16:10 hi taxilian, how can tell cmake to create a project that uses ATL?
kylehuff 16:10 granted, I have slightly more overhead in the way I am doing it, because I don't yet know how to call the browsers parse method from within my plugin, so I am doing JSON.parse(myplugin.myMethodThatReturnsJSON());
taxilian 16:10 oh, no need for that
I can tell you how
JSON will be a property of window
!find htmlLog
FireBreathBot 16:10 Found 1 possible matches. Displaying 1
/^void FB::BrowserHost::htmlLog(const std::string& str)$/ (f) found in src/ScriptingCore/BrowserHost.cpp: http://goo.gl/b94ag
taxilian 16:10 kylehuff: you can do it similar to this function: https://github.com/firebreath/FireBreath/blob/master/src/ScriptingCore/BrowserHost.cpp#L111
but instead of console.log it'd be JSON.parse
kylehuff 16:10 oh, wow. once again. too easy
taxilian 16:10 that's another thing that is poorly documented on the wiki; accessing javascript / the DOM
kylehuff 16:10 well, for the plugin example I will create that will illustrate "add_firebreath_library()", I will do it using jsoncpp so I can link to it in the wiki for an example of converting Variant* objects to JSON strings, I could also add in there a method that illustrates calling JS on the DOM and create a wiki entry to reference and explain it.
taxilian 16:10 cool
would certainly help
put it in its own github project and I'll pull it into github.com/firebreath
and give you access to update it
kylehuff 16:10 okay, will do.
nir_ 17:10 hi taxilian,
taxilian 17:10 hello
nir_ 17:10 i'm trying to cocreateinstance from a npapi dll
i have the tlb
but adding the #import directive in the source breaks the linker
taxilian 17:10 nir_: I really have no idea. that's completely outside of my expertise
manoj 17:10 hi there again... i'm trying to test whether a plugin install requires a browser restart or not
nir_ 17:10 is this possible? the project looks like it has been created by someone in the orbit zone of bill gates and linus...
manoj 17:10 i used the tip from stackoverflow, where i call navigators.plugins.refresh(false)
taxilian 17:10 manoj: I've installed plugins for years without restarting the browser
nir_: I never had to use the #import statement
manoj 17:10 oh, so i load the test page (from the firebreath project) first... and then install the plugin using the packaged msi
oh.. well, thats great to hear! :)
i'm obviously doing something wrong... i have this link on the page called refreshPlugins() which calls that javascript function
all it does is the navigators refresh
taxilian 17:10 manoj: what OS / browser?
manoj 17:10 should i be doing somethign more?
i tried firefox 7 and ie 8
taxilian 17:10 well, IE8 doesn't *have* a navigator.plugins
so you just have to try either new ActiveXObject(..) or actually put the object tag in
manoj 17:10 oh ... oops
taxilian 17:10 if you refresh the page on ff7 does it work?
or go to about:plugins?
manoj 17:10 if i refresh it works
taxilian 17:10 then you're probably doing something wrong
but I don't know what
unfortunately I'm about a week behind where I need to be at work right now, so I don't have a lot of time to help you troubleshoot it
manoj 17:10 okay, thanks for the help... i'll try to debug this :)
kylehuff 17:10 woot; it works, and it is a lot faster.
Execution time for return of VariantMap: 5688
Execution time for return of JSON.parse called with Invoke(): 727
taxilian 17:10 heh
interesting
wish I could think of a way to speed that up
good to know, though
thank you for checking that
please include that info on the wiki somewhere if you could so it isn't lost
kylehuff 17:10 Execution time for return of 100 small VariantMap objects: 4756
Execution time for return of 100 small objects parsed with JSON.parse: 2637
okay, like, in the "tips and tricks" section?
taxilian 17:10 maybe even its own page
Performance Considerations or something
possibly under the Interacting with Javascript section
and a link / mention in Tips and Tricks
kylehuff 17:10 okay, I will do that now, since it is a fairly simple work-around to describe