# Jaime Rios ## Posts - [Package management with CMake's CPM](https://jaimerios.com/?p=1911): I’ve used conan and vcpkg with varying levels of success. Recently, I came across CPM.cmake and it works quite well with the projects I have used it in. For getting CPM.cmake in your own CMake project, you have to download the CPM.cmake code: The above code will download the CMake module and after that, you can bring in libraries, like Catch2: There are examples of how to use the CPMAddPackage function call, in folder https://github.com/cpm-cmake/CPM.cmake/tree/master/examples Sometimes, I found, that not all libraries set up properly without a little extra help. Here’s an example: The above project just brings in the ... Read more - [Automate Evernote using AppleScript](https://jaimerios.com/?p=1808): This is just a sample of how to create pages in Evernote using AppleScript. Portions of AppleScript code were borrowed from posts on http://veritrope.com, thanks to them for that help! - [Unit Tests and CMake](https://jaimerios.com/?p=1797): Here’s an example CMakeLists.txt, where I set up a unit test target, using the GTest framework: The above should get you going with unit testing, as long as CMake can find the GTest frameworks on your computer. If you need to point CMake to another directory for the GoogleTest, GTest, stuff, you can add the following to your CMakeLists.txt file: The set command, followed by GTEST_ROOT will set that variable to the path you need. The above path is just an example and you can change it to anything. Ref: https://stackoverflow.com/questions/8507723/how-to-start-working-with-gtest-and-cmake - [clang static analyzer](https://jaimerios.com/?p=1792): I used Xcode and loved the static analyzer. Then I switched to Visual Studio Code to do my C++ programming and wanted the static analysis done on my own code. To do this with the LLVM tools, you use the tool scan-build. You have to call that CLI first before cmake, and you should use it in its own directory: I’m using Ninja in the above example to build my project files, so to build: … this will output any problems that there are with the code. Here’s some sample code… bad code, I put together for this article: When ... Read more - [C++ std::erase and rbegin/rend](https://jaimerios.com/?p=1788): Once. Only once have I done this. I had to traverse a std::vector in reverse, and at some point, I had to call std::erase. I thought, “Ok, this should work” and instead, something bad happened. I little digging around, and a stackoverflow.com answer later, I saw an answer that left me scratching my head. The short answer is, if you are using a reverse_iterator, you have to supply an iterator that std::erase can work with. You do that by calling base on the iterator. You also have to move the iterator one position over since reverse_iterators and regular iterators point ... Read more - [Mandelbrot Set](https://jaimerios.com/?p=1776): I’m quite fascinated with the image that the Mandelbrot Set produces, but admittedly, I didn’t understand how to implement the function from the description on Wikipedia. Thankfully, there are 2 really good videos that give an overview and an in depth explanation of the function, which you can watch at: Mandelbrot back to basics: https://youtu.be/FFftmWSzgmk Mandelbrot Set described: https://youtu.be/NGMRB4O922I The formula, zn+1=zn2+cz _{n+1}=z_n^2+c , involves complex numbers, which you will see used in my implementation. In my implementation, we go through each x,y coordinate, checking if at that coordinate, whether or not the values returned are within the Mandelbrot Set ... Read more - [C++ std::next](https://jaimerios.com/?p=1773): Another way to increment an iterator, and preferred if you’re using std::move in your code, is to use std::next over ++. Here’s an example: Now, since we are not modifying anything in our string, we could also use const iterators, simply replacing begin and end with cbegin and cend : Languages:C++11, C++17 Refs: https://en.cppreference.com/w/cpp/iterator/next https://en.cppreference.com/w/cpp/iterator/begin - [C++20 std::source_location](https://jaimerios.com/?p=1770): This is a compile time utility, which replaces macros like FILE and LINE. I’m partial to using functions over macros, and this compile time utility looks nice: This is weak example of what you can do with the above class, but you get the idea. - [Canonicalizing a URL path using std::filesystem::canonical](https://jaimerios.com/?p=1766): More specially, a file path where we are trying to remove .. and . So, if you have “projects/vectorization/../gitstuff/./../../something/index.html” canonicalizing the string would reduce it to “something/index.html” We have a couple of options to do this. Option 1 – use std::filesystem Since C++17, you can take a path, and canonicalize it using std::filesystem::canonical. For paths that do not exist, or you just want to mess around, you can use std::filesystem::weakly_canonical to remove .. and .. It’s really simple to work with, and here’s an example of how to use it: Option 2 – use a stack We can use a ... Read more - [C++ std::rotate](https://jaimerios.com/?p=1763): This is an interesting template function, defined in , which moves elements of a container class, much in the same way when you rotate the number wheel on a luggage combination lock: rotate the wheel to the left, all of the numbers move along with that rotation; rotate the wheel to the right and the numbers do the same thing, but in the opposite motion. Much like the arrow on the combination lock, the rotate’s second parameter, ForwardIt n_first, is the element that ends up being under the arrow. By being under the arrow, we mean that ForwardIt n_first ends ... Read more - [C++ stack](https://jaimerios.com/?p=1759): In some sample code, you may see a reference to stack. This is a type of data structure, that according to cpp-reference : This is actually a wrapper for another container class. An example of it’s use is: - [Using C++ std::merge](https://jaimerios.com/?p=1757): There have been a few times that I needed 2 vectors to be … merged… and they had to be ordered. It’s simple when you have a plain old type, and are using the back_inserter to append the contents of each vector to the end of the merged vector, but what if you want to use your custom class? And what if you need a custom means to sort the merged vector? You can use a predicate function to put the items in the correct order in the merged vector. The format for the predicate function is bool FunctionName(const T& ... Read more - [Using shared_ptr, a short article](https://jaimerios.com/?p=1753): How can I create a shared_ptr? How about a NULL shared_ptr? What if I already have a shared_ptr, that I own, and I want to null it out? Ok, ok. What if I want to null out my shared_ptr and at the same time, replace it with a new instance? How do I check if the shared_ptr is still in use? What if I’m in a class function and want to take my current instance and pass it to another function as a shared_ptr?A: So long as your class is already managed by an existing shared_ptr, you can: That’s pretty ... Read more - [Working with REST Index](https://jaimerios.com/?p=1717): Article Series, “Working with REST” This post is simply an index, to help navigate through the articles. Working with REST Making a connection using Swift Connecting with C++ - [Connecting with C++](https://jaimerios.com/?p=1661):   Previously … We connected to our local JSON server using a console app, writen in Swift: Making a connection using Swift In this article, we are going to do the same thing, this time using C++. Libraries Swift comes with a large library of functionality, including classes to connect to a REST server. The standard C++ library comes with a lot of functionality, but it does not have a library for connecting to a web server. For that, we are going to use the CPP REST SDK by Microsoft, formally known as Casablanca. Since this library handles connections to ... Read more - [Making a connection using Swift](https://jaimerios.com/?p=1638): Previously Part 1, Working with REST In the previous article, we installed a local JSON server, to make testing the app we are about to create in this article, fast. In this article, we are going to create a console app, using Swift. In the following article, we will be doing the same process, using C++. Creating a console app in XcodeLaunch Xcode, then create a new project using Select “Command Line Tool” Enter in the name for your app. You can leave the organization name to the defaults. We are presented with a basic console app project; the file ... Read more - [Working with REST](https://jaimerios.com/?p=1631): An introduction on the server technology and how to connect your app to a web endpointIntroThis is the first article, in a series. By the end of the series, you should be able to connect your app, whether macOS, iOS, console, to a REST endpoint. There are a lot of articles on the internet that cover connecting to a web end, this is a little different in that it takes you from baby steps to running. From really easy, to really hard. Like any other journey, let’s start at a beginning, with a foundation. The languages used in this series ... Read more - [Rationalizing the expense of attending a C++ conference](https://jaimerios.com/?p=1619): In my mind, it is always a win to go to a C++ conference. There are still managers who are against sending developers to conferences, for their own reasons, many of which I disagree with. Not because I myself am a C++ developer, but because, as a community of developers, we do seek the opportunity to grow, to learn, and to connect with other developers. Having the opportunity to do such things keeps developers happy, and being happy, means developers have more drive to deliver. If you need a listing of reasons why to send your developers to a C++ ... Read more - [Android Studio weirdness](https://jaimerios.com/?p=1617): Or I should write, macOS and Android Studio not playing well with each other. I updated my installation of Android Studio to 3.4 and something unexpected happened almost every time I brought up the “Find action” menu (Command+Shift+A) where Terminal.app would pop up immediately after the “Find action” menu popped up. Turns out, this was a Keyboard shortcut conflict with the latest version of macOS Mojave (https://intellij-support.jetbrains.com/hc/en-us/community/posts/360003367639-2019-1-Find-Action-shortcut-opens-terminal-securityuploadd-) To fix the issue, you have to “Go to System Preferences | Keyboard | Shortcuts | Services and disable Search man Page Index in Terminal.” - [USB Overdrive to the rescue](https://jaimerios.com/?p=1604): Earlier this year, I took the plunge and bought myself a WASD Code Keyboard, with Cherry MX Green buttons and 0.2mm sound dampeners… it’s oh soooo nice! (http://www.wasdkeyboards.com/index.php/products/code-keyboard/code-104-key-mechanical-keyboard-mx-green.html This keyboard was paired up to my 2017 MacBook Pro; I type a lot for a living and and mechanical keyboards work well for what I do. When the laptop was on all the time, I didn’t have any issues. However, if the computer would go to sleep, sometimes, I would find that the keyboard would not work. To get the keyboard to work again, the USB connection had to be disconnected, ... Read more - [If you want to make your own card game](https://jaimerios.com/?p=1578): This site seems like the place to get it done: https://www.blackbox.cool These folks are the creators of “Cards Against Humanity” and to boot, the site looks cool. - [Cool terminal app](https://jaimerios.com/?p=1572): Sometimes I run really long tasks in Terminal.app. I sometimes wait. I sometimes go somewhere else and forgot that it was running. It would be so cool to have Terminal.app use Notifications to let me know that it is done. Well. Thankfully, someone has done just that and it can be downloaded via homebrew. To install, type : $ brew install terminal-notifier To use: $ echo "I'm pretending to be a long running task" ; terminal-notifier -message 'All done!' Thanks to the folks over at apple.stackexchange.com for listing out this cool utility. - [Perforce DVCS and iCloud Drive](https://jaimerios.com/?p=1568): I use Perforce DVCS for almost all of my projects: it’s a great new feature for p4, and I use it on a daily basis, given, I usually away from my home server. Now, there is one DVCS instance I use, which happens to be on my iCloud Drive folder. That seemed to work well … until one day … The instance stopped working. It didn’t recognize the DVCS client name, and when it would pop up the name in the error log, most of the client name was chopped off… even though I can see the client name in ... Read more - [A quick word on modern BASH](https://jaimerios.com/?p=1545): Here’s a page that has some useful tips for modern BASH scripting: http://www.davidpashley.com/articles/writing-robust-shell-scripts/ - [Building OpenCV as a macOS Universal Intel Binary](https://jaimerios.com/?p=1535): So, for my project, I needed an Intel Universal build of the OpenCV library. The copy of the OpenCV source I have on my machine is version 3.0.0 and it has worked well for me, so I’ll start with that. My build machine is running macOS 10.12 and has Xcode 8 installed on it. OpenCV uses cmake for its build system, so you have to download and install the CMake app for macOS. I got my copy from https://cmake.org I referred to the article listed on Wired Watershed to help me get started. I made the following changes to the ... Read more - [Creating a remote from an already existing depo](https://jaimerios.com/?p=1525): Today, I created a remote depo, so that I can use the DVCS functionality in P4 with one of my projects. First, I connected to my perforce server and typed: $p4 remotes To see all of the remotes that were on the server. Before doing this command you have to type: $p4 login Which thankfully, my username on the linux server is the same as my username in the Perforce server so I didn’t have to type that again. Once I was logged in and saw that there was no remote set up for the project I wanted to use ... Read more - [How to install Perforce DVCS](https://jaimerios.com/?p=1515): Introduction For 9 years now, I’ve used Perforce; before that, it was MKD, Subversion, VisualSourceSafe, CVS and a few others. In the past year, I used Git. One cool thing that Git has that Perforce didn’t have was being able to save your changes while not being connected to a central server. However, Perforce recently added native DVCS to their source control tools so, checkouts and submits are now possible while offline. Here are the steps you need to take if you want to use Perforce DVCS on your computer. Note, I’m using macOS, so my instructions are for that ... Read more - [Haversine formula now on GitHub](https://jaimerios.com/?p=1510): The C implementation of the Haversine formula I ported from Javascript is now hosted on GitHub. The project from this website is now up on GitHub for anyone to view. I also plan to do some updates to the code since C++14 has been out and has a lot of good features to add. - [Using P4Plugin with Jenkins to publish assets](https://jaimerios.com/?p=1498): I was previously using the Perforce Plugin in Jenkins to handle my tasks with Perforce, including adding files that needed to be released from a build, but in the past year, I’ve experienced some weirdness that lead me to evaluate the P4Plugin by Perforce. All of the weirdness that I saw in the prior plugin went away, but I couldn’t figure out how to publish only certain files from a build. There wasn’t anything in the documentation instructing you on how to do this feature and when I would use the Publish Assets feature, all of the extra files created ... Read more - [When you have Jira and Confluence running on the same server ...](https://jaimerios.com/?p=1490): You have to change the Context path for each app to be in a different directory. That is one option, which is listed on atlassian.com If you don’t set this option, you may be logged out of one Atlassian product when you go to log into the other. - [Xcode plugin for Perforce](https://jaimerios.com/?p=1468): I use Perforce as my version control system and Xcode as my IDE. Unfortunately, Apple removed Perforce support from Xcode a whiles back for reasons unknown. So, to work around the problem, I started to use of DTerm… but I wanted more. I created AppleScripts for both Xcode4 and Xcode5 which was better, but… I wanted more. So, I took the plung and wrote a plugin for Xcode using Swift. The plugin is hosted on Perforce’s Swarm website, which you can download and build in Xcode. Once you build the project, the plugin is automatically installed for you. Pay attention ... Read more - [Xcode dylib constructor destructor](https://jaimerios.com/?p=1426): I meant to post this link a while ago, but here it is anyway: TP40002013-SW17 So, in a dylib, you can have code execute when the dylib is loaded and execute code when the dylib is being unloaded: __attribute__((constructor)) static void initializer1() { printf("[%s] [%s]\n", __FILE__, __FUNCTION__); } __attribute__((constructor)) static void initializer2() { printf("[%s] [%s]\n", __FILE__, __FUNCTION__); } __attribute__((destructor)) static void finalizer1() { printf("[%s] [%s]\n", __FILE__, __FUNCTION__); } __attribute__((destructor)) static void finalizer2() { printf("[%s] [%s]\n", __FILE__, __FUNCTION__); } - [openframeworks plugin for Xcode](https://jaimerios.com/?p=1465): Sweet! Now you can add open frameworks add ons to your project from a Xcode plugin: https://github.com/admsyn/OFPlugin Of course, if you have Alcatraz, you won’t need to go to the github site to download the plugin, just get it from “Package Manager” within Xcode - [You can run Swift code from the command line?](https://jaimerios.com/?p=1461): WAT? Now this is something else! practicalswift.com - [A package manager for Xcode named Alcatraz](https://jaimerios.com/?p=1436): I learned about a package manager for Xcode named Alcatraz when I attended CocoaConf in San Jose earlier this year. Extending the functionality of Xcode through plugins has been something I’ve been looking into for a while and the only plugins I knew about in the wild could only be found through Google searches or on NSHipster.com The tool makes it much easier to find plugins for Xcode. Buuuut, it actually also serves up themes, templates and more, all from a menu available within Xcode. Installation is also simple. Type in a single Terminal command and hooorah, it’s installed: curl ... Read more - [And now, another language](https://jaimerios.com/?p=1420): You know, I was getting quite comfortable with Obj-C, C++11, and everything else I had learned over the years… now Apple has to go and introduce another language: Swift I don’t know what to make of it. How much better can it be than Obj-C? I guess I’ll find out over the course of the year. I do have to say though, that “let” and “var” are pretty cool, in the same way that “auto” is pretty cool in C++11. Oh, and if you haven’t already read Herb Sutter’s article on why you should use “auto” in your code, check ... Read more - [Aaaargh! Stop auto substituting my text!](https://jaimerios.com/?p=1406): Ugh! I’ve been running into problems with my Jenkins scripts that would fail when attempting to run my p4 commands, because the three periods I inserted into the p4 command were automatically converted to an ellipsis by MacOSX, which is not a good thing: Three dots are automatically changed to an ellipsis - [Windows disk space analyzer](https://jaimerios.com/?p=1398): So, if you need a good program to show you where your disk space is being used, in Windows, check out Space Sniffer - [Perforce and Xcode5](https://jaimerios.com/?p=1389): In a previous post, Perforce and Xcode4, I created applescripts to work with Xcode4 and Perforce. I updated the AppleScripts to work with Xcode5 only and added a couple of new scripts. One, called p4_file_renamed.scpt, is used to update the renamed file Perforce when you are using Xcodes rename functionality, either directly or through the refactor functionality. The other two scripts get the filename of the currently selected file or the full path of the file which is useful for when you want to find a file by path in P4V. You can download the file here: xcode5_p4_applescripts - [Preventing clang from examinging file during static analysis](https://jaimerios.com/?p=1377): Ok, so if you want to avoid a file from being analyzed during a static analysis, you can use the following example #ifndef __clang_analyzer__ // code clang should not analyze #endif http://clang-analyzer.llvm.org/faq.html - [Perforce and Xcode4](https://jaimerios.com/?p=1349): I created some AppleScripts that allow you to control some basic Perforce functionality in Xcode4, which was lost when Apple released the latest version of their IDE. Perforce actually published a way of checking out files using the Behaviors functionality in Xcode (Xcode and P4), but I wanted a little more. Note, these scripts are a work in progress. If you happen to make improvements, let me know so that those changes can be shared with the community. You can download the AppleScripts here: xcode_p4_applescripts Update The AppleScript files are also being hosted on the public Perforce swarm forum, located ... Read more - [A note about performance](https://jaimerios.com/?p=1330): On a multi-core Mac, running 10.8, I ran a test to compare the speed differences of incrementing or decrementing a value with no-locks, atomics and finally, a mutex lock. The no-lock is the baseline, and here is the difference in speed with the later 2 items: Atomics: 3X slower on the same thread Mutex: 7X slower on the same thread Hmmm… - [Automating Instruments](https://jaimerios.com/?p=1308): I actually automate Instruments to get finer grain information of what an application is actually doing. To automated Instruments, according to Apple’s documentation, all you need is the DTPerformanceSession.framework… but, you actually need more than that, and you have to find where the dependencies are located. Here are all of the libraries you need: DTInstrumentsCP.framework DTMessageQueueing.framework DTPerformanceSession.framework DTXConnectionServices.framework InstrumentsSupport.framework And here is where they are located: /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/Frameworks/DTInstrumentsCP.framework /Applications/Xcode.app/Contents/SharedFrameworks/DTMessageQueueing.framework /Applications/Xcode.app/Contents/Developer/Library/Frameworks/DTPerformanceSession.framework /Applications/Xcode.app/Contents/SharedFrameworks/DTXConnectionServices.framework /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/Frameworks/InstrumentsSupport.framework - [Bitten by ImageIO and libTIFF](https://jaimerios.com/?p=1305): ApplicationServices.framework and ImageIO.framework use their own version of libJPEG/libTIFF so if you were to use the standard version from the web, you would have a conflict when the application loads. This appears to only affect Xcode 4.X. - [Spread the love](https://jaimerios.com/?p=1298): When was the last time you gave the Internet a great big hug? Seriously. Think about it… you love the Internet 🙂 - [Google C++ Testing Framework and C++11](https://jaimerios.com/?p=1295): I’ve been using Google’s C++ Testing Framework for some time now, but as soon as I tried to use C++11 in Xcode, I was met with some issues about the tuple header file not being found. Unfortunately for me, that means I had to leave that header out of my project using the following option: GCC_PREPROCESSOR_DEFINITIONS = GTEST_HAS_TR1_TUPLE=0 - [Finding the "file in use" culprit in Mac OS X](https://jaimerios.com/?p=1287): Thank to a tip at MacWorld, I was able to find out what process was locking a file I wanted to delete. lsof | grep [whatever] - [Spaces, where are you?](https://jaimerios.com/?p=1268): I took me long enough to figure out how to do this, but MacLife on has it all spelled out. - [Duplicating projects and Xcode4](https://jaimerios.com/?p=1282): I found that when you duplicate a Xcode project, say to make experimental changes you don’t want in the original project, you find that the newly duplicated project actually points to the original project. That is because there is a workspace file within the xcodeproj bundle, project.xcworkspace, that contains the name of the original project, so you may want to edit that workspace file in order for it to point to the newly duplicated project. - [OmniGraffle supports UNIX keyboard commands](https://jaimerios.com/?p=1281): Well, at least ctrl+a and ctrl+e. I haven’t tried anything else, but I was surprised to find out that these even work within OmniGraffle. - [Checking out a file in Perforce using Xcode's 4 behaviors](https://jaimerios.com/?p=1278): Perforce published a knowledge base article on how to use Xcode’s built in behaviors to check out a file: Automatically checking out files for edit in Xcode 4.3 This is nifty and similar to an article I saw posted on stackoverflow by user Mark Thalman. Update I actually have AppleScripts that will do some of the functionality that Xcode3 had with Perforce on this posting: Perforce and Xcode4 - [Vector drawing programs](https://jaimerios.com/?p=1102): Matt Inman made a video where he discussed how he does his illustrations for his website: www.theoatmeal.com. If you haven’t seen any of this stuff, I would recommend that you only do it while you are home because his site is a big productivity killer. Anyway, it got me very interested in doing illustrations again, but I’ve usually only do that by hand and I didn’t feel like spending $800 on Illustrator. Off to Wikipedia! Wikipedia has a listing vector programs available; some good, some bad; some just ok. I have been using Inkscape for a while, but I’m not ... Read more - [Code review time](https://jaimerios.com/?p=1266): Right now, I’m reviewing code I copied into my own code branch (p4) and I’m finding that I’m doing something I thought I’d never do. I’m actually lining up functions and parameters into columns. I have to admit, it’s much easier to read code this way then when code is all smushed together. Now, I know some will say that this violates Rule 0, but I don’t care. - [CPUID for MacOS](https://jaimerios.com/?p=1250): This is a little old, but I wanted to share the link any for those looking for CPUID on the MacOS; download-maccpuid/ - [Using your iPad as a game controller](https://jaimerios.com/?p=1248): Firemint made an awesome racing game for the iPad, but that’s not all! With this game and an Apple TV, you can actually turn the iPad into a game controller and watch the gameplay on your HD TV! Ubber freaking cool! Guide to setting up airplay and party play for Real Racing 2 - [Steve Jobs quote](https://jaimerios.com/?p=1233): “[..] some mistakes will be made along on the way… that’s good, because at least some decisions are being made along the way and we’ll find the the mistakes and we’ll fix them” (WWDC 1997) - [Converting ASCII to HEX and vice-versa](https://jaimerios.com/?p=1230): I created a Dashboard Widget to convert ASCII characters to HEX. The Widget uses Javascript code created by Derek Buitenhuis, whose code is featured on java2s.com Here is the Widget and Dashcode project available for download: ASCII to HEX Widget for Mac OS X ASCII to HEX Widget Dashcode Project - [Starting the week off right](https://jaimerios.com/?p=1222): Wow… first my hard drive at home and now 2 of my RAID drives in my office died this morning… what a way to start the week 🙂 - [Starting the weekend right](https://jaimerios.com/?p=1223): I love watching my Mac slow down to a crawl… So, off to the Console.app to see what is going on: kernel disk1s1: I/O error. Awesome! - ["Selectively Disable Warnings" with clang](https://jaimerios.com/?p=1212): I saw this demo done at WWDC on how to turn off warnings, only when truly warranted, while compiling with clang: #if defined (__clang__) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunused-value" #endif // defined __clang__ void ImAUselessLittleFunction ( int pleaseUseMe ) { pleaseUseMe; // Nope, you are not going to be used } #if defined (__clang__) #pragma clang diagnostic pop #endif // defined __clang__ I thought this should be shared with you… You’re welcome 🙂 - [Enabling PHP5 on Mac OS X](https://jaimerios.com/?p=1197): Thanks to foundationphp.com for this tutorial! - [Pinching an inch off of code-bloat](https://jaimerios.com/?p=1189): Here is a tool that looks quite interesting: SymbolSort - [LLVM + Visual Studio = :)](https://jaimerios.com/?p=1180): What!? LLVM is available for Visual Studio? http://llvm.org/docs/GettingStartedVS.html - [Cool window tool for Mac OS X](https://jaimerios.com/?p=1175): Here is a tool that allows you to do some cool things with the windows in Mac OS X: moom - [Thank you](https://jaimerios.com/?p=1164): I had to install Windows 7 on my test mac-mini computer and was halted by the “Boot Camp x64 is unsupported on this computer model” message. Thanks to Michael Anastasiou , things are now working as they should. - [Command Prompt](https://jaimerios.com/?p=1159): Ah-ha! I found this nice little feature in the “Command Prompt” in Windows 7: hit the F7 key and you get a window with a history of commands you typed into the window. Nifty! - [GoingNative 2012](https://jaimerios.com/?p=1155): Last week I was fortunate to attend the GoingNative 2012 seminar hosted at Microsoft’s Redmond campus. Bjarne Stroustrup, Herb Sutter, Andrei Alexandrescu, Stephan T. Lavavej, Chandler Carruth, Hans Boehm, and Andrew Sutton gave presentations at this seminar. If you don’t know who they are, you can easily look them up since they are all very important people in the computing world. Videos for the seminar are available online (thanks Herb!): http://herbsutter.com - [Detecting clang or llvm in Xcode 4.2](https://jaimerios.com/?p=1153): Use either __clang__ or __llvm__ defines. More information can be found at stackoverflow - [DOS HERE and opening a command prompt in Windows 7](https://jaimerios.com/?p=1139): In Windows XP, Microsoft released PowerToys with a DOSHERE tool that allowed you to open a command prompt in the current window you had open. In Windows 7, you can hold down the shift key while right clicking a folder to get the same functionality… Cool! Thanks to windows7hacker for the tip! - [Productivity Power Tools by Microsoft](https://jaimerios.com/?p=1136): Microsoft has a plug-in for Visual Studio that adds a lot of nice little features that I never realized I needed… like triple clicking to select a whole line. - [Cyclomatic Complexity](https://jaimerios.com/?p=1133): I was introduced to Cyclomatic Complexity at Eric Rimbley’s course at Construx; I was facinated with the topic and found a tool that works with Visual Studio 2010 that gathers this metric: http://www.blunck.info/ccm.html - [File managers](https://jaimerios.com/?p=1129): For the longest time, the only file manager I used on the Mac was the Finder. I was fine with that and I never thought of needing another program. My co-worker though uses a program named PathFinder by CocoaTech. After seeing it in action, I thought it would be a great tool for organizing my project files and it does make finding files faster and easier. So, when I started doing more PC work for my current project, I wanted something similar to PathFinder cause the Windows Explorer is only so-so. Well, the closest I got to PathFinder was a ... Read more - [iPad 2 doesn't appear in iTunes](https://jaimerios.com/?p=1120): For some strange unknown reason, my iPad was not showing up under the devices section of iTunes after I upgraded to iOS 5. After much Google’ing, the only information I found helpful had me delete iTunes and reinstall it… which actually worked: How to remove and reinstall the Apple Mobile Device Service on Mac OS X 10.6.8 or Earlier - [Steve Jobs 1955-2011](https://jaimerios.com/?p=1108): The passing of a great visionary. - [Hey, look what I found!](https://jaimerios.com/?p=1104): I found this site by accident, sporting the stylish Visual C++ 6 logo: http://www.bogotobogo.com/cplusplus/cpptut.php It is pretty funny to read the tutorial on multithreading, given how new it was back then to a lot of developers and today, it’s becoming the new norm: http://www.bogotobogo.com/cplusplus/multithreaded.php - [List open files](https://jaimerios.com/?p=1098): On the Mac OS, if you need to know what files are open and by what application and on what disk, you can use the lsof command in Terminal. Pair that command with grep and you can isolate things like this: lsof | grep "Snow Leopard" This will show you what files are open that have “Snow Leopard” in the name. - [How not to design a video game](https://jaimerios.com/?p=1095): This is a very funny video on how a video game should not be implemented: - [WebGL](https://jaimerios.com/?p=1091): A while ago I blogged about WebGL. There are some really cool implementations of this technology at chromeexperiments.com, with a really cool demo of a water simulation and a cute video game. Thanks to altdevblogaday.com for blogging about this! - [Important command to demangle C++ code in your pasteboard](https://jaimerios.com/?p=1088): Cool command line I can run from DTerm on the contents in my clipboard, outputted from Xcode: pbpaste | c++filt | mate This command will take my clipboard contents, which were originally created from Xcode, pass that to the c++filt command and then create a new file in TextMate with the resulting contents. - [3D Printer! What?!](https://jaimerios.com/?p=1082): This is really something! I did not think that this was even possible. A really good presentation is given by… a kid… about why he loves his 3D printer: http://store.makerbot.com/thing-o-matic-kit-mk7.html Some of the really cools things that are made with 3D printers can be viewed at: http://www.thingiverse.com/ - [How to disable a CPU core in Windows](https://jaimerios.com/?p=1074): Thanks to my co-worker, I read this really useful article on how to disable a CPU core on Windows without having to use the BIOS: http://solidlystated.com/software/how-to-disable-a-cpu-core/ - [alt text on iPad](https://jaimerios.com/?p=1053): I found this cool tip on how to see the alt text on images that you would normally see when you hover the mouse cursor over an image… which as we know, there is no mouse on an iPad: hints.macworld.com - [Shell script to get path of application in MacOS](https://jaimerios.com/?p=1059): Here is a shell script that finds an application on my hard drive using a nifty call to Finder using AppleScript: #!/bin/sh result=`exec osascript - [Interesting Word 2011 Bug](https://jaimerios.com/?p=1060): I have Word 2011 installed on my Mac. Joy. Anyway, I have 2 monitors on my MacPro. I create a new Window ( Window->New Window ) to view my Table of Contents on the secondary monitor. When I switch to another app, like Google Chrome, then click on that new window in the secondary monitor, the window immediately moves to the primary monitor and reduces it’s width to about 10% of the monitor width. Joy. Reproducible bug. - [Star Wars, played by a floppy drive](https://jaimerios.com/?p=1055): Thanks to Raymon Chen for posting this link on his blog: Star Wars Theme Song - [C++ tips and tricks for MacOS X](https://jaimerios.com/?p=1043): I had to do some fancy debugging of a C++ dylib and while I was searching around the internet, I came accross this article from Apple: C++ features in MacOS X. I also found two cool articles that describe well how the dlopen application works and what happens to your symbols when an application bundle loads your dylibs: Dynamic Linking of Imported Functions in Mach-O Redirection of Imported Functions in Mach-O I also found a cool programs that shows you what the load might look like in a particular dylib. This is a very useful tool: MachOView Related posts MacDependency - [Xcode 4](https://jaimerios.com/?p=1037): Xcode 4 has a lot of cool new features. One of my favorites is it’s ability to tell you when you introduced a bug in your code; the feature is similar to a spell check found in a word processor. Usually, these cool tools are only available for Objective-C, but because of LLVM, this feature works on C++ as well. And on the topic of C++, Xcode 4 will support C++0X… Holy cow! - [Parallel coding](https://jaimerios.com/?p=1032): Last year, I had the great privilege of attending “Effective Concurrency” by Herb Sutter; I say great because it was an eye opener for me.  Now, you all know that I’m a Mac developer, so, seeing that I was the only guy in the room with a MacBookPro, I got a humorous look from Herb. I turned my laptop around to show him that I was running Windows 7 under Boot Camp, to which he asked, “How’s that working for ya?”. “So far, so good”, I said. I didn’t know what I would expect from the class, particularly since I ... Read more - [UNIX tip of the day](https://jaimerios.com/?p=1023): Thanks to my coworker for showing me this: pbpaste | c++filt | mate I use this to take a really long text output from GDB and de-mangle the code into something I can read. I copy the output in the GDB console to the clipboard and the command takes those contents and pastes the results into TextMate. - [Running AppleScript commands from the Terminal.app](https://jaimerios.com/?p=990): I found some pages on the web on how to run an AppleScript from the terminal, but this seems to be the only one that works in my situation: echo 'tell application "Google Chrome" to quit' | /usr/bin/osascript In my case, my keyboard stopped working so I wanted to safely shut down the programs via ssh before I rebooted the workstation. - [More fun with symbols](https://jaimerios.com/?p=1003): I found some very useful environment variables you can set on the application you are debugging when you need to see what symbols are being recorded by dlopen when it opens all of the libraries in your application: click on me, click on me please! So, from your Xcode project, double click your debug app: Now, set the following variables to YES, or NO, depending on what info you need: You are going to get a ton of information in the debugger console, which is very useful when trying to figure out if there are any offending symbols that could ... Read more - [Adobe Scripting Additions](https://jaimerios.com/?p=987): I’ve been getting warning messages in my Console log stating the “Adobe Unit Types.osax” has deprecated functions. Then, when I starting scripting Xcode with AppleScript, I’ve been getting a bunch of errors about the above listed library. Well, Adobe had something to say about that: http://kb2.adobe.com/cps/516/cpsid_51615.html - [Ninja Glock](https://jaimerios.com/?p=984): Thanks to thefirearmblog.com for sharing this video: - [How to duplicate one file ... a lot](https://jaimerios.com/?p=974): I had to duplicate a file… over a thousand times, for a test. For the MacOS, I created a shell script to do this: #!/usr/bin/env bash # I'm passing in the filename as a parameter to the shell script, # which is accesible through $1 for (( i = 0; i < 2000; i++ )); do cp -p "$1" "${i}_$1" done On Windows, I opened a command window ( Start -> Run -> cmd.exe [Hit enter] ), changed directories to my pictures folder, then typed: for /L %f in (1,1,2000) do copy MYDOG.JPG %fMYDOG.JPG Thanks to my co-worker for showing ... Read more - [Apple announces iCloud](https://jaimerios.com/?p=959): Apple announced the iCloud service and for someone like me, this is a great service. For a while, I have been battling with the problem of having access to common data on multiple computers, whether that be documents, calendaring information, or other documents from multiple computers. Having access to that data without having to rely on a USB key is a cool thing. I like their pricing model too: FREE. What I don’t like is the potential there may be to change that model from FREE to FEE like Apple has done before in the past with the .Mac service, ... Read more - [Xcode Script Menu and P4](https://jaimerios.com/?p=966): Here is another way that I am able to check out a file using the Xcode Script Menu and a keyboard hot key: #!/bin/sh # This shell script checks out the current file from Perforce # Get the file's path components FULL_FILE_PATH="%%%{PBXFilePath}%%%" SRC_FILE=${FULL_FILE_PATH##*/} FILE_PATH=${FULL_FILE_PATH%/*} # This line brings in my settings so that Perforce knows what server I am connecting to # This also assumes that the root of my project has a perforce.rc file source ~/.bash_login if [ -f $FULL_FILE_PATH ] then cd $FILE_PATH /usr/local/bin/p4 edit $FILENAME fi The “Output:” and “Errors:” options were set to “Display in Alert”, ... Read more - [Starting Google Chrome without restoring previous session](https://jaimerios.com/?p=960): If you ever needed to open Google’s web browser Chrome, without having the previous session brought back, you can actually do this from the command line. On the MacOS, you can use the Terminal.app application to type in the following commands: $ cd /Applications $ ./Google\ Chrome.app/Contents/MacOS/Google\ Chrome --home Google Chrome should start up for you without bringing up your old pages or old tabs. Hooray for startup options! References: http://chromespot.com - [Turning on the task list in VS2010](https://jaimerios.com/?p=956): According to Microsoft, this is turned off by default for performance reasons: http://connect.microsoft.com/VisualStudio/feedback/details/668650/task-list-is-not-working You can turn this on again in “Tools->Options->Text Editor->C/C++->Formatting-> Miscellaneous->Enumerate Comment Tasks” - [Call of Duty: Modern Warfare 3](https://jaimerios.com/?p=953): Oh. My. God. I. Can’t. Wait. - [Midway games out of business](https://jaimerios.com/?p=925): Wow, I am out of touch with the gaming community. I was on the MidwayUSA site and my wife asked me if it was the video game company. No, I said, but then when I pulled up the info on Wikipedia ( http://en.wikipedia.org/wiki/Midway_Games ), I was surprised to see that they had filed for bankruptcy. Yikes! ## Pages - [About](https://jaimerios.com/?page_id=2): Who am I? A C++ developer, first and foremost. After that, a cross platform developer. macOS, iOS, Windows, Linux and even Android, though I must be honest, I have been spending most of my time in Linux, with my second life being on Windows. When I first started this website, I wanted to share my programming knowledge with other developers who may have difficultly finding answers to obscure problems. As time went gone on, the focus of this site had shifted. More of the content here is the occasional obscure stuff I run into, that I want to document, and ... Read more [comment]: # (Generated by Hostinger Tools Plugin)