April 2, 2012

Eclipse, IntelliJ – color schemes

By in ActionScript, Eclipse, IntelliJ, Java

Color schemes I’m currently using (Eclipse and IntelliJ)

eclipse – color scheme

intellij – color scheme

intellij – eclipse alike keymaps

Tags: , ,

December 1, 2011

Forcing lazy loading on JPA entity

By in Java, JPA

The entity returned from a lazy-loading relationship can actually be a proxy that waits until
a method is invoked on the proxy before the entity is faulted in. We have to invoke a method on the
entity to guarantee that it is actually retrieved from the database. If this were a collection-valued
relationship, the size() method of the Collection would be commonly used to force eager loading.


public class BaseUser
{
...

@OneToMany(mappedBy="user",cascade=CascadeType.ALL, orphanRemoval=true)
public Collection<Authority> authorities;
...
}

//Some point in code under transcational

Query q = em.createQuery("SELECT v FROM User v WHERE v.username = '" + username + "'");

if (users.size() != 0)
{
User user = (User) q.getResultList().get(0);

//this will trigger lazy loading
user.getAuthoritys().size();
}

...

Tags: ,

September 21, 2011

The Formula

By in Uncategorized

September 12, 2011

Hiding ActionBar from ViewNavigator

By in AIR, android, blackberry, Flash platform, Flex, ipad, iphone, mobile

In order to hide action bar from the ViewNavigator all you have to do is create custom ViewNavigatorSkin and override its createChildren method.There you have several options, set includeInLayout to false or just don’t add actionbar as a child at all.Simple as that.

  override protected function createChildren():void
    {
        contentGroup = new Group();
        contentGroup.id = "contentGroup";

        actionBar = new ActionBar();
        actionBar.id = "actionBar";

        addChild(contentGroup);

        //either you can comment this line out
        //addChild(actionBar);

        //or you can simply do this
        actionBar.visible = actionBar.includeInLayout = false;
        addChild(actionBar);
    }
September 3, 2011

Sitting is killing you

By in Development

Sitting is Killing You
Via: Medical Billing And Coding

September 1, 2011

Eddie Vedder Society with Johnny Depp

By in Music

August 30, 2011

Sharing my cool playlists

By in Music

I’ve created new page where i will share some cool music i listen

Check it out

 

August 23, 2011

How to create DPI-aware splash screen

By in AIR, Flash platform, Flex, mobile

If you are developing Adobe AIR for multiple devices and mobile (Desktop, Android, iPhone, iPad), most definetely you will need to define splash screen for specific DPI.
It is pretty simple in Flex all you have to do is create your own preloader and override initialize method.
For mobile there is special class SplashScreen->Sprite which implements IPreloaderDisplay.The most convinent way is to extend this class.

package preloader
{
import mx.core.DPIClassification;

import spark.preloaders.SplashScreen;

import mx.managers.SystemManager;
import mx.utils.DensityUtil;

public class DPIAwarePreloader extends SplashScreen
{
	[Embed(source="/../asset/160dpi/splashScreen.png")]
	private var splashScreen160dpi : Class;

	[Embed(source="/../asset/240dpi/splashScreen.png")]
	private var splashScreen240dpi : Class;

	[Embed(source="/../asset/320dpi/splashScreen.png")]
	private var splashScreen320dpi : Class;

	public function DPIAwarePreloader()
	{
		super();
	}

override public function initialize() : void
{
	var runtimeDPI : Number = DensityUtil.getRuntimeDPI();
	var sysManager : SystemManager =
	this.parent.loaderInfo.content as SystemManager;

	var splashImage : Class;

	switch(runtimeDPI)
	{
		case DPIClassification.DPI_160:
			splashImage = splashScreen160dpi;
			break;

		case DPIClassification.DPI_240:
			splashImage = splashScreen240dpi;
			break;

		case DPIClassification.DPI_320:
			splashImage = splashScreen320dpi;
			break;
	}

	sysManager.info()["splashScreenImage"] = splashImage;

	super.initialize();
}
}
}

This will check for runtimeDPI property of your device and set the splash screen designed for specific DPI.

The last step is to add your preloader to the root Application by setting the preloader property in the mxml.

Tags: , , , ,

June 24, 2011

Flex AIR multi-device development

By in AIR, Flash platform, Flex, mobile
Adobe AIR

Adobe AIR

Application DPI
The DPI of the application. By default, this is the DPI of the device that the application is currently running on. When set in MXML, Flex will scale the Application to match its DPI to the runtimeDPI. This property cannot be set by ActionScript code; it must be set in MXML code.

Runtime DPI
The DPI of the device the application is currently running on. Flex rounds the value to one of the DPIClassification choices.

Find out more
DPI and PPI Explained

Building Multi-Density and Multi-Platform UIs with Flex by Narciso (nj) Jaramillo

Optimizing Performance for the ADOBE® FLASH® PLATFORM

DPI Auto Scaling for Density Independent Mobile Apps – Functional and Design Specification

June 7, 2011

Simple flex filter editor with source code

By in Flash platform, Flex

Here is the really simple flex filter editor that can be use as a foundation for exploring filter capabilities in flex.
All of the flex filters are pretty much just a wrappers for filters supported by flash player.And this is simple editor of these wrappers.

Filter editor with source code

Tags: , , ,

Switch to our mobile site