Welcome!

Linux Containers Authors: Liz McMillan, Kevin Sparenberg, Karyn Jeffery, Elizabeth White, Yeshim Deniz

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
"DX encompasses the continuing technology revolution, and is addressing society's most important issues throughout the entire $78 trillion 21st-century global economy," said Roger Strukhoff, Conference Chair. "DX World Expo has organized these issues along 10 tracks with more than 150 of the world's top speakers coming to Istanbul to help change the world."
While the focus and objectives of IoT initiatives are many and diverse, they all share a few common attributes, and one of those is the network. Commonly, that network includes the Internet, over which there isn't any real control for performance and availability. Or is there? The current state of the art for Big Data analytics, as applied to network telemetry, offers new opportunities for improving and assuring operational integrity. In his session at @ThingsExpo, Jim Frey, Vice President of S...
"We provide IoT solutions. We provide the most compatible solutions for many applications. Our solutions are industry agnostic and also protocol agnostic," explained Richard Han, Head of Sales and Marketing and Engineering at Systena America, in this SYS-CON.tv interview at @ThingsExpo, held June 6-8, 2017, at the Javits Center in New York City, NY.
"We are focused on SAP running in the clouds, to make this super easy because we believe in the tremendous value of those powerful worlds - SAP and the cloud," explained Frank Stienhans, CTO of Ocean9, Inc., in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
DX World EXPO, LLC., a Lighthouse Point, Florida-based startup trade show producer and the creator of "DXWorldEXPO® - Digital Transformation Conference & Expo" has announced its executive management team. The team is headed by Levent Selamoglu, who has been named CEO. "Now is the time for a truly global DX event, to bring together the leading minds from the technology world in a conversation about Digital Transformation," he said in making the announcement.
"We've been engaging with a lot of customers including Panasonic, we've been involved with Cisco and now we're working with the U.S. government - the Department of Homeland Security," explained Peter Jung, Chief Product Officer at Pulzze Systems, in this SYS-CON.tv interview at @ThingsExpo, held June 6-8, 2017, at the Javits Center in New York City, NY.
The financial services market is one of the most data-driven industries in the world, yet it’s bogged down by legacy CPU technologies that simply can’t keep up with the task of querying and visualizing billions of records. In his session at 20th Cloud Expo, Karthik Lalithraj, a Principal Solutions Architect at Kinetica, discussed how the advent of advanced in-database analytics on the GPU makes it possible to run sophisticated data science workloads on the same database that is housing the rich...
SYS-CON Events announced today that Massive Networks 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. Massive Networks mission is simple. To help your business operate seamlessly with fast, reliable, and secure internet and network solutions. Improve your customer's experience with outstanding connections to your cloud.
Everything run by electricity will eventually be connected to the Internet. Get ahead of the Internet of Things revolution and join Akvelon expert and IoT industry leader, Sergey Grebnov, in his session at @ThingsExpo, for an educational dive into the world of managing your home, workplace and all the devices they contain with the power of machine-based AI and intelligent Bot services for a completely streamlined experience.
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...
"The Striim platform is a full end-to-end streaming integration and analytics platform that is middleware that covers a lot of different use cases," explained Steve Wilkes, Founder and CTO at Striim, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
SYS-CON Events announced today that Calligo, an innovative cloud service provider offering mid-sized companies the highest levels of data privacy and security, 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. Calligo offers unparalleled application performance guarantees, commercial flexibility and a personalised support service from its globally located cloud plat...
SYS-CON Events announced today that DXWorldExpo has been named “Global 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. Digital Transformation is the key issue driving the global enterprise IT business. Digital Transformation is most prominent among Global 2000 enterprises and government institutions.
SYS-CON Events announced today that Datera, that offers a radically new data management architecture, 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. Datera is transforming the traditional datacenter model through modern cloud simplicity. The technology industry is at another major inflection point. The rise of mobile, the Internet of Things, data storage and Big...
"MobiDev is a Ukraine-based software development company. We do mobile development, and we're specialists in that. But we do full stack software development for entrepreneurs, for emerging companies, and for enterprise ventures," explained Alan Winters, U.S. Head of Business Development at MobiDev, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
SYS-CON Events announced today that DXWorldExpo has been named “Global 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. Digital Transformation is the key issue driving the global enterprise IT business. Digital Transformation is most prominent among Global 2000 enterprises and government institutions.
In his opening keynote at 20th Cloud Expo, Michael Maximilien, Research Scientist, Architect, and Engineer at IBM, discussed the full potential of the cloud and social data requires artificial intelligence. By mixing Cloud Foundry and the rich set of Watson services, IBM's Bluemix is the best cloud operating system for enterprises today, providing rapid development and deployment of applications that can take advantage of the rich catalog of Watson services to help drive insights from the vast t...
SYS-CON Events announced today that EnterpriseTech has been named “Media 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. EnterpriseTech is a professional resource for news and intelligence covering the migration of high-end technologies into the enterprise and business-IT industry, with a special focus on high-tech solutions in new product development, workload management, increased effic...
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 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...