Popular Posts
-
Kendo UI applying SUM in footer template kendo ui - KendoUI: Grid Summary values in Footer - Stack Overflow : ", footerTemplate:...
-
MVC grid example ASP.NET MVC Flexigrid sample - CodeProject : 'via Blog this'
-
A possible way of handling distributed transaction for multiple contexts without alleviation to MSDTC??? c# - Entity Framework - Using Trans...
Friday, May 26, 2017
Wednesday, May 24, 2017
dotnet-architecture/eShopOnContainers: Easy to get started sample reference microservice and container based application (Currently in ALPHA state, ongoing progress, accepting feedback and pull-requests). Cross-platform on Linux and Windows Containers, powered by .NET Core and Docker engine. Supports .CSPROJ with Visual Studio 2017 and also CLI based environments with Docker CLI, dotnet CLI, VS Code or any other code editor
Saturday, May 20, 2017
JS Dump from VS Code:
function abc(id) {
var countriesSubscription = [
{ Exchange: 'ASX', CountryId: 1, ExchangeRate: 1, CountryName: "Australia", Code: "AU", CurrencyForeign: "AUD", CurrencyLocal: "AUD", IsSubscribed: true, PriceLocal: 15.75, PriceForeign: null, DataType: "ClickToRefresh" },
{ Exchange: 'ASX', CountryId: 2, ExchangeRate: 1.01, CountryName: "Canada", Code: "CAN", CurrencyForeign: "CAD", CurrencyLocal: "AUD", IsSubscribed: false, PriceLocal: null, PriceForeign: null, DataType: "" },
{ Exchange: 'ASX', CountryId: 3, ExchangeRate: 5.78, CountryName: "Hong Kong", Code: "HKG", CurrencyForeign: "HKD", CurrencyLocal: "AUD", IsSubscribed: false, PriceLocal: null, PriceForeign: null, DataType: "" },
{ Exchange: 'CHIX', CountryId: 4, ExchangeRate: 0.74, CountryName: "US", Code: "USA", CurrencyForeign: "USD", CurrencyLocal: "AUD", IsSubscribed: true, PriceLocal: null, PriceForeign: null, DataType: "" },
{ Exchange: 'ASX', CountryId: 5, ExchangeRate: 0.67, CountryName: "France", Code: "FRA", CurrencyForeign: "EUR", CurrencyLocal: "AUD", IsSubscribed: false, PriceLocal: null, PriceForeign: null, DataType: "" },
{ Exchange: 'CHIX', CountryId: 6, ExchangeRate: 1.37, CountryName: "Switzerland", Code: "CHE", CurrencyForeign: "CHF", CurrencyLocal: "AUD", IsSubscribed: true, PriceLocal: null, PriceForeign: null, DataType: "" },
{ Exchange: 'ASX', CountryId: 7, ExchangeRate: 0.73, CountryName: "Belgium", Code: "BEL", CurrencyForeign: "EUR", CurrencyLocal: "AUD", IsSubscribed: false, PriceLocal: null, PriceForeign: null, DataType: "" },
];
countriesSubscription.forEach(function (element) {
if (element.CountryId === id) {
element.IsSubscribed = true;
return;
}
});
for (var index = 0; index < countriesSubscription.length; index++) {
var element = countriesSubscription[index];
console.log(element.CountryName + ' ' + element.IsSubscribed);
}
// Use map function
var result = countriesSubscription.map(function (element) {
return element.CurrencyLocal + " " + element.PriceLocal;
});
result.forEach(function (element) {
console.log(element);
}, this);
// reduce array of objects to dictionary
var countryDictionary = countriesSubscription.reduce(function (o, v) {
o[v.CountryId] = v;
return o;
}, {});
console.log(countryDictionary[1]);
console.log(countryDictionary[1].CountryName);
console.log(countryDictionary[2]);
console.log(countryDictionary[2].CountryName);
// Find index of element
Array.prototype.indexOfObject = function countriesSubscription(property, value) {
for (var i = 0, len = this.length; i < len; i++) {
if (this[i][property] === value) return i;
}
return -1;
}
var result = countriesSubscription.indexOfObject("CountryName", "Canada");
console.log(result);
result = countriesSubscription.map(function (e) { return e.CountryName; }).indexOf('Canada');
console.log(result);
console.log(countriesSubscription[result].CountryName);
// **** Array to group by Exchange ****
var groupByCurrency = countriesSubscription.reduce(function(all, item, index){
all[item.Exchange].push(item);
return all;
}, {CHIX:[], ASX:[]});
groupByCurrency.ASX.forEach(function(item){
console.log(item);
})
groupByCurrency.CHIX.forEach(function(item){
console.log(item);
})
// Custom function that loops and finds
countrySearch = function (array, callback) {
for (var key in countriesSubscription) {
if (callback(countriesSubscription[key])) {
return countriesSubscription[key];
}
}
}
var countryById = this.countrySearch(countriesSubscription, function(key){
return key.CountryId === 1;
})
console.log(countryById);
var countryByName = this.countrySearch(countriesSubscription, function(key){
return key.CountryName === "Australia";
})
console.log(countryByName);
var CountryBySubscribtion = this.countrySearch(countriesSubscription, s => s.IsSubscribed === false )
console.log(CountryBySubscribtion.CountryName);
}
abc(3);
Doing group by like in JavaScript using the reduce function, see:
var countriesSubscription = [
{ Exchange: 'ASX', CountryId: 1, ExchangeRate: 1, CountryName: "Australia", Code: "AU", CurrencyForeign: "AUD", CurrencyLocal: "AUD", IsSubscribed: true, PriceLocal: 15.75, PriceForeign: null, DataType: "ClickToRefresh" },
{ Exchange: 'ASX', CountryId: 2, ExchangeRate: 1.01, CountryName: "Canada", Code: "CAN", CurrencyForeign: "CAD", CurrencyLocal: "AUD", IsSubscribed: false, PriceLocal: null, PriceForeign: null, DataType: "" },
{ Exchange: 'ASX', CountryId: 3, ExchangeRate: 5.78, CountryName: "Hong Kong", Code: "HKG", CurrencyForeign: "HKD", CurrencyLocal: "AUD", IsSubscribed: false, PriceLocal: null, PriceForeign: null, DataType: "" },
{ Exchange: 'CHIX', CountryId: 4, ExchangeRate: 0.74, CountryName: "US", Code: "USA", CurrencyForeign: "USD", CurrencyLocal: "AUD", IsSubscribed: true, PriceLocal: null, PriceForeign: null, DataType: "" },
{ Exchange: 'ASX', CountryId: 5, ExchangeRate: 0.67, CountryName: "France", Code: "FRA", CurrencyForeign: "EUR", CurrencyLocal: "AUD", IsSubscribed: false, PriceLocal: null, PriceForeign: null, DataType: "" },
{ Exchange: 'CHIX', CountryId: 6, ExchangeRate: 1.37, CountryName: "Switzerland", Code: "CHE", CurrencyForeign: "CHF", CurrencyLocal: "AUD", IsSubscribed: true, PriceLocal: null, PriceForeign: null, DataType: "" },
{ Exchange: 'ASX', CountryId: 7, ExchangeRate: 0.73, CountryName: "Belgium", Code: "BEL", CurrencyForeign: "EUR", CurrencyLocal: "AUD", IsSubscribed: false, PriceLocal: null, PriceForeign: null, DataType: "" },
];
// **** Array to group by Exchange ****
var groupByCurrency = countriesSubscription.reduce(function(all, item, index){
all[item.Exchange].push(item);
return all;
}, {CHIX:[], ASX:[]});
groupByCurrency.ASX.forEach(function(item){
console.log(item);
})
groupByCurrency.CHIX.forEach(function(item){
console.log(item);
})
output:
CountryId: 5,
ExchangeRate: 0.67,
CountryName: 'France',
Code: 'FRA',
CurrencyForeign: 'EUR',
CurrencyLocal: 'AUD',
IsSubscribed: false,
PriceLocal: null,
PriceForeign: null,
DataType: '' }
{ Exchange: 'ASX',
CountryId: 7,
ExchangeRate: 0.73,
CountryName: 'Belgium',
Code: 'BEL',
CurrencyForeign: 'EUR',
CurrencyLocal: 'AUD',
IsSubscribed: false,
PriceLocal: null,
PriceForeign: null,
DataType: '' }
{ Exchange: 'CHIX',
CountryId: 4,
ExchangeRate: 0.74,
CountryName: 'US',
Code: 'USA',
CurrencyForeign: 'USD',
CurrencyLocal: 'AUD',
IsSubscribed: true,
PriceLocal: null,
PriceForeign: null,
DataType: '' }
{ Exchange: 'CHIX',
CountryId: 6,
ExchangeRate: 1.37,
CountryName: 'Switzerland',
Code: 'CHE',
CurrencyForeign: 'CHF',
CurrencyLocal: 'AUD',
IsSubscribed: true,
PriceLocal: null,
PriceForeign: null,
DataType: '' }
Thursday, May 18, 2017
Tuesday, May 16, 2017
Monday, May 15, 2017
. Net free code profiler
https://channel9.msdn.com/coding4fun/blog/Keeping-Track-of-Your-Codes-Preformance-with-CodeTrack
Gui windlg dump file debug
https://channel9.msdn.com/coding4fun/blog/Keeping-Track-of-Your-Codes-Preformance-with-CodeTrack
Sunday, May 14, 2017
Backup/Restore & configure Master/Slave in Redis - YouTube
Backup/Restore & configure Master/Slave in Redis - YouTube
nice redis master and slave and configuration and back up
nice redis master and slave and configuration and back up
Saturday, May 13, 2017
Friday, May 12, 2017
Thursday, May 11, 2017
Chrome extension c#
https://www.codeproject.com/Articles/1185723/Develop-Your-First-Google-Chrome-Extension-Using-H
Tuesday, May 9, 2017
Monday, May 8, 2017
Encription library as in ravebdb
http://feedproxy.google.com/~r/AyendeRahien/~3/TZJP-64f4FI/ravendb-4-0-full-database-encryption
Saturday, May 6, 2017
dyatchenko/ServiceBrokerListener: Component which receives SQL Server table changes into your .net code.
dyatchenko/ServiceBrokerListener: Component which receives SQL Server table changes into your .net code.
alternative to sql dependency for database notifications
alternative to sql dependency for database notifications
Wednesday, May 3, 2017
Tuesday, May 2, 2017
Subscribe to:
Posts (Atom)