Subscribe: ExtremeDev: Development Solutions
http://extremedev.blogspot.com/feeds/posts/default?redirect=false
Preview: ExtremeDev: Development Solutions

ExtremeDev: Development Solutions



Javascript, JQuery, CSS, HTML, ASP.NET, XML, XSLT, C#, SQL and others: Tips, Code Snippets & How To's. Plus Consulting Services in Programming. Hacks & Solutions.



Updated: 2017-12-11T05:11:24.322+02:00

 



Skype is not working as from 20 June 2017

2017-06-20T10:30:12.409+03:00

It looks like microsoft did it again - another update and skype is not working properly again. What is with this guys? aren't they testing their software? Some simple unit tests would avoid such things once and forever.
BTW - updating windows - does not help as well, it looks like we will have to stay without skype a few days.

Microsoft, since you bought skype - you made it worse.

I could help with reorganizing the work in Skype department :)



X-Frame-Options & SAMEORIGIN

2014-11-19T16:52:57.291+02:00

Refused to display 'http://extremedev.example.com' in a frame because it is set 'X-Frame-Options' to 'SAMEORIGIN'

This is an error that can appear when you want to display a site through an iframe of another site. It will not allow for the site within the iframe to be displayed.

So what to do in this case?

There are several articles on the internet that are suggesting that you need to add some headers that will allow the display of the site through the iframe from different domains. For example: https://developer.mozilla.org/en-US/docs/Web/HTTP/X-Frame-Options

........ »



Generic Method for wrapping around any code

2014-12-23T08:13:18.578+02:00

Hey all,,
We often need to run something before some code logic and after it was executed.

As a simple example we can take the try-catch block, everybody has this in their application and is using it more then two times for sure.

What we can do in this case is to write a generic method that will allow to run our code inside a try-catch statement. This method will look like this:


Code:
public static void TryDo(Action action, ILogger logger, string messageDescription)
{
try
{
action();
}
catch (Exception)
{
// Do some logging stuff here
}
}

........ »



IE 11 first impressions

2014-01-05T23:10:41.481+02:00

Hi all,

Several weeks ago I tried saw an update in my windows 7, it was Internet Explorer 11. I said, great, maybe this version of IE will be a good one, but unfortunately it wasn't it.

The first problems that I have encountered, even before opening IE 11 was when I tried to install it. I selected it to be installed as an update, it required other updates also, so I waited for it to download, and finally Windows says: "You need to restart windows for changes to apply". WHAAT?

Why when installing a browser I need to restart windows? Microsoft -> that is not good, not good at all.

But wait, that's not all, after I agreed with the restart, it was restarting around 15 times, with a message failure to install updates. Then finally after one hour, yes this is truth ONE hour, my desktop appeared, however unfortunately I could not start any application, I couldn't even go to control panel through the start menu.

In order to make my computer work again, I had to go to control panel through explorer, and uninstall, manually all the updates installed on that day - that was a very very long process. And guess what windows says to me after each update uninstall: "You need to restart....", Ough noooo, again???
After doing that my windows was ok again, but without IE 11, I tried above procedure several times, because I wanted to see IE 11 but it looks like it was not possible to do that on that computer, so I tried on another.

First impression about IE 11 was that there is not big difference, but then I opened Developers Tools, I was impressed, but then after starting to use it I was getting disappointed, more and more.

It was really really buggy.

The thing is that I am a developer that is working with sites that are updating HTML content a lot of times per second, which as you understand requires good rendering capabilities from browser, but also requires a good Developer Tools that can handle these changes in HTML source.

Well IE 11 Developer Tools is not good enough to handle this, so it crashed, and even after I closed Dev Tools and reopened it did not start again, so I had to close and reopen the entire browser again.

For me it was impossible to work with this browser + it was sometimes failing even on sites that are not updating the content so many times.

However there is something that I like and that is that Microsoft has finally decided to include automatic updates in this browser, which in my opinion they had to do a long time ago.

So guys, how do you like the new IE 11?

Regards,
Roman



IE9 and console.log problems

2013-05-17T15:20:17.437+03:00

Hello everyone,

I have found that Internet Explorer 9 has some problems when you want to use console.log in your sites.
If you have for example:

Code:
console.log('www.extremedev.blogspot.com');

then in IE9 without the Developer Tools open it will throw an exception (but you will not be able to see it because the Developer tools is not opened).
This happens because IE does not find the console object.

There is a small fix for this - you have to
........ »



Visual Studio 2012

2012-12-06T19:32:15.853+02:00

Hello,

Well, as everybody know Microsoft Visual Studio is an integrated development environment (IDE) from Microsoft.

I've started from using the Visual Studio 2003, this was many years ago and at that time it seemed amazing. But the technologies are developing very fast and we have to keep the pace together with it, by at least having the latest IDE.

At a first look at any new IDE it is hard to use it, and as I noticed - especially for Senior Developers with more than 5 years of experience. They seem very hard to be convince to use a new technology, application and IDE.
........ »



HTML5: audio tag

2012-11-13T19:21:55.150+02:00

Hello everybody,

We will discuss about the audio tag in this post.
This tag is available in HTML 5.
You can play an audio file right in browser, and you can do that without using flash.

A note that I did not find anywhere is that not all browsers support mp3 files and not all browsers support wav files. This is why you need to have both mp3 and wav files.

So a cross browser solution - that will work on IE, Chrome, Firefox and Safari will be something like this:

........ »



Orchard: Change Page Title

2012-11-13T18:48:25.634+02:00

Hello,

Here is how make so that you have a custom title for a custom page (View).

Open the View (.cshtml) file that you want with a custom title and add this code at the top of the file:

Code:
@{
Layout.Title = T("Custom Title | EXTREMEDEV").Text;
}



Orchard: Change favicon

2012-10-29T21:51:57.115+02:00

Hello,

As you all probably know Orchard is a free, open source, community-focused project aimed at delivering applications and reusable components on the ASP.NET MVC platform.

So, now about the favicon, to change the default Orchard's favicon you need either to install the Favicon module, which I think is too complicated for this case, or to override the location of the favicon by overriding the default Document.cshtml template - just copy/paste to your theme.

You will find something like below in Document.cshtml:

Code:
RegisterLink(new LinkEntry {Type = "image/x-icon", Rel = "shortcut icon", Href = Url.Content("~/.../FavIcon.ico")});

Change the path of the href attribute to where your favicon is, and here it is you have your own favicon.

Happy coding!!!



SSIS on SQL Server 2008 R2

2012-05-21T23:19:23.305+03:00

Hi all,

These days I had a chance to take a look at SQL Server Integration Service 2008 R2 (SSIS) and do you know what? it is a really good thing when you need to Extract, Transform and Load (ETL) data from a DataBase to another.

However, unfortunately it is very buggy and is still like something that is not fully implemented, like not all the functionality was implemented till the end.
What I've found during several days of investigations on SSIS is:
1) it is very hard to maintain;

........ »



Remove Skype haha foto virus / worm

2012-03-07T14:59:03.139+02:00

Hello,

Remember my post about Skype haha foto http://goo.gl/...?Facebook.com-IMG....JPG

After several days, I have found on the internet how to remove this worm.  Read below:

Try locate in processlist file called mdm.exe, and kill the process, Then download any startup program management utilities - for example Nirsoft Startup.cpl and look for "Windows Firevall engine" that references the "c:/windows/mdm.exe". Delete or disable those in startup and delete the file itself under c:/windows/mdm.exe



YouTube Service sent you a message: Your video has been approved

2012-03-11T17:13:49.097+02:00

Hello,

Here is an interesting email that is being sent to many people.



From: YouTube Service
To: someEmail@someDomain.com
Sent: Wednesday, March 7, 2012 11:56 AM
Subject: YouTube Service sent you a message: Your video has been approved

........ »



Transaction count after EXECUTE indicates that a COMMIT or ROLLBACK TRAN is missing. Previous count = %ld, Current count = %ld

2012-02-17T16:13:59.721+02:00

Such an error has appeared these days to me in SQL using SPROC in another SPROC where these are using transactions:


Msg 266, Level 16, State 2, Procedure SPROC_NAME2, Line 0
Transaction count after EXECUTE indicates that a COMMIT or ROLLBACK TRANSACTION statement is missing. Previous count = 1, current count = 2.

So what is that???
I will explain.

........ »



Carousel with variable item-sizes

2012-02-13T15:55:57.165+02:00

Carousel with variable item-sizes


I have implemented a Javascript / jQuery + CSS Carousel which is auto-scroll-able, but also has the possibility to manually scroll the items.

The biggest advantage of this carousel is that you can have items of different size and the carousel is not changing its size.

Here is the how you define the items that will be displayed in the Carousel:

Code:
  • <a href="#"><img src="./img/item5.png">a>

  • <a href="#"><img src="./img/item3.png">a>

  • To configure the speed of scrolling when auto-scrolling you need to amend this line of code:

    ........ »



    Skype haha foto http://goo.gl/...?Facebook.com-IMG....JPG

    2012-03-07T22:51:02.154+02:00

    Many of my friends have sent me some "photos". Something like: haha foto http://goo.gl/...?Facebook.com-IMG....JPG

    All these messages were sent through skype groups.
    This of course is something like virus.

    Because when you click on that link it is being opened in browser and there is no photo in it, however it looks like it is installing something on your computer and from now and on you are also sending group messages through skype :) with the message: haha foto http://goo.gl/...?Facebook.com-IMG....JPG

    I very much believe that it's purpose is not only to send that link, but it should also do something in the background, I still don't know what, maybe some key logging of your credentials to email/skype/facebook and others.

    ........ »



    How to check your site speed and performance

    2012-02-03T15:41:15.137+02:00

    Hi all,

    In this post I will give a short list of sites and tips that will help you to improve your site's speed and performance.

    First a list of sites:
    1) Google's Page Speed OnlinePage Speed Online analyzes the content of a web page, then generates suggestions to make that page faster. Reducing page load times can reduce bounce rates and increase conversion rates; Note: you can also find a Google Chrome Extension for this tool, here on this page.
    ........ »



    SQL: Concatinate Rows into a string without using variables

    2012-01-23T18:09:18.359+02:00

    Hi All,

    Here is a small SQL script which allows you to concatenate the values from all rows into a single row/value.


    SELECT T.value + ',' AS [text()]

    FROM myTable T
    FOR XML PATH ('')

    ........ »



    Override jQuery.val() and jQuery.val(value)

    2012-01-23T16:02:25.288+02:00

    Hi all,

    Sometimes there are cases when you need to do something when $.val() and $.val(value) from jQuery is called,  but then you still want the default behavior to be kept. Here is an example of how you could do that:

    Code:
    var originalVal = this.originalVal = $.fn.val;
    $.fn.val = function(value) {
    if (typeof value == 'undefined') {
    alert('Getting the value');
    return originalVal.call(this);
    }
    else {
    alert('Setting the value');

    return originalVal.call(this, value);
    }
    };


    I for example have used it for a jQuery widget, I wanted to override the default behavior of the val()  function when this is performed on the element for which a widget was used. So what I have done is I have added a custom attribute to the element for which I am using the widget and then in the val() I am checking the presence of that attribute - just like below:

    ........ »



    SQL: Rename Column/Table Name

    2012-01-11T12:35:48.765+02:00

    Hi All,

    We all sometimes need to rename a column/table from our database, however we do not want to drop all our records from the table where the column is renamed or the name of that table is changed.

    For that there is such a nice SPROC in MS SQL: sp_rename.

    This SPROC can be used to rename any user-created object in current DB.

    However there is also a caution:

    ........ »



    What's New in ASP.NET 4.5 and Visual Web Developer 11 Developer Preview

    2012-01-10T08:59:12.848+02:00

    What's New in ASP.NET 4.5 and Visual Web Developer 11 Developer Preview

    This document lists features and enhancements that are being introduced in ASP.NET 4.5. It also lists improvements being made for web development in Visual Studio (Visual Web Developer).

    ........ »



    SQL Performance Tips 5

    2012-01-05T15:02:48.863+02:00

    Hello,

    Another SQL Performance tip, which will help you to determine the exact execution time of your sql statements. The simplest way of doing that is to save the time before running your statement and then compare that value with current time. Here is a sample SQL statement:
    ........ »



    ANTS Memory Profiler 7.1 without license

    2012-02-09T16:53:20.985+02:00

    Hi All,

    The trial period of 14 days of your ANTS Memory Profiler has passed.

    You are now searching for a license for ANTS Memory Profiler?
    Or are you searching for a crack for ANTS Memory Profiler?
    Or are you searching for a keygen for ANTS Memory Profiler?

    No need to do that anymore because there is an easy way to use it without having a license, crack or keygen (Note: the version that I am using is 7.1).

    So what to do?

    ........ »



    SQL Performance Tips 4

    2011-11-24T10:22:32.138+02:00

    Hi All,

    Again me with some more SQL Performance Tips.

    If you have a lot of tables with which you have to join and those tables are big then pay attention to the order of how you join those tables because the order matters.

    Why the order of the tables in joins matters?

    It is because even if the result of your query returns only a few of records, lets say 7 records, it doesn't mean that it will run fast, and it will not run fast because during the first joins your tables can "return" thousands, millions or even more records with which the SQL Server will be working further.

    So the idea is that you have to use the Actual Execution Plan to see what is Estimated Number of Rows with which the SQL Server will be working with.

    Try to filter the data using the joins, so that less data remains to be processed, and less time it takes to the SQL Server to return the result to you.

    Good luck,
    Roman



    SQL Performance Tips 3

    2011-11-24T10:20:56.641+02:00

    Hi All,

    Me again with another SQL Performance tip.

    Another way to optimize a query is using the Actual Execution Plan.

    Well, first of all by using it you will see what indexes are missing, what table or join is causing the performance issue, which join is returning a lot of rows and many more.

    It worth learning how to use the Actual Execution Plan.

    Now about indexes, you must keep in mind that not all indexes that are suggested to be created by Actual Execution Plan are good to be created, and this is for several reasons:

    ........ »



    SQL Performance Tips 2

    2011-11-24T10:21:02.581+02:00

    Hi All,

    Here are some more tips on SQL Performance.

    SET NOCOUNT
    So what is it useful for?
    First of all what is it doing: Stops the message indicating the number of rows affected by a Transact-SQL statement from being returned as part of the results.

    Which means that when you do not need the number of rows affected to be returned from the SPROC then write that at the beginning of the SPROC. Why? because it will reduce the traffic and the execution time of your SPROC.

    ........ »