Total Microtheories:7409 TotalHits: 242429 Email Us | Add MT | Help Using the Site



BETTER IDEAS, BETTER SOLUTIONS


[Valid RSS] | RSS Feed

Most Recent Microtheory

(hits=9) The App.XML is initialized with a Boostrapper entry point. The Bootstrapper loads the mainViewModel and its view.[Learn More...]
(hits=7) A usercontrol containing a textbox and a datagrid is loaded into the MainWindow view on the addressbook button click. The textbox x:Name="SearchName" is connected to the AddressViewModel Property SearchName. The x:Name="AddressBooks" is connected to the databindable AddressViewModel property AddressBooks, a databindablecollection. When an user enters data into the textbox, a text change event is raised and the AddressBookViewModel SearchName setter is invoked assigning the value to the _searchName variable. When the user presses the SearchButton, the Search method in the addressviewModel is called an the repository loads the databindablecollection with addressbook items.[Learn More...]
(hits=7) We are using caliburn for the mvvm architecture. Caliburn create a bootstrapper entry point. The MainViewModel is loaded with a mainview.xaml. The mainview has a grid for containing a button. The button will be used to activate the AddressViewModel through an LoadAddressBook button click event. The views and the viewmodels are connected by naming convention. The XXXviews are stored in the view directory and the XXXviewModels are stored in the ViewModels directory[Learn More...]
(hits=8) The Model View View model architecture allows for two way binding. In other words, Data changed in a datagrid will bind to data in an databindable collection and data changed in a databindable collection will bind with the datagrid, automatically. The MVVM model simplifies interaction with the datagrid.[Learn More...]
(hits=13) In the child window, I use the SingletonForm GetInstance to get the MainWindow instance by type and access its controls by name retrieving a combo box item data by using the comboboxitem class.[Learn More...]
(hits=11) WPF uses the app.xaml to launch the mainwindow.xaml using a starturi. Remove the starturi application attribute and replace it with an override method of OnStartup. In OnStartup use the extension class FormSingleton to invoke the instance of the MainWindow form and then display with the .Show method. Pass null as an owner since MainWindow is the root window. On the MainWindow I created a button for launching a child window form.[Learn More...]
(hits=15) I use a Singleton pattern to instantiate all forms in my application. I can access the form by its type. This model does not allow for multiple forms to be instantiated of the same type. The form type and the instance of the form are stored into a static dictionary. The Activator.CreateInstance will instantiate an instance of the form using its type. The owner is passed by argument as a parameter to the FormSingleton class. When the instance of the form is closed, a delegate function is callbacked an the form is removed from the static dictionary called dictForms.[Learn More...]
(hits=17) When objects are added, removed, or updated from the ObservableCollection the dataGrid is automatically updated with those changes. WPF adds a CollectionChanged event handler to the ObservableCollection's events.[Learn More...]
(hits=10) In this code snippet, I demonstrate how to use WPF XAML to display "Is A" data in one datagrid and "Has A" data in another datagrid for the dog class (see How to create concrete classes with polymorphism). XAML allows the developer to place wpf controls within a Grid or a Canvas. The grid allows the window to be partition into rows and columns. In this case there is only one row and one column by default for the grid. Within the grid is a combobox control with three values: Dog, Cat and Horse. Two data grids are defined within the grid relative position to the row top and column left position, they reside in. The dataGridIsA has one column which is data bound to an observable collection with the class field name of "IsAString". An ObservableCollection is a dynamic collection of objects of a given type. The IsA observableCollection contains data attributes of both the mammal abstract class and the dog class either from the ICollection or method calls. Additionally, the dataGridHasA is data bound to the observable collection holding the IsA ICollection attributes of the dog class. The AutoGenerate attribute of the dataGrid is set to false preventing the application from creating a data grid column from the observablecollection class variable names.[Learn More...]
(hits=10) The dynamic key word is used to create an anonymous class using a key/value pair combination of fieldname and value. The type is determined by the compiler.[Learn More...]
(hits=11) This code sample demonstrates how to implement polymorphism in c#. Polymorphism is one of the three pillars of object orient programming. Polymorphism means several forms. A dog is an mammal. The mammal class is defined as abstract meaning it can not be instantiated. However, the properties and methods of the abstract class can be accessed by the derived concrete class. An abstract class instance can reference a derived concrete class, but a concrete class can not reference an abstract class. Mammal mammal=dog is allowed but Dog dog=mammal is not. Polymorphism can be implemented by abstract GetSound method with the override GetSound method in the Dog class. Additionally, the Dog class constructor can be have multiple parameter types allowing for different behavior and attributes of the concrete class.[Learn More...]
(hits=13) he Lambda expression body can be made of multiple statements, variable assignments, or method calls. The lambda expression can modify class variables external to the expression, be careful.[Learn More...]
(hits=13) The Lambda parameters can be passed by reference (ref int x). The x increment is permanent.[Learn More...]
(hits=17) Lambda expression take parameters (Person p). If no parameter are given then use () indicating an empty parameter list.[Learn More...]
(hits=13) In this code snippet, I demonstrate how to create a list using a struct and how too use an enumeration type called GenderType in the struct. A list of Person struct type is created and a lambda function is created as the predicate of the Find extension and the FindAll extension. The Find extension searches the list until the first record with a match is encounter then stops. The FindAll extension searches the list for all matches returning true.[Learn More...]
(hits=19) await function().ConfigureAwait(false) will run the method on a separate thread from the UI thread. The await call will instantaneous return control back to the UI thread. In the code example, the doLongRunningFnc1 processes a 100 numbers raise to the third power without blocking the UI thread.[Learn More...]
(hits=14) The task returns a list of doubles for TResult. I can enumerate the Result because it is IList of doubles[Learn More...]
(hits=12) The await keyword in the async method specifics a point the c# compiler can split the code into a continuation on the thread doing the work.[Learn More...]
(hits=15) When the c# compiler encounters an await in an async method, it reformats it into a task.Run on the same thread as the async method. Now, there is a problem updating the User Interface because they share the same thread. Using the await on a code will create a continuation block for completion after the async code is done. You won't get a "marshalled from a different thread" error by using await with async or using continueWith and putting your UI update code in the continueWith code block.[Learn More...]
(hits=13) Mark Davis use manganese oxide to keep heat based hydrogen temperatures to 850 c versus 1000 c.[Learn More...]
(hits=14) The MIT plasmatron uses resonant pulsed electrolysis to release hydrogen producing brownian gas water that will burn.[Learn More...]
(hits=16) Evan Johnson of Hytech Power has a technology for creating a hydrogen boast for diesel engines to improve fuel efficiency. The hydrogen generator using titanium plates and electro-catalysts and electricity to produce hydrogen. A semi diesel engine can be retrofit with the hydrogen boast for about 10k. HyTech for cars stores hydrogen in hydrate metals under lower pressure of 200 psi yield mileage ranges of 300 miles. He has created a Liquid fuel for transporation.[Learn More...]
(hits=27) Lee Cronin of the University of Glasgrow uses a liquid to store hydrogen as a liquid based inorganic fuel. He has developed a process for releasing hydrogen at 30 times greater volume per unit of energy than current electrolysis methods of hydrogen production. He calls this process, "artificial photosynthetic systems" and uses solar power as an energy source.[Learn More...]
(hits=17) The world products 50 billion kilograms of hydrogen a year. Thomas Jaramillo a research from Stanford has developed a catalyst for accelerating the production of hydrogen using a chemical reaction and lowers the energy required to produce hydrogen. The production of hydrogen is faster and requires less energy. Jaramillo discovered a catalyst with properties of being stable in acid. The oxygen evolution reaction catalyst required 270 millivolts to reach oxygen production. The catalyst is a thin film crystal grown on a flat surface made from iridium oxide on one layer and strontium iridium oxide on the other layer. iridium oxide is the only known catalyst that works in acid.[Learn More...]
(hits=19) My goal is to reduce the amount of linq required to access data in the database. One way to reduce the amount of linq code is use the eager loading class references produced by Entity Framework for a database table. An ScheduleEvent table has foreign keys for the Employee AddressBook and the Customer AddressBook records. The foreign keys relationship is used by EntityFramework to create a virtual EmployeeAddressBook and a virtual CustomerAddressBook. The Schedule Events are returned as an IQueryable type. This allows me to foreach the result of the query results. The Unit of Work repository ScheduleEventRepository uses eager loading to return the parent object of the entity framework schedulevent class: EmployeeAddressBook. The ScheduleEvent has a virtual reference to an Employee AddressBook and a Customer AddressBook. The EmployeeAddressBook and CustomerAddressBook are virtual meaning, they must be included to be loaded by the base class method GetObjectsAsync where I pass the lambda expression and the table name to Include for eager loading.[Learn More...]
(hits=23) This code snippet demonstrates the Parrallel.invoke and the Parrallel.foreach. Parallel.foreach partions the reading of a collection into sections giving each thread a section of the whole collection. The Parallel.foreach can be canceled by the user.[Learn More...]

Top 20 Microtheories

Top 5 Questions

Recent Questions

Links


Help