Wednesday, September 15, 2010

Git on Windows behind proxy

I am working begind proxy at work and at home. So setting up some tools could be somewhat tricky especially at work due to very strict filtering policy.

To use git@github I've tried to use git on windows and finally ended up using Ubuntu inside VirtualBox with shared folder to commit and push to github. This is crazy setup =)

Today, finally had some time to getting things running at home using https protocol to github. Project I am working on initially developed with NetBeans and use GuiBuilder, so I've installed nbgit for NB 6.9 (http://code.google.com/p/nbgit/). It has very limited set of git commands. I tried TortoiseGit in addition, but it failed to push for unreported reason. If you have same issue you could try following solution(works for me=))
  1. Install git for windows from http://code.google.com/p/msysgit/. Git-1.7.2.3-preview20100911 in my case
  2. Launch Git Bash and go to your git repo folder.
  3. Set https proxy.

    export https_proxy=https://host:port
    or 
    git config --global http.proxy http://host:port
    
  4. Update global git config to fix ssl verification error.

    error: error setting certificate verify locations:
    CAfile: /bin/curl-ca-bundle.crt
    CApath: none
    
    Fix for this:

    git config --global http.sslverify false 
    or 
    git config --system http.sslcainfo \bin\curl-ca-bundle.crt
    
  5. Now you can push you changes to origin

    git push origin master
    

Sunday, January 10, 2010

Studio for kdb+ v 3.23 released

We've made some enhancements to Studio for kdb+ and v3.23 2010.01.09
is now available for download from

https://code.kx.com/trac/browser/contrib/cskelton/studio/releases/studio.zip

Changes include:
  • Support of Timestamp and Timespan types
  • Support of compressed data(kdb v2.6). Saw 4-10 times less data transferred
  • Migrated to Java 6
  • Jfreechart library was upgraded, all other libs dropped
  • Frame title tweaks. Now displayed as 'filename@server_name'
  • Last execution time(full cycle) for last query
  • Decimal format now can be specified in config: DecimalFormat=#.######
  • Look and feel can be specified in config: lookandfeel='lookandfeel class name'. This fix exceptions when using remote desktop on Windows with different theme settings
  • Builtin help has been remove. Please use code.kx.com as documentation source.
  • Excel export change to handle escaping text containing substring <IND>
  • Other small fixes...

Please contact me if you have any questions, bug reports.

For the moment the distribution is packaged as a zip file only - maybe
we will package as .exe too later. To use, download from the above
link, unzip retaining folder structure, and invoke via

java -jar studio.jar

The config file is automatically generated in
$HOME/.studioforkdb/studio.properties

Thursday, November 12, 2009

Installing Go programming language story

Few days ago google released 'go' programming language - very fast, compiling and many-many other features. Official site for this http://golang.org. Also you can view presentation on YouTube.

I've tried it on my Windows desktop under cygwin using http://golang.org/doc/install.html  and failed with an error:

%%%% making lib9 %%%%

quietgcc -ggdb -I/cygdrive/c/work/go/include -O2 -fno-inline -c /cygdrive/c/work/go/src/lib9/_p9dir.c
quietgcc -ggdb -I/cygdrive/c/work/go/include -O2 -fno-inline -c /cygdrive/c/work/go/src/lib9/_exits.c
quietgcc -ggdb -I/cygdrive/c/work/go/include -O2 -fno-inline -c /cygdrive/c/work/go/src/lib9/argv0.c
quietgcc -ggdb -I/cygdrive/c/work/go/include -O2 -fno-inline -c /cygdrive/c/work/go/src/lib9/atoi.c
/cygdrive/c/work/go/src/lib9/_p9dir.c:245: error: 'struct stat' has no member named 'st_gen'
make: *** [_p9dir.o] Error 1
make: *** Waiting for unfinished jobs....
 Next, I've installed latest version 3.0.10 of VirtualBox and Ubuntu 9.10 x64 on my Windows XP 32bit desktop.
Having installed all required dependencies and trying to clone repo:
svidyuk@svidyuk-desktop:~$ hg clone -r release https://go.googlecode.com/hg/ /home/svidyuk/go
abort: error: _ssl.c:480: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
Googleing for this error found on launchpad that https not supported behind proxy... So, I've simply typed:
svidyuk@svidyuk-desktop:~$ hg clone -r release http://go.googlecode.com/hg/ /home/svidyuk/go
requesting all changes
adding changesets
adding manifests
adding file changes
added 3976 changesets with 16799 changes to 2931 files
updating working directory
1640 files updated, 0 files merged, 0 files removed, 0 files unresolved
And... in few minutes I've faced issue similar to 53. So I've added http to NOTEST in pkg/Makefile, then it hangs on testing net then added net to NOTEST and go!

./8.out
hello, world
And now... go,go,go! Install it and try. BTW does native client support means that we can script Chrome with go?

Tuesday, September 15, 2009

How-to: Running q/kdb+ as service on Windows

When simply running q on windows from command line you will end  with many q instances running consuming space on you taskbar and so on. If you spend some time and setup all your q dev/prod instances like services on Windows this will save you huge amount of time. BTW if you don't have q right now you can download it for free from KX Systems site:http://kx.com/Developers/FREE-DOWNLOAD.php

There are many tools for Windows to wrap any executable as service, but I will use free tool from Microsoft - SRVANY.
SrvAny is a tool found in the Windows NT Resource Kit that is used for running Windows NT applications as services. You can download it from Microsoft site:ftp://ftp.microsoft.com/bussys/winnt/winnt-public/reskit/nt40/i386/srvany_x86.exe .

To create a Windows service, perform the following steps:

1.Copy srvany.exe to c:\q

2. At command prompt(cmd.exe), type
instsrv.exe q5010 c:\q\srvany.exe
This will create service named q5010. We will use it to run q on port 5010(tickerplant)

3.Prepare Windows registry file to setup parameters for q5010 service:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\q5010\Parameters]
"Application"="c:\\q\\w32\\q.exe"
"AppParameters"="-p 5010 -q"
"AppDirectory"="c:\\q"
4. Now you can use q5010 service as usual windows service:

To start: sc start q5010 or net start q5010
To stop: sc stop q5010 or net stop q5010


If you want setup several instances repeat steps 2-3 for different service names and ports. If you run tickerplant, realtime and historical database you will have 3 services at minimum, q5010, q5011, q5012. To start in appropriate order you can setup dependencies between q5011 and q5010

sc.exe q5011 depend= q5010

Note that sign '=' must be immediately after word depend and space before service name.

In this way you can setup on windows complete kdb setup that starts and stops in right way.

Additional features:

Output redirect:
Also if you need to do redirect of output you must modify application using following reg file.
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\q5010\Parameters]
"Application"="c:\\WINDOWS\\system32\\cmd.exe"
"AppParameters"="/c c:\\q\\w32\\q.exe -p 5010 -q >c:\\q\\logs\\q.5010.log"
"AppDirectory"="c:\\q"
Environment setup:

1.Start regedit and go to following subkey:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\q5010\Parameters]
2. Add Value with name AppEnvironment with type REG_MULTI_SZ
3. In the Multi-String Editor, enter environment variables using the syntax =.
TZ=GMT
QHOME=c:\q
Do not forget to add a new line after the last line, or the value will be ignored.

Related articles:
How To Create a User-Defined Service:http://support.microsoft.com/kb/137890
Troubleshooting SrvAny Using Cmd.exe:http://support.microsoft.com/kb/152460
Passing Environment Variables to Applications Started by SRVANY:http://support.microsoft.com/kb/197178

Monday, August 24, 2009

How-to: Package single jar with netbeans

For desktop application it's quite usefull to package it as single jar and launch as java -jar ...
or wrap it with launch4j and make executable file for you platform(for windows now but also will try for OS X).
The story is short actually - Just add following section into your build.xml file.
<target name="-post-jar">
<jar update="true" destfile="${dist.jar}">
<zipfileset src="${dist.dir}/lib/lib1.jar"/>
<zipfileset src="${dist.dir}/lib/lib2.jar"/>
<zipfileset src="${dist.dir}/lib/lib3.jar"/>
</jar>
</target>

Also some libraries rely on content of MANIFEST.MF file, so actually you need to merge file with same names from all jar in META-INF folder. Will update on solution to this =)

UPD: Article on this topic was published on java.sun.com: http://java.sun.com/developer/technicalArticles/java_warehouse/single_jar/ . No solution for merging MANIFEST.MF files proposed =(

UPD2: You can use exclude tag inside zipfileset to exclude manifest update: META-INF/MANIFEST.MF

Sunday, July 26, 2009

Необычное вокруг #1

"Космомясо"
Туборг ГРИН Черной и Туборг ГРИН Лимон
Оказывается женскую гигиену можно просто купить

Saturday, July 25, 2009

Новый сайт с использованием служб Google

Вчера открыли в публичный доступ новый сайт - Паркет Premium (http://www.parketpremium.ru ). Сайт целиком и полностью был сделан с использованием Google Apps, разве что кроме автоматической регистрации домена(зона .ru) сейчас не поддерживается.
Интересно что все из того что может понадобится для сайта небольшой компании имеется в наличии, а именно:

  • Формы обратной связи и опросники(также возможно за несколько минут создать любую другую форму с автоматическим сохранением результатов в spreadsheets). Это делается на основе Google docs for apps. Также очень понравилась возможность элементарного встраивания формы в тело страницы в любом месте.
  • Большой выбор стандартных тем для сайта с очень большими возможностями настройки фона/размеров/шрифтов.
  • Интеграция с Google Analytics и Webmasters. Возможность автоматической интеграции с Яндекс.Вебмастер отсутствует, так что пришлось подтвержать с помощью загрузки файла(Управление сайтом - Приложения - Добавить) yandex_xxxxxxxxxxxxxx.txt в корень сайта. Обратите внимание на то что пустой файл загрузить не дает.
  • Автоматическая генерация дерева сайта и возможность гибкой настройки меню.
  • Удобные макеты для организации структуры каждой отдельной страницы(1,2,3 колонки с/без header/footer)