IRC Log Viewer » #firebreath » 2012-01-09

IRC Nick Time (GMT-7) Message
Jake__ 00:01 hey guys.. getting desperate here... how can i implement file handling in FireBreath?
FireBreathBot 03:01 JIRA issue issue created by [email protected]
reichi 04:01 hi
has anyone been using the JSFakeArray lately?
the [] operator stuff doesn't seem to work here (with webkit as engine)
Jake__ 08:01 can anybody help me with implementing file handling in firebreath???
i've declared it in the header file and defined it in the .cpp file.... but to no avail.. when i tested it it returned that it is undefined.... any idea how to solve this?
Jake__ 08:01 is there anyone here??
taxilian 09:01 Jake__: good morning
you still haven't actually specified what your problem is
Jake__ 09:01 in the header file i declared "void writeFile();"
i registered the method in the .cpp file
taxilian 09:01 okay; first thing to understand is that there is nothing firebreath specific about this problem
it's just C++
Jake__ 09:01 and defined the function with "void PluginTestAPI::writeFile(){ ofstream outFile("frustrate.txt"); }"
i think so.. yeah.... :D
taxilian 09:01 .pb
FireBreathBot 09:01 When you need to share code, logs, or anything else longer than a couple of lines, use a pastebin.,, and are all good options
taxilian 09:01 give me some code that I can look at, as well as the exact message you're getting from the compiler or linker
Jake__ 09:01 i tested it in firefox and used firebug.... it returned that the function is undefined...
taxilian 09:01 oh
did you call registerMethod for that function?
Jake__ 09:01 yep
taxilian 09:01 show me the registerMethod call
Jake__ 09:01
taxilian 09:01 can you call other methods or access properties on the plugin?
Jake__ 09:01 yup
i actually have 3 other methods... a simple subtract, add, and average method
they work fine
taxilian 09:01 I don't know. if you give me the full files I might be able to spot something
not seeing anything in the small snippets that suggest the problem
Jake__ 09:01 what other files should be touched for this sort of situation?
by the way sir... i'm just curious... am i doing it right when everytime i change something to the code i'd have to delete the entire directory and run the prep script and build it again???
taxilian 09:01 no, you shouldn't have to rerun the prep script unless you add or remove files
and you don't usually need to delete the build directory unless a lot of major things have changed
the only files you should need to touch to add a method to your JSAPI class is the .cpp and .h files for that one object
Jake__ 09:01 so... how should i see my changes in the plugin?? should i build it again?
taxilian 09:01 yes, building it again would be a very good idea
Jake__ 09:01 and sir... did you see nothing wrong with the code?
taxilian 09:01 just like any other project
not so far
but I've only seen very small pieces
did you restart the browser, btw?
Jake__ 09:01 yep
taxilian 09:01 dunno, then
nothing obvious
in the code you've shown me so far
Jake__ 09:01 :(
oh... btw sir... when i build the project again.... it always generates an error... saying cannot open the dll
taxilian 09:01 that's because the browser is still open and using the file
Jake__ 09:01 that's why i always delete the build directory and then run the prep script, edit and build again..
any advice on how to solve this sir? i'm really frustrated... :( please help me
taxilian 09:01 close the browser entirely
then build
without deleting the build dir
then try it again
that's a good place to start
Jake__ 09:01 oh... no not that sir.. about my problem in file handling... :( i've been up this for 2 days straight.... hardly getting any sleep... and i still have classes at day... :(
taxilian 09:01 that's what I was talking about
the first step is to verify that you are actually using the latest version of the DLL
which I doubt
Jake__ 09:01 still undefined... :(
by the way sir... which directory should the file be seen?
taxilian 09:01 I don't understand the question
so you closed the browser entirely
you did a build on the solution
and it all succeeded?
Jake__ 09:01 nope... it didn't ... i called the function again with firebug.. .still it returned undefined
just plainly undefined
reichi 09:01 testing something that didn't actuallyb uild is pretty useless, isn't it?
you want to: build without errors, even better without warnings
copy the newly built .dll in the directory for your browser's plugins
and test it
it think it is very uncommon that files in your build-directory are being held open by something and cannot be overwritten because of that
and that should be the very first issue you resolve
and when you copy/install the dll into the browser's plugin dir it is always a good idea to double-check the creation date of the file
if it doesn't pretty much match the time your build finished, you build didn't work as you may have expected it to
your build
Jake__ 09:01 i think the issue is not that.... all the other methods worked when this simple write file doesn't
reichi 09:01 you think
but you don't know
you don't know at all why it is not working, right?
so why not start where you obviously do have errors
that are not supposed to be there
and mmh
is the browser really allowed to just write a file?
via a npapi plugin?
taxilian 09:01 Jake__: my question was did the *build* succeed
not did the js call succeed
we already established that that didn't work
Jake__ 09:01 yep.. the build succeeded
taxilian 09:01 reichi: yes, an NPAPI plugin can write files with the same permissions that the browser has
which generally means the same permissions that a user has
reichi 09:01 somehow scray
scary even
taxilian 09:01 though in IE you'd be in protected mode so you're more restricted
that's why NPAPI plugins are a security risk
reichi 09:01 especially when looking at the fact, that most browser can load new plugin at runtime
without further notice
Jake__ 09:01 hooooohh... this is really frustrating
reichi 09:01 simpel questions
do you instantiate the correct <object> element?
do you have a single or a multi-mimetype plugin?
if it is multi-mime is you Factory.cpp correct?
if not, is the mime-type in your <object> tag correct?
taxilian 09:01 Jake__: still waiting to find out if you have actually been able to completely build the plugin
Jake__ 09:01 oh.. i'm sorry bout that.. yes... i've completely built the plugin
taxilian 09:01 and the build succeeded? and you're 100% certain that DLL is the one that is loading?
Jake__ 09:01 @reichi i'm using the test page(html) generated by firebreath
taxilian 09:01 be back in a bit; I'm on the phone
Jake__ 09:01 absolutely certain
Jake__ 09:01 reichi: have you already experience writing files using NPAPI plugins?
taxilian 09:01 Jake__: there is nothing specific to NPAPI plugins in what you are doing as far as writing files
reichi 10:01 Jake__: I just started but I'm writing a bigger one atm
and just didn't experience what you describe
i think you just miss something
but with 4 lines of code it's hard to determine what it actually is
Jake__ 10:01 wew....... hooooh..... how about included headers?
i included iostream and fstream libraries
reichi 10:01 wouldn't compile if there's any problem about them
Jake__ 10:01 oh yeah... hahaha.. good point
linearray 10:01 change one of the methods that work to something else
like: change echo to return "foo"
then see if the output changes when you call echo
Jake__ 10:01 linearray: ok i'll try that
linearray: did it...... the output changed...... i tested my writeFile method again but to no avail.. :9
taxilian 10:01 Jake__: post a gist or something with the full code in your API.h and .cpp
Jake__ 10:01
the first one is for the header and the second link is for the .cpp
linearray 10:01 I just tried what you do
and yes, I get "undefined"
because it's a void function
taxilian 10:01 oh… duh. sorry, I have a lot on my mind
linearray 10:01 when you return something you get that instead... is this what you mean?
taxilian 10:01 I probably should have caught that
I thought he meant that the value of the function was undefined
not the result
Jake__ 10:01 hmmmmmmm..... so??? where was I wrong?
reichi 10:01 ouch
Jake__: nowhere
in means of code
a "void" function doesn't return anything
it jsut does "something"
taxilian 10:01 Jake__: your code is working exactly as it should
Jake__ 10:01 so where was the .txt file??? i don't see it in my local disk??
reichi 10:01 in your javscript code you could e.g. try something like console.log(plugin.functionCall)
or plugin.function
without braces
it should tell that the thing you logged is a function
actually, if it wasn't there you would have gotten a null pointer exception
null is not a function
Jake__ 10:01 reichi: not really getting what you're saying
reichi 10:01 void writeFile()
if you call console.log(plugin.writeFile)
you'll get undefined
because void is just "nothing"
sorry i am misstypting a lot today :/
if you call console.log(plugin.writeFile); instead
without the function braces ()
the console will tell you, that plugin.writeFile is a function
that's one way to actually determine if your code ist callable from javascript
2nd thing
if you function weren't actually there
you would not get undefined on calling "console.log(plugin.writeFile());"
but an exception telling you that "null/undefined is not a function"
that's simply how javascript works
if your function doesn't do what it is supposed to be
i recommend to add some logging
Jake__ 10:01 uh huh... i understand... thanks reichi... so... back to my concern... where is the text file?? if nothing is wrong with my code... where is my text file?
reichi 10:01 and use an absolute path for testing
taxilian 10:01 !findfile SystemHelpers.h
FireBreathBot 10:01 Found 1 matching file(s) in the master branch. First 1 are:
taxilian 10:01 you can use those functions to help find the path you want
reichi 10:01 i think the directory an npapi-plugin would write to without ANY path given
would be pretty browser-specific
not so say "random"
Jake__ 10:01 taxilian: haha.. i can use that if i know how to... hahahaha... sorry.... i'm that dumb
dreid 10:01 So, anyone given any thought to self-updating plugins?
linearray 10:01 plenty
dreid 10:01 So, anyone have a working implementation of self-updating plugins? ;)
taxilian 10:01 dreid: it's not that simple
I honestly recommend using Google Omaha
linearray 10:01 omaha+update engine is delayed gratification
pain now vs. pain later
taxilian 10:01 sorry, guys, I'm swamped at work today, so I'm not as much help as usual
Jake__ 10:01 hoooooooohhhh.... thanks a lot guys.... i just specified the path so to manipulate the file's path... it did generate it.. thanks a lot again
i just can't thank you enough guys.... wew... :D
hoooh... i'll be signing off now.... still have classes later..... thanks again guys.. :D bye
dreid 11:01 Ok, I"ll look into Omaha.