воскресенье, 22 ноября 2009 г.

new Ruby on Macports.

Few days ago, I update ruby via Macports, and my rails application die.
(gem install mysql doesn't help)

Only full reinstall of ruby (with deleting it gems from /opt/local/lib/ruby) help.
And my rails and passenger come back.

воскресенье, 1 ноября 2009 г.

Mac Qt helper rules

I'd like to show all of you example of self generating Qt project on Mac Os system.
Why is this different from linux or windows system?
The reason is unique way of creating software packages on MacOs.
Default program package on MacOs is a folder (for example Mplayer.app) this folder contain subfolders, in which user can find libraries, additional files, binaries). So default problem is put libraries on their place.

For this purpose I create special "_generator.sh" bash script.
The Algorythm:
1) generate default Qt Project file (*.pro);
2) add to project file all dependencies;
3) generate Xcode project file, using qmake -spec.

qmake -project
echo 'INCLUDEPATH += /Applications/MacPorts/qgis1.3.0.app/Contents/MacOS/include' >> SimpleMapEditor.pro
echo 'INCLUDEPATH += /opt/local/libexec/qt4-mac/include/QtXml/' >> SimpleMapEditor.pro
echo 'QMAKE_LFLAGS += -L/Applications/MacPorts/qgis1.3.0.app/Contents/MacOS/lib' >> SimpleMapEditor.pro
echo 'QMAKE_LFLAGS += -L/Applications/MacPorts/qgis1.3.0.app/Contents/MacOS/lib/qgis' >> SimpleMapEditor.pro
echo 'LIBS += -lqgis_analysis -lqgis_core -lqgis_gui -lqgispython' >> SimpleMapEditor.pro
echo 'LIBS += -losmplugin' >> SimpleMapEditor.pro
#echo 'LIBS += -lqgis_gui -lqgispython' >> SimpleMapEditor.pro
echo 'QT += xml' >> SimpleMapEditor.pro

echo 'QGIS_LIBS.version = 1.3.0' >> SimpleMapEditor.pro
echo 'QGIS_LIBS.files = /Applications/MacPorts/qgis1.3.0.app/Contents/MacOS/lib/libqgis_analysis.1.3.0.dylib' >> SimpleMapEditor.pro
echo 'QGIS_LIBS.files += /Applications/MacPorts/qgis1.3.0.app/Contents/MacOS/lib/libqgis_core.1.3.0.dylib' >> SimpleMapEditor.pro
echo 'QGIS_LIBS.files += /Applications/MacPorts/qgis1.3.0.app/Contents/MacOS/lib/libqgis_gui.1.3.0.dylib' >> SimpleMapEditor.pro
echo 'QGIS_LIBS.files += /Applications/MacPorts/qgis1.3.0.app/Contents/MacOS/lib/libqgispython.1.3.0.dylib' >> SimpleMapEditor.pro
echo 'QGIS_LIBS.path = Contents/MacOS/lib' >> SimpleMapEditor.pro
echo 'QMAKE_BUNDLE_DATA += QGIS_LIBS' >> SimpleMapEditor.pro
echo 'SOURCES += _generate.sh' >> SimpleMapEditor.pro
echo 'SOURCES += _clean.sh' >> SimpleMapEditor.pro

qmake -spec macx-xcode SimpleMapEditor.pro


This is an example of using MacPorts Qt-mac, and qgis library.

Result of Qt "*.pro" file:

######################################################################
# Automatically generated by qmake (2.01a) ?? ????. 1 12:10:57 2009
######################################################################

TEMPLATE = app
TARGET =
DEPENDPATH += . Ui
INCLUDEPATH += .

# Input
HEADERS += MainWindow.h
FORMS += Ui/MainWindow.ui
SOURCES += main.cpp MainWindow.cpp
INCLUDEPATH += /Applications/MacPorts/qgis1.3.0.app/Contents/MacOS/include
INCLUDEPATH += /opt/local/libexec/qt4-mac/include/QtXml/
QMAKE_LFLAGS += -L/Applications/MacPorts/qgis1.3.0.app/Contents/MacOS/lib
QMAKE_LFLAGS += -L/Applications/MacPorts/qgis1.3.0.app/Contents/MacOS/lib/qgis
LIBS += -lqgis_analysis -lqgis_core -lqgis_gui -lqgispython
LIBS += -losmplugin
QT += xml
QGIS_LIBS.version = 1.3.0
QGIS_LIBS.files = /Applications/MacPorts/qgis1.3.0.app/Contents/MacOS/lib/libqgis_analysis.1.3.0.dylib
QGIS_LIBS.files += /Applications/MacPorts/qgis1.3.0.app/Contents/MacOS/lib/libqgis_core.1.3.0.dylib
QGIS_LIBS.files += /Applications/MacPorts/qgis1.3.0.app/Contents/MacOS/lib/libqgis_gui.1.3.0.dylib
QGIS_LIBS.files += /Applications/MacPorts/qgis1.3.0.app/Contents/MacOS/lib/libqgispython.1.3.0.dylib
QGIS_LIBS.path = Contents/MacOS/lib
QMAKE_BUNDLE_DATA += QGIS_LIBS
SOURCES += _generate.sh
SOURCES += _clean.sh


Let's see what do we do:
1) we add additional paths to header folder;
INCLUDEPATH += /Applications/MacPorts/qgis1.3.0.app/Contents/MacOS/include
INCLUDEPATH += /opt/local/libexec/qt4-mac/include/QtXml/

2) add some library to linker
LIBS += -lqgis_analysis -lqgis_core -lqgis_gui -lqgispython
LIBS += -losmplugin

3) add additional Qt libraries (that used by qgis)
QT += xml

4) say qgis library to Program package:
QGIS_LIBS.version = 1.3.0
QGIS_LIBS.files = /Applications/MacPorts/qgis1.3.0.app/Contents/MacOS/lib/libqgis_analysis.1.3.0.dylib
QGIS_LIBS.files += /Applications/MacPorts/qgis1.3.0.app/Contents/MacOS/lib/libqgis_core.1.3.0.dylib
QGIS_LIBS.files += /Applications/MacPorts/qgis1.3.0.app/Contents/MacOS/lib/libqgis_gui.1.3.0.dylib
QGIS_LIBS.files += /Applications/MacPorts/qgis1.3.0.app/Contents/MacOS/lib/libqgispython.1.3.0.dylib
QGIS_LIBS.path = Contents/MacOS/lib
QMAKE_BUNDLE_DATA += QGIS_LIBS

четверг, 1 октября 2009 г.

Do not forgot about Garbage Collector.

when you are using NSThread* thread; please add garbage collector by your own
see example (method "- (void) neuro_arch").
as you see I create and release NSAutoReleasePool each time when I run this function.
without that, memory leaker will find a lot of problems.

воскресенье, 6 сентября 2009 г.

Objective C like killing time Machine.

I waste an 8 hours to create application that will show Image onto NSImageView.
And you know? I don't get result.

Still creating connection From Controller To View is unbeliavable fucking hard.
There are no normal documentation.

Why I should found method "setStringValue" - onto NSImage (as I was thought that method, that can load images should controll image).
Noooo NSImage, is a part of big amount of classes that can controll images.

Skrew this.

вторник, 1 сентября 2009 г.

Snow Leopard waiting.

It is not so easy to buy Mac OS Snow Leopard into Minsk.

Apple.by, Apple.com, Local magazines e-mail's don't gave any answer about availability of this product on our markets...

Wow I got an answer from "http://www.belyterem.com/", it's our local Apple reseller store.
And thay say that I can buy it from them.

Just one more Plus in Linux side.

воскресенье, 14 июня 2009 г.

What Xcode does wrong.

I found some big minuses of XCode.

First: he can't go by function definition: he can go line by line, page by page; but from initizing of one function to initializing second function... where is it? If some one know please help me to found it.

Second: whet function return value, Xcode doesn't look what type is it. And like result Xcode doesn't show methods of returned result.
So contructions like Qlist.at(4).GetSize() is hard to write.

Third: Some params like: framework paths does not work.
This create a big problem when you write something with QT.

So this is a reason to use sometimes TextMate.

понедельник, 6 апреля 2009 г.

Linux Preposition

Well some days ageo I meet first really big bug into macports...
while installing amarok (I have thinks that iTunes is not so good solution for multimedia) so
while installing some port (i will like carefull later) it is go down on fetch stage,
cause: sources that he try to download sources from some control version system.

and die there)
i think that this port was wrote incorrectly, but i don't know.

so I start to think, that best MacOs For Programming Is Gentoo Linux :)