вторник, 30 сентября 2014 г.
понедельник, 29 сентября 2014 г.
Проекты
PortfolioDb - C:\devTest\Web\Portfolio\PortfolioDB\PortfolioDB
PortfolioBo - C:\devTest\Web\Portfolio\PortfolioBo\PortfolioBo
PortfolioForm - пишет в PortfolioBo - Transactions, Trades, Portfolios, сформированные в PortfolioManager по результатам сформированных ExecutionReport из текстовых файлов.
PortfolioBo - C:\devTest\Web\Portfolio\PortfolioBo\PortfolioBo
PortfolioForm - пишет в PortfolioBo - Transactions, Trades, Portfolios, сформированные в PortfolioManager по результатам сформированных ExecutionReport из текстовых файлов.
Ссылки на проекты
192.168.10.6/PositionsMvc_02 - Позиции
192.168.1.57/PositionsMvc_01 - Позиции
192.168.10.6/PortfolioMvc_01 - Портфолио
192.168.1.57/PositionsMvc_01 - Позиции
192.168.10.6/PortfolioMvc_01 - Портфолио
пятница, 26 сентября 2014 г.
app.config ConfigurationManager
http://msdn.microsoft.com/ru-ru/library/system.configuration.configurationmanager(v=vs.110).aspx
http://stackoverflow.com/questions/19232695/how-to-use-configurationmanager
http://msdn.microsoft.com/ru-ru/library/system.configuration.configurationmanager.appsettings(v=vs.110).aspx
http://stackoverflow.com/questions/20195198/how-to-use-configurationmanager-appsettings-with-a-custom-section
http://stackoverflow.com/questions/10766654/appsettings-get-value-from-config-file
среда, 24 сентября 2014 г.
вторник, 23 сентября 2014 г.
Computer
Процессор для серверов INTEL Xeon E3-1230 v3 3.3ГГц [cm8064601467202 sr153]
Материнская плата GIGABYTE GA-Z87-HD3 LGA 1150, ATX, Ret
MSI B85-G43, под кулером за 1000р
Материнская плата — Gigabyte GA-Z87-HD3 (rev. 1.1), охлаждение — DEEPCOOL ICEEDGE 400XT, память — Kingston HYPERX KHX1600C9D3K2/8GX DDR3 2×4Gb, 1600. На всякий случай взял хорошую термопасту Arctic Cooling MX-4. Блок питания остался старый на 450Вт (все стабильно работает уже около месяца с несколькими винчестерами и видео GTX 560).
DEEPCOOL ICEEDGE 400XT,матьеринка MSI B85-G43 LGA 1150, ATX
File Encoding
if (Path.GetExtension(file) != ".log")
{
using (var streamReader = new StreamReader(file, Encoding.Default))
{
//ReportLine.TradeID = GetMaxTradeID();
while (!streamReader.EndOfStream)
{
var s = streamReader.ReadLine();
if (s == null)
continue;
{
using (var streamReader = new StreamReader(file, Encoding.Default))
{
//ReportLine.TradeID = GetMaxTradeID();
while (!streamReader.EndOfStream)
{
var s = streamReader.ReadLine();
if (s == null)
continue;
воскресенье, 21 сентября 2014 г.
EF prevent ID autogeneration
http://stackoverflow.com/questions/11612259/when-using-entity-framework-4-0-with-code-first-pattern-how-can-i-prevent-the
[Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
public int Id { get; set; }
четверг, 18 сентября 2014 г.
EF Bulk Insert
http://weblog.west-wind.com/posts/2013/Dec/22/Entity-Framework-and-slow-bulk-INSERTs
http://stackoverflow.com/questions/6107206/improving-bulk-insert-performance-in-entity-framework
http://stackoverflow.com/questions/5940225/fastest-way-of-inserting-in-entity-framework
https://efbulkinsert.codeplex.com/
среда, 17 сентября 2014 г.
Setups for PositionTracker
<appSettings>
<add key="ServiceName" value="TradePuller"/>
<add key="BusNodeName" value="BusNode_01"/>
<add key="BusNodePushAddress" value="tcp://192.168.1.57:22231"/>
<add key="PullTopic" value="ExecutionReport"/>
</appSettings>
<add key="ServiceName" value="TradePuller"/>
<add key="BusNodeName" value="BusNode_01"/>
<add key="BusNodePushAddress" value="tcp://192.168.1.57:22231"/>
<add key="PullTopic" value="ExecutionReport"/>
</appSettings>
AppConfig Operations
app.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="AppConfig.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<appSettings>
<add key="ServiceName" value="TradePuller"/>
<add key="BusNodeName" value="BusNode_01"/>
<add key="BusNodePushAddress" value="tcp://192.168.1.57:22231"/>
<add key="PullTopic" value="ExecutionReport"/>
</appSettings>
<applicationSettings>
<AppConfig.Properties.Settings>
<setting name="ServiceName" serializeAs="String">
<value>TradePuller</value>
</setting>
<setting name="BusNodeName" serializeAs="String">
<value>BusNode_01</value>
</setting>
<setting name="BusNodePushAddress" serializeAs="String">
<value>tcp://192.168.1.57:22231</value>
</setting>
<setting name="PullTopic" serializeAs="String">
<value>ExecutionReport</value>
</setting>
</AppConfig.Properties.Settings>
</applicationSettings>
</configuration>
Programm
using System.Configuration;
class Program
{
static void Main(string[] args)
{
var serviceName = Properties.Settings.Default.ServiceName;
var busnode = Properties.Settings.Default.BusNodeName;
var busnodepush = Properties.Settings.Default.BusNodePushAddress;
var pulltopic = Properties.Settings.Default.PullTopic;
Console.WriteLine("Service:{0}\r\nBusNode:{1}\r\nBusNodePush:{2}\r\nPullTopic:{3}",
serviceName,
busnode,
busnodepush,
pulltopic);
Console.ReadLine();
serviceName = ConfigurationManager.AppSettings["ServiceName"];
busnode = ConfigurationManager.AppSettings["BusNodeName"];
busnodepush = ConfigurationManager.AppSettings["BusNodePushAddress"];
pulltopic = ConfigurationManager.AppSettings["PullTopic"];
Console.WriteLine("Service:{0}\r\nBusNode:{1}\r\nBusNodePush:{2}\r\nPullTopic:{3}",
serviceName,
busnode,
busnodepush,
pulltopic);
Console.ReadLine();
}
}
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="AppConfig.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<appSettings>
<add key="ServiceName" value="TradePuller"/>
<add key="BusNodeName" value="BusNode_01"/>
<add key="BusNodePushAddress" value="tcp://192.168.1.57:22231"/>
<add key="PullTopic" value="ExecutionReport"/>
</appSettings>
<applicationSettings>
<AppConfig.Properties.Settings>
<setting name="ServiceName" serializeAs="String">
<value>TradePuller</value>
</setting>
<setting name="BusNodeName" serializeAs="String">
<value>BusNode_01</value>
</setting>
<setting name="BusNodePushAddress" serializeAs="String">
<value>tcp://192.168.1.57:22231</value>
</setting>
<setting name="PullTopic" serializeAs="String">
<value>ExecutionReport</value>
</setting>
</AppConfig.Properties.Settings>
</applicationSettings>
</configuration>
Programm
using System.Configuration;
class Program
{
static void Main(string[] args)
{
var serviceName = Properties.Settings.Default.ServiceName;
var busnode = Properties.Settings.Default.BusNodeName;
var busnodepush = Properties.Settings.Default.BusNodePushAddress;
var pulltopic = Properties.Settings.Default.PullTopic;
Console.WriteLine("Service:{0}\r\nBusNode:{1}\r\nBusNodePush:{2}\r\nPullTopic:{3}",
serviceName,
busnode,
busnodepush,
pulltopic);
Console.ReadLine();
serviceName = ConfigurationManager.AppSettings["ServiceName"];
busnode = ConfigurationManager.AppSettings["BusNodeName"];
busnodepush = ConfigurationManager.AppSettings["BusNodePushAddress"];
pulltopic = ConfigurationManager.AppSettings["PullTopic"];
Console.WriteLine("Service:{0}\r\nBusNode:{1}\r\nBusNodePush:{2}\r\nPullTopic:{3}",
serviceName,
busnode,
busnodepush,
pulltopic);
Console.ReadLine();
}
}
вторник, 16 сентября 2014 г.
среда, 10 сентября 2014 г.
MS SQL - установка
http://msdn.microsoft.com/ru-RU/library/ms143506(v=sql.120).aspx
Чтобы обеспечить правильность установки компонента, SQL Server потребует установить обновление. Программа установки SQL Server проверит наличие этого обновления и потребует загрузить и установить его, прежде чем можно будет продолжить установку SQL Server. Чтобы избежать прерывания установки SQL Server, вы можете загрузить и установить это обновление перед запуском программы установки SQL Server, как описано ниже (или установить все обновления для .NET 3.5 с пакетом обновления 1 (SP1), доступные в центре обновления Windows).- При установке SQL Server 2014 в Windows Server 2008 с пакетом обновлений 2 (SP2) необходимое обновление можно получить здесь.
- Если SQL Server 2014 устанавливается на компьютере под управлением любой другой поддерживаемой ОС, то это обновление будет включено.
вторник, 9 сентября 2014 г.
EF Migration
enable-migrations
add-migration InitialCreate
update-database
internal sealed class Configuration : DbMigrationsConfiguration<ContosoUniversity.DAL.SchoolContext> { public Configuration() { AutomaticMigrationsEnabled = false; } protected override void Seed(ContosoUniversity.DAL.SchoolContext context) { // This method will be called after migrating to the latest version. // You can use the DbSet<T>.AddOrUpdate() helper extension method // to avoid creating duplicate seed data. E.g. // // context.People.AddOrUpdate( // p => p.FullName, // new Person { FullName = "Andrew Peters" }, // new Person { FullName = "Brice Lambson" }, // new Person { FullName = "Rowan Miller" } // ); // } }
seed Method Example
namespace ContosoUniversity.Migrations { using ContosoUniversity.Models; using System; using System.Collections.Generic; using System.Data.Entity; using System.Data.Entity.Migrations; using System.Linq; internal sealed class Configuration : DbMigrationsConfiguration<ContosoUniversity.DAL.SchoolContext> { public Configuration() { AutomaticMigrationsEnabled = false; } protected override void Seed(ContosoUniversity.DAL.SchoolContext context) { var students = new List<Student> { new Student { FirstMidName = "Carson", LastName = "Alexander", EnrollmentDate = DateTime.Parse("2010-09-01") }, new Student { FirstMidName = "Meredith", LastName = "Alonso", EnrollmentDate = DateTime.Parse("2012-09-01") }, new Student { FirstMidName = "Arturo", LastName = "Anand", EnrollmentDate = DateTime.Parse("2013-09-01") }, new Student { FirstMidName = "Gytis", LastName = "Barzdukas", EnrollmentDate = DateTime.Parse("2012-09-01") }, new Student { FirstMidName = "Yan", LastName = "Li", EnrollmentDate = DateTime.Parse("2012-09-01") }, new Student { FirstMidName = "Peggy", LastName = "Justice", EnrollmentDate = DateTime.Parse("2011-09-01") }, new Student { FirstMidName = "Laura", LastName = "Norman", EnrollmentDate = DateTime.Parse("2013-09-01") }, new Student { FirstMidName = "Nino", LastName = "Olivetto", EnrollmentDate = DateTime.Parse("2005-08-11") } }; students.ForEach(s => context.Students.AddOrUpdate(p => p.LastName, s)); context.SaveChanges(); var courses = new List<Course> { new Course {CourseID = 1050, Title = "Chemistry", Credits = 3, }, new Course {CourseID = 4022, Title = "Microeconomics", Credits = 3, }, new Course {CourseID = 4041, Title = "Macroeconomics", Credits = 3, }, new Course {CourseID = 1045, Title = "Calculus", Credits = 4, }, new Course {CourseID = 3141, Title = "Trigonometry", Credits = 4, }, new Course {CourseID = 2021, Title = "Composition", Credits = 3, }, new Course {CourseID = 2042, Title = "Literature", Credits = 4, } }; courses.ForEach(s => context.Courses.AddOrUpdate(p => p.Title, s)); context.SaveChanges(); var enrollments = new List<Enrollment> { new Enrollment { StudentID = students.Single(s => s.LastName == "Alexander").ID, CourseID = courses.Single(c => c.Title == "Chemistry" ).CourseID, Grade = Grade.A }, new Enrollment { StudentID = students.Single(s => s.LastName == "Alexander").ID, CourseID = courses.Single(c => c.Title == "Microeconomics" ).CourseID, Grade = Grade.C }, new Enrollment { StudentID = students.Single(s => s.LastName == "Alexander").ID, CourseID = courses.Single(c => c.Title == "Macroeconomics" ).CourseID, Grade = Grade.B }, new Enrollment { StudentID = students.Single(s => s.LastName == "Alonso").ID, CourseID = courses.Single(c => c.Title == "Calculus" ).CourseID, Grade = Grade.B }, new Enrollment { StudentID = students.Single(s => s.LastName == "Alonso").ID, CourseID = courses.Single(c => c.Title == "Trigonometry" ).CourseID, Grade = Grade.B }, new Enrollment { StudentID = students.Single(s => s.LastName == "Alonso").ID, CourseID = courses.Single(c => c.Title == "Composition" ).CourseID, Grade = Grade.B }, new Enrollment { StudentID = students.Single(s => s.LastName == "Anand").ID, CourseID = courses.Single(c => c.Title == "Chemistry" ).CourseID }, new Enrollment { StudentID = students.Single(s => s.LastName == "Anand").ID, CourseID = courses.Single(c => c.Title == "Microeconomics").CourseID, Grade = Grade.B }, new Enrollment { StudentID = students.Single(s => s.LastName == "Barzdukas").ID, CourseID = courses.Single(c => c.Title == "Chemistry").CourseID, Grade = Grade.B }, new Enrollment { StudentID = students.Single(s => s.LastName == "Li").ID, CourseID = courses.Single(c => c.Title == "Composition").CourseID, Grade = Grade.B }, new Enrollment { StudentID = students.Single(s => s.LastName == "Justice").ID, CourseID = courses.Single(c => c.Title == "Literature").CourseID, Grade = Grade.B } }; foreach (Enrollment e in enrollments) { var enrollmentInDataBase = context.Enrollments.Where( s => s.Student.ID == e.StudentID && s.Course.CourseID == e.CourseID).SingleOrDefault(); if (enrollmentInDataBase == null) { context.Enrollments.Add(e); } } context.SaveChanges(); } } }update-database
Подписаться на:
Сообщения (Atom)