Friday, December 14, 2012

Stealth Settings for Skype


For a very long time, I have been dying to see the Invisible Mode applied selectively.

There are many times, or perhaps daily, when I want to be Invisible only to certain Contacts, or just one Contact, but not to everyone else.

This feature is available in various Instant Messengers, such as the Stealth Settings (for individual Contacts) in the Yahoo Messenger.

But there is no such setting in Skype as of now. There is a workaround however.

I simply block the contacts when I don't want to talk to them, then just unblock them when I want to.  If you block a contact, you will appear as offline to them regardless of the status you selected.  They will also receive no notification or warnings when you block or unblock them.

Wednesday, December 5, 2012

What does Operation is not valid due to current state of the object exception mean?


Error message

System.InvalidOperationException: Operation is not valid due to the current state of the object.

Stack trace

[InvalidOperationException: Operation is not valid due to the current state of the object.]
at System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded()
at System.Web.HttpValueCollection.FillFromEncodedBytes(Byte[] bytes, Encoding\ encoding)
at System.Web.HttpRequest.FillInFormCollection()

[HttpException: The URL-encoded form data is not valid.]
at System.Web.HttpRequest.FillInFormCollection()
at System.Web.HttpRequest.get_Form()
at System.Web.HttpRequest.get_HasForm()
at System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull)
at System.Web.UI.Page.DeterminePostBackMode()
at System.Web.UI.Adapters.PageAdapter.DeterminePostBackMode()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,\ Boolean includeStagesAfterAsyncPoint)

Cause:
  • Microsoft’s Security update MS11-100 released on December 28, 2011, limits the max no. of form keys, files and JSON members to 1000 in an HTTP request. 
  • ASP.NET rejects requests that have more than 1000 of these elements and the user sees an error in the browser.
  • In the older version of ASP.NET( i.e prior to this update) HTTPValueCollectionClass did not have the ThrowIfMaxHttpCollectionKeysExceeded method. This method was introduced in the class after this update. So if the request contains more than 1000(default value) elements, we see this exception.
Solution: 
Increase the value of key aspnet:MaxHttpCollectionKeys to a higher number for example 1500.


Side-effect
The amount we specify has an impact on upload speed of our content, which will be proportionally slower. Therefore, it’s better to set the value, that should be enough for the exception to not occur.

Saturday, November 24, 2012

How To Use a previously Used theme again in Google Chrome


You might have faced this situation. You had a theme in Google Chrome. You changed it. You did not like the second one and wanted the first one again. But you can’t find how to do it. There is no theme manager in chrome yet. There is no way to manage themes like you would apps that you have downloaded. Once you click on "Choose Theme" it will download the crx and then overwrite whatever theme you had previously installed.

By going to Settings you will see a section called Appearance, however the only revert option is to revert to default.
One way of keeping, managing, and sharing the themes you choose is to go to the themes page and share the theme you are installing with either your Gmail or Google+. This will at least provide a way to track which themes you like, and it will keep all of the links to the themes in 1 place. Here are the steps to share with a blank circle to keep it private.

  • Go to Settings > Appearance
  • Select "Get Themes"
  • Find one you want and hover over the card. Next to the "Choose Theme" button, select the "Share" button
  • Share the theme with Google+ or send it to someone on gmail.
  • Choose to share the theme with a Circle that only you are a member of, that way all the posts will be visible only by you or if you are sending an email send it to yourself

Now when you visit Google+ (or Gmail if you choose to share via email) you will have a list of all the themes you've tried or want to try in the future.

Thursday, November 22, 2012

How to Code HTML Email Newsletters


Google Mail, Lotus Notes, and Outlook 2007 present their own unique coding challenges. Outlook 2007, believe it or not, has significantly less support for CSS than previous versions of Outlook!
Google Mail’s lack of support is a little more forgiveable — because the application runs in a browser, it cannot control the contents of the emails it displays. Consequently, Google’s engineers have had to take steps to ensure that their application displays properly regardless of the quality of the HTML or CSS in which emails are written.
As a result, Google Mail is a new web mail service that acts like an artifact of the early 1990s, when web standards were primitive. It takes some work, but it is possible to crack open a Google Mail page and see just how convoluted the services approach to rendering HTML email actually is.
For one thing, Google Mail deletes the CSS styles contained between any style tags, no matter where they appear in the email. And fonts displayed within HTML tables — the only alternative to using styles — have the odd habit of appearing larger than intended, no matter how the HTML email is structured.
The good news, however, is that if you code to account for the oddities of these email three applications, your HTML email code is more likely to display well in most, if not all, email clients. Here are some techniques that appear to work well in Google Mail and other older email software:
  • Define the background color in a td cell with the bgcolor attribute, not the CSS style.
  • As noted above, use the background attribute in the td cell for background images instead of using CSS. One side-effect of this approach is that the background image can be made as tall as needed — if the content used in your email template is likely to vary in size, using an extra-tall background image in this way allows the height of the email shrink or expand, depending on the height of the copy, from one email to the next. Remember, though, that Outlook 2007 ignores background images completely.
  • If it works better, use the padding declaration to control margins within a td cell. The margin style does not work in these cells, but padding does.
  • If you need a border around a td cell, keep in mind that Google Mail displays a border around a td cell when it’s defined in a div, but not when it’s defined as a border style in a td tag.
  • If you need a light-colored link against a dark background color, put the font definition in the td cell (so it applies to p and a tags equally) then add a color: style to the a tag.
  • If the p and a fonts appear to be different sizes, wrap the a tag in a p tag.
  • Google Mail aggressively uses the right-hand column of the Google Mail user interface, which squeezes the HTML email into the center panel. Be sure the padding style in the content tds is set to 10 pixels all round, so that text does not hit against the left and right edges.
  • When testing an HTML email with a Google Mail account, it’s likely that you’ll find that one or more font styles are missing in the tdh1h2pa, and other tags. Inspect every font carefully to make sure Google Mail displays the fonts correctly.
Besides Google Mail, there’s another, less obvious hazard a programmer faces when creating HTML email: Lotus Notes. Many large corporations continue to support and upgrade their Notes installations (as of 2004, IBM reported that 95 million people used Notes).
Unfortunately, it’s impossible to tell which companies use Notes. The best approach is to follow the guidelines described in this article — the more primitive the code, the more likely it will work well, if not perfectly, with Notes.
That said, it’s quite possible that Notes will introduce to your HTML email quirks that are almost beyond belief. For example, the software can convert images to their proprietary formats, or simply ignore flawless basic HTML in one email, but display other HTML fine in another email.
A trial version of Lotus Notes is available for download if you need to test your mail in Notes — see the resource list at the end of the article. Here are a few tips that will help you convince Notes to display your HTML email properly:
  • As we discussed previously, use a container table that contains all the internal layout tables (for example, for the header, content, and footer). This keeps the email together in one chunk of HTML, so pieces of the layout are less likely to wander when displayed in Notes.
  • Create a gutter around the container table by setting the width to a percentage and/or using a cellpadding of at least 5.
  • As I mentioned earlier, avoid using a style declaration in your email’s head tag. It might be the approach that adheres to web standards, but Notes (like Google Mail) might delete your styles. Rely, instead, on inline styles within the tabletdh1h2pa, and other tags.
  • Use absolute URLs to images stored on a web server. You can’t do much about Notes converting images, but using remote images might help.
  • Intra-email links, using named anchors, rarely (if ever) work in Notes. It’s simply best to avoid links that jump down the email to a specific piece of content.
  • Avoid colspans in your HTML tables. Notes — especially its earlier versions — can deal only with basic table layouts.
  • Be sure that your td cell widths are accurate. Unlike web browsers, which automatically set all cells to the widest-defined width, Notes sizes each td cell based on its defined width.
  • Centering an email layout usually won’t work in Notes. Email layouts generally have to be left-aligned.
Using these techniques to achieve a successful render in Google Mail and Lotus Notes will ensure that your emails also display fine in Outlook 2007, which uses an older HTML rendering engine. Microsoft has published details about what their email software will and won’t display properly; more details can be found in the Resources section at the end of this article).
The Email Standards Project has additional details on CSS support in Outlook 2007, and Microsoft is one of the companies at which their lobbying efforts are targeted.
SUMMARY
Many people who receive email prefer HTML over text for a number of reasons. For programmers, though, the task of creating an HTML email that will display consistently appears both simple and horribly complex. This article has described many of the issues and strategies for creating markup that will work across email software.
What’s the best idea to take away from this article? If there’s a choice to be made between a simple email design and a more complex solution, simplicity is always the safest bet.

How to enable Chrome's Do Not Track option



Google has added a new feature to Chrome: Do Not Track.
Step 1: Click on the drop-down menu in the top right-hand corner of the toolbar and choose Settings.

Step 2: At the bottom of the page that loads, click on Show advanced settings. 

Step 3: Step 3: Under the Privacy heading, check the box next to Send a "Do Not Track" request with your browsing traffic.





As a substitute, You could also try using Incognito mode.

Thursday, August 30, 2012

ASP.NET 4.0 potentially dangerous Request.Form value was detected

Few days ago, while working on an ASP.NET 4.0 Web project, I got an issue. The issue was, when user enters unencoded HTML content into a comment text box s/he got something like the following error message:
"A potentially dangerous Request.Form value was detected from the client".


This was because .NET detected something in the entered text which looked like an HTML statement. Then I got a link Request Validation, that is a feature put in place to protect your application cross site scripting attack and followed accordingly.

To disable request validation, I added the following to the existing "page" directive in that .aspx file.

ValidateRequest="false"


But still I got the same error.

Later I found, for .NET 4, we need to add requestValidationMode="2.0" to the httpRuntime configuration section of the web.config file like the following:

<httpRuntime requestValidationMode="2.0"/>


But if there is no httpRuntime section in the web.config file, then this goes inside the <system.web> section.

If anyone wants to turn off request validation for globally user, the following line in the web.config file within <system.web> section:

<pages validateRequest="false" /> 


Wednesday, August 29, 2012

How to fix LINQ Error: Sequence contains no elements


I’ve read some posts regarding this error when using the First() or Single() command.   They suggest using FirstOrDefault() or SingleorDefault() instead.

But I recently encountered it when using a Sum() command in conjunction with a Where():

var effectiveFloor = policies.Where(p => p.PricingStrategy == PricingStrategy.EstablishFloor).Max(p => p.Amount);


When the Where() function eliminated all the items in the policies collection, the Sum() command threw the “Sequence contains no elements” exception.



Inserting the DefaultIfEmpty() command between the Where() and Sum(), prevents this error:

var effectiveFloor = policies.Where(p => p.PricingStrategy ==PricingStrategy.EstablishFloor).DefaultIfEmpty().Max(p => p.Amount);

but now throws a Null Reference exception!


The Fix:
Using a combination of DefaultIfEmpty() and a null check in the Sum() command solves this problem entirely:
var effectiveFloor = policies.Where(p => p.PricingStrategy ==PricingStrategy.EstablishFloor).DefaultIfEmpty().Max(p =>  p==null?0 :p.Amount);


LINQ: Sequence contains no elements. Extension methods to the rescue.


When you start playing with LINQ queries over sequences of elements (e.g. getting min / max value for enumerable source) sooner or later you will come across this one -- the InvalidOperationException (“Sequence contains no elements”).
The problem occurs as by default queries like IEnumerable<T>.Min(…) andIEnumerable<T>.Max(…) do not play nicely if you try to execute them on an empty sequence and just throw the exception described above. Unfortunately these methods do not have a corresponding counterpart like Single(…) / SingleOrDefault(…) that is smart enough to query the sequence if it is not empty or alternatively use the default value without raising an exception.
Basically you got two options now:
  • Either perform the check on the enumerable sequence every time you are querying it
  • OR integrate the logic in an extension method.
The second approach is much preferable so let’s add the missing link below:
namespace ExtensionMethods {
    
using System;
    
using System.Collections.Generic;
    
using System.Linq;

    
public static class IEnumerableExtensions
    
{
        
/// <summary>         /// Invokes a transform function on each element of a sequence and returns the minimum Double value          /// if the sequence is not empty; otherwise returns the specified default value.          /// </summary>         /// <typeparam name="TSource">The type of the elements of source.</typeparam>         /// <param name="source">A sequence of values to determine the minimum value of.</param>         /// <param name="selector">A transform function to apply to each element.</param>         /// <param name="defaultValue">The default value.</param>         /// <returns>The minimum value in the sequence or default value if sequence is empty.</returns>         public static double MinOrDefault<TSource>(this IEnumerable<TSource> source, Func<TSource, double> selector, double defaultValue)
        
{
            
if (source.Count<TSource>() == 0)
                
return defaultValue;

            
return source.Min<TSource>(selector);
        
}

        
/// <summary>         /// Invokes a transform function on each element of a sequence and returns the maximum Double value          /// if the sequence is not empty; otherwise returns the specified default value.          /// </summary>         /// <typeparam name="TSource">The type of the elements of source.</typeparam>         /// <param name="source">A sequence of values to determine the maximum value of.</param>         /// <param name="selector">A transform function to apply to each element.</param>         /// <param name="defaultValue">The default value.</param>         /// <returns>The maximum value in the sequence or default value if sequence is empty.</returns>         public static double MaxOrDefault<TSource>(this IEnumerable<TSource> source, Func<TSource, double> selector, double defaultValue)
        
{
            
if (source.Count<TSource>() == 0)
                
return defaultValue;

            
return source.Max<TSource>(selector);
        
}
    
} }

Now you only need to add the using ExtensionMethods; directive in your project and you are all set.

Thursday, August 2, 2012

How to Force Google Chrome to Download PDF Files



  • Click the wrench button on upper right.
  • Go to "Settings" 
  • Click on Show advanced settings...
  • Go to: Content Settings -> Plug-ins
  • Click on "Disable Individual Plug-ins...
  • Locate the Adobe Acrobat plugin (or any other PDF viewer) and 
  • Click "Disable"

Wednesday, May 16, 2012

Difference between Views & Materialized views


Difference between Views & Materialized views

Materialized views are disk based and update periodically base upon the query definition.

Views are virtual only and run the query definition each time they are accessed.

Views evaluate the data in the tables underlying the view definition at the time the view is queried. It is a logical view of your tables, with no data stored anywhere else. The upside of a view is that it will always return the latest data to you. The downside of a view is that its performance depends on how good a select statement the view is based on. If the select statement used by the view joins many tables, or uses joins based on non-indexed columns, the view could perform poorly.

Materialized views are similar to regular views, in that they are a logical view of your data (based on a select statement), however, the underlying query resultset has been saved to a table. The upside of this is that when you query a materialized view, you are querying a table, which may also be indexed. In addition, because all the joins have been resolved at materialized view refresh time, you pay the price of the join once (or as often as you refresh your materialized view), rather than each time you select from the materialized view. In addition, with query rewrite enabled, Oracle can optimize a query that selects from the source of your materialized view in such a way that it instead reads from your materialized view. In situations where you create materialized views as forms of aggregate tables, or as copies of frequently executed queries, this can greatly speed up the response time of your end user application. The downside though is that the data you get back from the materialized view is only as up to date as the last time the materialized view has been refreshed.

Materialized views can be set to refresh manually, on a set schedule, or based on the database detecting a change in data from one of the underlying tables. Materialized views can be incrementally updated by combining them with materialized view logs, which act as change data capture sources on the underlying tables.

Materialized views are most often used in data warehousing / business intelligence applications where querying large fact tables with thousands of millions of rows would result in query response times that resulted in an unusable application.

Tuesday, May 8, 2012

Introduction to Business Intelligence


What is business intelligence?
The term Business Intelligence – often referred to simply as BI – was originally coined by Gartner Group who in 1996 wrote:
By 2000, Information Democracy will emerge in forward-thinking enterprises, with Business Intelligence information and applications available broadly to employees, consultants, customers, suppliers, and the public. The key to thriving in a competitive marketplace is staying ahead of the competition. Making sound business decisions based on accurate and current information takes more than intuition. Data analysis, reporting, and query tools can help business users wade through a sea of data to synthesize valuable information from it - today these tools collectively fall into a category called "Business Intelligence."
In other words, Business Intelligence (BI) is a terminology representing a collection of processes, tools and technologies helpful in achieving more profit by considerably improving the productivity, sales and service of an enterprise. With the help of BI methods, the corporate data can be organized, analyzed in a better way and then converted into a useful knowledge of information needed to initiate a profitable business action. Thus it’s about turning a raw, collected data into intelligent information by analyzing and re-arranging the data according to the relationships between the data items by knowing what data to collect and manage and in what context.

A company's collected raw data is an important asset where one can find solutions to many of an organization’s critical questions like 'what was the net profit for a particular product last year and what will be sales this year and what are the key factors to be focused this year in order to increase the sales?'. So there arises a necessity of a well planned BI system which can lead to a greater profitability by reducing the operating costs, increasing the sales and thereby improving the customer satisfaction for an enterprise.

With the help of a Business Intelligence System, a company may improve its business or rule over its competitors by exploring and exploiting its data to know the customer preferences, nature of customers, supply chains, geographical influences, pricings and how to increase its overall business efficiency.

Why is business intelligence needed?
BI is about analyzing an organization’s performance in order to improve its income and competitiveness. Thus, in a sense BI is something organizations have always been involved with BI on some level. With today’s modern IT systems however, organizations are collecting ever increasing volumes of data and it is no longer possible to analyze such data without specialized tools and methods. The data will not fit inside a person’s head.

Business Intelligence tools let users sip efficiently through huge amounts in a matter of seconds. Such impressive response times are not simply given by modern hardware and software. Special architectures and methods for building such systems are required.
Business Intelligence tools let users sip efficiently through huge amounts in a matter of seconds. Such impressive response times are not simply given by modern hardware and software. Special architectures and methods for building such systems are required.


Friday, May 4, 2012

Facebook Acquires Location-Based Service Glancee

Facebook has scooped up another startup in its path toward mobile dominance. This time, it’s Glancee, an ambient location-based service that competes with Highlight. 



From Glancee’s home page:


“We started Glancee in 2010 with the goal of bringing together the best of your physical and digital worlds. We wanted to make it easy to discover the hidden connections around you, and to meet interesting people. Since then Glancee has connected thousands of people, empowering serendipity and pioneering social discovery.


“We are therefore very excited to announce that Facebook has acquired Glancee and that we have joined the team in Menlo Park to build great products for over 900 million Facebook users. We’ve had such a blast connecting people through Glancee, and we truly thank our users for being a part of the Glancee community.”



Less than a month ago, Facebook acquired the mobile-based photo-sharing app Instagram for $1 billion, and the world’s largest social network has expressed its sights are set on mobile.


Glancee fits the bill. It was one of the hot passive location startups at SXSW this year, along with Highlight and Sonar.


Facebook’s just weeks away from an initial public offering. The company announced its shares would be priced at $28 to $35, putting the company at a valuation of $85 billion and $95 billion. Facebook did not disclose the terms of the Glancee acquisition.

Wednesday, May 2, 2012

Instagram Passes 50 Million Users

The photo-sharing app is on fire. It now has more than 50 million users — and is adding new ones at the rate of roughly 5 million per week, according to its API. 


Instagram hit 40 million users around April 13, and 30 million at the start of the month. This is astonishing growth for an app that started 2012 with just 15 million users.


Of course, the fact that the app was recently released for Android — after being iPhone-only for its first two years — is likely driving a lot of those sign-ups. But Instagram also hit number one in the iOS App store for the first time in the wake of the Facebook acquisition.


Some time ago Facebook reported that it was up to buy Instagram, a 2-year-old photo-sharing application developer, in its largest-ever acquisition just months before the social media website is expected to go public.



“For years, we’ve focused on building the best experience for sharing photos with your friends and family,” Facebook founder Mark Zuckerberg said while announcing the deal. “Now, we’ll be able to work even more closely with the Instagram team to also offer the best experiences for sharing beautiful mobile photos with people based on your interests.”


Facebook CEO called the acquisition “an important milestone for Facebook because it’s the first time we’ve ever acquired a product and company with so many users. We don’t plan on doing many more of these, if any at all.”


Seemingly, the buyout has also helped to drive interest and it probably won’t be long until the firm hits the 100 million milestone.

Tuesday, May 1, 2012

Facebook to encourage organ donation

Facebook on Tuesday unveiled an organ donor status option for Timeline, a move designed to help more than 114,000 people in the U.S. and millions more around the world who are waiting for a life-saving heart, kidney or liver transplant.


“Many of those people — an average of 18 people per day –- will die waiting, because there simply aren’t enough organ donors to meet the need,” Facebook notes in a blog entry explaining the move. “Medical experts believe that broader awareness about organ donation could go a long way toward solving this crisis.”


Designating yourself as an organ donor is easy. All you need to do is go to your Timeline, click on “Life Event” and then “Health & Wellness.” Then, you’ll see the option for “Organ Donor.” At that point, you can add when and where you registered and your personal story.


For those who aren’t organ donors, Facebook is providing a link to the appropriate registry. As with other Timeline entries, you can make your organ donor status public or private.


While the plan might initially seem strange, it's quite clever once you think about it. Whether we love or hate Facebook, the social network plays a role in many of our lives. So when an issue is promoted on the site, we won't be able to escape it. Soon you'll notice the option to add your organ donation status when you edit your Timeline, you'll see your friends adding such statuses and you'll see links encouraging you to officially register as a donor. 


Odds are, you'll idly click on something and learn a bit about organ donation. You might even decide to become a donor yourself — and then update your Facebook status, of course — which will add to the overall promotion of the issue.


Whether the awareness raised by Facebook (as well as the peer pressure it produces) will reduce the number of individuals who die while waiting for a transplant remains to be seen.