Friday, December 28, 2012


Over a year ago I started working on a new version of the Qt Service component. I originally started the work on and setup a project and three git repositories there.

Well, I am writing this mostly to belay any confusion as to why I removed those repositories, and the answer is rather simple...

I had not been doing any work on it, and I started doing more recent work using a Qt Playground project. The advantage is that I am better able to accept more help through the Qt Playground project since the CLA is required to work there (AFAIK) - or rather, it is at least easier to verify such things for the Qt community. It also enables the work to be done in the Qt Project's chosen fashion with all the same tools available (though not all necessarily enabled).

I removed the projects from gitorious namely to keep anyone from getting confused as to where the work is actually taking place. The gitorious projects were: (i) a clone of Qt5 over a year ago that I never did get to compile, and (ii) essentially an import of the Qt Service component with some early thoughts.

The work at the Qt Playground project is presently in Code Review for the initial push. It's not yet any where near complete but the general architecture should be there.

So you can find the Qt Playground project here:,status:open+project:playground/daemon,n,z

You'll be able to get the source here:


Happy Coding!

Tuesday, December 18, 2012

Rsync is your friend

I needed to copy a Linux system recently. In fact, I ended up copying it multiple times as I reformatted the drives a few times. Rsync did the job perfectly:

# rsync -a /mnt/tmp/mainbackup /mnt/tmp/system

And in the end, my only issue was getting Grub to boot the drive due to silly BIOS limitations.

Wednesday, August 01, 2012

Pitfalls of C++/CLI

I'm a C/C++ guy. I've written a lot of software for Windows using VC++ - from VC++ 6 to VC++ 2010 - but always used native code - e.g. no .NET stuff.

I recently inherited a project at work that had a mix of C# and C++/CLI. The C# stuff is actually pretty minimal - just enough to manage a Windows Service. The C++/CLI makes up the majority of the program, and is also tied with some Native C++ to interface to a driver DLL for some special hardware.

Long story short, I'm trying to determine the cause of some buffering issues between this Windows application and a Linux-based application. The Linux-based application works with other software that does the same thing just fine; but there's a bug somewhere I'm trying to track down. In the midst of analyzing the Windows application I find some code that essentially does the following:

struct myCppStructure
    unsigned int field1;
    unsigned int field2;
    unsigned int dataArray[512];
struct myCppStructure* data;
IntPtr dataPtr(data);
// myNetworkSocket is a NetworkStream cast as a System::IO::Stream^ System::IO::BinaryWriter^

myBinWriter = gcnew BinaryWriter(myNetworkSocket);
__int64 length = sizeof(struct myCppStructure) / sizeof(__int64);
unsigned __int64* ptr = static_cast<unsigned __int64>(dataPtr.toPointer());

for (unsigned int i = 0; i < (length / sizeof(unsigned __int64)); i++)
// then calculate the remainder of the structure size and send that

What bothers me is that in nearly all other toolkits you don't need the FOR loop to write the data. You could do something like:

myBinWriter->Write(data, sizeof(struct myCppStructure));

I've been trying to find an equivalent in C++/CLI, but it seems everything has to go through some other object do it - usually resulting a copy of some sort, which is not permissible where this code is working.

So it seems that something that is extremely basic is just completely utterly lacking in C++/CLI. Simple things like this make it an useless language.

If anyone knows the solution, then please link it in the comments.

Thursday, January 26, 2012

Firefox - session file invalid error...

I ran into an issue with Firefox today, and after scouring the web without finding an answer and plowing through the sessionstore.bak file to try to fix it, I finally figured out the issue.

In Firefox 9, the Tools->WebDeveloper->Error Console had the following error:

session file is invalid type error this_initialState.window[0] is undefined

This occurred after FF crashed and I had to kill it - even reboot - and such as it the whole system was bogged down by something. I couldn't find anything on-line about it and started digging in. Firefox would not restore my session - all the tabs and tab groups, etc.

I did a comparison with the new sessionstore.js file that it had, and found that there was a little section that was missing from the default, but present in the backup - in bold below:


I removed the text, copied the resulting sessionstore file over sessionstore.js, and viola - firefox reloaded everything!

Hopefully others that have this issue will find this post and not have to spend a couple hours trying to figure out how to get their data back.

Friday, January 20, 2012

What the content industry doesn't get about SOPA/PIPA

Lamar Smith recently wrote an article for CNN concerning SOPA. However, he doesn't get what is wrong with it, straight from the opening paragraph:

The growing number of foreign websites that offer counterfeit or stolen goods continues to threaten American technology, products and jobs. Illegal counterfeiting and piracy costs the U.S. economy $100 billion and thousands of jobs every year. Congress cannot stand by and do nothing while some of America's most profitable and productive industries are under attack.

Okay, foreign counterfeiting and stolen goods are bad things. However, there is nothing showing that they cost jobs or billions of dollars. Many properly done studies show that piracy of this manner usually helps drive business to the original creator.

For example, someone making a counterfeit handbag won't have the quality of the original. Someone may buy it, but it'll break down, and they'll probably replace it with something from the original - especially if they were in a first-world country (e.g. US, Europe, Japan, and Australia) than to go and get another counterfeit.

Or, take music. The Grateful Dead and They Might Be Giants have both had a long history of encouraging people to copy and use their works. Both are extremely large bands now with very large and loyal audiences. This has not hurt them at all, but rather it drives their sales - as people hear the music and buy more from it when they discovery they like it.

Or take movies. The Anime community has a long history of importing works and dubbing (called Fan Dubs) or subbing (called Fan Subs). As a community they also encourage people to buy the licensed work when it is finally imported and subbed or dubbed for the country. This only introduces the works to bigger audiences, finds new audiences, and builds additional customers. Yes, there are some fans that just won't go the legal route, but most will.

In all cases, that $0.30 lost on one produce to piracy might turn into $5 or $6 down the road in repeat business.

But let's get back to SOPA/PIPA.

The Stop Online Piracy Act protects consumers and innovators by targeting foreign websites that traffic in stolen or counterfeit products, everything from movies to medicine to baby food.

Again, it's a good thing to stop counterfeit products that hurt people - medicine, baby food, etc. But this isn't being targeted at those kinds of things. It's being targeted at copyright infringement, and bypasses Due Process.

That is, it only takes one entity to show up in court and accuse a site (any site) of infringing their copyrights, and the court would be obliged to grant a takeover of the site. The owner isn't necessarily notified until their customers complaint that site is off-line, unless their DNS Registration provider (e.g. GoDaddy, etc.) notifies them as they move the DNS to pointing elsewhere.

This flies in the face of the U.S. Constitution which has a Due Process Clause - mentioned in multiple places: 5th Amendment and the 14th amendment.

The major backers of SOPA/PIPA - namely the Content industry (MPAA, RIAA, TimeWarner, NBC Universal, Disney, etc.) after having to go through Due Process for years and then losing in court for not being able to name the infringers - or having to show why they should be able to get those names and sue them to start with - is tired of Due Process, so they could really care less about it at the moment. (Though they probably will regret that should SOPA/PIPA ever pass.)

This information does a disservice to consumers, and it is being disseminated by those who have profited from working with illegal websites that steal and sell America's intellectual property.

There is a lot of dis-information yes; and it is being propagated primarily by the backers of SOPA/PIPA. Those against it are point out its actual results. The recent Internet Blackout day shows exactly what will happen should SOPA/PIPA pass. Google and others have a very good right to fear SOPA/PIPA and not because they profit from it. (BTW, I am speaking out against it and showing the problems with it too, but I do not profit from any infringing activities as Lamar claims I might since I am against it.)

The reality is that SOPA/PIPA have a very big legal affect that will severely hamper the creativity of the markets, especially on the Internet.

For instance, I am getting read to start a company. I have a product planned that I am going to make, and I'll have a website. However, if another company complains that I am infringing their copyright - without even showing it, just making an accusation - they could shutdown my start-up's Internet site, and effectively close up shop for the company. All because of an accusation by some entity that doesn't like what my company is providing, and would rather sue and shut me down than innovate themselves.

The online blackout that occurred this week, which included Wikipedia, was also misleading. Wikipedia has nothing to fear from SOPA. It is ironic that a website dedicated to providing information knowingly offered misinformation about the bill. SOPA will not harm Wikipedia, domestic blogs or social networking sites.

Wikipedia has everything to fear as all that needs to happen is for someone to upload some content that someone else claims infringes their copyright and ALL of Wikipedia gets shutdown.
So again, Lamar is providing dis-information.

Hyperbole has been rampant in the debate about SOPA. However, the bill in no way censors the Internet. It only targets activity that is already illegal, and only targets foreign websites that are dedicated to illegal or infringing activity. In fact, it is similar to laws that already govern websites based in the U.S.

Censorship automatically occurs when you start shutting down websites based on accusations. It would be one thing if the site and its owner had gone through the courts and were found completely guilty. However, the content providers don't like (i) how much effort it takes for them to do that, (ii) their likelihood of success that way, or (iii) the time it takes. However those three things are there to protect the whole of society from the 'mob', to ensure the rights under the law of all involved. SOPA/PIPA are 100% against that - a direct reflection of their supporters who probably had a very big hand in drawing the bill.

What has not been publicized is the broad support for SOPA. It has been endorsed by a diverse group of organizations, including the National Association of Manufacturers, International Union of Police Associations, the U.S. Conference of Mayors, the National Songwriters Association and the National Center for Victims of Crime. The bill has even united strange bedfellows: the U.S. Chamber of Commerce and the AFL-CIO. It's not every day that you see business and labor on the same side of an issue.

This just goes to show you that the organizations that support it have a big hand in commerce and not much in the way of protecting citizens. National Songwriters Association is part of the RIAA. RIAA and MPAA also have strong ties to the U.S. Chamber of Commerce and AFL-CIO; several of the companies therein (Time Warner, etc.) also have ties to device manufacturers through their DVD/BlueRay businesses. They also have a strong hand politically generating lots of money into politics. So again, the above are not surprising to see.

Even the White House has weighed in, endorsing the need for legislation

And the current administration at the White House has very strong ties to Hollywood. So again, it would only be surprising if they were against SOPA/PIPA. Same for any democratic organization (e.g. Unions) - and unions tend to back each other. So the Actors Guild would probably support things by the Police Union, and vice versa - the whole "I'll scratch your back if you scratch mine" thing (e.g. Old boy's network) as two appear strong than one.

respect the First Amendment and believe that any legislation passed by Congress must protect and defend our constitutional rights. But illegal and criminal activity is not protected by the First Amendment simply because it takes place online. For example, there is no First Amendment right to view, distribute or download child pornography over the Internet. Like child pornography, the theft of intellectual property is also illegal in the United States.

The major issue is not the First Amendment. It's the Fifth and Fourteenth Amendments - the right to Due Process.

The Stop Online Piracy Act works by cutting off the money to foreign illegal sites and making it harder for online criminals to market and distribute illegal products to U.S. consumers. The bill includes provisions that "follow the money" to cut off the main sources of revenue to these sites, and also protects consumers from being directed to foreign illegal websites by search engines. And it provides innovators with a way to bring claims against foreign illegal sites that steal and sell their technology, inventions and products.

But you wont' just get foreign sites. You'll get backlash that will involve domestic sites as well. And why would they stop with foreign sites? They'll do their best to show that a domestic site has foreign ties and therefore should be shutdown just the same - and they'll probably do it by just showing that the site does business internationally (which ALL Internet sites do by default).

Unfortunately, some critics simply want to maintain the status quo that harms U.S. companies, consumers and innovators.

Actually, I don't like the Status Quo either. We started down an ugly road back in 1998 with the DMCA - something that needs to be repealed at least in part.

I also believe current laws provide us all the tools necessary to combat piracy and counterfeiting without the need for SOPA/PIPA or even the ACTA Treaty that has been worked on in secret.

Wednesday, January 04, 2012

Iowa Primaries...

Well, congratulations to Santorum on doing so well in the Iowa primaries. I hope the momentum continues and that you get the nomination.

Please consider one thing - making Newt Gingrich your VP. The two of you would make a great pair for the main race.