Monthly Archives: October 2013

Wishing for Memory Functions in JavaScript

Share this:  

At work I am working on a web app that is very data intensive. A whole lot is done on the client side in JavaScript. There are certain instances in tests I have done where I have run out of memory.

I can adjust parameters down until the errors go away but:

  • Am I getting the absolute best usage of my memory or am I “leaving my change on the table?”
  • What if a user’s PC has less memory than me, are they going to get out of memory errors?
  • What if a user’s PC has a lot more memory than I do… then they really will not be able to leverage that extra memory to their advantage.

I wish there were two JavaScript functions available for programmers to use:

  • totalMemory()
  • availableMemory()

The functions could be called something else, that’s fine. But if there were these functions and if they returned the number of bytes relative to what was accessible to that current instance of the web browser, that would be so useful! As far as I know, JavaScript does not have any functions like this. I’ve looked 🙂

Am I missing something? Are there functions or object properties that I’ve missed? If you are a web developer working on some data intensive stuff on the client side don’t you wish you had these functions available?

One More Memory Related Thing
One more thing regarding JavaScript memory usage… There is a piece of info that I do know is out there somewhere… but I have not found yet… How much memory do JavaScript variables use?

I assume strings  may use 1 byte per character (or do they use 2 bytes to support unicode). I assume booleans take the least amount of memory (possibly 1 bit)? There are integers and floating point values… how many bytes do they use each? What is the overhead number of bytes for each variable and for each element in an array? Knowing this information could be helpful in deciding how to store information in memory the most efficient way.

UPDATE:
Microsoft says that their floating point variables in JavaScript use 8 bytes (search for the word “byte” on the page).
see: http://msdn.microsoft.com/en-us/library/ie/7wkd9z69(v=vs.94).aspx

UPDATE  2:
This looks like an interesting JS library: something where you pass in a variable or JSON string and it returns how many bytes it takes up.  I have to investigate this further when I have some time!
http://code.stephenmorley.org/javascript/finding-the-memory-usage-of-objects/

Crazy Ways of Designing 3D Printed Parts

Share this:  

So I got my female connection test piece working perfectly. My thought was Yes! I now have the measurements I need  to implement connections on the actual model!

Not so fast. I guess I just do not have the hang of this.  It seems to involve a lot of trial and error. Like I’ve said before, I am using Sketchup to design my parts.  This part of the project is driving me nuts. Its just the first part… getting the four base pieces to snap together.

I did not work on it last night because I was just too frustrated with it.

Working on Test Connector

Share this:  

Yesterday evening I started working again on the design of a female connection piece. The model I am working on (which I want to make copies of and give as gifts to family members) will use these connectors on the base. Instead of just trying to add them to the main model right away, I am creating a small connector which I can adjust the measurements of and print in a relatively short period of time and test to see if it fits the male part of the connector.

If it does not, I can make adjustments to the measurements and repeat the process. Printing this test piece takes much less time than printing the whole actual part of the model! Once I get it just right I will write down the final “correct” measurements and use them for all the base pieces of the model.

A couple months back I was working on this test connector. I was printing test prints in ABS plastic. I am putting ABS aside and printing my tests in PLA plastic. It takes about 24 minutes to print my female connector test print on my Makerbot Replicator 2 3D Printer.

3D Printing Journal Continued

Share this:  


I have started printing again after I got back from vacation. A lot of warping on a modest sized print in ABS plastic. It may be my imagination, but Makerbot’s Brown ABS filament seems to shrink and warp more than a color say like Red.

Oh, and I started getting temperature errors again 🙁 . I have not investigated this yet. It is just too depressing to look at right now.

PLA is still a non-starter on my Makerbot Replicator 2X printer.

There is a gift I want to  give to some of my relatives this Christmas. I am designing it and I want to print copies out and give as gifts. At the rate I am going, I am spending more time fixing the printer, having failed prints, etc. than I am designing this gift and printing its parts.

I decided rather impulsively to go to the nearby Microsoft Store and buy a Makerbot Replicator 2 printer (not 2x). It prints only in PLA. So far, I have found it to be much more reliable than the 2X. If I level the build plate properly it has a very high rate of successful prints. I am getting back to designing this gift in Sketchup again. Yay!

Note: The Makerbot Replicator 2 looks a lot like the 2X but… it cost less, does not print in ABS, has only one extruder not two, does not have an aluminum build plate, its build plate does not heat up (no need to for PLA), the extruder itself is different, there is no plexiglass on the sides and front, there is no plastic lid. So far… so good.

They have a demo printer at the Microsoft Store, it seems to be printing merrily away without filament cruft laying about. They sell a handful of PLA filament colors too. I will need to order some other colors from Makerbot that I need to print my gift out properly.

Getting the PLA prints to get unstuck from the build platform of my new 3D printer is harder than for ABS prints on my 2X. But I will trade successful prints for this problem any day!

I have notice that PLA can shrink… but a whole LOT less than ABS. I have a hunch that the really neat photos of say the green tractor on Makerbot’s site where printed on the Replicator 2 in PLA. I don’t know for sure, but I think I am right. I printed some tractor parts in ABS on my 2X (http://www.thingiverse.com/thing:31702)… there was a lot of warping. I printed the body of a UPS Truck in Brown ABS, there was a lot of warping and splitting (http://www.thingiverse.com/thing:31686).

Other Stuff
I got a new desk for my workshop at Office Depot to put my MacBook Pro on and hopefully it will be a future soldering station as well. My workshop is looking more and more “workshoppy” all the time! 🙂

Do I have too many proverbial balls in the air at one time? Probably!