Skip to main content

Posts

Cleaning up your local branches with ease

Small bash script to that helps you to clean up things 1 2 3 4 5 6 7 8 9 10 11 12 #!/bin/bash for br in $( git for -each-ref --count = 30 --sort = -committerdate refs/heads/ --format = '%(refname:short)' ) ; do echo "Delete branch $br (y/n)?" read -rsn1 input if [ "$input" = "y" ] ; then echo "deleting $br" git br -D $br else echo "skip $br" fi done

Bounds.intersect is bad, mkay?!

I was trying to check when enemy ships are getting out of screen to destroy objects (optimization). First version Vector2 screenSize = new Vector3 (Screen.width, Screen.height, Mathf.Abs (Camera.main.transform.position.z)); Bounds screenBounds = new Bounds (new Vector2(0f,0f), screenSize); Debug.Log ("Ship " + ship.renderer.bounds + " Screen " + screenBounds); if (!ship.renderer.bounds.Intersects (screenBounds)) ship.Destroy (); So apparently this operation is taking significant time to check, end up replacing with this Vector3 screenPos = Camera.main.WorldToScreenPoint( ship.transform.position ); Vector3 screenSize = Camera.main.WorldToScreenPoint( ship.renderer.bounds.size); if (screenPos.x + screenSize.x < 0) ship.Destroy ();

Rules of Fight Code squad

1. You should tell everyone about Fight Code squad 2. If you don't want to annoy people with rules, check rule #1 3. Something that is bigger than it should, call "Pile of shit" 4. Something bigger than "Pile of shit", call "Huge pile of shit" 5. Splitting Huge pile of shit on smaller piles, is not considered refactoring, it's just shitty job. 6. Don't short down variable names, abbreviations was invented by bureaucrats to confuse shit out of regular people. There should be no bureaucrats in Fight Code squad. 7. If method is taking more than 20 lines then you should feel bad, think again. 8. If class/module is taking more than 500 lines, then it's Pile of shit. 9. Readability over Functionality, if you can't read it after hangover, don't write it. 10. If (method|class|module|factory...) is used only once in a code, it shouldn't exist.  11. If method is taking one line, then something should be wrong with wh...

Summarize things from the past

So during these days I'm starting to think about old days, trying to remind my self how it was first time exploring new lands of different technologies. I don't like to compare and say: Some coding language A is better than some language B. This is like comparing different ways of thinking. Lets start from deep childhood, year lets say 1994. C++ - there was this awesome blue book, like 400 pages long and cool that it had illustrations. I remember that it took me more than a week to succesfully compile my version of "Hello Word" example to exe file and run it. It was the best day ever. Basic - at 6th grade our computer classes started and during first day I've got this like Basic book for Kids. And during same day I've finished it and was able to write some small stupid stuff. But it was really awesome, it was part of freedom. All possible free time I've spend there going deeper and deeper. Pascal - this was like "Hm, realy? There is something di...

Slicehost => Rackspace rage

For my side project Owely.com I've used Slicehost VDS solution, it worked fine, I've liked minimalistic Control Panel and really great tutorials how to setup environment from scratch. I really think they have best knowledge base online. Slicehost wasn't cheapest solution, but there was no complains from my side, they worked like clock, I never considered moving to other hosting provider, so when I've heard that they was acquired by Rackspace already then had this bad feeling. Then thought "ok, may be I'm too worried, may be it's for better" and tried to migrate in new env.  First day There was my mistake trying to use CentOS, I've researched and they say it's more stable and secured, but.... RedHad package manager don't know anything about ImageMagick higher than 6.1 or 6.2 don't remember, for new gems I was required to use >6.3, so I've spend few hours trying to set it up manually, then compile from sources then voodoo mag...

Why Magento sucks?!

p.p1 {margin: 0.0px 0.0px 13.0px 0.0px; font: 13.0px Arial; color: #1022a3} p.p2 {margin: 0.0px 0.0px 13.0px 0.0px; font: 13.0px Arial} p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Arial} p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Arial; min-height: 15.0px} span.s1 {letter-spacing: 0.0px color: #000000} span.s2 {text-decoration: underline ; letter-spacing: 0.0px} span.s3 {letter-spacing: 0.0px} span.s4 {text-decoration: underline ; letter-spacing: 0.0px color: #1022a3} This post was inspired by  http://www.commercestyle.com/e-commerce/magneto-sucks I don't agree on everything that wrote there, I won't say that is so sucky and hard. It's childish way to say system is too complicated, read the f**king manual, omg is this so hard?! So from perspective technical guy that have a lot of finished high loaded projects on the back, I want to explain my "sucky" point about it.  1) The thing that bothers me for last few weeks is news about Magento acquir...

How to kill old Resque workers and don't loose your face

In first thought trivial problem, `god gem` is keeping your Resque workers busy and when you deploy it just ask `god` to kill them by: god remove {group_name}. This is prety common misunderstanding thinking that workers will stop running at same moment, some of them can even live forever trying to establish their life inside your production server and continiously eating memory. One of walkarounds looked like this: in resque.rake create new task namespace :resque task :restart => :environment do    pids = Resque.workers.map(&:worker_pids) || []    pids.uniq!    if pids.any?        system("sudo kill -QUIT #{pids.join(' ')}")        puts "killed: #{pids.join(' ')}"    else        puts "resque wasn't running: #{pids.join(' ')}"    end end end It worked fine till one moment when rake stopped running initilizers before task and that cause ugly(hard) to find error...

Capture full screen in muti-screens Windows XP by Qt

I've just want to put some small solution here, I've spend few hours to find out why same procedure works fine in Linux and Mac OS,but always returns only first screen image in Windows XP. This is recommended use: QPixmap::grabWindow(QApplication::desktop()->winId()); And in windows XP it always capture only 1st screen, so this hack solution how same overloaded procedure works fine : QWidget *scr = QApplication::desktop(); WId w = scr->winId(); QPixmap pm = QPixmap::grabWindow(w,0,0,scr->width(), scr->height()); Just specify geometry of all screen and it works perfect.

My speech about Qt in Ciklum Speakers' Corner(RUS)

I wanted to share my speech that took place 21 Oct, it'a about how Qt helps to build cross-platform application. It was based on my experience building Owely.com for Windows, Mac OS and Linux. This presentation is based on russian, sorry eng speaking guys. And actual presentation on Eng: http://igorrac.blogspot.com/2010/10/qt-cross-platforming-rocks.html

Magento API + Java != Friends

Recently I've had a task to write small integration of Java to the Magento API, and meet a lot of troubles on the way. First of all Magento supports SOAP web-services that actually don't work well, I've found one solution http://code.google.com/p/magja I didn't tried because we spend much time trying to make them work with no result, so next was XML RPC based API that worked quite well on PHP examples, but caused more trubles. Login worked pretty well: XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); config.setServerURL(new URL("http://magento.dev/index.php/api/xmlrpc/")); XmlRpcClient client = new XmlRpcClient(); client.setConfig(config); Vector params = new Vector(); params.addElement( "defsan" ); params.addElement("123456"); String session = (String)client.execute( "login", params ); But other call's did worked, instead they show: Exception ...

Qt cross-platforming "rocks"!

Today I've made a topic about my experience of lunching Qt-based cross-platform product : Owely.com. In my presentation I've made few points about how C++ evolved during these years, and how it can become handy when you need high-performance cross-platform solution with high integration to the native API. Hopefully people that come to check this presentation was very interested in C++ and we had small but productive conversation. For thous who miss

Getting real presentation

this slides was prepared for Ciklum Speaker's Corner specially for developers. I've tried to squeeze only topics and quotes that's mostly important for new age application development. This slide prepared from "Getting real" book of 37signals Getting real in development View more presentations from defsan .

QPixmap::setAlphaChannel artifacts

  I found strange artifact connected with alpha channel in QPixmap. In my project Owely, I use few layers to separate different tools interactions, so you just repaint some level without worries. So all levels had alpha channels set on constructor, but strange stuff appear, on the second initialization they wasn't empty, they was filled with previous screenshot with transparency, check the image The problem was solved by this article: http://labs.trolltech.com/blogs/2009/12/16/qt-graphics-and-performance-an-overview/ there was words about setAlphaChannel that works unstable, and should be used with fill() method m_pixmap = QPixmap(parent->width(), parent->height()); m_pixmap.setAlphaChannel(m_pixmap); m_pixmap.fill(Qt::transparent); // this fix the deal I don't advise to use fill on paint event, or somewhere in the loop.

QSystemTrayIcon VS showFullScreen

I've found strange collision when you open window on full-screen and go to other application so that full-screen is on the back, then you have tray icon, then when you press on tray icon image just disappears. I've spend some long hours searching the problem that cause this, when discovered that full-screen mode overlaps icon tray and it just being redrawn by QPainter of MainWindow. This is quite strange problem, so I've dig more and more and found out that hiding Mac OS top menu do the same to the tray icon. It looks like when you hide the menu and in same time try to show IconTray it gives you a punch, so nothing could probably solve this problem. In my case I've changed the flow of the application, so now full-screen window is modal, when you exit full-screen mode it hide main window and tray icon works fine. Conclusion: NO QSystemTrayIcon and showFullScreen at same time

Hiding Mac OS system menu in Qt

I know it not a big deal, but when you work with full screen application system menu pops up when you move mouse on the top, so here is a hack that solve this problem, I use it in main.cpp put this in header #ifdef Q_WS_MACX #include #endif and this in main procedure: int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); #ifdef Q_WS_MACX HideMenuBar(); #endif return a.exec(); //other code } thats it :) I hope it will help

Ciklum moved to new office

It's big WOW for everyone, now we have nice view from the window and work will be better :) Still I'm leaving company at 25th of May to join forces of new start-up Tuppy.com, hope this will happen smoothly without any delays. Still think that new office is big plus to stay there

How to get active window geometry on Carbon

I'm not a Carbon developer, so it took huge amount of time to find simple way how to get active window handle in Windows API it's simple as few commands and there is so much forums where you can find help for that. Don't know why, but mostly people are searching window title. My task was find window geometry on Qt. This example includes how to do this, but can be also used for retrieving other information. Still don't know how to cast AXUIElementRef to WId, so if someone have a clue let me know in comments. Example: QRect getActiveWindowGeometry() {     QRect rect;     ProcessSerialNumber psn = { 0L, 0L };     OSStatus err = GetFrontProcess(&psn); // get front process PSN     /*error check*/     pid_t *pidt;     GetProcessPID(&psn ,pidt); // get Pid from ProcessSerialNumber     AXUIElementRef theApp = AXUIElementCreateApplication(*pidt); //get Application fr...

Getting Real on Ciklum PM Camp

 I had very nice few days in Ciklum PM gathering, a lot of useful workshops and discussions. One of the event was Speakers Corner, idea borrowed from UK, but in this case it was more about free talk of PMs with clients. There was some people from Holand and Denmark that took initiative and presented their own  vision about how outsourcing should work, how to grow trust and keep communication on the high level. Very useful experience when you see how it feels from other side of outsourcing. Also I wanted to say that we with Yuri Tukhnin presented "Getting Real" methodology of crafting the project. I'm in love with "Getting Real" it keep you tuff and realistic. We didn't managed to finish all slides by 30min, so we was about more than "real" :) at least we managed to tell about main stuff like code less and cut the features. I hope this seed will grow with in the company, at least I see that company decided to move in agile development way.  Today, ...

Startups magnet

   Strange thing, universe is build very interesting, when you try dig on something everything around it starts stick with you, new connection, new info is coming from everywhere. Like more then year ago I started working with my own startup and from that moment all everybody around me stated talking about startups, then some of people invites me to join their projects, some are just philosophizing. But the main point that when you are starting doing something, it's like travel to the parallel universe where all things are the same.    Second thought I've got that everything what you discover, every "new idea" was already made by someone, so you think "what the point to make same?". When youtube came on the market there was tons of video sharing websites, but almost all was expensive(storage was expensive at that time), so what they guys did, they put a lot of afford to make service free and fast, nobody else could fight for that, so youtube win. If you thi...

People are interesting

...and people are interested. I like talking with people, when you first describe them an idea, you say: - Hm, it should be some sort of white-board.... They feel very suspicious , some heard about white-boards, some didn't but always they are trying to imagine this in their head, then you give them link to check. In few days, when you meet again during the coffee break, usually they start talking about the project: - It's very cool, but I've noticed that it would be cool to have .... So from that point you feel that not only you are involved in developing start-up, it become some sort of public and now your colleagues and other people that you met online are part of it, they own your product. This is one of exciting moments that help you continue development, so you know that you are on good track. Few weeks ago I've had feedback from one guy from the Mexico, he was reporting some hibernate issues upon Owely, some of them we fixed in next release, but it's no...