Accessing private data members directly outside from its class in C++

Private members in C++ cannot be accessed from outside the class directly. In this post I will tell an interesting fact, that in C++ however there are means with which you can access/modify the values of the private members of a class from outside of the class, when the structure of the class is known.

Continue reading

Posted in C Language, Computer Science | Tagged , , | 1 Comment

Bash Script: Reading ID3v1 Tags

mp3 files contain track name, artist name, etc meta data about the music file itself. The meta data format used in mp3 files are called the ID3 tags. There are different versions of ID3 tags available. The objective is to read this meta data information from an mp3 file having an ID3v1 tag.

A detailed overview of the ID3v1 (as well as ID3v2 tags) are done here in this post: What are ID3 Tags all about?. A small ID3v1 library is also implemented (reading and writing tags) in C language here: An ID3v1 Tag Parsing Library. TagLib is available to read and write ID3v1 and ID3v2 tags and is free to use.
Continue reading

Posted in Computer Science, Linux / Unix Shell | Tagged , , , | Leave a comment

Bash Script: Find occurrence count of a string in a file

A file is given, and a string is given. The number of time the string occurs in the file, and the line number in which the string occurs in the file needs to be found out and printed.
Continue reading

Posted in Computer Science, Linux / Unix Shell | Tagged , , | Leave a comment

Reviewing the GNUSim8085 (v1.3.7)

This article reviews the GNUSim8085 (v1.3.7) a graphical simulator, assembler and debugger for the Intel 8085 microprocessor.

The Intel 8085 is an 8-bit microprocessor that was launched by Intel in 1977 and hence is something that we have never seen around. So why do we need to learn about the programming model and instruction set of this old microprocessor? The microprocessors we use are all for general-purpose computing but there are other applications of computers such as making automatic solar tracking-panels, automatic power-controls, or security control systems. For such applications, general-purpose CPUs are unnecessary-a waste of resources; a low powered CPU is what we need. The Intel 8085 is one of the candidates. To program this piece of hardware, we first need to know the programming model-the logical structure of the programmable registers, flags, and the instruction set.

Continue reading

Posted in GNU+Linux+FOSS, Reviews | Tagged , | 3 Comments

Input Strings with Blankspaces

In CLI programs getting input from the standard input is very important. Often we need to input strings from the user. Strings are delimited by newline, blankspace character and other characters as per the user interpretation. I am discussing on some ways here with which we can take input strings with blankspaces in it safely.
Continue reading

Posted in C Language, Computer Science | Tagged , | 1 Comment

Configure Samsung ML-1666 in Fedora

fedora_logoI recently had a problem with my Samsung ML-1666 Monochrome laser printer: I could not configure it in Fedora. Simply downloading the driver from Samsung website and installing seemed easy, but actually did nothing.

Googling for hours did not solve the problem, but I kept trying and finally got it working. So I thought I should write down what I did, it may help you.

Continue reading

Posted in GNU+Linux+FOSS, Tutorials | Tagged , | 4 Comments

Allocating multidimentional array at runtime in C

Arrays in C language are static in nature, and cannot be resized at runtime. The effect of runtime allocation of an array could be achieved by hierarchically allocating blocks of memory at runtime. Below we discuss the mechanism to allocate multidimensional arrays.
Continue reading

Posted in Coding Discussions, Computer Science, C Language | Tagged , | 2 Comments

C Language Constructors and Destructors with GCC

Constructors and Destructors are special functions. These are one of the features provided by an Object Oriented Programming language. Constructors and Destructors are defined inside an object class. When an object is instantiated, ie. defined of or dynamically allocated of that class type, the Constructor function of that class is executed automatically. There might be many constructors of which the correct implementation is automatically selected by the compiler. When this object is destroyed or deallocated, the Destructor function is automatically executed. For example when the scope of the object has finished or the object was dynamically allocated and now being freed. The Constructors and the Destructors are generally contains initialization and cleanup codes respectively required by an object to operate correctly. Because these functions are automatically invoked by the compiler therefore the programmer freed from the headache of calling them manually.

Continue reading

Posted in C Language, Computer Science | Tagged , , | 9 Comments

WordPress.com Stats API

gimp_logoWordPress.com has a very nice stat plugin showing the overall post views data and also post by post, but it would be always great if there was more. A lot of people talk about introducing Google Analytics. A lot of people save the data offline by copying the summary tables into files to save the site data. I had an idea to process the data of my site a bit differently and find trends in the data. I thought except copy-pasting the site summary data, there should be a cleaner manner to store the data. First I made a brief Google search, then made a wordpress.com forums thread. Then i had a short chat with Mark in wordpress.com freenode IRC and was redirected to wp.com email support. The first result came from email support telling that there is no data export feature. But another email followed to correct the previous one which told about the wordpress.com stats API with which you can get your wordpress.com site’s stats data in CSV or XML format.
Continue reading

Posted in GNU+Linux+FOSS, Tutorials | Tagged , , | 12 Comments

Bash Script: Counting lines, words, characters

Objective

The objective is to write a shell script to mimic the functions of the wc command. This shell script would be made with bash built-ins and standard coreutils commands, and is made as accurate as possible to mimic wc.
Continue reading

Posted in Computer Science, Linux / Unix Shell | Tagged , , | 5 Comments