Friday, August 12, 2016

Windows IOT - Blink Dual Diode

After checking out the blinky app with Windows IOT on Raspberry Pi3.

so lets make a simple dual blinky app.

Extended hardware needed from the original Blinky is another diode and resistance or dual diode.

In my simple setup I used the dual diode that came with the È37 sensor kit from SunFlowerÈ.

Connection configuration as below:

Dual Diode
-GRD-              -------------- Connected to Ground through one resistance (220 ohm)
  -G-                  -------------- Connected to Pin 5
  -R-                   -------------- Connected to Pin 6

Application as follow:
the main console class have the following private members
        private GpioPin pin5;
        private GpioPin pin6;
        private DispatcherTimer timer;

  public MainPage()
        {
            InitializeComponent();
            timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromMilliseconds(500);
            timer.Tick += Timer_Tick;
            InitGPIO();
            if (pin5 != null)
            {
                timer.Start();
            }      
        } 

 private void InitGPIO()
        {
            var gpio = GpioController.GetDefault();
            // Show an error if there is no GPIO controller
            if (gpio == null)
            {
                pin5 = null;
                pin6 = null;
                GpioStatus.Text = "There is no GPIO controller on this device.";
                return;
            }
            pin5 = gpio.OpenPin(5);
            pin6 = gpio.OpenPin(6);
            pin5.SetDriveMode(GpioPinDriveMode.Output);
            pin6.SetDriveMode(GpioPinDriveMode.Output);
            GpioStatus.Text = "GPIO pin initialized correctly.";
        } 


        private int index = 0;
        private void Timer_Tick(object sender, object e)
        {
            index++;
            if (index > 3) index = 0;
            switch (index)
            {
                case 0:
                    pin5.Write(GpioPinValue.Low);
                    pin6.Write(GpioPinValue.Low);
                    break;
                case 1:
                    pin5.Write(GpioPinValue.High);
                    pin6.Write(GpioPinValue.Low);
                    break;
                case 2:
                    pin5.Write(GpioPinValue.High);
                    pin6.Write(GpioPinValue.High);
                    break;
                case 3:
                    pin5.Write(GpioPinValue.Low);
                    pin6.Write(GpioPinValue.High);
                    break;
            }
        }
the result as below:-


Wednesday, February 24, 2016

Microsoft Dynamic CRM

From a Microsoft introduction video about Microsoft dynamics CRM that summarized the main features as below:-


CRM Main Functions
==============
Supporting Sales, Marketing & Services

Sales Functions
==============
-Leads
-Opportunities
-Communication tracking
-Product Database
-Sales Processes

Client Cares Functions
==============
-Case Recording
-Contract MAnagement
-Services & Resources Management
-Appointment Scheduling
-Knowledge base

Marketing Functions
==============
-Planning & Budgeting
-Marketing Lists
-Compaigns
-Tracking and reporting

Some of the main process to simplify the work are as below:-

Sales Process
==============
  1. Create Lead
  2. Qualify
  3. Convert to Opportunity
  4. Create Quote
  5. Create Order
  6. Create Invoice
Marketing process:-
======================
  1. Planning & Budgeting
  2. Creating and managing lists
  3. planning and creating campaigns
  4. Launching and Managing Campaigns
  5. Tracking and Reporting
Will try to summarize Dynamic AX,NAV,GL & SL later




Monday, June 22, 2015

Running RDLC reports on Azure

After configuring and uploading the web app and its db, the ASPNET MVC worked perfectly until I tested the reports.
Started to check for answers and found a solution.

Errors that you may face, as below:-

  1. Could not load file or assembly 'Microsoft.ReportViewer.WebForms, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
     
  2. Could not load file or assembly 'Microsoft.ReportViewer.Common, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified. 
  3.  Could not find file 'D:\home\site\wwwroot\Views\Reports\ItemLabels.rdlc'. 
  4.  Could not load file or assembly 'Microsoft.ReportViewer.ProcessingObjectModel, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified. 


 So the errors 1,2 & 4 were clearly missing references and 3 was missing the rdlc file.
check on google and from this link on stackoverflow. I started adding one reference at a time.
so the solution was first to add new reference to the MVC web project and find the dlls from the GAC folder in "C:\Windows\assembly\GAC_MSIL\", each assemply have its own folder having different verstions, as I was using version 12, I selected that version for the below assemblies:-

  • Microsoft.ReportViewer.Common.dll
  • Microsoft.ReportViewer.ProcessingObjectModel.dll
  • Microsoft.ReportViewer.WebForms.dll (was already added)
  • Microsoft.ReportViewer.DataVisualization.dll

Steps: after selecting add referece, click on browse, and enter the path "C:\Windows\assembly\GAC_MSIL\", select each of the above folder and select the correct dll version for your application


On my local machine I had version 10,11 &12, 

Inside the version 12 folder there was one dll only, so I selected it.


And it appeared in the references as any dll 




All the the above need to have there property copy to local set to true.

And beware that the size of the dlls may go up to 10mb.


upload the RDLC file as I was still debugging.

The RDLC reports worked fine




Sunday, June 14, 2015

Azure SEO

We got accepted in the BizSpark program and the first thing I had in my head was to compare the performance of our web site with a version on the cloud, even though our landing page is pure html, a bit of java and optimized images, this was the result I got from GT Metrix,


so you can see from the above, that I already optimized the site to 98% on the normal hosting that we had (http://CanadianInfoTech.com).
And when we moved the html files directly to the cloud and checked it, we got the below:-



so we have one point that is making a big issue and its "The following cacheable resources have a short freshness lifetime. Specify an expiration at least one week in the future for the following resources:-"

so before fixing it, I wanted to move the main css & js to a CDN, checked some torurials and appeared now its a peace of cake, by doing the following:-

open your azure portal,

  1. select CDN, click the plus, select quick create.
  2. Select Otigin Type: Web App
  3. Select Original URL your target web site.



Be aware that there are a lot of tutorial that will tell you go and create storage, a container blob, set security, add your files, etc, that was the old method and had a lot of headache when you needed to update you files. dont use it anymore. a great video about this can be found here.

One issue here, you can't test it directly, so if you want to go for lunch,play a game or take a break this will be a good time for it, as it will take a bit of time till the new CDN end point will start working.

So we are back, the next day, checked the end point and the site opened from it, but I did not yet update the resources to read from the end point.

So I changed all the file references to the endpoint, for example :-
 laptop
to
laptop

References: if you still have a problem, this blog post was really helpful to me, here

before doing so, I needed to make a new copy of my web site, so I have a special version for the cloud.

If my the landing page was MVC ASP.NET I prefare to make html helper or another way to let all the resources work with the cdn, but for my company main page it was simple html.

So I started to replace the paths for the images, css and the js, here VS replace tool was handy.

For the stander JQuery and other well known plugins, I preferred to leave them on there cdn domains, to utilize caching from other web sites.

Used the Azure publishing and starting testing again. I'm expecting a small enhancement as we did not fix the main issue yet. And as expected 93%, the same results, but the paths for all the resource are coming from the CDN end point, great.

This link was really helpful, added the following to the web config:-




  
    
  
   
      
         
         
         
      
   

and the performance returned to normal, In php hosting it did not start 98%, but I updated the .htaccess file, so in IIS, the web config can do the trick.

even though that the last step was the key to enhance the performance, moving to the CDN was important.


And if you check the details this is basic comparison:-
# Item PHP Hosting Azure Hosting
1 Page Load time 1.52s 1.32s
2 Page size 490Kb 490Kb
3 Number of request 28 28
4 Page Speed Grade 98%98%
5 Y Slow Grade 86% 96%




So we see a small gain of 0.20 sec. Moving that 98% higher will not be an easy task, and if I have time I will try my best to find the main issues causing them and the best fixes.

I wanted to note that on the google developer insights I did not find a real difference between the two.
it was 89% for the desktop and 71% for the Mobil, we need to tackle these number later too.




Thursday, June 11, 2015

Programming Mobile Services for Android Handheld Systems: Concurrency

Completed another online certificate, this one was much more interesting talking more about patterns and services and near the end of the 4th course (total of 6 courses)

Shared link:
https://www.coursera.org/account/accomplishments/certificate/5ZNYR8W4YR




Tuesday, March 24, 2015

Great Online Courses

As I'm referring these site a lot to friends and colleges,  I decided to add them to the blog and share it.

So Im listing them below with thier links and slogans, I have experience with all of them and I can say it made learning more easier &  more joyful.

Coursera
Take the world's best courses, online, for free.
https://www.coursera.org

Novoed
NovoEd delivers effective and engaging online courses with our social learning platform.

Rethink your world - experience the best courses wherever, whenever you want.


Update me if  you think I need to add more :)

Saturday, January 24, 2015

SQL Linked Server connation to Informix database


Setting up connection to Informix Database through SQL Management Studio was not so easy anyhow with a bit of work and research it could be accomplished.

Im using MS SQL 2014 stander edition, with Informix database. The system localz need to be set too as it depend on the Informix setting, in my case Informix was hosted on Linux (Red Hat 6 Server) with Arabic language.

First: Informix SDK and locals
First we need to install the Informix sdk on the machine that is running SQL Management Studio . In my case I downloaded the latest 64bit from IBM web site (clientsdk.4.10.FC4DE.WIN) and installed it.
And then as I need the correct locals (Arabic Language) I installed the “Informix International Language Supplement” in my case it was “Informix International Language Supplement 3.30.MC2_C511MML” and selected Arabic “ar_AE.1256”

Even though it did not find the Informix directory I only needed to provide the path (“C:\Program Files\IBM Informix Client SDK”) and everything went fine.

If you are here you can configure the odbc driver and test that all setting in your host are correctly buy testing the ODBC 64bit setting.

Secondly:
I run the following in command prompt

            regsvr32 ifxoledbc


And to to prepare the Informix server to work with OLEDB we need to run a script on the master database of the server itself.
The script file can be found in the directory for the Informix SDK that we installed in the first step, we need to copy it to the Linux server hosting the Informix database and run it by using the dbaccess command as below:
                      dbaccess sysmaster coledbp.sql

Finally: inked Server Setting on SQL Management Studio
Before starting the linked server you need to change a bit of the driver setting by expanding the provider node and right clicking on the ifxoledbc and selecting properties.

We need to check the Dynamic parameter (The first name) and allow inprocess as below:



Starting the linked server setting, I opened Microsoft SQL Management studio, when to Server objects and then linked servers and right clicked and selected new linked server.
Added the following setting
General Tab
Linked Server:                   AnyNameYouLike  (for me I used INFORMIX_DB)
Provider:                             IBM Informix OLEDB Provider
DProduct Name:              ifxoledbc
DataSource:                       DatabaseName@ServerNAme
Provider String:                                 DB_LOCALE=ar_AE.1256;CLIENT_LOCALE=ar_AE.1256


Security Tab:
Be Made using This Security context:
Remote login:                    your login to the Informix database
With password:                your password to the Informix database


Server Options Tab
Change the RPC and RPC OUT to true


Note: If you don’t have special language setting you can leave the provider string empty.

Thats it, you start writing your T-sql and if everthing whent write you will start seeing your data

SELECT * FROM [INFORMIX_DB].[databaseName].[informix].[TableName]

Reference:
I got a lot of help from these articles:



Monday, December 03, 2012

MVC Cascaded Drop Down List


MVC have helpers for dropdownlist and they work great, and you can build the template for them too.
But for cascaded drop downlist its different because I think, there is a lot of ways to implement it.
So I will try to build cascade dropdownlist template that can be used more than once in a form with an AutoPostBack ability too.

First of all we need model for the dropdownlist and a model for Cascade dropdownlist as below:

   1:      public class DropDownListViewModel
   2:      {
   3:          public string Value { get; set; }
   4:          public bool AutoPostBack { get; set; }
   5:          public IEnumerable<SelectListItem> Items { get; set; }
   6:      }
So value is for the selected value for the drop dow, autopostback is a flag to indicate autopostback to the form.

And for the cascaddropdown model as below:

   1:    public class CascadDropDownListViewModel
   2:      {
   3:          public string Value { get; set; }
   4:          public bool AutoPostBack { get; set; }
   5:          public string ParentDropDownName { get; set; }
   6:          public string Action { get; set; }
   7:          public IEnumerable Items { get; set; }
   8:      }
The parentdropdownname, is the name of the parent control so that it can update when it changes, the action property is the name of the action used to fill the cascade dropdownlist, it will be a json action
Lets add two editor templates that will work with these models
For dropdownlist

   1:  @if (Model.AutoPostBack)
   2:  {
   3:      @Html.DropDownList("Value",Model.Items, new { onchange="this.form.submit();" })
   4:  }
   5:  else
   6:  {
   7:      @Html.DropDownList("Value",Model.Items)
   8:  }
For the cascade dropdownlist

   1:  @model WebAdvEx.Portal.Models.CascadDropDownListViewModel
   2:   
   3:  @if (Model.AutoPostBack)
   4:  {
   5:      @Html.DropDownList("Value",Model.Items, new { action=Model.Action, cascad="yes", parent=Model.ParentDropDownName+"_Value" ,onchange="this.form.submit();" })
   6:  }
   7:  else
   8:  {
   9:      @Html.DropDownList("Value", Model.Items, new { action=Model.Action, cascad="yes", parent=Model.ParentDropDownName+"_Value" })
  10:  }
We need some Javascript to let the controls be alive,

   1:  <script type="text/javascript">
   2:          $(document).ready(function () {
   3:              $('select[cascad=yes]').each(function () {
   4:                  var action = $(this).attr('action');
   5:                  var drop = $(this);
   6:                  var parent = '#' + $(this).attr('parent');
   7:   
   8:                  $(parent).change(function () {
   9:                          $.getJSON(action, { id: $(parent).val() },
  10:                              function (items) {
  11:                               
  12:                                  drop.empty();
  13:                                  $.each(items, function (index, item) {
  14:                                      drop.append($('<option/>', { value: item.Value, text: item.Text }));
  15:                                  });
  16:                              });
  17:                  });
  18:              });
  19:          });
  20:  </script>
So in summary, looking for any cascade, getting the parent for the control, assigning a new change event, calling the action to get the data in Jason and update the cascade control
A sample of the control code and the controller view
In my controller I have a model with dropdownlist and cascade dropdownlist and im filling them as below:

   1:    model.Country = new DropDownListViewModel() { 
   2:                  Value = model.CountryId.ToString(), 
   3:                  Items = model.GetCountryList(),
   4:               AutoPostBack=false};
   5:   
   6:              model.City = new CascadDropDownListViewModel()
   7:              {
   8:                  Value = model.CityId.ToString(),
   9:                  Items = model.GetCityList(model.CountryId),
  10:                  AutoPostBack=false,
  11:                  ParentDropDownName="Country",
  12:                  Action = Url.Action("UpdateChildList")
  13:   
  14:              };
  15:   
  16:              return View(model);

the function used to fill the cascade after the parent is changed is as below:

   1:   public JsonResult UpdateChildList(int id)
   2:          {
   3:              var indexViewModel = new IndexViewModel();
   4:              return Json(indexViewModel.GetCityList(id),JsonRequestBehavior.AllowGet);
   5:          }
Im using sample data, so indexviewmodel is only a temp thing for testing and bloging, normally we build in the correct location, the idea is to return some sample data as below:

   1:   public IEnumerable<SelectListItem> GetCityList(int CountryId)
   2:          {
   3:              var result = new List<SelectListItem>();
   4:              switch (CountryId)
   5:              {
   6:                  case 1:
   7:                      result.Add(new SelectListItem() { Value = "1", Text = "Abu Dhabi" });
   8:                      result.Add(new SelectListItem() { Value = "2", Text = "Dubai" });
   9:                      result.Add(new SelectListItem() { Value = "3", Text = "Sharja" });
  10:                      break;
  11:                  case 2:
  12:                      result.Add(new SelectListItem() { Value = "4", Text = "USA City 1" });
  13:                      result.Add(new SelectListItem() { Value = "5", Text = "USA City 2" });
  14:                      result.Add(new SelectListItem() { Value = "6", Text = "USA City 3" });
  15:                      break;
  16:                  default:
  17:                      result.Add(new SelectListItem() { Value = "7", Text = "Germany City 1" });
  18:                      result.Add(new SelectListItem() { Value = "8", Text = "Germany City 2" });
  19:                      result.Add(new SelectListItem() { Value = "9", Text = "Germany City 3" });
  20:                      break;
  21:              }
  22:   
  23:   
  24:              return result;
  25:          }

Mission done, cascade dropdownlist are linked and working fine. 

Saturday, October 06, 2012

Visual Studio 2012 Launch - Abu Dhabi


Visual Studio 2012 Launch - Abu Dhabi

Microsoft

Sunday, October 7, 2012 from 9:30 AM to 3:00 PM (GST)

Abu Dhabi, United Arab Emirates



Visual Studio 2012 Launch with Celebrity Speakers: David Chappell and Orville McDonald 
Organizations that are able to move forward with velocity on realizing value opportunities through such modernization investments as Application Lifecycle Management (ALM) stand to attain a competitive advantage in the industries they serve. Organizations that are first to realize such opportunities stand to establish ground as domain leaders. We are excited to announce the newVisual Studio 2012 at a launch event with David Chappell, Chappell & Associates, world renowned Technologist and Orville McDonald, Director Product Management, Visual Studio, Microsoft Corporate.

Agenda:
09:30-10:00   Coffee & Networking
10:00-10:50   Keynote: Evolve; Rediscover Relevancy - Orville McDonald, Director Product Management, Microsoft
10:50-12:00   Application Lifecycle Management for IT Leaders - David Chappell, Technologist
12:00-13:00   Lunch
13:00-14:00   Friction-Free Collaboration for Development and Operations
14:00-14:15   Coffee Break
14:15-15:00   Continuous Quality Enablement


Tuesday, September 11, 2012

Booting from Win8 VHD with your Win7


To set up Windows 8 as Virtual Machine and boot from it, without effecting your Win7, you can use the following:-
download the needed files from: http://github.com/naeemkhedarun/CreateWindows8VHD
You can use the steps there but I have small changes to let it work with my Win7

·         Run PowerShell
·         Go to the folder with the scripts “C:\projects\CreateWindows8VHD “ by executing:   
C:
Cd C:\projects\CreateWindows8VHD>

·         Import the function “Create-Windows8VHD.ps1 “ by executing:
set-executionpolicy unrestricted
Import-Module .\Create-Windows8VHD.ps1

·         Create the VHD noting the parameters with the following:
Create-Windows8VHD "[VHD file location and name]" "[Size in MB]" "[Drive Letter]", example:
Create-Windows8VHD "D:\vhd\windows8.vhd" "10000" "X"

·         Following this to set up a dual boot record you can do:
C:\Windows\sysnative\bcdboot [Drive Letter]:\Windows
C:\Windows\System32\bcdboot X:\Windows

·         You should now be able to restart into the Windows 8 Preview!, restart your computer and you will get a windows start up page, then select your windows 7 or windows 8

Sunday, August 12, 2012

Welcome to the Windows Store

Finally I completed my registration for Microsoft Windows Store, and I can start submitting applications there. My Kids Metro Studio App will need some final tuning before submitting it, but its know a matter of some days and for me some time managements planning.

The steps to complete the Microsoft Windows Store registration process were as follow:
1. Complete one windows 8 boot camp (did this in Dubai - UAE)
This is an event that Microsoft is doing around the globe and its a great chance to learn stuff and meet people interested in Windows 8 development

2. Register and attend one Windows 8 App Quality Lab
This is a very useful session that you will show your application to Metro Style Developer from Microsoft and they will support, asset and direct you on the right track to complete your app.

3. Register your app http://win8.msregistration.com here and full the survey, and I believe if they see and feel your app is ready or can be ready for the store they will provide you with a token, you can find it after few days on the Application Excellence Survey Results, at the bottom of the page.

For more details on the exact location
go to http://win8.msregistration.com and login

From the Default.aspx page, Go to App Profiles
You will find your app that you added with the survey link (click this link) from the Microsoft developer, Below the survey you will find the token key with the following
[Your name] has a Token, granted by [Microsoft Develoepr]. Token: [Your Tokken]

Note: The Token is the Registration Code

4. Go to the windows store web site and login, start filling the forms for the registration for the windows store account, when you come by the Registration Code, enter your Tokken, complete the payment (its currently free )

5. That's it, you will receive a welcome letter from the store, and you can start uploading your win 8 apps.


Sunday, August 05, 2012

A day at the office

A day at the office full of development and fun. Sometimes quite and productive



Sometimes tutoring


 Sometimes learning

Sometimes crashed and crazy

But always ending with fun and understanding

days that can't be forgotten.

Thanks Ali Nawas for the great photos
more can be accessed here 





Windows 8 Developer Boot Camp - 2 days


Windows 8 Developer Boot Camp is set to be on 2nd & 3rd Sept. 2012 at Dubai, covering Windows 8, Windows Azure and Visual Studio 2012

The Agenda for the 2 days is as below
Agenda:
Day-1


Subject
09:30
-
10:30
Morning Coffee & Networking
10:30
-
11:30
Introduction and Keynote
11:30
-
12:30
Traits of Great Metro Style Applications
12:30
-
13:30
Lunch Break
13:30
-
14:30
Platform for Metro Style Applications
14:30
-
15:30
Tools for Building Metro Style Applications
15:30
-
16:00
Coffee Break
16:00
-
17:00
Windows 8 and Windows Azure
17:00
-
17:30
Day 1 Wrap Up



Agenda:
Day-2*


Subject
09:30
-
09:45
Morning Coffee & Networking
09:45
-
10:00
Day 2 introduction
10:00
-
11:00
All About Visual Studio 2012 and Launch
11:00
-
12:30
App Lab
12:30
-
13:30
Lunch Break
13:30
-
17:45
App Lab
17:45
-
18:00
Day 2 Wrap Up
*For Day 2, you need your PC with Windows 8 Release Preview & Visual Studio 2012

When:
2nd Sept. 2012 09:30-17:30 
3rd Sept. 2012 09:30-18:00

Where:
Al Saker Ballroom, 
Le Royal Méridian Hotel, 
Jumeirah Beach Residence


View Larger Map