Skip to content

Recent Articles

25
Jul

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.

19
Jul

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):

BINDIR=${prefix}/bin
MANDIR=${prefix}/man
man1dir=$(MANDIR)/man1
 
#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.

19
Jul

Install libsdl2 on OSX using MacPorts

In order to install libsdl2 on OSX using MacPorts run:

sudo port install libsdl2
19
Jul

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.

19
Jul

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.

12
Mar

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"
2
Dec

Solaris Quick Tips

Here are some Solaris commands you might find useful.

ifconfig -a  # show network interfaces
ifconfig qfe0 10.0.0.2 netmask 255.255.255.0  # 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
2
Dec

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
2
Dec

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.

14
Nov

‘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];