Saturday, May 31, 2014

JSON, GSON

https://www.youtube.com/watch?v=rncW-74VL7U

To use viewpagerindicator in Android studio project

http://droidista.blogspot.com/2012/08/making-actionbarsherlock-and.html

http://stackoverflow.com/questions/21130003/using-viewpagerindicator-library-with-android-studio-and-gradle

http://blog.haunted-soft.com/2013/10/viewpagerindicator-aar-packaged.html

https://github.com/pandanomic/SUREwalk_android

http://dl.bintray.com/populov/maven/com/viewpagerindicator/library/

you can download jar file (2nd link above)  and add to your project or check out the project above to use

repositories {
    maven { url "http://dl.bintray.com/populov/maven" }
    mavenCentral()
    maven { url 'http://download.crashlytics.com/maven' }

}



Capture youtube video frame by frame

Pause video, left or right arrow.

How to Add Libraries to Android Studio

http://gmariotti.blogspot.com/2013/06/quick-tips-convert-to-new-gradle-based.html

https://www.youtube.com/watch?v=wCKWIDGULfY



https://www.youtube.com/watch?v=1MyBO9z7ojk

create new dir on root folder called "libraries'
copy the library project to 'libraries'

edit settings.gradle
include ':libraries:mylib'

Now add the dependency to project

File, project structure, project settings

click on "Dependencies" tab, click on "+" and select "Module dependencies"



Frameworks detected: Android framework is detected in the project Configure

http://stackoverflow.com/questions/18386154/android-framework-is-detected-in-the-project

Thursday, May 29, 2014

Issue 55863: Gradle build does not support local aar dependencies

https://code.google.com/p/android/issues/detail?id=55863

http://stackoverflow.com/questions/16682847/how-to-manually-include-external-aar-package-using-new-gradle-android-build-syst

Visual studio VB.net assembly version

Version.Text = System.String.Format("Version {0}.{1}.{2}.{3}", My.Application.Info.Version.Major, My.Application.Info.Version.Minor, My.Application.Info.Version.Build, My.Application.Info.Version.Revision)

Android action bar

Android 4.0 new features

Android intents

https://www.youtube.com/watch?v=2TK6KX_RDe8
https://www.youtube.com/watch?v=qurvm-E9AiU

http://pluralsight.com/training/courses/TableOfContents?courseName=android-intents&highlight=jim-wilson_android-intents-m02-basics*4#android-intents-m02-basics

Wednesday, May 28, 2014

team foundation server delete workspace

open vs command prompt
tf workspaces /collection:http://mytfsServer:8080/tfs/mycollection

to delete a workspace
tf workspace /delete /collection:http://mytfsServer:8080/tfs/mycollection myworkspace

greendroid

http://cyrilmottier.com/2010/05/14/introduction-to-the-greendroid-library/

Tuesday, May 27, 2014

How do I change the .NET framework bootstrapper package

1. I found that I needed to right click on my Setup and Deployment project, hit properties, go to prerequisites, and uncheck .NET framework 4 and check .NET framework 3.5.

2. Select it in Solution Explorer, and then at the top click the little icon with binoculars (Launch Condition Editor).

Under Launch Conditions, right click on the .NET Framework and open the properties, and then change the Version to .NET Framework 3.5.

When c# properties does not work on app config

You have to add global::

if (global::xxxxx.Properties.Settings.Default.Debug)

Android import project

https://www.youtube.com/watch?v=1MyBO9z7ojk

http://stackoverflow.com/questions/16588064/how-do-i-add-a-library-project-to-the-android-studio

http://chmcguir.wordpress.com/2013/09/23/android-studio-importing-library-projects/

http://stackoverflow.com/questions/20310164/how-to-import-eclipse-library-project-from-github-to-android-studio-project

Monday, May 26, 2014

Android - import project has message frame work detected

(below is not complete)
You have to select run , then configure the run as Android applicaiton, and select module then it will run.

Android - ViewPager



The one below is fully functional but no images

https://github.com/JakeWharton/Android-ViewPagerIndicator

https://www.youtube.com/watch?v=C6_1KznO95A

http://blog.sqisland.com/2012/07/android-swipe-image-viewer.html

http://blog.sqisland.com/2012/09/android-swipe-image-viewer-with-viewpager.html

https://github.com/chiuki/android-swipe-image-viewer

http://viewpagerindicator.com/

http://stackoverflow.com/questions/13796382/android-viewpager-as-image-slide-gallery

http://www.smashingmagazine.com/2013/02/01/android-carousel-design-pattern/

http://www.edumobile.org/android/android-beginner-tutorials/view-pager-example-in-android-development/

Sunday, May 25, 2014

Android Studio - How to add a jar library

I download this demo from the link below and found out when build it, it says missing the android support lib v4, so I started to looking for solution of how to add a jar library. Found video below:

http://www.e-nature.ch/tech/simple-tutorial-for-a-smooth-horizontal-view-slider-with-android/

The link below can get you started, but you need to read through the entire view since he made a mistake then he corrected it.

https://www.youtube.com/watch?v=fHEvI_G6UtI

The above video ia not completely correct according to current Android studio (I am using 0.5.8)

below is how I added jar file for andriod support v4

Find the jar file first then do copy

In Android studio create a new directory "libs" right click on your app (see below)

create the libs folder

Paste the jar file

Confirm


you have to change build.gradle file, add dependencies. NOTE the video on top does not work at this point, I have to changed to use the format below to make it work

dependencies{
    compile files ('libs/android-support-v4.jar')
}

I got help from the link below:




From here to project build and working



Android studio import Intelij idea projects => Migrate Project to Gradle? This project does not use the Gradle build system...

Migrate Project to Gradle?
This project does not use the Gradle build system. We recommend that you migrate to using the Gradle build system.
More Information about migrating to Gradle
Don't show this message again.

http://stackoverflow.com/questions/21606504/cant-migrate-project-to-gradle-in-android-studio

The project thinks it's still a non-Gradle based project; it's not the presence of the build.gradle file that makes it Gradle-based, but it's how the project was set up in the first place. You'll need to re-import your project to finish the conversion to Gradle.
First, though, it looks like you don't have a settings.gradle file; it looks like you need one. Since you've set up your project as a single-module project, then you can put the file in your project's root directory, next to build.gradle. It should contain this:
import ':'
In the future if you add more modules to your project you may want to convert it to a multi-module directory structure, but you don't need to worry about that now. In any event, now you need to do the re-import in Android Studio:
  1. Close your project
  2. Back up your project
  3. Delete the .idea folder in the root directory of the project
  4. Delete all the .iml files in your project
  5. Import your project in Android Studio, and in the dialog that prompts you for a file, choose thebuild.gradle file.
  6. After this you should be good to go.

I followed yellow highlighted and open android studio then import project, open the root folder it prompt me the following screen:

Just click "Next"


Click "Finish"


It imported with some warnings, but I still can run the entire project successfully.




How do I run multiple instances of Android Studio

http://stackoverflow.com/questions/18299698/how-do-i-run-multiple-instances-of-android-studio

  1. Go to Settings -> General -> Project opening.
  2. Check 'Confirm window to open project in'.
  3. Create or open different project.
  4. You will be asked if open a new window.

When you open the new instance you do not open anther android studio exe. Open from the existing running android studio.

Saturday, May 24, 2014

How to download YouTube video to your Android mobile phone

Use RealPlayer and RealPlayer Cloud(install on your windows PC), use RealPlayer to open the URL of Youtube that you want to download
right mouse click and you will see download option
upload to real cloud
open in mobile phone RealPlayer Cloud (install RealPlayer Cloud on your phone)
click on option to download to mobile

watch on mobile offline is available.

Thursday, May 22, 2014

Android drawer

When search Android drawer found

https://www.youtube.com/watch?v=YeR7McJIltk

http://www.cyrilmottier.com/

this.invalidate() will redraw the screen

http://www.tutecentral.com/android-custom-navigation-drawer/

Fix emulator offline



Android SDK


Android ADB

http://www.howtogeek.com/125769/how-to-install-and-use-abd-the-android-debug-bridge-utility/


C:\Users\NAME\AppData\Local\Android\android-sdk\platform-tools

ADB.exe
Browse to this directory, hold Shift and right-click inside it, and select Open command window here.

show devices

Microsoft Expression Encoder 4

Sound

Simple doc
http://www.greenfoot.org/static/codebreaker/expression.pdf

Microsoft video

http://tinyurl.com/3odwjo2

http://www.microsoft.com/en-us/showcase/details.aspx?uuid=fc45e68b-2186-4ddd-b763-f13d9a0cb2






Microsoft screen recorder

http://technet.microsoft.com/en-us/magazine/2009.03.utilityspotlight2.aspx

Activity - add menu item

go to menu folder
open main.xml
inside <menu
type  <item enter
then tab  then tab
it will give you line below:
<item android:id="@+id/"

You can watch video => here






Activity

Override methods

go to code and select method

Wednesday, May 21, 2014

Android Intent

https://www.youtube.com/watch?v=2TK6KX_RDe8

intent register broadcast receiver
service
broadcast receiver

explicit - assitant and you know the guy to call
inplicit - you do't know

http://developer.android.com/guide/components/intents-filters.html

http://developer.android.com/reference/android/content/Context.html

example:
https://www.youtube.com/watch?v=qurvm-E9AiU

Implicit
reusbility, ex send email, android os knows what app sends email , but you do not know
https://www.youtube.com/watch?v=rqZnn5cf2As

4 pieces of intent
action - what you want to do (call someone)
data - what type of data, ex url, images
extras -phone #
category - create group of components to handle the intent (ex. place activity in the launcher)

intent filters
https://www.youtube.com/watch?v=2FNGXp8Lzlw

package manager
http://developer.android.com/reference/android/content/pm/PackageManager.html

example:
https://www.youtube.com/watch?v=iGbMNfv2KxA

https://www.youtube.com/watch?v=qDN7q4uWKto
startActivity(chooser)

http://developer.android.com/reference/android/app/Activity.html#startActivity(android.content.Intent)

http://androidsbs.blogspot.com/2014/01/startactivty-start-new-activity.html

Example email
https://www.youtube.com/watch?v=nj-STGrL7Zc

Example image
https://www.youtube.com/watch?v=E6LjSjJb5T4

Example send multiple images
https://www.youtube.com/watch?v=55hRGBJ1-2E

Android Activity onSaveInstanceState() and onRestoreInstanceState()

concept
https://www.youtube.com/watch?v=3FMn4FEv12M

how to use
https://www.youtube.com/watch?v=B3G6kUXvfuY

boundle
out.
super.onsaveinstantstate

http://stackoverflow.com/questions/4096169/onsaveinstancestate-and-onrestoreinstancestate

android it button click

http://stackoverflow.com/questions/10947114/button-selection-in-android

https://www.youtube.com/watch?v=MtmHURWKCmg

https://www.youtube.com/watch?v=R6QTfIh23YA

5 ways
https://www.youtube.com/watch?v=cqkEPcqU2QU

inner class
https://www.youtube.com/watch?v=U7qvQF6J0gE

3rd way, interface variable
https://www.youtube.com/watch?v=2s63_XHC9eI
http://docs.oracle.com/javase/tutorial/java/javaOO/anonymousclasses.html
http://stackoverflow.com/questions/355167/how-are-anonymous-inner-classes-used-in-java

Android onConfigurationChanged not being called

http://stackoverflow.com/questions/6457659/android-onconfigurationchanged-not-being-called

https://www.youtube.com/watch?v=Y5J6BURMrHQ

Android studio tips

Ctrl Space to show value
http://www.developerphil.com/android-studio-tips-tricks-moving-around/

Notes for #13 Android Tutorial For Beginners: Android Activity Screen Orientation

https://www.youtube.com/watch?v=HtMmY6CeuYE


Tuesday, May 20, 2014

C# taskscheduler

  rootFolder.RegisterTaskDefinition(task.Name, definition, 6, "ID", "password", _TASK_LOGON_TYPE.TASK_LOGON_PASSWORD, null);

The ID & PW just need hard coded, not an object.


http://taskscheduler.codeplex.com/discussions/545546
http://code.msdn.microsoft.com/CSTaskScheduler-2f70d723

Monday, May 19, 2014

Fragment tutorial

youtube tutorial

https://www.youtube.com/watch?v=vk7VKUFOlbY&amp;index=3&amp;list=PLonJJ3BVjZW4lMlpHgL7UNQSGMERcDzHo

Android sdk extra AVD

https://software.intel.com/en-us/android

Intel(R) Hardware Accelerated Execution Manager (HAXM)
with Intel(R) Virtualization Technology (VT) 
for faster Android* Emulation

for Android 4.0.3 and above
Level 15
Check Intel in cpu/abi
Memory options 512

Sunday, May 18, 2014

Friday, May 16, 2014

Visual Studio 2013 lost intellisense

http://stackoverflow.com/questions/13375961/visual-studio-2012-intellisense-sometimes-disappearing-broken

When the problem occurs next time follow these: start from #1 and Move to next when the earlier one doesn't work for you
1: Close all the tabs and open your file again. (Thanks to russds)
2: Clean the Build > Close the Solution > Restart Visual Studio > Open the Solution again
3: Goto: Edit > IntelliSense > Refresh Local Cache
4: Close Visual Studio 2012 and delete this folder: %AppData%\Microsoft\VisualStudio\11.0\ReflectedSchemas
5: Goto: TOOLS > Import and Export Settings > Reset all settings

Wednesday, May 14, 2014

Remote Desktop Connection Manager

Save password and server info,so no need to key in ID & PW every time.

http://www.microsoft.com/en-us/download/confirmation.aspx?id=21101

Tuesday, May 13, 2014

Inconsistent Accessibility: Parameter type is less accessible than method

basically missing "public" in class declaration for some classes

http://stackoverflow.com/questions/6229504/inconsistent-accessibility-parameter-type-is-less-accessible-than-method

Monday, May 12, 2014

C# settings - Specialized string collection to list


List<string> Servicelist = Properties.Settings.Default.ServiceList.Cast<string>().ToList();

http://stackoverflow.com/questions/844412/convert-stringcollection-to-liststring

Saturday, May 10, 2014

servicestack mvc4

https://github.com/ServiceStack/ServiceStack/wiki/Run-servicestack-side-by-side-with-another-web-framework

http://stackoverflow.com/questions/22016374/could-not-load-type-servicestack-servicehost-iservice-when-starting-servicesta


Could not load type 'ServiceStack.ServiceHost.IService'

I get the above error when calling Init() on my AppHost.

Checked the DLL and found that all versions are not consistent, so I followed the suggestions in the above link.
  1. Remove all the references from your project.
  2. Remove the packages.config.(only lines with servicestack)
  3. Check the project target is .NET 4.5.
  4. Clean the project.
  5. Then re-run the NuGet command.
And fixed it.


Github and Visual Studio

http://msdn.microsoft.com/en-us/library/hh850445.aspx

Make sure you choose below in the Tools, options, then when you add solutions to source control, you will have choice of Git

Friday, May 9, 2014

Thursday, May 8, 2014

Monday, May 5, 2014

invoke or begininvoke cannot be called on a control until the window handle has been created c# splash screen issue using Microsoft.VisualBasic.dll

One app has this issue when first started

Searched around and found Microsoft rejected to fix this issue:

https://connect.microsoft.com/VisualStudio/feedback/details/769497/hidesplashscreen-causing-invalidoperationexception

One guy posted his work around:

Posted by Tony Tullemans on 1/15/2014 at 2:20 PM
I have had this InvalidOperationException problem for many years in a very large app that I have written but it does not occur very often - probably 1 out of every 300 launches. As ugly as it might appear, this is what I have done to overcome it and it seems to be working. Add this method to your main form.

Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
    Try
     MyBase.OnLoad(e)
    Catch ex As Exception
     If ex.StackTrace.Contains("HideSplashScreen") Then
        ' Just continue on as the HideSplashScreen call is made after the Form.Load() event is completed - i.e. just ignore it.
     Else
        ' Report the error however you would like.
     End If
    End Try
End Sub

The detail below:
You add reference Microsoft.Visualbasic.dll  to the app, so you can use splash screen

The sequence is before the main form load, the splash screen loads, then mainform loads, but splash during closing caused error. below is a log of sequence of events:

2014-05-07 11:22:29:925 - XYZ.OnCreateSplashScreen ~~~ Entering ~~~
2014-05-07 11:22:30:895 - XYZ.OnCreateSplashScreen ~~~ Exiting ~~~
2014-05-07 11:22:31:037 - XYZ.OnCreateMainForm ~~~ Entering ~~~
2014-05-07 11:22:38:369 - MyMainform..ctor ~~~ Exiting ~~~
2014-05-07 11:22:38:370 - XYZ.OnCreateMainForm ~~~ Exiting ~~~
2014-05-07 11:22:38:386 - MyMainform.OnLoad ~~~ Entering ~~~
2014-05-07 11:22:38:387 - MyMainform.MyMainform_Load ~~~ Entering ~~~
2014-05-07 11:22:38:417 - MyMainform.MyMainform_Activated ~~~ Entering ~~~
2014-05-07 11:22:38:418 - MyMainform.MyMainform_Activated ~~~ Exiting ~~~
2014-05-07 11:22:38:418 - MyMainform.MyMainform_Load ~~~ Exiting ~~~
2014-05-07 11:22:38:670 - OnLoad - this is a hide splash screen error
2014-05-07 11:22:39:041 - MyMainform.OnLoad ~~~ Exiting ~~~


Progam.cs
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Diagnostics;

namespace XYZ
{
    /// <summary>
    /// The Main entry point into the XYZ application
    /// </summary>
    static class Program
    {
        [DllImport("User32.dll", EntryPoint = "ShowWindowAsync")]
        private static extern int ShowWindowAsync(IntPtr hWnd, int swCommand);

        private const int SW_SHOWNORMAL = 1;
        private const int SW_SHOWMINIMIZED = 2;
        private const int SW_RESTORE = 9;

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main(string[] args)
        {
            try
            {
                Process[] RunningProcesses = Process.GetProcessesByName("XYZ");

                if (RunningProcesses.Length > 1)
                {
                    MessageBox.Show("An instance of this application is already open.", "XYZ", MessageBoxButtons.OK);
                    ShowWindowAsync(RunningProcesses[0].MainWindowHandle, SW_SHOWMINIMIZED);
                    ShowWindowAsync(RunningProcesses[0].MainWindowHandle, SW_RESTORE);
                    Application.Exit();
                }
                else
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    new XYZ().Run(args); //this is run class to create splash screen and main form
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error happenend on main " + ex.Message);
                
            }

       
        }
    }
}

XYZ.cs
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.VisualBasic.ApplicationServices;
using Wendys.Shared.BreakfastIndicator;
using Wendys.Shared;
using System.Windows.Forms;
using System.Reflection;

namespace XYZ
{
    /// <summary>
    /// The Main MIS class that handles UI event synchronization.
    /// </summary>
    public class XYZ : WindowsFormsApplicationBase
    {

        public xyz()
        {
        }

        #region Protected Methods
        /// <summary>
        /// Displays the Splash Screen
        /// </summary>
        protected override void OnCreateSplashScreen()
        {
            this.SplashScreen = new FrmSplash();
        }

        /// <summary>
        /// Initializes and calls the main form.
        /// </summary>
        protected override void OnCreateMainForm()
        {
            try
            {
                this.MainForm = new Yourmainform();
            }
            catch (Exception ex)
            {
                if (m_Log != null)
                {
                    m_Log.LogException("OnCreateMainForm", ex);
                }

                MessageBox.Show(String.Format("Error: {0}, please contact the Help Desk", ex.Message), "xxx", MessageBoxButtons.OK);
            }
          }
        #endregion
        }
    }


using System;
using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
using Wendys.Shared;
using Wendys.Shared.BreakfastIndicator;
using Wendys.Backoffice.StoreHours;

namespace XYZ
{
    public partial class MyMainForm : Form
    {

        protected override void OnLoad(System.EventArgs e)
        {
            string sMeth = MethodBase.GetCurrentMethod().Name;

            try
            {
                 base.OnLoad(e);
            }
            catch (Exception ex)
            {
                if (ex.StackTrace.Contains("HideSplashScreen"))
                {
                    // Just continue on as the HideSplashScreen call is made after the Form.Load() event is completed - i.e. just ignore it.
                    Log("OnLoad - this is a hide splash screen error")  //this log is my log routine
                }
                else
                {
                    // Report the error however you would like.

                }
            }
            finally
            {
                m_Log.ExitWithClassName(m_sClassName, sMeth);
            }
        }
   

        public MyMainForm() //Constructors
        {
            try
            {
            
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }
        }

        private void MyMainForm_Load(object sender, EventArgs e)
        {
                 this.Activate(); 
        }
        
        private void MyMainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
        }
        #endregion

        private void MyMainForm_Shown(object sender, EventArgs e)
        {
        }

        private void MyMainForm_Activated(object sender, EventArgs e)
        {
         
        }
     }
}