Welcome!

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

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 B2Cloud 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. B2Cloud specializes in IoT devices for preventive and predictive maintenance in any kind of equipment retrieving data like Energy consumption, working time, temperature, humidity, pressure, etc.
SYS-CON Events announced today that Massive Networks, that helps your business operate seamlessly with fast, reliable, and secure internet and network solutions, has been named "Exhibitor" 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. As a premier telecommunications provider, Massive Networks is headquartered out of Louisville, Colorado. With years of experience under their belt, their team of...
SYS-CON Events announced today that NetApp has been named “Bronze 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. NetApp is the data authority for hybrid cloud. NetApp provides a full range of hybrid cloud data services that simplify management of applications and data across cloud and on-premises environments to accelerate digital transformation. Together with their partners, NetApp em...
SYS-CON Events announced today that Interface Corporation will exhibit at the Japan External Trade Organization (JETRO) Pavilion 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. Interface Corporation is a company developing, manufacturing and marketing high quality and wide variety of industrial computers and interface modules such as PCIs and PCI express. For more information, visit http://www.i...
SYS-CON Events announced today that Mobile Create USA will exhibit at the Japan External Trade Organization (JETRO) Pavilion 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. Mobile Create USA Inc. is an MVNO-based business model that uses portable communication devices and cellular-based infrastructure in the development, sales, operation and mobile communications systems incorporating GPS capabi...
SYS-CON Events announced today that Nihon Micron will exhibit at the Japan External Trade Organization (JETRO) Pavilion 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. Nihon Micron Co., Ltd. strives for technological innovation to establish high-density, high-precision processing technology for providing printed circuit board and metal mount RFID tags used for communication devices. For more inf...
SYS-CON Events announced today that N3N will exhibit at SYS-CON's @ThingsExpo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. N3N’s solutions increase the effectiveness of operations and control centers, increase the value of IoT investments, and facilitate real-time operational decision making. N3N enables operations teams with a four dimensional digital “big board” that consolidates real-time live video feeds alongside IoT sensor data a...
SYS-CON Events announced today that SIGMA Corporation will exhibit at the Japan External Trade Organization (JETRO) Pavilion 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. uLaser flow inspection device from the Japanese top share to Global Standard! Then, make the best use of data to flip to next page. For more information, visit http://www.sigma-k.co.jp/en/.
SYS-CON Events announced today that Suzuki Inc. will exhibit at the Japan External Trade Organization (JETRO) Pavilion 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. Suzuki Inc. is a semiconductor-related business, including sales of consuming parts, parts repair, and maintenance for semiconductor manufacturing machines, etc. It is also a health care business providing experimental research for...
While some developers care passionately about how data centers and clouds are architected, for most, it is only the end result that matters. To the majority of companies, technology exists to solve a business problem, and only delivers value when it is solving that problem. 2017 brings the mainstream adoption of containers for production workloads. In his session at 21st Cloud Expo, Ben McCormack, VP of Operations at Evernote, will discuss how data centers of the future will be managed, how th...
SYS-CON Events announced today that Ryobi Systems will exhibit at the Japan External Trade Organization (JETRO) Pavilion 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. Ryobi Systems Co., Ltd., as an information service company, specialized in business support for local governments and medical industry. We are challenging to achive the precision farming with AI. For more information, visit http:...
SYS-CON Events announced today that MIRAI Inc. will exhibit at the Japan External Trade Organization (JETRO) Pavilion 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. MIRAI Inc. are IT consultants from the public sector whose mission is to solve social issues by technology and innovation and to create a meaningful future for people.
SYS-CON Events announced today that mruby Forum will exhibit at the Japan External Trade Organization (JETRO) Pavilion 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. mruby is the lightweight implementation of the Ruby language. We introduce mruby and the mruby IoT framework that enhances development productivity. For more information, visit http://forum.mruby.org/.
SYS-CON Events announced today that Fusic will exhibit at the Japan External Trade Organization (JETRO) Pavilion 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. Fusic Co. provides mocks as virtual IoT devices. You can customize mocks, and get any amount of data at any time in your test. For more information, visit https://fusic.co.jp/english/.
In his session at @ThingsExpo, Greg Gorman is the Director, IoT Developer Ecosystem, Watson IoT, will provide a short tutorial on Node-RED, a Node.js-based programming tool for wiring together hardware devices, APIs and online services in new and interesting ways. It provides a browser-based editor that makes it easy to wire together flows using a wide range of nodes in the palette that can be deployed to its runtime in a single-click. There is a large library of contributed nodes that help so...
SYS-CON Events announced today that Enroute Lab will exhibit at the Japan External Trade Organization (JETRO) Pavilion 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. Enroute Lab is an industrial design, research and development company of unmanned robotic vehicle system. For more information, please visit http://elab.co.jp/.
Agile has finally jumped the technology shark, expanding outside the software world. Enterprises are now increasingly adopting Agile practices across their organizations in order to successfully navigate the disruptive waters that threaten to drown them. In our quest for establishing change as a core competency in our organizations, this business-centric notion of Agile is an essential component of Agile Digital Transformation. In the years since the publication of the Agile Manifesto, the conn...
Real IoT production deployments running at scale are collecting sensor data from hundreds / thousands / millions of devices. The goal is to take business-critical actions on the real-time data and find insights from stored datasets. In his session at @ThingsExpo, John Walicki, Watson IoT Developer Advocate at IBM Cloud, will provide a fast-paced developer journey that follows the IoT sensor data from generation, to edge gateway, to edge analytics, to encryption, to the IBM Bluemix cloud, to Wa...
There is huge complexity in implementing a successful digital business that requires efficient on-premise and cloud back-end infrastructure, IT and Internet of Things (IoT) data, analytics, Machine Learning, Artificial Intelligence (AI) and Digital Applications. In the data center alone, there are physical and virtual infrastructures, multiple operating systems, multiple applications and new and emerging business and technological paradigms such as cloud computing and XaaS. And then there are pe...
SYS-CON Events announced today that Keisoku Research Consultant Co. will exhibit at the Japan External Trade Organization (JETRO) Pavilion 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. Keisoku Research Consultant, Co. offers research and consulting in a wide range of civil engineering-related fields from information construction to preservation of cultural properties. For more information, vi...