Sony Smart Extras (Smartwatch) When using an .xml file to specify the layout of an accessory, remember the following

  • All sizes should be expressed in px. This to avoid scaling based on the phone density.
  • If an ImageView is used to show an image, we recommend that you specify layout_width and layout_height in px to avoid scaling based on the phone density.

Note: This is since the phone density is based on the phone (or tablet) you have connected the smart extension to, not the smart extension itself.

Sony Smartwatch Accelerometer sensor when is a axis positive (witch side is up)?

For the axis the values are:

  Positive value Negative value
x: The button is up The button is down
y: The Sony label is up The Sony label is down
z: The Screen is down The screen is up

Also a interesting thing to note, no matter how we all try to (when having the accelerometer using the SENSOR_STATUS_ACCURACY_HIGH) we can not get it to go past 78,15m/s^2.

Using RedirectToAction

The RedicrectToAction simply generates a HTTP 302 code witch tells the browser to get the next page.
It is important to remember that when this is used inside a view then we should return RedicrectToAction. This will render the View to the client (and make it redirect) and will stop any further execution (if the RedirectToAction for instance is inside a if statement)

public ActionResult Upload(UploadOrderModel uploadorder)
{
	if (uploadorder.IsInvalid)
	{
		//somthing fishy is going on ...
		return RedirectToAction("Index", "Home");
	}
	//do important things here
	return View(orderInfo);
}

system.web.mvc.controller.redirecttoaction at msdn

Force a span to honor a width

A span is normally a inline element so setting a width to it might not have the effects you are looking for.
In order to “force” a span to have a width it can be set as a inline-block

<span style="display:inline-block;width:92px;">&nbsp;</span>

another (better!) way is to use padding to give the span a size.

<span style="padding: 10px 20px; font-size: 0px;">&nbsp;</span>

(The font-size is here to “fix” the height of the span; and don’t forget that padding happens on both sides in this example so the end result is 20x40px)

(JQuery) Uncaught TypeError: Property ‘$’ of object [object someObject] is not a function

This can happen for instance when JQuery has not been fully loaded before trying to execute JQuery code.
Using $(document).ready(function($) is one way to solve this, as this should wait until JQuery is fully loaded.

<script type="text/javascript">
  $(document).ready(function($) {
    //some awsome jquery code
  });
</script>

Python: Converting from string to integer/float

myString = "545.2222"
float(myString) #545.2222
 
#or to round it of
int(float(myString)) #545
 
#or to keep us safe in case the myString should be checked for "funny" values
try:
    i = int(myString)
except ValueError:
    i = 0

Specifying the JVM to run Eclipse with

Specifying the JVM Eclipse should use is both a nice way to make sure it is correct now and to know that future upgrades/updates won’t mess with this.

This is done by specifying the -vm option in the “eclipse.ini” file.

Important bits to know about this:

  • -vm option and the path must not be on the same line
  • You should give the Java excecutable here, not just the path where is is located
  • if you also have -vmargs the -vm must be before that in the ini file

Example eclipse.ini (for windows)

-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vm
C:\progra~1\Java\jdk1.6.0_26\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m