Article similar to Josh Smith's MSDN MVVM article for Silverlight.
binding to VM property (e.g. an ICommand) in DataGridTemplateColumn: ex. by Bill
On Message Broker architecture. Also how to use (Application.Current as App)
First SL3
L2S with WPF
http://www.c-sharpcorner.com/uploadfile/anavijai/integrating-silverlight-in-sharepoint-2010/
http://beyondrelational.com/modules/2/blogs/433/posts/12021/different-ways-to-bind-data-grid-in-silverlight.aspx
Consuming SharePoint Web Services from Silverlight see here for how to set endpoint address; here for sample crossdomain.xml and clientaccesspolicy.xml. To cast the result of the linq to bindable ObservableCollection see.
Adding Dynamic Columns. For fixing "XamlReader.Load() does not accept event handlers" error, see.
See bottom of this for Error handling. Sortable Dynamic Columns.
Tuesday, July 31, 2012
Sunday, July 29, 2012
Searching/Querying in .NET
- Delegates are good for defining a generic criteria parameter of search method -- no need to hard code criteria in loop of each of multiple search methods (see also Specifications)
- Lambdas obviate need to define named delegate implementations (or methods matching a generic .NET delgate type i.e. Predicate or Func)
- Expression trees to construct lambdas on the fly, allowing construction of criteria at run time
- Lambdas obviate need to define named delegate implementations (or methods matching a generic .NET delgate type i.e. Predicate or Func)
- Expression trees to construct lambdas on the fly, allowing construction of criteria at run time
Saturday, July 28, 2012
WPAS
- Feature of IIS 7
- Can host HTTP & Non-HTTP services
- Can host HTTP & Non-HTTP services
Thursday, July 26, 2012
WCF Channel
The Channel is the combination of Data Contract (e.g. ISomething), binding (e.g. HTTP), and endpoint (e.g. URI). It can be used in place of the autogenerated proxy by means of the channel factory.
Sunday, July 22, 2012
Control Invoke
Control calls without Invoke (with delegate) from other thread sometimes works but throws exception in Visual Studio
For example modifying the example from http://msdn.microsoft.com/en-US/library/a1hetckb(v=vs.80) to read
expand collapse
Full Code:
expand collapse
For example modifying the example from http://msdn.microsoft.com/en-US/library/a1hetckb(v=vs.80) to read
expand collapse
public void Run() { myFormControl1.myListBox.Items.Add("test from thread");...
works in non-debug mode:
namespace WindowsFormsApplication1 { public partial class MyFormControl : Form { public delegate void AddListItem(string myString); public AddListItem myDelegate; private Button myButton; private Thread myThread; public ListBox myListBox; private Button myNoThreadButton; public MyFormControl() { //InitializeComponent(); myButton = new Button(); myNoThreadButton = new Button(); myListBox = new ListBox(); myButton.Location = new Point(72, 160); myButton.Size = new Size(152, 32); myButton.TabIndex = 1; myButton.Text = "Add items in list box"; myButton.Click += new EventHandler(Button_Click); myNoThreadButton.Location = new Point(70, 190); myNoThreadButton.Size = new Size(100, 32); myNoThreadButton.Text = "Add items No thread created"; myNoThreadButton.Click += new EventHandler(ButtonNoThread_Click); myListBox.Location = new Point(48, 32); myListBox.Name = "myListBox"; myListBox.Size = new Size(200, 95); myListBox.TabIndex = 2; ClientSize = new Size(332, 333); Controls.AddRange(new Control[] { myListBox, myButton, myNoThreadButton }); Text = " 'Control_Invoke' example "; myDelegate = new AddListItem(AddListItemMethod); } static void Main() { MyFormControl myForm = new MyFormControl(); myForm.ShowDialog(); } public void AddListItemMethod(String myString) { myListBox.Items.Add(myString); } private void Button_Click(object sender, EventArgs e) { myThread = new Thread(new ThreadStart(ThreadFunction)); myThread.Start(); } private void ButtonNoThread_Click(object sender, EventArgs e) { for (int i = 1; i <= 5; i++) { string myString = "(no thread) Step number " + i.ToString() + " executed"; AddListItemMethod(myString); } } private void ThreadFunction() { MyThreadClass myThreadClassObject = new MyThreadClass(this); myThreadClassObject.Run(); } } public class MyThreadClass { MyFormControl myFormControl1; public MyThreadClass(MyFormControl myForm) { myFormControl1 = myForm; } String myString; public void Run() { myFormControl1.myListBox.Items.Add("test from thread"); for (int i = 1; i <= 5; i++) { myString = "Step number " + i.ToString() + " executed"; Thread.Sleep(400); // Execute the specified delegate on the thread that owns // 'myFormControl1' control's underlying window handle with // the specified list of arguments. myFormControl1.Invoke(myFormControl1.myDelegate, new Object[] { myString }); } } }
Friday, July 20, 2012
DataGridView Object DataSource Must Contain Properties
Not fields. Found this out the hard way. see http://www.codeproject.com/Articles/24656/A-Detailed-Data-Binding-Tutorial
Wednesday, July 18, 2012
Yield Return is Lazy
The method with it will not execute unless the results are used. See http://www.codeproject.com/Articles/38097/The-Mystery-Behind-Yield-Return
ForEach Extension Method
empList.ForEach(delegate(Employee e)
{
Console.WriteLine("{0,2} {1,7} {2,8} {3,8} {4,23} {5,3}", e.ID, e.FName, e.MName, e.LName, e.DOB, e.Sex);
});
http://www.codeproject.com/Articles/35667/How-to-Use-LINQ-GroupBy
Console.WriteLine("{0,2} {1,7} {2,8} {3,8} {4,23} {5,3}", e.ID, e.FName, e.MName, e.LName, e.DOB, e.Sex);
});
http://www.codeproject.com/Articles/35667/How-to-Use-LINQ-GroupBy
Tuesday, July 17, 2012
POX and WCF Data Services
POX and WCF Data Services implies REST, i.e. access resources via URL (http://weburl/service.svc/Products retrieves list of products in XML) from which can readily write LINQ queries.
Assign Delegates to Predicates
e.g. Filter property of an ICollectionView is a predicate, so pass it a delegate which is applied to each item (returning true or false based on some criteria)
Pivot Rows to Columns in SQL Server
Pivot row values to columns by using this pattern in SQL Server
SELECT @strValues = COALESCE(@strValues+',', '') + FirstName
FROM
( SELECT DISTINCT FirstName FROM [AdventureWorksLT2008R2].[SalesLT].[Customer]) X
ORDER BY FirstName
SELECT [Result]= @strValues
ref: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=53885
SELECT @strValues = COALESCE(@strValues+',', '') + FirstName
FROM
( SELECT DISTINCT FirstName FROM [AdventureWorksLT2008R2].[SalesLT].[Customer]) X
ORDER BY FirstName
SELECT [Result]= @strValues
ref: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=53885
Sunday, July 15, 2012
The RAII Idiom
The essence of the RAII idiom is that the class file encapsulates the management of any finite resource, like the FILE* file handle. It guarantees that the resource will properly be disposed of at function exit. Furthermore, file instances guarantee that a valid log file is available (by throwing an exception if the file could not be opened).
http://en.wikibooks.org/wiki/C%2B%2B_Programming/RAII
Wednesday, July 11, 2012
A+ Notes
CNR - riser slot supports plug and play, supercedes AMR
WUXGA - supports 1080p
Unplug AC adapters when not in use (their transformer draws constant current)
Full Duplex - no need for collision detection
DDR - 184-pin (one notch), DDR2 and DDR3 - 240-pin
Inverter - supplies power to LCD backlight
ATX 6-pin connector - supplies 75 W at 12V
TOSLINK - fiber connector for digital audio
EVDO card - cellular PC communication
AM2+ - Phenom socket
Mini-PCI - formerly used in laptops
CardBus - version of PCMCIA
ExpressCard - replaced PCMCIA/CardBus
Line tester - test telephone jacks
Boot logging - safe mode option, records driver loading
D-subminiature - D shaped connector, e.g. DB-25, DE-9
Fan placing - top/rear for exhaust, front/sides, intake ref
SIMMs - go in pairs, DIMMs can be single
BNC connector - for thinnet (coaxial)
FTTx - last mile fiber optic specs
DirectAccess - VPN-like IPv6 solution
wbadmin - backup command for Vista
WUXGA - supports 1080p
Unplug AC adapters when not in use (their transformer draws constant current)
Full Duplex - no need for collision detection
DDR - 184-pin (one notch), DDR2 and DDR3 - 240-pin
Inverter - supplies power to LCD backlight
ATX 6-pin connector - supplies 75 W at 12V
TOSLINK - fiber connector for digital audio
EVDO card - cellular PC communication
AM2+ - Phenom socket
Mini-PCI - formerly used in laptops
CardBus - version of PCMCIA
ExpressCard - replaced PCMCIA/CardBus
Line tester - test telephone jacks
Boot logging - safe mode option, records driver loading
D-subminiature - D shaped connector, e.g. DB-25, DE-9
Fan placing - top/rear for exhaust, front/sides, intake ref
SIMMs - go in pairs, DIMMs can be single
BNC connector - for thinnet (coaxial)
FTTx - last mile fiber optic specs
DirectAccess - VPN-like IPv6 solution
wbadmin - backup command for Vista
Tuesday, July 10, 2012
Fiber connectors
MT-RJ - looks like RJ-45
ST - long straight tip
SC - plastic plug
LC - resemble small SC
ST - long straight tip
SC - plastic plug
LC - resemble small SC
IPv6
Link-local: FE80:://10
Site-local: FEC0::/10
Global: 001...
ULA: FC00::/7
Lookback: 0:0:0:0:0:0:0:1 or ::1
Site-local: FEC0::/10
Global: 001...
ULA: FC00::/7
Lookback: 0:0:0:0:0:0:0:1 or ::1
802.11 AP
802.11 standard describes the AP which bridges the wireless LAN to the wired LAN.
In Vista, enter the SSID into Network name: prompt of the "Manually connect to a wireless network" screen.
In Vista, enter the SSID into Network name: prompt of the "Manually connect to a wireless network" screen.
Subscribe to:
Posts (Atom)