William Mora

SlidingTabs Android Library

This library project is on GitHub.

With the release of Android Studio 1.0, one of the things to notice is that there's an option to import an Android code sample. All these samples are available on GitHub/googlesamples.

Snackbar Android Library

This library project is on GitHub along with an example app.

Google's Material Design documentation introduces a new component used for quick feedback called Snackbars. The document describes them as follows:

OpenFeed - Android L Twitter Client with RecyclerView and CardView Widgets

With Google's announcement of the new version of Android (codename L) last month. I installed the preview SDK on my Nexus 5 and all of my apps worked pretty good except for Twitter which would not even open.

Up in the Air

Since I decided to join one game a month, I need to come up with new ideas. Having the world cup this time around, I put myself in "hackathon mode" and developed Up in the Air over a weekend. It's very simple (yes, even more simple than Martian Run!) but I really had a lot of fun playing around with the physics involved.

In case you are wondering, the game is done with libGDX.

Hope you like it!

I'm Joining One Game a Month!

After finishing my last game, Martian Run!, I am feeling inspired to keep working on small games. For that, I decided to join One Game a Month. I really hope to get some XP! :D

Here's my profile. Martian Run! is already submitted.

LibGDX Tutorial - A Running Game with libGDX - Part 5

Check out part 1 for the project and world setup! Check out part 2 for implementing controls for our runner! We introduced our enemies on part 3. We rendered our background and ground on part 4.

Remember the code is on GitHub. Graphics were made by Kenney. Also, a final version based on this tutorial is on Google Play.

LibGDX Tutorial - A Running Game with libGDX - Part 4

Check out part 1 for the project and world setup! Check out part 2 for implementing controls for our runner! We introduced our enemies on part 3.

This is part 4 of a tutorial on writing a 2d running game. Remember the code is on GitHub. Also, a final version based on this tutorial is on Google Play.

LibGDX Tutorial - A Running Game with libGDX - Part 3

Check out part 1 for the project and world setup! Check out part 2 for implementing controls for our runner!

This is part 3 of a tutorial on writing a 2d running game. Remember the code is on GitHub. Also, a final version based on this tutorial is on Google Play.

LibGDX Tutorial - A Running Game with libGDX - Part 2

Check out part 1 for the project and world setup!

This is part 2 of a tutorial on writing a 2d running game. Remember the code is on GitHub. Also, a final version based on this tutorial is on Google Play.

LibGDX Tutorial - A Running Game with libGDX - Part 1

I've always liked 2d running games. When I first got an Android phone, I played iRunner for hours, and at the time I seriously wanted to develop a game like that. A lot of time has passed since but I finally had the time to put together a simple, running game using libGDX. A final version based on this tutorial is on Google Play.

LibGDX is one of the nicest projects I've followed over the past few years and when I began looking into different video game development frameworks, it was definitely the one that provided the most features and provided the best performance for my then crappy phone :). If you have time, I recommend reading its creator's post on releasing version 1.0.

Angular Espresso - AngularJS, CoffeeScript and Express

UPDATE: This post is now outdated. Check out the project's git page for the latest info on Angular Espresso.

AngularJS is a powerful framework maintained by Google. I started playing around with it a few weeks ago and I think it is great for developing web apps. If you are a used to using jQuery for DOM manipulation and/or your views' logic, you'll have to change your approach and change the way you write dynamic views. Best of all, AngularJS is more than that: you could also have models, controllers, services and use partial views to develop a true, behavior-driven web app.

The AngularJS team has an angular-seed project that is very useful as a starting point for an AnglarJS app. There's also an extension of that project that integrates Express with AngularJS.

Node.js Tutorial - Building a Chatroom with Express.js + Socket.IO

In this tutorial we'll see the basics of creating a Node.js project with two of its most popular modules: Express.js and Socket.IO. We'll build a simple chatroom from scratch, like those from the early Internet days :P.

The final code is on GitHub, here's the link.

Requirements

We are going to be building the project from scratch, so the only requirement is that you install, of course, node and npm (if not included with node). Also, I assume you know JavaScript. If you don't, I totally recommend JavaScript's track at Codecademy.

Creating a Project

Create the folder where we'll have our project, we'll be working from here from now on.

In Node, we don't really create a project with a specific folder structure, but create an app file instead; that is, the file that will be executed as the node application. You may name the file as you want; in most of the projects I've seen it named either app.js or server.js. Since we'll be building a web server, let's go with server.js.

Learning CoffeeScript

Since there's so much fuzz about CoffeeScript these days, I thought it would be nice to cover the basics of the language and publish it on GitHub. You can take a look at it and share your thoughts in the comments section. The repo is a work in progress.

Repo: https://github.com/wmora/learning-coffeescript

See the README.md section for more details.

SpinnerSimpleDateModel

Here is the code for a JSpinnerModel that handles Date objects in simple format (e.g. 'dd/MM/yyyy'). It extends a SpinnerDateModel so most of the code is based on that class. This class assumes that values are separated by a slash (/). The reason why I created this was based on a client's requirement where I could only display the date in simple format and select the calendar using a JSpinner:

Installing Oracle Application Server 10g on Windows Server 2003 SP2

If you try to install the Oracle Application Server 10g (9.0.4) on a Windows Server 2003 SP2, you may encounter an error when the installer tries to configure the OC4J instances with the following:

Deploying application 'ADFBCManager' to OC4J instance 'home'.
FAILED!
ERROR: Caught exception while deploying 'ADFBCManager' to 'home':
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at oracle.j2ee.tools.deploy.Oc4jDeploy.doDeploy(Unknown Source)
at oracle.j2ee.tools.deploy.Oc4jDeploy.execute(Unknown Source)
at oracle.j2ee.tools.deploy.Oc4jDeploy.deploy(Unknown Source)
at oracle.j2ee.tools.deploy.Oc4jDeploy.main(Unknown Source)
Caused by: com.evermind.client.orion.AdminCommandException: Deploy error: deploy failed!: ; nested exception is:
oracle.oc4j.admin.internal.DeployerException: Error initializing ejb-module; Exception Error in application ADFBCManager: Error loading package at file:/C:/oraOAS10g/j2ee/home/applications/ADFBCManager/bc4joembean.jar,
Error compiling C:\oraOAS10g\j2ee\home\applications\ADFBCManager\bc4joembean.jar: Syntax error in source
at com.evermind.client.orion.DeployCommand.execute(DeployCommand.java:90)
at com.evermind.client.orion.Oc4jAdminConsole.executeCommand(Oc4jAdminConsole.java:139)
... 8 more
...

Duplicate Oracle Constraints

If you have ever used the Oracle import utility, your database has system generated constraint names (ex: SYS_C00641321), and you did not specify CONSTRAINTS=N during the import then chances are you have duplicate constraints for pretty much every constraint except for any PRIMARY KEY, FOREIGN KEY and user generated constraint names. I recently stumbled upon a database that had performance issues and one of the things I noticed was that almost every single constraint was repeated up to 10 times. Most of the duplicates were NOT NULL constraints, which is kind of expected since people tend to create NOT NULL constraints anonymously such as the following:

CREATE TABLE tab1
(col1  VARCHAR(2) NOT NULL,
col2  VARCHAR(30) NOT NULL);

That statement will create 2 NOT NULL constraints with a system generated name (ex: SYS_C00641322 and SYS_C00641323). If the schema that owns that table is exported and then imported to another schema, it will create two additional NOT NULL constraints since it recreates the table running the exact same command shown above. That could be prevented by having user generated constraint names:

Password Case Sensitivity in Oracle 11g

Oracle 11g now sets the password case sensitivity setting to TRUE by default. If you are running any application that connects to an earlier version of an Oracle database, chances are you are sending the connect string in all caps within the application (ex: USER/USER@ORCL11G when it really should be user/user@orcl11g). Make sure you are aware of this when developing your app and if the case is that you want to have case sensitive passwords, use double quotes to enclose the password string (ex: USER/"user"@ORCL11G). To disable password case sensitivity, just change the value of the system parameter sec_case_sensitive_logon:

alter system set sec_case_sensitive_logon = FALSE;

Where FALSE disables password case sensitivity and TRUE enables it.

Cheers!

Running an Oracle Forms Applet on Windows 7

I was trying to run my application built in Oracle Forms and Reports on a new laptop with Windows 7. However, when running the Java forms applet, the applet’s graphics stayed frozen and I was not able to see my application properly.

This problem is caused due to the graphics card running on the computer running Windows 7. To run certain applications, Windows 7 must change its theme back to Windows 7 Basic (I believe it was the same issue with Vista). So, basically, the graphics card is too much for the Java applet to handle.

SQL: Exists Condition

The SQL EXISTS condition is a boolean function that returns true if the condition is met. The syntax is pretty simple:

SELECT * FROM TABLE WHERE EXISTS(_subquery_);

Alternatively, you can use NOT EXISTS(_subquery_). An example of the function is the following:

SELECT utc.table_name    
 FROM user_tab_cols utc     
 WHERE utc.column_name='ACCOUNTID'
 AND NOT EXISTS(SELECT uc.table_name     
   FROM user_constraints uc     
   WHERE uc.table_name=utc.table_name     
   AND uc.r_constraint_name='SYS_C00229824')     
   ORDER BY utc.table_name;

The query looks for all the tables that contain the column ACCOUNTID and from those tables, only get the ones that don't make reference to the constraint SYS_C00229824.

How to Modify Swap Size - Ubuntu 10.04

When installing Ubuntu, I was never asked about the desired size for my swap size. Oracle recommends to use at least 2GB of memory in order to create a database, let alone run it. With help from this excellent post from LinuxReaders, I expanded my swap size to 2GB (again, Oracle's recommended size for 11g) by executing the following:

$ dd if=/dev/zero of=/tmp/swapfile bs=1MB count=2048
2048+0 records in
2048+0 records out
2048000000 bytes (2.0 GB) copied, 36.257 s, 56.5 MB/s
$ mkswap /tmp/swapfile
mkswap: /tmp/swapfile: warning: don't erase bootbits sectors
       on whole disk. Use -f to force.
Setting up swapspace version 1, size = 1999996 KiB
no label, UUID=aa8617a8-9500-498e-90da-f5164190ad00
$ sudo swapon /tmp/swapfile

Change Screen Brightness From Terminal (Ubuntu 10.04)

If you want to change the screen brightness in Ubuntu (I can’t change it using the keyboard shortcuts or the Ubuntu Power Management menu), open a terminal and execute the following:

sudo setpci -s 00:02.0 F4.B=xx

Where xx is the desired brightness in hex ranging from 0 (brightest) to FF (no brightness at all). I usually change it to CA when working on battery.

Cheers!

What This is About

Hello!

Random tech tips, thoughts, etc.

You can follow me on Twitter @_williammora

Enjoy!