Remove Title Bar from your WPF application

0

Recently, one of my friends was asking me how can him remove the title bar from his WPF Application. He dont know what the keyword he can use, I thought its interesting so I am posting here so in case if any one needs it in the future.

There are a few ways to do it.
1. Do through coding ( Code Behind ).

this.WindowStyle = WindowStyle.None;

2. Do through XAML. Add in the WindowStyle attribute to the Window Tag
Window WindowStyle="None">

3. Editing through the properties ( Ultimately, this changes the XAML )

Properties

Properties

You can check out the sample application here.
http://cid-29f099c37b76ca59.office.live.com/self.aspx/Blog/Code%20Guide/Windows%20Presentation%20Foundation/RemoveTitleBarWPF.zip

If you have any questions, please feel free to contact me at guohong@limguohong.com

SQL Cheat Sheet

0

Digged out by DBSY ( Database System ) notes from Temasek Polytechnic. I realised that I need to refer to this once in a while. Good to post this out for easy reference. Will update this when I see a need to. If you have feedback on this, please feel free to contact me using the contact me form or email me at guohong@limguohong.com

SELECT
[ALL | DISTINCT | DISTINCTROW ]
column name, …
[FROM table name]
[WHERE where_condition]
[GROUP BY { column name | expr | position}]
[HAVING where_condition]
[ORDER BY { column name | expr | position}]
[ASC | DESC], …]
[LIMIT {[offset,] row_count | row_count OFFSET offset}]

INSERT INTO [table name]
[(

{,
}) ]
VALUES
([constant value] , {[constant value]} ){,([constant
value]{[constant value]})} [select statement])

DELETE FROM
[table name]
[WHERE [selection condition]]

UPDATE [tablename]
SET <column name>=<value expression> {, <column name>=<value expression>}
[WHERE <selection condition>]

Subquery Syntax

SELECT [DISTINCT] select_list
FROM table_list
WHERE
{expression {[NOT] IN | comp_op {ANY|ALL|SOME]} | [NOT] EXISTS}
(SELECT DISTINCT
subquery_select_list
FROM table_list WHERE conditions)
[GROUP BY group_by_list [HAVING conditions]]
[ORDER BY order_by_list]]

C# SQL Connection Code

public void ConnectToDatabase()
{

//string connectionString = “”;
//string connectionString = ConfigurationManager.ConnectionStrings["wcfConn"].ToString();

if (conn.State != ConnectionState.Open)
{
conn.ConnectionString = connectionString;
conn.Open();
comm.Connection = conn;
}
comm.Parameters.Clear();
}

If you do it from code behind, it will look something like this,

data source={INSERT IP / localhost here };initial catalog={insert database name here};User ID={insert user id here};Password={Insert Password here}

If you insert from web.config, it will look something like this,

<connectionStrings>
<add name="wcfConn"
connectionString="data source={Insert IP/localhost};initial catalog={Insert database name};User ID={Insert username here};Password={Insert Password here};"
providerName="System.Data.SqlClient" />
</connectionStrings>

Microsoft Office 2010 – Removing picture background

0

I have made a screencast to show how do we use the background removal feature in Microsoft Office 2010. This is one of the more common questions which teachers asked me when we were presenting at Yishun Town Secondary School

If you want to give it a try, you can download the sample files from here
http://cid-29f099c37b76ca59.office.live.com/self.aspx/Blog/Office%20Demo/Remove%20Background%20Sample.zip

Should you have any question, please feel free to contact me at guohong@limguohong.com

Microsoft Excel 2010 – Combining 2 charts into one ( Using same data source )

0

I have made a screencast to show how we can combine 2 chart types into one chart when we are using the same data source. This is one of the questions posed to me when we were at Yishun Town Secondary School.

Microsoft Excel 2010 – Combing 2 charts into one ( Using same data source )
If you are looking for different data source, please look here
http://blogs.office.com/b/microsoft-excel/archive/2007/08/24/combining-chart-types-adding-a-second-axis.aspx

You can download the sample file here :
http://cid-29f099c37b76ca59.office.live.com/self.aspx/Blog/Office%20Demo/Double%20Chart%20Sample.xlsx

Should you have any question, please feel free to contact me at guohong@limguohong.com

Microsoft Excel 2010 – Protecting selected cells

3

I was at Yishun Town Secondary School the other day to assist on the Gerald, Microsoft School Technology Innovation Center Manager, presentation on a hands on session for Microsoft Office techology.

We were posed some questions, I realised that it is useful to post some of them in a form of guide here so it will help teachers. How do we protect some cells and not allow editing on them while allowing some others to be edited. It will be useful when ICT HODs or teachers want to do up an excel document with the formulas and wish to send to his/her team to use but they do not want them to mess it up.


1. First, lets open up Microsoft Excel 2010.


2. In this example, we will add first and second column and show the result in the third column.
Select A3, go to Formulas tab > AutoSum > Sum


3. Select A1 and A2 for your data range.


4. On the bottom right of the cell, you will see a enlarged black dot, click on it and drag it all the way down to 20th row. ( In this example, we will just make use of 20 rows for the calculation. )


5. You will see something like this.


6. Right click on the 20 cells and go to Format Cells


7. Go to Protection and make sure Locked is ticked. This means these cells are not allowed to be edited.


8. Now Select A1 to B20


9. Right click on the selected cells and go to Format Cells


10. Go to the Protection Tab and untick Locked ( This means these cells can be edited )


11. You might want to color the cells so that your end user will know that these cells can be edited by going to Home tab > Cell Styles > choose Input.


12. Go to Review tab > Protect Sheet


13. Input a password into the dialog box which appears. Please remember the password as you require that to unlock.


14. Another dialog box will appear to confirm the password, input the same password in again.


15. Try inputing values in A1-B20 and you will realised that you can do it but you cant do it when you try on other cells.

This concludes the tutorial on how do you protect selected cells in Microsoft Excel 2010. I have attached the sample document which you can download and have a look.

http://cid-29f099c37b76ca59.office.live.com/self.aspx/Blog/Office%20Demo/Protecting%5E_Selected%5E_Cells.xlsx

Should you have any question, please feel free to contact me at guohong@limguohong.com

Comprehensive guide to development resources for Windows Phone

0

AppHub had just created 22 scenario focused web pages for developers. It provides a comprehensive view of all the resources available for Windows Phone 7 development. I figured that this will be interesting and useful for developers like you and me.

We can see this here, http://create.msdn.com/en-us/education/basics/developer_resources

Silverlight for Windows Phone
XNA Game Studio and XNA Framework
Windows Phone Developer Tools and Device Unlock
User Experience and User Interface
Application and Execution Model
Input, Touch and Gestures
Launchers and Choosers
Security
Frame and Page Navigation
Isolated Storage
Performance
Advertising Services
Camera and Photos
Media – Audio and Video
Push Notifications and Live Tiles
App Bar and Controls
Location and Mapping
Networking and Web Services
Sensors
Globalization and Localization
Porting Your App or Game to Windows Phone 7
Application Publishing and Marketplace

code::XtremeApps: 2011

0

The codeXtremeApps competition is back again in 2011!

http://www.itsc.org.sg/index.php?option=com_eventbooking&task=view_event&event_id=36&Itemid=41

They are going to have their launch at SMU! Go and register if you are interested!! I joined last year, you can see some of the blogpost written about the competition here : http://www.limguohong.com/tag/codextremeapps/

http://www.itsc.org.sg/index.php?option=com_eventbooking&task=individual_registration&event_id=36&Itemid=41

 

Programme
Time Title Presentation
14:30-15:00 Registration and Refreshment
15:00-15:10 Opening Addreess

by Ms Tham Ai Chyn, Deputy Chairman, ITSC

15:10-15:40 Code::XtremeApps:: Junior Category – What Is It?

by Dr Bimlesh Wadha, Chair, code::XtremeApps:: Junior Category Subcommittee

15:40-15:55 Code::XtremeApps:: Open Category – What Is It?

by Dr Benjamin Gan, Co-Chair, code::XtremeApps:: Open Category Subcommittee

15:55-16:10 HTML5 and code::XtremeApps:: What Is It To Me?

by Mr Low Chin Chau, Chief Technical Officer, Unifinity Pte Ltd

16:10-16:25 How To Prepare For code::XtremeApps:: Competition – The Big Clue

 

16:25-17:00 Q & A

Some pictures!

Quick fix – WCF HTTP Error 404.3 – Not Found Error

0

Recently one of our client faced with a problem when he tried to open up the WCF after deploying, he checked and realised that he has the WCF features turn on and also .NET framework turn on but he is still getting a 404.3 error. What happened may be because the WCF services is not registered.

Open up command prompt in admin mode and run this after changing directory to the Windows Communication Foundation folder

ServiceModelReg -i

Example :

cd C:\Windows\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\ ServiceModelReg -i

This fixed the problem. :)

Error reporting for Windows Phone 7 : Little Watson

0

I was looking through some resources and found this interesting bit written by a Microsoft developer working for mobile. He written it for his personal use and he is kind enough to release it to the community.

Link : http://blogs.msdn.com/b/andypennell/archive/2010/11/01/error-reporting-on-windows-phone-7.aspx

What he really did was actually to call the methods he had written in Application_UnhandledException and RootFrame_NavigationFailed in App.xaml.cs and this code bit will actually send an email to the email you specific with the stack trace and the error.

Simple and useful!

Thanks Andy.

Quick fix – Cant host WCF on IIS 7.5

0

Will be writing quick fix that fixes my problem that I faced daily here.

I was trying to host my WCF written on top of .NET Framework 4. When I am hosting it up, i got this error
” HTTP Error 500.21 – Internal Server Error
Handler “svc-Integrated” has a bad module “ManagedPipelineHandler” in its module list”

After some search, i realised I have to install asp.net on the server by running Visual Studio Command Prompt in Administrator mode with this.

aspnet_regiis.exe -i

Go to Top