Free Download: dialer.sis
Archives
-
▼
2009
(902)
-
▼
February
(56)
- Rotary Dialer for Nokia 5800 XpressMusic
- IIS 7 and Shared Hosting - I
- BlueWhaleMail - Free software for mobile email and...
- SMS Me and You
- Enterprise Architect
- Spyphone (Babyphone) for Nokia S60
- How much does it cost to run a computer?
- FreeFSWP–Set Fullscreen Wallpaper On Your S60 3RD ...
- Toshiba A305-S6872
- Toshiba Qosmio G55-Q802
- Toshiba Satellite Pro U400-S1001X
- Nokia Magnifier for Series 60 3rd edition
- WPAD , DNS 2008 and UTM
- AcceSnake for Nokia S60
- PyAsk - App asking from predefined words
- FreeHashTab –A small hash tool on mobile
- PhoneLocator - locate your phone - realtime GPS tr...
- Calls!nfo for Nokia Series60
- Loading Files from a Remote Server in Silverlight
- Google Book will be up and running again after $12...
- Car Manager MIDlet
- The Service Bus
- Enterprise IT architect: The new kid on the block.
- Lenovo 3000 V100
- Lenovo ThinkPad T60p
- Lenovo IdeaPad Y730
- tutLaunch for Series 60 3rd Edition FP1
- Windows 7, too many versions
- SCVMM 08 console error
- Lenovo ThinkPad T500
- Lenovo ThinkPad X60 Tablet
- Lenovo ThinkPad SL400
- Lenovo IdeaPad S10
- Lenovo IdeaPad U110
- Lenovo ThinkPad X301
- Lenovo ThinkPad X200
- Contacts on Ovi
- What are the options — Azure and Access Control?
- FortiCleanUp Tool for S60
- Lenovo IdeaPad Y510
- Alexa & PR Kontrol for Java phones
- Olympus Stylus 1030 SW
- Olympus SP-570 UZ
- Olympus SP-560 UZ
- Olympus E-3
- Olympus FE-300
- Olympus Stylus 790 SW
- Panasonic Lumix DMC-G1
- Hyper-V machine with Netapp iSCSI and Equallogic i...
- pygpslog - A GPS logger for S60 3rd editition phones
- SCVMM 08 DC migration and IP error
- Windows Internet Explorer 8
- Panasonic Lumix DMC-TZ5
- Panasonic Lumix DMC-LS80
- Panasonic Lumix DMC-FZ18
- FreeUnRAR - A RAR decompressing tool on mobile
-
▼
February
(56)
Saturday, February 28, 2009
Rotary Dialer for Nokia 5800 XpressMusic
Free Download: dialer.sis
Friday, February 27, 2009
IIS 7 and Shared Hosting - I
In conjunction with the current project I'm working on (has to do with virtualization, which I'll touch on in later posts) I'm planning to set up a Web shared hosting environment using Windows Server 2008 and IIS7. I'm figuring out what I need to know and how to go about this, and ran across a couple of IIS7 features that are great for all of you Web hosters out there.
- Feature delegation. I've seen a few other names for this on the Internet, including the IIS 7 site, the most common being configuration delegation. Regardless, the basic concept is that IIS 7 configuration system is designed so that the server administrator (you, the hoster), can designate specific IIS 7 features that your customers can configure on their own, without having to get in touch with you to do it. You can only delegate features at the server level, essentially telling the IIS7 configuration system which configuration settings are available for your customers to configure in their Web sites and applications.
- Remote administration. Microsoft included a Web Management Service in IIS7 that, after you install and enable it, provides functionality that enables your customers to manipulate the configuration settings for their Web sites and applications from their own computers. They can do this using a remote instance of IIS Manager.
These two features go hand-in-hand. You set up remote administration on your servers to enable your customers to configure their sites or applications from their desktop or laptop and use feature delegation to designate which features your customers can configure.
To get up to speed on feature delegation, see the articles in Delegating Administration and the videos in Using Shared Hosting Environments.
To fully understand how feature delegation works, I suggest you read up on the IIS7 configuration system itself, too. See Getting Started with IIS 7.0 Configuration for details.
To learn more about remote administration, see the articles in Managing IIS 7.0 Remotely.
For a great overview on the benefits of using IIS 7 on Windows Server 2008 to host Web sites, see MIX08: Bringing Hosters and Developers Together with IIS7.
My next post will take a closer look at feature delegation and how to choose which IIS7 features to delegate.
Monday, February 23, 2009
BlueWhaleMail - Free software for mobile email and social networking
Free Download:
Sunday, February 22, 2009
SMS Me and You
Unlock this application for free
(Register, login and get your code by clicking che "Unlock for free" button.)
Free Download: sms_en.zip
Saturday, February 21, 2009
Enterprise Architect
What is an EA?
Microsoft write in this website about this subjet
http://msdn.microsoft.com/en-us/architecture/bb945098.aspx
sAntos
Spyphone (Babyphone) for Nokia S60
The basic setup is simple. Set the "agent" - that’s the contact’s telephone number that should be informed in the case of an emergency. Next, place the phone at the place that you want to monitor, for example next to a baby.
From now on, the application will constantly monitor the audio level of its surroundings. If they exceed a pre-defined threshold, the phone will automatically call the agent. As a normal voice call is made, you can now hear the surroundings of the phone in order to judge if something serious is happening.
Free Download: here
Friday, February 20, 2009
How much does it cost to run a computer?
Here's something that has always hung around in my mind, but I never got around to looking up the answer. How much will running PCs add to your power bill?
Anandtech posted an article where they calculated the cost of running a PC per hour.
* For a middle of the line system, they figured one year of use is $93.51 for 8 hours a day.
* If you let your PC sit idle 24 hours a day, it will cost you $128.12 a year.
* For a top of the line system that is at full load all day long (like a server) you could spend $440.85.
These prices are calculated at the price of electricity in North Carolina. California PC users will pay almost double.
Thursday, February 19, 2009
FreeFSWP–Set Fullscreen Wallpaper On Your S60 3RD Phones(Support MR and FP1 machines)
Free Download: FreeFSWP_unsigned.sis
(FreeFSWP supports following phones: 3250、5700、6110N、6120C、E50、E51、E60、E61(i)、E62、E65、E70、E71、N73、N75、N76、N80、N81、N82、N91、N93(i)、N95)
Wednesday, February 18, 2009
Toshiba A305-S6872
Fortunately, the keyboard is comfortable; with your eyes closed it feels like any other nearly full size board. The touch pad is likewise roomy, though we were annoyed by the glowing white stripe across the top of the pad, which seems to be just decoration (we thought maybe it would change colors if the touch pad were disabled, but no dice).
We took some consolation in the fact that it along with other distractingly illuminated case elements, a Satellite logo in the bottom left hand corner and a row of touch sensitive media controls above the keyboard can be turned off using Toshiba's HWSetup utility.
The 15.4 inch wide screen LCD display offers a 1,280x800 native resolution, which is standard for a screen this size. The display's glossy finish produces rich colors and contrast we found it minimally distracting while surfing the Web and typing email, but quite enjoyable for movie watching. A Webcam above the display lets users conduct video chats.
Other Features
- Video VGA out, Webcam VGA out, S-Video
- Audio Stereo speakers, headphone or microphone jacks Stereo speakers, headphone or microphone jacks
- Data 3 USB 2.0, mini-FireWire, mulitformat memory card reader, eSATA port 4 USB 2.0, SD card reader
- Expansion ExpressCard/54 ExpressCard
- Networking modem, Ethernet, 802.11 a/b/g/n Wi-Fi modem, Ethernet, 802.11 b/g/n Wi-Fi, Bluetooth, optional WWAN
- Optical drive DVD burner DVD burner
Toshiba Qosmio G55-Q802
Neither addition is going to be of much use to casual consumers, but we can see limited circumstances where specific tasks encoding lots of HD video to DVD would make the G55 worth a look, and note that the non Blu-ray versions of Acer's and HP's 18 inch laptops cost around the same, even without the extra processing power.
Specification
- Price as reviewed / Starting price $1,549
- Processor 2.0GHz Intel Core 2 Duo P7350 (plus 1.5GHz Cell processor)
- Memory 4GB, 800MHz DDR2
- Hard drive 250GB 5,400rpm (x2)
- Chipset Mobile Intel P45 Express Chipset
- Graphics 512MB Nvidia GeForce 9600M GT
- Operating system Windows Vista Premium (64 bit)
- Dimensions (WDH) 17.8x12.2x1.9 inches
- Screen size (diagonal) 18.4 inches
- System weight or Weight with AC adapter 10.7/12.1 pounds
- Category Desktop replacement
The system's glossy (and fingerprint prone), pinstriped design resembles the recently revamped Satellite line, but the chassis itself has the same clamshell look, with the edges of the lid curling in slightly, as on the 17 inch Qosmio X305-Q701.
It's not for those without ample desktop space, but the G55 also feels solid as a rock. The full keyboard and separate number pad are typical for Toshiba which is to say very glossy.
The keys themselves are comfortable and easy to use, but there's a bit too much flex around the middle of the keyboard. A row of standard touch sensitive media control buttons sit above the keyboard, but we're much more excited about the small volume control jogwheel that's on the lower left side of the keyboard tray. We always find jogwheels easier to use and more responsive than volume up and down buttons, or touch sensitive volume sliders (which never respond fast enough for our tastes).
The 18.4 inch wide screen LCD display offers a 1,680x945 pixel native resolution, which is a bit of a mystery. Every other 18 inch laptop we've seen has a 1,920x1080 pixel resolution, which is a natural match with the 16:9 aspect ratio and 1080p HD content. The G55 also lacks the Blu-ray drive that the other 18 inch laptops we've reviewed all carry as standard equipment. However, since Toshiba laptops were saddled with HD DVD drives for long past that format's useful life, we can call this progress, of a sort.
Other Features
- Video VGA out, HDMI VGA out, S-Video, HDMI
- Audio Stereo speakers, headphone/microphone jacks, S/PDIF jack Stereo speakers with subwoofer, headphone/microphone jacks.
- Data 4 USB 2.0, mini FireWire, multiformat memory card reader, eSATA 4 USB 2.0, mini FireWire, SD card reader
- Expansion ExpressCard/54 ExpressCard/54
- Networking modem, Ethernet, 802.11 b/g/n Wi-Fi, Bluetooth modem, Ethernet, 802.11 b/g/n Wi-Fi, optional Bluetooth
- Optical drive DVD burner DVD burner or Blu-Ray
Toshiba Satellite Pro U400-S1001X
Specification
- Price as reviewed / Starting price $1,049
- Processor 2.1GHz Intel Core 2 Duo T8100
- Memory 1GB DDR2 SDRAM 667MHz
- Hard drive 160GB, 5400rpm
- Chipset Mobile Intel 965GM Express
- Graphics Intel GMA X3100
- Operating system Windows XP Pro
- Dimensions (width by depth) 12.4x9.0 inches
- Thickness 1.2 to 1.4 inches
- Screen size (diagonal) 13.3 inches
- System weight and weight with AC adapter 4.6 / 5.5 pounds
- Category Thin and light
OK, euphoria might be overstating it a bit, but the fact remains that the mouse keys offer excellent feel with just the right amount of travel and a barely audible click when fully pressed. Between the two mouse buttons is a fingerprint scanner. The touch pad is a compact 2.5 inches by 1.5 inches and, sadly, it lacks the vertical scroll function that many have come to rely on, including myself.
The 13.3 inch display offers a 1,280x800 pixel native resolution, which is standard for a screen this size. We were surprised to find the same glossy screen coating as found on its consumer cousin, the Satellite U405. For business use working under bright fluorescent lights or in a sun filled airport gate we generally prefer a screen with a matte finish, which reduces glare and reflections.
Above the display sits a 1.3 megapixel Webcam and mic for easy video conferencing. We generally have low expectations for laptop speakers and lower those for the audio output of business laptops. Yet, the Satellite Pro U400 fell short of our meager expectations, with the tinniest and weakest audio output. For both music and movies, you'll want to make use of the laptop's headphone jack.
The Toshiba Satellite Pro U400-S1001X serves up a standard collection of ports and connections similar to what we saw on the Satellite U405 but minus an eSATA port. There's a placeholder on the left edge for an HDMI port, but it sits empty on this business machine; your only video out option is the analog VGA port.
Nokia Magnifier for Series 60 3rd edition
Free Download: nokiamagnifier.sis
(supported phones: N95, E90, N82.Should work for any S60 3rd Edition with auto-focus camera support)
Tuesday, February 17, 2009
WPAD , DNS 2008 and UTM
We are planning to install Ironport WebFiltering.
Ironport doesn´t have the NLB ( network load balancing) or something similar to set up HA.
They speak about to configure a .pac file. (proxy file).
You need to enter wpad.mycompany.com in the DNS.
Ironport doesn´t work with 2008 AD.
We had a problem with the wpad entry in the dns.
This entry is in the block list.
Hi, we are the links to solve the problem:
http://technet.microsoft.com/en-us/library/cc816908.aspx
http://technet.microsoft.com/en-us/library/cc441517.aspx
There is a problem in the first link:
The right command is:
dnscmd /config /enableglobalqueryblocklist 0 (disable)
dnscmd /config /enableglobalqueryblocklist 1 (enable)
Santos
AcceSnake for Nokia S60
Developed in Python, this game has been entirely coded with a text-editor, on a N95 8Go. I never used a computer to make it.
For the first time in a snake game, you can move in any direction, slow down, and accelerate just by moving the phone. You can cross your tail but don't touch the wall or you will loose a life.
If you don't have an accelerometer, or if you prefer to use the keyboard, just choose the right option.
If you didn't installed it allready : Download and install the RDAccelerometer DLL.
Free Download: here
To sign the sis file, use the Open Signed Online service.
Monday, February 16, 2009
PyAsk - App asking from predefined words
Free Download: here
Sunday, February 15, 2009
FreeHashTab –A small hash tool on mobile
Free Download: FreeHashTab_v1.00_selfsigned.sisx
(FreeHashTab supports following phones:
3250、5700、6110N、6120C、6121C、6220C、6290、E50、E51、E60、E61(i)、E62、E65、E70、 E71、N73、N75、N76、N77、N78、N80、N81、N82、N91、N93(i)、N95、N96、5800)
Friday, February 13, 2009
PhoneLocator - locate your phone - realtime GPS tracking for Nokia S60 phones
Free Download: phonelocator.v070.sis
Thursday, February 12, 2009
Calls!nfo for Nokia Series60
Features:
- Know how much sms you have sent to which number.
- Detailed analysis of Incoming, Outgoing and sms.
- Know your expected expenditure without contacting the operator.
- Location Tagging : Know at which location you have made the calls and receive the calls.
- Itemized Bill: Upload all your data to a particular secure server and fetch it when you want no need to pay extra to the operator for itemized bill.
(You can sign the application before installation at symbiansigned.com)
Wednesday, February 11, 2009
Loading Files from a Remote Server in Silverlight
1. Introduction
Microsoft Silverlight uses the WebClient class to send HTTP requests to remote scripts, which allows the application to perform specific web server functions, such as retrieving files. Remote scripts, created with Active Server Pages (ASP) and Personal Hypertext Processor (PHP), add an additional layer of functionality with direct access to the remote server, such as the file system. In this article, I will demonstrate an application that utilizes the WebClient class to retrieve and display files from a remote server. The article also shows some fun features to enhance the application including Data Binding and a Sample Syntax Highlighter.
1.1 The Non-Silverlight Approach
I developed the Source Code Viewer application using PHP, AJAX, and MySQL. The application allows the end users to browse a collection of source code in a category-style manner. Using AJAX, the page remains stationary as the data is pulled and processed from a MySQL database. The users can browse through the categories to search for files.
There are a couple of concerns in regards to this implementation:
- Modifying and adding files requires constant database changes
- MIME types have to be modified to ensure that the file types are read
- The files have direct hyperlinks
The original Source Code Viewer can be found at: http://www.bayprince.com/sourcecode.
1.2 The Silverlight Approach
I chose to use Silverlight to develop an interactive layer to the Source Code Viewer application.
The Silverlight version contains three primary components:
- Display the list of allowed categories using a file path to category relationship.
- Remote Script to display the list of files in the selected folder
- Render the selected file based on file type
The Silverlight Toolkit has a TreeView control, which is perfect for showing hierarchy data. The control is easily customizable to develop a File Explorer style interface. The Toolkit is conveniently located at http://www.codeplex.com/Silverlight.
The Remote Script retrieves data from the server and renders its output in the form of xml, which can be imported into the Silverlight application. The script performs validations to protect the necessary files and stores the file details into the xml output.
Silverlight has a nice collection of built-in controls and supports rapid development of custom controls. Developing custom controls for specific file types, such as text files, images, and media, allows supporting those types without the need to configure the MIME type entries. For example, Python (py) files on my server are executable by default. It would be beneficial to render those files as text for viewing.
2. Introducing Remote File Viewer
Remote File Viewer is an online application that allows users to browse files on a remote server. I currently use the application to share my source code to students and fellow developers. I manage a single xml file for the category system to inform the application on what categories to display to the end user. The user chooses a category and is presented with a list of files in the category. The list of files is pulled from the remote script that finds the valid files in the respected directory. The user can select a file and view its contents, including basic file information such as File Size and Last Modified.
Remote File Viewer Flow Diagram
2.1 Current Version
The current version of the Remote File Viewer renders source code files, images, and Deep Zoom output. Source Code files are assumed to be ASCII text files. Remote File Viewer has basic syntax highlighting for comments and strings. This allows the code files to appear more dynamic rather than the common text document. Images are rendered using the built-in Image control. The Deep Zoom approach is different because it searches specifically for the dzc_output.xml file to render its output using a standard Deep Zoom template. Additional file types, such as media, can easily be integrated using the framework.
2.2 Remote File Viewer Demo
You can check out the live demo here. The demo will allow you to browse source code text files, images, and Deep Zoom outputs located on my server.
The following file types are supported, along with their respected categories on my server:
- Text: Everything except for the Images category
- Images: Images / Raina Tracer / Scenes category
- Deep Zoom: Images / 3D Modeling category
3. Before Getting Started
3.1 Required Technologies
You will need the Silverlight Toolkit to use some of the necessary controls, including TreeView and DockPanel. The Toolkit can be downloaded at http://www.codeplex.com/Silverlight.
3.2 Testing Remote Code
You will need to run the application (xap) on a remote server otherwise the application will throw a SecurityException exception during any calls to the remote script. The supplied version of the project was designed for my domain, however you can customize the xml file to point to folders on your server.
3.3 Selecting a Server-Side Scripting Language
You can use ASP, PHP, or any other server-side scripting language that can perform tasks on the web server and produce an output. I chose to use PHP for this application, but the same concepts will work for other server-side scripting languages.
4. Implementing the Remote Script
The script must define its Content Type as text/xml to ensure that the output is rendered as XML content.
1: header("Content-type: text/xml");
A single HTTP parameter is passed into the script to store the requested relative path, which will be appended to the script’s actual relative path to the files. The parameter is validated to ensure that the path exists on the web server.
1: // HTTP Parameters
2: $currentFolder = $_REQUEST['dir'];
3:
4: // Prevent access to parent folders
5: $i = stripos($currentFolder, "./", 0);
6: if ($i > -1)
7: $currentFolder = "";
8:
9: $REL_PATH = "../sourcecode/files/";
10: $dir = $REL_PATH . $currentFolder;
11:
12: // Validate that the folder exists
13: if (file_exists($dir) == FALSE) {
14: $currentFolder = "";
15: $dir = $REL_PATH;
16: }
The heart of the script is the generation of the XML content. The script loads the files in the path by calling the pathinfo and fileinfo APIs. The APIs may differ with other scripting languages. The file type is determined by comparing the file extension in the IGNORE_FILES and BINARY_FILES arrays. Each file is then entered as a single entry of the xml file.
1: $IGNORE_FILES = array("exe", "swf", "zip", "vsd", "php", "inc", "mll","htm", "html");
2: $BINARY_FILES = array("jpg", "png");
3:
4: $xml = "<?xml version=\"1.0\"?>\n";
5: $xml .= "<files dir=\"$currentFolder\">";
6:
7: if ($handle = opendir($dir)) {
8: // Loop through files
9: while (false !== ($file = readdir($handle))) {
10: $p = $dir . "/" . $file;
11:
12: if ($file != "." && $file != ".." && is_dir($p) != 1) {
13: // Validate extensions
14: $pathInfo = pathinfo($p);
15: $file_ext = $pathInfo['extension'];
16:
17: // Get file information
18: $fileInfo = stat($p);
19: $fileSize = $fileInfo['size'];
20:
21: $modifiedDate = date ("m:d:Y:H:i:s", $fileInfo['mtime']);
22:
23: // Validate if the application supports the file
24: if (in_array($file_ext, $IGNORE_FILES)) { continue; }
25:
26: // Determine file type
27: $type = "";
28:
29: if (in_array($file_ext, $BINARY_FILES)) { $type = "image"; }
30: else { $type = "text"; }
31:
32:
33: // Output File to XML
34: $xml .= "<file file=\"$file\" type=\"$type\" bytes=\"$fileSize\" lastModified=\"$modifiedDate\" />";
35: }
36: }
37: closedir($handle);
38: }
39:
40: $xml .= "</files>";
41:
42: print $xml;
5. Designing the User Interface
The User Interface consists for three primary sections: Category Tree, File List and the Render Control. The Category Tree is the TreeView Control that is data bounded to the local category xml file. The File List is rendered after the user selects on the category and the data is brought back from the server. The Render Control is a UserControl object renders the output based on the file type.
5.1 Defining the Category Data
The primary category data is the compiled hierarchical list of the categories that will be in the application. Each category has a name, file path, and a list of child categories. There will be some categories that only contain child categories and no files. By setting their file path to an empty string, the application will know to ignore server processing for those categories.
The following XML file shows two categories: C# and Silverlight Development. Both categories have a child categories with files. The dir attribute in the XML is the relative path of the files. This path will be appended to an absolute path location in the C# code. We will data bound this XML file to the Category Tree.
<categories>
<category name="C#" dir="">
<children>
<category name="TicTacToe" dir="csharp/tictactoe">
<children />
</category>
</children>
</category>
<category name="Silverlight Development" dir="">
<children>
<category name="Remote File Viewer" dir="silverlight/rfv">
<children />
</category>
</children>
</category>
</categories>
5.2 Category Tree
The TreeView control is part of the Silverlight Toolkit. The Microsoft.Windows.Controls.dll is required in your project’s References to use the control.
The following reference is added to the list of namespaces in Page.xaml.
1: xmlns:y="clr-namespace:Microsoft.Windows.Controls;assembly=Microsoft.Windows.Controls"
The following code snippet defines the TreeView Control and prepares it to be data bounded to the previously created xml. The TreeView Control uses the HierarchicalDataTemplate object to render the category children data. The SelectedItemChanged event is attached to the control to capture the user’s selection.
1: <y:TreeView x:Name="listCategories" Background="Transparent" BorderBrush="Transparent" BorderThickness="0" SelectedItemChanged="listCategories_SelectedItemChanged">
2: <y:TreeView.ItemTemplate>
3: <y:HierarchicalDataTemplate ItemsSource="{Binding Children}">
4: <TextBlock Margin="0" Text="{Binding Name, Mode=OneWay}" FontSize="12" />
5: </y:HierarchicalDataTemplate>
6: </y:TreeView.ItemTemplate>
7: </y:TreeView>
5.3 File List
The File list becomes visible after the data is retrieved from the remote script. The list allows the user to select on the file to view in the Render Output control. This list is hidden if the category contains no files.
The following code snippet shows the data bounded ListBox.
1: <ListBox x:Name="listFiles" Margin="20" Background="Transparent" BorderBrush="Transparent" SelectionChanged="listFiles_SelectionChanged" Visibility="Collapsed">
2: <ListBox.ItemTemplate>
3: <DataTemplate>
4: <TextBlock Margin="0" Text="{Binding File, Mode=OneWay}" Foreground="White" FontSize="10" />
5: </DataTemplate>
6: </ListBox.ItemTemplate>
7: </ListBox>
5.4 Render Control
The Render Control is a UserControl that will render the file output based in the file type. The Remote File Viewer supports text, images, and deep zoom output. Text is processed through a lightweight syntax highlighting pass for string and comments notation. Images are rendered using the built-in Image control. Deep Zoom objects are loaded into the custom Deep Zoom application with the generic functionality. Other file formats can be supported by adding their output panels in this control.
The following code snippet shows the controls use to render the file outputs. The current file type refreshes the user interface by toggling the visibility of the other controls.
1: <ScrollViewer x:Name="scrollViewer" BorderThickness="0" BorderBrush="Transparent" VerticalScrollBarVisibility="Auto">
2: <Grid>
3: <StackPanel x:Name="panelProgress" Margin="0" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="Collapsed">
4: <TextBlock Text="Loading..." FontSize="16" />
5: <ProgressBar x:Name="progress" Width="200" Height="15" Minimum="0" Maximum="100" />
6: </StackPanel>
7: <TextBlock x:Name="txtOutput" Margin="5" Foreground="Black" FontSize="10" />
8: <Image x:Name="imageOutput" Stretch="Uniform" Width="Auto" Margin="0" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="Collapsed" />
9: <z:DZPanel x:Name="zoomOutput" Width="Auto" Margin="0" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="Collapsed" />
10: </Grid>
11: </ScrollViewer>
6. Implementing the User Interface
6.1 Defining the Remote Data Members
The following code snippet shows the two data members that store the values of the remote addresses. REMOTE_SCRIPT_PATH is the location of the remote script. REMOTE_ABS_PATH is the absolute path where the files are stored. The remote location is hidden from the end user thus allowing for another layer of security.
1: private const string REMOTE_SCRIPT_PATH = "http://www.DOMAIN.com/RemoteFileViewer/xml.php";
2: private const string REMOTE_ABS_PATH = "http://www.DOMAIN.com/sourcecode/files/";
6.2 Implementing the Web Server Connection
The following code snippet shows the implementation of wrapper function for the WebClient API. The function is called twice when retrieving the file list from the server and during the downloading file process. The function accepts the remote address and two callbacks as inputs. WebClient provides methods for sending and receiving data. The WebClient.DownloadStringAsync method is used to download the resource as a string format. DownloadProgressChanged and DownloadStringCompleted are two event handlers that will be use to handle the data transfer and completion. During the transfer, the application displays a progress bar to inform the user of its status. The DownloadStringCompleted validates that the download was successful and stores the results in the DownloadStringCompletedEventArgs member.
1: private void CallWebService(
2: string remoteUrl,
3: DownloadProgressChangedEventHandler changeCallback,
4: DownloadStringCompletedEventHandler completeCallback
5: )
6: {
7: // Load service from the server
8: WebClient client = new WebClient();
9: client.DownloadProgressChanged += changeCallback;
10: client.DownloadStringCompleted += completeCallback;
11: client.DownloadStringAsync(new Uri(remoteUrl, UriKind.Absolute));
12: }
6.3 Populate the TreeView Control
The following code snippet loads the Data.xml file and parses the data into the list of DataCategory object. The data is then bounded to the TreeView control.
1: // Populate categories from local data source
2: XElement root = XElement.Load("Data.xml");
3: Categories = (from c in root.Elements("category")
4: select new DataCategory
5: {
6: Name = (string)c.Attribute("name"),
7: Children = LoadData(c),
8: Folder = (string)c.Attribute("dir"),
9: }).ToList();
10:
11: // Update categories' data
12: listCategories.ItemsSource = Categories;
6.4 Selection Events
The following code snippets show the implementation of the Category and File Selection Events. Both events call the CallWebService function to retrieve data from the server. The File Selection event parses the file based on its file type to provide the appropriate loading.
1: private void listCategories_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
2: {
3: DataCategory category = (DataCategory)listCategories.SelectedItem;
4:
5: // Validate category (some categories don't have files)
6: if (category == null category.Folder == "")
7: {
8: listFiles.Visibility = Visibility.Collapsed;
9: return;
10: }
11:
12: // Connect to php service to get files in the folder
13: renderControl.ShowProgress(0);
14:
15: CallWebService(
16: String.Format("{0}?dir={1}", REMOTE_SCRIPT_PATH, category.Folder),
17: DirDownloadProgressChanged,
18: DirDataComplete
19: );
20: }
21:
22: private void listFiles_SelectionChanged(object sender, SelectionChangedEventArgs e)
23: {
24: DataFile file = (DataFile)listFiles.SelectedItem;
25:
26: // Load selected file
27: if (file == null file.File == "")
28: return;
29:
30: // Get file path
31: string folder = ((DataCategory)listCategories.SelectedItem).Folder;
32: string path = String.Format("{0}{1}/{2}", REMOTE_ABS_PATH, folder, file.File);
33:
34: if (file.Type == "text")
35: LoadFile(path);
36: else if (file.Type == "deepzoom")
37: renderControl.RenderDeepZoom(file, new Uri(path, UriKind.Absolute));
38: else if (file.Type == "image")
39: renderControl.RenderImage(file, new Uri(path, UriKind.Absolute));
40: }
7. Icing on the Cake: Syntax Highlighter
Syntax highlighting provides for a visual addition when viewing source code. I decided to add a basic implementation of Syntax Highlighting to the Remote File Viewer to make the source code stand out. The current version supports string and comment syntax highlighting.
The TextBlock object can hold a collection of Run objects, each with their own style properties. The ApplyHighlighting function accepts the string input from the file and parses the file based on lines. The function performs string checks to find particular tokens, such as comment tokens and string quotations, and render them in separate Run objects. Additional tokens can be supported by comparing to a keyword hash or applying regular expressions.
1: #region Syntax Highlighting
2: //================================================
3: private string AddOutput(string output)
4: {
5: if (output != "")
6: {
7: AddRun(output, Colors.Black);
8: output = "";
9: }
10:
11: return output;
12: }
13:
14: //================================================
15: private void AddRun(string txt, Color color)
16: {
17: Run run = new Run();
18: run.Text = txt;
19: run.Foreground = new SolidColorBrush(color);
20: txtOutput.Inlines.Add(run);
21: }
22:
23: //================================================
24: private void ApplyHighlighting(string txt)
25: {
26: string output = "";
27: bool commentMode = false;
28:
29: // Clean line spacing
30: txt = txt.Replace("\t", " ");
31: txt = txt.Replace(" ", " ");
32:
33: // Clear UI Elements
34: txtOutput.Inlines.Clear();
35: txtOutput.Text = "";
36:
37: // Parse file contents into lines
38: List<string> lines = txt.Split('\n').ToList();
39:
40: foreach (string line in lines)
41: {
42: // Blank line (append to current output)
43: if (line.Trim() == "")
44: {
45: output = String.Format("{0}\n", output);
46: continue;
47: }
48:
49: // Check for comments if we are not in a comment
50: if (!commentMode)
51: {
52: // Visual Studio Region coloring
53: if (line.Contains("#region") line.Contains("#endregion"))
54: {
55: int index = line.IndexOf("#");
56:
57: // Add words before the comment
58: output = String.Format("{0}{1}", output, line.Substring(0, index));
59: output = AddOutput(output);
60:
61: // Add the comment
62: AddRun(String.Format("{0}\n", line.Substring(index)), Colors.Blue);
63: continue;
64: }
65:
66: // Single line comments (// and # symbols)
67: if ((line.Contains("//") && !line.Contains("http://")) (line.Contains("#") && !line.Contains("\"#") && !line.Contains("#\"")))
68: {
69: int index = 0;
70:
71: if (line.Contains("//"))
72: index = line.IndexOf("//");
73: else
74: index = line.IndexOf("#");
75:
76: // Add words before the comment
77: output = String.Format("{0}{1}", output, line.Substring(0, index));
78: output = AddOutput(output);
79:
80: // Add the comment
81: AddRun(String.Format("{0}\n", line.Substring(index)), Colors.Green);
82: continue;
83: }
84:
85: // Apply string highlighting
86: if (line.Contains("\""))
87: {
88: output = ApplyStringHighlighting(output, line);
89: continue;
90: }
91: }
92:
93: // Comments Highlighting
94: if (line.Contains("/*"))
95: {
96: if (line.Contains("*/"))
97: {
98: try
99: {
100: int index = line.IndexOf("/*");
101:
102: if (index > 0)
103: output = String.Format("{0}{1}", output, line.Substring(0, index));
104: else
105: index = 0;
106:
107: // Add words before the comment
108: output = AddOutput(output);
109:
110: // Add the comment
111: int commentIndex = line.IndexOf("*/");
112: AddRun(line.Substring(index, commentIndex + 2 - index), Colors.Green);
113:
114: // Add the words after the comment
115: output = AddOutput(String.Format("{0}\n", line.Substring(commentIndex + 2)));
116: }
117: catch { }
118:
119: continue;
120: }
121: else
122: {
123: // Append to the output data (not the UI)
124: output = AddOutput(output);
125: commentMode = true;
126: }
127: }
128:
129: // Append string
130: output = String.Format("{0}{1}\n", output, line);
131:
132: // Close comments (if applicable)
133: if (line.Contains("*/") && commentMode)
134: {
135: AddRun(output, Colors.Green);
136: output = "";
137: commentMode = false;
138: }
139: }
140:
141: // Add remainder output
142: output = AddOutput(output);
143:
144: // Update scroll viewer to its top position
145: scrollViewer.ScrollToVerticalOffset(0);
146: }
147:
148: //================================================
149: private string ApplyStringHighlighting(string output, string line)
150: {
151: string curLine = line;
152: bool openString = false;
153: int index = 0;
154:
155: output = AddOutput(output);
156:
157: while (curLine.Length > 1 && curLine.Substring(1).IndexOf('\"') != -1)
158: {
159: index = curLine.IndexOf('\"');
160:
161: if (openString)
162: {
163: AddRun(String.Format("\"{0}", curLine.Substring(0, index + 1)), Colors.Red);
164: openString = false;
165: }
166: else
167: {
168: output = AddOutput(curLine.Substring(0, index));
169: openString = true;
170: }
171:
172: curLine = curLine.Substring(index + 1);
173: }
174:
175: return AddOutput(String.Format("{0}\n", curLine));
176: }
177: #endregion Syntax Highlighting
8. Conclusion
Silverlight provides a wide variety of features to develop rich interactive applications. The WebClient class extends the application with web server functionality by downloading data from the remote web address.
In this article, I demonstrated how the Remote File Viewer application interacts with the remote script using the WebClient class. The basic framework of the Remote File Viewer will allow you to show files to your end users. Other file formats, such as video and audio, can be easily implemented by extending the remote script and the Render Control. The Syntax Highlighting feature is a fun addition that can be further enhanced to handle a variety of scenarios.
Hopefully this article has helped start you along the path of using Silverlight and the WebClient class to create interactive data-driven web applications.