I will be logging at http://weblog.hataewon.com. Old entries from here will be gradually copied.
Over the last two weeks I found some time to work on my small Cocoa project Qmind, a mind-mapping app for OS X:

Finally, arrow keys can be used to change the selection. And icons can be inserted. However, the deletion of icons will come in version 0.0.10 + X, where X > 0.
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.fram ework/Support/lsregister -kill -r -domain local -domain system -domain user
Then, relaunch Finder.
Since http://qvacua.com consists of only static files, the following node.js static HTTP server comes in handy
HOST = null; // null => localhost
PORT = 8000;
HTTP_STATUS_OK = 200;
HTTP_STATUS_NOT_FOUND = 404;
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs");
function writeNotFound(response) {
response.writeHead(HTTP_STATUS_NOT_FOUND, {
"Content-Type": "text/plain"
});
response.end("Not Found");
}
function writeBinary(data, response) {
response.writeHead(HTTP_STATUS_OK);
response.write(data, "binary");
response.end();
}
function writeIndexHtml(filename, response) {
var indexFilename = path.join(filename, 'index.html');
fs.exists(indexFilename, function (exists) {
if (!exists) {
writeNotFound(response);
return;
}
fs.readFile(indexFilename, function (error, data) {
writeBinary(data, response);
});
});
}
var server = http.createServer(function (request, response) {
var uri = url.parse(request.url).pathname;
var filename = path.join(process.cwd(), uri);
fs.stat(filename, function (error, stats) {
if (error) {
writeNotFound(response);
return;
}
if (stats.isDirectory()) {
writeIndexHtml(filename, response);
return;
}
fs.readFile(filename, function (error, data) {
writeBinary(data, response);
});
});
});
server.listen(PORT, HOST);
console.log("Server @ http://" + (HOST || "localhost") + ":" + PORT);
By default index.html will be served when the URL directs to a folder. It does not have error handling whatsoever: sufficient for development.
Lohengrinstraße 11, 81925 München, Germany, anema-e-core.com
- J: Pizza with vegetables, C+
- T: Saltimbocca alla Romana (Kalbsmedaillons mit Parmaschinken und Salbei), B
2004 Solís Diego de Almagro Gran Reserva
- B+
- 7,40 €
Once in a while, when testing your Objective-C code, you want or have to mock a class method. Or you want to replace the implementation of a class method. The following code replaces the implementation of originalClassMethod of SomeClass with the implementation of mockClassMethod of MockClass:
Method mockMethod = class_getInstanceMethod([MockClass class], @selector(mockClassMethod)); IMP mockImpl = method_getImplementation(mockMethod); Method originalMethod = class_getClassMethod([SomeClass class], @selector(originalClassMethod)); IMP originalImpl = method_setImplementation(originalMethod, testImpl);
Don’t forget to import objc/runtime.h.
- Adding a new submodule
git submodule add git://URL/TO/SUBMODULE.git SUMMODULE_NAME - Getting, ie downloading, the newly added submodule
git submodule init - Updating all submodules
git submodule update - Make changes to a submodule
- cd SUBMODULE
git checkout master(or whatever branch you want to edit)code ... code ... code ...git commitgit pushcd ..(go to the parent repo)git commit SUBMODULEgit push