Archive for August, 2009

How to get a callback on button press from QT designer

Tuesday, August 25th, 2009

Right click on the body of the form.
Click Change Signals / Slots
Under slots, press the + key. Add the name of the callback that you want.
Link it with the signal/slot editor
Now your generated file of the same name will have a callback of the name of the slot you added
Derive from your generated file
Use public slots: to implement, as per the manual

—EDIT—

Found an easier way
Derive from the autogenerated class
Write something like
public slots:
void on_actionSQL_Query_activated();

Replace actionSQL with the name of your object. Replace activated with the name of the signal that is sent.

How to add a new window with QT and Visual Studio integration

Tuesday, August 25th, 2009

Took me a long time to figure this out, but got the answer on Stack Overflow

“In Visual Studio, the workflow I use when I want to design a new window is to add a Qt GUI class with Project->Add Class…->Qt4 Classes->Qt4GuiClass.

Then, fill out the form as necessary and the VS add-in will add the appropriate ui and moc files. Double clicking on the ui file will bring up Qt Designer, which you can use to lay your window out.”

QT Visual Studio integration doesn’t work / how to fix

Sunday, August 23rd, 2009

I downloaded the SDK for Windows
https://qt.nokia.com/downloads/sdk-windows-cpp

Then the Visual Studio Add-In
https://qt.nokia.com/downloads/visual-studio-add-in

Installed both. Now the 4th or so option in Visual Studio is “QT”

You can click create project / QT / QT Application.

However, it doesn’t work

I read a forum post to click in the file menu QT / QT Options. However, if you click add, the OK button to select a file is always disabled.

Forum Post where others give the answer. You have to set two environment variables, and build with mingw

Building QT in MinGW is pretty hard to figure out. So I found a YouTube video on how to do it
QT + Visual Studio 2005 Part 1/5

And it doesn’t build without errors
Unresolved externals

It’s great that they give this out for free under the LGPL, but from a sales standpoint this is an Epic Fail. It doesn’t work out of the box, there is no documentation or support on why, and the price is very high. $4000 for a license and $2000 for 10 support incidents.

Getting bids on a new project

Saturday, August 22nd, 2009

I have a new project I’m working on. I wrote a 15 page detailed design document. I then decided to spend a week finding bids.

Roughly:

5 companies didn’t respond at all
5 responded with they couldn’t do it
2 responded, but mentioned they charge $2000 a day
1 responded with a rough estimate, and a high price, and asked me if I wanted to continue
3 Signed the NDA and came back with a quote, without further communication
1 Signed the NDA, actually spoke to me by email over several days to clarify it, and came back with a quote
3 got the requirements document, but I never heard back again. They are probably studying it, unaware that spending more than a couple of days to answer means they lost the bid.
2 were extremely slow to respond, where it took the whole week to even sign the NDA
1 immediately wanted a phone meeting, without even looking at the requirements document. After sending the requirements document, they wanted a meeting again, without stating why.

The company that clarified the requirements document was my first choice, but couldn’t do it for various reasons. So I’m going to go with one of the companies that just placed a bid. Payment is for completed work only, so there’s no risk or cost to me other than wasted time.

Generally, the small companies were the ones that came back with bids or comments. The large companies were slow to respond, and either wanted a meeting or were so slow to respond I haven’t heard from them by now, and won’t wait any longer.

Is it unreasonable to expect to get a quote within a week’s time?

Scaleform partnership for a lobby integration

Tuesday, August 18th, 2009

Whenever a customer has difficulty with RakNet, or a feature of RakNet, I reflect on what I could have done better to help them. So when Stardock, used RakNet as part of their lobby system, I noted that it took them an alarming amount of time and resources relative to my expectations. Part of this was that RakNet’s NAT punchthrough feature was not as sophisticated as it is now. And part of it is just the magnitude of this feature, involving:

  • Remote server hosting
  • Proxy server hosting
  • UPNP
  • Handling difficult to handle failure conditions

The only way to help the customer get around this is to do it for them, which involves lobby and UI code.

Scaleform by far has the best cross-platform solution for UI. So I negotiated a partnership with them, allowing Jenkins Software LLC to use and release Scaleform integration code to our customers. This was done for the Autopatcher. And I’m now having our own Lobby system made. This is a huge feature, but when done can encompass things such as user registration, game rankings, clans, friends, emails, rooms, and NAT punchthrough. All the end user would need to do is license Scaleform and skin the UI that RakNet provides. From a competitive standpoint, this puts us on par with other major middleware providers and eliminates the last reason any developer may have to use their services rather than RakNet.

It’s a pretty big deal, and when done, I believe will be a huge boost to sales and a serious threat to the competition.

New congestion control thanks to UDT

Tuesday, August 18th, 2009

A few years ago, a user in the forum stated that UDT had much higher throughput than RakNet for LAN transfers. I took a look at it and it was made by a couple of research scientists for the purpose of being faster than TCP. While they published details of their work, the documentation is extremely technical and academic. Anyway, I said at the time that RakNet was designed with different goals, and if all they wanted was high speed LAN transfer to use UDT instead.

Since that time, I had ongoing problems with congestion control. Every 2-6 months I’d try a different approach with incremental improvements. But with the wide range of scenarios under which RakNet is used, there was always a new scenario where it didn’t work. So I basically gave up, and turned to UDT for help.

My first approach was to directly integrate UDT into RakNet. I spent about a week removing all exceptions from the UDT source, changing to the RakNet memory allocator, and integrating RakNet to use UDT for sends and receives through RakNet’s own sockets. I had it working, but had problems where UDT didn’t connect as fast as RakNet. UDT also didn’t support priority levels or different sending types other than RELIABLE_ORDERED. I wasn’t happy about having another UDP library integrated into my core product just for one feature (congestion control). In the end, I released this an optional define flag. It’s present in version 3.62 though I left it disabled by default.

At random, I saw an advertisement by one of the authors of UDT, Yunhong Gu, for paid contracting. Rather than have him code a solution, I had him write a technical design document on how the UDT congestion control was implemented, so I could implement it myself.

The result of my implementation

Using DevPartner performance analysis I eliminated the top 20% CPU utilization from RakNet. I also reduced the bandwidth overhead, even though more information is sent. In the end, I raised the file transfer rate on localhost from 2 to over 20 megabytes per second (I’ve seen it go as high as 40 on another computer). And the transfer rate to my remote server went up by 50%.

I’m pretty happy with the end-result. This is probably the most significant improvement to RakNet I’ve made since it was developed. I’ll be releasing this as version 3.7 in the very near future.

Fixed spam links in RSS feed

Tuesday, August 18th, 2009

Looks like wordpress got hijacked and was sending out spam in the RSS feed. Sorry to all those that experienced it. This is the 2nd time wordpress has gotten hijacked. Seems like it’s not a very secure system, as much as i otherwise appreciate that it’s free
URL with fix (See last post)

Sorry if I accidentally deleted your account. I had to delete all with usernames or email addresses that looked automatically generated.

Rich people during the downturn

Monday, August 17th, 2009

I was reading an article today about rich people having a harder time during the downturn in the economy. What really struck me was the some of the comments.

1. It’s ridiculous to say you cannot sell your house (now that you can no longer afford to maintain it). You just can’t sell it for more than its market value. Doing so involves admitting that you overpaid when you bought it. You made a bad decision, accept the consequences. Staying in a house you can’t afford only worsens your loss.

2. People that make more money than you do do so because they made better decisions earlier in life, and took successful risks. With the exception of circumstances outside of your control (abusive parents, birth defects, traffic accidents) everyone in the US has a reasonably equal opportunity in life. Most disadvantages at the start can be overcome if you work harder.

3. College is only unaffordable if you make it so. Jr. college costs a few hundred per semester, and that’s for 2 years. Another 2 years of college at 2K per semester is 8K. Live with your parents, go to whatever is nearby, and get a degree. It only matters for your first job, and if you excel at your first job you’ll catch up quickly enough. If you’re too old to live with your parents now, that’s your own fault for screwing around when you had the chance. You’ll have to work harder to make it up.

4. Rich is relative. I make more than the person in the article, yet I’m only middle class. I can’t afford to buy a house. Federal income tax takes over 30%, state tax another 10%, Social security another 10K, sales tax is at 8.5%, and so on. My rent is $3000 a month and while I’m renting a house, it’s not a mansion by any means. Federal taxes do not take into account cost of living. You may make more, but you pay progressively more in taxes, and have to pay more to live.

5. For every business owner, there are 9 that failed. For every rich business owner, there are 9 that are not rich. And every business owner works 7 days a week 24 hours a day. Perhaps not directly in the office/shop/restaurant. But the business is always there, demanding your attention to make it successful. So successful people deserve the money they made, and if they play golf all day, it’s because they worked hard earlier. Are there rich people that don’t deserve it? Of course. But that’s the aberration, and sooner or later it’ll even out.

6. If you can’t save, look at your spending habits. There are very few people that cannot afford college were they to control their expenses to the true necessities. That is why foreigners get ahead. They really did have nothing where they came from, so they understand how to save and what is really a necessity.

One of those rare cases where a linked list is the best data structure

Thursday, August 6th, 2009

I have a B+ tree containing pointers, sorted by key. I had a queue which mirrored that tree, but was ordered by a fixed-interval timestamp (from most recent to least recent). I recently encountered a situation where I was able to look up the pointer by the key in the B+ tree, but didn’t know its index into the queue. Since the queue could be tens of thousands of elements long, and the same op. had to be repeated many times, it was too slow to stick with. So I changed to a linked list. That way I could remove from the middle of the queue and readd at the head of the queue without scanning the queue for its index.