How come NPRuntime require xpt file? - mozilla

I am trying to make sense of whatever I learned about NPRuntime. Here is a example of NPRuntime plugin from from mozilla-central of NPRuntime plugin, which mentions following lines
// ==============================
145 // ! Scriptability related code !
146 // ==============================
147 //
148 // here the plugin is asked by Mozilla to tell if it is scriptable
149 // we should return a valid interface id and a pointer to
150 // nsScriptablePeer interface which we should have implemented
151 // and which should be defined in the corressponding *.xpt file
152 // in the bin/components folder
Now AFAIK NPRuntime desn't require to copy xpt file, xpt file is specific to XPCOM and NPRuntime does not use XPCOM. So what does above statement mean ?

That comment lies, both about xpt and the nsScriptablePeer, as you can see from the actual code. Please file a bug in Core:Plugins about this and mention it in a comment (bonus points for the patch!)

Related

Output other than .txt

I'm looking to build a simple program that will simply modify existing output files from an other program so I don't have to open the program and enter a bunch of data the long way. This program is very specific to my domain and has an extension named .wcc. However, when I change the extension of one of these output files to .txt, I get half gibberish :
ÿÿ WPointÿÿ WPolygonÿÿ  WQuadrilateralÿÿ  WMemberDataÿÿ
WLoadÿÿ WLStandardMembersÿÿ WLSavedDesignSettingsÿÿ WLSavedFormatSettingsÿÿ  WLSavedViewSettingsÿÿ WLSavedProjectSettingsÿÿ  WLSavedSettingsÿÿ  WLSavedLoadSettingsÿÿ WLSavedDefaultSettingsÿÿ WLineÿÿ WProductÿÿ WBeamDataÿÿ  WColumnDataÿÿ
WJoistDataÿÿ
WWallStudDataÿÿ WSupportingMemberDataÿÿ WSavedAnalysisSettingsÿÿ WSavedGravityDesignSettingsÿÿ WSavedPreferencesSettingsÿÿ WNotchÿÿ WIJoistÿÿ WFloorCWC37 ÀAE LumberS-P-F No.1/No.2 # À# lumwall.cww ÿÿÿÿ1.2.3.1.Mur_1_EX-D ÿÿÿÿÿÿ B Cÿÿ B C €? 4C 4C   Neige #F #F ÈC ÿÿÿ
WLStandardMembersÿÿ "
There are also musical notes and perpendicular signs which I can't copy paste here. I can sorta read the text, but still not enough to make modifications via txt file. What type of file could this be? Is it even possible to do what I'm trying to do? Thanks!
I am surprised that you are trying to open a .wcc file as a text file (it's contents - as you will see - don't lend themselves to being converted to such a file type); however, the attempt to open the file as a .txt file seems to be specific to your domain.
I noticed part of your question is as follows: "What type of file could this be?"
You are right in thinking that the .wcc file is a rather obscure file type - we don't think about that file type a lot (or are not conscious of it existing). A .wcc file is a WinCam 2000 Cache file that allows WinCam 2000 movies to be previewed in the slide browser - these were often generated by older WinCam 2000 screen recording and editing programs.
Again, the file extension is very rare these days (a Google search only returns ~700 results). But, it appears you have a program that is producing the file, which - as you are saying - "is quite specific to your domain". You may be out of luck with regard to opening them for modification purposes.
Supposedly, you can covert .wac files to .wav files, which are much more relevant to today's technology (and definitely alterable from code); however, without knowing the purpose of the file, e.g. what you are trying to do with the file domain-side, I can't say that this will suit your needs.
Also, the above comments are "correct": changing a file extension will not convert the file to the file extension type. Typically, converters - like a simple software - are needed to convert files.

Replacing WAV header

So here is what I've got:
The problem that I face requires me to take a specialized header from WAV1 , and put it as the header for WAV2, in order to make WAV2 work with the API that I'm using. However, whenever I try to replace the first 38 characters of WAV2 with the first 38 of WAV1, I get an error when I try to play the file, I get an error saying that it is not formatted properly. Both WAV1 and WAV2 play properly before the edit.
Do you guys have any idea on what I'm doing wrong?
Thanks so much for your help.
-Rhynorater.
Wav format is a standardised format (see https://ccrma.stanford.edu/courses/422/projects/WaveFormat/ for details about file format). I'm not sure what a "specialized" header is (perhaps you could clarify what your specialised header is?) as the format is standard - any variation would not be a wav file.
The first 38 bytes of a wav file are the header and should adhere to the standard. You cannot copy the header from one file and use it for another as the header contains information specific to the individual file (number of channels, sample rate, file length, etc).
If you both files playback normally (how are you testing this?) I'm not sure why the API you are using is not compatible (which API are you using?).

NLog:: adding source code line number to the log

I need source code line number to the log entry through NLog.
Please let me know alternate ways to do it.
<<Log entry>> Line 23
<<Log entry>> Line 391
P.S. - 23, 391 are the source code line numbers.
Thanks
You may use ${callsite:fileName=true} layout renderer - indicates whether to render the source file name and line number. Documentation.
Not sure but you should try this. Hope it will help :D
http://iosdevelopertips.com/cocoa/filename-and-line-number-with-nslog-part-ii.html
and I also found this
NSLog(#"current line: %d",__LINE__);
from this
How can I log the current line via NSLog in Cocoa / Objective C?
EDIT sry I dont know that u want C#
should try look at this
Do __LINE__ __FILE__ equivalents exist in C#?

GDB can not find line numbers

I am using GDB for debugging a Linux kernel module.
After loading the module, i use add-symbol-file to add module symbols.
When i use list command in GDB to find a symbol in module, it will find it for example:
(gdb) list __do_restart
122 * would provide type of error or success. In the case of early restart support from
123 * cr_mods a signal will be posted at appropriate time.
124 *
125 * NOTE: This type of restarting could be used for migrating parallel processes.
126 */
127 int __do_restart(void *data){
128 struct siginfo info;
129 struct object_stored_data *sd;
130 struct crmod_clients *clt = get_client(data);
131 memset(&info, 0, sizeof(struct siginfo));
(gdb) b __do_restart
Breakpoint 1 at 0xe081740e: file /home/amrzar/Workspace/common/commod.c, line 130.
I can even set a breakpoint for it. But after the first interrupt in execution when i use list it says:
(gdb) list __do_restart
No line number known for __do_restart
It simply lost symbols! Why? (I am sure about presence of debugging information in object file)
Thanks
I do not really know what causes this problem but once I had same trouble using add-symbol-file but adding -readnow option solved it for me!

Implementing basic file system

As a college project I need to implement a basic file system from within a file. So how do I go about this? What are the things that I would need to know? The requirements include having a daemon process in the background. Also the applications that use this system need to connect to the server using a Unix domain socket
The file system should have the following capabilities:
List files stored along with their sizes.
Create files
Allow changes to files
Delete files
Check this out if it can help.
http://www.geocities.ws/ravikiran_uvs/articles/rkfs.html
If you want to create a file system in user space FUSE can help you.
http://fuse.sourceforge.net/
Here is an example of a very, very basic FUSE implementation that is backed by a glorified shared memory segment (xenstore). Its a fork of the original xenstore FUSE file system that I maintain.
You will also find some code to show you how to make Valgrind more helpful when debugging FUSE implementations.
You write functions for open / create / read / write / truncate / getattr / etc and pass them to fuse (line numbers are from the linked example):
343 static struct fuse_operations const xsfs_ops = {
344 .getattr = xsfs_getattr,
345 .mknod = xsfs_mknod,
346 .mkdir = xsfs_mkdir,
347 .unlink = xsfs_rm,
348 .rmdir = xsfs_rmdir,
349 .truncate = xsfs_truncate,
350 .open = xsfs_open,
351 .read = xsfs_read,
352 .write = xsfs_write,
353 .readdir = xsfs_readdir,
354 .create = xsfs_create,
355 .destroy = xsfs_destroy,
356 .utime = xsfs_utime,
357 .symlink = xsfs_symlink,
358 .init = (void *)xsfs_init
359 };
As you can see, its extremely self explanatory. A little searching would result in finding many basic file backed examples of FUSE implementations as well.
I highly recommend doing it entirely in user space, unless you have enough time to get familiar enough with the kernel.
A file system is essetially a database for files. The main thing you'll need is a lookup table for storing byte offsets and file lengths. The file names could also be stored in the table or they could be stored in the first few bytes at each offset. It will be far easier on you if you make your file system a fixed size.
This would be similar to how the FAT file system works.
You can also have a look at http://en.wikipedia.org/wiki/Database_storage_structures since at the lowest levels file systems and databases are very similar.
The simplest way to do this would be to build a template for storing data, and parse files into ram, of course, this isn't the most efficient.
Something like...
SOME/LOCATION/Filename >>>
contents of the file here, blah blah blah
<<<
SOME/OTHER/LOCATION/File2Name >>>
contents of another file here
<<<
Then to list out a directory, using regex find all lines ending in >>>, then parse up to the Xth slash (based on the number of slashes in the searched folder), and do a case (in) sensitive search, based on whether or not you want this to be case sensitive. Of course, as I mentioned loading it into memory, you could search a key->value hashmap, which would probably be a lot simpler.

Resources