Month: February 2018

Should you learn C/C++ in 2018 ?

Published on: 15.02.2018

Conclusion

I would not recommend learning C/C++ as your first programing language just for learning to programme, better go with Python.

Also, if you do not know why you want to learn C/C++, better do not spend time it.

My C/C++ backgorund

Most of my professional programming career, around 10 years I have spent writing C/C++ programs.

By professional programming career, I mean that other people have paid me to write code.

I have spent more time in C/C++, altho I would say that I know Python better than C/C++.

My knowledge of Python is better because Python has fewer features than C/C++ and you do not need to do memory management.

Why C/C++ is hard

IMHO C/C++ is hard due to many features and memory management.

By the time you understand memory management, you can learn 80% of Python.

Just look at this image of code that is concentrating 2 strings in C vs. Python.

Yes, there can be less C code (error checking, free, few const less) and the code would still work.

But then I would be showing bad C production code and not be demonstrating how real-world C code should be written.

It is not fun to debug segmentation fault and that is what you get if there is no proper error checking in C.

Python code could, and in real life should also have if __name__ == "__main__":, but I have removed it to because it is not necessary like in C.

Point is that higher level programing language (Python in this example) is doing a lot of low-level things automatically.

So, you need fewer lines of code, what means fewer possible bugs, resulting in increased developer productivity.

The tradeoff is more CPU and memory for faster time to market.

C and C++ are two different programming languages

Here I am using a language construct C/C++.

Because most of the code bases (at least that I have seen in a corporate environment) are some hybrid of C and C++.

My theory is that the older code was written in C and then later they added object-oriented programming (C++).

But C and C++ are not the same programming languages, mental programming models are quite different.

C code is about structure, functions, and pointers.

In C++ you have object-oriented programming and lot of other features.

In the real world, you need to know C and C++, so that is why I use C/C++.

When you should learn C/C++

The only positive thing that I can see that person will learn from learning C/C++ is manual memory management and pointers.

Basically better understanding how the computer (on software level) is working.

If your only reason is to have a better understanding how the computer (on software level) is working, better learn C programing language.

C has fewer features than C++.

It is easier to learn C++ if you know C because then you should know manual memory management and pointers.

But for anything else than few niches (system, embedded, banking, game engines, etc), I do not see a much practical use of C/C++ in the year 2018.

Probably you ain’t gonna use C/C++

I am not saying C/C++ is not in use anywhere in 2018.

I personally (almost every month) get some interview requests for C/C++ positions.

Usually, they are either for embedded software (C) or banking industries (C++).

I am just arguing that beginners (persons that do not know any programing language) should not start with C/C++.

The only exception is if you are planning to get a job (or start your business) in C/C++ environment.

If it is not for the job/business, I do not see why you should learn C/C++, except for hobby.

But even then, get a better hobby 🙂.

P.S. If you, dear reader, think that I am missing some point, please add it in comments.

Samsung ML-1520 on OS X 10.12 (Mac OS Sierra)

Published on: 01.02.2018

I do not like doing upgrades

Especially operating system (OS) upgrades.

The reason, why I do not like them, is because usually after update something is not working as before or even not working at all.

The feature from software is changed, drivers not available anymore, software is not working with a new OS, sometimes new OS is slower than old one, etc.

The only reason why I do upgrade is if I have to (some feature is only working on new OS) or have new hardware (then anyway I need to install OS so I can try the last version).

Regularly I upgrade only iPhone and iPad because I do not use it for work, more for fun (if some software is not working anymore I can live without it).

I bought new SSD

For my 7 years old computer, I decided to upgrade my HDD to SDD because it was the bottleneck.

Upgrade will be done from OS X 10.9 to OS X 10.12.

At that time 10.13 was available as a beta.

But I will not use the beta if I do not have to.

When I did iPhone development with XCode I usually had to use newest OS X to have access to the last SDK.

Always test before upgrade

Luckily I have one Mac Mini, so I decided to do a test installation on it first.

So that I am sure that all software that I use is working fine before I upgrade my main computer.

The biggest problem I had with my Samsung ML-1520 laser printer.

I do remember that even on OS X 10.9 it was also not working by default, but with http://guigo.us/mac/splix/ I manage to have it working.

On OS X 10.12 http://guigo.us/mac/splix/ are still needed, but will not get the job done.

After 2 hours, I manage to have it working on OS X 10.12 (Mac OS Sierra) but it was not easy.

652 WLXKJ USB network server

I have Samsung ML-1520 connected to 652 WLXKJ USB network server so that I can share Samsung ML-1520 as a network printer.

For last 7 years, 652 WLXKJ is working with no problems.

There is no official support for it (I do not even know who made this thing), and you have to figure things on your own (like to add USB stick to it, if you want to use it as network print server).

652 WLXKJ USB server
652 WLXKJ USB network server working with 15 years old USB stick

Samsung ML-1520 on OS X 10.12 (Mac OS Sierra)

The only way how I have found that Samsung ML-1520 laser printer can work with OS X 10.12 (Mac OS Sierra), is to add a PPD (Postscript Printer Description) file manually but http://guigo.us/mac/splix/ must also be installed.

Luckily, PPD file is available at SpliX website, download the source code, unzip it, ml1520.ppd is inside splix-2.0.0/ppd.

There is also ml1520fr.ppd (French language) and ml1520pt.ppd (Portuguese Brazil language), .

After this printing of PDF and DOC documents did work (and I have only tested with PDF and DOC documents).

Steps for installing Samsung ML-1520 on OS X 10.12 (Mac OS Sierra)

Install Splix-2.0.0.mpkg

Splix-2.0.0.mpkg can be downloades from http://guigo.us/mac/splix/ as Splix-2.0.0.zip, unzip it and install it.

You will have the error message The installation failed but this is fine, you need to have, I know it is strange.

the error message The installation failed after installing Splix-2.0.0.mpkg, but this is fine

This is an important step, if you do to it, later when you install Samsung ML-1520 you will have The software for the printer was installed incorrectly. Please reinstall the software from the manufacturer error message and Samsung ML-1520 will not work.

error if Splix-2.0.0.mpkg is nto installed

Add ml1520pt.ppd Postscript Printer Description for Samsung ML-1520

all information from Samsung ML-1520

Add Samsung ML-1520 in System Preference... inside Printers & Scanners
Most important is to in Use: select Other... and then Open file ml1520pt.ppd, remeber you need to download it from SpliX website.

Address:, Protocol and Queue: are specific in my setup because I am using it with 652 WLXKJ USB network server.

When all is finished, Samsung ML-1520 is working fine.

Samsung ML-1520 working fine

This is why I do not like upgrades.

Hopefully, this will be helpful to somebody.