Showing posts with label Services. Show all posts
Showing posts with label Services. Show all posts

Nov 14, 2008

Two new automated blogs

I've been very busy this month. All the exams (for microsoft certification, in the faculty and so on), my extended work day (from 9 to 20 as I was absent
from work for about a month and need to do some extra work to catch my collegues), some ongoing projects I was stupid enough to take and so on...

However, I've found some time to start two new blogs which I consider more as experiment than real blogs:

Sql Exceptions

and :


.NET Exceptions



Both blogs currently contain about 40 posts with Sql and .NET Exceptions which you may find helpful after time. I am saying after time as I plan to automate those blogs so the information there is posted by software and not by myself.

Also users are welcome to post comments. Soon I will publish special format of posts which you can use in order to give your opinion on specific exception and this exception will be automatically published in the post.

Unfortunatelly there is a limitation - Blogger allow me to only publish about 40 posts daily so I wasn't able to create posts about all the exceptions in SQL and .NET Framework.

I will batch post each day (may miss some of the days like weekends for example ;) so in few weeks both blogs will be up to date.

Mar 31, 2008

Never tought I will need Award Images module on my site ...

I recently built a PAD generator script on my site in order to easilly promote my software, but I never tought my software will be awarded. The surprise came from Sedo Auctions Watcher, it was awarded 5 stars by redsofts.com (you can find my program listed here). Becouse I built this little tool for few hours and it wasn't doing anything than informing you on ending domain auctions I was pretty surprised. What's even more interesting is that Sedo Auctions Watcher is adware program. It displays banners, but it does this by following some guidelines. It will not change your homepage or install toolbars.

Probably because I was trying to play fear I was awarded. What's good is that this award changed the way I think. After 4-5 hours of work
were awarded, what will happen if I spend some more time?

You'll see soon ;)

You can find the rating guidelines here:

http://www.redsofts.com/awards.html

Mar 19, 2008

Very simple tool to watch ending Sedo Auctions

Few months ago I was interested in the domain trading business. It was interesting to me as it generated 14.2 million dollars back in 2006. It is based on speculla I think. Something like FOREX but not quite.

I registered two domains and placed them on Sedo Auctions.

I was also interested on how other domains are going so I decided to write a small tool. It will stay in your tray and will show you the auctions which are about to end the next 24 hours. The following information is gathered about each auction:

- Domain for sale
- Price
- Currency
- Time left before the auction is closed
- Google PR for each domain

The program is available for download from Chameleon Bulgaria

I decided to put a banner on this program so my domains
for sale are visible to the users (well, after all I spent some time on this program and I would really like ot have some incomes after all ;).

Here is a direct link to the program page on Chameleon Bulgaria may be found
here

Jan 28, 2008

Job Done!

I think I made it finally. The osCommerce 2 vShop import was made this afternoon. Just waiting QA test now.
>

Jan 22, 2008

.NET C# to parse MySQL queries? Impossible? Pavel can make it ;) (with some ifs and buts offcourse ;)

The most interesting task in my career came the end of the last week. As a Vizibility employee I was asked if I can port osCommerce live site to out vShop solution (http://www.vizibility.co.uk/tmenu/vshop.asp) The interesting thing is that I had no access to osCommerce nor did I ever worked with it. What's even more chalenging - osCommerce database was given to me as SQL queries, something like :

drop table if exists table ;
create table table (
-- Some things here ...
);

insert into table () values ( );

As a normal software developer so there were 3 big chalanges:

1. How to parse this SQL thing (it is MySQL) ?
2. How to figure out
the osCommerce Logic ?
3. How to port all those things as a script so it can be applied to our live servers by the support team?


It's really chalanging don't you think? First I thought it will be a good step to install fresh copy of osCommerce, import the products and try to port them as CSV or something. But then I understood it will take too much time, so I decided to parse the SQL queries on my own and store them in a predefined objects like tables, rows and so on and so on. Then I could easilly transfer them as a text files in the format we needed.

And I almost made it - the parsing methods are done (I was able to parse this thing in a day but some bugs still appear).

Seems the more I work on our shopping solution the more easier I can understand other's shopping solutions.

Great task in a great company!

Jan 21, 2008

5 minutes C# code to open Web.Config from Windows Forms application.

In my previous post about IIS, Virtual Directories and Directory Services you saw how can you obtain the sites per IIS instance as well sa all the root virtual directories. Now it is time to show you how can you obtain the Web.Config file for a root directory.

At first glance I thought it will be easy, I thought I will simply need declare the following:

using System.Web.Configuration;

And / or :

using System.Configuration;

Well it's not quite this way. In order to load web.config file from a windows forms application you need to have some kind of context to be used or, in other words, file mapping.

The following method takes two parameters : path to the root directory and DirectoryEntry, representing the root directory
object (you can see my previous post ( Get IIS sites and virtual directories with .NET / C# / Directory Services ) learn how to obtain DirectoryEntry for a web root directory.
And here is the method:

      
List < string []> GetWebConfigAppSettings( string Path, DirectoryEntry entry)
       {
            
List < string []> items = new List < string []>();
            
if (entry.Properties[ "Path" ].Value != null )
            {
               
FileInfo fiWebConfig = new FileInfo (entry.Properties[ "Path" ].Value + @"\web.config" );
               
if (fiWebConfig.Exists)
                {
                  
WebConfigurationFileMap fm = new WebConfigurationFileMap ();
                   System.Collections.
Hashtable props = new System.Collections. Hashtable ();
                  
foreach (System.DirectoryServices. PropertyValueCollection property in entry.Properties)
                   {
                        
string propertyName = property.PropertyName;
                        props.Add(propertyName, property.Value);
                   }
                  
VirtualDirectoryMapping mapping = new VirtualDirectoryMapping (fiWebConfig.Directory.FullName, true );
                   fm.VirtualDirectories.Add(entry.Properties[
"AppRoot" ].Value.ToString(), mapping);
                   System.Configuration.
Configuration cfg = System.Web.Configuration. WebConfigurationManager .OpenMappedWebConfiguration(fm, entry.Properties[ "AppRoot" ].Value.ToString());
                  
foreach ( KeyValueConfigurationElement elmt in cfg.AppSettings.Settings)
                   {
                        items.Add(
new string [] { elmt.Key, elmt.Value });
                   }
                }
            }
            
return items;
       }



The method above will return a List of all in the web.config file (the appSettings section), you can easilly adjust it to fit your needs.

As you can see the magic begins in :

> System.Configuration. Configuration cfg = System.Web.Configuration. WebConfigurationManager .OpenMappedWebConfiguration(fm, entry.Properties[ "AppRoot" ].Value.ToString());


method. You simply need to make some preparations befor ask it to open the web.config.

Note : this code again is written in few minutes and does not pretend to be optimized, you can again use it at your own will.

Jun 9, 2007

When to decouple?

It is quite modern nowadays to decouple things. One project in USA to deal one business requirement, another in Pakistan to deal with some other business requirement and one more in Romania and one more in Bulgaria...

Is it so good indeed to decouple single project into Web services and make them talk each other?

Well I think as most things in this life decoupling has its advantages and disadvantages.

I nearly lost my mental health becouse of an xslt to transform an xml document to another xml document so it can be sent from a system we are developing to a system, which provides document printing. Does it worth to write 14, 000 lines of xslt code only to print a document? Well, depends on the viewpoint. First of all decoupling minimizes
the development efforts in the corporation, by splitting it into development efforts in two or more corporations. That's good #1. Second - it can save years of gathering data (a good example are the credit providers in the USA, they have information you can hardly obtain other way but using their (paid) services). That's good #2.
The support is done by the other party, you don't need to care about it. That's good #3.
The other good thing is that there's always someone else to blame for something not working ;). That's joke ofcourse. The truth is that if your code doesn't work - you'll lose your clients. That's the simple truth about any business.

Now let's turn our attention on the disadvantages the SOA and decoupling may bring to you. The first and one of the biggest disadvantages is that YOU ARE DEPENDING ON SOMEONE ELSE. Any technical problem on their side will affect your side and what's worse - it will also affect your customers. And what is even worse- it will (in most cases) harm your reputation, not the reputation of the party that made the mistake (so be careful about what are you writing in the error messages the customer will see on other party fail;). Yeah, I mean it. You shouldn't accept the other party guilt as yours, if they could delivered it to you, you would have delivered it to the client, right? So instead of writing :
"Error, we have a problem"
write :
"Error, our partner have a problem."
Other big disadvantage is that while developing your side code you are facing a black box. You don't know what's happening in this black box and why it is responding in the way it does. You can only trust the documentation you may have. But is everything in it? No, I don't think so. Especially for complex services some small things are always missing and you need to either figure them out (which costs a lot of money for pills) or contact the other party and wait so they can clear the problem and document it.
I remember once I faced great problems with a web service which simply refuses to return any response. Only some simple empty xml document. Finally we figured out with my colleagues it needed two spaces in the begining of the document. I remember I wanted to swim from Bulgaria to USA to ask the guys who developed this thing to show me how would the request the document. The development dificulties, however are not a great obstacle, becouse once passed, they won't worry you anymore. But there is one more disadvantage which will remain - the transportation of the data. In order to get response from a third party service you need to send it request (this request is transported over the Internet), the service needs time to process it and then it returns you the request (which is also transported over the Internet). Then you may do something with this request and send response to the client (which is also done over the Internet). So instead one response / request pairs, you will have two. That's 100% bandwidth growth. It isn't something you can live with.

So the question remains. When should we use decoupling and SOA (I mean services, provided by third parties)?

I think it is a good choice to use third party services when you need some sort of information which is hard to obtain or may require too much time and which someone already have (credit reports in USA are good example, I think). You also may consider using SOA for services which will require a lot of time for development and which are already developed by third parties. For simple services - I think it is better to develope them on your own, so you don't waste too much bandwidth and depend on other parties.