Teaser No. 1


JNICB

Check whether OS X is in Dark/Light theme

Recently, I was forced to check whether application is in Dark/Light theme (status icon must be either white or black).

I have found two solutions. First one

boolean isDark = [NSAppearance currentAppearance] name] 
  containsString: NSAppearanceNameVibrantDark]

and second one

boolean isDark = [[[NSUserDefaults standardUserDefaults] 
  stringForKey: @"AppleInterfaceStyle] isEqual: @"Dark"]

To my surprise, both can give different results.

First one, seems to fail when you open new window from the status bar icon. In that case, after closing the window you get the value @”NSAppearanceNameVibrantLight”, which is wrong. It seems that for some reason window thinks it is executed in Light mode instead of Dark.

And Now for Something Completely Different – Type-R

If you are fan of Type-R, as I am, you will probably like this one :)

https://www.hondatheotherside.com/

And Now for Something Completely Different – Ann Cotten “Homology, Myself”

You probably know that feeling when you link randomly placed elements and, at some point, something unexpected emerge. This is exactly the case I had with Ann Cotten.

So, it started with Gh+ broadcast by Grzegorz Hoffmann. At 8-th of December he was playing Mr. Oizo and some other stuff that was pretty cool. As I couldn’t find this particular episode I started to browse a little bit on Gh+ pages and I have found this piece of music: Tarwater – Homology Myself (link). You can also find it on iTunes if you like (link). To be honest, at first, I was sure the poem that was used as a lyrics was written by William Blake. The reason here was that way of performing it and the way of the composition resembles parts of the music you can find on Dead Man OST composed by Neil Young. My mistake. It turned out that I was plain wrong. The author of the poem was Ann Cotten. Once I had this one, I had to find the book and it must have contained the poem translated into english – I don’t speak german. After few tries I have eventually found the book: Ditchten= 10. To my surprise it turned out to be quite good collection of modern, german, poets (you should try it for yourself as well).

So, in my case, getting Ann’s poetry was something like this:

flateric

gh+

tarwater

ditch

KleinBottle-01

And, that’s all for something completely different for today :)

P.S.
I have intentionally used homology in the mathematical sense. I couldn’t find Ann’s logo :)

rxvtimg.C error: ‘PictOpDifference’ was not declared in this scope

If you experience the issue with following error:

rxvtimg.C: error: ‘PictOpDifference’ was not declared in this scope

you can overcome it by commenting out following part in config.h

/* Define to enable xrender support */
/* #undef XRENDER */

Update:

Optionally, you can disable transparency by setting following settings in config.h

/* Define if you want your background to use the parent window background */
#undef ENABLE_TRANSPARENCY

#error Blitz is configured with –enable-threadsafe

#error Blitz is configured with --enable-threadsafe, 
but no compiler thread support is found. 
Did you forget, e.g., "--pthread"?

This message might be quite confusing, as typically, you will blindly take “–pthread” and pass directly into g++. However, g++ have other option :)

-pthread

DDD – compilation fails: strclass.C: In function ‘std::istream& operator>>(std::istream&, string&)’: error: ‘EOF’ was not declared in this scope

If you have an issue while compiling DDD

strclass.C: In function ‘std::istream& operator>>(std::istream&, string&)’:
strclass.C:1546:35: error: ‘EOF’ was not declared in this scope

Go ahead, and thanks this guy http://garricksblog.blogspot.com/2012/02/mid-terms-and-build-errors.html.

quote: “It turns out that the constant EOF was not probably declared by including stdio.h. So I went ahead and added that in:

homer@homer-desktop:~/MyPrograms/ProgramSourceCode/ddd-3.3.12$ diff ddd/strclass.C ddd/strclass.C.old

42d41

< #include

I owe you a beer ;)

Theme, you can fall in love with :)

    Recently, while reading Getting started with tmux, I have read about really nice theme -“SOLARIZED”. You can find it here: http://ethanschoonover.com/solarized

    There is a predefined profile for iTerm, so you are good to go straight after downloading it. Highly recomended.

Getting Started with tmux by Victor Quinn, J.D.

tmux

Summary: short and straight to the point

This book is one of these short manuals where you get exactly what you need. Simple and straightforward explanation of the tool, helpful examples, and real life cases that show how can you improve with tmux with really not too much effort.

You are literally guided step by step in each case and it is really hard to get lost. In my opinion, samples do really reflect activities that most people do while working with ssh. It is not just a random set of advices taken from the internet.

And, you get this nicely organized Appendix with all the key bindings used through out the chapters.

I would recommend this one for anyone who haven’t heard about tmux yet, but works with ssh a lot.

e-book: Getting Started with tmux

Modern Perl Best Practices by Damian Conway

bkt_perl_modern_practices

Summary: Highly recommended

Whether you want to watch this video heavily depends on how much Perl do you use, and how much do you appreciate good advices.

If you work with Perl on day to day basis, and you want to improve by applying some of the good practices, really consider this one. Damian Conway goes over variety of topics here and presents best practices. Of course the term best is heavily biassed here, as author shows what is the best in his opinion. It not always must be the case, but still, huge part of the video shows you really good practices, while remaining one presents almost best practices.

What is really worth to watch is the approach to certain topics and, to my surprise, some of the ideas can be easily adapted to Python as well. Of course you can’t get them directly, but concepts and ideas are really worth taking them into Python instead of Perl. This, for example refers to hash map manipulations, passing arbitrary number of arguments via dictionary, naming conventions, data layout in the code, code formatting and documentation, etc. Even though you won’t be able to apply these rules directly, you will be still able to follow them.

As for perl itself, there were few surprises in the video that caught my attention (I am just a casual perl developer). I was caught by some builtins (e.g. enumeration), I was surprised by some conventions that can do you lots of harm when incorrectly used (e.g. scalar vs. list context), and in general it was real eye-opener in many cases (but that might be the result of my rather reduced activity when it comes to day to day usage of language).

If you ask about lecture delivery, video quality, and material preparation – they are simply top-notch.

As for the best practices themselves, these are not defined by simple set of rules, but your attitude towards excellence in what you do – as Damian points out at the end.

Highly recommended.

←Older