Category Archives: Uncategorized

Great new GCC option – Effective-C++ Warnings

Did you know about -Weffc++ in GCC? Neither did I, until I upgraded to new Code::Blocks from Jens’ unofficial Debian repository for Code::Blocks.

Here’s a few sample warnings, with sample lines and commentary:

  • /home/ivucica/Development/project/src/types.h|12|warning: ‘operator=’ should return a reference to ‘*this’|

Sample:
Position &operator=(const Position& other) { x=other.x; y=other.y; z=other.z; return *this;}

What’s the big deal here? By leaving out the ampersand in this operator overloading, I accidentally returned a copy of entire Position class. (On the other hand, I had no reason to actually overload this operator so perhaps real fix is to erase entire line. Still…)

  • /home/ivucica/Development/project/src/mat.h|10|warning: ‘class Mat’ has pointer data members|
    /home/ivucica/Development/project/src/mat.h|10|warning: but does not override ‘Mat(const Mat&)’|
    /home/ivucica/Development/project/src/mat.h|10|warning: or ‘operator=(const Mat&)’|

No sample needed.

What’s the problem here? Well, we have a Mat class containing pointer. So what happens when someone does this: Mat x = y; or this: Mat x(y);? We have another instance of a class with copies of all the data, except the data pointed to by the pointer. Instead the pointer itself gets copied.

So if we keep a C-style string in there, we’re not really copying the string … we’re copying the pointer to it, and modifying the string in the new instance still modifies the string in the original ocpy.

While not applicable everywhere, still a good and useful warning.

  • /home/ivucica/Development/project/src/obj.h||In constructor ‘Obj::Obj()’:|
    /home/ivucica/Development/project/src/obj.h|15|warning: ‘Obj::m_radius’ should be initialized in the member initialization list|

Simple. Instead of initializing (or forgetting to initialize, or intentionally doing so) a variable in the constructor:
Obj() {m_classname=”Obj”; m_usecount = 0; }
why not do it in a “safe” and readable way (and perhaps more optimal?)
Obj() : m_classname(“Obj”), m_usecount(0) { }

While these warnings are certainly not the Universal Elixir to cure all your troubles, they will certainly prove useful in furthering your 1337 skills.

Earning money through ads?

A question mark, and for a reason.

On all my sites, I get about 800 weekly visitors. Very small number, but sufficient to make about $0.05/week pretty unsatisfactory. Since December, about $3.00. A long way to the $100 to get cash from Adsense.
Looks like people just ignore ads nowadays. Is it worth to even hope for any money?

Yahoo! OpenID’s XRDS check, Apache2 and PHP

Another continuation of a previous blogging session 🙂

A reminder, we’re talking about this:

Warning: This website has not confirmed its identity with Yahoo! and might be fraudulent. Do not share any personal information with this website unless you are certain it is legitimate.

PHP+Apache2 users out there might be interested in this reminder, which it’s already mentioned on previous post’s checklist, but I’d like to point it out again.

Don’t name your file xrds.xml.php and try to serve it as xrds.xml while changing Content-type to application/xrds+xml in the header. Apache2 is braindead (or used to be) and doesn’t even attempt to execute the file.

Yahoo! sends an Accept header in its HTTP request, listing application/xrds+xml. Apache decides your file is not of correct filetype, and sends Yahoo! the 406 Not Acceptable response. Referring to same file with the .php extension included makes Apache actually execute the file, and then compare the content-type to the accept header from the client.

Downloading Adobe Flash Player for Mac OS X 10.3.9, part 2

So, as I already blogged, Adobe broke download process for Flash Player for MacOSX 10.3.9… while on MacOS X 10.3.9. Both included browsers (MSIE5.2Mac and Safari1.3) break on Adobe’s pages. Safari simply doesn’t execute Javascript for either selection of “Yes! I have 10.3, I’m so sorry, give me old Flash Player”, nor for the download button if you go through manual process of selection of your OS.
I haven’t however blogged about the solution for this.


SOLUTIONS:
If they help, please click on “Useful” button on the bottom of this post. This does not require registration.


#1: Personally, I went the route of getting newest available Firefox for 10.3.9. Looks like Firefox 2.0.0.x works for OS X 10.2 and newer. Oddly enough, I couldn’t find a download link on Mozilla’s own pages, so let’s grab it from OldApps.com. Now, Adobe’s regular pages work!
However, you might not happy with that, no sirs. (But, why aren’t you? Firefox 2 is the best browser you can get on that old OS and machine you have there. Safari 1.3 is ancient. FF2 may not be the newest,but it’s the best you can get with Mac OS X 10.3 so don’t be like that.)

#2: Alternative solution is clicking on this link, where I already clicked on “Agree and Download” for you. Even closer, here’s a direct link to the DMG file. To install, double click on DMG file. An icon appears on your desktop; open it. Then drag the icons on the left into folders on the right (the background of the window is very suggestive of what you have to do).

Now go and watch flash-video movies on that iMac G3 you have there (which is precisely why you’re stuck with 10.3.9, right? At least I am)
Found this useful? Please leave feedback by clicking on the boxes below this post.
In case these links don’t work a few years after 2009, post in comments and I’ll try to get this for you. I might not be able to help you, but asking won’t harm. I won’t put alternative link here, since Adobe doesn’t like people redistributing their player. They do however like breaking their site for the target audience of the software download they offer. Ugh.

Yahoo! Search using Google Gears, part 2

I already blogged about Yahoo! Search using Google Gears. Looks like they’re using Google Gears to optimize responsiveness of their Search Pad, and they’re also doing it only in Google Chrome where there’s no HTML5 local storage implemented.