Avatar for cephdon

cephdon

Member since Feb 2014 • Last active Jan 2016
  • 2 conversations
  • 91 comments

Most recent activity

  • in General
    Avatar for cephdon

    Not that it will help you with github, but... I use the IDE named 'QTCreator' to work with the code. Then, I have the ability to easily search through all files in the project and find definitions, etc. Maybe some kind of ide is what you need?

  • in JavaScript
    Avatar for cephdon

    @Gordon,
    Thank you.
    No worries. Each entry could have it's absolute position and then the sizes of the previous and current lines before the key and data. Just a little math to get to the absolute position for the beginning of each one.

    So it could still be done. Awesome.

  • in JavaScript
    Avatar for cephdon

    @Gordon nice!
    I wasn't actually attempting to push for that feature, just noting what we could do with it. However, since we will have it, is it based on relative or absolute positions?

  • in JavaScript
    Avatar for cephdon

    If we had the ability to do a relative seek in a file, or the ability to move to an absolute position (forward and backward) in the file, then we could build a relatively unlimited (from the perspective of memory) key value store (or simple db). It's easier if it's relative, though.

    Basically, you store in a file(for each entry):
    Offset to the beginning of the next entry, offset to the beginning of the previous entry, key, data. (Or, size of this entry, size of previous entry, key, data. It's the same thing when relative)
    It could be line delimited, or not.
    In any case, you could easily binary search the database for your data, assuming you sort it at insertion time.
    Then, when that is done, you only keep the data you want in memory and leave the rest saved to disk.

    It might not be as fast as an in memory array, but with a 32GB sd card, you could store and search much more than the memory available.

  • in Interfacing
    Avatar for cephdon

    From what I remember, the fs_kill only deals with the stream handles... unless that has changed. While that would absolutely need to be done, so that streams are handled correctly, the readfile code is a "one shot" open, read, close. Does reset() call wrap_fat_kill and jswrap_fs_kill? Then, once the card is inserted again, you would have to call jsfsInit to get it back into operation.

    after code inspection

    At least, that is what it looks like from code inspection based on what is in github.
    So, here is the test case, it looks like reset will kill all handles and unmount the card when it is pulled out. The second thing is to perform a reset after inserting the card... the reason is that reset also does initialization. Since the system does not auto detect insert and removal, you have to do it twice.

    If this works, we would need E.mount to go with E.unmount in order to take full advantage of the hot swap as we are discussing. It looks like it should auto init on read after being unmounted, but I am wondering if that is not working for some reason (as in we are not doing enough to initialize the device, clearly we can initialize on startup).

  • in Interfacing
    Avatar for cephdon

    Unless things have changed, and I didn't look to see if that was the case or not, the readfile function in fs was a simple open, read, close operation. It used to do an fs init call the first time it was executed, or really the first time anything was executed.

    From what I know of how it did work, I am wondering if there needs to be an additional flag added for state change of the card.

    It would be something like:
    On idle, check the card detect pin
    If the card was present and now isnt, set the card detected flag to false and the state changed flag to true.
    If the card was not present and now is, set the card detected flag to true and the state changed flag to true.

    If the state changed is true and the card is not detected, call fs kill and destroy all handles.
    If the state changed is true and the card is detected, call fs init so that the filesystem is valid again.

    If this is done during idle, you should have the ability to swap out cards without trouble.....it's a guess anyway, from knowledge of a few versions ago.

  • in General
    Avatar for cephdon

    Well, you could use the file stream api to fetch and write each file one at a time in a loop. It wouldn't matter how big the file was, but it might take a long time.

  • in General
    Avatar for cephdon

    @Gordon, @rm:

    I think it might depend on the eventual use of the library. If the goal is to have something that you could link with some other program and have it execute a string containing JavaScript, it may be possible.

    You can look at targets/linux/main.c: line 276. This is the location where the interpreter executes a file of JavaScript. You could take what you need from this file/location and create an interface for running an arbitrary string of JS.
    However, all it would do is execute the JS.. you would still need to find a way to get data back out to the running program if you want any feedback from the JS.

    I am not saying it is the cleanest way to do it, just that it is a way to do it.

  • in JavaScript
    Avatar for cephdon

    @Loop,

    You will want to use the arm-none-eabi-gcc version 4.7.3 (Carlson-Minot Mac OSX Intelx86 2013.05-23 Lite) from Code_Sourcery_2013.5-23. It produces the smallest code. I just took the binaries and placed them on my system and in my path.
    Also, I don't know what IDE you use(or if you use one), but I looked high and low and the best one I could find was QT Creator (on osx), all of the others had issues debugging or were incredibly slow. You can find instructions online for how to import projects with existing code. It takes a bit of fiddling, but once you get used to it, the way they setup different configurations is kinds natural... just watch out if you edit the makefile...you have to do it in VIM mode to keep tabs in the correct places.

    You will want to install gdu from coreutils.. I got it from macports. It is needed to check the size of your compiled binary to make sure it will fit inside of the device. Linux uses the du command for this, but the osx version doesn't have the correct options, that is why gdu is necessary.

    From memory, I think thats all there is...then the code compiles (with my makefile changes) and you can run the target to write it to the device.

  • in General
    Avatar for cephdon

    @Gordon,
    Re: guys on github,
    I think there must be a line drawn somewhere. If people begin demanding what they think is best, without talking to the project owner about it, then the direction of the project gets muddled. You and I have had many conversations about these changes, so I thought my original implementation was slotting in with your code.

    The difference came in the way it was handled and the manner of the discussion. I won't be shy about it, though, if they did represent espruino, I was not going to contribute anything more to the project. That's the danger of having people who can influence change in your project without your consent. They have the ability to change the perception, right or wrong, of the project in general.

Actions