Behavior, Content, Money – 3 Things you should never give away for free!!!

BCmoney MobileTV

Making a Rock-Paper-Scissors game Multiplayer

Posted by bcmoney on March 16, 2017 in Java, PHP with No Comments


No Gravatar

Multiplayer features require networking capabilities of some sort, and typically, a form of persistent data storage (i.e. to save things like “Leaderboards” to keep track of Wins/Losses/Draws in the case of our RPS game).

Integrate PHP based SOAP RPS game server in another language, JAVA desktop GUI

Posted by bcmoney on February 23, 2017 in Gaming, Java, PHP, Web Services with No Comments


No Gravatar

Rock-paper-scissors chart

Rock-paper-scissors chart (Photo credit: Wikipedia)

Now that we have a Web Service ready to consume (even though it is SOAP based), it should be pretty easy to extend to Java, which also means it should be possible with a little bit of effort to create a Desktop GUI.

For more on creating a Java-based SOAP server to have an all-Java version of this solution, see:
https://netbeans.org/kb/docs/websvc/jax-ws.html

 

 

See the other parts here:

Animations on the web – Applets .vs. Flash .vs. SVG .vs. setTimeout .vs. jQuery.animate .vs. requestAnimationFrame .vs. CSS3 animations

Posted by bcmoney on October 23, 2014 in CSS, Flash, Java, JavaScript, Multimedia with No Comments


No Gravatar

In a follow-up to my prior article on Interactive Graphics on the web from a few years back, today I’ll be looking a bit closer at the latest Animation options on the web.

Animations have always been the specialty of Flash and before that pioneered by Java Applets on the web, but with the introduction of HTML5 and CSS3 things are sure changing fast!

This post is a quick round-up of the leading approaches to do something that a decade ago when I was first learning to develop I would have had trouble believing were even possible without a plugin/tool like Flash or Java. That is to simply move a box around through animation, moving it from left-to-right (but could be any direction) across the screen perpetually within a user’s browser, with simple controls to control the starting and stopping of the animation.

Java Applets

Historically the first (and back then pretty much only) way to accomplish your dynamic and interactive content needs, Java Applets offered the ability to code “Rich Internet Applications” in Java, similar to what it could already do on the Desktop via AWT GUIs, but run them on the web in the user’s browser client.

-or-

This loses alot of marks because of the sorry state of Java plugins and security issues since Oracle took over from Sun Microsystems and seemingly de-prioritized Java’s RIA features in favour of backend and enterprise parts of the stack which have a closer potential tie-in to its database and related products/services. Its also more cumbersome as it depends on the Java Runtime Environment (JRE) being installed to work, along with a Java browser plugin (IcedTea for OpenJDK or JavaWebStart for Sun/Oracle) so it would not work on a majority of mobile devices without rooting the device and layering in Java support (if even possible – depending on device type it may not be).

Many legacy devices do run Java Mobile/Micro Edition (JME) already, but the average user would have trouble even with some of the installer tools out there. Users also grow tiresome of the constant updates, warnings and security concerns that Applets present in the browser. Java in the browser lives on in the form of JavaFX and JNLP app launchers, but Applets are on their way out slowly but surely.

Score: 2.5/10 (I recall being wowed when I first saw dynamic and highly interactive content being rendered by Java, but have to admit the web has changed a lot since the 1990s).

Flash

Shortly after the debut of Applets, Macromedia launched their web-version of Shockwave (later Flash). Flash used a concept of “Motion tweens” where you basically draw out by hand the path that you want the animation to take, and the Flash plugin/player takes over and renders the desired motion path on your graphic objects, the desired number of times (or endlessly on a cycle).

-or-

This can be quite performant on Desktop devices that have the Flash plugin installed and enabled (most Computer browsers at this point in time), however not so much on Mobile devices. Also, thanks to Steve Jobs’ infamous statement that he’d never allow Flash on the iPhone due to its known security and performance issues on mobile (FlashLite), it may never be the case that you can rely on Flash to hit a majority of mobile browsers. This could still be a decent option however, if you’re already invested heavily in the Flash stack and/or Flex framework for your multimedia needs, and are ok focusing on Computer users. With Flash suffering pretty much as many security issues of late as old school Java Applets, I’m guessing most Developers are rejoicing with the other options emerging.

Score: 3/10 (I also have fond mostly painful memories struggling to get my first “motion tween” working in Flash Studio 2004; again, the web is moving to more built-in options for animation needs as we’ll soon see, but for a quick one-off this is still a viable option for a few more years, as long as you don’t need to support iPhone users).

SVG

Scalable Vector Graphics (SVG) is one of the up-and-coming mechanisms for multimedia on the web. I recall when it was initially being pushed by W3C in the early 2000s, but at that time, you needed a dedicated browser extension just to render the SVG. Later, JavaScript cross-browser polyfills and libraries like Raphael.JS, Processing, and D3 emerged which built heavily on SVG (or supported it as a primary export format).

The

https://output.jsbin.com/bubabil

Score: 4/10 (I also have fond mostly painful memories struggling to get my first “motion tween” working, again, the web is moving to more built-in options for animation needs)

setTimeout

This approach in vanilla JS uses a combination of “setTimeout” and “clearTimeout” (along with a helper “global variable” you can’t really get around).

-or-

The problem is that first of all its fairly obviously laggy due to rounding errors in the calculation of nanoseconds (basically the timer is leaky and gets compoundingly inaccurate the longer it runs); but worst of all, if left running in an idle window too long it can become even further janky, jump all over the place, and consume too many resources causing the Tab to crash. This is not a viable animation option unless you are detecting the “active” state of the browser client to ensure the animation is only played when the user is actively on the page and interacting within the desired content regions such that its worth showing the anitmation. Even then, there’s no guarantee it will work equally well across Mobile and Desktop browsers.

Score: 5.5/10 (cool idea that it’s possible, but not the best approach for serious uses)

jQuery.animate();

This is probably the leading go-to answer if you ask StackOverflow, as usual, the Dev community seems to prefer to hand-off the cross-browser edge cases to jQuery which “usually” performs reasonably well. This makes sense, why reinvent the wheel? In this case though, this solution too will lead to jankyness if you leave it running over longer periods of time, but not nearly as wildly as the first setTimeout example without jQuery, as jQuery’s $.animate() doesn’t suffer from the same nanosecond rounding errors as setTimeout does.

-or-

Score: 7/10 (convenient enough, but still not even close to the best performing approach)

requestAnimationFrame();

This is the new HTML5 + JavaScript option that was previously not available. Depending on your target browsers, you may want to check its availability, but its shipping in Firefox, Chrome, Safari and even IE 10+ now, so it should be ready for prime time!

It performs better because it uses purpose-built animation APIs rather than relying on the single client-thread’s timer to continue running and stay accurate, or, and cludgy browser workarounds and approximations that attempt to overcome this with the jQuery.animate() approach.

-or-

The only downsides here, is that for now, its still a bunch of extra code to ensure you’re covering all the browsers with cross-browser vendor prefixes, other than that its fairly smooth and fluid, handily beating both the vanilla JS setTimeout and jQuery.animate optons.

Score: 8.5/10 (convenient enough, but still not even close to the best performing approach)

CSS3 Animations

Last, but certainly not least, what I’m probably most excited about is CSS3 Animations, natively within the browser… I mean how crazy is that?! This stuff would have been unheard of a few short years ago.

-or-

Ok so while not totally 100% CSS3 only, we need at least a tiny snippet of JS just to control the currently active class based on the desired state of the animation, toggling the starting of the motion through a class called “running” being added, and stopping of the motion through a class called “paused” being swapped out instead. Still, I found this pretty impressive once I realized the possibilities of CSS3 Animations & Transitions… the future will be interesting.

Score: 9.5/10 (I might be biased on this one, but I’m blown away by the fact this can now be done in CSS!)

Just to be comprehensive I’ll at least mention there’s also other options like Animated GIFs, VRML/X3D, Canvas, JavaFX, Flex, Silverlight, Unity, and even WebGL; but for practical animation needs, and programmatic access to control the animation, those listed above are the most accessible and sensible options for developers today.

Will the real Developers please stand up!

Posted by bcmoney on February 26, 2014 in Java, Mobile with 1 Comment


No Gravatar

Graphite, on tan wove paper, laid down on comm...

Early “Standing Work Desk” (Photo credit: Wikipedia)

In my industry of IT (and indeed all Technology jobs in general), it is extremely easy to develop unhealthy and border-line self-destructive habits. From staring at a screen for too long to bad posture slouching over a keyboard, and from tendonitis in the wrist due to bad hand/wrist joint alignment to forgetting to stand up regularly in order to keep the blood circulating; these are just some of the many common pitfalls of being a developer, engineer or technologist of any kind. Furthermore, in our digital society, these now also apply almost equally to the majority of other professions as almost everyone has to use a computer or electronic device of some sort in their line of work today. Compounding this even more is the fact that once we get home, we are often interacting with more and more computers and devices (interface in our cars, on mobile phones, TVs, personal computers, tablets, etc). It’s not too surprising that digital overload is a major trending health concern in the 21st century.

Recently, if only in the interest of self-preservation, I’ve become extremely interested in the growing Fitness movements online to take one’s health back from the digital distractions and electronic that seek to steal it away. What started out innocently enough (yet often times insulting/disgustingly/self-deprecatingly enough) with Reddit’s Fitness discussion thread has now grown into an experiment with several different Fitness Tracking, Calorie Counting and Nutrition Planning tools, as well as keeping track of any ailments or injuries that cropped up during my training using Patient-to-Patient Networks and related resources. At this point I had not yet gone full “Fit Geek” yet, as I wholeheartedly rejected one of the primary driving forces behind this so-called “Fit Geek movement”; namely, the “wearable gadgets” fitness technology category. I knew things were really starting to get out of hand though, when my own mother got into said technocratic gadgetry craze by purchasing a FitBit ONE which is basically a Pedometer, Heart Monitor, Sleep Analyzer and Watch/Timer/Stopwatch all in one, complete with a secured Web 2.0 style RESTful API to allow you to access your personal Fitness Activity data.

So, not to be outdone by my own mother, I finally decided to crack and give this fit tech thing a try (stubbornness and rejection of mainstream trends/agendas aside, I really do need to know about this health & fitness technology stuff at a deep level since I believe it will be tightly entwined with my career in Health IT). Not being exactly sure what I was looking for, and at the same knowing I didn’t want to put much time, money or effort into this investigation initially, I decided to take up Nintendo on their offer of a free downloadable copy of $59.99 Wii Fit Plus for people who already had the Wii Balance Board that came with previous versions of Wii Fit who purchased the WiiU FitMeter before January 31st, 2014. Sadly, if you’re reading this, you’ve missed that deal; but I can tell you that I’ve been pleasantly surprised about the ease of use and convenience of using the FitMeter to track your distance walked/jogged/run/skied/biked and a rough estimate of the total calories burned from that basic activity.

Read the rest of this entry »

The Getting Started in JAVA Guide (That I Wish I Had In University)

Posted by bryan on September 24, 2012 in Java with 5 Comments


No Gravatar

History Language Installing Examples
Compiling Running Programs IDEs
Java (programming language)

Java (programming language) (Photo credit: Wikipedia)

The Java programming language is one of the most widely used and widely supported programming languages in the world (in terms of total number of devices and systems running it). Since its inception, it has also been the subject of several major lawsuits (i.e. Oracle .vs. Google, Google .vs. Oracle countersuit,  US Gov .vs. Microsoft, Apple .vs. Android OEMs – Samsung, Motorola, HTC and  Sun .vs. Microsoft) due in no small part thanks to its aforementioned widespread use in just about every major device from mobile phones to back-end server infrastructure and from individual desktops/laptops to large-scale distributed computing grids (like Amazon’s AWS & EC2).

Java didn’t set out to be a better C for every programmer, and in fact had an identity crisis early in its life. It started out in 1991 as a language called “Oak”, part of a small project called the “Green Team” initiated by Patrick Naughton, Mike Sheridan, and James Gosling, who is primarily credited with the design of the language that became Java. (Bryan Youmans has a page on the history of Java, with some interesting thoughts on the language design. There’s also an official version of the history from Sun/Oracle.)

Read the rest of this entry »

BC$ = Behavior, Content, Money

The goal of the BC$ project is to raise awareness and make changes with respect to the three pillars of information freedom - Behavior (pursuit of interests and passions), Content (sharing/exchanging ideas in various formats), Money (fairness and accessibility) - bringing to light the fact that:

1. We regularly hand over our browser histories, search histories and daily online activities to companies that want our money, or, to benefit from our use of their services with lucrative ad deals or sales of personal information.

2. We create and/or consume interesting content on their services, but we aren't adequately rewarded for our creative efforts or loyalty.

3. We pay money to be connected online (and possibly also over mobile), yet we lose both time and money by allowing companies to market to us with unsolicited advertisements, irrelevant product offers and unfairly structured service pricing plans.

  • Archives