Getting an image size in C++

I was in need of some quick code to get the dimensions of a JPEG. I happened upon this post that inspired me to write my own. I’ll post the results on GitHub (now posted here) when I get a chance, but some fun things came out of such research.

  1. comparing a char to its value in hex requires casting the hex value to char.
  2. Bit manipulation on the low order bit may be required. I will be doing more research on the whys.

Continue reading

Developing Multi Platform Code

My current project includes writing for two different mobile operating systems. I had the luxury of enough time to explore the ins and outs of developing a mobile application that runs on multiple platforms.

At the start, I decided to write an example application for each platform. It was something complicated enough to warrant planning efforts.

I wrote the user interface with Cordova (PhoneGap). But had I not been able to use it, the user interface would have had to be coded for each OS individually. This is a big reason for keeping your business logic separate from the UI.

The real business logic was written in Objective C for iPhone, and Java for Android. It was a true port. I figured out ways to get the same thing done on different operating systems.

Such a project demonstrated to me that much time can be spent developing the business logic. So if you are going to support multiple platforms, you will want to do it in a platform-neutral language.

Should you write it in Javascript? The answer in my case was no. Many of the things the software needed to do did not fit within the abilities of Javascript. Cordova plugins could have been built, but that was (in my mind) too big of a chunk to bite off. I am not as comfortable with Javascript, especially in the debugging and toolset areas.

Cordova plugins were still built. But rather than doing a small task natively, and the rest in Javascript, these plugins handled a large portion of the “engine” that ran the application.

Such pieces needed access to the file system, XML parsing, and file compression.

Now with the project working on both devices, I can see how the trouble of talking to C/C++ routines should be weighed with the trouble of rewriting Objective C and Java. There is not one answer. This should be decided on a per-project basis.

For this project, writing the business logic in C++ would have been best. Once the link is set between the preferred language and C++, more complicated business logic can be done in one language, and easily ported to both platforms. Ongoing maintenance will be made easier as platform agnostic changes will be done in one place.

Yes, it is a pain to get the links set up for the Android NDK. It is a bit easier for iOS. Windows phone may be on the horizon as well.

Even with C/C++, you are forced to think about platform specific and platform agnostic code. The problem does not go away completely. But even with small projects such as this one, a “toolbox” starts to form. Some of the platform-specific code gets pushed down and hidden in some libraries that could be used on other projects.

In all, it was a great learning experience, and one with assets that I will carry to future projects.

Resource: Click here for a good article to read about writing for multiple platforms.

A flexible mobile stack

My team and I have been working on a mobile application. The application is being built for Android devices, but with the aspirations of being ported to the other popular mobile platforms.

The application is mainly a CRUD-style app, with the eventuality of the data being displayed in a MS Word document.

Below is some of the details of our stack…

HTML5/CSS/JavaScript: Software purists may scoff, but an application can be written where the UI is developed in HTML5, CSS, and JavaScript. Portability of the user interface becomes a non-issue.

Cordova (PhoneGap): This has come a long way from its early days.  HTML5 does not know everything. How do you take a picture in HTML5? How do you generate a MS Word document in HTML5? You write a Cordova plug-in to interface your JavaScript. Portable? No. But I would rather port pieces of an app than an entire app.

MS Word: Why have the report come out in MS Word format? Because that way the user can edit it easily without needing a phone. Yes, there are alternatives. But do you want to support them?

Tools:

Eclipse: Boy does it have its warts! But it also is much easier to handle than vi and emacs. Integration with the Android SDK and Git is nice. It works on Windows, Linux, and Apple PCs. Google is pushing their IDE, and it may be worth a look. But for now, we appreciate the fine developers of the Eclipse IDE.

Git: How can you have a distributed workforce without stepping all over each other? Get them trained on the ins and outs of Git. A nice-to-have for a single developer. A must-have when there are two or more.

JUnit / Appium: Testing your code is part of developing it. Yes it is painful. But it pays huge dividends. Spend the effort up front. Please believe me on this one.

What should my child learn for a career in software development?

A concerned parent approached me recently. Their child has pursued a path in game development. The bit of research the parent did (not sure how much) indicated to him that there were some big downsides to this. Long hours, low pay, demanding schedules and the like. How should he direct his son?

Well, I am no parent. But I was a beginner once. And I have seen plenty of beginning programmers fail.

Of the programmers that fail, I would say the greatest majority of them failed because they did not dedicate themselves to programming. Many found they didn’t even like programming. Like many other careers, people see the high demand and high pay of some developers, and jump in expecting to make big bucks after a few years of education. Not in this industry, nor any other that I can think of.

In my opinion, if you are going to fail, fail early. Consider it a learning experience, and move on.

So what advice would I give to a concerned parent? Coach and support.

Coach:

What if your child wanted to pursue a career in game development? Perhaps show them the good and bad points. Show them the outlook for such a choice, and remind them that their decision now can affect their future.

Support:

Once the decision is made, encourage them as much as possible.

Are they keeping their eyes opened to different opportunities? Encourage them to explore, as well as be focused on a goal.

Are they narrowly focused on their goal? Encourage them to continue to learn all facets of their chosen path, as well as explore other opportunities.

If failure comes, show them that it is not the end of the world. It is part of the life process.

Does that not sound like positive reinforcement? It certainly sounds better to me than waiting for failure and saying “I told you so.”

As in all types of advice, YMMV.

Advantages of the Crypto Currency Exchange Connector

Connecting to a singular exchange via their API may be all that is required. But as the crypto coin landscape continues to evolve, the ability to switch exchanges, or even use arbitrage between exchanges can require a sizable investment of time and resources on your part.

Learning the intricacies of the Crypto Currency Exchange Connector can provide a solution.

Industry Standard Protocols

The protocol of choice for many financial exchanges is the FIX Protocol. This is the protocol that the Crypto Currency Exchange Connector uses. If your systems already speak FIX, using this service is the way to go.

Consolidated Transaction Information

Looking at your transaction history across exchanges can be cumbersome. The history of all transactions sent through the system can be reviewed. You now have a singular place to retrieve your transaction history, making trading system profitability calculations easier.

Additional Exchanges / Changes to an Exchange

Should an API change at one of the exchanges, we change our system. Changes to your system will probably be minimal or nothing at all. If an additional exchange appears, we implement their API on our side. You enter your account information on our website, and you then have access to the new exchange.

Contact us today to find out more about the Crypto Currency Exchange Connector.

Connecting to the Exchange Connector

Connecting to the Crypto Currency Exchange Connector may seem complex. However it was designed to give users the access they need without allowing rogue users access to your accounts.

To access the service, you must connect through TLS 1.2. Once connected, everything sent between you and the Exchange Connector is encrypted. No other system can eavesdrop on your communications if they receive encrypted packages.

On top of the encrypted communications, client side certificates are also required. A certificate held by you is installed on your machine. You and our systems have previously agreed that the certificate is yours. When you encrypt, you also sign your transmission using a key only known by you. Once your transmission is received by our system, we compare your signature to the one we computed by looking at your certificate. Once this process is complete, we are reasonably assured that

  1. A machine that has access to your client side certificate is the machine that generated the transmission.
  2. No entity between your systems and our systems has modified the transmission.
  3. No eavesdropper has seen the information shared between the two systems.

Software to Ease the Burden

While this may seem quite complex to set up, there is a utility to help. STunnel takes care of this for you. A properly configured STunnel client can handle the encryption and verification steps with little to no modifications to your existing software. More details of STunnel can be found at http://www.stunnel.org.

Sunny Hill RBC Photos

Here are some pictures of the Sunny Hill project done by the Georgia 3 Regional Building Committee.

Yes, I know my photo skills are bad. But here’s some details:

  • 2 Apartments sit atop the hill
  • Beneath the apartments is Auditorium C
  • Auditorium C is much smaller than A & B, which are the same size.
  • Auditoriums A & B are separated where you see the carport.
  • Between A & B is a common area where a literature counter, bathrooms, and offices reside.
  • Just outside each of auditoriums A & B are 2 libraries.