The much awaited Wolfram|Alpha (tagged as "the google killer") was finally launched Friday evening. According to the news from CNET, the newest search engine tried to bring the service online in the middle of a perfect storm. However, networking and database problems also prevented the engine from launching as of 6 p.m. PDT, an hour after the company announced that it would go live to the world. Nevertheless Wolfram|Alpha is now up and running and here are the screenshots from my testing of the service this morning. I tried playing with it using different keywords and the new search engine gave me some interesting results:
For keyword "Puerto Galera, Philippines": it gave me the city population, local time, current weather and etc.
For keyword "Geogravity in philippines": it returns data facts and a lot of numbers.
My first Impression is that Wolfram|Alpha results are good but the processing is quite slow (at least for some query I tested). I also experienced some failed query attempts that displays a failure message like the one below.
Although glitches during testing stage are understandable. I hope it can live the hype for the coming weeks.
This morning, I was writing an invoice number generator module for my open source billing system project that will be released soon at foxtrot0911.com. The format of the invoice number is YEAR+NNNNN(Ex. 200900001). The five right most numbers are incremental and will start at 1. I decided to put the invoice number generator on a store procedure and the challenge was, How will I put leading zeros to number to make a fixed width of numbers? (Example: 1 to 00001, 2 to 00002... 20 to 00020 and so on). Today I will show you how you can implement it using SQL stored procedure. There are several way to do this in SQL, Here are two SQL script examples that you can use:
Using RIGHT function
SELECT @InvoiceNumber=RIGHT('00000' + CAST(InvoiceNo AS VARCHAR(5)), 5) FROM TMPNumbers
/*Increment invoice number holder */ UPDATE TMPNumbers SET InvoiceNo=InvoiceNo+1
GO
Using RIGHT AND REPLICATE function
SELECT @InvoiceNumber=RIGHT(REPLICATE('0', 5) + CAST(InvoiceNo AS VARCHAR(5)), 5) FROM TMPNumbers
/*Increment invoice number holder */ UPDATE TMPNumbers SET InvoiceNo=InvoiceNo+1
Using stored procedure on processing huge query can make data processing faster compare to processing the data on the client side. A stored procedure is a precompiled executable object that contains one or more SQL statements. When calling stored procedure, you are issuing just one batch of commands and the database server executes all the commands and returns the result to the calling client application. This approach has a huge optimization in case the database server is accessed via a slow network. Another advantage of using stored procedure over client queries is, in stored procedure you don't have to recompile and redeploy your application whenever there are changes on your queries. Instead you just edit the stored procedure directly on database server query editor and run it then it will automatically reflect to all application using that stored procedure.
To show you how to call Stored Procedure in VB.NET, here is a sample code that counts the recurring invoices that were already due.
The Stored Procedure to call.
ALTER PROCEDURE [dbo].[uspCountRecurInvoice] @RecurCount float OUTPUT
AS SET NOCOUNT ON;
--monthly SELECT @RecurCount=COUNT(ARHeaderID) FROM dbo.tblARHeaderRecur WHERE DateDiff(mm,StartDate,GetDate())>=1 and RecurringInterval='Monthly'
--weekly SELECT @RecurCount=@RecurCount+COUNT(ARHeaderID) FROM dbo.tblARHeaderRecur WHERE DateDiff(wk,StartDate,GetDate())>=1 and RecurringInterval='Weekly'
RETURN @RecurCount
Calling a stored produre in VB.NET
Private Function CountRecurringDue() As Boolean Dim con As New SqlConnection Dim cmd As New SqlCommand Dim lreturn As Boolean = True Try con.ConnectionString = Settings.ConnectionString con.Open() cmd.Connection = con cmd.CommandType = CommandType.StoredProcedure cmd.CommandText = "uspCountRecurInvoice" cmd.Parameters.Add("@RecurCount", SqlDbType.Int) cmd.Parameters("@RecurCount").Direction = ParameterDirection.Output cmd.ExecuteNonQuery() Dim intCount As Integer = 0 Integer.TryParse(cmd.Parameters("@RecurCount").Value, intCount) If intCount > 0 Then MessageBox.Show("There is " & intCount.ToString() & " recurring invoice to run", "Recurring Invoice") Catch ex As Exception lreturn = False MessageBox.Show("Error while counting due recurring invoices." & ex.Message, "Recurring Due Counter") Finally con.Close() End Try Return lreturn End Function
For more VB.NET Coding Tips and Tricks, subscribe now
Its all over the news this morning, the search Giant services were experiencing slow down on some major cities. Pings on Google.com show packet losses in New York, San Francisco, Chicago, Australia, France, China and other locales. The outage began at 8:13 a.m. PDT, according to McAfee's data, and was fixed by 9:14 a.m. PDT. It affected about 14 percent of users but everything is back to normal now. According to McAfee, the probable cause was the attempt of Google to make changes to key Internet routing numbers as part of its ongoing transition from an older networking standard to a newer one called IPv6 but this was denied by Google.
Here is the explanation of Google about the sudden outage:
Imagine if you were trying to fly from New York to San Francisco, but your plane was routed through an airport in Asia. And a bunch of other planes were sent that way too, so your flight was backed up and your journey took much longer than expected. That's basically what happened to some of our users today for about an hour, starting at 7:48 am Pacific time.
An error in one of our systems caused us to direct some of our web traffic through Asia, which created a traffic jam. As a result, about 14% of our users experienced slow services or even interruptions. We've been working hard to make our services ultrafast and "always on," so it's especially embarrassing when a glitch like this one happens. We're very sorry that it happened, and you can be sure that we'll be working even harder to make sure that a similar problem won't happen again. All planes are back on schedule now.
By default, .NET framework redistributable does not include Crystal Reports module. So more often, programmers encounters errors on deployment when printing reports created from Visual Studio Crystal Report. Deployment of .NET applications should be easy, you just need to have a .NET framework installer and your application's executable plus database then it should good to go. But this only applies if you have no reports written on crystal report. If you did, you have to include the "CrystalReportsRedist2005_x86.msm" merge module on your application's installer. To make everybody's life easier, I uploaded my Crystal Reports .NET 2.0 Redistributable Installer on my file hosting server. To deploy it, just extract the compressed file and run the setup.exe.
Google Chrome 2.0.180.0 (developer build) has been released Tuesday night at the dev channel. The newest version included some significant fixes listed on the release notes posted at Chromium Developer Documentation. The most interesting inclusion is the support for extensions that made the Mozilla's Firefox popular over rival browsers. Google also provided some sample Chrome extensions which can be enabled if you launch the browser through the command line with the "--enable-extensions".
A sample extension that I tried is the GMail checker that displays a toolstrip that shows how many messages are in your Gmail inbox.
To install Google Chrome Developer version, read here.
If you can not wait to enjoy the new features of Google Chrome before its actual official release, you must switch to "Development Channel". By default, Google Chrome installer which is available for download at http://www.google.com/chrome is subscribe to Stable release only (quarterly updates). To subscribe to Development channel, just follow these steps.
1. Download and Install Google Chrome from http://www.google.com/chrome. 2. Download the Google Chrome Channel Switcher 3. Run the Chrome Channel Switcher and Select the Dev channel as shown below:
4. Click Update to save your choice the click Close. 5. In Google Chrome, click the wrench menu and choose About Google Chrome. 6. Click Update Now to install the dev channel's release. 7. Lastly restart all instances of Google Chrome.
One of my favorite .NET control is the ListView. It is very useful for displaying multiple records on a spreadsheet format. Column sorting is one the feature of spreadsheet applications that most of end-users are used to. Unfortunately, this is not readily available as property in VB.NET. The ListView Sorting property only sorts items and not the sub-items so it can't be use if we want to allow the user to sort your list by any clicked column.
Google Inc. announced today their newest search options called Google Squared at the Searchology event. Unlike Google's traditional search results, Google Squared will not simply show a set of links related to the search request. Instead, it will query through Google's massive database to organize pertinent facts and other content in rows and columns. The search giant said that the new feature aims to effectively guess out what the user intent is and get the results quickly. Sounds familiar? that’s because Wolfram Alpha has been pitching for the same understanding technology of their own search engine. So it could be argued that Google is preempting what Wolfram Alpha want to accomplish.
"Syntax error (missing operator) in query expression" is a common error when executing SQL statements such as INSERT and UPDATE. Most of the time, beginners are having a hard time to dissect which statement from query is causing the error. If we will read between the line, the runtime compiler is trying to tell us that you submitted an SQL syntax that it cannot understand. The error applies to Microsoft Access and SQL Server. On MS Access, error message is "Microsoft JET Database Engine (0x80040E14) Syntax error (missing operator) in query expression"
To troubleshoot the problem, Try the following steps: 1. CHECK if you have a complete SQL command on the query your trying to submit.
SELECT [fields] FROM [table] WHERE [expression] INSERT INTO [table] ([field1],...) VALUES ([value1],...) WHERE [expression] UPDATE [table] SET [field1]=[value1] WHERE [expression]
2. CHECK for extra qoutes inside the string value your trying to pass.
For example: INSERT INTO tblCustomer(firstname,lastname) VALUES('Fryan's','Digital World')
This query will give you the "Syntax error (missing operator) in query expression" error due to the extra qoute in the second string value: 'Fryan's'
You can avoid this in .NET, by using the Replace() function before you pass the string value to complete the query as shown below.
Dim strQuery as String Dim strFirstname as String = "Fryans's" Dim strLastname as String = "Digital World"
Remember that its the responsibility of the programmer to prevent this type of errors. We should not blame our users if they trying to input extra quotes during data entries.
Microsoft release an incubation project referred to as codename "Axum" to solicit feedback from their customers and validate Axum’s value propositions. User's feedback will be the biggest factor in the success of Axum, whether it will become a product or stay as project. The primary use for Axum is to define concurrent application logic of relatively coarse granularity. Axum borrows its syntactic style from the C family, most closely C#, with which it shares most of its expression and statement language elements. Here's a qouted definition from Axum official website:
Axum aims to validate a safe and productive parallel programming model for .NET. It’s a language that builds upon the architecture of the web and the principles of isolation, actors, and message-passing to increase application safety, responsiveness, scalability and developer productivity
To install Axum you must have at least Visual Studio 2008. Try it yourself, download it now.
A college friend is currently developing a University Library system which is connected to internet. The system has kiosks for student to search for books they want to borrow. For example, if a students type-in Manny pacquiao on the search box, it should display all available books or magazines about Manny. Aside books result, the system should also be able to extract some information/biography about Manny. We thought that instead of populating a information database, the system will just retrieve contents from a public encyclopedia database such as Wikipedia.
Luckily for him wikipedia has a readily available API for this kind of web request. To show how we did it using C#, I created a sample project for you that can be downloaded from Mediafire.
Just follow these steps to create your own from scractch: 1. Create a new Project on your C# IDE. 2. On the form, Add a button and a richtextbox (textbox will do) 3. Double click the form to show the coding window. Add the following namespaces at the Using directives.
using System.Net; using System.IO; using System.Xml; using System.Xml.XPath;
4. Now double click the button to show the coding window then on the click event paste the following code:
FacePAD, better known as the Facebook Photo Album Downloader is a firefox browser extension that will allow you to download your friends' facebook albums, en masse, with the click of a button. The software extension was originally developed by Nic Holliday and updated by Lazyrussian, rozziite. Aside from your friends album, you can also grab an album from Events Album or Groups Album.
After installing the firefox extension, you can download your own or friends albums in just one click. Heres a step-by-step video tutorial on how to this cool software.
I tested it on my account and it actually works! see the screen shot below:
If your using Firefox browser, download it FacePAD now.
For more information on Cool Softwares, subscribe now
This afternoon, a user from yahoo answer ask me on how to send xml data to a web page using C#. He want his client application to post updates on a web application that accepts uniform XML format. My advice to him is to use the .NET's WebRequest class. WebRequest is an abstract base class for the .NET Framework's request/response model for accessing data from the Internet. An application that uses the request/response model can request data from the Internet in a protocol-agnostic manner, in which the application works with instances of the WebRequest class while protocol-specific descendant classes carry out the details of the request.
Requests are sent from you client application to a particular URI (Uniform Resource Identifier), such as a Web page on a server. The URI determines the proper descendant class to create from a list of WebRequest descendants registered for the application.
Here's the steps to send data to a server. This method is commonly used to post data to a Web page:
1. Create a WebRequest instance by calling Create with the URI of the resource that accepts data
string uri = "http://127.0.0.1/webmsgbroker/default.aspx"; WebRequest req = WebRequest.Create(uri);
2. Specify the protocol method and the content type to use in sending the request
3. Wrap the request stream with a text-based writer
StreamWriter writer = new StreamWriter(req.GetRequestStream()); // Write the xml text into the stream, GetTextFromXMLFile is a custom function the convert XML to stream writer.WriteLine(this.GetTextFromXMLFile("C:/test.xml")); writer.Close();
4. Send the data to the webserver and wait for the response.
rsp = req.GetResponse();
Here is the complete sample sourcecode:
//Function to convert XML to stream private string GetTextFromXMLFile(string file) { StreamReader reader = new StreamReader(file); string ret = reader.ReadToEnd(); reader.Close(); return ret; }
//Button to Post data to web page private void button1_Click(object sender, EventArgs e) { WebRequest req = null; WebResponse rsp = null;
try { //URL of message broker string uri = "http://127.0.0.1/webmsgbroker/default.aspx"; req = WebRequest.Create(uri); req.Proxy = wproxy; req.Method = "POST"; // Post method req.ContentType = "text/xml"; // content type // Wrap the request stream with a text-based writer StreamWriter writer = new StreamWriter(req.GetRequestStream()); // Write the xml text into the stream string fileName = "C:/test.xml"; writer.WriteLine(this.GetTextFromXMLFile(@fileName)); writer.Close(); // Send the data to the webserver rsp = req.GetResponse();
The first ever Windows 7 RC (build 7100) bug was found and luckily the newest windows is still on BETA stage. The reality is every software has bugs and sooner or later people will find it. Thats why there is beta testing stage, it is the method to find them. But according to Ed Bott of ZDNET, this one looks more serious and it shouldn't slipped through into the release candidate.
Microsoft already published the complete description of the bug:
A folder that is created under the root of the system drive is missing entries in its security descriptor, which may cause some application failures on the English version of Windows 7 Release Candidate 32-bit Ultimate
In the English version of Windows 7 Release Candidate (build 7100) 32-bit Ultimate, the folder that is created as the root folder of the system drive (%SystemDrive%) is missing entries in its security descriptor. One effect of this problem is that standard users such as non-administrators cannot perform all operations to subfolders that are created directly under the root. Therefore, applications that reference folders under the root may not install successfully or may not uninstall successfully. Additionally, operations or applications that reference these folders may fail.
For example, if a folder is created under the root of the system drive from an elevated command prompt, this folder will not correctly inherit permissions from the root of the drive. Therefore, some specific operations, such as deleting the folder, will fail when they are performed from a non-elevated command prompt. Additionally, the following error message appears when the operation fails: Access is denied.