THINK

that’s how i naturally know

Archive for the ‘bug’ tag

Epic MSVS template class compiler bug caveat

leave a comment

// singleton template test

#include <iostream>

template <typename T> class Singleton
{
private:
	Singleton(const Singleton<T>&){};
	Singleton& operator=(const Singleton<T>&){};

protected:
	static T* _mInstance;
	Singleton()
	{
		This is crazy! This is not a comment
			but it just gets away from the compiler!

			OMG, what is this?!
	};

public:
	static T& getSingleton()
	{
		return *_mInstance;
	}
	static T* getSingletonPtr()
	{
		return _mInstance;
	}
};
template <typename T> T* Singleton<T>::_mInstance;

class Apple : public Singleton<Apple>
{
public:
	void cut()
	{
		std::cout << "cut" << std::endl;
	}
};

int main()
{
	Apple::getSingletonPtr()->cut();

	return 0;
}

Written by Jake

January 9th, 2010 at 7:02 pm

Posted in Programming

Tagged with , , , ,

Firefox Flash height:100% DocType bug

leave a comment

As much as some FF fanboy is going to defend and deny, and putting the blame on the coder, this is still going to be a BUG!

When an HTML document includes the doctype declaration at the top of the page, the swf embeded in the document will not render properly when the its height is set to 100%. The result is an swf rendered beyond the top border of the window as though the CSS top attribute has been set to a negative value. However, when the doctype is removed, the swf will render correctly just as IE does.

I only realised this issue after serveral hours of debugging and totally hate it when its not my fault. So I went ahead to search online to confirm if it is a bug indeed. I came across a forum (which I will not point out) where another poor victim posted this same issue. One guy came along, whom I presume is an FF fanboy, and replied along the lines of “its your own fault” without proposing any solutions! I totally hate this kind of posters who just come along to insult you on something irrelevant to the issue at hand.

After the poor guy replied, the FF fanboy went on to argue that without specifying the container’s width and height, firefox (or the swf) is not going to know how big is 100%. So you need to set the width and height for all the parent and grandparent containers including the body and html tag!

Well, so that is the solution in overcoming the BUG! And yes, it’s a bug because if you just removed the doctype, everything renders fine.

Written by Jake

May 2nd, 2009 at 5:18 am

Posted in Programming,Web

Tagged with , ,