list of websites in magento

If you want to know what websites and how many are installed in magento you can get that information from getWebsites method of the Mage_Core_Model_App object.

$storeCodeAsKey = true;

$websitesCollection = Mage::app()->getWebsites(false,$storeCodeAsKey);

	echo "<pre>";
	
	print_r(count($websitesCollection) . "\n");
		
	foreach ($websitesCollection as $website => $value)
	{
		print_r(($storeCodeAsKey ? "Store Code:":"Store Id:") . $website . "\n");
	}
	echo "</pre>";
Posted in magento, php | Tagged , , , | Comments Off on list of websites in magento

AIR for Android with FlashDevelop

Hi,

I have been playing with AIR for Android lately but I could do it only from Flash CS5, recently I have found that my embedded fonts wasn’t displayed in the android application, after further investigation it was Flash CS5 problem and latest Flex SDK:

<flex-sdk-description>
<name>Flex 4.1</name>
<version>4.1.0</version>
<build>16076</build>
</flex-sdk-description>

I have reverted to the earlier version of SDK:

<flex-sdk-description>
<name>Flex 4.0</name>
<version>4.0.0</version>
<build>7219</build>
</flex-sdk-description>

and it worked but not when Flash CS5 was used. So because I couldn’t use Flash CS5 and have fonts embedded I have searched for solution to use FD to build air for android applications.

I have found this and that and using that knowledge I have compiled AIR for Android project for FlashDevelop that works perfectly for me, it builds APK file and uploads it to the connected device (not emulator – which is slow anyway) and runs it. I have used Project image (PNG) from fazermokeurs version project.


UPDATE: well I know why fonts were not embedded, it was due to the new way of embedding fonts (As CFF “Compact Font Format”) used by default for the Flash Text Engine, you may find info here and here.

The AIR for Android

Posted in actionscript, android, flash | Tagged , , , , , , , , , | Comments Off on AIR for Android with FlashDevelop

cause of silence

I haven’t updated my blog for a while but I had a reason:) It’s name is HTC desire:) with Android 2.2 and FlashPlayer 10.1 and Adobe AIR:)

Posted in android, Uncategorized | Tagged , | Comments Off on cause of silence

Rectangle with “sorted” edges

In some situation you would like to reassure that given Rectangle object have “top-down, left-right” order you can do it using following two snippets

this creates “normalized” copy of the given rectangle


		/**
		 * Takes rectangle as a parameter and returns new with sorted edges, i.e. (x=50, y=50, w=-100, h=-100) becomes (x=-50, y=-50, w=100, h=100). In other words it makes sure that rectangles top and left are smaller than bottom and right respectively.
		 * 
		 * @param	p_oRect
		 * @return
		 */
		protected function normalizeRect(p_oRect:Rectangle):Rectangle
		{
			var nr:Rectangle = new Rectangle();
				nr.top = Math.min(p_oRect.top, p_oRect.bottom);
				nr.bottom = Math.max(p_oRect.top, p_oRect.bottom);
				nr.left = Math.min(p_oRect.left, p_oRect.right);
				nr.right = Math.max(p_oRect.left, p_oRect.right);
				
			return nr;
		}

this modifies given rectangle directly

		/**
		 * Modifies the rectangle given in parameter and makes sure that edges are sorted, i.e. (x=50, y=50, w=-100, h=-100) becomes (x=-50, y=-50, w=100, h=100). In other words it makes sure that rectangles top and left are smaller than bottom and right respectively.
		 * This method works directly on the object without making a copy.
		 * @param	p_oRectRef
		 */
		protected function normalizeRectV2(p_oRectRef:Rectangle):void
		{
			var _nSwap:Number;
			_nSwap = p_oRectRef.top;
			p_oRectRef.top = Math.min(_nSwap, p_oRectRef.bottom);
			p_oRectRef.bottom = Math.max(_nSwap, p_oRectRef.top);
			
			_nSwap = p_oRectRef.left;
			p_oRectRef.left = Math.min(_nSwap, p_oRectRef.right);
			p_oRectRef.right = Math.max(_nSwap, p_oRectRef.left);
		}
Posted in actionscript, flash | Tagged , , | Comments Off on Rectangle with “sorted” edges

access denied

If you have a problem with calling the API methods, and the only thing you get is “access denied” then you may try following solution:

access denied fix

Posted in magento | Tagged , | Comments Off on access denied