This is a mirror of official site: http://jasper-net.blogspot.com/

Dynamic ASP.NET MVC 3 models using Mono’s Compiler as a Service

| Thursday, June 16, 2011
5741600327_140bae7f06.jpg

I had an idea for an interactive MVC sample which will let you see the scaffolded editor and display for a model. I thought about a few ways to do this, the first being Mono’s compiler as a service. So far it’s a partial success – the model scaffolding works, but the attributes don’t (very possibly my mistake).

Getting the latest Mono Compiler
Miguel recommended that I grab the latest Mono build off Github, since there have been some improvements and bug fixes in the compiler. He wasn’t kidding, there’s a lot of active work going on in the compiler, and the Evaluator class (the main compiler service class) is no exception. Here’s the commit history just for the Evaluator (eval.cs):

A quick skim of the mcs (mono csharp compiler) commit messages in general shows a lot of work going on, including work on async: https://github.com/mono/mono/tree/master/mcs/mcs

The biggest change since the last Mono release, as Miguel blogged about in February, is the change from static API to an instance API:

…we turned the static API Evalutor.Eval (string expression), into an instance API. The instance API allows developers that are embedding the C# compiler-as-a-service in their application to have different contexts.

This required the entire compiler to be updated from being a giant set of static classes that could safely use global variables and state into a state that was properly encapsulated.

The API is now richer, we provide a way to configure the compiler settings using a settings class. This can be populated either manually, or by using the build-in command-line parser for compiler options.

This is good news – I find the new API easier to work with. The magical static stateful service API pattern works great for the REPL sample but causes problems if you’re doing anything much more complex. The downside, though, is that just about all the code samples and blog posts on the the Mono compiler service stuff don’t work as-is against the new compiler.

I didn’t want to set up a build environment for Mono. Fortunately, most established open source projects offer regular builds if you look around a bit. I grabbed the most recent MonoCharge package from http://mono.ximian.com/daily/, which includes all the precompiled binaries. They’re packaged as a .tar.gz, which opens up just fine in 7-zip. I just grabbed the Mono.CSharp.dll assembly.

Read more: Jon Galloway

Posted via email from Jasper-net

Ten Caching Mistakes that Break your App

|
Introduction

Caching frequently used objects, that are expensive to fetch from the source, makes application perform faster under high load. It helps scale an application under concurrent requests. But some hard to notice mistakes can lead the application to suffer under high load, let alone making it perform better, especially when you are using distributed caching where there’s separate cache server or cache application that stores the items. Moreover, code that works fine using in-memory cache can fail when the cache is made out-of-process. Here I will show you some common distributed caching mistakes that will help you make better decisions when to cache and when not to cache.

Here are the top 10 mistakes I have seen:
  1. Relying on .NET’s default serializer
  2. Storing large objects in a single cache item
  3. Using cache to share objects between threads
  4. Assuming items will be in cache immediately after storing them
  5. Storing entire collection with nested objects
  6. Storing parent-child objects together and also separately
  7. Caching Configuration settings
  8. Caching Live Objects that have open handle to stream, file, registry, or network
  9. Storing same item using multiple keys
  10. Not updating or deleting items in cache after updating or deleting them on persistent storage
Let’s see what they are and how to avoid them.

I am assuming you have been using ASP.NET Cache or Enterprise Library Cache for a while, you are satisfied, now you need more scalability and have thus moved to an out-of-process or distributed cache like Velocity or Memcache. After that, things have started to fall apart and thus the common mistakes listed below apply to you.

Relying on .NET’s Default Serializer

When you use an out-of-process caching solution like Velocity or memcached, where items in cache are stored in a separate process than where your application runs; every time you add an item to the cache, it serializes the item into byte array and then sends the byte array to the cache server to store it. Similarly, when you get an item from the cache, the cache server sends back the byte array to your application and then the client library deserializes the byte array into the target object. Now .NET’s default serializer is not optimal since it relies on Reflection which is CPU intensive. As a result, storing items in cache and getting items from cache add high serialization and deserialization overhead that results in high CPU, especially if you are caching complex types. This high CPU usage happens on your application, not on the cache server. So, you should always use one of the better approaches shown in this article so that the CPU consumption in serialization and deserialization is minimized. I personally prefer the approach where you serialize and deserialize the properties all by yourself by implementing ISerializable interface and then implementing the deserialization constructor.

Read more: Codeproject

Posted via email from Jasper-net

Using Google Calendar in ASP.NET Website

|
Problem

Google Calendar is used to store concert dates of some famous Russian DJs. The task is to display these dates with titles on the ASP.NET website.

What is Google Calendar?

Google calendar is a free Google service for planning of meetings, events, affairs with a binding to a calendar. It is possible to set a time for a meeting, repetition, a reminder, to invite other participants (service sends the invitation by e-mail). It is possible to create several calendars, each with its own name.

Possible Ways to Solve the Problem

Google has Calendar Data API that allows you to view and update calendar events from your application.

The following Calendar Data API libraries are there:

.NET
Java
JavaScript
PHP
Python
We will use .NET library for our task, because we have ASP.NET application where we need to work with Google Calendar service.

Meaningful Statement of the Problem

Get an array of events from the Google Calendar, using the following information: "Google calendar name", "Google account name", "Google account password".
Display these events on the site.
Solution of the Problem

(1) Get an array of events from the Google Calendar, using the following information: "Google calendar name", "Google account name", "Google account password".

Consider the solution to this problem step by step:

Step 1: Download .NET library for Google data API
You can download the .NET library for Google data API from Google_Data_API_Setup_1.8.0.0.msi. Then, run the installer. The library will be installed into the following folder: C:\Program Files\Google\Google Data API SDK\Redist\.

Step 2: Copy the necessary files to the Web site
Copy the following files from C:\Program Files\Google\Google Data API SDK\Redist\ into Bin folder of the website: Google.GData.AccessControl.dll, Google.GData.Calendar.dll, Google.GData.Client.dll, Google.GData.Extensions.dll.

Next, add the References to these files in the website project.

Go to References-Add Reference-Browse, choose files and press OK.

Read more: Codeproject

Posted via email from Jasper-net

Amalgam: Place FTP as a mapped drive in Explorer

|
This will use Dokan to make (Initially) an FTP target appear as a source drive in Explorer. It will allow Media playback and file updates.
A lot of this work was done to talk to the Liquesce FTP Server, and yet still has to deal with the shortcomings of both FTP and the Dokan driver.

It will use .Net4 x32 Full profile, so will run wherever it is installed.

FAQs
Q Aren't there other free offerings that do this?
A Yes there are, but I was not able to find one that worked reliably and at the full potential of both read and write speeds in Win 7 and above.

Q Why do this?
A I wanted a drive that took an FTP target and placed it into windows as a drive in explorer (and dos); so that Media players could extract data and play large 1080p files without jitter.

Read more: Codeplex

Posted via email from Jasper-net

Silverlight: Interprocess Communication from Silverlight Application

|
Summary: The article shows how to implement communication between Silverlight application and some non-Silverlight application by using Eneter.Messaging.Framework. The example shows Silverlight client invoking requests to the console application. The request can be paused, resumed or cancelled.

There are not many possibilities if you need to implement the communication between Silverlight application and some non-Silverlight application (e.g. standard desktop application).
Basically, you can choose sockets to implement your own communication based on TCP or you can choose WCF to communicate via remote calls.

Another option you can consider is to useEneter.Messaging.Framework. The framework enables you to implement the message based communication scenarios. E.g. Silverlight client can invoke a request and manipulate it with 'pause', 'resume' and 'cancel'. It means the request being processed in the console application can be paused, resumed or cancelled from Silverlight client.

The example below shows how to implement the Silverlight client invoking a request to the non-Silverlight application that can be 'paused', 'resumed' or 'cancelled'.

1. Create Server - Standard Console Application

Create standard console application in Visual Studio and add Eneter.Messaging.Framework.dll to references.
(Full, not limited and for non-commercial usage free version of the framework can be downloaded from www.eneter.net.)

Implement the main method in the following way:

using Eneter.Messaging.MessagingSystems.MessagingSystemBase;

using Eneter.Messaging.MessagingSystems.TcpMessagingSystem;

namespace TcpCommandServer
{
    class Program
    {
        static void Main(string[] args)
        {
            // Start policy server to allow the communication with the Silverlight client.
            TcpPolicyServer aPolicyServer = 
new TcpPolicyServer(System.Net.IPAddress.Loopback);
            aPolicyServer.StartPolicyServer();

            // Create the communication based on Tcp.
            // Note: Silverlight clients can communicate 
            // on the following ports: 4502 - 4532.
            IMessagingSystemFactory aMessagingFactory = new TcpMessagingSystemFactory();
            IDuplexInputChannel aDuplexInputChannel = 
aMessagingFactory.CreateDuplexInputChannel("127.0.0.1:4530");

            // Start listening for requests.
            CommandReceiver aCommandReceiver = new CommandReceiver();
            aCommandReceiver.StartCommandReceiver(aDuplexInputChannel);
        }
    }
}

Note: The policy server listens to port 943 and returns XML telling Silverlight that communication is allowed. The framework returns a basic XML but you can also set your own if it is needed.

Read more: Codeproject

Posted via email from Jasper-net

Debugging Install Functions in Visual Studio 2010

|
Most of us have probably used or know of the System.Diagnostics.Debugger.Break(). For more information on Debugger.Break checkout this link http://msdn.microsoft.com/en-us/library/system.diagnostics.debugger.break.aspx

Online documentation states that if no debugger is already attached, user would be prompted to attach one to executing program when the break is hit. For some reason however, this didn’t work for us when our desired breakpoint was in an OnInstall() function of an installer class.

Further digging revealed that the comments decorating the Break() call differ a bit from the online documentation:

// Summary:
// Signals a breakpoint to an attached debugger.
//
// Exceptions:
//   System.Security.SecurityException:
//     The System.Security.Permissions.UIPermission is not set to break into the
//     debugger.
[SecuritySafeCritical]
public static void Break();
 
Apparently, Break() only signals a breakpoint to an attached debugger as per the summary above.

Read more: Sam Abraham

Posted via email from Jasper-net

Silverlight: Notification Messages from the Server

|
Summary

The article shows how to implement receiving of notification messages from the hosting server in the Silverlight application by using Eneter.Messaging.Framework.

Basically there are two approaches if you need to implement the communication scenario where the Silverlight client needs to be notified about some events on the server:

Polling

The Silverlight client regularly initiates the HTTP connection and asks the server for messages. The server then responses messages intended for the client or returns an empty response if messages are not available (that can be the majority of requests).

The advantage of the polling is that it does not block resources. (The problem is that browsers typically limit the number of concurrent HTTP connections per server to 2 - 8. The polling needs this connection only for short time.)

The disadvantage of the polling is that it can cause a lot of useless communication (in case the majority of requests return the empty response).

Pushing

The Silverlight client initiates the HTTP connection. The server receives the request but does not answer until messages for the client are not available - the connection stays open (that can be a long time). When the server answers, the client processes notifications and initiates the HTTP connection again.

The advantage of the pushing is that there is not a useless communication.

The disadvantage of the pushing is that it consumes the HTTP connection. And because browsers typically limit the number of concurrent HTTP connections per server to 2 - 8, it can happen that connections are occupied and the client application is blocked.

If you prefer to get notification messages based on the pushing, you can choose WCF. The server can implement the service and the Silverlight client can get notification messages via some callback interface.

If you prefer to get notification messages based on the polling, you do not have many possibilities. Probably you would need to implement the communication yourself by using .NET functionality for HTTP. (The client regularly polls and recognizes messages and the server constantly collects messages and responses them to the client on demand. This can easily become quite a complex implementation.)

Read more: Codeproject

Posted via email from Jasper-net

A little collection of cool unix terminal/console/curses tools

|
Just a list of 20 (now 28) tools for the command line. Some are little-known, some are just too useful to miss, some are pure obscure -- I hope you find something useful that you weren't aware of yet! Use your operating system's package manager to install most of them. (Thanks for the tips, everybody!)

dstat & sar
iostat, vmstat, ifstat and much more in one.
dstat_screenshot.png

htop & iotop
Process, memory and io monitoring.
htop_screenshot.png

Read more: Kristóf Kovács

Posted via email from Jasper-net

Be Your Own Bitch

|
Fred Wilson, a prominent figure in the venture capital/investment community was getting interviewed at the TechCrunch Disrupt conference in front of a group of developers and entrepreneurs. As they were talking, the idea of applications for platforms (companies like Facebook, Google, Twitter) came up and Fred told a short story about his experiences with platforms:

Fred – My friend Seth Goldstein had a company called Social Media that built one of the first ad networks on Facebook, and one day Facebook decided they didn’t really want Social Media to exist, and they didn’t.

Interviewer: What message does that send out to other developers and start ups that they build on the platform? They build business on the platform and then they get the rug pulled out from under them”

Fred: I have a saying, Don’t be a Google Bitch, don’t be a Facebook Bitch, and Don’t be a Twitter Bitch. Be your own Bitch.

Besides providing a great little soundbite for tech blogs everywhere and momentarily stunning his interviewer, I think there’s a lot to learn from Fred’s point [you can watch the full interview here - good stuff at the 23 minute mark].
Whether you’re a developer or entrepreneur or not, I think it’s important to pay attention to this because the one thing I learned about business and life is that lessons can come from anywhere and truth always has applications beyond the field in which you initially encounter it. For instance, I can’t write a lick of code, but Fred’s statement is still incredibly relevant to me because it really comes down to five simple words.

Do what you really want to do.

In everything you do, you have a choice. Every time you delegate that freedom of choice to someone else, you’re voluntarily becoming dependent on them. In Fred’s words, you become someone’s bitch (for lack of a better term).

Posted via email from Jasper-net

Interprocess Communication

|
Summary

The article provides an overview about approaches for interprocess communication.

When you need to realize the communication between applications, usually you consider the following approaches.

File Transfer

Applications communicate via files. Producing applications write data to files and consuming applications read files to get data.

The advantage is that applications are loosely coupled. They do not have to know about internal implementations of each other. They just need to know the file format and a location of files.

On the other hand, writing and reading files is not so fast. Therefore, files cannot be updated very frequently (e.g. many times per second) but usually they are updated in intervals, e.g. hourly. However, this causes delays and applications reading the file must often deal with the fact that data is not up to date -> synchronization issues.

Database Storage

Applications communicate via shared data in a database. Shared data is written into the database from where it can be read by other applications.

The advantage is that the database provides a unified access to all data (e.g. via SQL). So applications do not have to deal with different file formats. In addition, the transaction mechanism helps to keep data consistent.

The drawback is that applications using the database depend on the data schema. Therefore, the change in the data structure (data schema) can cause changes in applications using the database.

Also the performance can be problematic - especially, if multiple applications frequently read and update the same data or the database is distributed across different locations.

Remote Procedure Call

Applications communicate via exposed functionality. Application providing the functionality uses a middleware (e.g. WCF) to hide the interprocess communication. The intention is that remote calls look like local calls. The communication is usually synchronous.

The advantage of this approach is that the application provides a specified functionality and encapsulates (hides) data.

The disadvantage is that the communicating applications are coupled. Example: The calling application assumes that the other side implements the particular interface. If you add a new method to the interface, then all client applications are affected and must be updated and recompiled.

Read more: Codeproject

Posted via email from Jasper-net

Atomicity, volatility and immutability are different, part one

|
I get a fair number of questions about atomicity, volatility, thread safety, immutability and the like; the questions illustrate a lot of confusion on these topics. Let's take a step back and examine each of these ideas to see what the differences are between them.

First off, what do we mean by "atomic"? From the Greek ἄτομος, meaning "not divisible into smaller parts", an "atomic" operation is one which is always observed to be done or not done, but never halfway done. The C# specification clearly defines what operations are "atomic" in section 5.5. The atomic operations are reads and writes of variables of any reference type, or, effectively, any built-in value type that takes up four bytes or less, like int, short and so on. Reads and writes of variables of value types that take more than four bytes, like double, long and decimal, are not guaranteed to be atomic by the C# language.

What does it mean for a read and write of an int to be atomic?  Suppose you have static variables of type int. X is 2, Y is 1, Z is 0. Then on one thread we say:

Z = X;

and on another thread:

X = Y

Each thread does one read and one write. Each read and write is itself atomic. What is the value of Z? Without any synchronization, the threads will race. If the first thread wins then Z will be 2. If the second thread wins then Z will be 1. But Z will definitely be one of those two values, you just can't say which.

David Corbin asks in a comment to my previous entry whether immutable structs are guaranteed to be written atomically regardless of their size. The short answer is no; why would they be? Consider:

struct MyLong 
{
    public readonly int low;
    public readonly int high;
    public MyLong(low, high) 
    {
        this.low = low;
        this.high = high;
    }
}

Ignore for the moment the evil that is public fields. Suppose we have a fields Q, R and S of type MyLong initialized to (0x01234567, 0x0BADF00D), (0x0DEDBEEF, 0x0B0B0B0B) and (0, 0),  respectively. On two threads we say:

S = Q;

and

Q = R;

We have two threads. Each thread does one read and one write, but the reads and writes are not atomic. They can be divided! This program is actually the same as if the two threads were:

S.low = Q.low;
S.high = Q.high;

and

Q.low = R.low;
Q.high = R.high;

Now, you can't do this because that's writing to a readonly field outside a constructor. But the CLR is the one enforcing that rule; it can break it! (We'll come back to this in the next episode; things are even weirder than you might think.) Value types are copied by value; that's why they're called value types. When copying a value type, the CLR doesn't call a constructor, it just moves the bytes over one atomic chunk at a time. In practice, maybe the jitter has special registers available that allow it to move bigger chunks around, but that's not a guarantee of the C# language. The C# language only goes so far as to guarantee that the chunks are not smaller than four bytes.

Posted via email from Jasper-net

Silverlight: How to Send Message to Desktop Application

|
Summary

This is a very simple example showing how to send a message from Silverlight application to standalone desktop application.

Introduction

The example below shows how to use Eneter Messaging Framework to send text messages from Silverlight application to standalone desktop application using TCP connection.

(Full, not limited and for non-commercial usage free version of the framework can be downloaded from http://www.eneter.net/. The online help for developers can be found at http://www.eneter.net/OnlineHelp/EneterMessagingFramework/Index.html).

When we want to use the TCP connection in Silverlight, we must be aware of following specifics:

The Silverlight framework requires the policy server.
The Silverlight framework allows only ports of range 4502 - 4532.
Policy Server

The Policy Server is a special service listening on the port 943. The service receives '<policy-file-request/>' and responses the policy file that says who is allowed to communicate.

Silverlight automatically uses this service when it creates the TCP connection. It sends the request on the port 943 and expects the policy file. If the policy server is not there or the content of the policy file does not allow the communication, the TCP connection is not created.

SilverlightTcpConnection.gif

Read more: Codeproject

Posted via email from Jasper-net

Creating a Windows Sidebar gadget for a SQL Server Reporting Services Report walkthrough

|
untitled%25255B3%25255D.png?imgmax=800

By default, after installing Window7 operation, there are many powerful and handy little tools in Sidebar Gadget, you can also download some customized Sidebar Gadget, such as: MSDN forum helper. Currently, we have some stock reports to show the real-time status of stock market, we also want to integrate SQL Reporting Services - stock report into window7’s Sidebar Gadget rather than open the IE all the time.

This article will walk you through the processes of integrating SQL Server Reporting Services into Windows 7 Sidebar Gadget.

Posted via email from Jasper-net

Silverlight: How to Receive Messages from Desktop Application

|
Summary

This is a simple example showing how a Silverlight application can receive messages from a standalone desktop application.

Introduction

The article is a free continuation of How to Send Message to Desktop Application where the Silverlight application sends a text message to the desktop application. Now I would like to show how the Silverlight application can receive text messages from the desktop application using TCP connection. (Actually, the example below shows the bidirectional communication between the Silverlight application and the desktop application.)

The implementation uses Eneter Messaging Framework. (Full, not limited and for non-commercial usage free version of the framework can be downloaded from http://www.eneter.net/. The online help for developers can be found at http://www.eneter.net/OnlineHelp/EneterMessagingFramework/Index.html.)

As mentioned in the previous article, the Silverlight communication via TCP has the following specifics:

The Silverlight framework requires the policy server.
The Silverlight framework allows only ports of range 4502 - 4532.
In addition:

The Silverlight application cannot be a TCP listener.
Therefore, if the Silverlight application wants to receive messages, it must open TCP connection to the listening desktop application and receive response messages.

SilverlightDuplexTcpConnection.gif

Read more: Codeproject

Posted via email from Jasper-net

.NET - Start Asynchronous Parallel Task and Cancel Them Too

|
I was having a good discussion with a couple of friends about the support of parallel tasks in .NET. If you too are interested in the same, I have written a couple of articles that can give you an overview of the support for parallelism and concurrency in .NET applications.

Parallel Tasks in .NET 4.0 -   The Parallel class found in the System.Threading.Tasks namespace “provides library-based data parallel replacements for common operations such as for loops, for each loops, and execution of a set of statements”. In this article, we will use the Invoke method of the Parallel class to call multiple methods, possibly in parallel.

Parallel Tasks in .NET 4.0 (Part II) – Methods that Return value - In one of the previous articles Parallel Tasks in .NET 4.0, we explored a set of new API’s called the "Task Parallel Library (TPL)" which simplifies the process of adding parallelism and concurrency to applications. We used the System.Threading.Tasks.Parallel.Invoke() to call methods that did not return a value. However for methods that return a value, you would need to use the Task(TResult) class which represents an asynchronous operation that can return a value. We will explore how to use this class in this article

Cancelling Tasks in .NET 4.0 - In one of the previous articles Parallel Tasks in .NET 4.0 (Part II) – Methods that Return value, we used the Task(TResult) class which represents an asynchronous operation that can return a value. In this article, we will see how to cancel a task/operation.

Read more: dev Curry

Posted via email from Jasper-net

Silverlight: How to Communicate with Desktop Application via HTTP

|
Introduction

This article is a free continuation of How to Receive Messages from a Desktop Application and How to Send Message to a Desktop Application where the Silverlight application communicates with the standalone .NET application via TCP. In this article, I would like to show how to implement the communication via HTTP.

The example below implements a .NET application as a service and a Silverlight application as a client. The service listens to text messages and responses with their length. The client then uses the service to get the length of the given text.

The implementation uses the Eneter Messaging Framework. (Full, not limited, and for non-commercial usage free version of the framework can be downloaded from http://www.eneter.net/. The online help for developers can be found at http://www.eneter.net/OnlineHelp/EneterMessagingFramework/Index.html.)

Policy Server

Like the TCP communication, the HTTP communication also requires the policy XML file. Silverlight automatically requests this file when the application wants to connect to other than the site of origin. In the case of HTTP, Silverlight requests the policy file on the root of the HTTP request. I.e., if the Silverlight application requests http://127.0.0.1/MyHttpService/, then Silverlight asks for the policy server from the root: http://127.0.0.1/clientaccesspolicy.xml. If the policy file is not available or its content does not allow the communication, the HTTP request is not performed.

SilverlightDuplexHTTPConnection.png

Service Application

The service application provides the HTTP policy service for the communication with the Silverlight client. Then it implements the simple service calculating the length for the given text. Please notice, to run the HTTP listening application, you must execute it under sufficient user rights. Otherwise you will get an exception.

The whole implementations is very simple.

using System;
using Eneter.Messaging.EndPoints.TypedMessages;
using Eneter.Messaging.MessagingSystems.HttpMessagingSystem;
using Eneter.Messaging.MessagingSystems.MessagingSystemBase;

namespace LengthService
{
    class Program
    {
        // Receiver receiving messages of type string and responding int.
        static private IDuplexTypedMessageReceiver<int, string> myReceiver;

        static void Main(string[] args)
        {
            // Start Http Policy Server
            // Note: Http policy server must be initialized to the root.
            HttpPolicyServer aPolicyServer = new HttpPolicyServer("http://127.0.0.1:8034/");
            aPolicyServer.StartPolicyServer();

            Console.WriteLine("Http Policy Server is running.");

            // Create Http messaging.
            IMessagingSystemFactory aMessaging = new HttpMessagingSystemFactory();

            // Create the input channel that is able to
            // receive messages and send back response messages.
            IDuplexInputChannel anInputChannel = 
                aMessaging.CreateDuplexInputChannel("http://127.0.0.1:8034/MyService/");

Read more: Codeproject

Posted via email from Jasper-net

SQL Server 2000 Monitoring Management Pack

|
Overview
Microsoft SQL server 2000 out of support and hence the Microsoft SQL server 2000 management pack is deprecated and not supported. 

The Microsoft SQL Server 2000 Management Pack provides both proactive and reactive monitoring of SQL Server 2000 in an enterprise environment. Availability and configuration monitoring, performance data collection, and default thresholds are built for enterprise-level monitoring. Both local and remote connectivity checks help ensure database availability.

Read more: MS Download

Posted via email from Jasper-net

Service Listening to TCP, HTTP and Named Pipe at the same time

|
Introduction

The example below implements a simple service that is able to receive requests via TCP, HTTP and Named Pipe. Therefore, the service can be available for clients using different communication. E.g. Windows Phone 7 environment supports only HTTP.

The example is based on the Eneter Messaging Framework 2.0 that provides components for various communication scenarios.
(Full, not limited and for non-commercial usage free version of the framework can be downloaded from http://www.eneter.net. The online help for developers can be found at http://www.eneter.net/OnlineHelp/EneterMessagingFramework/Index.html.)

Multiple Listening 

To implement the multiple listener, we will use the Dispatcher component from the Eneter Messaging Framework.

The Dispatcher receives messages from all attached input channels and forwards them to all attached output channels.

In our scenario, the dispatcher will have three input channels (TCP, HTTP and Named Pipe) and only one output channel (local channel to the message receiver).

So, if a message is received e.g. via the TCP input channel, the dispatcher will forward it through the output channel to the typed message receiver. The typed message receiver then notifies the user code implementing the service.

MultilisteningService.gif

Multiple Listening Service Application

The service is implemented as a simple console application. The most important part is using of the dispatcher component for the multiple listening (TCP, HTTP and Named Pipe).

Since the service listens also to HTTP, you must execute it under sufficient user rights. (I recommend administrator for the debug purposes.)
The whole implementation is very simple.

 Collapse
using System;
using Eneter.Messaging.EndPoints.TypedMessages;
using Eneter.Messaging.MessagingSystems.HttpMessagingSystem;
using Eneter.Messaging.MessagingSystems.MessagingSystemBase;
using Eneter.Messaging.MessagingSystems.NamedPipeMessagingSystem;
using Eneter.Messaging.MessagingSystems.SynchronousMessagingSystem;
using Eneter.Messaging.MessagingSystems.TcpMessagingSystem;
using Eneter.Messaging.Nodes.Dispatcher;

namespace MultiReceivingService
{
    public class RequestData
    {
        public int Number1 { get; set; }
        public int Number2 { get; set; }
    }

    class Program
    {
        // Receiver receiving 'RequestData' and responding 'int'.
        // Note: Duplex typed message receiver can receive messages of specified type
        //       and send response messages of specified type.
        private static IDuplexTypedMessageReceiver<int, RequestData> myReceiver;

        static void Main(string[] args)
        {
            // Create local messaging connecting the dispatcher with the receiver.
            IMessagingSystemFactory aLocalMessaging = 
new SynchronousMessagingSystemFactory();
            IDuplexInputChannel aLocalInputChannel =
                aLocalMessaging.CreateDuplexInputChannel("MyLocalAddress");

            IDuplexTypedMessagesFactory aTypedMessagesFactory = 
new DuplexTypedMessagesFactory();
            myReceiver = aTypedMessagesFactory.CreateDuplexTypedMessageReceiver
<int, RequestData>();
            myReceiver.MessageReceived += OnMessageReceived;

Read more: Codeproject

Posted via email from Jasper-net

Some Things To Know About Publishing Android Apps

|
Now that I have two apps listed in the Android Market, I thought I would write up something about the publication process to let folks know what to expect when they to go publish their own Android apps.

The first step in preparing your app for publication is to digitally sign your app with a certificate. There is an entire page on the topic of signing on Google's Android Developer site, but if you're using the ADT (Android Developer Tools) plugin for Eclipse to develop your apps, the process is pretty darn simple:  you right-click on your app project name in the Package Explorer view, choose "Android Tools" from the context menu, then choose "Export Signed Application Package."  That will activate a signing wizard that will take you through the steps, and it's simply a matter of filling in the form fields with the appropriate information (which is when the documentation on signing really comes in handy).  Once the process is complete, you'll end up with a keystore file for your app and the signed .apk installer file.  I would suggest keeping your app keystore files in one place (each keystore file shares the same name as the app it belongs to) because you'll need the keystore file any time you sign an updated version of your app.

Once you've got your signed .apk file, you should figure out what you want to do for the screenshots for your app that will appear in the Market listing.  The Android Market allows you to upload only two screenshots of your application, so you need to figure out which screens best capture the essence of what your app does and look reasonable readable even if shrunk to half the size: the images are shrunk when viewed in the app description on the Android Market app, and while users can tap a screenshot to see it at full-size I don't know how many people realize that they have that option.

You have two options for capturing the screenshots:  either take the screenshots using the Android device emulator that comes with the Eclipse plugins for Android, or root your Android device and run a screen capture program like drocap2 (UPDATE: actually, there is a tool in the SDK that will allow you to take screenshots without rooting).  The Android Market only accepts screenshots that are either 320x480 pixels or 480x854 pixels, so make sure your screenshots conform to one or the other set of dimensions.

You will also need to provide a title for your app as well as a brief description.  Your app title can be as long as 30 characters, but be aware that the label beneath the launcher icon for your app on an Android homescreen will only display first eight or nine letters of the title.  The description for your app can only be 325 characters long: I have no idea why Google picked that particular length, but it means you have to choose your words carefully.  Make sure you choose words that you think users will likely search on in the Android Market app on their phones in order to find apps like yours.

Read more: Mobile Zone

Posted via email from Jasper-net

MSEPX - Microsoft Security Essentials Process Exclusion Utility

|
Introduction

This article describes coding a C++ Win32 based utility application that allows the user to use point and click interface to add process source file names (the path and name of the executable) to the process exclusion list of Microsoft Security Essentials.  It creates and uses a Windows service, uses multiple service threads, has a custom drag and drop, and does registry editing. 

Please excuse the fact that the code is far from commercial quality. This was a two or three day hobby exercise for my personal amusement, but is a fairly well tested effort so it should work correctly. Much of the code was copied from third parties (most if not all of the drag and drop source is based on the MSDN Magazine, October 2004 drag and drop code written by Paul DiLascia: Create Client Windows, Drag and Drop Between Listboxes) with the bulk of it based on examples from MSDN.

This program was written in C++ with Win32 libraries in Microsoft Visual Studio 8 and has been tested using Windows XP Professional and Windows 7 Ultimate.

image004.jpg

Read more: Codeproject

Posted via email from Jasper-net

SQL Server: Shortcuts for TSQL Code in SSMS

|
For a developer or DBA it’s common to start their day with “SELECT * FROM” and in a daily routine work we type same lines of script many times. If you are a lazy developer or DBA like me then sometime it feels boring to type same code again and again. Intellisence in SQL Server 2008, saved lot of time but still it lacks few features, which other third party tools were offering before SQL Server 2008. Through such tools like SQL PROMPT, we have ability to type shortcuts in editor which after pressing Enter or Tab turn into a predefined code block. Like I will just type * and it will convert it to “SELECT * FROM”.
If you don’t like to purchase these tools but still want to make your life easy then you need SSMS Tools by Mladen Prajdić, totally free and you can download from here. Beside other good tools it has an option of SQL Snippets. Although it already have a good list of shortcuts but still you can add of your choice.

SQL+Snippet+2.gif

Read more: Connect SQL

Posted via email from Jasper-net

CitiBank hacked – dumb developers, dumber security consultants

|
In the Citi breach, the data thieves were able to penetrate the bank’s defenses by first logging on to the site reserved for its credit card customers.

Once inside, they leapfrogged between the accounts of different Citi customers by inserting various account numbers into a string of text located in the browser’s address bar. The hackers’ code systems automatically repeated this exercise tens of thousands of times — allowing them to capture the confidential private data.

As if insecure direct object references aren’t bad enough, it’s the quotes from the security “expert” that really rankle;

It would have been hard to prepare for this type of vulnerability.

Bullshit. Utter bullshit. If, as the NY Times reports, it was a simple matter of changing URLs once you had a login it would not be hard to prepare for this. This should have been caught in even the simplest automated review. This was not sophisticated or ingenious, as reported, this was boringly simple. It does however point to an industry wide failure in developer education. OWASP has had Insecure Direct Object references on it’s Top 10 list for years. It’s in the SDL Threat Modeling tool. Any security firm worth its salt checks for this, and I’d guess CitiBank employ a few. So why aren’t developers mitigating what are, to me, obvious faults. Why do we still suffer SQL injection? Cross Site Scripting? And what the hell can we do about it?

Read more: idunno.org
Read more: NewYork times

Posted via email from Jasper-net

Exposing Silverlight functions to Javascript

|
Sometimes we need to interact between our Silverlight application and our host page. In this beginners post, I'll describe how to do it along with a mapping example. The target is to choose a state in the host page (which filled from a silverlight function) and then zoom and highlight the state on the Silverlight map.

First we create a class and give it the ScriptableMember attribute. This enables the hosting page to gain access to the class.  The function fill_states will read the the fifty states from the server and run the JS addToStates to add them all to the list in the hosting page. Calling JS from silverlight is easy with HtmlPage.Window.Invoke function.

public class MyScriptableManagedType
{
        [ScriptableMember()]
        public void fill_states()
        {
            QueryTask pQueryTask = new QueryTask("http://sampleserver..../ESRI_Census_USA/MapServer/5");
            pQueryTask.ExecuteCompleted += fill_states_ExecuteCompleted;

            Query pQuery = new Query();
            pQuery.OutFields.AddRange(new string[] { "STATE_NAME" });
            pQuery.ReturnGeometry = false;
            pQueryTask.ExecuteAsync(pQuery);
        }

        private void fill_states_ExecuteCompleted(object sender, QueryEventArgs e)
        {
            IOrderedEnumerable<Graphic> pSorted = null;
            pSorted = e.FeatureSet.Features.OrderBy(g => g.Attributes["STATE_NAME"]);
            
            foreach (Graphic graphic in pSorted)
            {
                string pStateName = graphic.Attributes["STATE_NAME"].ToString().Trim();
                object o = HtmlPage.Window.Invoke("addToStates", pStateName);
            }
        }

The next function is goto_state : gets the state name from JS and then zoom and highlight it on the map.

[ScriptableMember()]
    public void goto_state(string sStateName)
    {
            QueryTask pQueryTask = new QueryTask("http://sampleserver.../ESRI_Census_USA/MapServer/5");
            pQueryTask.ExecuteCompleted += goto_state_ExecuteCompleted;

            Query pQuery = new Query();
            pQuery.ReturnGeometry = true;
            pQuery.Where = "STATE_NAME = '" + sStateName + "'";
            pQueryTask.ExecuteAsync(pQuery);
        }

Read more: Oren Gal

Posted via email from Jasper-net

Using Google Realtime Search to track Trends

|
You can use Google’s Realtime search feature to track trending topics on social media networks like Twitter.  To find it, just do a search as usual, then click on the More icon on the left to open up the Realtime option (or just go to http://google.com/realtime).

image_8.png

  image_7.png

Read more: Steve Smith

Posted via email from Jasper-net

Working with Chrome's file browser handler

|
image00.jpg

During the day 2 keynote of Google I/O, I was excited to see Box's integration with the Chromebook's file browser handler getting demoed on the big stage. The integration makes local files and files you encounter on the web easily accessible to cloud services inside Chrome OS.

Chrome's file browser handler utilizes the new HTML5 file system API, designed to enable web applications to interact with local files. This API lets web applications read files, edit files, and create new files within a designated local space on a user's machine. This includes creating binary files for application data, and in Box's case, accessing user-created files to let people easily move their content to the cloud.

As mentioned during the Google I/O keynote, the integration between Box and the Chrome OS file browser handler only took our team a weekend to build. We were able to build the integration quickly because of the simplicity of both Chrome's file browser platform and Box's API, both of which were designed to make content integrations like this easy for developers to implement.

In this case, the Quick Importer tool from the Box API made the entire development process just a few steps:

1. We created a Chrome extension manifest to work with Box.

{
 "name”: "Box Uploader",
 ...
 "file_browser_handlers": [
     {
      "id”: "upload",
      "default_title": "Save to Gallery", // What the button will display
      "file_filters": [
       ]
     }
   ],

2. In the Chrome manifest, we specified the relevant file types to which the service applies. In our case, that's most file types, as seen below. Specialized services may just want certain types, such as images for Picasa.

"file_browser_handlers": [
     {
      "id": "upload",
      "default_title": "Save to Box",
      "file_filters": [
       "filesystem:*.*"
       ]
     }
   ],

Read more: Google code blog

Posted via email from Jasper-net

Announcing the Web Standards Update - HTML5 Support for the Visual Studio 2010 Editor

|
vshtml5_thumb.png

Folks have been asking "When will VS2010 support HTML5?" I've been saying, jokingly, that the answer is "yesterday" as there's nothing keeping you from creating HTML5 in Visual Studio or ASP.NET today. However, there's no intellisense and there's lots of squiggly lines that make people uncomfortable. Combine all that with the fact that HTML5 is a moving target, and it's unclear. We've said before that the next version of Visual Studio will have better support HTML5, but what about today?

Today, a rogue faction of the Web Platform and Tools team, spearheaded by Mads Kristensen, is pleased to announce the Visual Studio Web Standards Update. This adds better support for HTML5, CSS3 and new JavaScript features to ALL versions of Visual Studio.

Download the first Visual Studio Web Standards Update

HTML5 moves fast, and this update will aim to keep up with it. It adds support to Visual Studio and the editor for HTML5, CSS3 and new JavaScript features. The goal is perhaps an update every quarter or so as new features or elements emerge.  We want ASP.NET web developers to always be able to use the latest standards, as well as being able to choose from existing standards. Remember that you can use HTML5 today along with JavaScript libraries like Modernizr that allow you to create pages that work across nearly all browsers, including old crappy ones.

Posted via email from Jasper-net

Async support for Silverlight and WP7

|
Async support in C# language brings the new life to the modern application development to bring forth the same technique of writing your code and bring asynchrony easily. The main focus of async ctp is to ornament the language in such a way so that the developer could seamlessly create applications that brings asynchrony yet not dealing with its complexity. Hence using the new technique, asynchrony could easily achieved in a program without refactoring the whole program with lots of callbacks and method calls. I have already talked about it in a separate article. If you don’t know, please visit “Async CTP 5.0”. 

Async CTP is released again recently and announced in MIX 11. Just after it is released, the first thing that everyone looks for is what is new in the release. As a matter of fact, I did jumped back to see them but eventually found out that there is nothing new in this build in terms of new features is concerned but the release focuses on fixes of performance adding debugging capabilities etc. I will definitely look back to them later in another post, but in this post I am going to talk about another important thing that featured with this release. As opposed to the previous release, the current release now supports Silverlight and Windows Phone 7 environments. This seems to be interesting. 

What is Asynchrony?

The word asynchrony means something that is running without blocking other operations running in parallel. If you have created a background Thread to process some data, you are actually doing asynchronous job in background as your foreground operation does not get hampered. In vNext C# introduces Asynchrony using TPL. The two new keywords “async” and “await” could be used to make one sequential method asynchronous. Hence the new way of developing asynchronous program replaces the traditional approach where we needed to refactor the code totally to gain asynchrony in our application. Basically, this is done using the StateMachine to store the entire method into a form of states, and each states are delegated into batch of statements. The Task.ContinueWith is used in the system to ensure that the method body gets executed sequentially. Yes, it’s a compiler trick. If you want to know more about it, please read through my entire article on “Async CTP”.

Now coming back to our discussion on Windows Phone 7, we know that C# async is now supported by both Silverlight and Windows Phone 7 out of box. To work with this, please follow the steps: 

Download "Async CTP (Refreshed)" from this link.
After you install the CTP release, you will get few more dlls available in your installed directory as shown below:

dlls.PNG

Posted via email from Jasper-net

Why Great Ideas Fail

| Wednesday, June 15, 2011
I ran a session at FOO camp ’11 on Why Great Ideas Fail. It was a chaotic session, but my goal of leaving with a list of reasons was a success, and here it is.

The crowd was tech and start-up heavy, so the list is shifted towards those pursuits. But this could be the start of a book project that more broadly explores the history of great ideas. Starting with fleshing out these categories better, and then finding good stories that illustrate ideas that failed for these reasons, as well as ideas that successfully overcame these challenges.

Meta-comment: Fascinating how many of these are opposite pairs of each other (e.g. gave up too soon, stayed with same idea for too long).
Follow up: If you were there, or not, and want to be updated if this project gets off the ground, leave a comment.

Why Great Ideas Fail:
  • Killed idea too soon
  • Stayed with idea for too long
  • Death (of person with the idea)
  • Not knowing target audience
  • Not Willing to experiment to find audience
  • Unwilling to change direction
  • Willful ignorance of economics
  • Overcoming organizational inertia
  • Not understanding the ecosystem the idea lives in
  • Inability to learn from microfailure
  • Fighting the last war
  • Giving up
  • Chindogu – solution causes more problems than it solves.
  • Randomness
  • Blamed marketing
  • Failed to pitch or communicate well
  • Not taking the idea far enough
  • Underestimating cultural limits
  • Underestimating dependencies
  • Balancing how world is vs. how world can be
  • Balancing Wants vs needs
Thanks to Val Aurora, I also got a list from attendees of personal reasons great ideas failed. Wide range of levels of specificity, but still interesting,

Specific failures people listed as their own:
  • Forcing something on people they don’t want
  • (more...)

Read more: Scott Berkun

Posted via email from Jasper-net

Test drive the shiny new Wcf interop bindings

|
wcf.codeplex.com is the place where most of the wcf action happens at these days. If you have been following it recently you have seen a lot of activity around Rest and Http. As of yesterday Soap officially joins the codepex party. Microsoft has just released the WCF Express Interop Bindings - a new Visual Studio extension for Soap web services interoperability. If you use Wcf this matters to you!

What did Microsoft release yesterday?

Web services interoperability is always a pain. When security is involved it is usualy more then a casual 'oouch'. Yes, WsHttpBinding has a specific permutation of settings which can interoperate with Oracle web logic. And I know a lot of people who have tried to find that permutation in a brute force manner. Mostly doing this is a waste of time which we prefer to invest in more productive areas.

So here's the idea behind yesterday's shipping: We now have a new binding, WebLogicBinding, which only allow us to configure settings which are interoperable with web logic. So all settings are interoperable! We also have bindings for web sphere, axis2 (wso2) and metro (wsit / glassfigh / tango).
In addition we got a nice wizard on top of Visual Studio's new project dialog which allows us to easily author interoperable services using these bindings.

platform.jpg

Posted via email from Jasper-net

Welcome to the first release of the WCF Express Interop Bindings

|
This project provides a starter kit for WCF service developers wishing to connect with Java clients in WebSphere, WebLogic, Metro and Apache. It supports security, MTOM and RM features. For more information see the Landing page

We welcome your feedback (Topic: Interop Bindings). Please submit any feature requests / bug fixes via the issue tracker.

Features
VSIX Installer
WCF Bindings for Oracle WebLogic, Oracle Metro, IBM WebSphere, Apache Axis 2
Interop settings wizard

Pre-requisites
.NET 4.0 / Visual Studio 2010 Standard edition or above (Express is not supported)
WCF 4.0
Visual Studio 2010 SDK (necessary to build the source)
Download Visual Studio 2010 SDK
Download Visual Studio 2010 SP1 SDK

Read more: Codeplex

Posted via email from Jasper-net

Push Data to the Client using WCF CallBack Service

|
Many a times, the requirement demands that the WCF Service pushes data to the application that is consuming it, over the session established between client application and the WCF service. This mechanism can be termed as Callback. WCF actively supports callback to its client, over the instance context established. To understand this scenario, think of it like the WCF service becomes the client and the client becomes the service.

BasicHttpBinding and WSHttpBinding do not support callback. To support callback over HTTP transport, WCF provides WSDualHttpBinding. The WSDualHttpBinding sets up two channel - one for calls from client to service and other from service to client. Whenever you create a Service, it can have only one callback contract. When a proxy is created for the Service with CallBack, the base class of the proxy is the DuplexClientBase<T>. This is used to create channels for the duplex service and this channel is the associated with the callback object.

Enough of theory, let’s create a WCF service, Host and Client callback.

Step 1: Open VS2010 and create a Blank solution, name it as ‘WCF_Callback_Contract’. In this solution, add a new WCF Service application and name it as ‘WCF_CallBack_Service’. Rename IService1.cs to Iservice.cs and Service1.svc to Service.svc.

Step 2: Open IService.cs and add the following ServiceContract, Callback contract interface and a DataContract, as shown below:

wcf-callback-service.png

Read more: dot Net Curry

Posted via email from Jasper-net

Namespace and Class Alias in C#

|
We use using to define alias. There are 2 types of Alias

 1. Namespace Alias: Namespace alias are used when you want to shorten a long namespace. To do that :

using Abhishek = System.Drawing;
public class X
{
public X()
{
Abhishek.Graphics g = this.CreateGraphics();
}
}
 
Here in the header we made an alias Abhishek of System.Drawing
Thus within the code if we refer to Abhishek, it will be same as referring to System.Drawing.

2. Class Alias: You can also make use of using statement to define reference to a single class. Say if I write using Abhishek=System.Drawing.Bitmap; Abhisek will hold the class Bitmap. We can create Object of Abhishek, access static functions directly.

using Abhishek=System.Drawing.Graphics;
public class X
{
public X()
{
Abhishek g = this.CreateGraphics();
}
}

Read more: Daily .Net Tips

Posted via email from Jasper-net

patterns & practices: Project Silk

|
FileDownload.aspx?ProjectName=silk&DownloadId=233650


Overview
Project Silk provides guidance for building cross-browser web applications with a focus on client-side interactivity. These applications take advantage of the latest web standards like HTML5, CSS3 and ECMAScript 5 along with modern web technologies such as jQuery, Internet Explorer 9, and ASP.NET MVC3.

To illustrate this guidance, the project includes a reference implementation called Mileage Stats that enables its users to track various metrics about their vehicles and fill-ups. Much of the effort in building Mileage Stats was applied to the usability and interactivity of the experience. Animations were included to enhance the enjoyment of the site and AJAX is used to keep the interface responsive and immersive. A great deal of care was also taken to ensure the client-side JavaScript facilitates modularity and maintainability. To accomplish these design goals, the JavaScript code was structured into “widgets” that benefit from the jQuery UI Widget Factory.

About the Mileage Stats RI

The Mileage Stats RI is a multi-page interactive web application where the pages are rendered without requiring a postback. This creates the illusion of a desktop application. The lack of postbacks enable rich UI transitions between states (pages.) The browser application runs very fast because of the client-side data caching.

The Mileage Stats RI JavaScript is modularized using jQuery UI Widgets. The widgets allow breaking the UI into small discrete stateful objects; providing a clean separation of responsibilities and concerns. See the Widget QuickStart (included with the latest download) for an example application that uses the jQuery UI widget factory.

Read more: Karl of WPF
Read more: Codeplex

Posted via email from Jasper-net

Free and Freaking AWESOME: 3-D Sample for Silverlight 5

|
Wow, check out this sample of a 3-D realtime engine.  This is just freaking awesome!

Download this immediately, that is if you are experimenting with Silverlight 5.  Otherwise, ignore it!

It contains (and I cut and pasted this from the link above in case you missed it): 

Babylon Toolkit provides a complete toolbox for Silverlight 5 3D. 
It includes:

  • A complete Effect class with shaders and parameters support (with an integrate shaders and registers cache system)
  • A Model/ModelMesh/ModelMeshPart object model
  • A ModelContent/ModelMeshContent/ModelMeshPartContent object model to create Model hierarchy
  • An importation system with support for .OBJ files
  • Cameras classes:
  • Orbit camera
  • Regular camera
  • A BasicEffect for simple rendering modes which supports:
    • Diffuse color & texture
    • Specular color & texture
    • Bump texture
    • Ambient color
    • Point light
  • Pre-defined effects:
    • BasicEffect3Lights (3 directionals lights instead of 1 position light)
    • CartoonEffect (work in progress)
    • SkinnedEffect (with normal and specular map support)
    • SplattingEffect (for multi-texturing with smooth and precise transitions)
    • VertexColorEffect (very light for non textured meshes)

    Read more: Codeplex

    Posted via email from Jasper-net

    UK Tech Days–MVVM for Silverlight Development

    |
    The videos from the recent Tech.Days Live event are available and one of those is the excellent Laurent Bugnion of IdentityMine who did an excellent session around MVVM which you can enjoy from here;

    Read more: Mike Taulty's Blog

    Posted via email from Jasper-net

    IP Camera Adapter

    |
    Turn your android phone into a camera. Download the application from the Market

    A universal network camera adapter for the Windows operating system. Can be used with a variety of protocols, cameras with MJPG output or static images. Works with any application that uses DirectShow API, such as Skype, MSN messenger and Chatroulette. 
    Works on Windows 2000/XP/Vista/7. 

    Read more: Android market qrcode.png

    Posted via email from Jasper-net

    Sleek Web UI Elements Free PSD Download

    |
    CreativeFan_Web_elements_set-500x325.jpg

    CreativeFan is built around strengthening, informing, inspiring and empowering the creative media community in every way possible, from providing tutorials and articles to inspiration and freebies.

    In order to better serve the community, we’ve decided to team up with a few elite designers to give away exclusive freebie design elements that you can use in your own work.

    Please be sure to read the license, and if you like the freebie, send the link to this post to your friends as well.  Also, be sure to support these designers by checking out their portfolios and items for sale!

    Read more: creativefun

    Posted via email from Jasper-net

    HTML 5 vs Silverlight 5

    |
    Philosophy
    The goal of this paper is to present an objective comparison between Silverlight 5 and HTML 5 (with: JavaScript / ECMAScript 5 + CSS3 + any required additional frameworks and APIs). We will only focus on some features: covering these technologies entirely would require a whole book. 
    The main idea is to provide a guide to help you choose a technology as part of a planned project. 
    All decisions elements could not be presented here of course. You should take this document as a help to decide rather than as an absolute truth.

    In each chapter we will focus on functionalities but also on ease of implementation and performance. The goal here is not to study in detail the features of HTML 5 or Silverlight 5. 

    Sample source code is available here.

    To install Silverlight 5 beta you can go here.

    HTML vs XAML
    The two competitors are tied on the philosophy as they are both based on a markup language (HTML and XAML). They also both make extensive use of attributes.

    Extensibility
    Silverlight 5 allows you to add custom attributes to existing tags via attached properties. It is also feasible in HTML 5, but through the use of an inelegant hack (if HTML 5 does not recognize a tag or an attribute, it will just ignore it. Javascript can then process this information to add the required behavior). An implementation example of this usage is the project KnockOut.

    On top of that, Silverlight has the Markup Extensions that add behavior to existing attributes (including Binding or even custom behaviors). Moreover, the list of tags is not fixed since it is possible to develop ones own controls providing a real advantage in the industrialization of a Silverlight solution. 

    DOM access
    In Silverlight, each tag can be accessed directly from the code behind using association by name (x: Name). In HTML 5, it is possible to do the same with the attribute 'id' but only in certain browsers (IE, Chrome). We must therefore go through Javascript’s location services by id, which slightly penalizes ease of development:

    var toto = document.getElementById('toto');
    toto.style.visibility = 'hidden';

    Regarding the traversing of logic trees, Silverlight and HTML provide equivalent related services. 
    It is however worth noting that HTML 5 offers a query tool for its DOM named Selectors API. This enables very efficient search across the objects on the page using selection queries: 

    var alerts = document.querySelectorAll("p.warning, p.error");

    In this example, we ask the API to return the list of paragraphs whose class is "warning" or "error". You can also query for IDs, types and many other criteria.

    Read more: Eternal Coding

    Posted via email from Jasper-net

    How to Encode HD Video for Windows Phone 7

    |
    We know that Zune software has an automatic conversion tool but quality is not always what you’d expect or want. XDA member rvmax wrote an interesting guide on how to encode HD video in 720p or 1080p for your Windows Phone 7 devices. The guide includes a step by step installation with links to the required software, all of which are free and paid options for you to choose from. After finishing encoding, you can send the video to your mobile with Zune and it won’t convert it again.
    If you liked it, please leave your comments.

    Originally posted by rvmax

    Encoding HD Video for Windows Phone 7

    Zune offers by default an automatic conversion of videos for Windows Phone 7. However the quality is not always what you want, the encoding time is endless and often lacks many options such as subtitles.

    This guide was produced for encoding high definition video 720p or 1080p to Windows Phone 7. You can use the same method to encode videos lower quality but the result won’t be conclusive.

    Software & Encoding Setup

    Many programs exist to encode each with their advantages and disadvantages. Some are paying others do not.
    VidCoder offers all the advantages: free, easy to use while providing many functionalities.
    The encoding is configured with the following parameters:
    Container
    mp4 File

    Read more: XDA developers

    Posted via email from Jasper-net

    Focus on Community: Widgetlocker Theme collection

    |
    Introduction.png

    Looking for a way to trick out your lockscreen? Already have Widgetlocker but don’t have that artistic touch? Worry not, as xda member zHk3R has assembled the largest Widgetlocker theme collection your eyes will ever see. Hundreds of pages of users posting their work for you to use. The thread is an absolute must for those who like to keep their phone aesthetically up to date. The thread gives users various widgets, slider themes, wallpapers, and much more! The thread can be found over on xda.

    Read more: Talk Android
    Read more: XDA Forum

    Posted via email from Jasper-net

    Android – How to Unpack/Repack .apk Files

    |
    If you want to learn more about .apk files here is a good tutorial on how to unpack and repack these for your Android device. XDA member despotovski01 prepared an interesting guide for which you just need to follow the instructions and you will learn how to unpack/repack .apk files fast and easily. You will need Winrar or similar program and Formatter, which is an application made by the developer, in order to make it work. If you don´t want to mess with Command Prompt, then this option will give you a very graphical/simple user interface to make the changes you want.
    Please let us know what you think.

    Originally posted by despotovski01

    Hey guys!
    I’ve made another tutorial. This one is about unpacking and repacking .apk files. This tutorial was made for people who don’t want to mess with Command Prompt, or for those who want to do it in graphical user interface.
    ————————————————-
    Requirements:
    -An archive manager, such as WinZip, WinRar, or Power Archiver, that is capable of extracting and making .rar archives
    -Formatter (it’s a program made by me) – click here to download it. Mirror: http://www.mediafire.com/?5a74bjg475er75d

    Read more: XDA developers

    Posted via email from Jasper-net

    How to Save YouTube/FLV Clips on Android

    |
    Saving FLV files from YouTube or other video streaming services to your Android phone isn't as tricky as you might think with these two easy methods!

    Enjoy YouTube? Why Not Save the Videos?

    One of the most popular uses for mobile devices is to enjoy streamed content, typically movies (but often music as well) and one of the most common ways of streaming content is via the FLV format. This can be played in the browser or a dedicated FLV viewer as it is downloaded, allowing the Android device to play, perhaps, a movie trailer from YouTube.

    However, there is one drawback with FLV – it’s tough to save it and keep a copy, and on a mobile device it is made even tougher by the lack of useful browser plugins that are available for desktop computers.

    Fortunately, various ways do now exist to save streaming FLV on Android phones, thanks to a couple of useful websites and one or two free apps that allow you to download a streamed video clip and save it to your phone for a repeated viewing – or even transfer to your computer – later on.

    Using TubeMate – YouTube Downloader

    Thanks to the free TubeMate app you can start downloading YouTube videos without any messing around.

    The first thing you will need to do is visit the Android Market and search for “tubemate”. Once you have found and installed the app, you can launch it from the shortcut, which will take you to a selection of current popular YouTube videos. Using the search function in the top-right corner, find the clip you want to keep, and select it from the search results.

    Read more: BrightHub

    Posted via email from Jasper-net

    Google Removes 10 New Malware Apps from Android Market

    |
    Google has removed 10 Angry Birds-related apps from the market after a professor at North Carolina State reported they were infected with Malware. Xuxian Jiang, the professor who found the apps, said that they run in the background in order to send phone information to a remote server. The professor labeled the new kind of malware "plankton."

    Read more: Android Pit

    Posted via email from Jasper-net

    Steam Now Offering Free-To-Play Games

    |
    globalheader_logo.png

    Valve's digital Steam service is going strong with 30 million active accounts, and now the developer has further boosted its offerings by adding free-to-play titles. Steam is kicking off its support of the free-to-play model with five titles (which will include in-game Steam exclusives): Spiral Knights, Forsaken Worlds, Champions Online: Free for All, Global Agenda: Free Agent, and Alliance of Valliant Arms. Valve's support of free-to-play shows just how widely accepted it's become.

    Read more: Slashdot

    Posted via email from Jasper-net

    Silverlight 5 Features Ancestor Relative Source Binding

    |
    Silverlight-5-App.jpg

    Silverlight 5 has another new feature called Ancestor Relative source binding. It was already available in WPF and has been newly introduced in Silverlight 5 beta. Using this, you can now bind to the relative ancestor elements very easily.
     
    Let's discuss it with a small example where we will create a Control Template for a Button and bind it's Tag property to the actual element to display text, instead of setting the Content property. Read to know more.

    Let us create a simple basic style for a button. For our example, we will not use any visually stunned button style. So, our button will just look like a TextBlock. Let's create the style with a TextBlock control as shown below:
     
    <Style x:Key="ButtonStyle" TargetType="Button">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid>
                        <TextBlock TextWrapping="Wrap" 
                                   VerticalAlignment="Center"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
     
    Here you will see that, we just have a normal TextBlock as our ControlTemplate of the button control. Now instead of binding the Content property to the Text property of the TextBlock, we want to bind it with the Tag property of the button. Here in this case, the Tag property is an first level ancestor property of the TextBlock control.
     
    Let us modify our style which will look as below:
     
    <Style x:Key="ButtonStyle" TargetType="Button">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid>
                        <TextBlock TextWrapping="Wrap" 
                                   Text="{Binding Tag, RelativeSource={RelativeSource AncestorType=Button, AncestorLevel=1}}"
                                   VerticalAlignment="Center"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
     
    You will notice here that, the Text property of the TextBlock is binded to the Tag property of the button. As this is one level up to the TextBlock and very close to the binded element, we used here AncestorLevel=1. AncestorType=Button defines the control which it was binded with.

    Read more: Kunal's Blog

    Posted via email from Jasper-net