When working on a large-scale C++ project with multiple dependencies, it can be challenging to understand the relationships between different components and libraries. Thankfully, CMake provides a nifty feature to visualize these dependencies using Graphviz, a widely-used open-source graph visualization software. Using CMake’s –graphviz option and the dot command from Graphviz is a powerful way
Read more
Tag: convert
Reading JSON from URL in R
Posted onR is good at analyzing data. Many data are provided as JSON from RESTful APIs with an URL. R natively support many data format. For JSON, we can use some libraries. For reading JSON from URL, we can use the “jsonlite” package. In this example, we use an example of fetching BTC prices of last
Read more
3 Ways of .odt to .txt File Conversion in Command Line in Linux
Posted onThe Open Document .odt files can contain rich formats for the content. However, some times a plain text file is more handy. We may convert .odt files to plain text files for such needs. In this post, we discuss 3 ways of how to convert .odt files to .text files in command line in Linux.
Read more
.docx/.doc to .odt File Conversion in Command Line in Linux
Posted onWord .docx and .doc files are common for documents commonly generated by MS Word software. We would like to convert them to the more open ODF Open Document .odt files for various cases. This can be done by GUI software tools. If we have a set of many .docx/.doc files, it will be handy if
Read more
Converting Hex to ASCII Using xxd
Posted onStrings are commonly encoded as hexadecimal (hex) strings for various purposes. Hence, it is also common to convert hex strings to its original strings such as an ASCII string. Hex to ASCII string conversion can be done programmatically in many languages. In command line, we can use xxd to convert hex to ASCII string. This
Read more
Converting Int to String in C++
Posted onIt is common to convert an integer (int) to a string (std::string) in C++ programs. Because of the long history of C++ which has several versions with extended libraries and supports almost all C standard library functions, there are many ways to convert an int to string in C++. This post introduces how to convert
Read more
How to Convert Integers to Strings and Strings to Integers in PHP
Posted onConversion from integer to string and from string to integer are common operations in most applications such as C++. PHP has its uniqueness in language and standard library design. In this post, we will check methods to convert integers to strings and vice versa. Convert string to int in PHP You can cast a string
Read more
How to mirror a website using wget on Linux?
Posted onHow to mirror a website using wget on Linux? If the command can filter only specific file extensions, such as pdf and docx, it will be much better too. To download all PDF files from https://example.org/path/ as an example, you may use this command: wget –mirror \ –convert-links –no-parent –quiet \ –adjust-extension -A pdf \
Read more
What can we expect in Java update 2019?
Posted onJava is the most regularly used programming language for the creation of web applications. This high-level programming language develops by the Sun Micro-system. This language was designed for use in the world of internet and known for fastest, secure, and most reliable language of the computing platform. One interesting fact is that Java programmers are
Read more
How to synchronize Google Drive and Google Docs files in Ubuntu/Debian/Mint Linux using Insync
Posted onGoogle Drive is a nice cloud storage service. It provides a suite of nice online document spreadsheet and slide editors Google Docs, Google Sheets and Google Slides. The collaborative editing and full history tracking features of Google Docs are excellent. Google Drive gives 16GB free storage which is pretty much larger compared to other free
Read more
How to convert a string to lower case in Python?
Posted onHow to convert a string to lower case in Python? For example: “Abc” -> “abc” “BBB” -> “bbb” “abc” -> “abc” You can use the string.lower() method of Python: string.lower(s) Return a copy of s, but with upper case letters converted to lower case. Example: $ python Python 2.7.5 (default, Apr 11 2018, 07:36:10) [GCC
Read more
How to install alien on CentOS 7 to convert .deb to .rpm?
Posted onHow to install the alien command on CentOS 7 to convert .deb to .rpm? alien is already in EPEL and it makes it quite easy to install it in CentOS 7. First, enable EPEL following this tutorials. Then, install alien by # yum install alien Then alien should be ready: # yum info alien Installed
Read more
How to convert a piece of HTML code to plain text in PHP?
Posted onHow to convert a piece of HTML code to plain text without leading and ending spaces in PHP? For example, I would like to convert <div> <b>hello</b> world</div> to a string hello world You may use this piece of code in PHP to strip HTML tags, remove leading and ending spaces and convert special characters
Read more
How to get the one character’s next character in ASCII table in Bash?
Posted onHow to get the one character’s next character in ASCII table in Bash? For example, if I have ‘a’ in variable i, how to get ‘b’? First, we need to get the integer value for the character. char=’b’ charint=$(printf “%d” “‘$char'”) Then, we increase the integer by one let charint=$charint+1 Last, we can get the
Read more
How to split a string by string in Bash?
Posted onHow to split a string by string in Bash? For example, “a string separated by space” => [“a”, “string”, “separated”, “by”, “space”] and “a,string,separated,by,comma” => [“a”, “string”, “separated”, “by”, “comma”] You can convert a string to an array using the grammar like inarr=(${a}) If the delimiter is not space and delimiter is a single character
Read more
How to convert epoch timestamp to human readable date format in Bash?
Posted onIn Bash, how to convert an epoch timestamp to a human readable date format? In Bash, you can use the date command’s -d option: date -d @<your epoch> Here @ specifies the epoch timestamp. One example: $ date -d @1490157520.05 Wed Mar 22 12:38:40 HKT 2017
How to convert epoch timestamp to human readable date format in Python?
Posted onHow to convert an epoch timestamp to a human readable date format? In Python: import time time.strftime(“%a, %d %b %Y %H:%M:%S %Z”, time.localtime(epoch)) One example: $ python Python 2.7.5 (default, Nov 6 2016, 00:28:07) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2 Type “help”, “copyright”, “credits” or “license” for more information. >>> import time >>>
Read more
How to get the epoch timestamp in Go lang?
Posted onIn Go lang, how to get the epoch timestamp, the number of seconds passed since the epoch? In Go, you can use the time.Now() func to get current time and its Unix() func to convert it into an epoch timestamp: import(“time”) func getEpochTime() int64 { return time.Now().Unix() } If you would convert a time string
Read more
How to get the epoch timestamp in Python?
Posted onIn Python, how to get the epoch time (the number of seconds since epoch)? In Python, you can get the epoch time by calling time.time() which return a floating number: import time print time.time() If you would like to get only the number of seconds, you may convert it to an integer. One example is
Read more
How to convert svg to png in Linux?
Posted onHow to convert a svg image file to a high-quality png file in Linux? inkscape works great with vector images (better than ImageMagikk’s convert). Try this command to convert in.svg to a 1000×1000 png image: inkscape -z -e out.png -w 1000 -h 1000 in.svg