22 November 2015

Windows AdDuplex NuGet support

The best way to integrate AdDuplex into your project is through NuGet system, and not Visual Studio Gallery on MSDN.

This prevent Visual Studio Designer from Unhandled Exceptions.

So, if you already added Reference on installed AdDuplex support from Visual Studio Gallery on MSDN, remove it, and add corresponding NuGet packages for AdDuplex support.

Then in Windows 10 Universal project:

Add a namespace declaration to your page
xmlns:adduplex="using:AdDuplex"

Add an AdControl to your page:
< adduplex:AdControl AdUnitId="xxxxxx" AppKey="xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" />

Then in Windows 8.1 Store project:

Add a namespace declaration to your page:
xmlns:adduplex="using:AdDuplex.Universal.Controls.Win.XAML"

Add an AdControl to your page:
< adduplex:AdControl AdUnitId="xxxxxx" AppKey="xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" />

Then in Windows 8.1 Phone project:

Add a namespace declaration to your page:
xmlns:adduplex="using:AdDuplex.Universal.Controls.WinPhone.XAML"


Add an AdControl to your page:
< adduplex:AdControl AdUnitId="xxxxxx" AppKey="xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" />

Happy coding !


           

19 October 2015

How to fix MS Office 2016 file associations

If you lost file associations after MS Office 2016 installation, then go to Control Panel - Programs and Features, select Change on right click of the Microsoft Office 2016 item.

Then choose Quick Repair and the problem schould be fixed...

21 September 2015

Setup Windows God mode

This is hidden Windows Icon called God Mode, witch enable you many hidden Control Panel settings. Procedure for creating this God mode icon is:

Step 1: Right click on desktop

Step 2: Click Create folder.

Step 3: Name new folder like this : GodMode.{ED7BA470-8E54-465E-825C-99712043E01C} and press Enter.

Step 4. Enjoy God mode

20 September 2015

How to fix JavaScript IntelliSense in Visual Studio

If you have situation, that after some update in Visual Studio (TypeScript, for example), when you edit a JavaScript file, IntelliSense not work, here is a fix procedure:

Make sure your computer has an internet connection, and
If the Tools for Universal Windows Apps Development are still installed:

Go to Programs and Features, select Visual Studio 2015, click Change.
In Visual Studio setup, click Modify.
Deselect the feature Tools for Universal Windows App Development.
Select Tools for Universal Windows App Development again, and click Update.

If you have already uninstalled the Tools for Universal Windows Apps Development:
Reinstall Tools for Universal Windows App Development.

Or, take the following steps to reinstall the JavaScript project system and language service:
Download the installer for your edition of Visual Studio, such as, vs_community.exe.
Open a command window, and run the following command:
vs_community.exe /modify /installselectableitems JavaScript_Hidden /passive

Change directories to C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE.
Run the following commands
devenv /updateconfiguration
devenv /clearcache

16 September 2015

How to recover missing default volume icon in system tray on Windows 10

If you have missing volume icon in system tray on Windows 10, then you should run Registry Editor, with open Run by typing Win+R buttons. Enter "regedit" which means we are editing registry. In here select key 

HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Current Version\TrayNotify 

Here find couple of registries name IconStreams and PastIconStreams
Select those and delete them if exists.

Restart Windows Explorer or MS Windows, and your volume icon should be recovered.



How to restart Windows Update service

If your Windows Update Control Panel applet cannot start update process with button "Try again",
then you should press Win+X for Quick Menu and choose Command Prompt (Admin), and type:


  • net stop wuauserv
  • net start wuauserv
After that commands, response should be - successfully, and you can now restart Windows Update Control Panel applet with no problem.

09 September 2015

How to setup Windows Android Intel HAXM AVD Emulator

This is how to setup Windows 7, 8, 8.1 and 10 for Android Intel HAXM AVD Emulator.

In Administrator Command Prompt (Win+X) type:

C:\>bcdedit /copy {current} /d "No Hyper-V" 
The entry was successfully copied to {ff-23-113-824e-5c5144ea}. 

C:\>bcdedit /set {ff-23-113-824e-5c5144ea} hypervisorlaunchtype off 
The operation completed successfully.

P.S.:
In order to access the new boot menu, I select Settings (Windows Key + C) then Power, and Restart but hold down shift on the keyboard while clicking Restart with the mouse.

24 May 2015

How Do I Connect an Android Wear Emulator to a Real Phone ?

After starting Android Wear emulator and connected Real Android Phone :

- start Android Wear App on Real Android Phone and connect to Android Wear Emulator, or

- just type in PC Terminal :

adb -d forward tcp:5601 tcp:5601

Source: http://www.tech-recipes.com/rx/49586/how-do-i-connect-an-android-wear-emulator-to-a-real-phone/

18 May 2015

Android Material compatible theme

If you want to have Android Material compatible theme, you should have like this, in your styles.xml file :

<style name="MyTheme" parent="@style/Theme.AppCompat.Light">
    <item name="android:windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="android:windowFullscreen">true</item>
    <item name="android:windowContentOverlay">@null</item>
</style>

26 March 2015

How to update CM12 nightlies ?

Manual instructions:

Download latest zip
Boot into recovery
Install zip
Wipe cache and dalvik 
Reboot
Nothing gets wiped on your device.


28 January 2015

Parse News RSS 2.0 image in C#

If you want to parse News RSS 2.0 image from link, for example > http://codecanyon.net/feeds/new-codecanyon-items.atom

The following code can be used to match all img src in the source text and to populate list with value of src attribute.

private static IEnumerable<string> GetImagesInHTMLString(string htmlString)
        {
            var images = new List<string>();
            const string pattern = Imgpattern;
            var rgx = new Regex(pattern, RegexOptions.IgnoreCase);
            MatchCollection matches = rgx.Matches(htmlString);

            for (int i = 0, l = matches.Count; i < l; i++)
            {
                if (matches[i].Value.Contains(".jpg") || matches[i].Value.Contains(".png"))
                {
                    var ms = Regex.Matches(matches[i].Value, Urlpattern);
                    if (ms.Count > 0)
                    {
                        if (!string.IsNullOrEmpty(ms[0].Value))
                            images.Add(ms[0].Value.Replace("\"", string.Empty));
                    }
                }
            }

            return images;
        }

Decompiled C# Library : AppStudio.Common.dll

Wonderfull Microsoft Windows AppStudio on adress http://appstudio.windows.com generate Universal Applications for Windows Phone and Windows Store in C# - online.

Downloaded generated source code use closed library AppStudio.Common.dll, which breaks further portability.

Fortunately, the only items being used from this library are the BindableBase, BindableSchemaBase, and IDataSource. 

So I recreated these files in the directly, removing the AppStudio.Common.dll reference entirely from both the  Windows projects.

Here’s the code for the BindableBase:

using System;
using System.Collectionus.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace SoftLabPro.Data
{ public abstract class BindableBase : INotifyPropertyChanged
{
    public event PropertyChangedEventHandler PropertyChanged;
    protected BindableBase()
    {
    }
    public virtual void Initialize(IDictionary<string, string> parameters)
    {
    }
    protected void OnPropertyChanged(string propertyName = null)
    {
        PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
        if (propertyChanged != null)
        {
            try
            {
                propertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
            catch
            {
            }
        }
    }
    protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
    {
        if (object.Equals((T)storage, value))
        {
            return false;
        }
        storage = value;
        this.OnPropertyChanged(propertyName);
        return true;
    }
}
}

Here is BindableSchemaBase:

using System;
using System.Runtime.CompilerServices;
using System.Text;

namespace SoftLabPro.Data
{ public abstract class BindableSchemaBase : BindableBase
{
    public BindableSchemaBase()
    {
        this.Id = Guid.NewGuid().ToString();
    }
    public abstract string GetValue(string propertyName);
    public virtual string GetValues(params string[] propertyNames)
    {
        StringBuilder builder = new StringBuilder();
        foreach (string str in propertyNames)
        {
            builder.AppendLine((this.GetValue(str) ?? string.Empty).ToString());
        }
        return builder.ToString();
    }
    public abstract string DefaultContent { get; }
    public abstract string DefaultImageUrl { get; }
    public abstract string DefaultSummary { get; }
    public abstract string DefaultTitle { get; }
    public string Id { get; set; }
}
}


And finally IDataSource:

using System.Collections.Generic;

using System.Threading.Tasks;

namespace SoftLabPro.Data

{
    public interface IDataSource<T> where T : BindableSchemaBase

{
    Task<IEnumerable<T>> LoadData();
    Task<IEnumerable<T>> Refresh();
}

}

27 January 2015

Parse Google News RSS image in C#

If you want to parse Google News RSS image from link, for example > http://news.google.com/news?hl=us&q=android&output=rss

The following code can be used to match all img src in the source text and to populate list with value of src attribute.

private static IEnumerable<string> GetImagesInGoogleNewsString(string htmlString)
        {
            List<string> imgSrcs = new List<string>();
            //const string pattern = Imgpattern;
            //var rgx = new Regex(pattern, RegexOptions.IgnoreCase);
            var imgSrcMatches = System.Text.RegularExpressions.Regex.Matches(htmlString, string.Format(@"<\s*img\s*src\s*=\s*{0}\s*([^{0}]+)\s*{0}", "\""),
               RegexOptions.CultureInvariant | RegexOptions.IgnoreCase | 
               RegexOptions.Multiline);

            foreach (Match match in imgSrcMatches)
                imgSrcs.Add("http:" + match.Groups[1].Value);

            return imgSrcs;
        }

16 January 2015

Android Splash Screen sizes

For drawable resolutions I found these most suitable :


Density

Resolution

Format

Color

ldpi

240x320

png

24bit

mdpi

320x480

png

24bit

hdpi

480x800

png

24bit

xdpi

720x1280

png

24bit

xxdpi

1080x1920

png

24bit

xxxdpi

?







05 January 2015

Making money with Android

Follow one developer's journey to making an income from Android apps. The goal: $1000 a month.