Started Development of a Collapsible Frame Qt Widget

5. May 2012 22:14 by Cameron in C++, Qt  //  Tags: , ,   //   Comments

Today, I started development of a collapsible frame Qt widget. I needed a widget that could show/hide its contents by clicking on an open/close button but couldn't find a solution online so I decided to create my own. The code is still a work in progress, but the basis of the code involves the use of nested layouts to achieve the hide/show effect. I had to write a custom clickable label class and subclass QLabel as QLabel doesn't have a clicked() signal. I'm using style sheets to apply the icon to the QLabel so that it has the correct image based on open/close and hover over states. The code is available on github under the Apache 2.0 license. Feel free to check out the code and see if you'd like to fork it yourself and contribute.

https://github.com/pcmantinker/Qt-Collapsible-Panel

Neo4j and SQL Server 2008 R2

Lately, I've been researching graph databases (NOSQL) as an alternative to traditional relational databases. The performance increase from a graph database compared to a relational database is phenomenal. To get my website rolling, I'm planning on using SQL Server 2008 R2 with the Microsoft Entity Framework. Once the data models are in place, I can then work on writing a SQL to graph database server application for migrating my data model into a graph database. There are several .NET libraries available for interfacing with Neo4j's REST API and the data migration should be trivial. My database migration tool will consist of using the Entity Framework to connect to SQL Server 2008 R2 and one of the .NET frameworks for manipulating Neo4j's REST API. I'll continue to post updates as they become available.

Qt Cross Platform Notification System

25. March 2012 16:30 by Cameron in C++, Qt  //  Tags: , , , , ,   //   Comments

I've been working on a cross-platform notification system built on Qt which is modeled after Mac OS X's Growl notification system. This is for use in a project that I'm currently working on. You may view the source code here: https://github.com/pcmantinker/Tray-Notification-System

I am still playing around with the window flags for the notification system as sometimes when a new notification is shown, within the Windows operating system, it steals focus from full screen applications. If you have any suggestions, feel free to let me know in the comments. Also, feel free to fork my repository and contribute to the code base if you're interested.

Unity 3D Game Project

5. March 2012 13:11 by Cameron in Programming  //  Tags: , , , , , , , ,   //   Comments

This semester, at Louisiana State University, I'm taking a video game design class and our goal is to make a 3D stereoscopic game using the Unity 3D engine. I'm working with a group of students from the University of Illinois at Chicago and one other member from LSU. So far, it's proven to be a very interesting class. We've pitched our storyboard ideas in front of our peers and our professors to get a good sense of what we should do next. Ultimately, we decided on doing a hang gliding game influenced by the PilotWings series. I have always loved the Pilot Wings games and I can remember the hours of fun I used to have playing PilotWings for the SNES. Today, I have Pilot Wings Resort for the Nintendo 3DS and thoroughly enjoy the game play. Our game, while having some similarities to Pilot Wings, will be unique and have its own twist. We're still working out all of the logistics of the game play, but we have some good ideas thus far.

I've been focusing on simulating hang glider flight physics using Unity 3D's physics engine and later I will help with composing the soundtrack of the game. I've setup a prototype of the game where the player is positioned in the middle of a canyon and has the ability to tilt left and right as well as climb and descend. I'm still working on making the movement more fluid, but the basic concept of flight is represented in the prototype. My colleagues are working on randomizing the terrain and managing the world objects for powerups and obstacles.

Once we have a presentable prototype, it will be fun to compose the soundtrack for the game. I've been playing piano for the past 15 years and I love to compose my own music. Some of the songs I compose are strictly solo piano while others have multiple parts to add depth to the sound.

I will keep this blog updated as more progress is made on the game project front. I'll also be sure to upload some images of the prototype at some point.

Qt Application Development in Mac OS X Lion

1. February 2012 01:52 by Cameron in Qt, Mac OS X, C++  //  Tags: , , , , ,   //   Comments

I've been working on some code using the QtSDK lately and I've been researching how to deploy applications for Mac OS X 10.6 and above. Luckily, it's pretty simple to deploy applications as the QtSDK includes a tool called macdeployqt. The tool copies all required Qt frameworks to the app bundle and re-assigns the library reference paths for the app to use the libraries within the app bundle and not the user's system directory (/usr/lib). It doesn't copy 3rd party libraries that aren't in the /usr/lib directory so you will have to manually add those.

Please note that macdeployqt on Qt 4.7.x doesn't seem to assign the correct library paths when linking against QtWebKit. This is a known bug that was fixed in Qt 4.8.0.

Also, if you want to insure that your app will not have problems on Snow Leopard, be sure to add this to your .pro file: 

macx:QMAKE_MAC_SDK=/Developer/SDKs/MacOSX10.6.sdk

This tells Qt to use the Snow Leopard SDK instead of the Lion SDK. If you build your application with the 10.6 SDK, it will work with Mac OS X 10.6 or higher.

One last thing is that there seems to be a problem with Xcode 4 and Qt Creator not being able to find g++-4.2 which is installed with older versions of Xcode. A work around for this until a new version of Qt Creator:

sudo ln -s /usr/bin/g++ /usr/bin/g++-4.2

sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2

I hope this helps anyone experiencing the same issues.

 

EDIT:
As of the February 1, 2012 QtSDK update, it appears as though the problems with g++ and using macdeployqt have been fixed. Please be sure to update to the latest SDK release. 

Convert JavaScript Escaped Characters to HTML/XML Entities

11. January 2012 01:44 by Cameron in javascript  //  Tags: , , , , , ,   //   Comments

Recently, I needed a way to convert JavaScript escaped characters to HTML/XML entities for saving files in UTF-8 encoding without saving the special characters to disk. Luckily this was pretty easy. I used JavaScript's built-in function escape() to escape the input text and used regular expressions to find each escaped value and replace them in the input text with their new HTML/XML entity equivalent. For example, the text "Copyright Some Company ©" would escape to "Copyright%20Some%20Company%20%A9" using JavaScript's built-in function escape(). After converting the escaped characters to entities, the result would be "Copyright Some Company ©". When saved in a database and rendered as HTML to a webpage, it would display the original message "Copyright Some Company ©". Here's the code for anyone interested:

// convert escaped characters to html/xml entities
function normalizeText(text)
{
	// escape text for special characters
	var esc = escape(text);
	var simpleCharsRegex = /%[0-9A-Fa-f][0-9A-Fa-f]/g;
	var specialCharsRegex = /%u[0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f]/g;
	var simpleCharsMatch = esc.match(simpleCharsRegex);
	var specialCharsMatch = esc.match(specialCharsRegex);
	if(simpleCharsMatch!=null)
	{
		for(var i = 0; i < simpleCharsMatch.length; i++)
		{
			var temp = simpleCharsMatch[i];
			simpleCharsMatch[i] = simpleCharsMatch[i].replace(/%/, 'x') + ';';
			esc = esc.replace(temp, simpleCharsMatch[i]);
		}
	}
	if(specialCharsMatch!=null)
	{
		for(var i = 0; i < specialCharsMatch.length; i++)
		{
			var temp = specialCharsMatch[i];
			specialCharsMatch[i] = specialCharsMatch[i].replace(/%u/, 'x') + ';';
			esc = esc.replace(temp, specialCharsMatch[i]);
		}
	}
	return esc;
}

I understand there may be a more efficient way to do this, but this code does work in a pinch. Please let me know in the comments if you have any suggestions for improving this code.

Beginning Desktop Client for IGA

2. January 2012 18:45 by Cameron in PSN, Xbox Live  //  Tags: , , , , , , , , , , ,   //   Comments

After some time to think about the most secure method for processing achievements and trophies for an individual user using the user's account credentials, I've decided that using a desktop client rather than server side technology for collecting achievements and trophies is the best approach. Not only is it more secure, but it also reduces the load on my server by turning each user's computer into a node on the IGA network for processing small parts of achievements and trophy data as a whole. The combined data from each user will be uploaded to the IGA dedicated server for importing into the central database. Then data can be viewed from the web interface or smart phone applications.

The web interface and smart phone applications will merely serve as a way to interact with the data from the database rather than pulling data down from the various sources and taking up bandwidth. This is good for smart phone users as data charges can apply for checking for updates frequently.

I'm using a Qt, a cross platform GUI library, for designing the user interface so that the client may run on Windows, Mac OS X, and Linux out of the box. I will post some screen shots as they become available.

Latest updates on Xbox LIVE script

2. January 2012 13:28 by Cameron in Xbox Live  //  Tags: , , , , , , ,   //   Comments

I have recently added support for collecting data for an Xbox user's friend list to my Xbox LIVE script. Also, since my last blog update, I've changed all dates in the data to use epoch time stamps. I've attached an updated sample:

pcmantinker-xbox.xml (528.72 kb)

First version of PSN trophy collector finished

2. January 2012 13:17 by Cameron in PSN  //  Tags: , , , , , ,   //   Comments

Today I finished the first version of my PSN trophy collector. In this version, my script is able to pull down detailed information about a person's basic profile information and their full online game list with trophies. Note: the script only pulls games that play online and participate in trophies. Any games that don't have trophies are not scanned. For each game, a full list of trophies is collected showing the dates of each earned trophy. I've attached a sample of my PSN trophy data.

pcmantinker-ps3.xml (234.28 kb)

Be watchful of what you eat

6. December 2011 12:29 by Cameron in Misc  //  Tags: , , , , , ,   //   Comments

I'm fine, but I had an interesting night at the emergency room last night. I ate my regular broccoli beef meal from Chinese Combo King, a local Chinese food restaurant near campus, and shortly afterwards I had an allergic reaction to something in the food. I have been eating at Chinese Combo King since I was a freshman at LSU and have had no issues with the ingredients of the food. However, last night, I noticed that the food tasted differently like it was cooked with a different spice than I was used to. At the time, I didn't think anything of the difference in taste. I just thought there was a different chef cooking the food last night that used a different recipe. It took about 10 minutes for me to notice that I had begun breaking out in hives. Prior to last night's incident, I had never really broken out in hives so it was a bit alarming to see it develop so rapidly. I received a professional opinion from a nurse from my healthcare provider that I should check in to the emergency room to get appropriate care for my condition. 

Once I got to the emergency room, the visit lasted about 5 hours. They were pretty packed when I arrived. I am definitely thankful to have gone to the ER though. I'm feeling much better today. Sadly, I think that last night will be the last time I eat at Chinese Combo King. It's strange that after 21 years, I have discovered an unknown allergy that causes me to break out in hives. I will be getting tested by an allergist over the winter break to narrow down the root cause.

My recommendations for everyone is to always be aware of the foods that you eat. Sometimes we cannot know the ingredients in the food we eat or in my case, not even know you were allergic to something. I'm no medical doctor, but something that they recommended me was to take Benadryl and Zantac simultaneously to help reduce inflammation. Zantac acts as an antihistamine like Benadryl but works differently so they can be taken together. These can be purchased over the counter and will definitely help with immediate relief. If after you've taken these you aren't seeing any results, consult a professional opinion about your condition. I hope this helps anyone with a similar case in the future.

Happy Holidays!

Month List

Tag cloud