I was working on a personal project and needed to accomplish some specific requirements when clients purchased an item from the website. Now, Paypal has something called Instant Payment Notification (IPN) which is a mechanism by which Paypal makes an Http Post to any url you choose, and in that post it sends you some vital information about the financial transaction (more information on Paypal's IPN here).
The problem that I was having was that I was not able to locally debug the code that I had written for the URL that would receipt Paypal's Http Post, and the reason is that in your Paypal's business account, you are not allowed to enter a "localhost" type of url. So when you go to Paypal, log in and go to Profile -> My Selling Tools -> Instant Payment Notifications, you can then specify the URL where Paypal will post the requests and this URL is not allowed to be localhost.
Tuesday, May 19, 2015
Thursday, October 2, 2014
Evaluating similarity between strings. Jaro-Winkler implementation in C#
We recently had a requirement where our application had to let the user know about existing trading security names from the database that were "similar" to what the user was trying to import into the system.
Saturday, August 2, 2014
Automatically setting READ UNCOMMITTED isolation level in LINQ Contexts
We recently decided to set a READ UNCOMMITTED transaction isolation level for our queries to the database and we wanted to establish it at the Linq Context level so that all of our "Select" queries would apply it by default.
Reading table records in SQL temporarily locks them until the query finishes its execution and all the data is returned to the client. This locking may slow down the execution times of other competing queries on the same table. We had one particular query in one table that would normally take 10 - 12 seconds when executed alone. As soon as you had that same query competing with 35 other threads it would take anywhere between 60 to 120 seconds.
Reading table records in SQL temporarily locks them until the query finishes its execution and all the data is returned to the client. This locking may slow down the execution times of other competing queries on the same table. We had one particular query in one table that would normally take 10 - 12 seconds when executed alone. As soon as you had that same query competing with 35 other threads it would take anywhere between 60 to 120 seconds.
Friday, December 13, 2013
Waiting for all asynchronous tasks to finish
We recently had to revisit one of the reports of our system (a financial solution) because it was taking too long, anywhere between 20 to 40 minutes depending on the size of the Mutual/Hedge Fund Company). Basically, the report contained information about the positions of each account in a fund, things like Units held, Average Cost, Market Value, Series. Unfortunately, these numbers cannot be obtained through simple SQL aggregation functions like SUM or AVG and crunching the numbers results in an exercise a little harder than that which includes going through the transactions history of each account.
Monday, April 22, 2013
Set UpdateCheck to Never programatically for LINQ Data Contexts
By default when you generate a LINQ Data Context in Visual Studio, every column of every table has the UpdateCheck property set to Always. The implication of this is that the UPDATE sql statements issued by LINQ will include all the fields in the WHERE clause in order to match the exact copy of the record that was initially read and prevent overwriting changes made by other users/threads between the last time we read the record and the moment we try to update it. And that's fine in many scenarios but sometimes you want all the UPDATE statements to find the record to update and change it regardless of changes sent by others (a "last commit wins" type of policy) and for that you'd need LINQ's UPDATE statements to only include the table's primary key fields in the WHERE clause. That is, you need the UpdateCheck property set to Never for all the columns that are not primary keys.
Sunday, October 21, 2012
Visual Studio poor performance issue
Over the last two weeks my Visual Studio has been behaving strangely. Launching a simple console application in debug mode would take about 5 minutes for it to come up. Same thing happened when launching other projects in the solution in debug mode.
Today I cleaned up my Visual Studio configuration, rebooted my PC and the debugger launches instantly as expected. In case any of you are experiencing a similar issue, you can clean your visual studio by performing the following:
Tools -> Import and Export Settings…
Select “Reset all settings”, and click next.
Select “No, just reset settings”, and click next.
Choose your default collection of settings (Visual C# Development Settings)
Click Finish.
Today I cleaned up my Visual Studio configuration, rebooted my PC and the debugger launches instantly as expected. In case any of you are experiencing a similar issue, you can clean your visual studio by performing the following:
Tools -> Import and Export Settings…
Select “Reset all settings”, and click next.
Select “No, just reset settings”, and click next.
Choose your default collection of settings (Visual C# Development Settings)
Click Finish.
Wednesday, September 5, 2012
How to post a complex object via AJAX to an MVC Action
I needed to post an object from Javascript to an Action using Asp.Net Mvc, and realized it is not as straitghforward as I thought it would be. So, I put together a little example which can be used for reference in the future.
Monday, August 13, 2012
A sample JQuery Carousel
I recently had to display pages of commercial flyers on a Carousel, where they could be flipped over. After some research I found Chris Coyier's blog and his excellent JQuery plugin that allowed me to implement my own carousel. He baptized his JQuery plugin as Moving Boxes and you can find his introductory article here and a live running sample here.
Thursday, July 12, 2012
HRESULT: 0x80070057 (E_INVALIDARG)
Very annoying problem for a good while today. I happened to be reverting my code back to a previous version of the repository on SVN. We needed to roll back some changes, and to my surprise after going back to the previous version I wasn't able to build the solution anymore, showing me a weird error:
"Could not load file or assembly … The parameter is incorrect … HRESULT: 0x80070057 (E_INVALIDARG)".
"Could not load file or assembly … The parameter is incorrect … HRESULT: 0x80070057 (E_INVALIDARG)".
Tuesday, June 5, 2012
Delving into Android Apps Development
I always had this frustration with native mobile apps, of never having had the opportunity to develop one. Maybe it was the lack of a real chance in my company or maybe lack of free time to do it. Anyways, Last week I decided to get through with something basic for Android and publish it on the Google Play market.
Friday, May 4, 2012
How to solve Http 401 error for Http Put and Delete with WCF Rest
With the popularity of WCF Rest services, it is now a bit more common to issue HTTP PUT and HTTP DELETE requests. I don't remember using those verbs before in my career. Whenever I needed to delete something or update something, I would use HTTP POST and then handle the data in the back end. But times have changed, and with WCF Rest embracing the HTTP protocol, you are more likely to work with those two verbs more often.
Tuesday, April 3, 2012
Basics of SQL Ranking Functions
This is a subject that I didn't know much about until I had to really investigate and use a month ago. Ranking Functions, that is SQL commands to obtain results sets with a column containing some "order" or ranking related information.
Friday, March 16, 2012
Copying data between classes with Automapper
Sometimes you have similar classes in your project and you want to copy data from one instance of a class to another. In my old days I used to do that myself going field by field. That was until someone told me about Automapper.
Friday, March 9, 2012
Custom authentication for WCF REST over Https
I recently had to build a WCF REST service over HTTPS. Once built and functioning we decided to include some sort of authentication mechanism, so that the service could only be used by authorized members and not anyone on the internet, which makes perfect sense.
Saturday, March 3, 2012
First post
The goal of the blog is to share programming tricks and tools that I run into in my daily life as a developer. I will try not to talk about things you can easily find elsewhere, therefore the activity will be slow on the blog.
Looking back and reflecting about my life as a software developer, it would have really been 100 times tougher if colleagues of the profession out there hadn't shared all the knowledge they have. I think it is time for me to modestly give some of that back and help others in their journeys.
Looking back and reflecting about my life as a software developer, it would have really been 100 times tougher if colleagues of the profession out there hadn't shared all the knowledge they have. I think it is time for me to modestly give some of that back and help others in their journeys.
Subscribe to:
Posts (Atom)