avatar

Andres Jaimes

How to read a file name argument from the command line in C++

Reading a file name parameter from the command line is a common task. In this post I read a file name and validate it exists. For paths and file names that include spaces, you have to pass them between quotes, otherwise they will be interpreted by the operating system as two different parameters. #include <string> #include <iostream> #include <fstream> int main(int argc, char* argv[]) { for (int i = 1; i < argc; i++) { std::string s(argv[i]); if (s.

How to check command line arguments in any order

Here is an easy solution to passing parameters to a C++ application from the command line that does not require any external libraries. Since parameters are read inside a loop, the order in which they are passed is not important. #include <string> #include <iostream> int main(int argc, char* argv[]) { for (int i = 1; i < argc; i++) { std::string s(argv[i]); if (s == "-a") { std::cout << "You passed parameter -a" << std::endl; } else if (s == "-b") { std::cout << "You passed parameter -b" << std::endl; } else { std::cout << "Unknown: " << s << std::endl; } } return 0; }

Read all tables and columns from a database using Java

This Java example finds all the tables and their corresponding columns from a database. The code iterates over the entities and columns found and shows them on the console. Minor changes are necessary to process the found values in a different way. Connection conn; DatabaseMetaData dmd; ResultSet rs1, rs2; ResultSetMetaData rsmd; Statement s; try { conn = getConnection(); dmd = conn.getMetaData(); rs1 = dmd.getTables("database_name", null, "%", null); s = conn.createStatement(); while (rs1.

Solution: Netbeans 8 not working on Ubuntu 15.10

Netbeans is one of my beloved day to day applications. Yesterday, when I installed Ubuntu 15.10 (Wily Werewolf) on my computer, Netbeans started to hang on the startup screen, specifically at the Loading Modules phase. It took me hours looking for solutions on the internet; and reinstalling different versions of the Java Development Framework didn’t seem to help. Finally I found the following fix at an Ubuntu forum, which turned out to be very simple to apply.

Support Glumik!

Hello, This time I write to ask you for your support. We’re developing a website for small business owners in the City of Queretaro, Mexico. The website will allow the proprietors have presence on the Internet. Many of these people do not have the resources for starting a website and we want to help them. Donations start from as little as 1 dollar. The more you donate the better chance you have to get a reward, including a 1 hour call where you and I can hold a Q&A session on selected tech topics.

Installing CentOS 7 – A Graphical Tour for Linux Beginners

If you are new on the Linux platform, I am sure you feel overwhelmed with all the different versions available. Choosing one is not an easy task, and each version has its own pros and cons. Let me tell you why I like CentOS: It is very stable It has well tested features There is a big community around it It has many large software repositories It is Part of the RedHat / Fedora family Installing CentOS Installing a new operating system may seem challenging, but CentOS has always made this task a simple one.

Install CentOS 7, Oracle XE and other development tools

The CentOS distribution is a famous and stable Linux version derived from RedHat Linux. It’s been one of my favorites and one that you can easily find with hosting providers. In this article we will install CentOS and OracleXE. It’s worth mentioning the OS team improves the installation process with each version, and you will find out in this tutorial how straightforward it currently is. 1. Installing CentOS We’ll perform a minimal installation; this means, we will not install a graphical interface, because this server is meant to be a web / database test server.

Sunset stroll

Relaxing stroll in the desert.

Compiling and Debugging Oracle's Pro*C files in OS-X / Xcode

Part of my work as a Web/UNIX developer includes maintenance and development of tools using Oracle’s Pro*C. In text interfaces, VIM is a pretty decent tool for creating source code and their companion make files. If you created the right make file, compiling is also a breeze. However things get kind of tricky when you have to debug. Oh my! This can be a difficult task. Many may say that there’s nothing like gdb, but come on guys, even you can’t deny the beauty of a visual debugger.

The Rationale behind the Creation of a Model-View-Controller Framework: Fantastic

Important: This is a work in progress document. The Model-View-Controller is a software pattern frequently used for web development. As its name states, it is composed by three components: A Model or domain representation of a problem. It receives commands, processes them and modifies its state according to the input provided. A View whose main task is to retrieve information from the model and turn it into a useful representation for the user.