Source
I want to start by being absolutely positively clear about two things, because our usability research has shown this to be confusing. Remember our little program from last time?
async void ArchiveDocuments(List<Url> urls)
{
Task archive = null;
for(int i = 0; i < urls.Count; ++i)
{
var document = await FetchAsync(urls[i]);
if (archive != null)
await archive;
archive = ArchiveAsync(document);
}
}
Read more...
Async, C#, C# 5.0, Continuation Passing Style, csharp, Development, Programming
Source
The designers of C# 2.0 realized that writing iterator logic was painful. So they added iterator blocks. That way the compiler could figure out how to build a state machine that could store the continuation - the “what comes next” - in state somewhere, hidden behind the scenes, so that you don’t have to write that code.
They also realized that writing little methods that make use of local variables was painful. So they added anonymous methods. That way the compiler could figure out how to hoist the locals to a closure class, so that you don't have to write that code.
The designers of C# 3.0 realized that writing code that sorts, filters, joins, groups and summarizes complex data sets was painful. So they added query comprehensions and all the rest of the LINQ features. That way the compiler could figure out how to do the right object model calls to build the query, the expression trees, and so on.
The designers of C# 4.0 realized that interoperating with modern and legacy dynamic object models was painful. So they added the dynamic type. That way the compiler could figure out how to generate the code at compile time that does the analysis in the Dynamic Language Runtime at runtime.
The designers of C# 5.0 realized that writing asynchronous code is painful, in so many ways. Asynchronous code is hard to reason about, and as we've seen, the transformation into a continuation is complex and leads to code replete with mechanisms that obscure the meaning of the code.
Read more...
.NET, Async, C#, C# 5.0, csharp, Development, Programming
Source
Creating an HTML editor
The concept of content assistants is related to a specific implementation of JFace text viewers, the classorg.eclipse.jface.text.source.SourceViewer. Instances of this class are used throughout the Eclipse workbench to implement the various editors. However, SourceViewers are not restricted to the Eclipse workbench but may be used in any application that builds upon the SWT and JFace JARs. This article demonstrates the implementation of content assistants in the context of an Eclipse editor plug-in, and gives some hints on how to use content assistants with "naked" SourceViewers.
Let's implement a simple HTML editor. Here a content assistant can be very helpful. For example, a content assistant could generate typical HTML structures such as tables or links, or could wrap selected text areas into style tags.
Read more...
content assistant, Development, Eclipse, Eclipse RCP, HTML editor, Java, plugin, Programming, SWT
Source
The Standard Widget Toolkit (SWT) and JFace libraries are used to develop graphical user interfaces (GUIs) for the Eclipse environment, and also to develop stand-alone GUI native applications. In this article, I introduce some of the basic SWT (the name for the basic GUI object) types and show how to combine them to create a working application.
About Eclipse, SWT and jFace
As noted on the Eclipse Web site, Eclipse is a kind of universal tool platform. It's an open, extensible IDE for anything and nothing in particular, and provides tool developers with flexibility and control over their software technologies.
Eclipse provides a base for developers to produce rich GUI-driven tools and applications. Fundamental to this capability are the Eclipse GUI libraries SWT and JFace.
Read more...
Development, Eclipse, Java, jFace, Programming, SWT
Source
This article describes how to use java.net to access the internet. The setting of a proxy is also described. It also covers the usage of the Apache HttpClient library which simplifies the handling or network access.
HTML Webpages and Java
Examples
- Read web page via Java
- Getting the return code from a webpage
- Content Type / MIME Type
Using Http get services
Using the Apache HttpClient
Proxy
- How to set the proxy in Java code
Read more...
Development, Java, Networking, Programming, Tutorial