0

ASP.NET 4.0 ScriptManager Improvements

Posted by InfinitiesLoop on Nov 23, 2009 in ASP.Net, Ajax, Dotnet, Javascript  | View Original Article
 .NET Framework 4 Beta 2 has been out for a little while now. There are some subtle improvements to the ScriptManager control in ASP.NET 4.0 that few have picked up on yet. Allow me to introduce you to them! First, let me say that this is strictly about...(read more)

Tags:

 
0

JQuery Validator plus Element IDs, and Names

Posted by Chris Brandsma on Nov 23, 2009 in Dotnet  | View Original Article
 

OK, just discovered an interesting implementation detail of JQuery Validator (one that I should have known about already as well).

OK, if you have a form where the inputs of the for have both id and name  attributes, the name attributes trump id.

So if you have this:

   1: <input type='type' id='RegisterUserName' name='userName' />

Then you write the validation against ‘user’Name’, not ‘RegisterUserName’.

   1: $("RegisterForm").validate({

   2:     rules: { userName: {required: true} }

   3: });

If you do not you will get all sorts of strange null exception errors (which in JavaScript means something returned as ‘undefined’.

How this happens

People have been talking about the great flexibility of Asp.Net MVC for a while now, but there are a few things to be aware of.  One of them is multiple forms. 

Say you have a web page that has two forms on it, one to register users, the other to log users in.   Both forms have ‘username’ and ‘password’ fields.   Asp.Net MVC still cannot get you around the need to keep ids unique – but names can be reused.   These names are also read by Asp.Net Action Controllers.  So if you have multiple forms all submitting to the same Controller Action, as long as the name attributes are set it will hook up.

Anyway, this is a short post, mostly for myself, so I don’t spend two hours figuring this out again.

Tags:

 
0

A few issues with Silverlight 4 after Installing Visual Studio 2010

Posted by Al on Nov 23, 2009 in Dotnet  | View Original Article
 

Silverlight 4 beta just came out and is better than I expected. This is the first post of many about my experience with this beta and the road blocks I’ll find during my expedition. This version of Silverlight is without any doubt brilliant as well as all the features that are coming out in the release are beyond my expectations.

After installing Visual Studio 2010 I received this “successful” error message.

image

 

I installed Silverlight 4 beta without any issue, fast and straight forward.

image

 

After installation you can see the projects you can build, .NET RIA Services  WCF RIA Services are out of the box.

image

 

When creating a new project now you have the choice to target different Silverlight versions.

image

 

So far so good, issues I found in the beta up to this point.

  • Roadblock testing the COM interop

Error    1    One or more types required to compile a dynamic expression cannot be found. Are you missing references to Microsoft.CSharp.dll and System.Core.dll?  

When adding a reference to the project I get an empty box.

image

If I look at the directory where the dlls are installed

“C:\Program Files\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0”

I cannot find the Microsoft.CSharp.dll I can only find Microsoft.VisualBasic.dll to use. Where is the C# dll located for Silverlight 4? I wasn’t able to find it on my computer.

 

  • Testing the Printing API

When using the printing api, I don’t get access to the raw image that is going to send to the printer, you can pass the objects to print and the API will take care of sending it to the printer, I was expecting to get access to the preview to be able to modify the output if need it.

 

  • Hosting HTML content

I can only host HTML using the WebBrowser tag when running the Silverlight app in fully trusted mode. Otherwise if not I get a HTML disabled control.

<WebBrowser x:Name="MyBrowserControl" Visibility="Collapsed" Width="700" Height="500" />

image

Hope this helps to other people “playing” with Silverlight 4.

Cheers

Al

Follow me in twitter | bookmark me | Subscribe to my feed | Add stats to your blog

 

Tags:

 
0

Silverlight 4 Beta – Using Silverlight as Drop Target

Posted by Brian Lagunas on Nov 23, 2009 in Dotnet  | View Original Article
 

Have you ever wanted to give the user the ability to drag a file from you desktop or file explorer onto your Silverlight application? Well, up until now you couldn’t. What’s that sound? It’s a bird… it’s a plane… no, it’s Silverlight 4 Beta.  Yes, Silverlight 4 Beta is coming to the rescue and giving you the ability to have your Silverlight application act as a drop target. And it is so easy to do. Observe.

First just identify the UI element you want to use as the drop target, then set the AllowDrop property to true. Then just handle the Drop events.

Here is a quick example. This examples allows a user to drag a bitmap from their file system into my application and displays the images in a ScrollViewer. Here is the XAML

<StackPanel x:Name="LayoutRoot" Background="White">

    <TextBlock Text="Drop image below." FontSize="16" FontWeight="BOld" HorizontalAlignment="Center" />

    <ScrollViewer x:Name="ImagesTarget" Background="White" Width="800" MinHeight="300" 

                  VerticalScrollBarVisibility="Hidden" HorizontalScrollBarVisibility="Auto" AllowDrop="True">

            <ItemsControl x:Name="ImageList">

                <ItemsControl.ItemTemplate>

                    <DataTemplate>

                        <Image Source="{Binding}" Margin="5" Stretch="UniformToFill" Height="240" />

                    </DataTemplate>

                </ItemsControl.ItemTemplate>

                <ItemsControl.ItemsPanel>

                    <ItemsPanelTemplate>

                        <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center"/>

                    </ItemsPanelTemplate>

                </ItemsControl.ItemsPanel>

            </ItemsControl>

        </ScrollViewer>

</StackPanel>

I create a ObservableCollection of bitmap images and use this as the ItemsSource for the ScrollViewer.

ObservableCollection<BitmapImage> _images = new ObservableCollection<BitmapImage>();

I hook into the Drop event in the load event of the form.

ImagesTarget.Drop += new DragEventHandler(ImagesTarget_Drop);

Now lets implement the Drop event to loop through all the files and add them to the list.

void ImagesTarget_Drop(object sender, DragEventArgs e)

{

    if (e.Data == null)

        return;

 

    IDataObject dataObject = e.Data as IDataObject;

    FileInfo[] files =

      dataObject.GetData(DataFormats.FileDrop) as FileInfo[];

 

    foreach (FileInfo file in files)

    {

        try

        {

            using (var stream = file.OpenRead())

            {

                var imageSource = new BitmapImage();

                imageSource.SetSource(stream);

                _images.Add(imageSource);

            }

        }

        catch (Exception)

        {

            MessageBox.Show("Not a suppoted image.");

        } 

    } 

}

Bingo… Bango… Boom, that is all there is to it. And of course, you can handle the other drag events to have more control over what is being dropped and where.

Download the Source

Tags: , ,

 
0

Is Microsoft Taking Dynamic Languages Seriously?

Posted by K. Scott Allen on Nov 23, 2009 in Dotnet  | View Original Article
 

Specifically IronPython and IronRuby.

Consider this …

  • IronPython got underway in July of 2004. Five years later it appears IronPython is still not a candidate to be a first class language in the .NET framework and tools. You can vote on this issue.
  • Microsoft first released IronRuby at Mix in 2007. Nearly three years later it appears IronRuby is still not a candidate to be a first class language in the .NET framework and tools. You can vote on this issue.

A first class language is deployed when the full .NET framework is installed. It’s as easy to find as csc.exe. It’s not a language you have to ask the IT department to install separately. It’s not a language that requires you to jump out of Visual Studio to edit or run.

Most of all, a first class language doesn’t require justification to higher powers. A first class language is pre-certified and stamped with a seal of approval. It’s as easy to use in the locked-down big corporate setting as the company paper shredder.

shredder

The DLR and the PDC

I was depressed when I read the session list from Microsoft’s recent Professional Developers Conference. If you browse the session list you’ll find hundreds of sessions covering cloud computing, Sharepoint, Silverlight, SQL Server, and modeling. There are a handful of sessions covering concurrency, and a few dedicated to C++.

There is exactly one session featuring the Dynamic Language Runtime in a significant fashion. The title is Using Dynamic Languages to Build Scriptable Applications. You can learn how to augment an existing application after you’ve done all the real work in a first class language.

Perhaps Microsoft is just hedging their bets, but it’s clear that that dynamic languages aren’t high on the priority list. Maybe they’ll be first class citizens one day, but many developers are tired of waiting.

P.S. Is Managed JScript dead?

 
0

Silverlight 4 Beta – Text Trimming

Posted by Brian Lagunas on Nov 23, 2009 in Dotnet  | View Original Article
 

Before Silverlight 4 if you wanted to dynamically add ellipses (the commonly used … to show that the sentence continues), you have to invent your own implementation which usually involves creating your own control that wraps a text based control and then manipulate the text inside based on the size.  Similar to what Robby Ingebretsen had to do here.

Well, that is no longer the case. Introducing Text Trimming.

<TextBlock FontSize="16"

           TextTrimming="WordEllipsis"

           Text="A man is known by the company he keeps."

           Width="120"/>

Displays as: “A man is…”

This is a nice addition to the Silverlight framework.

Tags: ,

 
0

Silverlight Podcast: Expression Encoder 3

Posted by Silverlight Team on Nov 23, 2009 in Miscelleneous  | View Original Article
 

Our second Silverlight podcast features an interview with James Clarke of the Expression Encoder team. Learn about how Encoder works, screen capture and its object model.

There are two versions:
 
Enhanced AAC file for iPod: click here
Standard MP3 file: click here
 
By downloading and listening to these podcasts, you agree to our Terms of Use.


Tags:

 
0

Showcase of Beautiful Typography in Web Design

Posted by vitaly on Nov 23, 2009 in Design & Graphics  | View Original Article
 


By Callum Chapman

Everybody loves a nice bit of typography. This year we have seen some absolutely stunning typographic layouts used in print, web and game design. Using typography in web design can really help to spice things up, so take a look through these beautiful examples of typography used in modern web design to help inspire you when it comes to producing your own typography based designs for the web.

There are many different styles that are used nowadays when it comes to typography in web design – a lot of them are put into place in minimalistic and simple designs such as ALGA New Yorks, Buddy Carrs Skateboards and Corking Designs website, all of which use large, bold lettering on a simplistic design which typically uses no more than 3 or 4 colors.

Huge lettering doesn’t stop there though: Gummisig’s portfolio uses a great combination of large type and highlighted links with colorful textured backgrounds, and Hull Digital use a large sketched effect heading which goes great with the other hand-drawn elements of the website and its overall ‘noisy’ background image. The effect now referred to as ‘the letterpress effect’ can also be seen in several designs, such as Alonso Creative Blog and Epic Event. Chris Spooner has a great showcase of the letterpress text effect used in web design, followed by a short tutorial on how to create this trendy effect yourself.

Jam Hot is just one of the many in this showcase that uses incredible Flash effects to produce awesome animated typography combined with great illustration – a real eye opener! Another great Flash-enabled website is JLern, who use beautiful effects that cause the entire page to rotate depending on where your mouse cursor is located.

Beautiful Typography in Web Design

Oliver Kavanagh

Oliverkavanagh in Showcase of Beautiful Typography in Web Design

Fray

Fray in Showcase of Beautiful Typography in Web Design

Gummisig

Gummisig in Showcase of Beautiful Typography in Web Design

Finch Blog

Finch in Showcase of Beautiful Typography in Web Design

NY Moon Radio

Nymoonradio in Showcase of Beautiful Typography in Web Design

Darren Hoyt

Darrenhoyt in Showcase of Beautiful Typography in Web Design

Demotive

Demotive in Showcase of Beautiful Typography in Web Design

Jam Hot

Jamhot in Showcase of Beautiful Typography in Web Design

Jason Santa Maria

Jasonsantamaria in Showcase of Beautiful Typography in Web Design

Eight Hour Day

Eighthourday in Showcase of Beautiful Typography in Web Design

Kay Times Two

Kaytimestwo in Showcase of Beautiful Typography in Web Design

Kidd81

Kidd81 in Showcase of Beautiful Typography in Web Design

Epic Event

Epicevent in Showcase of Beautiful Typography in Web Design

Kyle Standing

Kylestanding in Showcase of Beautiful Typography in Web Design

Lord Likely

Lordlikely in Showcase of Beautiful Typography in Web Design

Mana Catalogues

Manacatalogues in Showcase of Beautiful Typography in Web Design

Matt Haltom

Matthaltom in Showcase of Beautiful Typography in Web Design

Meinl Percussion

Meinlpercussion in Showcase of Beautiful Typography in Web Design

Fernado Silanes

Fernandosilanes in Showcase of Beautiful Typography in Web Design

Adlucent

Adlucent in Showcase of Beautiful Typography in Web Design

ALGA New York

Alganewyork in Showcase of Beautiful Typography in Web Design

All Things Heart & Home

Allthingsheartandhome in Showcase of Beautiful Typography in Web Design

Alonso Creative Blog

Alonsocreativeblog in Showcase of Beautiful Typography in Web Design

Beautiful/Decay

Beautifuldecay in Showcase of Beautiful Typography in Web Design

Blog Me Tender

Blogmetender in Showcase of Beautiful Typography in Web Design

Bloom

Bloom in Showcase of Beautiful Typography in Web Design

Brad Frost Web

Bradfrostweb in Showcase of Beautiful Typography in Web Design

Buddy Carr Skateboards

Buddycarrskateboards in Showcase of Beautiful Typography in Web Design

Corking Design

Corkingdesign in Showcase of Beautiful Typography in Web Design

Elysium Burns

Elysiumburns in Showcase of Beautiful Typography in Web Design

Festival Boreal

Festivalboreal in Showcase of Beautiful Typography in Web Design

Hatch

Hatch in Showcase of Beautiful Typography in Web Design

Hello Monday

Hellomonday in Showcase of Beautiful Typography in Web Design

Hull Digital Live 09

Hulldigitallive in Showcase of Beautiful Typography in Web Design

Jessica Hische

Jessicahische in Showcase of Beautiful Typography in Web Design

Jlern Design

Jlerndesign in Showcase of Beautiful Typography in Web Design

Kuredu Island Resort

Kureduislandresort in Showcase of Beautiful Typography in Web Design

Mobily

Mobily in Showcase of Beautiful Typography in Web Design

Moof

Moof in Showcase of Beautiful Typography in Web Design

Mulletized

Mulletized in Showcase of Beautiful Typography in Web Design

Mutant Labs

Mutantlabs in Showcase of Beautiful Typography in Web Design

Mational Television

Nationaltelevision in Showcase of Beautiful Typography in Web Design

Nice Web Type

Nicewebtype in Showcase of Beautiful Typography in Web Design

Nosotros

Nosotros in Showcase of Beautiful Typography in Web Design

One Blog

Oneblog in Showcase of Beautiful Typography in Web Design

Pixel Craft

Pixelcraft in Showcase of Beautiful Typography in Web Design

Polargold

Polargold in Showcase of Beautiful Typography in Web Design

Questionable Characters

Questionablecharacters in Showcase of Beautiful Typography in Web Design

Rut Med Flera

Rutmedflera in Showcase of Beautiful Typography in Web Design

Ryan Keiser

Ryankeiser in Showcase of Beautiful Typography in Web Design

Shirt Out Loud

Shirtoutloud in Showcase of Beautiful Typography in Web Design

Siete De Febrero

Sietedefebrero in Showcase of Beautiful Typography in Web Design

Smash

Smash in Showcase of Beautiful Typography in Web Design

SOAS Design

Soasdesign in Showcase of Beautiful Typography in Web Design

Spark Capital

Sparkcapital in Showcase of Beautiful Typography in Web Design

SR Burns

Srburns in Showcase of Beautiful Typography in Web Design

St Andrews Church

Standrewschuch in Showcase of Beautiful Typography in Web Design

Strip Turnhout

Stripturnhout in Showcase of Beautiful Typography in Web Design

Supernormal

Supernormal in Showcase of Beautiful Typography in Web Design

Switch Mediaworks

Switchmediaworks in Showcase of Beautiful Typography in Web Design

Things That Are Brown

Thingsthatarebrown in Showcase of Beautiful Typography in Web Design

This & That

Thisandthat in Showcase of Beautiful Typography in Web Design

T-Post

Tpost in Showcase of Beautiful Typography in Web Design

Trent Walton

Trentwalton in Showcase of Beautiful Typography in Web Design

Twirkethic

Twirkethic in Showcase of Beautiful Typography in Web Design

Gaby Castellanos

Gabycastellanos in Showcase of Beautiful Typography in Web Design

Type Jockeys

Typejockeys in Showcase of Beautiful Typography in Web Design

Washtenaw Community College

Washtenawcommunitycollege in Showcase of Beautiful Typography in Web Design

World Nude Day

Worldnudeday in Showcase of Beautiful Typography in Web Design

Wrangler Face Off

Wranglerfaceoff in Showcase of Beautiful Typography in Web Design

Yellow Bird Project

Yellowbirdproject in Showcase of Beautiful Typography in Web Design

You Know Who Design

Youknowwhodesign in Showcase of Beautiful Typography in Web Design

Yuru Inspires

Yurublog in Showcase of Beautiful Typography in Web Design

Zen Desk

Zendesk in Showcase of Beautiful Typography in Web Design

Some other articles you may enjoy…

Tags: ,

 
0

Silverlight 4 Beta – Accessing a users webcam and microphone

Posted by Brian Lagunas on Nov 23, 2009 in Dotnet  | View Original Article
 

So, by now you should have heard that Silverlight 4 Beta was released at PDC 2009. One of the most interesting and fun features included in the release is the ability for you to access a users webcam and microphone. So I am going to show you have to access a list of webcams and microphones, capture video, and then take pictures and show them to the user.  But, before I can show you how to use them, you have to have the Silverlight 4 Beta framework installed.

Start here:

You can either download the source and start playing around immediately, or you can read through the post and then download the source.

First off lets start out with our view box (this spot is where our video will be shown). First create a rectangle and give it a meaningful name. I called mine ViewBox. Make it the size of the video you want to show, as you can see mine is 640×480.

<Rectangle x:Name="ViewBox" Width="640" Height="480" Fill="White"/>

Now lets create some combo boxes to show the available webcams and microphones on the users machine. I created a item template and used the FriendlyName as the binding text. The FriendlyName is the name/description of the device.

<TextBlock Margin="5" HorizontalAlignment="Center" Text="WebCam" Grid.Column="0" Grid.Row="0" />

<ComboBox x:Name="WebCamList" Grid.Row="1" Grid.Column="0">

    <ComboBox.ItemTemplate>

        <DataTemplate>

            <TextBlock Text="{Binding FriendlyName}" />

        </DataTemplate>

    </ComboBox.ItemTemplate>

</ComboBox>

 

<TextBlock Margin="5" HorizontalAlignment="Center" Text="Microphone" Grid.Column="1" Grid.Row="0" />

<ComboBox x:Name="MicrophoneList" Grid.Row="1" Grid.Column="1">

    <ComboBox.ItemTemplate>

        <DataTemplate>

            <TextBlock Text="{Binding FriendlyName}" />

        </DataTemplate>

    </ComboBox.ItemTemplate>

</ComboBox>

Now lets create some buttons to start capturing our video, stop capturing the video, and one to take some pictures.

<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">

   <Button Margin="5" x:Name="btnStartCapture" Content="Start Capture" Click="btnStartCapture_Click" />

   <Button Margin="5" x:Name="btnStopCapture" Content="Stop Capture" Click="btnStopCapture_Click" />

   <Button Margin="5" x:Name="btnTakePicture" Content="Take Picture" Click="btnTakePicture_Click" />

</StackPanel>

Next, lets create a scroll viewer to hold a collection of pictures we take.

<ScrollViewer Width="800" VerticalScrollBarVisibility="Hidden" HorizontalScrollBarVisibility="Auto">

   <ItemsControl x:Name="Pictures">

       <ItemsControl.ItemTemplate>

           <DataTemplate>

               <Image Source="{Binding}" Margin="5" Stretch="UniformToFill" Height="240" />

           </DataTemplate>

       </ItemsControl.ItemTemplate>

       <ItemsControl.ItemsPanel>

           <ItemsPanelTemplate>

               <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center"/>

           </ItemsPanelTemplate>

       </ItemsControl.ItemsPanel>

   </ItemsControl>

</ScrollViewer>

Now that we have our UI finished up we need to start adding some code.  The first thing we need to do is create some private members.  Once will be our capture source and the other will be a collection to hold our pictures. I am using an ObservableCollection so I don’t have to worry about manually update the UI when items are added to it.

CaptureSource _captureSource;

ObservableCollection<WriteableBitmap> _pictures = new ObservableCollection<WriteableBitmap>();

Now that we have our private members, lets hook into the form’s loaded event and add some code. The first thing we need to do is create a new instance of our capture source. Next, we get a list of all our available webcams and microphones and add them to our combo boxes accordingly. Last we set the Pictures ScrollViewer items source to our private member _pictures. You should have something like the following.

void MainPage_Loaded(object sender, RoutedEventArgs e)

{

    // creating a new capture source

    _captureSource = new CaptureSource();

 

    // get list of the web cams

    WebCamList.ItemsSource = CaptureDeviceConfiguration.GetAvailableVideoCaptureDevices();

    WebCamList.SelectedIndex = 0;

 

    // get list of microphones

    MicrophoneList.ItemsSource = CaptureDeviceConfiguration.GetAvailableAudioCaptureDevices();

    MicrophoneList.SelectedIndex = 0;

 

    Pictures.ItemsSource = _pictures;

}

 

Now, lets handle the click event for our start capturing button. First thing we hav to do is stop and device that may be capturing. Now, we need to set our capture source’s video and audio capture instances from the available options in our combo boxes. We need to create a VisualBrush, this is what will be the video. We create a new instance of the VisualBrush and set the source to our captureSource. Next, we set the Fill of our rectangle to the VisualBrush.  now, the magic does happen until the next part. You need to request permission from the user to use their webcam. Once you have it you just start capturing.

private void btnStartCapture_Click(object sender, RoutedEventArgs e)

{

    if (_captureSource != null)

    {

        // stop whatever device may be capturing

        _captureSource.Stop();

 

        _captureSource.VideoCaptureDevice = (VideoCaptureDevice)WebCamList.SelectedItem;

        _captureSource.AudioCaptureDevice = (AudioCaptureDevice)MicrophoneList.SelectedItem;

 

        VideoBrush vidBrush = new VideoBrush();

        vidBrush.SetSource(_captureSource);

        ViewBox.Fill = vidBrush;

 

        // request access to webcam and audio devices

        if (CaptureDeviceConfiguration.AllowedDeviceAccess || CaptureDeviceConfiguration.RequestDeviceAccess())

        {

            _captureSource.Start();

        }

    }

}

Now, lets handle the stop capture buttons click event. This basically halts all video capturing and is very easy to implement.

private void btnStopCapture_Click(object sender, RoutedEventArgs e)

{

   if (_captureSource != null)

   {

       _captureSource.Stop();

   }

}

The last thing we need to do is enable taking pictures. So, handle the click event for the take picture button. Luckily for us, the capture source has built in support for capturing images asynchronously.

private void btnTakePicture_Click(object sender, RoutedEventArgs e)

{

   if (_captureSource != null)

   {

       _captureSource.AsyncCaptureImage((image) =>

       {

           _pictures.Add(image);

       });

   }

}

That’s it. You have now created your first Silverlight application that can communicate with a users webcam and microphone. Think of all the possibilities.  Download the code, play with it and have fun.

Download Source

Tags: , , ,

 
0

SYS-CON’s Cloud Computing Bootcamp November 2009 Slides

Posted by Latest News from Cloud Computing Journal on Nov 23, 2009 in CLoud Computing, General, Technology News  | View Original Article
 These are copies of the slides from SYS-CON's Cloud Bootcamp held at Cloud Computing Expo at the Santa Clara Convention Center, CA November 2-4, 2009. Tim Crawford: Introduction Glenn Brunette (Sun): Cloud Security Kevin Noonan (Push2Cloud): Google App Engine Jason Christensen (jasonc411): Cloud Computing Mobile

read more

Copyright © 2010 Answer My Query All rights reserved. Maintained by Orange Brains .