1Gig-Tech (#8) – Azure, EntityFramework, Edge, XPlat

August 30, 2015 1Gig Tech No comments , ,

Welcome to 1Gig Tech update!

In today’s edition, there are 6 articles on technology, news, open source, community on the fantastic and ever evolving technology world.

  • Entity Framework Loading Related Entities
    Entity Framework supports three ways to load related data – eager loading, lazy loading and explicit loading. The techniques shown in this topic apply equally to models created with Code First and the EF Designer.
  • Pure Native C++ consuming .NET classes without COM registration
    One of the problems that many C++ native developers face when interacting with .NET is the inability to load a .NET COM Dll and use the COM classes without registering the DLL. I faced this problem when adapting the debugging NetExt from pure C++ to pure C++/.NET.

You can also follow these updates on Facebook Page or can also read previous editions at 1Gig Tech

Thanks

Scheduling Background Tasks in ASP.NET using Quartz.NET

August 27, 2015 ASP.NET, ASP.NET vNext, Visual Studio No comments , ,

 

Ever wondered how we can have critical tasks (not just sending out newsletters, tweeting, etc.) scheduled as background tasks our an ASP.NET website? This post outlines a quick way to use an open-source tooling to schedule background tasks in not more than 3 steps.

For scheduling background tasks, I recommend using one of the two open-source libraries – Quartz or Hangfire.

If we don’t need any monitoring, are a fan of zero/minimal configuration, don’t have any database or cache, etc. we can choose Quartz otherwise we can use Hangfire. In this post, we will use Quartz as a scheduling framework. To start with, we need to add reference of the NuGet package ‘Quartz’ to our Web Application by typing following command in Package Manager Console (or we can also use the UI in Visual Studio)

Install-Package Quartz

Now, there are 3 steps to adding a background tasks

 

Defining a Job

The beauty about Quartz is that it allows us to define the job in a separate class which ensures right abstraction and encapsulation. So let’s define a MaintenanceJob that inherits the interface IJob which has one member Execute. The method defines the action to be performed when the scheduled job is triggered

using Quartz;
namespace Tasks
{
    public class MaintenanceJob : IJob
    {
       public void Execute(IJobExecutionContext context)
       {
            var ftpLocation = context.JobDetail.JobDataMap.Get("ftp.location");
            // zip old log files
            // delete the files once zip is completed
            // sftp the zip to another location
        }
    }
}

Here, the IJobExecutionContext provides us the context of the job like – JobRunTime, PreviousFireTimeUtc, NextFireTimeUtc, Trigger, JobDetail, etc. JobDetail can be set from Trigger or Scheduler as additional data passed to the scheduled jobs.

Defining a Job Trigger

 

Trigger defines when a Job should be executed. There are different types of triggers – Time based, CRON, Calendar, Schedule, etc.

We want to run this MaintenanceJob once daily (at interval of 24 hours) at midnight. So our trigger definition will look like,

        public static ITrigger TimeTrigger()
        {
            return TriggerBuilder.Create()
               .WithDailyTimeIntervalSchedule
                 (s =>
                    s.WithIntervalInHours(24)
                   .OnEveryDay()
                   .StartingDailyAt(TimeOfDay.HourAndMinuteOfDay(0, 0))
                 )
               .Build();
        }

 

When we use Time Interval Schedule, we have many options to schedule this job on weekdays OnMondayThroughFriday or on weekends OnSaturdayAndSunday, every minute/second, etc. If we were to define the trigger using CRON expressions, our trigger will look like,

        public static ITrigger CRONTrigger()
        {
            return TriggerBuilder.Create()
               .WithCronSchedule("0 57 23 ? * *", s=> s.WithMisfireHandlingInstructionDoNothing())
               .Build();
        }

When we use CRON based trigger, we can use CRON expressions to define interval and can also actions to handle failures, etc.  The above expression will run the job every day at 23:57 (server time)

 

Defining a Job Schedule

A scheduler acts as an entry point and definition for all Quartz jobs. So we need to derive a correlation between the job we created and the trigger we defined. This scheduler should be called in the Application Start of our ASP.NET website (Webforms or MVC). Now we can either write the below code directly in Application_Start method in Global.asax or we can structure it in a new class called JobScheduler

    public class JobScheduler
    {
        public static void Start()
        {
            IScheduler scheduler = StdSchedulerFactory.GetDefaultScheduler();
            scheduler.Start();

            IJobDetail job = JobBuilder.Create<MaintenanceJob>().Build();
            job.JobDataMap.Add("ftp.location", "ftp://SomeFileLocation");
            scheduler.ScheduleJob(job, Triggers.TimeTrigger());
        }
    }

In the above code, we are using a scheduler, defining (not creating an object) MaintenanceJob using JobBuilder and associating MaintenanceJob with the TimeTrigger trigger. Next, we need to have this JobScheduler.Start method called when the application starts (i.e. at every IIS reset)

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            JobScheduler.Start();
        }

 

If we need to run tasks on a schedule as part of our ASP.NET application with reliable accuracy and without multiple Batch Scripts or PowerShell scripts running as Scheduled Tasks, choose Quartz. The code is also available as Gist on GitHub

1Gig-Tech (#7) – ASP.NET, CloudFoundry, CSS, VSO

August 23, 2015 1Gig Tech No comments , , ,

Welcome to 1Gig Tech update!

In today’s edition, there are 8 articles on technology, news, open source, community on the fantastic and ever evolving technology world.

  • Cloud Foundry on Azure (RicksterCDN)
    Ning Kuang, Sr. PM on the Azure compute team chats with Rick about the latest release of Cloud Foundry on Microsoft Azure. With this new release, a single Azure ARM template has been updated based on community feedback to deploy multiple VMs to serve as your Cloud Foundry environment.
  • Visual Studio On-Demand Videos “The Big List” (Dmitry Lyalin)
    One of my jobs as a Product Manager for Visual Studio is to enable product team Program Managers and developers to create videos of their new product features, and we’ve been very successful in creating hundreds of these on-demand videos over on Channel 9.

You can also follow these updates on Facebook Page or can also read previous editions at 1Gig Tech

Thanks

Concerned about your privacy in Windows 10?

August 17, 2015 Windows No comments ,

Concerned about your privacy in Windows 10?

Many articles have been written that Windows 10 sends information to Microsoft servers in background. While I do not have information on what kind of information Windows 10 really sends to Microsoft servers there are enough controls in the settings to tighten the privacy settings if you are concerned about data being sent to Microsoft. However, unlike many other software, you can change these privacy settings. Here are few settings you can play with to control privacy, diagnostic information and location

Change Privacy Options

 

To view them, you just need to search for Privacy Settings in the “Search the web and Windows” box near the Start button. You can turn off all the options if you would like to.

Control Diagnostic data

 

In the same Privacy settings, you can select Feedback & diagnostics settings and define the frequency at which Windows should ask you for feedback and the device data (full, basic or enhanced) to Microsoft.

 

Change Location Settings

 

Location settings allow Windows 10 applications to retrieve your location. There are 2 levels of settings – one for location settings for all users using the laptop, second for the logged in user. I have kept Location settings ON as I use location based features like Weather, Cortana, etc.

Wi-Fi Sense

 

Wi-Fi sense is the new feature that allows sharing your Wi-Fi password with your contacts on networks you choose (like Skype, Facebook or Outlook.com). You can search for Network and Internet settings, click on Wi-Fi and navigate to “Manage Wi-Fi settings”

You can turn off the setting “Connect to networks shared by my contacts” which will also stop sharing your Wi-Fi password to your contacts (using Windows 10) when they are in the range. I do not think they will come to know your password, it’s just that Windows 10 will automatically connect them to your Wi-Fi network when they are in range (i.e. your home).

Note: If you think there are other settings that could help privacy settings, do comment in this post. I’ll include them as revisions to this post.

1Gig-Tech (#6) – IoT Core, Win10, TFS 2015, UWP, Bridge for Android, iOS

August 15, 2015 1Gig Tech No comments , , ,

Welcome to 1Gig Tech update!

In today’s edition, there are 14 articles on technology, news, open source, community on the fantastic and ever evolving technology world.

  • Microservices in C# Part 3: Queue Pool Sizing (Paul Mooney)
    This tutorial expands on the previous tutorial, focusing on the Queue Pool concept. By way of quick refresher, a Queue Pool is a feature of the Daishi.AMQP library that allows AMQP Queues to be shared among clients in a concurrent capacity, such that each Queue will have 0…1 consumers only.
  • Microsoft/TypeScript
    Skip to content HTTPS clone URL Subversion checkout URL You can clone with or . Download ZIP Loading… Something went wrong with that request. Please try again.
  • Create an ASP.NET 5 web app in Visual Studio Code (Erik Reitan)
    This tutorial shows you how to create an ASP.NET 5 web app using Visual Studio Code (VS Code) and deploy it to Azure App Service. ASP.NET 5 is a significant redesign of ASP.NET. ASP.NET 5 is a new open-source and cross-platform framework for building modern cloud-based web apps using .NET.
  • How To Install Android Apps On Windows 10 Mobile
    Recently, the official documentation of Microsoft’s project Astoria was leaked which allows Android developers to port their Android apps to Windows 10 Mobile with just some slight adjustments. Simply put, project Astoria is nothing but Microsoft’s Windows Bridge for Android.

You can also follow these updates on Facebook Page or can also read previous editions at 1Gig Tech

Thanks

1Gig-Tech (#5) – Windows10, UWP, Edge, RyuJIT

August 2, 2015 1Gig Tech No comments , , ,

Welcome to 1Gig Tech update!

Today’s edition covers mostly on Windows 10 considering the launch of Windows 10 and Visual Studio 2015 in the past weeks. There are 16 articles on technology, news, open source, community on the fantastic and ever evolving technology world.

  • Microsoft Edge review: Windows finally has a good browser (Dan Seifert)
    For two decades, the default web browsing experience in Windows has been Internet Explorer. Over the years, Microsoft’s home-built browser became bloated, insecure, confusing to use, and just plain hated by many users. A lot of people turned to alternatives, such as Google Chrome, as a result.
  • BFG Repo-Cleaner
    The BFG is a simpler, faster alternative to git-filter-branch for cleansing bad data out of your Git repository history: Removing Crazy Big Files Removing Passwords, Credentials & other Private data The git-filter-branch command is enormously powerful and can do things that the BFG can’t – but the
  • Targeting Windows 10 with your Apache Cordova app (Heath Stewart)
    This April, in concert with Windows 10 Technical Preview 2, we debuted support for the Windows 10 platform for Apache Cordova. Now, with the availability of Windows 10, full Windows 10 support is part of the Windows Apache Cordova platform and native to Visual Studio 2015.
  • The nine most important updates in Windows 10 (Dan Seifert)
    Windows 10 is officially out today. It’s the biggest update to Windows in years and represents a number of new directions for Microsoft’s premier software product. Windows 10 replaces Windows 8 and 8.1, and serves to attract those Windows 7 users that never bothered to update to Windows 8.
  • .NET Rocks!
    So what’s happened with Glimpse? Carl and Richard talk to Anthony van der Hoorn and Nik Molnar about the latest developments with their web instrumentation library Glimpse.
  • .NET Networking APIs for UWP Apps (Heath Stewart)
    This post was written by Sidharth Nabar, Program Manager on the Windows networking team. At Build 2015, we announced that .NET Core 5 is the new version of .NET for developers writing Universal Windows Platform (UWP) apps. The set of networking APIs available for developers in .
  • ECMAScript 2015 Goodies – Part 2 – const
    This is the second article in ECMAScript 2015 Goodies. In the first article, we have covered new keyword in the language – let, which allows us to define a true block level variable in the program. In this short article, we will cover another new keyword – const.
  • RyuJIT Bug Advisory in the .NET Framework 4.6 (Heath Stewart)
    A code generation (AKA “codegen”) issue in RyuJIT in the .NET Framework 4.6 has been discovered that affects a calling pattern called Tail Call Optimization. The RyuJIT team has fixed the issue and has started the process of producing a .NET Framework 4.
  • Getting Started with Windows 10 (Scott Hanselman)
    I’ve been making Windows 10 videos at night to help out friends and family, and because it’s fun. Windows 10 comes out July 29th, and it takes what was familiar about Windows 7 and what was great about Windows 8 and takes it forward.
  • Visual Studio Tools for Unity 2.0 (Heath Stewart)
    Last week we announced the release of the Visual Studio Tools for Unity 2.0. VSTU is Microsoft’s free Visual Studio add-on that enables a rich programming and debugging experience for working with the Unity gaming tools and platform. For VSTU 2.

You can also follow these updates on Facebook Page or can also read previous editions at 1Gig Tech

Thanks

Facebook Open Graph API META Tags

August 1, 2015 Non-Microsoft, Web Development No comments ,

When I was designing Singapore Azure Bootcamp website, I was extremely happy to use HTML5 and CSS3 and the website looked fantastic. But when I shared the website link on Facebook to get more traffic, the Facebook post randomly took one of the pictures I had posted on the website, a description and displayed it. Well of course, that’s not what I wanted. I recently found another tech-event website (masked the event names in the image below) with similar issue so I thought to pen down my learnings on Facebook Open Graph API that provides solution to this problem

Facebook’s Open Graph protocol allows for web developers to turn their websites into Facebook “graph” objects that allows us a certain level of customization over how information will be carried over from a non-Facebook website to Facebook when a page is “recommended”, “liked”, or just generally shared. This information is set via the Open Graph Meta tags – tags that are prefixed with og: with the format mentioned below in the HTML head section

<meta property="og:{tagName}" content="{tagValue}"/>

 

So here are few tweaks I did to get things corrected.

4 Important Meta Tags

Setting the Site Name

The meta tag og:site_name is very handy to provide Facebook some context about your site

<meta property="og:site_name" content="Azure Bootcamp 2015 Singapore Website"/>

 

Setting the Image

I rescaled the Azure Bootcamp image to 250×250 as its best to use a square image and saved it as fb_img.png (AFAIK, we can also use JPG format) in my assets folder and added a og:image meta tag in the HTML head section. The image META tag directs Facebook to use the specified image when the page is shared

<meta property="og:image" content="http://globalazurebootcampsg.azurewebsites.net/assets/img/fb_img.png">

If we are using CDN resources, we can also mention the image path on CDN

Setting the Title (or Display Name)

The meta tag og:title is used to specify the title of the URL. Generally, it should be the page/article title.

<meta property="og:title" content="Global Azure Bootcamp Singapore - 25th April 2015">
            

In my case, it represented the Azure Bootcamp 2015 event.

Setting the Link URL

The URL should be the canonical address for the page.

<meta property="og:url" content="http://singapore.azurebootcamp.net">

For the Azure Bootcamp site, we were using Azure hosting so our original website address was http://globalazurebootcampsg.azurewebsites.net (used earlier in the image) however, we wanted everyone to be aware of the routed/public URL http://singapore.azurebootcamp.net

Testing these settings

 

Once we have added these META tags to the HTML head section of our page/website, we can check the information Facebook receives using the Facebook Lint Tool.

When we enter the URL we want to share on the Lint Tool, it uses Open Graph API to retrieve the META tags and provides us a sample of what will be visible when the URL is shared by anyone.

Leverage the Lint Tool and Facebook Open Graph API (i.e. META tags) to bring a different and attract few more visitors to your website from Facebook!

1Gig Tech (#4) – VS2015, .NET 4.6, ASP.NET, HTML5, AMQP, NCover, IoT

July 25, 2015 1Gig Tech No comments , , , , , ,

Welcome to 1Gig Tech for 25 Jul, 2015!

In today’s edition, there are 23 articles on technology, news, open source, community on the fantastic and ever evolving technology world.

  • The History of Windows Timeline (cmclellan)
    After April 8 2014, Microsoft will no longer deliver new security updates, non-security hotfixes, free or paid assisted support options and online technical content updates for Windows XP.
  • A Custom Elements-Based HTML5 UI Framework
    Onsen UI is designed and implemented to deliver unprecedented user experience for your apps. Frustrated with the lack of native-like performance? Try Onsen UI and you’ll feel the difference right away. Onsen UI is responsive.
  • AMQP protocol : the builtin type system by examples (ppatierno)
    One of the most interesting features of AMQP protocol is the built in type system that provides a way to represent the AMQP values inside a frame starting from primitive types to custom types (based on our application domain) and composite types (containing fields).
  • VexFlow
    The score below was rendered in your browser. If you’re a programmer interested in rendering music notation in your own applications, take a look at The VexFlow Tutorial.
  • Edit this webpage with your voice
    Commands you can speak Element selection Select the (element) Ex: “select the header” Ex: “select the footer” Select the largest image Select the text (text) Ex: “select the text GET INFORMATION” Ex: “select the text WITH YOUR VOICE” Select its parent Select its first child Select its last child
  • WebAssembly: a binary format for the web (Google)
    WebAssembly (short: wasm) is a new binary format for the web, created by Google, Microsoft, Mozilla and others. It will be used for performance critical code and to compile languages other than JavaScript (especially C/C++) to the web platform. It can be seen as a next step for asm.js [3].
  • Announcing .NET Framework 4.6 (Heath Stewart)
    We’re excited to announce the RTM releases of .NET Framework 4.6 and Visual Studio 2015 today. You can read about the new features or leave that for later and try them out now. The quickest way to get started is to install the free Visual Studio 2015 Community version. With the .NET Framework 4.
  • Same Day Xamarin Support for Visual Studio 2015 (Miguel de Icaza)
    Today, Microsoft is unveiling the final release of Visual Studio 2015 in a global webcast, and we are joining the celebration! Now Released to Market (RTM) for full use in production, Visual Studio 2015 includes many new features and improvements that make it easier to build apps quickly, includin
  • The anatomy of a credit card form (Gabriel Tomescu)
    Paying for something online with a credit card is simple, right? Yes and no. Yes, because we’ve been doing it since the early days of the Internet (e.g. Amazon), and no, because no two credit card forms are alike.
  • Dropdowns Should be the UI of Last Resort (Luke Wroblewski)
    All too often mobile forms make use of dropdown menus for input when simpler or more appropriate controls would work better. Here’s several alternatives to dropdowns to consider in your designs and why. No one likes filling in forms.
  • NCover 5.1 Beta Program
    When we originally released NCover 5 last year, we were excited to share a lot of great new features including Condition Coverage and even more ways to share coverage results across the organization.
  • Merging Dynamic and Static Sites (Raymond Camden)
    Over the past year or so I’ve been fascinated by static site generators. I have a long history of working with dynamic web sites, and static sites were an intriguing change of perspective for me.

You can also follow these updates on Facebook Page or can also read previous editions at 1Gig Tech

Thanks

1Gig-Tech #3 – PowerJSON, Hangfire, ExpressMapper, Rosyln, Win10

July 19, 2015 1Gig Tech No comments , , , ,

Welcome to 1Gig Tech for 19 Jul, 2015!

In today’s edition, there are 9 articles on technology, news, open source, community on the fantastic and ever evolving technology world.

  • wmjordan/PowerJSON (wmjordan)
    PowerJSON is a fork of the smallest, fastest polymorphic JSON serializer–fastJSON. Please read the article about fastJSON here.
  • Hangfire
    An easy way to perform fire-and-forget, delayed and recurring tasks inside ASP.NET applications. No Windows Service required. Backed by persistent storages. Open and free for commercial use.
  • Dartmouth-Hitchcock revolutionizes the U.S. healthcare system
    Dartmouth-Hitchcock Health System is piloting a highly coordinated, intensely personalized solution built on Microsoft technologies for machine intelligence and advanced data analytics, including the just-announced Cortana Analytics Suite. Learn more here: http://www.microsoft.com/en-us/server…
  • Leveraging Roslyn to author ASP.NET Web API without recompiling
    Some time ago I posted a mini-series of posts about using Roslyn to script Web API, and that has gotten some great response. In that original post, I mentioned & used, without going into too much details, a very useful “compiler as a service” feature Roslyn offers.

You can also follow these updates on Facebook Page or can also read previous editions at 1Gig Tech

Thanks

1Gig-Tech #2 – ASP.NET, Win10, Office 2016, Xamarin, ElasticSearch

July 11, 2015 1Gig Tech No comments , , , ,

Welcome to 1Gig Tech for 11 Jul, 2015!

In today’s edition, there are 15 articles on technology, news, open source, community on the fantastic and ever evolving technology world.

  • Deploying ASP.NET 5 application to Azure Web App with Git
    I haven’t found any official docs about publishing ASP.NET 5 applications to Azure using source control (continuous deployment), but I thought I’ll give it a try. I failed at first and I asked whether it’s even possible on Twitter: Hi @michaldudak that’s a very good question.
  • react-ui-builder
    This tool is a visual builder of React JS components for your web application. In builder you can easily combine available components with each other, and see how they look and feel right on a web page.
  • Don’t Waste Time On Cross Browser Testing
    Browsers Mobile Simulators Reporting Side By Side Find cross-browser issues in minutes Easily switch between all major desktop browsers You don’t need more than 5 minutes to test any website in all major desktop browsers. Anytime all browsers are just 1 click away.
  • Build native iOS, Android and Mac apps in C#
    Mobile development skills are in demand, and Xamarin for Students gives you an edge over the competition. With Xamarin for Students, you can build native iOS, Android, and Windows apps with Xamarin Studio and Visual Studio, for free.
  • Installing Windows 10: A pictorial walkthrough (Ng Chong Seng)
    With Windows 10 for PCs and tablets due end of this month, and the fact that Microsoft is pushing out preview builds left, right, and center recently, we thought it’s time to revisit the installation process to see how it differs from previous versions of Windows and the early WIndows 10 builds.
  • Windows Server 2003 Migration Resources! (Jeffadude)
    It’s hard to believe that it’s been 12 years since we released Windows Server 2003! On March 28th 2003 I received a ship-it award for the role I played in helping to make Windows Server 2003 ready for enterprise customers.

You can also follow these updates on Facebook Page or can also read previous editions at 1Gig Tech

Thanks,
Punit Ganshani

Follow on Feedly