Today I bring an example of the different results you can expect when using Java’s BigDecimal class. From instantiation to applying different arithmetic operations, it is important to understand how they affect the resulting instances.
The following program shows different scenarios and results applied to BigDecimal’s.
package test; import java.math.BigDecimal; import java.math.RoundingMode; public class Test { public static void main(String[] args) { BigDecimal a = new BigDecimal("1.204165"); System.out.println("a (from string): " + a); // 1.
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.
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; }
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.
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.
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.
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.
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.
Relaxing stroll in the desert.
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.