WordPress database error: [INSERT, UPDATE command denied to user '51213-2'@'10.10.20.149' for table 'wp_options']INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) VALUES ('_transient_doing_cron', '1715274611.5303740501403808593750', 'yes') ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)
When you build an app, you can choose to translate it and add ressource dedicated to a special environments. Images/Logo specific to each pixel density plateau is one example of it. If you create bundles, your final package uploaded on the Store will be one “main” package and satellite package for each “specific target”.
It also means that the user will download only what is necessary to their devices : less bandwith used, smaller apps : happy users !
Creating app’s bundle is easy, in the last step of the Visual Studio package wizard, you choose either “If Necessary” or “Always”.
Choosing to use app bundles has some consequences. The one which I was not happy with was that you won’t be able to let the user choose the language of your app since only the languages installed on it’s device will be available.
In my last update of TV Show Tracker, I wanted to let this freedom to my users so I used the wizard and choose to never create a bundle. I uploaded my package to the Store and I then get the previously mentionned error
The solution is then to create my own app bundle with the SDK tools and upload it to the Store.
Here are the steps :
makeappx bundle /p NameOfTheCreatedBundle.appxbundle /d FolderWithTheAppxInside
The name of the bundle can be anything as the name of the folder with the appx inside.
The whole app with all ressources will now be downloaded by my users. This can be frightening : how much more will they have to download ? Let’s take a look inside the app bundle…
So an user on a standard density pixels, english phone will now download the not used “scale-140” assets, the “scale-180” assets and french language : 300 more kb –> 2,85 %. So for 2,85% more package size, my user will be able to choose the language of their app. That’s ok for me
Happy coding !
]]>
Not really obvious but this works fine
If you want to see this feature in action, it will soon be available in our last app “Say it With Flowers” !
PS: the whole procedure is describe in depth on MSDN but I am sure you love this recap
PS2: the localized app name won’t be displayed on the Store page because of a bug in the Store : http://blog.webrox.fr/?p=61
]]>Each time I have a new message, I receive an email with the wav audio file linked: fantastic ! Well in fact, it’s not because my Windows Phone 8 seems not to be able to read this file. Yes… no need to tell me this format created by Microsoft and IBM exists since 1991.
What I wanted to share with you is a free solution, while Microsoft is fixing the issue.
First of all, I don’t seem to be alone with this issue and you can add your votes for a quick fix on this page.
Developer one day, developer everyday : I first tried to create an app and register it for the “wav” files extension but it’s a protected one and so we can not make an app which will be able to read wav files from mail… too bad
The solution I finally found out is to use the phoneconvert.com service. It’s free, and its usage is simple : forward your email to it and it will respond to you with a Windows Phone 8 compatible version of your wav file.
I hope it will help you too.
]]>This is quite boring because it also raises the SelectionChanged event twice and can mess up your business logic.
Let’s see how to fix this temporary (I hope!) issue :
The problem is that the LongListMultiSelector listen to the changes(add/remove/replace/clear) in it’s SelectedItem collection so we can’t use it directly.
The solution is to ‘fake’ an user selection using the LongListMultiSelectorItem which is the container of each item.
So instead of writing this code :
[csharp]
foreach (var item in LongListMultiSelector.ItemsSource)
{
//LongListMultiSelector.SelectedItems.Add(item);
}
[/csharp]
you have to write this code :
[csharp]
foreach (var item in LongListMultiSelector.ItemsSource)
{
var container = LongListMultiSelector.ContainerFromItem(item)
as LongListMultiSelectorItem;
if (container != null) container.IsSelected = true;
}
[/csharp]
Yesterday, while I was updating my ConsoTracker app, I met a strange bug using the CustomMessageBox : it was raising a nullReference exception.
Let’s see what was the issue and how to “fix” it.
What I was trying to do was this simple scenario :
As I like playing with tasks, I was using this code :
[csharp]
protected async override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
var mBox = new CustomMessageBox
{
Title = "Do you want to… ",
Message = " … click on yes ?",
LeftButtonContent = "Yes",
RightButtonContent = "No"
};
var result = await ShowAsync(mBox);
NavigationService.Navigate(new Uri("/OtherPage.xaml", UriKind.RelativeOrAbsolute));
}
public static async Task<CustomMessageBoxResult> ShowAsync(CustomMessageBox box)
{
var taskCompletionSource = new TaskCompletionSource<CustomMessageBoxResult>();
box.Dismissed += (a, b) => taskCompletionSource.TrySetResult(b.Result);
try { box.Show(); }
catch (Exception exception) { taskCompletionSource.TrySetException(exception); }
return await taskCompletionSource.Task;
}
[/csharp]
This code was throwing an exception. To fix it, I downloaded the source of the Windows Phone Toolkit and I saw that at the end of the dismissal animation, it was trying to access the “Popup” object which was null : BOUM !
So… how did I fix it ? Simply by waiting for the popup to be unloaded instead of using directly the Dismissed event of the CustomMessageBox :
[csharp]
public static async Task<CustomMessageBoxResult> ShowAsync(CustomMessageBox box)
{
var taskCompletionSource = new TaskCompletionSource<CustomMessageBoxResult>();
var result = CustomMessageBoxResult.None;
//Only store the result here.
box.Dismissed += (a, b) => result = b.Result;
//Use this event to set the result.
box.Unloaded += (_, __) => taskCompletionSource.TrySetResult(result);
try { box.Show(); }
catch (Exception exception) { taskCompletionSource.TrySetException(exception); }
return await taskCompletionSource.Task;
}
[/csharp]
I hope it will save you some time too
]]>Are you always checking the AppHub when you release a new version, wondering if it’s ok to release it ?
Are you always asking yourself “do I have a bug and a bad review” ?
Do you need to know how much is downloaded your app several times a day ?
If yes, you are AppHub addict like me ! Let’s discover an app which will soon be your favorite one !
I am addicted to the AppHub too and I hate to check the AppHub from my Mango’s internet explorer because it’s sloooowwww.
I so decided to create an app which will do the data gathering for me. It’s name is “AppHub Tracker” and it’s already available on all the market place.
All the symptoms above are healed with these features :
Did you try it ? Do you need some extra features ? Just tell me in the comments
]]>By doing this, your app will have shiny graphics! This increase the color depth and then the gradient are rendered really more smoothly. As expert would say, there is no more banding in your image !
I have found a really great example picture on this web forum to show this :
Forcing your app to use 32 bits per pix is extremly simple to perform trough the WMAppManifest.xml file.
All you have to do is to set the value to 32 using the BitsPerPixel attribute on the App XML element.
Here is an exemple of it in my ConsoTracker WP7 app :
[xml]
<App xmlns="" BitsPerPixel="32" ProductID="{…}" Title="ConsoTracker"
RuntimeType="Silverlight" Version="1.0.0.0" Genre="apps.normal"
Author="Jonathan ANTOINE" Description="Track your usage"
Publisher="ConsoTracker">
…
</App>
[/xml]
You can find all the possible attributes of the App element on this page : http://msdn.microsoft.com/en-us/library/ff769509(v=vs.92).aspx
Don’t forget to read Peter post on the subject too : http://www.pchenry.com/Home/tabid/36/EntryId/456/Battle-of-the-Bands-with-WP7-and-Image-Banding.aspx.
Thank you Adrien for showing me this tip !
Have fun !
In ConsoTracker, the app I build on Windows Phone, I forgot to provide it and users ask met to provide it !
In this post you’ll discover that the classic .Net way does not work and how to retrieve it from your code.
Before I give you the code, be aware that the version number you set in your assembly is not read by the MarketPlace. In fact, you provide the information to it in the app submission process.
You do so have to update it in your code as you give the correct version to the market place.
In .Net you can retrieve the version number of an application from it’s regarding assembly object instance.
[csharp]System.Reflection.Assembly.GetExecutingAssembly().GetName().Version[/csharp]
If you try it on a Windows Phone, you’ll discover that calling the property throw an exception. Also, as pointed out by Thomas in a tweet, it’s security critical which restricts it to internal use by the .NET Framework for Silverlight class library.
That’s too bad because it would have been clean way to retrieve it. Instead you have to read the assembly name and deduce the version number from it.
Here is the helper I use in my application:
[csharp]/// <summary>
/// Retrieve the current version of the executing assembly.
/// This is the one in the AssemblyVersion attribute.
/// </summary>
/// <returns></returns>
public static Version GetCurrentVersion()
{
Version version;
var assembly = Assembly.GetExecutingAssembly().FullName;
var fullVersionNumber = assembly.Split(‘=’)[1].Split(‘,’)[0];
version = new Version(fullVersionNumber);
return version;
}
[/csharp]
Be sure that the version number are synched if you put this code in another assembly. You can do this by sharing a file containing the AssemblyVersion attributes using ‘Add as link’ instead of adding a copy of the file.
Also, as it may represent a performance cost, I recommend you to to call it only once trough a static constructor.
]]>There is already some good books in english which can help the developers to discover and understand it but there were none in French.
This is no more the case because my friend Thomas Lebrun (blog, twitter) and I wrote one entitled “MVVM De la découverte à la maîtrise”.
You can buy it at different places:
Here is the different things we have covered in it:
Feel free to share this post
An updated, working, version of the source code is available at this adress : http://db.tt/XQfstVbB
Regards,
]]>Here is the sample which creates a “secondary tile” for your application:
[code language=”csharp”]//This is a .Net class named StandardTileData
var theTile= new StandardTileData
{
Title = "Secondary Tile", //The title
BackgroundImage = new Uri("FrontImage.jpg", UriKind.Relative),
Count = 12, //Notification number
BackTitle = "Back’s page title", //The title of the back page
BackContent = "A text is nice here",
BackBackgroundImage = new Uri("backImage.jpg", UriKind.Relative)
};
// Add the live tile to the Home screen (will exit the app)
ShellTile.Create(new Uri("/MainPage.xaml", UriKind.Relative), theTile);[/code]
Now, you may want to generate a screenshot of your application (using WriteableBitmap) and use it as the tile background. This is possible !
To do so, you have to store the picture in a folder named “Shared/ShellContent” otherwise you will have an NotSupportedException throwned.
The URI to use will then look like this one : “isostore:/Shared/ShellContent/background.png”. You can read this MSDN page for more information.
It takes me some time and Wilfried to figure this out, I hope this post will save you the search !
]]>