Categorized under: CUDA, Linux, Programming, Windows

Making Code:Blocks highlight CUDA syntax

I just formatted my notebook and installed a fresh copy of Windows and Ubuntu. And then I noticed I forgot to backup my CUDA lexer file for Code:Blocks. So I created a new one and thought I’d share it in case anyone needs it. :)

To make your Code:Blocks highlights your CUDA syntax, simply download my lexer_cuda.txt (3) file, rename it to lexer_cuda.xml (apparently wordpress didn’t allow me to upload .xml file extension), and put it in:

  • [Windows] C:\Program Files (x86)\CodeBlocks\share\CodeBlocks\lexers
    • Or <Code:Blocks installation path>\share\CodeBlocks\lexers if you installed it to different folder.
  • [Linux] /usr/share/codeblocks/lexers

It works for Code:Blocks 10.05 and file extensions .cu and .cuh. You can add more extensions by yourself either by

  • Editing the line filemasks=”*.cu, *.cuh” in my lexer_cuda.xml file, or
  • Opening Code:Blocks
    • Go to Settings >> Editor >> Syntax Highlighting
    • Select CUDA in ‘syntax highlighting for’
    • Click Filemasks button, add the new extension, and click ok.

Credit: I used CUDA keywords from cuda.lua file.

Categorized under: Windows

Notepad++: Change Print Font Size

Notepad++ doesn’t have a menu to configure print font size.. How inconvenient, I really think this is a must-have feature!

This link tells me there are two ways to do it: by macro, or NppExec. The macro method didn’t work for me (I added the code in shortcuts.xml but the macro doesn’t show in Notepad++ so I couldn’t run it) The NppExec method has very brief explanation I don’t know how to do it.. And I couldn’t find a quick link that tell me exactly on how to do that method either. It was frustrating. A user who just wants to change print font size shouldn’t have to learn details about NppExec and Scintilla. So I think I would share here.

This is my take on it: Basically Notepad++ runs on a backend called Scintilla. And we can change print font size by sending a message to Scintilla to change its  SCI_SETPRINTMAGNIFICATION parameter. We can send a message to Scintilla by either running a macro, or via NppExec. Below is how I do it using NppExec.

  1. Plugins -> Plugin Manager -> Show Plugin Manager
  2. Select NppExec and click Install
  3. Restart Notepad++ after finish installing
  4. Press F6 or click Plugins -> NppExec -> Execute
  5. Type in SCI_SENDMSG 2146 -2
    • SCI_SENDMSG is a command to send message to Scintilla
    • 2146 is a code for SCI_SETPRINTMAGNIFICATION
    • -2 is a parameter, telling Scintilla to reduce the font size by 2 level
  6. Click OK
  7. Done.
Categorized under: Linux, Programming

My Linux Quick Reference

Just some commands that I tend to forget..

Screen

Terminate: Ctrl+D if Ctrl+A Ctrl+\ or Ctrl+A Ctrl+4 doesn’t work

Stop Beeping

Needs root permission.

Temporarily

modprobe -r pcspkr ->Disable
modprobe pcspkr -> Enable

Permanently

Add this line to the end of /etc/modprobe.d/blacklist
blacklist pcspkr

Piping stderr

foo 2>&1 | bar

To see only error messages (from compiler)
make sth 2>&1 | grep error

Useful Commands

/usr/sbin/dmidecode -t memory : Get mem details
. .profile or source .profile
ulimit -s unlimited
hid2hci
dhclient eth0
ip a
visudo
ln -s <target> <link name> : Symbolic Link

Categorized under: Linux

Recording Screen in Ubuntu

My rankings for the applications to record screen activities in Ubuntu. Sorry for no screenshots. Will add when I have time.
In brief: Use Xvidcap.

1. Xvidcap

  • Easy to install
    • sudo apt-get install xvidcap
  • Easy to use
    • The only thing I find is hard to do is saving. You have to specify the name & path in the preferences.
  • Can record cursor & Compiz effects
  • Can save to many file formats (many video & audio codecs to choose)
  • Support playback after recording
  • Project page

2. RecordMyDesktop

  • Easy to install
    • sudo apt-get install gtk-recordmydesktop
  • Easy to use. Although the GUI is inferior to Xvidcap.
  • Can record cursor & Compiz effects
  • Only support open file format (.ogv)
  • Doesn’t support playback. Have to save the recorded video in order to view.
  • Project page

3. Istanbul

  • Easy to install
    • sudo apt-get install istanbul
  • Easy to use.
  • Couldn’t stop recording. I had to kill the process. – -”

4. Wink

  • Not-so-easy to install
    • Download .zip from here
    • Extract and you’ll get a folder containing 2 files: installdata.tar.gz and installer.sh
    • Run ./installer.sh
    • You’ll probably get an error message saying libstdc++.so.5 and libexpat.so.0 are missing
    • libstdc++.so.5: Install package libstdc++5  - Get it from packages.ubuntu.com
    • libexpat.so.0: Create symbolic link from the existing libexpat you have
      • sudo ln -s /lib/libexpat.so.1 /lib/ libexpat.so.0
    • Run ./installer.sh again
    • Specify the path for the program
    • try running it from its folder ./wink
    • Voila! I can run!.. but how to record…? ..I’m done – -”
  • Don’t know how to record.. The end. LOL
Categorized under: SYTYCD, TV

SYTYCD8 Top 20

Video credit: SYTYCDFanS08V2

Unlike Season 7, which LoFro won me over since Vegas Round, I don’t have my clear, ultimate favourite yet. But I do have some favourites: Iveta, Sasha, Melanie.

Performance Night

I only liked 3 out of 10 routines. I almost liked Sasha’s routine, though.

1. Melanie & Marko – Contemporary

Choreographer: Travis Wall
Absolutely stunning.
Love the way melanie moves — so smooth — and her lines. Marko is also very strong.

2. Iveta & Nick – Quickstep

Choreographer: Jason Gilkison
They WERKED the Quickstep, the kiss of death!!!

3. Missy & Wadi – Jazz

Choreographer: Sean Cheesman
Missy’s movements were sharp! Loved Wadi doing freerunning at the end.

Random Opinions:

  • The were too much overpraising. The judges should get real with the critiques, like what they used to be in the early seasons.
  • Jess made Tyce’s Broadway routine work. And he finally got rid of the frowned face he usually makes while dancing! He’s growing on me.
  • Missy & Wadi are also growing on me.
  • Chris Scott disappointed me. Twice in just one episode :( Gotta give him some time to adapt.
  • I wanted to like Ashley but she hasn’t shined yet. And somehow I found Chris weaker than Ashley in their (already weak) Hip Hop routine.
  • Robert’s Woo~ thing, which is usually iritating, was bearable in this ep., only because of Jason’s and Mary’s Woo~. But he really should get rid of it/tone it down.
  • Has never been a fan of Ryan’s dancing. I don’t know. Just something about the way she moves.
  • Jordan playing dumb about the afro jazz was kinda cheesy. Not a smart move.

Fun Fact:

I read from somewhere that Sasha is a Russian short name for Alexander/Alexandra. So the Sasha/Alexander pairing = both Sashas.. LOL

Suggestions:

  • I want to see a ballroom/latin group routine. I’m pretty sure they haven’t done it since season 5 (Hip-Hop/Samba.. watch it.. so awesome).
  • The dances need to vary more. Lately the show has been too Contemporary heavy. (Jazz doesn’t make it feel much different) It can be boring.
  • More creative storylines. Or even no storylines at all. I’m sick of the storylines about disappointed love, cheating, you name it. I miss Wade Robson not only for his unique, outstanding choreo, but his refreshing back story of the choreo as well. (Night of the Dancing Flame, Ruby Blue, etc)
  • Need more fun, uplifting routine as well.
  • Want new choreographers. This season so far I only saw Sonya, Travis, Tyce, Jason, Chris, Seen and Stacey, whose routines we saw too many that it started to get boring already in season 7, choreographing. And most of them choreograph 2 routines per week, which usually turn out to a better and a lesser routine, or two pretty mediocre routines, both of which aren’t fair to the dancers. New choreographers could bring something new, and reduce the load on the current choreographers so that have more time to polish their routine.
  • Asking the past contestants to choreograph could be awesome as well. Travis isn’t the only one that can choreograph.
  • I’m really interested to see Ellenore’s choreo. Preferably the routine with the fun vibes like her solo in vegas.

Elimination Night

Great Group routine. Sonya’s routines are always a hit or miss for me. I personally think a top 20 routine is the hardest group routine to manage because of the amount of people on stage. If you can’t manage it well enough it will look like a hot mess. Props to Sonya for that.

Opinions:

  • I’m glad Iveta and Nick survived the curse of the dreaded Quickstep. (I knew Nick is popular but I couldn’t help worrying)
  • No elimination has happened before, Nigel. In just the last season.
  • Double elimination never ends up good. I have a feeling we are going to lose some dancers who deserve to go far (=whom I like.. LOL) next week.
  • I understand Nigel, though.
  • Robert, aka the Wooo~ man, annoyed the heck out of me. It was just too much. And his solo wasn’t even good. His attempt to do locking looked more like flailing around.
  • Gotta quote Cat: You can’t outWoo Mary.