Welcome!

Linux Containers Authors: Yeshim Deniz, Elizabeth White, Liz McMillan, Automic Blog, Pat Romanski

Related Topics: Linux Containers

Linux Containers: Article

Scratching that programming itch

Joe Barr starts building an online bridge game with GTK/GNOME and glade

(LinuxWorld) ¡ª It's a bad itch. I've had it for years. For a short period, back in 1988 and 1989, I had a fix for it. But that didn't last. Now, thanks to an unlikely pair (Nick Petreley and Whil Hentzen), it's back. Let me explain.

In the late 1980s, I used to hang out on Portal, which was sort of a step-sister of The Well, a popular online watering hole at the time. Remember, these were the days before easy Internet access from anywhere to anywhere. Our rag-tag band of migrant online addicts used a flat-rate service called PC Pursuit to connect to Portal. It made it affordable to hang out online. In those days, CompuServe and The Source were getting $7 or $8 an hour for connect time. That made the Portal/PC Pursuit arrangement all the more attractive.

We would gather each evening to chat, argue and play games. The favorite game was Trivia. Ms_Missie would run the game and keep score. The competition was intense. Of course, we had ringers in the game, too, such as the woman who edited the puzzle column for New York Magazine. It was very tough to beat her. One day, as we chatted, a few of us discovered that we had enough bridge players for a table or two. That was the trigger. I had to write an online bridge game.

I had experience writing communications software using BASIC, so that is what I used to write the game. I even found a public domain comm driver written for C. I hacked that to make it work with BASIC.

Unfortunately, the application was hard-coded to connect to Portal via PC Pursuit. That turned out to be its downfall. It worked well enough to deal the cards for us, count the tricks and keep score. But when Sprint bought PC Pursuit, Peter Naleszkiewicz announced the end of the pricing that made it a good deal for folks like us. That was the end of our Portal community, and that was also the end of the bridge game.

New world, same old itch

The world has changed a lot since then. Everything is connected to the Internet, and access is usually unmetered. I don't run DOS any longer, unless you count that cool emulator called dosbox. But the itch remains. I think you can see where this is leading. I have decided to scratch that same itch again: I'm writing a bridge game, this time for online play over the Internet and on Linux.

Why do I blame Petreley and Hentzen for this? Simple. They got me thinking about Linux development. Petreley's analysis of Linux developers started it. And because I haven't coded any real Linux apps (unless I count that toy I created with Kylix), I began to feel a small twitch where the itch used to be. When Whil Hentzen told me a couple of weeks ago that developing applications for Linux is the sweet spot for software development these days, it pushed me over the edge. The itch is back. I have to scratch it.

I haven't gotten very far on the project yet, at least not in terms of coding. But I have found some good tools to use and some good code to start with. C is my language of choice, so I looked around on Freshmeat.org for existing card-games written in C and licensed under the GPL. I found one that seems a perfect match: NetSpades. It's GPL'd, it's written in very clean C, and it has many of the parts I need already in place. A server handles the connections between players, and each player runs a client. Thanks to Brent Hendricks for creating this game and making his code available under the GPL.

Because I am fonder of C than I am of C++, I've decided to use the GTK/GNOME approach rather than KDE. That's another way of saying that I can at least limp around in C, but not in C++.

I was going to call the game NetBridge to give the creator of NetSpades more credit for its heritage, but that term is already overloaded in usage. GNUBridge, on the other hand, returned zero hits on a Google Web search.

Building GNUBridge

There is an excellent tutorial for learning how to use GTK+ (the Gimp Toolkit) on the GTK.org Web site. There's another one at LinuxHeadquarters.com. They are both excellent. They cover all the basics you need to know: callbacks, widget creation and so on. I've spent some time bouncing back between the two of them recently. I would copy and paste sample code from into gedit, save it and then run gcc from the command line as they said to do. Everything worked that way, but I began to think I needed better tools. I started looking for an IDE. Freshmeat.org led me to Anjuta, so I downloaded the RPM version and installed it. Anjuta correctly placed itself in my RHL 9 menu tree during the install. It looks to be an excellent IDE, although I have to admit I haven't logged much time in it yet.

I did get as far as using the wizard to create a new project. The wizard allows you to select the programming language (C, C++ or both), application type (GTK, GNOME, libglade, etc.) and give the project a name. It creates a empty template and makefile for you, so you can start adding code and debugging it immediately. I decided to copy one of the example programs from the GTK tutorial in place of the main.c template created by the Anjuta wizard.

I clicked on Build from the Anjuta toolbar, and it compiled the code. When I clicked on Build ¡ú Execute, however, I got an error message. It turned out that particular bit of example code wanted you to enter a 1, 2 or 3 as a command-line argument. If you don't, you get the error message. I noticed an option for "Set Program Params" under Build, clicked on it, entered a 1, then clicked Execute. This time it ran, producing the window you see below. Anjuta is definitely a step up from using gedit and CLI make.

Anjuta IDE

As nice as Anjuta is, it didn't provide the instant gratification of a drag-and-drop window designer. I wanted something like Kylix, but without the licensing encumbrances. As I went through the GTK+ tutorials and learned how to build containers to stuff widgets into, I thought how nice it would be to have a GUI generating the code for me. I set off in search of one.

That's how I found glade, and I didn't even have to install it.

GUIs the glade way

Both glade and glade-2 were already on my system as part of my stock Red Hat 9 workstation installation. I spent some time feeling my way around both versions of glade. It does generate code, and it does allow me to create a GUI interface more quickly than I could by coding it manually. However, I am not sure how or if I will end up using it for GNUBridge.

One experienced GTK programmer told me not to use the C code glade generates, but instead to use the XML GUI parts and load them via libglade. Another programmer, closer to my level of GTK-programming experience than the first, said he found glade's C code useful in another way. He examined the generated code to see how he should manually code the same widgets. At the moment, that's how I am leaning towards using glade. That may change, however, as I investigate the libglade option.

So that's it for now. There will be more on this project in the future. I've got a great starting point in NetSpades. I've got a nice-looking IDE to work with in Anjuta. And I may or may not have a helpful GUI-builder in glade. I mentioned above that I hadn't gotten very far in terms of coding, but I feel that given what I have to start with, I'm more than half-way finished already.

Any advice from experienced GTK developers out there will be gratefully accepted. For all you other tired, old dinosaurs out there who have to this point only coded on mainframes, minis or DOS/Windows PCs, I have a question for you:

When are you going to start scratching your own itch and develop an application for Linux?

More Stories By Joe Barr

Joe Barr is a freelance journalist covering Linux, open source and network security. His 'Version Control' column has been a regular feature of Linux.SYS-CON.com since its inception. As far as we know, he is the only living journalist whose works have appeared both in phrack, the legendary underground zine, and IBM Personal Systems Magazine.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


@ThingsExpo Stories
When growing capacity and power in the data center, the architectural trade-offs between server scale-up vs. scale-out continue to be debated. Both approaches are valid: scale-out adds multiple, smaller servers running in a distributed computing model, while scale-up adds fewer, more powerful servers that are capable of running larger workloads. It’s worth noting that there are additional, unique advantages that scale-up architectures offer. One big advantage is large memory and compute capacity...
Artificial intelligence, machine learning, neural networks. We’re in the midst of a wave of excitement around AI such as hasn’t been seen for a few decades. But those previous periods of inflated expectations led to troughs of disappointment. Will this time be different? Most likely. Applications of AI such as predictive analytics are already decreasing costs and improving reliability of industrial machinery. Furthermore, the funding and research going into AI now comes from a wide range of com...
No hype cycles or predictions of zillions of things here. IoT is big. You get it. You know your business and have great ideas for a business transformation strategy. What comes next? Time to make it happen. In his session at @ThingsExpo, Jay Mason, Associate Partner at M&S Consulting, presented a step-by-step plan to develop your technology implementation strategy. He discussed the evaluation of communication standards and IoT messaging protocols, data analytics considerations, edge-to-cloud tec...
"When we talk about cloud without compromise what we're talking about is that when people think about 'I need the flexibility of the cloud' - it's the ability to create applications and run them in a cloud environment that's far more flexible,” explained Matthew Finnie, CTO of Interoute, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
We build IoT infrastructure products - when you have to integrate different devices, different systems and cloud you have to build an application to do that but we eliminate the need to build an application. Our products can integrate any device, any system, any cloud regardless of protocol," explained Peter Jung, Chief Product Officer at Pulzze Systems, in this SYS-CON.tv interview at @ThingsExpo, held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA
With major technology companies and startups seriously embracing Cloud strategies, now is the perfect time to attend 21st Cloud Expo October 31 - November 2, 2017, at the Santa Clara Convention Center, CA, and June 12-14, 2018, at the Javits Center in New York City, NY, and learn what is going on, contribute to the discussions, and ensure that your enterprise is on the right path to Digital Transformation.
In his session at @ThingsExpo, Eric Lachapelle, CEO of the Professional Evaluation and Certification Board (PECB), provided an overview of various initiatives to certify the security of connected devices and future trends in ensuring public trust of IoT. Eric Lachapelle is the Chief Executive Officer of the Professional Evaluation and Certification Board (PECB), an international certification body. His role is to help companies and individuals to achieve professional, accredited and worldwide re...
The Internet giants are fully embracing AI. All the services they offer to their customers are aimed at drawing a map of the world with the data they get. The AIs from these companies are used to build disruptive approaches that cannot be used by established enterprises, which are threatened by these disruptions. However, most leaders underestimate the effect this will have on their businesses. In his session at 21st Cloud Expo, Rene Buest, Director Market Research & Technology Evangelism at Ara...
SYS-CON Events announced today that Enzu will exhibit at SYS-CON's 21st Int\ernational Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Enzu’s mission is to be the leading provider of enterprise cloud solutions worldwide. Enzu enables online businesses to use its IT infrastructure to their competitive advantage. By offering a suite of proven hosting and management services, Enzu wants companies to focus on the core of their ...
Internet of @ThingsExpo, taking place October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with 21st Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The Internet of Things (IoT) is the most profound change in personal and enterprise IT since the creation of the Worldwide Web more than 20 years ago. All major researchers estimate there will be tens of billions devic...
Amazon started as an online bookseller 20 years ago. Since then, it has evolved into a technology juggernaut that has disrupted multiple markets and industries and touches many aspects of our lives. It is a relentless technology and business model innovator driving disruption throughout numerous ecosystems. Amazon’s AWS revenues alone are approaching $16B a year making it one of the largest IT companies in the world. With dominant offerings in Cloud, IoT, eCommerce, Big Data, AI, Digital Assista...
SYS-CON Events announced today that Cloud Academy named "Bronze Sponsor" of 21st International Cloud Expo which will take place October 31 - November 2, 2017 at the Santa Clara Convention Center in Santa Clara, CA. Cloud Academy is the industry’s most innovative, vendor-neutral cloud technology training platform. Cloud Academy provides continuous learning solutions for individuals and enterprise teams for Amazon Web Services, Microsoft Azure, Google Cloud Platform, and the most popular cloud com...
SYS-CON Events announced today that MobiDev, a client-oriented software development company, will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. MobiDev is a software company that develops and delivers turn-key mobile apps, websites, web services, and complex software systems for startups and enterprises. Since 2009 it has grown from a small group of passionate engineers and business...
SYS-CON Events announced today that GrapeUp, the leading provider of rapid product development at the speed of business, will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Grape Up is a software company, specialized in cloud native application development and professional services related to Cloud Foundry PaaS. With five expert teams that operate in various sectors of the market acr...
SYS-CON Events announced today that Ayehu will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on October 31 - November 2, 2017 at the Santa Clara Convention Center in Santa Clara California. Ayehu provides IT Process Automation & Orchestration solutions for IT and Security professionals to identify and resolve critical incidents and enable rapid containment, eradication, and recovery from cyber security breaches. Ayehu provides customers greater control over IT infras...
With the introduction of IoT and Smart Living in every aspect of our lives, one question has become relevant: What are the security implications? To answer this, first we have to look and explore the security models of the technologies that IoT is founded upon. In his session at @ThingsExpo, Nevi Kaja, a Research Engineer at Ford Motor Company, discussed some of the security challenges of the IoT infrastructure and related how these aspects impact Smart Living. The material was delivered interac...
In his session at Cloud Expo, Alan Winters, an entertainment executive/TV producer turned serial entrepreneur, presented a success story of an entrepreneur who has both suffered through and benefited from offshore development across multiple businesses: The smart choice, or how to select the right offshore development partner Warning signs, or how to minimize chances of making the wrong choice Collaboration, or how to establish the most effective work processes Budget control, or how to ma...
IoT solutions exploit operational data generated by Internet-connected smart “things” for the purpose of gaining operational insight and producing “better outcomes” (for example, create new business models, eliminate unscheduled maintenance, etc.). The explosive proliferation of IoT solutions will result in an exponential growth in the volume of IoT data, precipitating significant Information Governance issues: who owns the IoT data, what are the rights/duties of IoT solutions adopters towards t...
SYS-CON Events announced today that CA Technologies has been named "Platinum Sponsor" of SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. CA Technologies helps customers succeed in a future where every business - from apparel to energy - is being rewritten by software. From planning to development to management to security, CA creates software that fuels transformation for companies in the applic...
SYS-CON Events announced today that IBM has been named “Diamond Sponsor” of SYS-CON's 21st Cloud Expo, which will take place on October 31 through November 2nd 2017 at the Santa Clara Convention Center in Santa Clara, California.