BSD sed: extra characters at the end of d command

For anyone who found this question due to a similar error message, but caused by an attempt to in-place edit on Mac OS X As per https://github.com/lmquang/til/issues/18: OS X requires the extension to be explicitly specified. The workaround is to set an empty string: $ sed -i ” ‘s/megatron/pony/g’ /path/to/file.txt ^^ man sed: -i extension … Read more

What does -D_DEFAULT_SOURCE do?

The glibc manual describes each feature test macro (FTM) including _DEFAULT_SOURCE: If you define this macro, most features are included apart from X/Open, LFS and GNU extensions: the effect is to enable features from the 2008 edition of POSIX, as well as certain BSD and SVID features without a separate feature test macro to control … Read more

What is the status of POSIX asynchronous I/O (AIO)?

Doing socket I/O efficiently has been solved with kqueue, epoll, IO completion ports and the likes. Doing asynchronous file I/O is sort of a late comer (apart from windows’ overlapped I/O and solaris early support for posix AIO). If you’re looking for doing socket I/O, you’re probably better off using one of the above mechanisms. … Read more

How do I timestamp every ping result?

I could not redirect the Perl based solution to a file for some reason so I kept searching and found a bash only way to do this: ping www.google.fr | while read pong; do echo “$(date): $pong”; done Wed Jun 26 13:09:23 CEST 2013: PING www.google.fr (173.194.40.56) 56(84) bytes of data. Wed Jun 26 13:09:23 … Read more

How do I determine the target architecture of static library (.a) on Mac OS X?

Another option is lipo; its output is brief and more readable than otool‘s. An example: % lipo -info /usr/lib/libiodbc.a Architectures in the fat file: /usr/lib/libiodbc.a are: x86_64 i386 ppc % lipo -info libnonfatarchive.a input file libnonfatarchive.a is not a fat file Non-fat file: libnonfatarchive.a is architecture: i386 %

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)