Welcome!

Linux Containers Authors: Liz McMillan, Pat Romanski, Elizabeth White, Yeshim Deniz, Roger Strukhoff

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
SYS-CON Events announced today that Evatronix will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Evatronix SA offers comprehensive solutions in the design and implementation of electronic systems, in CAD / CAM deployment, and also is a designer and manufacturer of advanced 3D scanners for professional applications.
To get the most out of their data, successful companies are not focusing on queries and data lakes, they are actively integrating analytics into their operations with a data-first application development approach. Real-time adjustments to improve revenues, reduce costs, or mitigate risk rely on applications that minimize latency on a variety of data sources. In his session at @BigDataExpo, Jack Norris, Senior Vice President, Data and Applications at MapR Technologies, reviewed best practices to ...
SYS-CON Events announced today that Synametrics Technologies will exhibit at SYS-CON's 22nd International Cloud Expo®, which will take place on June 5-7, 2018, at the Javits Center in New York, NY. Synametrics Technologies is a privately held company based in Plainsboro, New Jersey that has been providing solutions for the developer community since 1997. Based on the success of its initial product offerings such as WinSQL, Xeams, SynaMan and Syncrify, Synametrics continues to create and hone inn...
"Evatronix provides design services to companies that need to integrate the IoT technology in their products but they don't necessarily have the expertise, knowledge and design team to do so," explained Adam Morawiec, VP of Business Development at Evatronix, in this SYS-CON.tv interview at @ThingsExpo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
Recently, REAN Cloud built a digital concierge for a North Carolina hospital that had observed that most patient call button questions were repetitive. In addition, the paper-based process used to measure patient health metrics was laborious, not in real-time and sometimes error-prone. In their session at 21st Cloud Expo, Sean Finnerty, Executive Director, Practice Lead, Health Care & Life Science at REAN Cloud, and Dr. S.P.T. Krishnan, Principal Architect at REAN Cloud, discussed how they built...
No hype cycles or predictions of a gazillion things here. IoT is here. 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, an Associate Partner of Analytics, IoT & Cybersecurity at M&S Consulting, presented a step-by-step plan to develop your technology implementation strategy. He also discussed the evaluation of communication standards and IoT messaging protocols, data...
With tough new regulations coming to Europe on data privacy in May 2018, Calligo will explain why in reality the effect is global and transforms how you consider critical data. EU GDPR fundamentally rewrites the rules for cloud, Big Data and IoT. In his session at 21st Cloud Expo, Adam Ryan, Vice President and General Manager EMEA at Calligo, examined the regulations and provided insight on how it affects technology, challenges the established rules and will usher in new levels of diligence arou...
Smart cities have the potential to change our lives at so many levels for citizens: less pollution, reduced parking obstacles, better health, education and more energy savings. Real-time data streaming and the Internet of Things (IoT) possess the power to turn this vision into a reality. However, most organizations today are building their data infrastructure to focus solely on addressing immediate business needs vs. a platform capable of quickly adapting emerging technologies to address future ...
In his Opening Keynote at 21st Cloud Expo, John Considine, General Manager of IBM Cloud Infrastructure, led attendees through the exciting evolution of the cloud. He looked at this major disruption from the perspective of technology, business models, and what this means for enterprises of all sizes. John Considine is General Manager of Cloud Infrastructure Services at IBM. In that role he is responsible for leading IBM’s public cloud infrastructure including strategy, development, and offering m...
In his session at 21st Cloud Expo, Raju Shreewastava, founder of Big Data Trunk, provided a fun and simple way to introduce Machine Leaning to anyone and everyone. He solved a machine learning problem and demonstrated an easy way to be able to do machine learning without even coding. Raju Shreewastava is the founder of Big Data Trunk (www.BigDataTrunk.com), a Big Data Training and consulting firm with offices in the United States. He previously led the data warehouse/business intelligence and B...
The 22nd International Cloud Expo | 1st DXWorld Expo has announced that its Call for Papers is open. Cloud Expo | DXWorld Expo, to be held June 5-7, 2018, at the Javits Center in New York, NY, brings together Cloud Computing, Digital Transformation, Big Data, Internet of Things, DevOps, Machine Learning and WebRTC to one location. With cloud computing driving a higher percentage of enterprise IT budgets every year, it becomes increasingly important to plant your flag in this fast-expanding busin...
Nordstrom is transforming the way that they do business and the cloud is the key to enabling speed and hyper personalized customer experiences. In his session at 21st Cloud Expo, Ken Schow, VP of Engineering at Nordstrom, discussed some of the key learnings and common pitfalls of large enterprises moving to the cloud. This includes strategies around choosing a cloud provider(s), architecture, and lessons learned. In addition, he covered some of the best practices for structured team migration an...
22nd International Cloud Expo, taking place June 5-7, 2018, at the Javits Center in New York City, NY, and co-located with the 1st DXWorld Expo will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud ...
22nd International Cloud Expo, taking place June 5-7, 2018, at the Javits Center in New York City, NY, and co-located with the 1st DXWorld Expo will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud ...
DevOps at Cloud Expo – being held June 5-7, 2018, at the Javits Center in New York, NY – announces that its Call for Papers is open. Born out of proven success in agile development, cloud computing, and process automation, DevOps is a macro trend you cannot afford to miss. From showcase success stories from early adopters and web-scale businesses, DevOps is expanding to organizations of all sizes, including the world's largest enterprises – and delivering real results. Among the proven benefits,...
@DevOpsSummit at Cloud Expo, taking place June 5-7, 2018, at the Javits Center in New York City, NY, is co-located with 22nd Cloud Expo | 1st DXWorld Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The widespread success of cloud computing is driving the DevOps revolution in enterprise IT. Now as never before, development teams must communicate and collaborate in a dynamic, 24/7/365 environment. There is no time to wait...
Cloud Expo | DXWorld Expo have announced the conference tracks for Cloud Expo 2018. Cloud Expo will be held June 5-7, 2018, at the Javits Center in New York City, and November 6-8, 2018, at the Santa Clara Convention Center, Santa Clara, CA. Digital Transformation (DX) is a major focus with the introduction of DX Expo within the program. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive ov...
SYS-CON Events announced today that T-Mobile exhibited at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. As America's Un-carrier, T-Mobile US, Inc., is redefining the way consumers and businesses buy wireless services through leading product and service innovation. The Company's advanced nationwide 4G LTE network delivers outstanding wireless experiences to 67.4 million customers who are unwilling to compromise on qua...
SYS-CON Events announced today that Cedexis will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Cedexis is the leader in data-driven enterprise global traffic management. Whether optimizing traffic through datacenters, clouds, CDNs, or any combination, Cedexis solutions drive quality and cost-effectiveness. For more information, please visit https://www.cedexis.com.
SYS-CON Events announced today that Google Cloud has been named “Keynote Sponsor” of SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Companies come to Google Cloud to transform their businesses. Google Cloud’s comprehensive portfolio – from infrastructure to apps to devices – helps enterprises innovate faster, scale smarter, stay secure, and do more with data than ever before.