Angular 2 – 2 Way Binding with NgModel in NgFor

After digging around I need to use trackBy on ngFor. Updated plnkr and code below. Working Plnkr @Component({ selector: ‘my-app’, template: ` <div> <div *ngFor=”let item of toDos;let index = index;trackBy:trackByIndex;”> <input [(ngModel)]=”toDos[index]” placeholder=”item”> </div> Below Should be binded to above input box <div *ngFor=”let item of toDos”> <label>{{item}}</label> </div> </div> `, directives: [MdButton, MdInput] …

Read more

Call static function from angular2 template

Only instance members of the components class can be called from the view. If you want to call static members, you need to provide a getter in the component. export class MyComponent { parseDate = DateService.parseDate; } then you can use it like (input)=”event.date=parseDate($event.target.value)”

Why is SQL Server losing a millisecond?

SQL Server only stores time to approximately 1/300th of a second. These always fall on the 0, 3 and 7 milliseconds. E.g. counting up from 0 in the smallest increment: 00:00:00.000 00:00:00.003 00:00:00.007 00:00:00.010 00:00:00.013 … If you need that millisecond accuracy, there’s no pleasant way around it. The best options I’ve seen are to …

Read more

SQLite Insert very slow?

Wrap BEGIN \ END statements around your bulk inserts. Sqlite is optimized for transactions. dbcon = new SQLiteConnection(connectionString); dbcon.Open(); SQLiteCommand sqlComm; sqlComm = new SQLiteCommand(“begin”, dbcon); sqlComm.ExecuteNonQuery(); //—INSIDE LOOP sqlComm = new SQLiteCommand(sqlQuery, dbcon); nRowUpdatedCount = sqlComm.ExecuteNonQuery(); //—END LOOP sqlComm = new SQLiteCommand(“end”, dbcon); sqlComm.ExecuteNonQuery(); dbcon.close();

How to create a GUID in Excel?

As of modern version of Excel, there’s the syntax with commas, not semicolons. I’m posting this answer for convenience of others so they don’t have to replace the strings- We’re all lazy… hrmp… human, right? =CONCATENATE(DEC2HEX(RANDBETWEEN(0,4294967295),8),”-“,DEC2HEX(RANDBETWEEN(0,65535),4),”-“,DEC2HEX(RANDBETWEEN(0,65535),4),”-“,DEC2HEX(RANDBETWEEN(0,65535),4),”-“,DEC2HEX(RANDBETWEEN(0,4294967295),8),DEC2HEX(RANDBETWEEN(0,65535),4)) Or, if you like me dislike when a guid screams and shouts and you, we can go lower-cased like …

Read more

cannot implicitly convert type ‘bool?’ to ‘bool’. An explicit conversion exists (are you missing a cast?)

As the others stated bool? is not equal to bool. bool? can also be null, see Nullable<t> (msdn). If you know what the null state wants to imply, you easily can use the ?? – null-coalescing operator (msdn) to convert your bool? to bool without any side effects (Exception). Example: //Let´s say “chkDisplay.IsChecked = null” …

Read more