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

DotNetZip Library

| Thursday, June 7, 2012
DotNetZip - Zip and Unzip in C#, VB, any .NET language

DotNetZip is an easy-to-use, FAST, FREE class library and toolset for manipulating zip files or folders. Zip and Unzip is easy: with DotNetZip, .NET applications written in VB, C# - any .NET language - can easily create, read, extract, or update zip files. For Mono or MS .NET.

DotNetZip is the best ZIP library for .NET. Just look at the reviews! 

DotNetZip works on PCs with the full .NET Framework, and also runs on mobile devices that use the .NET Compact Framework. Create and read zip files in VB, C#, or any .NET language, or any scripting environment. DotNetZip supports these scenarios:
- a Silverlight app that dynamically creates zip files.
- an ASP.NET app that dynamically creates ZIP files and allows a browser to download them
- a Windows Service that periodically zips up a directory for backup and archival purposes
- a WPF program that modifies existing archives - renaming entries, removing entries from an archive, or adding new entries to an archive
- a Windows Forms app that creates AES-encrypted zip archives for privacy of archived content.
- a SSIS script that unzips or zips
- An administrative script in PowerShell or VBScript that performs backup and archival.
- a WCF service that receives a zip file as an attachment, and dynamically unpacks the zip to a stream for analysis
- an old-school ASP (VBScript) application that produces a ZIP file via the COM interface for DotNetZIp
- a Windows Forms app that reads or updates ODS files
- creating zip files from stream content, saving to a stream, extracting to a stream, reading from a stream
- creation of self-extracting archives.

Read more: Codeplex
QR: Inline image 1

Posted via email from Jasper-net

DockPanel Suite

|
Inline image 2

Description
The docking library for .Net Windows Forms development which mimics Visual Studio .Net.

Read more: SourceForge
QR: Inline image 1

Posted via email from Jasper-net

The HIGH cost of ConcurrentBag in .NET 4.0

|
I got some strange results when using concurrent collections, so I decided to try to track it down, and wrote the following code:

var count = ?;
var list = new List<object>(count);
var sp = Stopwatch.StartNew();
for (int i = 0; i < count; i++)
{
    list.Add(new ConcurrentBag<int>());
}
sp.Stop();
Console.WriteLine("{0} {2} items in {1:#,#;;0}ms = {3:#,#;;0}ms per item",
    sp.Elapsed, sp.ElapsedMilliseconds, count, sp.ElapsedMilliseconds / count);

And then I started to play with the numbers, and it is not good.

10 items in 2ms = 0ms per item

This is incredibly high number, you have to understand. Just to compare, List<int> takes 8 ms to create 100,000 items.

Read more: Ayende @ Rahien
QR: Inline image 1

Posted via email from Jasper-net

#575 – PropertyMetadata vs. FrameworkPropertyMetadata

|
When you implement a custom dependency property and you register the property by calling DependencyProperty.Register, you specify some metadata for the property by passing it an instance of PropertyMetadata.  This can be an instance of the PropertyMetadata class or an instance of one of its subclasses.  The differences are shown below.

PropertyMetadata – Basic metadata relating to dependency properties
CoerceValueCallback – coerce the value when being set
DefaultValue – a default value for the property
PropertyChangedCallback – respond to new effective value for the property

UIPropertyMetadata – derives from PropertyMetadata and adds:
IsAnimationProhibited – disable animations for this property?

FrameworkPropertyMetadata – derives from UIPropertyMetadata and adds:
AffectsArrange, AffectsMeasure, AffectsParentArrange, AffectsParentMeasure, AffectsRender – Should layout calculations be re-run after property value changes?


QR: Inline image 1

Posted via email from Jasper-net

[Windows 8] How to create an awaitable component ?

|
C# 5, with it’s async/await pattern, is extremelly useful for asynchronous development. In Windows 8, the good point is that all the APIs which take more than 50ms must be run asynchronously !

But how do you create your own WinRT component ? This might be simple but there are some tricky points that I wanted to highlight in this blog post.

We know that each WinRT components need to be a sealed class so let’s take a look at the following code:

public sealed class Reader
{
    public async static Task<IEnumerable<string>> GetItemsAsync()
    {
        var feedsTitle = new List<string>();
        var client = new SyndicationClient();
        var feeds = await client.RetrieveFeedAsync(new Uri(“http://channel9.msdn.com/coding4fun/articles/RSS”));
        foreach (var item in feeds.Items)
        {
            feedsTitle.Add(item.Title.Text);
        }
        return feedsTitle.AsEnumerable();
    }
}

Even if this code seems correct, it’ll fail to compile due to the following error (click on image to enlarge):

Inline image 1

The problem here is that each type exposed via your component need to be projected using WinRT. And the compiler is not able to project the Task type.

So we need to create a wrapper that will return (and take in parameters) only types that can be projected. And, for asynchronous operations, the dedicated type is IAsyncOperation<T>, which can be obtained, from a Task object, using the AsAsyncOperation extension’s method:

public sealed class Reader
{
    public static IAsyncOperation<IEnumerable<string>> GetItemsAsync()
    {
        return InternalGetItemsAsync().AsAsyncOperation();
    }

    internal async static Task<IEnumerable<string>> InternalGetItemsAsync()
    {
        var feedsTitle = new List<string>();
        var client = new SyndicationClient();
        var feeds = await client.RetrieveFeedAsync(new Uri(“http://channel9.msdn.com/coding4fun/articles/RSS”));
        foreach (var item in feeds.Items)
        {
            feedsTitle.Add(item.Title.Text);
        }
        return feedsTitle.AsEnumerable();
    }
}

QR: Inline image 3

Posted via email from Jasper-net

Visual Studio 2012: Improving User Stories and Requirements with PowerPoint Storyboarding

|
For Visual Studio Premium and Ultimate users there is a great new add-in for PowerPoint that can really help you called the PowerPoint Storyboarding add-in.  Using this feature you can quickly draft an interface design and get stakeholder feedback.  Plus, since it’s PowerPoint, even stakeholders can change elements easily to show you what they really want.  Let me show you how this works.

 

Getting Started
To get started just go to the Microsoft Visual Studio 2012 program folder and select PowerPoint Storyboarding:

Inline image 1

This will open up PowerPoint, give you a blank slide, and take you to the Storyboarding tab:

Inline image 2

It will also show the storyboard shapes to the right which are searchable via the search box (CTRL + G):

QR: Inline image 3

Posted via email from Jasper-net

HOW TO: Use SQLite in C# Metro style app

|
    I got a few questions and comments about how to actually include SQLite in a C# Metro style app.  Since perhaps it wasn’t clear in describing in my post, I thought a quick video might help demonstrate the steps to build and use SQLite in a C# Metro style app.

The video walks through actually building SQLite from the source (Visual Studio 2012 required…express is fine) and adding it to a C# Metro style app, create a database, populate with some data based on a class and databind the query to a ListView.  The video references my OneNote notebook on the tools you need to download and build the SQLite source.  It also demonstrates using the sqlite-net library from NuGet on interacting with SQLite in a C# application.

Read more: Tim Heuer
QR: Inline image 1

Posted via email from Jasper-net

Enabling Coded UI Test playback logs in Visual Studio 2012 Release Candidate

|
In Jason Zander’s blog post: Announcing the Release Candidate (RC) of Visual Studio 2012 and .NET Framework 4.5 he showed a new Coded UI feature  -capturing playback logs.

Unfortunately CodedUI doesn’t do this by default and finding the logs isn’t always obvious.  

To enable CodedUI Test Playback logs you need to set some configuration settings in the file QTAgent32.exe.config to make this work.  This file can be found at:

C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE

The settings are:

<system.diagnostics> 
   <switches> 
     <!-- You must use integral values for "value". 
          Use 0 for off, 1 for error, 2 for warn, 3 for info, and 4 for verbose. --> 
     <add name="EqtTraceLevel" value="4" /> 
   </switches> 
</system.diagnostics> 

and:

<appSettings> 

<appSettings> 
<add key="EnableHtmlLogger" value="true"/> 
<add key="EnableSnapshotInfo" value="true"/>

QR: Inline image 1

Posted via email from Jasper-net

Facebook Open Sources Library of its Components

|
Even as Facebook continues making headlines in the wake of its IPO and a precipitous drop in its share price, the company has made a big contribution to open source. Not everyone realizes that Facebook is built on open source technology, and it has released many components to the open source community before. Now, as Jordan DeLong explains in an extensive post, the company has released a reusable C++ library of components called Folly.

Read more: Ostatic
QR: Inline image 1

Posted via email from Jasper-net

Loading half a billion rows into MySQL

|
Background

We have a legacy system in our production environment that keeps track of when a user takes an action on Causes.com (joins a Cause, recruits a friend, etc). I say legacy, but I really mean a prematurely-optimized system that I’d like to make less smart. This 500m record database is split across monthly sharded tables. Seems like a great solution to scaling (and it is) — except that we don’t need it. And based on our usage pattern (e.g. to count a user’s total number of actions, we need to do query N tables), this leads to pretty severe performance degradation issues. Even with memcache layer sitting in front of old month tables, new features keep discovering new N-query performance problems. Noticing that we have another database happily chugging along with 900 million records, I decided to migrate the existing system into a single table setup. The goals were:

reduce complexity. Querying one table is simpler than N tables.
push as much complexity as possible to the database. The wrappers around the month-sharding logic in Rails are slow and buggy.
increase performance. Also related to one table query being simpler than N.
Alternative Proposed Solutions

MySQL Partitioning: this was the most similar to our existing set up, since MySQL internally stores the data into different tables. We decided against it because it seemed likely that it wouldn’t be much faster than our current solution (although MySQL can internally do some optimizations to make sure you only look at tables that could possibly have data you want). And it’s still the same complexity we were looking to reduce (and would further be the only database set up in our system using partitioning).

Redis: Not really proposed as an alternative because the full dataset won’t fit into memory, but something we’re considering loading a subset of the data into to answer queries that we make a lot that MySQL isn’t particularly good at (e.g. ‘which of my friends have taken an action’ is quick using Redis’s built in SET UNION function). The new MySQL table might be performant enough that it doesn’t make sense to build a fast Redis version, so we’re avoiding this as possible premature optimization, especially with a technology we’re not as familiar with.

Dumping the old data

MySQL provides the `mysqldump’ utility to allow quick dumping to disk:

  msyqldump -T /var/lib/mysql/database_data database_name
This will produce a TSV file for each table in the database, and this is the format that `LOAD INFILE’ will be able to quickly load later on.

Installing Percona 5.5

We’ll be building the new system with the latest-and-greatest in Percona databases on CentOS 6.2:

  yum install Percona-Server-shared-compat Percona-Server-client-55 Percona-Server-server-55 -y
[ open bug with the compat package: https://bugs.launchpad.net/percona-server/+bug/908620]

Specify a directory for the InnoDB data

This isn’t exactly a performance tip, but I had to do some digging to get MySQL to store data on a different partition. The first step is to make use your my.cnf contains a

datadir = /path/to/data
directive. Make sure /path/to/data is owned by mysql:mysql (chown -R mysql.mysql /path/to/data) and run:

mysql_install_db --user=mysql --datadir=/path/to/data

Read more: derwiki
QR: Inline image 1

Posted via email from Jasper-net

40 великолепных QR-кодов

|
Inline image 1 Inline image 2

QR-коды — новый тип штрих-кодов, который содержит в себе информацию, но они выглядят смертельно скучно. Однако, благодаря талантливым дизайнерам, они могут превратиться в настоящее искусство.

Read more: Habrahabr.ru
QR: Inline image 3

Posted via email from Jasper-net

Microsoft To Run Linux On Azure

|
   After years of battling Linux as a competitive threat, Microsoft is now offering Linux-based operating systems on its Windows Azure cloud service. The Linux services will go live on Azure at 4 a.m. EDT on Thursday. At that time, the Azure portal will offer a number of Linux distributions, including Suse Linux Enterprise Server 11 SP2, OpenSuse 12.01, CentOS 6.2 and Canonical Ubuntu 12.04. Azure users will be able to choose and deploy a Linux distribution from the Microsoft Windows Azure Image Gallery and be charged on an hourly pay-as-you-go basis.

Read more: Slashdot
QR: Inline image 1

Posted via email from Jasper-net

MSDN Magazine: June 2012

|
Inline image 2

The June edition of MSDN Magazin was release online over the long weekend, with articles looking at the use of the Windows Azure Service Bus, .NET 4.5 changes, HTML5, Knockout.js, Windows Phone 7, and the usual collection of columns.

Read more: MSDN
QR: Inline image 1

Posted via email from Jasper-net

Solid-state revolution: in-depth on how SSDs really work

|
Inline image 2
...

Solid-state drives are odd creatures. Though they sound simple in theory, they store some surprisingly complex secrets. For instance, compare an SSD to a traditional magnetic hard drive. A modern multi-terabyte spinning hard disk plays tricks with magnetism and quantum mechanics, results of decades of research and billions of dollars and multiple Nobel Prizes in physics. The drives contain complex moving parts manufactured to extremely tight tolerances, with drive heads moving around just thousandths of a millimeter above platters rotating at thousands of revolutions per minute. A modern solid-state drive performs much more quickly, but it's also a more mundane on the inside, as it's really a hard drive-shaped bundle of NAND flash memory. Simple, right?

However, the controller software powering an SSD does some remarkable things, and that little hard drive-shaped bundle of memory is more correctly viewed as a computer in its own right.

Given that SSDs transform the way computers "feel," every geek should know at least a bit about how these magical devices operate. We'll give you that level of knowledge. But because this is Ars, we're also going to go a lot deeper—10,000 words deep. Here's the only primer on SSD technology you'll ever need to read.

Varying degrees of fast

It's easy to say "SSDs make my computer fast," but understanding why they make your computer fast requires a look at the places inside a computer where data gets stored. These locations can collectively be referred to as the "memory hierarchy," and they are described in great detail in the classic Ars article "Understanding CPU Caching and Performance."

It's an axiom of the memory hierarchy that as one walks down the tiers from top to bottom, the storage in each tier becomes larger, slower, and cheaper. The primary measure of speed we're concerned with here is access latency, which is the amount of time it takes for a request to traverse the wires from the CPU to that storage tier. Latency plays a tremendous role in the effective speed of a given piece of storage, because latency is dead time; time the CPU spends waiting for a piece of data is time that the CPU isn't actively working on that piece of data.

The table below lays out the memory hierarchy:

LEVEL ACCESS TIMETYPICAL SIZE
Registers"instantaneous" under 1KB
Level 1 Cache 1-3 ns64KB per core
Level 2 Cache3-10 ns 256KB per core
Level 3 Cache 10-20 ns2-20 MB per chip
Main Memory30-60 ns 4-32 GB per system
Hard Disk 3,000,000-10,000,000 nsover 1TB

Read more: ArsTechnica
QR: Inline image 1

Posted via email from Jasper-net

Утекла база LinkedIn хэшей?

| Wednesday, June 6, 2012
Inline image 1

Вчера на форуме по подбору хэшей forum.insidepro.com пользователь под ником dwdm попросил помощи в подборе паролей к базе с SHA1 хэшами:
http://forum.insidepro.com/viewtopic.php?p=96122 (На текущий момент ссылка не работает)

Зато работает ссылка с теми самими хэшами. В базе около 6.5 миллионов SHA1 хэшей без соли.

Read more: Habrahabr.ru
QR: Inline image 2

Posted via email from Jasper-net

Goodbye Photoshop, Hello Cloudinary

|
Inline image 2

   Manipulating images for your website is such a tedious chore. You need to open Photoshop, click your mouse about ten thousand times, then save the file and upload it. Then next month you redesign your site and suddenly need to re-size all your image elements again! Startup Cloudinary has a good alternative for you: use custom URLs to transform your images in the cloud! I was a bit skeptical when I first read about Cloudinary, but after five minutes of goofing around with it I’m sold.

Upload your images — either through the Cloudinary dashboard or from your own applications via their API — and then access those images using specially crafted URLs to apply a variety of transformations to your images. That’s the real magic: you don’t need to do anything other than request your image with the transformations you want. Your original photo is still available, if needed, and each new variant you request is cached and delivered through Amazon’s CDN.

You want that full-size image scaled to 100 pixels high? Here you go!

Oh, you just want the woman’s face from that photo in a nice 90×90 thumbnail? Cloudinary provides face detection, so no problem.

You need rounded corners?

Read more: Cloudinary
QR: Inline image 1

Posted via email from Jasper-net

Nmap 6 Released Featuring Improved Scripting, Full IPv6 Support

|
The Nmap Project is pleased to announce the immediate, free availability of the Nmap Security Scanner version 6.00 from http://nmap.org/. It is the product of almost three years of work, 3,924 code commits, and more than a dozen point releases since the big Nmap 5 release in July 2009. Nmap 6 includes a more powerful Nmap Scripting Engine, 289 new scripts, better web scanning, full IPv6 support, the Nping packet prober, faster scans, and much more!

Read more: Slashdot
Read more: NMap
QR: Inline image 1

Posted via email from Jasper-net

TPL Data Flow Debugger Visualizer

| Tuesday, June 5, 2012
Inline image 2


TPL Data Flow

I first encounter TPL data flow (part of .NET 4.5 - TPL DTF) during the build conference (I attended  last year) but I must say I didn’t get it then. It sounded too much like RX which I was familiar with. Recently during one of my projects that required high performance CPU bounded – high throughput and low latency my colleague Alon the gave the idea – why not using TPL data flow and from then my world changed forever. It’s amazing to how many systems this technology can be suitable to,and for the project I was working on it was perfect. For those of you that are not yet familiar with this technology I suggest reading the article from here and see this amazing example of kinect and TPL DTF here – you’ll thank me later.

So I created some crazy TPL data flow networks on runtime (~100k different networks) and it worked getting 100% CPU most of the time, leveraging all the cores and getting really good performance – but it was really hard to debug and to understand the flow from the code. It was Alon again that suggested to write debug visualizer – so I did. This is my insights from the process.

Writing Debugger Visualizer

I don’t know how many of you had the chance to implement debugger visualizer but it is really straightforward if you need only view on a simple object just follow 5-6 steps:read here. Finally put your assembly in the visualizer folder (e.g. for VS 11 C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Packages\Debugger\Visualizers) and you’re done. This is very simple if your debugging target is simple and serializable. I from the other hand had few issues.

The Issues I encountered during the implementation

Debugger Visualizer Target cannot be interface

   This really surprised me because I know the target I wanted was IDataFlow which is the common interface of TPL data flow which all the blocks need to implement and I discovered that it’s impossible,the target must be a type (can be common base class but not an interface). My solution to this issue was not perfect – I added multiple attributes with all the build in blocks as target.  It’s not that bad because the build in blocks are a good start and as long as you start from build in block (what you normally do) then it will discover the rest of the linked block even if they are not part of the build in blocks. In addition it’s not recommended to implement IDataFlow block on your own – there is a lot to take care of: locking synchronization,buffering and more. If one of you Microsoft guys are listening I think adding support of Interface as target of debug visualizer can be very handy.

Read more: Offir Shvartz
QR: Inline image 1

Posted via email from Jasper-net

No more awaiting... ILSpy 2.1 now supports async/await

|
Inline image 1

A few weeks ago, Daniel blogged about the details of how decompiling async / await is implemented. If you are only interested in the results, see the below screenshot for a proof of decompilation working (on Windows 8 RP):

QR: Inline image 2

Posted via email from Jasper-net

C/C++ EXEs and DLLs created by Visual Studio 2008 don't run on Windows 4.0 (ie, NT4 and Win9x)

|
Louis Solomon / SteelBytes

Written 22/Apr/08
Revised 23/Apr/08 typo's and comment about link.exe/editbin.exe, and the 'quick notes'
Added Link 25/Aug/08 My command line tool that patches compiled code ExeVersion
Added Link 27/Aug/08 other related work LegacyExtender

Here is the result of my exploring this problem ... YMMV :-)

Part 1 (NT4 and Win9x): the required OS version flags in the .exe header are set to 5.0. Can you use Link.exe's or EditBin.exe's /SUBSYSTEM switch to fix this? No, as they don't let you set a value less then 5.0 on both the OS and SubSystem fields (using older version of EditBin from some older version of VS/VC/SDK apparently works). Solution is to patch 'em back to 4.0, here is some code that will do that

HANDLE hfile = CreateFile(argv[1],GENERIC_READ|GENERIC_WRITE,0,0,OPEN_EXISTING,0,NULL);
if (hfile!=INVALID_HANDLE_VALUE)
{
HANDLE hmapping = CreateFileMapping(hfile,0,PAGE_READWRITE,0,0,0);
if (hmapping)
{
BYTE *file_base = (BYTE *)MapViewOfFileEx(hmapping,FILE_MAP_ALL_ACCESS,0,0,0,0);
if (file_base)
{
IMAGE_OPTIONAL_HEADER *ioh = (IMAGE_OPTIONAL_HEADER *)(file_base + ((IMAGE_DOS_HEADER *)file_base)->e_lfanew + 4 + sizeof(IMAGE_FILE_HEADER));
ioh->MajorOperatingSystemVersion = 4;
ioh->MinorOperatingSystemVersion = 0;
ioh->MajorSubsystemVersion = 4;
ioh->MinorSubsystemVersion = 0;
UnmapViewOfFile(file_base);
}
CloseHandle(hmapping);
}
CloseHandle(hfile);
}

Part 2 (Win9x): the CRT uses the Unicode / Widechar version of GetModuleHandle() in it's internal _crt_waiting_on_module_handle(). Here is a replacement that doesn't

extern "C" __declspec(noinline) HMODULE __cdecl _crt_waiting_on_module_handle(LPCWSTR szModuleName)
{
#define INCR_WAIT                          1000
#define _MAX_WAIT_MALLOC_CRT 60000
    char szModuleNameA[MAX_PATH];
    WideCharToMultiByte(CP_ACP,0,szModuleName,-1,szModuleNameA,_countof(szModuleNameA),NULL,NULL);
    unsigned long nWaitTime = INCR_WAIT;
    HMODULE hMod = GetModuleHandleA(szModuleNameA);

QR: Inline image 1

Posted via email from Jasper-net