Welcome!

Linux Containers Authors: Liz McMillan, Pat Romanski, Elizabeth White, Yeshim Deniz, Jyoti Bansal

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
Internet of @ThingsExpo, taking place October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with the 21st International Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. @ThingsExpo Silicon Valley Call for Papers is now open.
SYS-CON Events announced today that DivvyCloud will exhibit 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. DivvyCloud software enables organizations to achieve their cloud computing goals by simplifying and automating security, compliance and cost optimization of public and private cloud infrastructure. Using DivvyCloud, customers can leverage programmatic Bots to identify and remediate common cloud problems in rea...
SYS-CON Events announced today that Tintri, Inc, a leading provider of enterprise cloud infrastructure, will exhibit 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. Tintri offers an enterprise cloud platform built with public cloud-like web services and RESTful APIs. Organizations use Tintri all-flash storage with scale-out and automation as a foundation for their own clouds – to build agile development environments...
SYS-CON Events announced today that Fusion, a leading provider of cloud services, will exhibit 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. Fusion, a leading provider of integrated cloud solutions to small, medium and large businesses, is the industry’s single source for the cloud. Fusion’s advanced, proprietary cloud service platform enables the integration of leading edge solutions in the cloud, including cloud...
SYS-CON Events announced today that Peak 10, Inc., a national IT infrastructure and cloud services provider, will exhibit 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. Peak 10 provides reliable, tailored data center and network services, cloud and managed services. Its solutions are designed to scale and adapt to customers’ changing business needs, enabling them to lower costs, improve performance and focus intern...
SYS-CON Events announced today that Progress, a global leader in application development, has been named “Bronze Sponsor” of 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. Enterprises today are rapidly adopting the cloud, while continuing to retain business-critical/sensitive data inside the firewall. This is creating two separate data silos – one inside the firewall and the other outside the firewall. Cloud ISVs ofte...
SYS-CON Events announced today that Systena America will exhibit 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. Systena Group has been in business for various software development and verification in Japan, US, ASEAN, and China by utilizing the knowledge we gained from all types of device development for various industries including smartphones (Android/iOS), wireless communication, security technology and IoT serv...
DevOps at Cloud Expo – being held October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA – 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 r...
SYS-CON Events announced today that Hitachi Data Systems, a wholly owned subsidiary of Hitachi LTD., will exhibit 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. Hitachi Data Systems (HDS) will be featuring the Hitachi Content Platform (HCP) portfolio. This is the industry’s only offering that allows organizations to bring together object storage, file sync and share, cloud storage gateways, and sophisticated search and...
The 21st International Cloud Expo has announced that its Call for Papers is open. Cloud Expo, to be held October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA, brings together Cloud Computing, Big Data, Internet of Things, DevOps, Digital Transformation, 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...
SYS-CON Events announced today that Technologic Systems Inc., an embedded systems solutions company, will exhibit at SYS-CON's @ThingsExpo, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Technologic Systems is an embedded systems company with headquarters in Fountain Hills, Arizona. They have been in business for 32 years, helping more than 8,000 OEM customers and building over a hundred COTS products that have never been discontinued. Technologic Systems’ pr...
SYS-CON Events announced today that Carbonite will exhibit 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. Carbonite protects your entire IT footprint with the right level of protection for each workload, ensuring lower costs and dependable solutions with DoubleTake and Evault.
New competitors, disruptive technologies, and growing expectations are pushing every business to both adopt and deliver new digital services. This ‘Digital Transformation’ demands rapid delivery and continuous iteration of new competitive services via multiple channels, which in turn demands new service delivery techniques – including DevOps. In this power panel at @DevOpsSummit 20th Cloud Expo, moderated by DevOps Conference Co-Chair Andi Mann, panelists will examine how DevOps helps to meet th...
SYS-CON Events announced today that Progress, a global leader in application development, has been named “Bronze Sponsor” of 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. Enterprises today are rapidly adopting the cloud, while continuing to retain business-critical/sensitive data inside the firewall. This is creating two separate data silos – one inside the firewall and the other outside the firewall. Cloud ISVs oft...
SYS-CON Events announced today that CollabNet, a global leader in enterprise software development, release automation and DevOps solutions, will be a Bronze Sponsor of SYS-CON's 20th International Cloud Expo®, taking place from June 6-8, 2017, at the Javits Center in New York City, NY. CollabNet offers a broad range of solutions with the mission of helping modern organizations deliver quality software at speed. The company’s latest innovation, the DevOps Lifecycle Manager (DLM), supports Value S...
SYS-CON Events announced today that Cloudistics, an on-premises cloud computing company, has been named “Bronze Sponsor” of 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. Cloudistics delivers a complete public cloud experience with composable on-premises infrastructures to medium and large enterprises. Its software-defined technology natively converges network, storage, compute, virtualization, and management into a ...
SYS-CON Events announced today that Ocean9will exhibit 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. Ocean9 provides cloud services for Backup, Disaster Recovery (DRaaS) and instant Innovation, and redefines enterprise infrastructure with its cloud native subscription offerings for mission critical SAP workloads.
Multiple data types are pouring into IoT deployments. Data is coming in small packages as well as enormous files and data streams of many sizes. Widespread use of mobile devices adds to the total. In this power panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, panelists will look at the tools and environments that are being put to use in IoT deployments, as well as the team skills a modern enterprise IT shop needs to keep things running, get a handle on all this data, and deli...
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
DevOps is often described as a combination of technology and culture. Without both, DevOps isn't complete. However, applying the culture to outdated technology is a recipe for disaster; as response times grow and connections between teams are delayed by technology, the culture will die. A Nutanix Enterprise Cloud has many benefits that provide the needed base for a true DevOps paradigm.