Info

Magnus Eriksson, Developer at Vaimo, a web agency heavily into Magento. Doing alot of coding in my spare time.

Have used woorank.com a lot. It’s a pretty good tool to find out why a site or blog dont manage to get particularly high in search engine rankings.

It goes through site content and ranks it with their SEO algorithm, it also provides help with other types of information like visitors, in-site SEO, off-site SEO, usability and website information. It provides a basic SEO information for  you to fix se basics of your site.

woorank.com

 

 

We had trouble using the HTML5 with EPiServer CMS, it proved to be a bug.

The bug is that you have to write html 5 doctype in uppercase, ie <! DOCTYPEhtml>, to write doctype in lowercase makes EPiServer html parser removes thedoctype.

The actual bug is that the doctype should be case-insensitive - that you can see if you read the documentation for the doctype.

so use the <! DOCTYPE html> until the bug is resolved.

There is a problem with adding files with extension .a to subversion. extension .a is compilated code in objective-c and there for useful to add to svn, mostly if you are group of developers so they can compile the checked out code. The reason it cant be added is because it exists in the global ignore list. You can change it if you want through the terminal, i guess it exist there for a reason so i have not done this.

The way i do it is by renaming it prior to adding, like codeexample.rename, add it, commiting, then use the svn rename and rename it back to .a. Now you can commit the changes and voilá, it exist in your repository.

Commands are from the swedish keyboard layout.

Auto Indent: ctrl + I
Comment on mouse selects: apple + shift + 7 (/)

Kalle Persson came up with these tips in the comments.

Switching between. M and. H file: ctrl + cmd + arrow up
Force autocompletion: esc
Switching focus between the panels: cmd + j

Thanks to Kalle, if you want to tell about more great commands, add a comment.

 

Here are two suggestions how to solve a horizontal view, that is, a view that differs from the vertical.

Either make it a modal with a risk that it takes ”time” until it appears, the transition can be a bit slow.

.h

@interface XXXX : UIViewController
{
    BOOL isShowingLandscapeController;
}

@property (nonatomic) BOOL isShowingLandscapeController;

.m

- (void)viewDidLoad
{
    [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:)  name:UIDeviceOrientationDidChangeNotification object:nil];  
}

-
(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) orientation {
    return (orientation == UIInterfaceOrientationPortrait);
}

- (void)dealloc
{
    [[NSNotificationCenter defaultCenter] removeObserver:self];
    [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
    [super dealloc];  
}

- (void)orientationChanged:(NSNotification
*)notification
{
    [self performSelector:@selector(updateLandscapeView) withObject:nil afterDelay:0];
}

- (void)updateLandscapeView
{
    UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation;
    if (UIDeviceOrientationIsLandscape(deviceOrientation) && !isShowingLandscapeController)
    {
         UIViewController viewController = [[UIViewController alloc] initWithNibName:nil bundle:nil];
         [self presentModalViewController:viewController animated:YES];
     [[UIApplication sharedApplication] setStatusBarOrientation: deviceOrientation];
         isShowingLandscapeController = YES;
     [viewController release];
   } else if (UIDeviceOrientationIsPortrait(deviceOrientation) && isShowingLandscapeController) {
         [self dismissModalViewControllerAnimated:YES];
         isShowingLandscapeController = NO;
   }
}

You can also choose to do in a different way and it is to use dual views, a tip is to only load what is visible but the code is not included in the example.

.h

@interface XXXX : UIViewController
{
    UIViewController *viewPortrait;
    UIViewController *viewLandscape;
}

@property (nonatomic,assign) UIViewController *viewPortrait;
@property (nonatomic,assign) UIViewController *viewLandscape;

.m

- (void)loadView {
    viewPortrait = [[UIViewController alloc] initWithNibName:nil bundle:nil];
    viewLandscape = [[UIViewController alloc] initWithNibName:nil bundle:nil];
    viewPortrait.hidden = NO;
    viewLandscape.hidden = YES;
}

- (void)viewDidLoad
{
    [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:nil];

}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) orientation {
     return (orientation == UIInterfaceOrientationPortrait);
}

- (void)dealloc
{
     [[NSNotificationCenter defaultCenter] removeObserver:self];
     [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
     [super dealloc];
}

- (void)orientationChanged:(NSNotification *)notification
{
     [self performSelector:@selector(updateLandscapeView) withObject:nil afterDelay:0];
}

- (void)updateLandscapeView
{
    UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation;

    if (UIDeviceOrientationIsLandscape(deviceOrientation) )
    {
    viewPortrait.hidden = YES;
        viewLandscape.hidden = NO;
    } else if (UIDeviceOrientationIsPortrait(deviceOrientation) ) {
        viewPortrait.hidden = NO;
        viewLandscape.hidden = YES;
    }
}

 

 

 

 

 

For measurements in the layouts

px number of real pixels. 100px is the same regardless of screen size.

In Inches - based on screen size. That is, it increases or decreases depending on the screen.

mm Millimeters - based on screen size. same as above.

pt points - 1 / 72 part of the above inch. It also increases or decreases depending on the  size of the screen.

dp Density Independent pixel - based on the physical density of the screen.
Assumes that a pixel is a pixel at 160dpi. However, it does not always make the size proportionally correct. You can also use dip.

sp Works like the dp but also takes into account the user’s font settings. This is recommended only to use on fonts.

A walkthrough to layout views in Android

FrameLayout

Its an layout for a single object an image for example. Children of an FrameLayout get automatically positioned at the top-left of the layout. This is not possible to change.
If there are more than one child there will be only one visible, the first.

LinearLayout

The most common view. This view has two modes to display its children – horizontal or vertical, one child per row or column if you think like a list (1 row)

TableLayout

As it sounds its a table of cell that you split the children into rows and columns. TableRow descripes the row and the biggest amount of children in a row sets the amount of total columns.

RelativeLayout

RelativeLayout lets the children be relative to each other, by declaring layoutabove=”id” or layoutbelow=”id” can you decide the position of the child, if you use both it will ly in between those two elements

Some attributes to consider that one can enter the on children
Note! Some layouts do not take into account all of the attributes.

Weight - the degree of importance as regards the filling of the parent. The higher the weight the more the right to place. Several children at the same weight are equally important. Logical but to consider is that if a child has two in weight and two children have a weight as a child entitled to 50% of the excess surface and two children will share the rest. Can be a little math if there are many children.

Margin - The distance between the child and nothing else.

Gravity - What the child should be adjusted to the row / column. Up, down, left, right, or a combination.

Padding - the distance between the child’s contents and the outer edge of the baby.