Sharing knowledge in Project, Program, Portfolio Innovation Management (PPIM) and various Technology.
Tuesday, December 29, 2009
Silver light 2.0 Timer
To create timer have to use Dispatchtimer in System.Windows.Threading.
Go through the below example.
<Canvas>
<Canvas.Resources>
<Storyboard x:Name="Timer">
<DoubleAnimation Storyboard.TargetName="rectTimer" Storyboard.TargetProperty="Width" BeginTime="0:0:0" Duration="2"></DoubleAnimation>
</Storyboard>
</Canvas.Resources>
<Rectangle Loaded="rectTimer_Loaded" Visibility="Collapsed" x:Name="rectTimer">
</Rectangle>
</Canvas>
private void rectTimer_Loaded(object sender, RoutedEventArgs e)
{
System.Windows.Threading.DispatcherTimer myDispatcherTimer = new System.Windows.Threading.DispatcherTimer();
myDispatcherTimer.Interval = new TimeSpan(0, 0, 0,1, 100);
myDispatcherTimer.Tick +=new EventHandler(myDispatcherTimer_Tick);
myDispatcherTimer.Start();
}
void myDispatcherTimer_Tick(object sender, EventArgs e)
{
HtmlPage.Window.Alert("TickEvent");
}
Monday, December 28, 2009
Making Transparent In Silverlight..
Example:
<Grid x:Name="LayoutRoot" Background="{x:Null}">
How do we extract "XAP" file in Silverlight?
It's like archive and contains all the resources of silverlight application.
How do we extract xap file?
Step1:
Copy the xap file from clientBin and store in desktop of your machine.
step2:
change the extension in to zip
Example:
test.xap
test.xap.zip
Now you can extract the file.
it's contains one dll and asemblymanifest.info
Event Handler Using Silverlight
event dynamically. It's usefull for dynamically craeate controls.
Example:
<Button Name="btnTest" Content="Test" Width="100" Background="Blue" Margin="1" Height="25"></Button>
public Page()
{
InitializeComponent();
btnTest.Click += btnTest_Click; //Attach Event
btnTest.Click -= btnTest_Click; //Detach Event
}
void btnTest_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show("Hi How are you");
}
What is use of AppManifest.xml and Assemblyinfo.cs in Silverlight
App(Application) Manifest.
This is the place where we can find the list of assemblies used in the application.
Location Path:Properties/AppManifest
ApplicationInfo
It's contains the information about the project like version, name and publisher.
Location: Properties/Assemblyinfo.cs
Wednesday, December 23, 2009
HtmlPage.Window.Invoke in Silverlight
This method will invoke the javascript method from code behind.
Example
Page.xaml
<UserControl x:Class="_22Dec2009.Page" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="1024" Height="800"> <Grid x:Name="LayoutRoot" Background="White"> <Border BorderThickness="2" BorderBrush="AliceBlue" CornerRadius="2" Margin="3"> <Button x:Name="Test" Click="Button_Click" Content="Test" Background="AliceBlue" Width="30" Height="20"> </Button> </Border> </Grid></UserControl>
Page.xaml.cs
This is code it will call the javascript method.
private void Button_Click(object sender, RoutedEventArgs e)
{ HtmlPage.Window.Invoke("getAlert", false); }
Default.aspx
<script language="javascript">
function getAlert() {
alert("sdf"); } </script>
Have you noticed in the eventargs. here in silverlight different..
Note:
Also we can call the javascript method throgh this code.
HtmlPage.Window.CreateInstance("getAlert", false);
happy coding! Enjoy
Response Redirect in Silverlight.
here in silverlight we have to use below code navigate to from one pages to another pages.
in the code we can mention target as well as browser features like height width....
Example
HtmlPage.Window.Navigate(new Uri("http://www.google.com"),"_blank","width:100,height:20");
Full Screen Options in Silverlight.
This is namespace have to use for the making the full screen.
System.Windows;
Example code is
Application.Current.Host.Content.IsFullScreen=!Application.Current.Host.Content.IsFullScreen
Wednesday, December 16, 2009
Content Delivery Network.
when end user accessing this site it has to travel through wire from few hundred miles to thousand miles.for avoiding these microsoft come up with new network called "Content Delivery Network".
if we use this in our project the performance will increase.
let me explain how it will increase the performance. suppose if you are accessing the site in India.
Content delivery network will find the shortest distance network and then it will load the all library files.
Instead of loading from one place.
Example:
<script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
instead of mentioning our own path
Wednesday, December 2, 2009
Materialized Views in Oracle
Materialized view is a database object that contains the result of a query (it actually contains the rows).
SQL> create materialized view mview
2 build immediate
3 refresh complete on demand
4 as select count(1) from
5 (select state,zip,city,count(1) from mv_test1 group by state,zip,city);
Materialized view created.
Depends on the REFRESH mode specified MV will be refreshed ON DEMAND, ON COMMIT or at specific time.
Advantage:
Main advantage is Improved query perfomance.
Example:
Same query which is used to create the MV is executed here and it took 1.26 secs.
SQL> select count(1) from
2 (select state,zip,city,count(1) from mv_test1 group by state,zip,city);
COUNT(1)
----------
347
Elapsed: 00:00:01.26.
But selecting from MV took 0.01 seconds.
SQL> select * from mview ;
COUNT(1)
----------
347
Elapsed: 00:00:00.01
Disadvantage:
If you use refresh option as ON COMMIT and the MV is created on a transaction table which go through several DML operations, DB resources will be utilized to refresh the MV, and in turn it will slow down the db performance.