Friday, June 27, 2014

web nerdz

Subject: web nerdz

  • note: originally emailed 06/27/2014 and sanitized for public consumption
  • sidenote: posting here so i can lead people here whenever they ask me about this stuff...


Many moons ago, I wrote the "http fun with telnet" post.


I think it needs to be revisited due to the renewed interest in 'standardized' REST calls (what web nerds say, "the way it was meant to be done")...


PUT vs POST

First, there's usually been some confusion with how REST calls are used --- in particular PUT vs POST.


Here are examples of what I mean:


But, really, a create/updating request should be thought of 'same thing'.


Note: PUT and DELETE are normally not enabled on all web servers



Server side processing

Because PUT and DELETE are quite dangerous if not controlled, server side processing (PHP, ASP, etc.) handled much of the PUT/DELETE (i.e. create, update, destroy) processes by incorporating them with AJAXy APIs (normally done with GET and POST only).


Let's see an example of the "server side processing" that a lot of people are used to:

Here, the action parameter is descriptive, to the point and clear on intention.


I do realize that the URL "parameters" are much more descriptive than 'PUT'...
  • But, you'll need to see what is 'implied' when using GET/PUT/POST...



Idempotent Retries

There's a very important concept for web server technologies that needs to be understood before continuing



Pretty URLs

A lot of web nerds want to slim down the URL so that search engines can "crawl" your web site with impunity.


Anyways, back to the implied usage of GET/PUT/POST/DELETE (what they call HTTP verbs). Let's take a look at an example URI:
  • http://webserver/account/nick
    • GET would return my details
    • PUT could update my details
    • A first time POST would create my account
    • And of course, DELETE would disable or nuke my account
  • Note that each of the methods does different things while the URL stays the same

You can still use server side processing to handle this
  • For example, in: http://webserver/account/
    • The index page has been setup as "app.php"
    • app.php will process (for example) /account/nick as the ARGs for the script (and any POST or URL parameters) to handle the request

  • you can look at (http_fun_with_telnet) and add handlers for PUT and DELETE to complete this homework assignment

Tuesday, June 24, 2014

json-ld (part 3 of 3)

Subject: json-ld (part 3 of 3)

  • note: originally emailed 06/24/2014 and sanitized for public consumption
  • sidenote: posting here so i can lead people here whenever they ask me about this stuff...
  • series: part 1 & part 2



Let me first say, I can see why they want all of this stuff:
  • xmlns:
  • RDF
  • JSON-LD
  • And finally -- from the only [usable] JSON-LD implementation available so far [that I know of so far]
    • a Hydra powered web API via symfony

This is the java nerds sticking their dirty fingers with a kung-fu death grip in the web world trying to make themselves still relevant.


Anyways, here's a HOWTO on getting "a" webby API thingie working with this JSON-LD stuff...


In a nutt shell
First, you need to know that Hydra is installed via "a" PHP package manger called Symfony

Now, install the sample hydra demo (so you have a working version to play with)
  • https://github.com/lanthaler/sfHydraDemoApp
  • Part 1 [of the demo] should look familiar if you did the crash course above
  • When you get to part 3 [of the demo]: pay attention to the last line:
    • "Please note that it will return JSON-LD so you might wanna access it using cURL or the Hydra Console"

Then there's "HydraBundle" -- which I'm guessing is a way to shove this Hydra server in your Symfony project.



My analysis
Anyways, the Hydra demo implementation has confirmed my suspicion -- the webserver (or whatever RESTy box) needs to handle the URI path (as the parameter to your "handler")
  • E.g. http://webserver/account/foo/bar
  • In this case, the following does not actually exist on the "web server":
    • account/foo/bar
    • account/foo
    • account
  • and yes, the webserver walks those paths first
  • finally, (in this case) a "index" file -- at http://webserver/ would take over
    • the demos have this file as "app.php"
  • this file takes and read the URI path and processes it by (depending on the php implementation) walk the "path" as the parameters for the request


Side note: I've never used Symfony in the past -- and after this little exercise, I don't think I'll ever use it in the future...
  • Really? [A] java build system that compiles PHP code to include a bunch of other PHP frame work code...
  • And the "compiled" PHP code isn't even optimized -- cached, yes, but the number of files "loaded" is still HUGE
  • Yes, it's nice that it automates some steps, does some checks, it looks pretty... but wowzers -- it's big and this code is supposed to be called every time there's a REST request?

  • To understand how the REST URI is mapped to the handler, read this:
  • Note: This is part is from symphony -- hydra demo is just returning the json-ld response...


Personally, this is way too much code baggage for something that should be much simpler to ... implement?


Extra
And, since this was mentioned in today's meeting, if you've never used this before, BOOKMARK THIS:


Thursday, June 19, 2014

json-ld (part 2 of 3)

Subject: json-ld (part 2 of 3)

  • note: originally emailed 06/19/2014 and sanitized for public consumption
  • sidenote: posting here so i can lead people here whenever they ask me about this stuff...
  • series: part 1 & part 3



This message is primarily for the TO: peeps. But some of you have asked about json-ld before and this would benefit everyone here for future reference.


Epiphany:
While reading up on some (computer) graphics articles -- I found out (in a round-about way) what linked-data (um, actually) the * description languages would be good for.

Not so fast:
First, why I still think it's not needed (in the context of javascript's json handler) -- it's unused information (you'll see this in a sec).
  • For more info on why I don't like json-ld (just like why I don't like VM's) -- it's heavy with a lot of un-needed cruff (you can read more about it from the email thread below).
    • Again, I'm coming from a javascript coder [for a project with restricted and security considerations] point of view...

So, what is it good for?
It (linked-data/interface description language/data format description language/etc.) is good for:
  • binary only data (i.e. structs/class)
    • getting transported between different programming languages
    • which might be running on different architecture (endian-ness, 32 vs 64 bits, etc.)
  • these (the data payload) are quite specific and can lead to catastrophic behavior if not handled properly

Examples of this type of mechanisms are:
  • ZeroC's Ice
  • Apache's Thrift
  • Google's Protocol Buffer
  • etc...

What does all that mean?
Basically, it's good for defining your data structs without (sort of) knowing anything about them.

Here's what I mean. Back to the graphics article I mentioned before. Blender (3D) is an open source modeler that had its beginnings 20 years ago.

The creator of that program made his binary data files with "encoded types for the entire internal structure" -- in other words, self-describing and included in the data file. The intention was to make it backwards compatible knowing that future versions of the program will always require inevitable changes to the data file format.

Why strike linked-data and call out the * description languages
Back to "unused information" I mentioned earlier, [for our system] -- the LD stuff will NEVER be used (I can pretty much say that now with 99.9% certainty).
  • C/C++/java/etc. however, would HUGELY benefit from a self-describing struct/class object.


So when I started to play with:

I said to myself, "this is interesting -- but what is this good for?"" -- I even said ([in part 1]):
  • this terse way of representing all of the data [is] highly error prone if written by humans -- this will need to be generated with tools just to be safe

The playground only showed results for JSON-LD and an RDF item.
  • But, there seems to be a number of possible representation for the same dataset:
  • I thought to myself, there has got to be a better way to create this (remember: highly error prone if written by humans)


Then, the following showed up in [redacted] (today in fact!):
  • [link redacted]
  • They mentioned hive-json
    • This showed how a json ld-ish output was created from (in this case) the apache hive schema

So, out of curiosity, I thought if there were other ways to help write json-ld via converters?

Wednesday, May 28, 2014

json-ld (part 1 of 3)

Subject: json-ld (part 1 of 3)

  • note: originally emailed 05/28/2014 and sanitized for public consumption
  • sidenote: posting here so i can lead people here whenever they ask me about this stuff...
  • series: part 2 & part 3



[Boss,]

Over the weekend, I looked into more about the JSON-LD stuff -- I get what it's doing -- but, we [are not] building a social network nor do we want dynamically generated 'queries' in areas that should be 'sanitized' (input validated, [...] etc.).

That said, the inventor of JSON-LD complained about a lot of things and the reason for creating JSON-LD (but hated on quad store a.k.a. named-graph).

I'll getting to the "sparkle" part in just a bit. But, here's a sneak peek:



Anyways, if you ever read any of Microsoft's HTML exporter from their Word app you would see things like:
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml"
xmlns="http://www.w3.org/TR/REC-html40">
<head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><title></title>
<style>
...
See all those xmlns: items?

Those are never used outside of your work, except for tracking purposes outside of your company. To "help" them figure out what you're document "means" instead of just a bunch of "content". This is what is known as the RDF annotation. RDF stands for Resource Description Format -- basically meta data for your content.


So, going back to JSON-LD: they want to transform something like this:
  • http://XYZ/ajax/api/path.php?user=name1
  • That would return something like this:
    • { "result" : "pass", "balance" : "111111" }
  • To returning something like this:
    {
        "@context": {
            "name": "http://xmlns.com/foaf/0.1/name",
            "balance": "http://json-ld-server/rdf/0.1/name",
        },
        "name": "X name1",
        "balance": "111111"
    }
    
  • In other words, you need to describe what the data is -- instead of just dumping it.
    • Do note, this will also mean there's no stopping them from changing the simple ajax request of:
      • http://XYZ/ajax/api/path.php?user=name1
    • To something more convoluted like:
      • POST: http://json-ld-server/
      • POSTDATA:
        {
            "@context": {
                "name": "http://xmlns.com/foaf/0.1/name",
                "query": "http://json-ld-server/rdf/0.1/query",
            },
            "name": "X name1",
            "query": "balance"
        }
        
  • Again, all meant for systems outside of ours to help them understand our system (i.e. route around/through our data)...

Finally, SPARQL (pronounced -- sparkle) can be seen like this: S(PAR)QL -- which stands for: SPARQL Protocol and RDF Query Language
  • This allows you to do all things SQL (CREATE, INSERT, UPDATE, DROP, etc.) with this terse way of representing all of the data (highly error prone if written by humans -- this will need to be generated with tools just to be safe)
  • The named-graphic link above earlier, shows some examples -- but it's still means this needs someone to write the query... this is all duplicated work...

Tuesday, February 11, 2014

[ containers ]

Subject: [ containers ]
12/17/2012 06:21 PM

  • note: originally emailed 02/11/2014 and sanitized for public consumption
  • sidenote: posting here so i can lead people here whenever they ask me about this stuff...


XXX mentions this way up the [internal] thread:
  • "we see open systems that move away from the monolithic closed stack (old way of delivering transactional systems) as the way forward." ...
  • "we see products such as the [abc] product converging with [xyz] POS solutions that allow us to extend our networks to open new and interesting sales channels (and other services such as promotions/advertising). it is a really exciting time."

I like the direction this is going.


It is no secret for my absolute disdain for VMware and those type of giant images (monolithic -- full OS on an image).  Don't get me wrong -- I love LIVE distros (very flexible -- more importantly, runs on the bare metal) -- I just hate full blown 'images' that runs in a VM (too slow).


That said, projects like the docker *IS* the future of server/[software deployment] (fast and easy).  <snip>

(Update: TODO: add link to unikernel post)


Here are some links for the OpenStack environment:


Sent: 12/17/2012 06:21 PM
Subject: [ server 1 & server 2]

Wow, it took about 2 hours to dance with vmware.

I would like to re-iterate my absolute detestation for OS-level virtual-machines.

In fact, just like my prediction of [xyz] going away -- I am going to say by the time we hand off [abc], it will NOT be a VMware image.

(I could NOT believe how LONG it took to make windows [change from] a static IP to dynamic and vice versa -- did this on the DB VM and was shocked at how long it took windows [on vmware] to complete that task -- it was faster to reboot the [image] instead of waiting for it to complete [the manual change over].)

<snip>

Monday, February 10, 2014

webGL supplemental

Subject: webGL supplemental

  • note: originally emailed 02/10/2014 and sanitized for public consumption
  • sidenote: posting here so i can lead people here whenever they ask me about this stuff...



I forgot that I sent myself some links to write up about last weekend.  And over this past weekend I found more stuff.  < SNIP >

webGL traction

3D modeler, animation and scene editor in a browser

webGL development

webGL demos

There’s a pile out there:


[...] I think that’s enough for now…



Thursday, February 6, 2014

webGL

Subject: webGL

  • note: originally emailed 02/06/2014 and sanitized for public consumption
  • sidenote: posting here so i can lead people here whenever they ask me about this stuff...


From: [name1]
The limiting factor (as expressed in the posts comments) is that it is depending on webGL – a standard/feature that has very little traction just yet.

From: [name2]
Ohhhhh Nick is going to freak out at you [name1]  :)


All major desktop browser supports webGL. But, whether they are enabled (by default) is another question.

webGL is even supported in IE11: (even though they had a kung-fu death grip on their Direct3D < SNIP >)


Most 'native' mobile browsers do not (out of the box) support webGL.  But, again, all major mobile browsers do -- and one in particular requires to be jailbroken to be enabled or a ‘custom browser’ built with the iAd library.
  • I will say that mobile makers will try to delay webGL on their hardware as far away as possible due to the power hungry usage 3D visuals normally chews up compared to basic 2D render once and draw counterparts...  anyways...


Now, as to whether there’s little traction or not:


[...] O'Reilly books [...] wrote this:



Little traction, huh...



I will make this prediction:  (oh wait, I already did -- RE: News: Epic shows... & Unity Dropping Flash...)...



  • Let's go along the lines of my last claim that: HTML5 will kill flash projects in [XXX]:
    • webGL will be used on [XXX product]s running off of webservers
      • true multi-game deployment
      • no custom OS requirements
      • easy on-the-fly upgrades
      • easy versioning deployment
      • etc. etc. etc.


    Tuesday, November 5, 2013

    Git branch naming

    Subject: Git branch naming

    • note: originally emailed 10/30/2013 and sanitized for public consumption
    • sidenote: posting here so i can lead people here whenever they ask me about this stuff...



    Sent by XXX:
    > One thing I was thinking about since we are going to start using
    > branches a lot more is that we start labeling branches versus tags. Say
    > something like….'feature-branch' or 'feature-B' and
    > 'ZZZ-1.1-T' or ZZZ-1.9-release'. This way it is easier to see
    > which branches are tags and which branches are tags for release.


    Don’t confuse a branch with a tag.


    A tag is a ref like any other:
    git checkout -b branchname tag

    Which is a shortcut for
    git branch branchname tag
    git checkout branchname

    “You cannot checkout a tag.”

    http://www.gelato.unsw.edu.au/archives/git/0610/28708.html

    [ Git ]

    Subject: [ Git ]

    • note: originally emailed 11/05/2013 and sanitized for public consumption
    • sidenote: posting here so i can lead people here whenever they ask me about this stuff...



    Git is an extremely flexible and powerful revision control system.  PerForce was my #1 fav until Git showed up.

    Anyways, we had a new contractor start up here with us -- but has no CVS access.  So I've setup a dual RCS configuration where I would manually merge between our team's updates to CVS with the contractor's GIT repository.

    Quite possibility the easiest I have ever encountered.  I would love to see the whole organization move to GIT.


    That said, I have collected a number of links to get our contractor up to speed with GIT.

    *** must reads ***
    https://www.atlassian.com/git/workflows
    • branching workflow (very relevant to this current thread -- and please see the attached note: it was in my drafts folder -- it didn't seem appropriate to send it at the time, whereas now, it is obvious)

    http://www.slideshare.net/hbalagtas/simple-daily-workflow-with-git
    • a very good 'overview' of a lot of the common ways RCS can be used
    http://agilewarrior.wordpress.com/2012/04/17/git-workflow/
    • an example of why there's no 'central repository' in the GIT universe (so the excuse of "we don't have access to GIT to upload our changes -- we're stuck in the water!!!" isn't really true)


    The following are a little more terse and detailed, I highly recommend spending a few moments whenever you can:


    My most favorite feature of GIT is the "stash" command
    • you can "stash" you current work (i.e. a temp checkin to your local GIT depo)
    • which will _then_ revert your changes to your latest checkout (previous to your "changes")
    • do your work
    • checkin (commit)
    • and then "unstash" your work-in-progress, continuing as if nothing changed

    There is no limit to the number of stashes you can do...


    Btw, the VIM fugitive plugin is amazing.


    Enjoy!

    Wednesday, March 27, 2013

    [ LLVM ]

    Subject: [ LLVM ]

    • note: originally emailed 03/27/2013 and sanitized for public consumption
    • sidenote: posting here so i can lead people here whenever they ask me about this stuff...



    [BOSS,]

    [SNIP]

    While looking at the [XYZ] features, and wanting to use node.js – it is possible to take existing code (logic mostly) that can be 'converted' (for example, from C or C++) to run in the Google's V8 javascript engine – that node.js also uses.

    But this isn't about javascript.  The piece of technology I want to bring to attention is called LLVM – Low Level Virtual Machine.  This project was only called a VM for legacy reasons.  But LLVM is much much more.  It's now known as the "LLVM compiler infrastructure".


    Basically, it is possible to take (for example) a C++ library, convert it (for example) to javascript.


    And since we like pictures to help describe things:
    • At the core, the programming language is generated to an "intermediate representation" (IR)
    • This IR object can then be used to be 'compiled to' the target platform
      • This can hardware (machine code)
      • But can also be software (byte code)


    • Here's an example of how nVidia took the LLVM project make their CUDA compiler


    • Here's another example of how source code from one language can be used to generate source code in another language

    Here’s a pretty good slide deck intro to LLVM:

    Mozilla and UE GDC talk

    Subject: Mozilla and UE GDC talk

    • note: originally emailed 03/27/2013 and sanitized for public consumption
    • sidenote: posting here so i can lead people here whenever they ask me about this stuff...


    -----Original Message-----
    From: XXX
    Sent: Wednesday, March 27, 2013
    Subject: Mozilla and UE GDC talk

    I went to a talk given by mozilla and UE this morning. They demonstrated the UE3 engine, and game, running natively in the firefox web browser. Mozilla developed 2 tools that were used to port the engine
    • emscripten converts c/c++ into js
    • they created a js library called asm.js that creates and executes high performance java script. This is accomplished through AOT js compilation and by enforcing types in the js.
    [SNIP] UE and mozilla said this is the key to getting performance out of js running in a web browser.

    With the use of these tools they said the port took 1 week. The [UE3] running in a browser gets about half the performance of the native engine on the same hardware. It was a really impressive demo.  They showed a full game getting 60fps and said they can get 100fps.

    The solution requires webGL so it works with firefox, Chrome, safari and any browser that supports web gl. IE does not support webGL.

    Really cool stuff. What you can do natively in browsers (no plug ins) is very impressive.

    [Boss,]

    This jogged my memory a bit:

    About a year and a half ago: UE on flash and my comments about webGL under the hood.
    From: Nick Shin
    Sent: Friday, October 07, 2011 12:01 PM
    Subject: News: Epic shows Unreal Tournament 3... running in a web browser - ComputerAndVideoGames.com

    This is webGL under the hood. The fact that you need to go through a flash layer is, in my humble opinion, kinda redundant.

    Once webGL becomes open for public consumption (in other words, the browsers have them enabled by default) flash will go away.

    Flash will not run on iPad.

    You will see the Unreal Engine, Unity and all other game engines, 3D modelers and even 2D animation tools all move to webGL without the intermediary flash layer.

    [ ... SNIP ... ]


    -----Original Message-----
    From: [Boss]
    Sent: Friday, October 07, 2011 11:52 AM
    Subject: News: Epic shows Unreal Tournament 3... running in a web browser - ComputerAndVideoGames.com

    Thoughts? Would this run on an Android or iPad?
    http://www.computerandvideogames.com/321291/epic-shows-unreal-tournament-3-running-in-a-web-browser/

    Before that, I also wrote about emscripten
    Sent: Monday, June 20, 2011 6:20 PM
    Subject: Weekend Tech updates

    A few weeks ago, we were looking into javascript frameworks
    -----Original Message-----
    Sent: Tuesday, May 31, 2011
    Subject: JavaScript and UI Frameworks comparisons...

    Here's a fun page I just ran into recently:
    https://github.com/jashkenas/coffee-script/wiki/List-of-languages-that-compile-to-JS

    This basically means you can use (almost) any common programming languages to generate javascript code, greatly increasing the number of frameworks you can use.

    [ SNIP ]

    My most favorite: a C/C++ LLVM (low level virtual machine) to JavaScript compiler: Emscripten


    and I noted: Emscripten from the following project:
    • https://github.com/jashkenas/coffee-script/wiki/List-of-languages-that-compile-to-JS

    Continuing with the original email thread:
    We all know DOOM can run in a browser, but how many of you know how he did it?
    • http://www.readwriteweb.com/hack/2011/05/doom-ported-to-javascript-and.php

    [ ... SNIP ... ]

    Really, I thought this would be a good excuse to talk about the LLVM (low level virtual machine) project. [snip] LLVM practically replaces the need to learn that (old stuff) with a much easier to grasp and modern programming methods. As a bonus, you get to learn about compiling architectures. If you ever wanted to create your own programming language, as well as a compiler for it to run natively -- this is a really cool tool to use.




    A couple months ago, I wrote this to the lunch crowd: [a] full game engine that was also ported converted to JS (again via emscripten).
    Sent: Thursday, Janurary 17, 2013 9:12 AM
    Subject: Weekend Tech updates

    http://www.ubuntuvibes.com/2012/08/open-source-cube-2-sauerbraten-engine.html
    Here's the article I was talking about -> C++ project ported to JS (with webGL) via Emscripten.



    I really like where webGL is going.
    Sent: Monday, February 13, 2012 1:40 PM
    Subject: streaming full application to an HTML5 browser

    I'm a big fan of openGL and the 3D modeler Blender.

    Here's a fun project that shows a live feed of the 3D modeler's output in action in a webGL enabled browser.

    http://www.blendernation.com/2012/02/10/live-3d-stream-from-blender-to-browser/

    This is truly going to be the future of seamless, plug-in-less, extremely powerful apps in a browser.


    [ SNIP ]

    -----Original Message-----
    Sent: Wednesday, February 08, 2012 4:59 PM
    Subject: streaming full application to an HTML5 browser

    So I was reading through my RSS feeds and ran into this article:

    [ SNIP ]

    But it leads me to find this:

    http://www.webupd8.org/2011/09/gtk-32-released-with-html5-allows.html
    The HTML5 "Broadway" backend allows rendering GTK applications in HTML5-capable browsers.

    [ SNIP ]


    [ SNIP ]

    I've saved the following for last: but I will email it in a follow up message (it's been sitting in my drafts folder for a few weeks -- waiting for a good reason to send it [snip]...

    And this is the CORE of what [XXX] is talking about.  The AOT (ahead of time) 'compiler' part of the demo.

    What I'm talking about is LLVM - or Low Level Virtual Machine.


    The [new] thing I got out of the message [above] is "asm.js" - which isn't a javascript file that I can download and use.

    But it is a spec that I would *love* to see the browsers pick up and run with it.  However, I have some serious doubts that we'll see this get picked up by all major browsers and I don't think we'll see this on the mobile platform at all...

    =)

    Tuesday, December 18, 2012

    Thoughts on JavaScript Development

    Subject: Thoughts on JavaScript Development

    • note: originally emailed 12/18/2012 and sanitized for public consumption
    • sidenote: posting here so i can lead people here whenever they ask me about this stuff...




    Sent by XXX:
    I am trying to put together an argument to use pure JavaScript. I wanted to get some of your thoughts on large scale application JavaScript. Like how feasible you think it is to use JavaScript for large scale applications and where the code base can become large. Also some ideas on how to combat the fact that JavaScript is not a structured language and sometimes makes maintainability of a code base and testing and such a nightmare.


    I would have to ask, what is the application trying to do?

    One of the mantras of “unix” utilities is, small programs that does one thing really really well.  But you can put a bunch of them together to make really powerful and extremely flexible set of tools.  Putting them together leverages each of the specialized utilities (concentrated in what they do) to make a bigger (and more useful) end product results.

    Wait… here it is: http://en.wikipedia.org/wiki/Unix_philosophy
    • To this, I would liken it to the *.lib concept in programming (instead of end user executables)

    You will have some people argue against that for ‘large scale application’ – but I contend that it is [usable].

    As for code bases becoming large:
    • Just like any other programming languages, a good set of APIs and documentation would carry it a long way.
    • Again, think of it as if you were releasing an XYZ.lib object, it is only useful if it's easy to pick up and run with it.
    • However, in JS, it’s even easier for people to just try:
      • By just including an 'example' demo with the "library" --  this will make developers that much closer to using it.
      • [Downloading and running it] is a lot easier than "lemme see how I’m supposed to be using this…"
    • Large code base can be managed by modularizing the components to specific tasks
      • This is by far my #1 requirement and the way I do things.
      • Think of this as, if I find a better replacement, I can drag and drop it in.
      • Lately [work related], it’s the need for an [alternative] mode – using a plug-in style provides the mechanism for this.
        • So in [ABC], for example, the core logic of controlling the boxes and displaying the visuals are all the same.
        • The network messages, on the other hand, are different.  So these were split off from the core base code.  Again maintaining the separation of logic by putting them in their own "modular" file/component.
        • [XYZ] does this too.  Right now we have basic [xyz1] and [xyz2] (it isn’t separated yet) but think of it as how you have [awesome featurez currently]. All of the core functionality are split out.  This can also be done in JS.
          • I hope to split out [xyz2] and make (maybe) [xyz3 soon] to further show the modularity concept.

    As for its non structured language:
    • Just like any other programming languages, unit testing is invaluable.
    • Javascript is just as easy to unit test and can be done along with normal development.
      • I would contend that it is even easier to write test cases for it in JS.
      • I can add a “debug” [file] version that is normally not picked up on release -- but when included, [it] will augment the features, capabilities, flow, etc. without interrupting or polluting the base code.
        • I have done a GIANT code clean up to show this concept a bit more clearly.
        • The PHP code was cleaned out of any ‘core logic’ – this was pushed in the base game JS code
        • Any “add-ons” are dynamically included (see AlertBox, DebugPrint, [abc], etc as examples).
          • None of them have any required code called from the base game
          • Just including the JS file will automatically generate and append the required code in the browser
      • Again, following the “example” demo method, you see it running live, can take any of the code you may find useful or leave it alone, very flexible.
    • I would also argue that it’s actually easier to maintain (and read and follow the flow) of scripting languages than the giant plumbing [code in] structured languages.  Which goes into my next topic: framework.
      • But first, don’t get me wrong, I totally understand the need for strong typed languages and I have programmed with them a lot in the past.
      • But, I [find] there are a lot of times when I need to write quick and small utilities, [and] I prefer to write them with as little lines of code as possible.
      • The benefits of extreme-rapid-development with very-fast-iteration times has far outweighed the usability of strict and terse programming.

    HTML(5) + CSS(3) + JS *is* a framework [out of the box].  A lot of work has been done by a bunch of hard core nerds that created quite simply an extremely robust yet flexible/tailor-able renderer that can be your basic e-reader, live auction viewer, balance your financials, connected/online universe, and a whole heap of other possibilities.
    • I would also mention that there isn’t that much more (system) code that needs to be written to provide features already supported by the browser itself. Let me re-phrase that.  There’s no need to re-write (i.e. re-invent) the core features already available in the modern browser.

    Finally, the sheer volume of documentation, books, online resources and examples out there makes it very easy to find solutions to questions, problems and wonderment when everyone is speaking down to the nuts and bolts – pure JS.  Otherwise, you will be hard pressed to find the same answers, suggestions and recommendations if it was written anything else for the browser.

    Hope this helps

    Wednesday, December 12, 2012

    jenkins and puppet

    Subject: jenkins and puppet

    • note: originally emailed 12/12/2012 and sanitized for public consumption
    • sidenote: posting here so i can lead people here whenever they ask me about this stuff...



    Ok, here’s what I got from trying to figure out what Jenkins and Puppet is.



    Starting with Puppet, from Puppet Labs:

    At first, I thought they are something like building you own distro with a configurable ‘manifest’ (it kinda is).  But upon reading part 2 of their 'learning puppet' docs it finally became clear what puppet does (go figure that it was on the last page of their collection of docs:).

    It basically describes the "agent" doing a pull-request from the "master" for work" – this is nothing more than:
    • Poll the server to find out what-to-do…

    In a nutshell, this is a way to deploy a node (either natively or VM) like any other linux distro, but does have some interesting ways to configure/interface with cloud providers (like netflix’s asgard), see the node’s status, configurations (like openNMS/nagios) as well as updating/patching them (like rsync).

    Again, the feature is the ability to run unit testing with the agent and master configuration.



    Jenkins is a continuous integration server.  Basically, a 'build server' – which I believe is a must have for any projects that uses compilers.  Not quite so much for web based content though [using Jenkins, that is...].
    • However, the stuff that you plow into Jenkins is the same stuff I plow into a script file.
    • Put this together with a cronjob (or whatever periodic scheduler you like) and you have Jenkins.
      • which can have more [added tasks], customizations and logic plowed in there
      • and generate a results page


    It doesn’t seem that Jenkins will run and do unit testing on the build’s executable.
    • But, this is where Puppet comes in.


    Thursday, April 19, 2012

    advergaming

    Subject: advergaming

    • note: originally emailed 04/19/2012 and sanitized for public consumption
    • sidenote: posting here so i can lead people here whenever they ask me about this stuff...




    Just a comment (or my ramblings) on advergaming in general:

    Advergaming has been kicked around a lot a few years ago when every ad agency wanted to get in on the console market.

    The best example of a very successful execution was the burger king games:



    The Magnum ice cream ‘advergaming’ is an interesting one.
    • The game was actually quite easy to (get into and) play.
    • The scrolling through the many ‘random’ web sites is also ‘nice’.
    • But, I think I would get tired of playing this and in fact, I would only play it once.
    • I actually tried playing again to see if I can click on any of the ‘websites’ you were running across to see if the links were live.
      • They were not.
      • This is where I think they fell a little sort of.
      • You would think they the pages you would run across would be dynamically changeable/updated.  This made the game ‘old’ really fast. 

    It’s a good start…

    However, [here's an] example [I'd like to bring up]:  a live page with clickable links and everything ‘real’ – is way more effective, you don’t play this, but it is based on a game and is something similar to ‘outside of the box interactions’:






    From: [colleague]
    Subject: advergaming

    Building off of last week’s brainstorm on creating a value proposition to entice transitional players with social/casual content I thought I’d share this interesting game/ad.

    http://pleasurehunt.mymagnum.com/

    the simple interaction of right left arrow and space is augmented with changing background content (advertising content) that itself becomes interactive in different ways.  Magnum ice cream is turning what had been a cost (advertising) into a rev stream (others advertisers paying them - assumedly) to be content in their game.

    I’ve never heard of Magnum ice cream, but I’ll look for it now. This is one area they could have improved this content: they should’ve worked their distribution channels into the content so I’d know where to look for their product.

    Hope this gives you some ideas for your group’s deliverable next week.

    Thanks,

    Tuesday, February 14, 2012

    improving browser reflow (rendering) performance

    Subject: improving browser reflow (rendering) performance

    • note: originally emailed 02/14/2012 and sanitized for public consumption
    • sidenote: posting here so i can lead people here whenever they ask me about this stuff...



    [Boss],

    To answer the question on why the android tablet was performing worse than the iPad, I took out the transparent animated images during the ‘spin’ to ‘fix’ the issue.  (This is probably why iPad didn’t support animated PNGs in the first place.)

    To understand why the rendering was bad and how to improve on 2D performance for the browser games we’re doing, last night I got a crash course about browser “reflow” behavior.

    In a nutshell: I was wondering if there was a way to stop the browser from re-drawing the page every time one element was being change.

    There is no ‘double buffering’ for the browser, but there is something close to it (DocumentFragment).  Meaning, that I would have to update/animate everything that is dynamic manually in the render/game loop.   The payoff is a (2-3x) performance improvement.

    I am going to restructure the current games to take advantage of this.  [XYZ] was re-rendering the pages 3 times an update using the animated PNGs and [ZYX] rotation.





    The following are resources to learn more about this:

    Here is an nice example of how a browser draws stuff to the page:

    Here’s some information on what the rendering path looks like on your typical browsers (in a easy to read format)

    If you want to know more (warning: VERY INDEPTH) about how browsers work:

    Monday, February 6, 2012

    [ data data data ]

    Subject: [ data data data ]

    • note: originally emailed 02/06/2012 and sanitized for public consumption
    • sidenote: posting here so i can lead people here whenever they ask me about this stuff...

    From: XXX
    the "need" for convenience
    I have learned a very important lesson about that phrase when a friend of mine told me this:
    "Me and computers are like a plugged in electric toaster in a bath tub full of water.  I am willing to pay extra for the added convenience of having something that just works.”


    Authenticity… trustworthy… 'to be treated as humans'
    There will always still be the need for anonymity, especially if you’re a parent with children trying to keep them safe from the crazies.


    I'm beginning to see a resurgent desire for simple, straightforward, lasting, superior items.
    Beginning?  This has always been the bane of internet browsing forever -- terse and obtrusive $#!t plastered all over the website.  How many web sites have you been to that was just too cluttered to use in the past 10 years -- flash heavy, ads spaces everywhere, pop up windows, "join/create a profile" overlays...

    I don’t surf web sites anymore.  I find them on RSS feeds or when they are mentioned on podcasts.

    I always use ‘adblock plus’ on my browser.


    I absolutely agree that simpler, cleaner and streamlined web sites are the future -- to bad marketing will do everything they can to screw that up.  I almost shed a tear when 'mobile' sites started showing up -- a simpler, cleaner and streamlined version of their desktop counter-part.  Too bad many of them are a little 'too simple/vague'.


    I don't know how many scripts I have to auto download web pages for me; snip the areas of interest I want; and collate all of the relevant data on a single page.  Too many web sites now want you to click through so many links to get the overall data, and most of them with extremely s.l.o.o.o.o.o.o.w response times.


    Will we ever have so much information online that people stop asking each other for recommendations (i.e. will we ever make an information filter that is as personal and reliable as another human)?
    I have learned a funny thing from another friend of mine:
    If there are no ads, who will tell me what to buy next?

    Now, you have to ask yourselves; are advertisers just as 'reliable' as another person?  I mean, they are done by people.  They are put up on TV, radio, print, whatever that are run by people.

    Many 'humans' use them as a 'source' for [ finding out more / talking about it ]. It would seem to me that information online is just the same.  A source to springboard off of to find out more information about it if it interests you.

    I always like to say:
    Having too much information is better than not having enough.


    I would like to close by also saying this; sometimes, information overload is perceived that way only because 'humans' are also very visual creatures.

    You can look at a ton of data (i.e. 'read' it) if you like to watch paint dry.

    Or you can 'watch' the data if it's been converted into a more palpable format.  Visualization (in computer graphics) is one of those exciting areas where art and design is merged in with the terse and bland 'data tables'.  One famous example of this is the visualization of flight path data.

    Some good books on this topic:

    I know there are more, I just don’t remember the titles to them off hand.

    [But,] here’s something cool I just ran into:
    http://www.blendernation.com/2012/02/08/blender-movie-winner-in-2011-science-visualization-challenge/


    Thursday, February 2, 2012

    Social Gaming

    Subject: Social Gaming

    • note: originally emailed 02/02/2012 and sanitized for public consumption
    • sidenote: posting here so i can lead people here whenever they ask me about this stuff...



    I haven’t done any FB apps, but I just ‘made’ a FB app following some dirt simple instructions.

    You can see it here:

    The ‘app’ is actually hosted outside of Facebook:
    • You can right click on (on the very right edge of the flash content and scroll bar, if you can) and see that it’s just an <iframe> (what Facebook is calling the canvas) pointing to the source of that asset.
      • You should see it open to: (or if you are having trouble getting the right click menu button to show the browser menu instead of the flash menu)

    So, getting stuff to show up on Facebook is easy.  The power comes when you want to do things like inviting/playing with friends, integrate with Facebook’s credit (payment system) and other features that tie into their API’s.

    For example, to look yourself up on Facebook’s API system:

    And using code facebook has provide at:

    You can, for example, fetch all of your friends:


    <?php
    require 'facebook-php-sdk/src/facebook.php';

    $facebook = new Facebook(array(
        'appId' => 'YOUR_APP_ID',
        'secret' => 'YOUR_APP_SECRET'
    ));

    $me = $facebook->api('/me/friends');
    /*
     * access all the information of friends
     * $me has the JSON detail of all the facebook friends of the current user
     */

    foreach($me['data'] as $frns) {
        $id = $frns['id']; /* make the echo statement a little easier to read */
        $name = $frns['name']; /* make the echo statement a little easier to read */
        echo "<img src="https://graph.facebook.com/$id/picture" title="$name" />";
    ?>



    There are much more terse ways to do this.  They are all found on Facebook’s developers docs:



    The following is where I got the dirt simple instructions from:


    So, to answer the original questions:
    • To Build FB games:
      • You can use whatever flash, unity or plain ol HTML assets you have.

    • To scale FB games:
      • FB punted on this and makes the developers host the content.
      • So, you will need servers for the (static) pages.
      • You will need more servers if you want to do things outside of the FB infrastructure.
        • Like what? May be like a [super awesome] mechanism that FB’s systems doesn’t provide.

    That’s all I got for a few of hours of research…

    Thursday, January 12, 2012

    HTML5 CSS3 and stuff

    Subject: HTML5 CSS3 and stuff

    • note: originally emailed 01/12/2012 and sanitized for public consumption
    • sidenote: posting here so i can lead people here whenever they ask me about this stuff...



    So, during the winter break last month – I just happen to be at the large brick n mortar book store that’s still around looking for that last minute gift selection.

    I wandered to the “computer” section as I always do and noticed a few new books on the shelf and proceeded to thumb through it.


    The first book that got my attention was the HTML5 Cookbook

    The next book: HTML5 Canvas


    The following book: HTML5 Applications wasn’t that great.  But it did tell me about me two other books:
    • Building Android Apps with HTML, CSS, and JavaScript
    • Building iPhone Apps with HTML, CSS, and JavaScript: Making App Store Apps Without Objective-C or Cocoa

    And those lead me to the Phone Gap project – now acquired by Adobe.  This is a path to develop native application via HTML5 + CSS3 + javascript code base.  The project is technically an open source project and can be found at Apache’s repository: at first called ‘callback’ – now called ‘Cordova’.


    Finally, some other goodies I happen to run across:
    • The Book of CSS3: A Developer's Guide to the Future of Web Design
    • JavaScript: The Definitive Guide: Activate Your Web Pages (Definitive Guides)


    Anyways, here’s a collection of must have bookmarks:


    There are a lot of other HTML5 books out there:

    And, with some high profile acquisitions:

    This stuff is becoming more and more mainstream.





    Sent: Thursday, October 13, 2011 4:19 PM

    I forgot to add the following

    If you are familiar with Visual Studio’s Debugger, then you are going to feel right at home with the firebug plug-in for firefox:
    • http://getfirebug.com/doc/breakpoints/demo.html
      • Break on all errors (such is unknown function or variable names), equivalent to compile time error
      • Break on attribute or DOM property change – equivalent to VS break on watch point change
      • You can even break on CSS style rule changes
      • It has watchlists
      • Setting breakpoints
      • It also has a runtime profiler (and quite nice too)
      • And even a memory profiler (just as nice)
      • Finally, a network profiler
      • which didn’t work so well when flash inside of a flash file were making raw network calls
      • but if you use standard HTML request, it spells out everything your browser is doing (except for websocket calls – hopefully, it will be supported in future releases)

    The only other negative thing I ran into is that it doesn’t trip on syntax errors (because the file never gets “loaded” to the browser, so firebug doesn’t know about it) – but you can use JSlint for something like that

    And I forgot to add this for supported browsers:
    • Chrome 14



    Sent: Wednesday, October 12, 2011 3:27 PM

    Since I’ve been diving into the world of HTML 5 CSS3 and javascript, I figure that I share some of my findings.


    Note: make sure you’re running at least:
    • Sarafi 5.1
    • Firefox 7
    • IE 10 (which isn’t out yet)

    Browser technology has come a long way.  Take a look at the following:
    CSS3 is supposed to be “hardware accelerated” which I can only guess it means that it builds GPU instructions from the baked set of styles.

    Javascript has to run on the CPU.  CSS are normally not changed after it is set.  So it gains a lot from deterministic values.


    Anyways, here’s another cool demo:
    • www.idangero.us/cs/
    • The package is a product, so this one requires licenses
    • But it shows what a little bit of CSS and javascript together can make

    Here’s a pile of “best-of”:

    For a little crash course on HTML5:

    Enjoy! -- Nick

    Tuesday, June 21, 2011

    http_fun_with_telnet

    Subject: http_fun_with_telnet
    note: originally emailed 06/21/2011 and sanitized for public consumption



    This message [will help explain how] to speak HTTP via a TELNET session.

    But, figured that I email this to everyone else -- just in case anyone might find something interesting in this little tid-bit.


    If you have your own web server, you can test it like this:

    telnet 80
    i.e. telnet google.com 80

    The command prompt window screen should be cleared after the command is typed in.

    NOTE: the following commands (including the blank line) will not be echoed...

    Just copy (both lines between the dashed markers) and paste it in your command prompt.
    -- get page --
    GET / HTTP/1.0

    -- end commands --

    This should return the index page of the web server you contacted.

    Here's how to JUST get the header response from the web server:
    -- get page --
    HEAD / HTTP/1.0

    -- end commands --

    For the rest of these tests, using this simple PHP code -- we're going to understand how POSTDATA and data in-lined with GET are handled:

    -- http_fun_with_telnet.php --
    <?php
        if(empty($_POST))
            echo "No GET or POST variables found";
        else {
            echo "POST variables:";
            print_r($_POST);
        }
    } else {
        echo "GET variables:";
        print_r($_GET);
    } 
    ?>
    -- end of file --

    In your browser, go to:
    http:///http_fun_with_telnet.php
    http:///http_fun_with_telnet.php?item1=value1&item2=value2
    Note what was printed in the browser.



    Now, on the command prompt:
    telnet 80
    Retrieve the manually to make sure things are working:
    -- get page --
    GET /http_fun_with_telnet.php HTTP/1.0

    -- end commands --


    [Let's try] again:
    telnet 80
    [This time] with in-lined GET data embedded in the URL (just like the second browser link above):
    -- get page --
    GET /http_fun_with_telnet.php?item1=value1&item2=value2 HTTP/1.0

    -- end commands --


    Now for the fun [part], again:
    telnet 80
    [To] retrieve the page via POST – NOTE, no data is embedded in the URL fetch:
    -- get page --
    POST /http_fun_with_telnet.php HTTP/1.0
    Content-Type: application/x-www-form-urlencoded
    Content-Length: 25

    item1=value1&item2=value2
    -- end commands --
    The "25" is the string length of the last line.

    Yes, you need to feed the POST data size to the web server before sending the data.

    Content-Type and Content-Length are the 2 minimum required headers you need to send to the web server in addition to the fetch line.

    It is possible to send binary data in POST and only POST.  This is how you upload photos and stuff to a web server.  But that’s for another post…


    That’s all I have for simple HTTP fetching…

    P.S. did you know SMTP (simple mail transfer protocol) works kinda like this too?


    So, now [you can see] how easy it is to craft your own HTTP [request headers] to [talk to] your web scripts hosted on your server.

    Have fun! -- Nick Shin

    Sunday, October 18, 2009

    Captured! By Robots


    yesterday, i went to see a show. a one man -- er, one meat bag band. i see a few others, but don't normally go out of my way to watch em unless i know the members directly. like the band my brother's in [ ZeroStars ] or the ones a few of my buddies are in [ Even Bigger ] and days past [ Skagina ].

    but yesterday's show was interesting. normally, music to me is like TV. i can either watch it while learning something new, leave it running on the background if it's not that important for my undivided attention or skip it while trying to find something i like. let me rephrase that. music to me is:
    • not my salvation
    • doesn't compel me to save the { flavor of the day }
    • help feed { some kind of meat bags }
    • or move me to { tears or rise against the masters}
    the news in general does that quite nicely for me. (although, i do need to get some of that overseas to get the full picture...)

    so, it was ironic when i watched the movie "Almost Famous" and remembered the line:
    "They don't even know what it is to be a fan. Y'know? To truly love some silly little piece of music, or some band, so much that it hurts."
    Sapphire - Almost Famous
    it was at this moment, that it dawned on to me that some people (crazy music fans) think like this. it seemed that this also applies to sports, games, cars, whatever. i just never thought of it in terms as the center of the universe.

    anyways, back to the show. i was asked if it was a life changing experience. "uh....", i started. that's was when i forgot about how music people thinks.

    i mean, really, the show was vastly different from the ones i have seen before and was more interested in antics, gizmos and gadgets than the songs. but i was happy. happy when meat bag said, "doing covers is the new punk" - happy when donkey kong (or some kind of motor-vational ape) was on stage - and happy when DRMBOT-0110 was doing 256th (could have been 29 for all i know). it also seemed that GTRBOT-666 was only using one string for bass - but was not as pretty or as head-banging with long flowing blond hair and other generous sized proportions as the bassist (forgive me for not remembering your band's name...) who played before them.

    while i'm more about video games than anything lately -- i really didn't care about the beatles rockband game announcement earlier this year:
    Beatles to re-release catalog alongside The Beatles: Rock Band
    Apr 8th 2009
    but totally dig this music video - video games related music video:

    via: destructoid.com 07.11.2009
    Attack of the Show celebrates 1,000 shows


    doh... i still want to hate that channel... or, is it time forgive...