Skip to content

Recent Articles


Convert a PNG image to a BMP image without compression for BMP file using ImageMagick

We can use ImageMagick tool to convert a PNG to a BMP image without compression using the following line:

convert img1.png -alpha off -compress none img1.bmp

Note: convert utility is from ImageMagick package that is available on multiple OSes.


Error: Makefile:: *** missing separator. Stop.

If you get the following error when trying to compile an app using a Makefile:

Makefile:14: *** missing separator.  Stop.

Then the problem is you need two tabs in front of $(CC) line (see the following example):

#CC=clang++ -g
CC=clang++ -g -O3 -mavx
CFLAGS=-pipe -Wall -O
LDFLAGS=-lSDL2main -lSDL2 -I/opt/local/include -L/opt/local/lib
all: a.o
a.o: main.cpp
	$(CC) $(LDFLAGS) main.cpp -fPIC -o test_app

Note that you will need two tabs, not one, not spaces. On some OSes it might work with one tab.


Install libsdl2 on OSX using MacPorts

In order to install libsdl2 on OSX using MacPorts run:

sudo port install libsdl2

Search for ports using MacPorts on OSX

If you want to search for a port name when using MacPorts system on OSX run the following command:

sudo port search sdl

Previous command will display all ports from MacPorts that contain the name name sdl.


Error: main.cpp: warning: using directive refers to implicitly-defined namespace ‘std’

If you see the following error when trying to compile a C++ application:

main.cpp: : : warning: using directive refers to implicitly-defined namespace 'std'

then that means you do not have any header file inclusion that uses std namespace.

You can fix this warning by including a C++ header file that uses a std namespace otherwise the compile will not know about std namespace.


Search a String in a Binary File From Command Line in Linux or OSX

If you want to search for a string in Linux or OSX you can do it from command line (terminal) using string command:

strings -a -t x /bin/bin_file | grep "string to be searched"

Solaris Quick Tips

Here are some Solaris commands you might find useful.

ifconfig -a  # show network interfaces
ifconfig qfe0 netmask  # configure network interface
ifconfig qfe0 plumb up # activate network interface

If you want to make the change permanent after reboot create the following file: /etc/hostname.qfe0 Also we must add the new interfaces to /etc/inet/hosts file. If you want that card to be configured automaticall using dhcp you will also need to create /etc/dhcp.qfe0 file.

dladm show-phys  # show physical network interfaces
dladm show-link  # show link status for network interfaces
prtconf -pv  # show pci identification details for your hardware

From previous commands you will be interested in vendor-id and device-id. Then using those IDs look into /boot/solaris/devicedb/master file.

modload /kernel/drv/iprb     # load a kernel module
kstat -c net | grep net      # display kernel statistic related to the network
scanpci                      # list pci hardware

Succesfuly Importing a ZFS Pool Read-only when Kernel Panics

If we try to import a ZFS pool and the kernel crashes we can try to import the pool in read only mode:

zpool import -f -N -o readonly=on -o failmode=continue tank

Oracle Solaris 11 Live Media or OpenIndiana Default Password

If you’ve installed Oracle’s Solaris or OpenIndiana and you want to know the default username and password here it is:

Username: jack
Password: jack

You can also switch to root using the following command

su -

The password for root (when using su) will be solaris.


‘initWithCString:’ is deprecated: first deprecated in iOS 2.0

Let’s say we got the following warning when trying to compile an Objective C code:

‘initWithCString:’ is deprecated: first deprecated in iOS 2.0

The line is:

NSString* nsString = [[NSString alloc] initWithCString: fileNameWE];

To solve the warning we will use stringWithFormat method instead so our modified code is:

NSString* nsString =[NSString stringWithFormat:@"%s", fileNameWE];