Since Yammer launched as the “Twitter for businesses” at TechCrunch 50 in 2008, the startup has continued to improve on its already solid product, releasing mobile apps and new desktop clients, adding threaded conversations, and more. The fact is that in just under two years, Yammer, which we use at TechCrunch for internal communications, is being used by more than one million users and 80,000 companies worldwide (which includes 80% of the Fortune 500). That’s impressive growth for the startup, which has raised $15 million in funding and is doubling revenue every quarter. But the social enterprise arena is competitive with Salesforce Chatter, Jive, Socialcast and many others vying for a piece of the pie. However, Yammer is going to be releasing a new version of its application at TechCrunch Disrupt this fall which could be a game-changer. The new Yammer will essentially turn the microblogging application into a full fledged social network. Yammer plans to add a number of applications to its platform that will increase its functionality beyond just a communications platform. An events application will allow you to invite co-workers to company or group events and track responses. Attendees can also download the event into their calendar. Read more: Techcrunch
Yammer 2.0 To Launch As A Powerful, Full-Fledged Social Network For The Enterprise
Since Yammer launched as the “Twitter for businesses” at TechCrunch 50 in 2008, the startup has continued to improve on its already solid product, releasing mobile apps and new desktop clients, adding threaded conversations, and more. The fact is that in just under two years, Yammer, which we use at TechCrunch for internal communications, is being used by more than one million users and 80,000 companies worldwide (which includes 80% of the Fortune 500). That’s impressive growth for the startup, which has raised $15 million in funding and is doubling revenue every quarter. But the social enterprise arena is competitive with Salesforce Chatter, Jive, Socialcast and many others vying for a piece of the pie. However, Yammer is going to be releasing a new version of its application at TechCrunch Disrupt this fall which could be a game-changer. The new Yammer will essentially turn the microblogging application into a full fledged social network. Yammer plans to add a number of applications to its platform that will increase its functionality beyond just a communications platform. An events application will allow you to invite co-workers to company or group events and track responses. Attendees can also download the event into their calendar. Read more: Techcrunch
Jailbreak your PlayStation 3 with your Android phone (or TI-84 calculator...)
Posted by
jasper22
at
11:26
|
Over the past week, a lot has changed in the PS3 modding and hacking community. In just a few short days, the PS3 has shifted from almost-impossible-to-hack to become both the easiest and cheapest console to jailbreak. All you need is a USB memory stick and some open-source code -- or an Android phone or TI-84 calculator. I should warn you that Sony has just released a firmware fix that renders this hack null and void -- if you've already updated your PS3, you can stop reading now. I should also disclaim that this hack might break your PS3 (but it's extremely unlikely). Read more: DownloadSquad
Behind the Scenes and Inside Workings of a CERT
Posted by
jasper22
at
11:21
|
Ireland's Computer Emergency Response Team differs from what you can find in most other countries, since it's not government-backed and relies mainly on the good will of several security professionals. In this interview, the founder and head of the CERT, Brian Honan, talks about how the CERT was formed, what equipment they use and what challenges they face in their daily work without having a government to back them up. Read more: Slashdot
Convert a PowerPoint 2010 Presentation to Video
Posted by
jasper22
at
11:19
|
Woman Wins Libel Suit By Suing Wrong Website
Posted by
jasper22
at
10:49
|
It appears that Cincinnati Bengals cheerleader Sarah Jones and her lawyer were so upset by a comment on the site TheDirty.com that they missed the 'y' at the end of the name. Instead, they sued the owner of TheDirt.com, whose owner didn't respond to the lawsuit. The end result was a judge awarding $11 million, in part because of the failure to respond. Now, both the owners of TheDirty.com and TheDirt.com are complaining that they're being wrongfully written about in the press — one for not having had any content about Sarah Jones but being told it needs to pay $11 million, and the other for having the content and having the press say it lost a lawsuit, even though no lawsuit was ever actually filed against it Read more: Slashdot
Wine 1.3.2 has been Released
Posted by
jasper22
at
10:48
|
The Wine development release 1.3.2 is now available.Whats new in this release:* Update of the Gecko engine, now including a 64-bit version.
* New implementation of console support on Unix terminals.
* Many new functions in the C runtime dlls.
* Various bug fixes."The source is available now. Binary packages are in the process of being built, and will appear soon at their respective download locations. Bugs fixed in 1.3.2:
3582 Moray 3.5 page fault in PE after call to CallWindowProcA
5541 WriteConsole can't write to stdout; affects e.g. wsh's cscript's usage message
6994 Crimsonland's background textures fail to render
8822 VB6.0 program crashes
10885 Some bitmaps are drawn topside-down (Lazarus 0.9.24)Read more: Linux Today
* New implementation of console support on Unix terminals.
* Many new functions in the C runtime dlls.
* Various bug fixes."The source is available now. Binary packages are in the process of being built, and will appear soon at their respective download locations. Bugs fixed in 1.3.2:
3582 Moray 3.5 page fault in PE after call to CallWindowProcA
5541 WriteConsole can't write to stdout; affects e.g. wsh's cscript's usage message
6994 Crimsonland's background textures fail to render
8822 VB6.0 program crashes
10885 Some bitmaps are drawn topside-down (Lazarus 0.9.24)Read more: Linux Today
EXPRESSION IS HIRING
Posted by
jasper22
at
10:36
|
The mission of the Expression team at Microsoft is to deliver great tools that enable designers and developers to create outstanding user experiences. We are currently working on a number of really interesting and challenging things – and we have some open positions to fill in development, test and program management.
Program management in the Expression team is, before anything else, about planning and designing our product in a holistic way. Beyond product design, PMs are also driving execution, partner relationships and all kind of other work that is required to deliver great software. REDMONDIf you are passionate about user experience and a tool builder by heart, with a good number of years of experience in designing, planning and delivering great software products,we’d love to hear from you. If you have specific experience with authoring tools for creative users or development tools, we’d love to hear from you even more. We have a a couple of positions for senior or principal PMs open in our Redmond offices, right on the Microsoft main campus. Read more: Electric Beach
Program management in the Expression team is, before anything else, about planning and designing our product in a holistic way. Beyond product design, PMs are also driving execution, partner relationships and all kind of other work that is required to deliver great software. REDMONDIf you are passionate about user experience and a tool builder by heart, with a good number of years of experience in designing, planning and delivering great software products,we’d love to hear from you. If you have specific experience with authoring tools for creative users or development tools, we’d love to hear from you even more. We have a a couple of positions for senior or principal PMs open in our Redmond offices, right on the Microsoft main campus. Read more: Electric Beach
Debugging SL apps with WinDebug or the Immediate Window to track memory leaks on a 64 bit machine
Posted by
jasper22
at
10:36
|
Today (second day after my vacation :-)), I’ve been looking for a solution to a rather nasty memory leak in a Silverlight application. Typically, you can do this in two ways: by using WinDebug, or through Visual Studio’s Immediate Window. I’m not going to go into the specifics of both – there are already blog posts about that, you can find a nice overview on how to debug Silverlight apps using WinDBG by Delay, another one by Ning Zhang here, and an overview of using it with the Visual Studio Immediate Window here. However, I stumbled upon a problem that kept me amused frustrated for a couple of hours. To be able to debug Silverlight apps this way, you need to load the sos coreclr extension. Typically, in WinDBG, you’d do this as such: !loadby sos coreclr This gave me an “unable to load”-error. No worries, maybe I had selected the wrong Internet Explorer process? So I tried the other active processes, and tried loading it again. Same problem. Quick check to see if my symbol path was ok: .sympath didn’t make me any wiser – everything looked ok Right. So I tried debugging through Visual Studio’s Immediate Window (remember, if you’re trying this you need to enable the unmanaged code / native code debugger in your project properties), and loading the sos coreclr extension there. Same problem. You don’t even want to know what happened next. I tried everything again, and again, and again with the exact path to sos.dll instead of through what was loaded in the iexplore.exe process. And again in WinDebug. And again in Visual Studio. And again by having a look at the process with Process Explorer to see if I didn’t miss the correct process for the 70th time. And again, in a different order. Et cetera ad infinitum. Nothing seemed to work. So I tried some backtracking: what’s different since I last did this? Well, I’ve now got a 64 bit processor, running Windows 7 – before I had a 32 bit processor running Windows XP.Read more: kevin dockx / icecream
Redirecting an initial navigation
Posted by
jasper22
at
10:35
|
One more post on the subject of keeping screens out of the backstack. A common scenario we see is a variation of the login screen scenario I mentioned the other week. In this case, the first page the user is supposed to see depends on some state saved in by the application (maybe a user preference for which screen to see first, or maybe based on trial mode, etc.) and whilst you want that first page to be in the back stack (ie, it is a legitimate place) you don’t want any additional “landing pages” taking up a slot in the backstack. Another situation where this arises is if your application is extending the Music + Videos hub or is registered as a Photo Extension and you need to show a different page when launched from these experiences. There are (at least) two ways of doing this; I’ll present two of them here along with a sample app that shows them in action. For my simple example, the trigger for showing a particular page is going to be whether the current time has an even or odd number of seconds (this is a silly example, but makes it easy to test both startup cases). In a real application the trigger might be based on incoming parameters, settings stored in IsoStore, etc. Cancelling Navigation
The first way to change your initial page is to cancel the incoming navigation to MainPage.xaml and then fire off the desired navigation instead. This is easily done in a few lines of code; firstly, at the end of the App constructor we add an event handler to the Navigating event: RootFrame.Navigating += new NavigatingCancelEventHandler(RootFrame_Navigating);In the event handler, we do several things. First, we check if the navigation is to MainPage.xaml (the NavigationPage specified in the WMAppManifest.xml file) and if not, we bail: // Only care about MainPage
if (e.Uri.ToString().Contains("/MainPage.xaml") != true)
return;Read more: Peter Torr's Blog
The first way to change your initial page is to cancel the incoming navigation to MainPage.xaml and then fire off the desired navigation instead. This is easily done in a few lines of code; firstly, at the end of the App constructor we add an event handler to the Navigating event: RootFrame.Navigating += new NavigatingCancelEventHandler(RootFrame_Navigating);In the event handler, we do several things. First, we check if the navigation is to MainPage.xaml (the NavigationPage specified in the WMAppManifest.xml file) and if not, we bail: // Only care about MainPage
if (e.Uri.ToString().Contains("/MainPage.xaml") != true)
return;Read more: Peter Torr's Blog
Silverlight dynamic point to point animation with EasingFunction
Posted by
jasper22
at
10:33
|
My article is divided into two section:
Section 1: Will show you how to create a point to point animation with EasingFunction using Blend
Section 2: How to set the point value dynamically in code behind Section 1:
I will ignore the project creation part.
I will use a simple Layout in MainPage.xamlLets open the MainPage.xaml in Expression Blend and create a Storyboard
In the timeline select image add a KeyFrame to 0 sec
Add the end keyFrame at 2 sec and move the image to some location (some location because the location will be controlled from the code behind)
Now add back EasingFunction to the end keyFrame:
Read more: Silverlight Next
Section 1: Will show you how to create a point to point animation with EasingFunction using Blend
Section 2: How to set the point value dynamically in code behind Section 1:
I will ignore the project creation part.
I will use a simple Layout in MainPage.xamlLets open the MainPage.xaml in Expression Blend and create a Storyboard
In the timeline select image add a KeyFrame to 0 sec
Add the end keyFrame at 2 sec and move the image to some location (some location because the location will be controlled from the code behind)
Now add back EasingFunction to the end keyFrame:
Read more: Silverlight Next
Listening to DependencyProperty changes in Silverlight
Posted by
jasper22
at
10:31
|
DependencyPropertyDescriptor prop = DependencyPropertyDescriptor.FromProperty(TextBox.TextProperty, myTextBox.GetType());
// add change handler
prop.AddValueChanged(myTextBox, (sender, args) =>
{});
prop.AddValueChanged(myTextBox, (sender, args) =>
{});
Unfortunately Silverlight has a limited set of meta-data functionality around the dependency property system, because the DependencyPropertyDescriptor does exist in Silverlight. In order to get a workaround I found a solution in which I get notified with help of the binding system. I simple use a relay object which value property is bound to the source property I want to get notified. The relay object contains a public event which raises when the value changes. Read more: Kiener's Blog
Advanced Silverlight bitmaps
Posted by
jasper22
at
10:30
|
Bitmap handling - using WriteableBitmap in particular differs greatly from WPF. In this article we look as the problems of loading bitmaps and generating them dynamically.Bitmaps from streams Although a bitmap source seems only to be creatable from other bitmaps or UIElements you can in fact create a bitmap from any suitably formatted stream using the SetSource method.
The only real problem here is that the stream of bytes that you provided have to take the form of a valid jpeg, png or gif and this makes it difficult to convert a raw bit stream into a finished bitmap.
As a simple example, let’s use the OpenFileDialog to read in an image stored on the local machine. This has to be called from a button handler or some user initiated code otherwise you generate a security error. So add a button to and an image control to a new Silverlight project and: using System.Windows.Media.Imaging;
using System.IO;To create a stream we first use the OpenFileDialog:private void button1_Click(object sender, RoutedEventArgs e)
{
Notice that we can’t use DialogResult as we would in WPF because Silverlight does things differently. Read more: I Programmer
The only real problem here is that the stream of bytes that you provided have to take the form of a valid jpeg, png or gif and this makes it difficult to convert a raw bit stream into a finished bitmap.
As a simple example, let’s use the OpenFileDialog to read in an image stored on the local machine. This has to be called from a button handler or some user initiated code otherwise you generate a security error. So add a button to and an image control to a new Silverlight project and: using System.Windows.Media.Imaging;
using System.IO;To create a stream we first use the OpenFileDialog:private void button1_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "JPEG Files (*.jpg;*.jpeg)|*.jpg;*.jpeg | All Files (*.*)|*.*";
ofd.FilterIndex = 1;
bool? result=ofd.ShowDialog();
Notice that we can’t use DialogResult as we would in WPF because Silverlight does things differently. Read more: I Programmer
Making your Content Scrollable
Posted by
jasper22
at
10:27
|
Every now and then, your application may require your users to scroll through a boatload of content. The following video shows an example of me scrolling through a large amount of content on the Windows Phone: The scrolling behavior you see in my application in the video is not provided by default. Even though the content I was displaying was too large to display on a single screen, I had to perform some additional steps to make sure my custom content could actually be scrolled. By the end of this brief tutorial, you too will learn the magic additional steps needed to allow users to scroll through your content.Getting Started
For this tutorial, simply make sure you have everything up and running to be able to create a Windows Phone, Silverlight, or WPF project using Expression Blend. While this tutorial is optimized for the Windows Phone, you’ll be able to use what you’ve learned in Silverlight and WPF as well.Introducing the ScrollViewer
All of the content you create lives inside layout panels such as the Grid, Canvas, or WrapPanel. All of these controls have their own unique abilities to make it easier for you to place and arrange your content. What they don't have is the ability to deal with content that goes outside of their boundaries. Read more: Kirupa.com
For this tutorial, simply make sure you have everything up and running to be able to create a Windows Phone, Silverlight, or WPF project using Expression Blend. While this tutorial is optimized for the Windows Phone, you’ll be able to use what you’ve learned in Silverlight and WPF as well.Introducing the ScrollViewer
All of the content you create lives inside layout panels such as the Grid, Canvas, or WrapPanel. All of these controls have their own unique abilities to make it easier for you to place and arrange your content. What they don't have is the ability to deal with content that goes outside of their boundaries. Read more: Kirupa.com
Silverlight 4 Application Template Themes by Microsoft
Posted by
jasper22
at
10:26
|
I watched John Papa’s Silverlight TV Ep 42: Apply and Customize the new Silverlight Themes this morning and decided to try it out. I felt that the documentation for getting started was sparse, so I decided to write my own to help the community. First, what is is and why do I care? The themes are designed to provide a navigation template for a Silverlight Business Application. If you are not a designer then chances are you are not going to make something this pretty. =) First, you should download the themes here. This pack includes the following themes :Cosmopolitan
Windows 7
Accent Color
Note: The Jet Pack is not available yet but should be available soon.After you download the theme pack and extract it you will get 2 folders, one for Expression Blend 4 and another for Visual Studio 2010. I had no problem installing the VS2010 by double clicking on the .VSIX file. The Visual Studio 2010 was straight-forward, so I will focus on Blend 4. The README_First.txt document says that you will need to copy the themes for Blend 4 into the %ProgramFiles%\Microsoft Expression\Blend 4\ProjectTemplates\en\CSharp\Silverlight folder. This is only correct for X86 installs of Expression Blend 4. For other X64 versions of Blend 4 you will need to copy the files into the \Program Files (x86)\Microsoft Expression\Blend 4\ProjectTemplates\en\CSharp\Silverlight folder. Read more: Michael Crump
Windows 7
Accent Color
Note: The Jet Pack is not available yet but should be available soon.After you download the theme pack and extract it you will get 2 folders, one for Expression Blend 4 and another for Visual Studio 2010. I had no problem installing the VS2010 by double clicking on the .VSIX file. The Visual Studio 2010 was straight-forward, so I will focus on Blend 4. The README_First.txt document says that you will need to copy the themes for Blend 4 into the %ProgramFiles%\Microsoft Expression\Blend 4\ProjectTemplates\en\CSharp\Silverlight folder. This is only correct for X86 installs of Expression Blend 4. For other X64 versions of Blend 4 you will need to copy the files into the \Program Files (x86)\Microsoft Expression\Blend 4\ProjectTemplates\en\CSharp\Silverlight folder. Read more: Michael Crump
Mim: the build system you always wanted
Posted by
jasper22
at
10:25
|
The word mim means any of the following:
Solution The solution to these problem is (of course) Mim. With Mim you clearly see all artifact the build system produces, how they are built, and when they need to be built. In fact, you can see the artifacts, e.g., by doing ls, before they are built. In other words, using your normal command line tools you can browse the project file tree to find the artifact you need (to run, to view, to copy, etc.) without building anything. Sounds like magic? Keep reading... Read more: Programmatically Speaking
- an incorrect way of writing 1999 in roman numbers (as in "we gonna party like it's 1999"),
- the Madame Mim from the Disney movie Sword in the Stone,
- Swedish for "mime" meaning "imitating"
- a figure in Norse mythology renowned for his wisdom
- an acronym for "Mim Isn't Make"
- make sure the dependencies are correct and built in the right order (think: make depend && make && make install),
- be sure of that every built file you see is up to date,
- hard understand how a software project is built (what are the artifacts? where are they stored? what are the dependencies?),
- hard to understand which variables a build have (e.g., make DEBUG=1)
Solution The solution to these problem is (of course) Mim. With Mim you clearly see all artifact the build system produces, how they are built, and when they need to be built. In fact, you can see the artifacts, e.g., by doing ls, before they are built. In other words, using your normal command line tools you can browse the project file tree to find the artifact you need (to run, to view, to copy, etc.) without building anything. Sounds like magic? Keep reading... Read more: Programmatically Speaking
Performing Back Navigation w/out adding a page to the Back Stack in WP7
Posted by
jasper22
at
10:23
|
In a previous post (here) I wrote about how you can catch the back button action on WP7. In this post I will explain how you can use the NavigationService provider in WP7 to correctly navigate back to a calling page in order to remove a existing page from the back stack in order to prevent the user from going back to the page. Below is a pretty simple sample work flow. You go from the home page, to a second page and then back to the home page. The item we want to discuss is how we go from the second page back to the home page.One way to perform navigation is to utilize the NavigationService and simply use Navigate and provide the URI to navigate to. See blow for an example NavigationService.Navigate( new Uri( "/MainPage.xaml", UriKind.RelativeOrAbsolute ) );The issue with this approach is that you are now creating a new page on the Navigation Stack. This means that if the user hits the back button on the phone they will be routed back to the SecondPage.xaml. Option #2 – Navigate from the SecondPage.xaml to the MainPage.xaml using the NavigationService.GoBack()When you use the NavigationService provider to perform back navigation using the GoBack() you do not add a new page to the stack, this is a GOOD thing. This means that if the user hits the back button on the MainPage.xaml they will NOT be routed back to the SecondPage.xaml again. if ( NavigationService.CanGoBack )
{
NavigationService.GoBack();
}Read more: Derik Whittaker
{
NavigationService.GoBack();
}Read more: Derik Whittaker
XML parsers
Posted by
jasper22
at
09:52
|
Hi ! This is a list of best open-source XML Parsers for any language (C++, C#, Python, etc..)Expat
Expat is an XML parser library written in C. It is a stream-oriented parser in which an application registers handlers for things the parser might find in the XML document (like start tags). TagSoup - SAX-compliant parser in Java
TagSoup, a SAX-compliant parser written in Java that, instead of parsing well-formed or valid XML, parses HTML as it is found in the wild: poor, nasty and brutish, though quite often far from short. TagSoup is designed for people who have to process this stuff using some semblance of a rational application design. TagSoup also includes a command-line processor that reads HTML files and can generate either clean HTML or well-formed XML that is a close approximation to XHTML. Arbica
Arabica is an XML and HTML processing toolkit, providing SAX, DOM, XPath, and partial XSLT implementations, written in Standard C++.Libxml
Libxml2 is the XML C parser and toolkit developed for the Gnome project (but usable outside of the Gnome platform), it is free software available under the MIT License.Xerces-C++
Xerces-C++ is a validating XML parser written in a portable subset of C++. Xerces-C++ makes it easy to give your application the ability to read and write XML data.Libxml++
libxml++ is a C++ wrapper for the libxml XML parser library.
Expat is an XML parser library written in C. It is a stream-oriented parser in which an application registers handlers for things the parser might find in the XML document (like start tags). TagSoup - SAX-compliant parser in Java
TagSoup, a SAX-compliant parser written in Java that, instead of parsing well-formed or valid XML, parses HTML as it is found in the wild: poor, nasty and brutish, though quite often far from short. TagSoup is designed for people who have to process this stuff using some semblance of a rational application design. TagSoup also includes a command-line processor that reads HTML files and can generate either clean HTML or well-formed XML that is a close approximation to XHTML. Arbica
Arabica is an XML and HTML processing toolkit, providing SAX, DOM, XPath, and partial XSLT implementations, written in Standard C++.Libxml
Libxml2 is the XML C parser and toolkit developed for the Gnome project (but usable outside of the Gnome platform), it is free software available under the MIT License.Xerces-C++
Xerces-C++ is a validating XML parser written in a portable subset of C++. Xerces-C++ makes it easy to give your application the ability to read and write XML data.Libxml++
libxml++ is a C++ wrapper for the libxml XML parser library.
(more..)Read more: BestOpenSource
Downloading in Chunks using WCF and Silverlight
Posted by
jasper22
at
09:46
|
AcknowledgementThe project is about downloading the large file (GB) in chunks. You can download the large file with less time without getting any error. Most people use chunk in video streaming and for P2P Network. The chunk selection in P2P network is very crucial. Chunk was written to serve one purpose, and do it well: Split files into differently-sized chunks, primarily so that large files can be transported via media that is smaller than the size of the file. IntroductionWe need a functionality that can download the large file. Downloading large file in one shoot is risky so the idea is from the UI (silverlight application) user can call the WCF function to download the Chunk (let’s say 10 MB) per call. Once WCF return the Chunk data silverlight application will open the FileDialog and write the data into the stream, if the file size is grater than the chunk size, program will call the WCF function again and get the next chunk. This way you can securely download the large file. Here we are going to use Silverlight and WCF technology. Background Let’s say you want to download the large file from your UI (which is running on client side) and the file is reside at server side. You can call the WCF function and get the chunk of data and write this data into the FileStream. The WCF function will be recursive so that this function will get the Chunk of data till entire file has been downloading. Using the CodeThe attached solution contains two projects, one is silverlight and other one is web project which contains the XAP file as well as Service class.The following function is in silverlight page which calls the WCF function to get the Chunk data: Note: you have to entered valid fileSize (size of the document in Bytes) in the code.Read more: Codeproject
OPENSource библиотеки структур данных и математические библиотеки
Posted by
jasper22
at
09:29
|
Итак: ВСЕ любят OpenSource. Ну, или, по крайней мере, 99% говорят и считают, что OpenSource — это хорошо. Я тоже так считаю. На OpenSource библиотеках очень хорошо учиться. Обычно OpenSource это большие проекты (для студента, все, что больше 3-4 тысяч строк уже серьезная вещь), которые писали разные люди, в разное время. Можно посмотреть стиль кода, стили написания, организацию, нотации именования переменных. Можно посмотреть, чем вообще занимаются люди вокруг — ведь с тобой в университете учится очень мало специалистов, интересы с которыми у тебя одни сходятся. Например: Я программирую на 3 языках, а сосед на N других, есть пара электронщиков, админов и целая армия разгильдяев. В итоге, на весь курс находится лишь десяток человек, у которых можно хоть чему-то научиться.
Хочу рассказать немного о моих изысканиях по codeplex and googlecode по части матбилиотек и библиотек структур данных. С одной стороны — я был в восторге, работая с некоторыми из них, с другой стороны — руки опускаются, когда видишь, что последний коммит был аж в 2007-2008 году. Но обо всем по порядку. Статью я поделил на несколько частей, что бы сразу не перегружать её большим количеством информации. Вначале я расскажу о библиотеках на C# и затем сравню с тем, что нашел по части Java.
Итак, список того, что я смотрел и куда даже пытался делал коммиты:Часть1:Numerical Methods on C#
Numerical Methods on Silverlight
Npack
SmartMathLibrary
DynaPrecisionЧасть2:DotRandom
FreeMath
Yacascs
И многое другоеЧасть 3 (не opensource)DotNumerics
NMath .NET
F# for Numerics
MATLAB Builder NE
Extreme Optimization Numerical Libraries for .NET
IMSL Library
Перед началом рассказа хочу сразу сказать- тестирование производительности я не проводил, тк для этого нужны конкретные задачи, а не сферические кони в вакууме, которые я могу придумать, да и работенка это на пару месяцев минимум. Read more: Habrahabr.ru Part 1, Part 2
Хочу рассказать немного о моих изысканиях по codeplex and googlecode по части матбилиотек и библиотек структур данных. С одной стороны — я был в восторге, работая с некоторыми из них, с другой стороны — руки опускаются, когда видишь, что последний коммит был аж в 2007-2008 году. Но обо всем по порядку. Статью я поделил на несколько частей, что бы сразу не перегружать её большим количеством информации. Вначале я расскажу о библиотеках на C# и затем сравню с тем, что нашел по части Java.
Итак, список того, что я смотрел и куда даже пытался делал коммиты:Часть1:Numerical Methods on C#
Numerical Methods on Silverlight
Npack
SmartMathLibrary
DynaPrecisionЧасть2:DotRandom
FreeMath
Yacascs
И многое другоеЧасть 3 (не opensource)DotNumerics
NMath .NET
F# for Numerics
MATLAB Builder NE
Extreme Optimization Numerical Libraries for .NET
IMSL Library
Перед началом рассказа хочу сразу сказать- тестирование производительности я не проводил, тк для этого нужны конкретные задачи, а не сферические кони в вакууме, которые я могу придумать, да и работенка это на пару месяцев минимум. Read more: Habrahabr.ru Part 1, Part 2
Silverlight how-to: Inherit from an Implicit Style
Posted by
jasper22
at
09:24
|
Since Silverlight 4 you can use Implicit Styles: http://weblogs.asp.net/lduveau/archive/2009/11/18/silverlight-4-implicit-styling.aspx Basically it is just a style defined in resource without a key. As you don’t have a key you may wonder how you could inherit (BasedOn) from an implicit style?Surprisingly lots of people are not aware of this, so here is how you can inherit from an implicit style: 1. Add a key to your implicit style (so it won’t be implicit anymore… but wait)Microsoft use this technique in the Silverlight Toolkit, and their naming convention is DefaultXXXStyle.So for a Button you would create DefaultButtonStyle like this sample: <Style TargetType="Button" x:Key="DefaultButtonStyle">
<Setter Property="Background" Value="BlueViolet"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontFamily" Value="Verdana"/>
<Setter Property="FontSize" Value="11"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</Style>2. Create a new Implicit Style based on this style:<Style TargetType="Button" BasedOn="{StaticResource DefaultButtonStyle}" />Now all your button will take DefaultButtonStyle as their implicit style. Read more: Laurent Duveau
<Setter Property="Background" Value="BlueViolet"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontFamily" Value="Verdana"/>
<Setter Property="FontSize" Value="11"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</Style>2. Create a new Implicit Style based on this style:<Style TargetType="Button" BasedOn="{StaticResource DefaultButtonStyle}" />Now all your button will take DefaultButtonStyle as their implicit style. Read more: Laurent Duveau
A Tiled Image Brush for Silverlight
Posted by
jasper22
at
09:23
|
The Silverlight ImageBrush does not support the TileMode property that exists in WPF, and as a result there is no built in way to have tiled images as a background brush for your controls and styles. The following control may be useful to you if you find yourself wanting to achieve the same things as a WPF tiled image brush.You can grab the source here. It is a control that behaves like a Border control, except that it also has a TiledImageSource property that you can use to select an image resource from the project. The TiledBGControl control (um, didn’t think too hard about naming it) is a viewless control, so you can change its default control template the same way you can for any other control. This is the structure of the default control template Read more: Silverlight Scratchpad
Blend Bits
Posted by
jasper22
at
09:22
|
I’m not a designer but I’ve been using Expression Blend since before it was first released for both Silverlight and WPF applications and it occurred to me that it might be useful to share some miniature tips/tricks around Blend in very short occasional blog posts so I’m going to have a go at that. I’ll publish them under a category of “Blend Bits” and I’ll focus primarily on Silverlight. The category should show up here and grow over time.Read more: Blend Bits
Microsoft SQL Server Protocol Documentation
Posted by
jasper22
at
09:21
|
The Microsoft SQL Server protocol documentation provides technical specifications for Microsoft proprietary protocols that are implemented and used in Microsoft SQL Server 2008.The Microsoft SQL Server protocol documentation provides detailed technical specifications for Microsoft proprietary protocols (including extensions to industry-standard or other published protocols) that are implemented and used in Microsoft SQL Server to interoperate or communicate with Microsoft products. The documentation includes a set of companion overview and reference documents that supplement the technical specifications with conceptual background, overviews of inter-protocol relationships and interactions, and technical reference information Read more: MS Download
Silverlight Visual Effects (e.g. drop shadow, blur, and mirror images)
Posted by
jasper22
at
09:09
|
There's a new Silverlight Visual Effects QuickStart that was just published. This offers quick instructions on how to add visual effects like drop shadows, mirror images, and blurs to your Silverlight content. Read more: Silverlight SDK
Read more: Silverlight Effect
Read more: Silverlight Effect
The implementation of virtual network learning TCP / IP
Posted by
jasper22
at
09:06
|
This series of articles on how to build your own virtual network and remote control from server side (in C#)
P.S. The text is Japanese so use Google Translate (or Chrome will do it automatically)
Read more: CodeZine
SQL SERVER – Find Row Count in Table – Find Largest Table in Database – T-SQL
Posted by
jasper22
at
09:01
|
I have written following script every time when I am asked by our team leaders or managers that how many rows are there in any particular table or sometime I am even asked which table has highest number of rows. Being Sr. Project Manager, sometime I just write down following script myself rather than asking my developers. This script will gives row number for every table in database.USE AdventureWorks
GO
SELECT OBJECT_NAME(OBJECT_ID) TableName, st.row_count
FROM sys.dm_db_partition_stats st
WHERE index_id < 2
ORDER BY st.row_count DESC
GO It is very good to see excellent participation there. In my script I had not taken care of table schema. SQL Server Expert Ameena has modified the same script to include the schema. Here is the new modified script. SELECT sc.name +'.'+ ta.name TableName
,SUM(pa.rows) RowCnt
FROM sys.tables ta
INNER JOIN sys.partitions pa
ON pa.OBJECT_ID = ta.OBJECT_ID
INNER JOIN sys.schemas sc
ON ta.schema_id = sc.schema_id
WHERE ta.is_ms_shipped = 0 AND pa.index_id IN (1,0)
GROUP BY sc.name,ta.name
ORDER BY SUM(pa.rows) DESC Above query will return following resultset.Read more: Journey to SQL Authority with Pinal Dave Part 1, Part 2
GO
SELECT OBJECT_NAME(OBJECT_ID) TableName, st.row_count
FROM sys.dm_db_partition_stats st
WHERE index_id < 2
ORDER BY st.row_count DESC
GO It is very good to see excellent participation there. In my script I had not taken care of table schema. SQL Server Expert Ameena has modified the same script to include the schema. Here is the new modified script. SELECT sc.name +'.'+ ta.name TableName
,SUM(pa.rows) RowCnt
FROM sys.tables ta
INNER JOIN sys.partitions pa
ON pa.OBJECT_ID = ta.OBJECT_ID
INNER JOIN sys.schemas sc
ON ta.schema_id = sc.schema_id
WHERE ta.is_ms_shipped = 0 AND pa.index_id IN (1,0)
GROUP BY sc.name,ta.name
ORDER BY SUM(pa.rows) DESC Above query will return following resultset.Read more: Journey to SQL Authority with Pinal Dave Part 1, Part 2
Host your own Web Server in your application using IIS 7.0 Hostable Web Core
Posted by
jasper22
at
08:58
|
IIS 7.0 includes a very cool feature that is not so well known called Hostable WebCore (HWC). This feature basically allows you to host the entire IIS functionality within your own process. This gives you the power to implement scenarios where you can customize entirely the functionality that you want "your Web Server" to expose, as well as control the lifetime of it without impacting any other application running on the site. This provides a very nice model for automating tests that need to run inside IIS in a more controlled environment. This feature is implemented in a DLL called hwebcore.dll, that exports two simple methods:
The real trick for this feature is to know exactly what you want to support and "craft" the IIS Server configuration needed for different workloads and scenarios, for example:
All of the above
An interesting thing to mention is that the file passed to ApplicationHostConfigPath parameter is live, in the sense that if you change the configuration settings your "in-process-IIS" will pick up the changes and apply them as you would expect to. In fact even web.config's in the site content or folder directories will be live and you'll get the same behavior. Read more: IIS
- WebCoreActivate. This method allows you to start the server. It receives three arguments, out of which the most important one is applicationHostConfigPath that allows you to point it to your very own copy of ApplicationHost.config where you can customize the list of modules, the list of handlers and any other settings that you want your "in-proccess-IIS" to use. Just as ApplicationHost.config you can also specify the "root web.config" that you want your server to use, giving you the ability to completely run an isolated copy of IIS.
- WebCoreShutdown. This method basically stops the server listening.
The real trick for this feature is to know exactly what you want to support and "craft" the IIS Server configuration needed for different workloads and scenarios, for example:
- Static Files Web Server - Supporting only static file downloads, good for HTML scenarios and other simple sites.
- Dynamic Web Sites
- ASPX Pages
- WCF
- Custom set of Http Modules and Handlers
An interesting thing to mention is that the file passed to ApplicationHostConfigPath parameter is live, in the sense that if you change the configuration settings your "in-process-IIS" will pick up the changes and apply them as you would expect to. In fact even web.config's in the site content or folder directories will be live and you'll get the same behavior. Read more: IIS
DllHijackAuditor
Posted by
jasper22
at
08:54
|
DllHijackAuditor is the smart tool to Audit against the Dll Hijacking Vulnerability in any Windows application. This is recently discovered critical security issue affecting almost all Windows systems on the planet. It appears that large amount of Windows applications are currently susceptible to this vulnerability which can allow any attacker to completely take over the system. Read more: Security Exploded
Breathing New Life Into Old DirectDraw Games
I bought a bunch of old Wing Commander games for Windows, but they use DirectDraw, which Microsoft has deprecated. They don't work too well under Windows 7, so I ended up reimplementing ddraw.dll using OpenGL to output the games' graphics. I wrote an article describing the process and all the fun workarounds I had to come up with, and released all related source code for others to hack on. Read more: Slashdot
Getting Started with Drupal: A Comprehensive Hands-On Guide
Posted by
jasper22
at
09:57
|
Drupal is a popular open source content management system. With its powerful and advanced features, you can build complex websites with ease, compared to building them from scratch. With the support of a huge community and a big number of available modules, no wonder Drupal is a system you keep hearing about over and over again. In this guide, we are going to discover Drupal using a pragmatic approach. We will create a Drupal site with a custom content type and views.Ready? Let’s dive right into this immensely powerful content management system. ObjectivesBy the end of this guide, you will:
What We Will CreateWe will set up and develop a basic Drupal website with a job board that visitors can post job openings and projects to. The intention here is to get you started using Drupal by actually creating a Drupal site instead of just reading about it. Read more: Six Revisions
- Learn the benefits and disadvantages of using Drupal
- Install Drupal
- Understand the Drupal back-end
- Learn about Drupal modules
- Explore the Administer page
- Create and publish content
- Create custom content types with the Content Construction Kit
- Create Views
- Create Page view displays
- Create Block view displays
- Learn about Drupal themes
What We Will CreateWe will set up and develop a basic Drupal website with a job board that visitors can post job openings and projects to. The intention here is to get you started using Drupal by actually creating a Drupal site instead of just reading about it. Read more: Six Revisions
var vs dynamic keyword in C# 4.0
Posted by
jasper22
at
09:49
|
To put it as simple as possible, there is a simple difference between the C# ‘var’ and ‘dynamic’ keyword. When using the ‘var’ keyword, the type is decided by the compiler at compile time, whereas when using the ‘dynamic’ keyword, the type is decided by the runtime. If you have been doing C# programming lately, you are already aware of the ‘var’ keyword, a strongly implicitly typed local variable for which the compiler is able to determine the type from the initialization expression - very useful when doing LINQ programming. The ‘dynamic’ keyword was introduced in .NET 4.0 framework which also introduced the Dynamic Language Runtime (DLR) to accommodate dynamic languages like IronRuby and IronPython [are they dead?]. C# 4.0 provides access to this DLR using the new ‘dynamic’ keyword. C# is a statically typed language and the ‘dynamic' type automatically tells the compiler that it is a dynamic invocation, so ignore the compile time checking for this type. This also means that any invalid operations will only be detected at runtime. Read more: devcurry
Child Window in WPF
Posted by
jasper22
at
09:48
|
Let us assume there is a requirement, On click event of button, a new child window should open. While child window is open, the parent window should be inactive.So start with Step 1: Create a WPF application. And drag and drop a Button on the MainPage.
<Grid>
On the button click event. An instance of Child window is being created. Then ShowDialog() method is being called to open the child window .Read more: C# Corner
<Grid>
<Button x:Name="ButtonNewWindow" Hright="100" Width="Auto" Content="Open new Window" /></Grid>Step 2: Right click on the WPF project and new item and select a WPF Window from WPF tab. Rename window to ChildWindow.xamlStep 3: Now on the click event of button child window will get open. ButtonNewWindow.Click += new RoutedEventHandler (delegate(object sender, RoutedEventArgs e)
{
ChildWindow chlWindow = new ChildWindow();MessageBox.Show(chlWindow.GetMessage());chlWindow.ShowDialog();
}
On the button click event. An instance of Child window is being created. Then ShowDialog() method is being called to open the child window .Read more: C# Corner
Web Forms with the MVP Pattern
Posted by
jasper22
at
09:42
|
Read more: Dino Esposito
Read more: MSDN Magazine
Why ASMX web services are not an excuse anymore with WCF 4.0
Posted by
jasper22
at
09:41
|
ASXM web services has been the favorite choice for many developers for building soap web services in .NET during a long time because of its simplicity. With ASMX web services, you get a web service up and running in a matter of seconds, as it does not require any configuration. The only thing you need to do is to build the service implementation and the message contracts (xml serialization classes), and that’s all. However, when you build a system as a black box with most of the configuration hardcoded, and only a few extensibility points in mind, you will probably end up with something that is very easy to deploy and get running, but it can not be customized at all. That’s what an ASMX web service is after all, you don’t have a way easily change the protocol versions, encoders, security or even extend with custom functionality (SOAP extensions are the only entry point for extensibility, which work as message inspectors in WCF). On the other hand, you have WCF, which is extensible beast for building services among other things. The number of extensibility points that you will find in WCF is extremely high, but the downside is that configuration also becomes extremely complex and a nightmare for most developers that only want to get their services up and running. Fortunately, the WCF team has considerably improved the configuration experience in WCF 4.0, making possible to run a service with almost no configuration. The approach that they have taken for this version is to make everything work with no configuration, and give the chance to override what you actually need for a given scenario. For instance, a WCF service that uses http as transport behaves a ASMX web service by default (it uses basicHttpBinding with SOAP 1.2, transport security, text encoding and Basic profile 1.1) unless you change that. So, how can you create a new WCF service as you did before with ASMX ?. That’s simple and you need to follow these steps, Read more: Pablo M. Cibraro (aka Cibrax)
Silverlight.Hosting Library
Posted by
jasper22
at
09:40
|
Silverlight.Hosting is a lightweight, easy-to-use library for embedding Silverlight content into a WPF or Windows Forms application.Read more: Codplex
Errors installing ASP.NET 4.0
Posted by
jasper22
at
09:39
|
Here is a little problem you might run into when trying to use aspnet_regiis.exe to register ASP.NET 4 on a site.C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -i
Start installing ASP.NET (4.0.30319).
.......
Finished installing ASP.NET (4.0.30319).
Setup has detected some errors during the operation. For details, please read the setup log file C:\Users\john\AppData\Local\Temp\ASPNETSetup_00003.log C:\Windows\Microsoft.NET\Framework\v4.0.30319>When you look into the mentioned log file and search for “fail” you find this:2010-09-06 14:27:18 Failure Changing IIS ApplicationHost.config: IIS7Register failed with HRESULT 800700b7: 'Cannot create a file when that file already exists. ' So what’s that all about?Turns out it is actually down to the fact that aspnet_regiis.exe does not cope too well with the generally accepted environment variable that expands to the Windows directory. So when you look in your applicationHost.config file (in \windows\system32\inetsrv\config) you may find something like this: <isapiCgiRestriction>
<add path="%windir%\system32\inetsrv\asp.dll" allowed="true" groupId="ASP" description="Active Server Pages" />
<add path="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" allowed="true" groupId="ASP.NET v2.0.50727" description="ASP.NET v2.0.50727" />
<add path="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" allowed="true" groupId="ASP.NET v2.0.50727" description="ASP.NET v2.0.50727" />
<add path="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" allowed="true" groupId="ASP.NET v4.0.30319 (32-bit)" description="ASP.NET v4.0.30319 (32-bit)" />
If you change the highlighted bits to the appropriate hard coded location (e.g. c:\windows ) and try again you should find it works.Read more: Notes from a dark corner
Start installing ASP.NET (4.0.30319).
.......
Finished installing ASP.NET (4.0.30319).
Setup has detected some errors during the operation. For details, please read the setup log file C:\Users\john\AppData\Local\Temp\ASPNETSetup_00003.log C:\Windows\Microsoft.NET\Framework\v4.0.30319>When you look into the mentioned log file and search for “fail” you find this:2010-09-06 14:27:18 Failure Changing IIS ApplicationHost.config: IIS7Register failed with HRESULT 800700b7: 'Cannot create a file when that file already exists. ' So what’s that all about?Turns out it is actually down to the fact that aspnet_regiis.exe does not cope too well with the generally accepted environment variable that expands to the Windows directory. So when you look in your applicationHost.config file (in \windows\system32\inetsrv\config) you may find something like this: <isapiCgiRestriction>
<add path="%windir%\system32\inetsrv\asp.dll" allowed="true" groupId="ASP" description="Active Server Pages" />
<add path="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" allowed="true" groupId="ASP.NET v2.0.50727" description="ASP.NET v2.0.50727" />
<add path="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" allowed="true" groupId="ASP.NET v2.0.50727" description="ASP.NET v2.0.50727" />
<add path="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" allowed="true" groupId="ASP.NET v4.0.30319 (32-bit)" description="ASP.NET v4.0.30319 (32-bit)" />
If you change the highlighted bits to the appropriate hard coded location (e.g. c:\windows ) and try again you should find it works.Read more: Notes from a dark corner
Deiphobus
Posted by
jasper22
at
09:37
|
Deiphobus is a fully object oriented, fluently configurable wrapper for Cassandra, providing pooling, connection distributing, and querying your keyspaces for objects with the specified properties (based on inverted indexes). Read more: Codeplex
Make a T-SQL Query Sleep for a certain amount of time
Posted by
jasper22
at
09:36
|
At times, in test scenarios, you may want to emulate that a transaction or a T-SQL query takes ‘x’ amount of time. Well that is possible (although not with precision) in SQL Server (2005/2008) using the WAITFOR command. Here’s an example of delaying query execution till a specified time interval has elapsed – let us say 10 secondsUSE Northwind
WAITFOR DELAY '00:00:10';
SELECT LASTNAME, FIRSTNAME FROM Employees; Read more: SQL Server curry
WAITFOR DELAY '00:00:10';
SELECT LASTNAME, FIRSTNAME FROM Employees; Read more: SQL Server curry
“Impossible” Soccer Kick Leads to New Physics Equation
Posted by
jasper22
at
12:58
|
In 1997, Brazilian soccer player Roberto Carlos scored on a free kick that first went right, then curved sharply to the left in what looked like a physics-defying fluke. We’ve finally discovered the physics equation that shows it was no fluke. The amazing goal — which left French goalkeeper Fabien Barthez too stunned to react — was scored during a friendly match in the run up to the 1998 World Cup. A group of French scientists, perhaps desperate to prove that at least the laws of physics weren’t actively rooting against their national team, have been able to figure out the trajectory of the ball and, with it, an equation to describe its unusual path. It all comes down to the fact that, when a sphere spins, its trajectory is a spiral. Usually, gravity and the relatively short distance the ball travels cover up this spiral trajectory, but Carlos was a mere 115 feet away and kicked the ball hard enough to reveal its true spiral-like path. As you can see in the diagram above, the ball would have kept spiraling if gravity (and the netting) hadn’t gotten in the way. Read more: Wired
Create and Customize Quick Steps in Outlook 2010
Posted by
jasper22
at
10:48
|
A new feature in Outlook 2010 is the ability to apply multiple actions at once to your email messages. Here we will take a look at creating your own Quick Steps for managing your email in Outlook 2010. Customize Quick Steps
If you’re using Outlook 2010 you’ll notice the new Quick Steps section in the Ribbon. There are some included by default and they can be customized. To configure or change Quick Steps, on the Home Tab, use the dropdown arrow in the Quick Steps box, then select Manage Quick Steps.
The Manage Quick Steps window opens and here we’re going to modify the To Manager step. Highlight To Manager and click on the Edit button.
Now we can edit the step. For example, we want to always forward certain emails to our boss. Enter in your managers email address and you can also select to flag it, select the type of importance, and add extra text for it. We also added an action to move the email to a specific folder in Outlook. Read more: How-to-geek
If you’re using Outlook 2010 you’ll notice the new Quick Steps section in the Ribbon. There are some included by default and they can be customized. To configure or change Quick Steps, on the Home Tab, use the dropdown arrow in the Quick Steps box, then select Manage Quick Steps.
The Manage Quick Steps window opens and here we’re going to modify the To Manager step. Highlight To Manager and click on the Edit button.
Now we can edit the step. For example, we want to always forward certain emails to our boss. Enter in your managers email address and you can also select to flag it, select the type of importance, and add extra text for it. We also added an action to move the email to a specific folder in Outlook. Read more: How-to-geek
Controversial ‘Duke Nukem Forever’ Will Finally Be Released
Posted by
jasper22
at
10:17
|
“Duke Nukem Forever,” a video game synonymous with never being released, is finally being released.The first person shooter about a space marine with a penchant for off-color humor who battles aliens with increasingly destructive weapons, was to be the fourth installment in a series of games that garnered critical praise and generated controversy for its depiction of women. After 10 years in development, 3D Realms, the studio behind the game, announced it was shutting down in 2009. The game is being finished by Gearbox Software and will be published by Take-Two Interactive, publisher of the “Grand Theft Auto” series. The game is being shown to consumers and the press for the first time at a video game convention today. Gearbox hopes to release the game next year. Announced in 1997, “Duke Nukem Forever” went through numerous changes as developer 3D Realms tried to keep pace with new technology its competitors were introducing into their games. As Scott Miller, then owner and CEO of 3D Realms, puts it: “We were probably too much of a perfectionist about the game. When some other game had some great feature come out we wanted to match it.” In addition, the studio managed to produce a slate of other games, like 2006’s “Prey.” “We’d been distracted on other games like ‘Prey.’ It was a combination of those things. We were trying to build a game that was too great,” he says. Read more: The Wall Street Journal
MSDN Magazine > September 2010 Issue
Posted by
jasper22
at
10:17
|
Async Tasks: Simplify Asynchronous Programming with Tasks;
Concurrency: Throttling Concurrency in the CLR 4.0 ThreadPool;
Async Agents: Actor-Based Programming with the Asynchronous Agents Library;
App Migration: Migrate Your ASP.NET 1.1 Apps to Visual Studio 2010;
Data-Bound Design: Create a Silverlight 4 Web Part for SharePoint 2010;
SQL Server and MapPoint: Making MapPoint 2010 and SQL Server Spatial Work Together;
The Working Programmer: Multiparadigmatic .NET, Part 1;
UI Frontiers: Touch and Response;
Cutting Edge: Better Web Forms with the MVP Pattern;
Security Briefs: The MSF-Agile+SDL Process Template for TFS 2010;
Test Run: Request-Response Testing Using IronPython;
Going Places: IronRuby on Windows Phone 7. Read more: MSDN
Concurrency: Throttling Concurrency in the CLR 4.0 ThreadPool;
Async Agents: Actor-Based Programming with the Asynchronous Agents Library;
App Migration: Migrate Your ASP.NET 1.1 Apps to Visual Studio 2010;
Data-Bound Design: Create a Silverlight 4 Web Part for SharePoint 2010;
SQL Server and MapPoint: Making MapPoint 2010 and SQL Server Spatial Work Together;
The Working Programmer: Multiparadigmatic .NET, Part 1;
UI Frontiers: Touch and Response;
Cutting Edge: Better Web Forms with the MVP Pattern;
Security Briefs: The MSF-Agile+SDL Process Template for TFS 2010;
Test Run: Request-Response Testing Using IronPython;
Going Places: IronRuby on Windows Phone 7. Read more: MSDN
TSQL Tips and Tricks - Different ways to know the server name
Posted by
jasper22
at
10:05
|
Here are the three different ways to know the Server name using queriesMethod 1 : Use @@servername
select @@servername as server_nameMethod 2 : Use sp_helpserver system procedure
exec sp_helpserver Read more: Beyond Relational
select @@servername as server_nameMethod 2 : Use sp_helpserver system procedure
exec sp_helpserver Read more: Beyond Relational
ConfORM – Another NHibernate mapping possibility
Posted by
jasper22
at
10:04
|
I recently hold two presentations at the .Net User Group Bern (DNUG) with René Leupold about object relational mapping in the .Net world. We showed Entity Framework 4.0 and NHibernate. My part was NHibernate. You could download the slides and samples from the DNUG website. In the two presentations I showed the mapping possibilities with hbm.xml files, attributes and Fluent NHibernate. In a previous blog post I already showed those possibilities.During the preparations I hadn’t time to try a new way to map your entities to the database. This new way is offered by the framework ConfORM, created by one of the contributors of NHibernate Fabio Maulo. In a previous post I showed the other possibilities how you can map your entities. In this post I show you the most simplest way I found to map the entities with ConfORM. I used for this example the version 1.0.2 (Alpha 2) of ConfORM and the version 3.0.0 Alpha 2 of NHibernate. The current version of ConfORM is available here. DomainThe domain for this sample is quite simple. It is a one to many mapping between Order and its OrderItems. The associations is bidirectional. Below you see the class diagram of the two classes:
USING APPDOMAINS TO MAKE NON-THREADSAFE CODE THREADSAFE
Posted by
jasper22
at
10:02
|
Recently, I was involved in a Wintellect consulting engagement where a customer had some class library code that was created years ago. The code in this class library was not designed to work well in a multithreaded environment. Specifically, this means that if two or more threads called into the class library code at the same time, the data got corrupted and the results could not be trusted. Non-concurrent-ready code is easy to obtain with frequent use of mutable static fields. But, there are other common coding practices which can result in code that is not safe with multiple threads passing through it at the same time. This customer wanted to increase the performance of their code and the best way to accomplish this is to have multiple threads processing their own data independently of each other. But, again, the class library code base would produce errant results if we did this. To demonstrate the problem, imagine this very simple static class which is indicative of the non-thread safe class library that I'm referring to: internal static class NonConcurrentAlgorithm
{
NonConcurrentAlgorithm.Add("Item 2");
Thread.Sleep(1000); // To demonstrate the problem consistently
foreach (var i in NonConcurrentAlgorithm.GetItems())
Console.WriteLine(i);When this code runs, the console could show:"Item 2" by itself
"Item 2" followed by "Item 1"
"Item 1" followed by "Item 2" Clearly, this is not desireable and the problem all stems from the threads sharing the one List<String> object. In fact, the List<T> class is not itself thread-safe and so it is even possible that having multiple threads accessing it simultaneously could result in items disappearing or a single item being inserted multiple times, or worse. It depends on how the List<T> class is internally implemented which is not documented and is subject to change. Now, one way to improve performance for the customer would be for Wintellect to take the non-concurrent code base and make it thread safe. This is the best thing to do; however, the code base was very large, the changes to the code base would have been substantial and a lot of testing would have had to be done. The customer was not too excited by this recommendation. So, what we did instead was use the CLR's AppDomain feature. This works out great because an AppDomain's state is completely isolated from all other AppDomains. To communicate across AppDomains, you must create a class derived from MarshalByRefObject. So, I created a NonConcurrentAlgorithmProxy class that wraps the methods of the static class. The NonConcurrentAlgorithmProxy class looks like this: internal sealed class NonConcurrentAlgorithmProxy : MarshalByRefObject
{
private static List<String> s_items = new List<String>();}If we have two threads using this class simultaneously, the results are unpredictable. For example, let's say we have this code: ThreadPool.QueueUserWorkItem(o => NonConcurrentAlgorithm.Add("Item 1"), null);
public static void Add(String item) { s_items.Add(item); }
public static String[] GetItems() { return s_items.ToArray(); }
NonConcurrentAlgorithm.Add("Item 2");
Thread.Sleep(1000); // To demonstrate the problem consistently
foreach (var i in NonConcurrentAlgorithm.GetItems())
Console.WriteLine(i);When this code runs, the console could show:"Item 2" by itself
"Item 2" followed by "Item 1"
"Item 1" followed by "Item 2" Clearly, this is not desireable and the problem all stems from the threads sharing the one List<String> object. In fact, the List<T> class is not itself thread-safe and so it is even possible that having multiple threads accessing it simultaneously could result in items disappearing or a single item being inserted multiple times, or worse. It depends on how the List<T> class is internally implemented which is not documented and is subject to change. Now, one way to improve performance for the customer would be for Wintellect to take the non-concurrent code base and make it thread safe. This is the best thing to do; however, the code base was very large, the changes to the code base would have been substantial and a lot of testing would have had to be done. The customer was not too excited by this recommendation. So, what we did instead was use the CLR's AppDomain feature. This works out great because an AppDomain's state is completely isolated from all other AppDomains. To communicate across AppDomains, you must create a class derived from MarshalByRefObject. So, I created a NonConcurrentAlgorithmProxy class that wraps the methods of the static class. The NonConcurrentAlgorithmProxy class looks like this: internal sealed class NonConcurrentAlgorithmProxy : MarshalByRefObject
{
public void Add(String item) { NonConcurrentAlgorithm.Add(item); }
public String[] GetItems() { return NonConcurrentAlgorithm.GetItems(); }
}Read more: JEFFREY RICHTER'S BLOG
public void Add(String item) { NonConcurrentAlgorithm.Add(item); }
public String[] GetItems() { return NonConcurrentAlgorithm.GetItems(); }
}Read more: JEFFREY RICHTER'S BLOG
Making Web Client requests behave from .NET or in reality misbehave – ignoring Certificate Issues from HttpWebRequest
Posted by
jasper22
at
09:59
|
Many times, especially during development, you could have certificates that are out of date, aren’t singed by any real authority (makecert, etc.), or even don’t match the host name that the request is issued against, but you want to test, etc. One example is if you want to run Fiddler to get a good over-the-wire trace of the HTTP traffic, when the endpoint is accessed over HTTPS. With Fiddler, you can capture HTTPS traffic, only thing is, it sticks it’s own certificate in the chain which doesn't match the DNS name of the host. So, your HttpWebRequest call will fail regardless. So, to have HttpWebRequest ignore all errors (this is testing only mode – don’t do this in production – or do it carefully) establish the certificate validation callback using the following – which basically, regardless of the SSL Policy error, just returns “true” – basically, nothing is ever wrong. public class AcceptAllCertificates
{
public AcceptAllCertificates()
{
System.Net.ServicePointManager.ServerCertificateValidationCallback +=
((sender, certificate, certicateChain, sslPolicyErrors) => true);
}
}The key thing is, this becomes over-arching – that means, SerivcePointManager now implements this policy across all subsequent calls. You need to call this at application startup, or somewhere before issuing requests. You can extend this and implement your own rules, but this is something I just used to take a good Fiddler trace against an external HTTPS endpoint that I didn’t control without having exceptions tossed. There are a whole bunch of other things that you can take advantage of in ServicePointManager – things such as the HttpConnection limit, which is based upon a W3 spec, but for internal back-end service calls over REST and the like, you may want to affect. namespace System.Net
{
// Summary:
// Manages the collection of System.Net.ServicePoint objects.
public class ServicePointManager
{
// Summary:
// The default number of non-persistent connections (4) allowed on a System.Net.ServicePoint
// object connected to an HTTP/1.0 or later server. This field is constant but
// is no longer used in the .NET Framework 2.0.
public const int DefaultNonPersistentConnectionLimit = 4;
//
// Summary:
// The default number of persistent connections (2) allowed on a System.Net.ServicePoint
// object connected to an HTTP/1.1 or later server. This field is constant and
// is used to initialize the System.Net.ServicePointManager.DefaultConnectionLimit
// property if the value of the System.Net.ServicePointManager.DefaultConnectionLimit
// property has not been set either directly or through configuration.
public const int DefaultPersistentConnectionLimit = 2; // Summary:
// Gets or sets policy for server certificates.
//
// Returns:
// An object that implements the System.Net.ICertificatePolicy interface.
[Obsolete("CertificatePolicy is obsoleted for this type, please use ServerCertificateValidationCallback instead. http://go.microsoft.com/fwlink/?linkid=14202")]
public static ICertificatePolicy CertificatePolicy { get; set; }Read more: Shawn Cicoria
{
public AcceptAllCertificates()
{
System.Net.ServicePointManager.ServerCertificateValidationCallback +=
((sender, certificate, certicateChain, sslPolicyErrors) => true);
}
}The key thing is, this becomes over-arching – that means, SerivcePointManager now implements this policy across all subsequent calls. You need to call this at application startup, or somewhere before issuing requests. You can extend this and implement your own rules, but this is something I just used to take a good Fiddler trace against an external HTTPS endpoint that I didn’t control without having exceptions tossed. There are a whole bunch of other things that you can take advantage of in ServicePointManager – things such as the HttpConnection limit, which is based upon a W3 spec, but for internal back-end service calls over REST and the like, you may want to affect. namespace System.Net
{
// Summary:
// Manages the collection of System.Net.ServicePoint objects.
public class ServicePointManager
{
// Summary:
// The default number of non-persistent connections (4) allowed on a System.Net.ServicePoint
// object connected to an HTTP/1.0 or later server. This field is constant but
// is no longer used in the .NET Framework 2.0.
public const int DefaultNonPersistentConnectionLimit = 4;
//
// Summary:
// The default number of persistent connections (2) allowed on a System.Net.ServicePoint
// object connected to an HTTP/1.1 or later server. This field is constant and
// is used to initialize the System.Net.ServicePointManager.DefaultConnectionLimit
// property if the value of the System.Net.ServicePointManager.DefaultConnectionLimit
// property has not been set either directly or through configuration.
public const int DefaultPersistentConnectionLimit = 2; // Summary:
// Gets or sets policy for server certificates.
//
// Returns:
// An object that implements the System.Net.ICertificatePolicy interface.
[Obsolete("CertificatePolicy is obsoleted for this type, please use ServerCertificateValidationCallback instead. http://go.microsoft.com/fwlink/?linkid=14202")]
public static ICertificatePolicy CertificatePolicy { get; set; }Read more: Shawn Cicoria
greekOS
Posted by
jasper22
at
09:58
|
Other than the Managed Operating System , I am currently working on several other projects , that had me halt the greekOS project Main page : http://greeksof.blogspot.com
Here you will find anything you need to know about greekOS and the other applications I develop as greekSOF . For more information visit my blog http://greeksof.blogspot.com
and add me on facebook ( you will find my profile here : http://design-portalgr.blogspot.com/Read more: Codeplex
Single Sign On (SSO) for cross-domain Asp.net applications, Part-I - The design blue print
Posted by
jasper22
at
09:57
|
Introduction"Yet another Monday morning at your office. Just started to wonder how fast the weekend just passed away, and how hard are the days going to be in this week. You got a mail! Oh no, not a lucrative job offer. Its just another requirement from your new client. Your client has a number of Asp.net of sites, and all he wants is to enable his users to log onto all sites just by logging into a single site. And, obviously, log out of all sites by logging out from a single site. OK, so your client wants a "Single Sign On" implementation. You thought, oh, it’s not that hard. The Asp.net forms authentication is the solution. It allows to share the same cookie across the sites under a same domain using the same configuration key using the <machineKey> element. A quick Google search gives you some pretty fine examples of Single Sign on implementation using <machineKey> in Asp.net applications. OK, so life is not that hard as a programmer after all. Hold on. Something just caught your eyes. The requirement says, "your client has a number of sites, but they are not necessarily under the same domain". You just missed this important point to notice, and, the very first day at your office just started to appear harder to you. It’s not easy to implement a Single Sign On for sites under different domain, for the very fundamental reason that, cookie of a particular domain cannot be shared with another domain. Who doesn’t know that, it’s the cookie that is used to maintain authentication information across different page requests?" I just depicted a scenario that is pretty common these days. This is an era of web 2.0 and social networking, as they say. Standalone and “iland” like systems are very rare these days. You do a tweet from the Twitter and update your status at LinkedIn and Facebook at the same time without doing anything else. You write an article on CodeProject and share it on hundreds of sites within a seconds. So, it’s pretty natural that you would expect to log onto a site and jump to another related one without having to re-login again, doesn’t matter to you what domain these sites are deployed under. So I thought, how about developing something that allows to implement a Single Sign On (Of course, for Asp.net sites) for cross-domain sites easily? People may have tried to implement this in many different ways, and, commercial solutions are also available upon purchase. But, what if I try to develop something which is simple, free and most importantly, which works. How Authentication works in Asp.net?Well, this may not be something new to you. But while we try to solve the hardest problems on earth, we often need to go back to the basics, to try to understand how things really work. So, it wouldn’t be bad to revisit the ABS’s of Asp.net Forms authentication mechanism. Read more: Codeproject
Introduction to ASP.NET URL Rewriting with HttpHandler
Posted by
jasper22
at
09:56
|
IntroductionMost of the time when we start learning something or doing something we get the first question that how does it helps? Or where I can use in the real world?Same thing goes in this technique as well. What are URL rewriting first of all then what is routing engine? Let us see some real issues in our code. A. Case 1One day you had a URL book marked as Http://abc.com/main/1.aspx. But now it is moved to Http://xyz.com/main/1.aspx, will it work now, no. But as a web site developer or architect how you will manages these kinds of broken links in web sites. B. Case 2Suppose we have two servers where each server has hosted with 50 pages. But all the links have to be made available for both web sites. How do we handle this situation?C. Case 3A website restructuring caused all of the Web pages in the /Admin/ directory to be moved to a /finance/Admin/ directory, you would want to use URL rewriting to check if a Web request was intended for a file in the /Admin/ directory. The request automatically should redirect the request to the same file, but in the /finance/Admin/ directory instead. And there are many more, so how do we handle all these scenarios. In classic ASP ages, it was very difficult to handle these scenarios, where we suppose to play with the ISAPI filters. Off course some third party software’s. In ASP.NET Http Modules to handle all these using URL Rewriting as an another option. I. ASP.NET URL RewritingBy using URL rewriting, we can intercept an incoming Web request and redirecting the request to a different resource page. When performing URL rewriting, typically the URL being requested is checked and, based on its value, the request is redirected to a different URL. Please refer to my last article for what happens when request comes to IIS or Scott Mitchell blogs or books from Dino Esposito you will really love them. And it is must to understand this post.II.Implementing URL Rewriting In olden days URL rewriting was implemented with ISAPI filters at the IIS Web server level or some third party software’s, which we are not going talk here. Our main focus is how to implement in ASP.NET. So, in ASP.NET URL rewriting can be implemented by using HTTP modules at the ASP.NET level. Using Http Modules by utilize the HttpContext object RewritePath () method. Here I am not going to explain the HttpApplication or HttpContext assuming that you have read my last post. But can tell one thing that; HttpContext class contains information about a specific HTTP request that is received by the IIS. An HttpContext instance is created for that request. This object contains properties to access the intrinsic object like Request, Response which in turn access to Application, Session and User objects. III.URL Rewriting with Built in HTTP ModulesWe can use out of the box Http Modules to perform the URL rewriting. Let us understand what are they and which event they are tied to in IHttpHandler. Let us see some of the out of the modules that we use day to day, yes we are working with the models, don’t say that I never worked on Http Modules. 1.FormsAuthenticationModuleThis module sets the identity of the user (to an IPrincipal) in the HttpContext for an ASP.NET application when forms authentication is enabled. FormsAuthenticationModule exposes AuthenticateRequest event. Where we can check the user is authenticated or not. If not redirect to a login page. Usually what we do use is Response.Redirect() but Context.RewritePath() method is also good option
void FormsAuthentication_OnAuthenticate(object sender, FormsAuthenticationEventArgs args)
{
{
if (FormsAuthentication.Authenticate("a","a") !=true){
Context.RewritePath("WebForm2.aspx");
}
}
So how we implement in HttpModule isnamespace Chinna.SampleModules
{
public class SampleModule : IHttpModule
{
public void Dispose()
{}
public void Init(HttpApplication context)
{
context.AuthorizeRequest += new EventHandler(OnAuthorizeRequest);
}
void OnAuthenticate(object sender, EventArgs e)
{
HttpApplication app = (HttpApplication)sender;
app.Context.RewritePath("WebForm1.aspx");
}
}
}Read more: Code Gain
So how we implement in HttpModule isnamespace Chinna.SampleModules
{
public class SampleModule : IHttpModule
{
public void Dispose()
{}
public void Init(HttpApplication context)
{
context.AuthorizeRequest += new EventHandler(OnAuthorizeRequest);
}
void OnAuthenticate(object sender, EventArgs e)
{
HttpApplication app = (HttpApplication)sender;
app.Context.RewritePath("WebForm1.aspx");
}
}
}Read more: Code Gain
Ubuntu 10.10 Beta (Maverick Meerkat) Released
The Ubuntu team is pleased to announce the release of Ubuntu 10.10 beta. Codenamed "Maverick Meerkat", 10.10 continues Ubuntu's proud tradition of integrating the latest and greatest open source technologies into a high-quality, easy-to-use Linux distribution. Ubuntu 10.10 Desktop Edition and Ubuntu 10.10 Netbook Edition continue the trend of ever-faster boot speeds, with improved startup times and a smoother, streamlined boot experience.Ubuntu 10.10 Server Edition provides even better integration of the Ubuntu Enterprise Cloud, with its install-time cloud setup. Ubuntu 10.10 Server for UEC and EC2 brings the power and stability of the Ubuntu Server Edition to cloud computing, whether you're using Amazon EC2 or your own Ubuntu Enterprise Cloud.The Ubuntu 10.10 family of Kubuntu, Xubuntu, Edubuntu, Ubuntu Studio, and Mythbuntu, also reach beta status today. Read more: Ubuntu list
Britney Spears: 1-6 How we filled the sad, lonely years between the release of "Ray of Light" and the invention of Lady Gaga.
Posted by
jasper22
at
18:17
|
Twitter Discographies summarizes musicians' entire careers in 140 characters, album by album. (SLT)Read more: Twitter Discographies
An easy way to use certificates for WCF security
Posted by
jasper22
at
12:36
|
IntroductionSecurity has an important role in any distributed application and Windows Communication Foundation (known as WCF or Indigo), the new Microsoft communication framework, implements many security standards and has a wide range of features available. One of the most important aspects of security is authentication. WCF can be configured to use many authentication methods:Anonymous caller
User name and password
Certificate
Windows
CardSpace
In this article I will show you how to configure WCF with certificates to authenticate service clients and server using an alternative approach. If you want to exactly understand my implementation, continue reading the next section. If you simply want to understand how to configure WCF using certificates jump directly to the Quick start tutorial section. Background conceptsThe next sections assume that you are familiar with many WCF and security concepts. See the External resources section if you want to review some of these concepts or for more information. The problemThe use of certificates for authentication is not new, but is still one of the most common way to authenticate a subject. WCF has a built-in support for certificates that conform to the Web Services Security (WS-Security) standards. The problem with the default configurations and examples available is that all the certificates must be installed in the Certificate Store, which basically is a central location where Windows saves all the certificates (used also for other applications: Internet Explorer, ...). Why this solution causes some problems? The easy answer is because it is not easy to correctly configure all the certificates. For more details:When you deploy your service to the server you must install in the Certificate Store all the certificates used (in different locations based on the use of the certificate).
This operation must be executed using an installation program, a script file or a batch file. For this reason, it is difficult to deploy the application using an xcopy/ClickOnce installation.
Each client must also install the certificate used to authenticate itself always in the Certificate Store. This is easy if you have a small number of clients but very difficult if you must manually configure each computer (in addition, for the client, you can't use an xcopy/ClickOnce installation).
You must give to the running process (like ASP.NET) the permissions to read the certificate private key. This step usually requires changing the file system permission. This again requires a script file or an installation which is not always easy.
If you are using a shared hosting probably you can't install certificates or change certificate permissions.
As a developer I like to have each project isolated from the others. I want to be able to easy test different configurations or applications, I like to simply download the latest version from the code repository and run it, without any special configuration. Using the Certificate Store I must always remember to install or uninstall the certificates each time.
At the following MSDN page you can see an example of a configuration using certificates and a description of how to install certificates using the classic solution: MSDN: Message Security Certificate.Read more: Codeproject
User name and password
Certificate
Windows
CardSpace
In this article I will show you how to configure WCF with certificates to authenticate service clients and server using an alternative approach. If you want to exactly understand my implementation, continue reading the next section. If you simply want to understand how to configure WCF using certificates jump directly to the Quick start tutorial section. Background conceptsThe next sections assume that you are familiar with many WCF and security concepts. See the External resources section if you want to review some of these concepts or for more information. The problemThe use of certificates for authentication is not new, but is still one of the most common way to authenticate a subject. WCF has a built-in support for certificates that conform to the Web Services Security (WS-Security) standards. The problem with the default configurations and examples available is that all the certificates must be installed in the Certificate Store, which basically is a central location where Windows saves all the certificates (used also for other applications: Internet Explorer, ...). Why this solution causes some problems? The easy answer is because it is not easy to correctly configure all the certificates. For more details:When you deploy your service to the server you must install in the Certificate Store all the certificates used (in different locations based on the use of the certificate).
This operation must be executed using an installation program, a script file or a batch file. For this reason, it is difficult to deploy the application using an xcopy/ClickOnce installation.
Each client must also install the certificate used to authenticate itself always in the Certificate Store. This is easy if you have a small number of clients but very difficult if you must manually configure each computer (in addition, for the client, you can't use an xcopy/ClickOnce installation).
You must give to the running process (like ASP.NET) the permissions to read the certificate private key. This step usually requires changing the file system permission. This again requires a script file or an installation which is not always easy.
If you are using a shared hosting probably you can't install certificates or change certificate permissions.
As a developer I like to have each project isolated from the others. I want to be able to easy test different configurations or applications, I like to simply download the latest version from the code repository and run it, without any special configuration. Using the Certificate Store I must always remember to install or uninstall the certificates each time.
At the following MSDN page you can see an example of a configuration using certificates and a description of how to install certificates using the classic solution: MSDN: Message Security Certificate.Read more: Codeproject
File Transfer with WCF
Posted by
jasper22
at
12:34
|
WCF streaming is helpful in all those cases when you need to move a lot of data between the client and the service in a way that keeps memory consumption under control (see Large Data and Streaming on MSDN for more details if you are not familiar with the topic). Streaming does impose some restrictions. Among them is that your operations can only have one input and/or output parameter and they can only be only one of the following:a Stream
a Message
a class implementing IXmlSerializable
I wanted to expose a very simple service to upload and download files through WCF. And because I wanted to be able to pass both the file content as a stream and at least the file name, I could not just use a Stream but had to resort to using Messages: the headers would convey the file information (such as the file type) and the body the content of the file itself through a stream. I therefore defined the service as follows:private void IssueDownloadRequest(string localFile, string serviceUrl, FileDownloadMessage request)
{
this.service = this.proxy.OpenProxy(serviceUrl); try
{
using (FileDownloadReturnMessage response = this.service.DownloadFile(request))
{
if (response != null && response.FileByteStream != null)
{
SaveFile(response.FileByteStream, localFile);
}
} this.proxy.CloseProxy(this.service);
}
catch (Exception e)
{
throw new FileTransferProxyException("Error while downloading the file", e);
}
finally
{
// we expect the stream returned from the server to be closed by the
// server itself so nothing to be done with it here. Just abort
// the proxy if needed.
this.proxy.AbortProxyIfNeeded(this.service);
}
}private static void SaveFile(Stream saveFile, string localFilePath)
{
const int bufferSize = 65536; // 64KRead more: Stefano Ricciardi Part 1, Part 2, Part 3
a Message
a class implementing IXmlSerializable
I wanted to expose a very simple service to upload and download files through WCF. And because I wanted to be able to pass both the file content as a stream and at least the file name, I could not just use a Stream but had to resort to using Messages: the headers would convey the file information (such as the file type) and the body the content of the file itself through a stream. I therefore defined the service as follows:private void IssueDownloadRequest(string localFile, string serviceUrl, FileDownloadMessage request)
{
this.service = this.proxy.OpenProxy(serviceUrl); try
{
using (FileDownloadReturnMessage response = this.service.DownloadFile(request))
{
if (response != null && response.FileByteStream != null)
{
SaveFile(response.FileByteStream, localFile);
}
} this.proxy.CloseProxy(this.service);
}
catch (Exception e)
{
throw new FileTransferProxyException("Error while downloading the file", e);
}
finally
{
// we expect the stream returned from the server to be closed by the
// server itself so nothing to be done with it here. Just abort
// the proxy if needed.
this.proxy.AbortProxyIfNeeded(this.service);
}
}private static void SaveFile(Stream saveFile, string localFilePath)
{
const int bufferSize = 65536; // 64KRead more: Stefano Ricciardi Part 1, Part 2, Part 3
Твиттер собственными руками на C#. Часть 1: авторизация OAuth
Posted by
jasper22
at
12:33
|
В один момент сложилась желание написать программу клиент для сетей микроблогинга Twitter, языком программирования был выбран C#.
Напомню что OAuth это открытый протокол авторизации, который позволяет предоставить третьей стороне доступ к защищенным ресурсам пользователя, без необходимости передавать ей (третьей стороне) логин и пароль. Третьим лицом в данном случае естественно будем являтся мы со своим приложением.
В принципе это руководство подойдёт для OAuth авторизации не только в Twitter, но и в любом другом портале который использует OAuth, например небезызвестный FriendFeed.Сам процесс авторизации по протоколу OAuth довольно подробно рассмотрен на Хабре.
Для того что бы авторизоваться учётной записью твиттера нам надо зарегистрировать своё приложение в Twitter Developers.
Заполняем анкетку и нажимаем кнопку Register application, дальше вас перекинет на страницу приложения. На ней нас интересует две строки, а именно Consumer key и Consumer secret — их нам необходимо каким-либо образом сохранить потому что скоро они нам понадобятся.
А теперь немного теорий. По сути процесс авторизации условно можно разделить на три этапа:
1. Делаем запрос на api.twitter.com/oauth/request_token с целью получить первоначальные значения oauth_token и oauth_secret
2. Получив эти значения делаем ещё один запрос в окне браузера, но уже на api.twitter.com/oauth/authorize и пользователю будет предложено ввести свои логин/пароль от учётной записи твиттера, а далее ещё одна форма в которой будет сообщено что наше расчудесное приложение хочет использовать данные учётной записи пользователя и естественно две кнопки: для отказа и поодтверждения. При нажатии на кнопку подтверждения откроется страница на которой будет написан PIN-код. PIN-код пользователь должен передать нашему приложению.
3. И после того как пользователь введёт PIN-код в нашем приложении, мы должны будем сделать третий запрос на api.twitter.com/oauth/access_token для получения oauth_token и oauth_secret которые должны использоваться для идентификация пользователя в системе.
Будем делать всё последовательно и к концу статьи у нас должно получиться приложение которое сможет проходить OAuth авторизацию.
Теперь переходим к самому процессу написания програмы.
Создадим новое консольное приложение. Read more: Habrahabr.ru
Напомню что OAuth это открытый протокол авторизации, который позволяет предоставить третьей стороне доступ к защищенным ресурсам пользователя, без необходимости передавать ей (третьей стороне) логин и пароль. Третьим лицом в данном случае естественно будем являтся мы со своим приложением.
В принципе это руководство подойдёт для OAuth авторизации не только в Twitter, но и в любом другом портале который использует OAuth, например небезызвестный FriendFeed.Сам процесс авторизации по протоколу OAuth довольно подробно рассмотрен на Хабре.
Для того что бы авторизоваться учётной записью твиттера нам надо зарегистрировать своё приложение в Twitter Developers.
Заполняем анкетку и нажимаем кнопку Register application, дальше вас перекинет на страницу приложения. На ней нас интересует две строки, а именно Consumer key и Consumer secret — их нам необходимо каким-либо образом сохранить потому что скоро они нам понадобятся.
А теперь немного теорий. По сути процесс авторизации условно можно разделить на три этапа:
1. Делаем запрос на api.twitter.com/oauth/request_token с целью получить первоначальные значения oauth_token и oauth_secret
2. Получив эти значения делаем ещё один запрос в окне браузера, но уже на api.twitter.com/oauth/authorize и пользователю будет предложено ввести свои логин/пароль от учётной записи твиттера, а далее ещё одна форма в которой будет сообщено что наше расчудесное приложение хочет использовать данные учётной записи пользователя и естественно две кнопки: для отказа и поодтверждения. При нажатии на кнопку подтверждения откроется страница на которой будет написан PIN-код. PIN-код пользователь должен передать нашему приложению.
3. И после того как пользователь введёт PIN-код в нашем приложении, мы должны будем сделать третий запрос на api.twitter.com/oauth/access_token для получения oauth_token и oauth_secret которые должны использоваться для идентификация пользователя в системе.
Будем делать всё последовательно и к концу статьи у нас должно получиться приложение которое сможет проходить OAuth авторизацию.
Теперь переходим к самому процессу написания програмы.
Создадим новое консольное приложение. Read more: Habrahabr.ru
Subscribe to:
Posts (Atom)