.net

AngularJS: Access directive from controller

Background I have a top level directive which needs to be accessed by a controller. Please consider this Plunk. Directive app.directive(‘topDirective’, [‘$compile’, function($scope){ return { scope: {}, restrict: ‘E’, template: ‘<h3>Top Directive</h3><p><button ng-click=”CallMe()”>Click Me</button></p>’, controller: function($scope) { var self = {}; $scope.CallMe = function(){ alert(‘Call Me’); }; }, link: function($scope, $elem, $attrs, $ctrl) { } }; }]); Controller that needs…
Read more

Reading via batch if .NET 4.0 is installed. Safe enough with reg query?

I’m currently trying to find out if .NET 4.0 is installed on different pcs via commandline. The command I’m using is: REG QUERY “HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDPv4Full” /v Version If 4.0 is installed I get 4.0….. as a result while if nothing is installed at all I get a registry key error. Now my question is (as I can’t reproduce it…
Read more

How can I parse an Arabic Umm Al-Qura date string into a .NET DateTime object?

I have the following Arabic date in the Umm Al-Qura calendar that I want to parse into a .NET DateTime object: الأربعاء‏، 17‏ ذو الحجة‏، 1436 This date is equivalent to September 30th 2015 in the Gregorian calendar. I’ve been trying the following “standard” C# code to parse this date, but without success: var cultureInfo = new CultureInfo(“ar-SA”); cultureInfo.DateTimeFormat.Calendar = new…
Read more

Waiting for certain information in a NetworkStream object

I’ve spent the past few days trying to read from a NetworkStream object using both the BeginRead and the Read methods, however both methods have been giving me difficulties and are unreliable it seems The first, “Read” required me to sleep the thread and expected the correct data to be present when the sleep finished. Like so: cmd = System.Text.Encoding.ASCII.GetBytes(CommandString…
Read more

PhantomJS can’t find element by id

I’m using the last version of selenium in my C# console application. The problem is I have a web site that I can’t see the first element to login BUT the same website works fine in firefox Things I tried: Maximize the window: driver.Manage().Window.Maximize(); Checked if the element presented in other frame (No frames in this page). Wait till the…
Read more

Choosing knockout or kendo

I have requirement to use kendo controls for my application as well as mvvm bindings. I went through this articles article 1 article 2 and found that all articles are aligned to kendo. Could you please let me know why so and could you please share the advantages and disadvantages? Source: .net

.NET : reproductibility of Dictionary enumeration when key is a reference

I often use dictionaries in my code with non-struct objects as key. I find this very practical and the framework provides us a large number of methods. However I wonder about the reproductibility of my code : is my program always giving the same result ? Indeed, I use foreach method or linq methods like this : Dictionary<MyObject, double> results…
Read more

WebClient no response and exception

Using WebClient to call a post API: try { var webClient = new WebClient(); var result= webClient.UploadString(‘http://wewe.com/name’, {…}) //log1 } catch(Exception ex) { //log2 } Sometime I hit a problem that log1 and log2 is not log. No response and exception after http call? Any reason why? Source: .net