Interesting links week #32 and #33
Below a list of interesting links that I found this week:
Frontend:
- Websites Shouldn’t Look The Same Across Different Browsers…Here Is Why
- Be Cool and Write Your Own jQuery Selectors
- 5 Reasons & Resources for Validating Your HTML
- What is a Supercookie?
Development:
- Web.Config / App.config transform Visual Studio Add in
- C#/.NET Little Wonders: The ReferenceEquals() method
Mobile:
Marketing:
Interested in more interesting links follow me at twitter http://twitter.com/erwingriekspoor
Interesting links week #30 and #31
Below a list of interesting links that I found this week:
Interaction:
Frontend:
- Techniques, Strategies and Patterns for Structuring JavaScript Code
- Techniques, Strategies and Patterns for Structuring JavaScript Code–The Prototype Pattern
- Techniques, Strategies and Patterns for Structuring JavaScript Code–Revealing Module Pattern
- Techniques, Strategies and Patterns for Structuring JavaScript Code–Revealing Prototype Pattern
- Cross-Browser CSS in Seconds with Prefixr
Development:
- C#/.NET Little Pitfalls: Default Parameters are Compile-Time Substitutions
- Build truly RESTful API and website using same ASP.NET MVC code
- OWASP Top 10 for .NET developers part 8: Failure to Restrict URL Access
Mobile:
Marketing:
Interested in more interesting links follow me at twitter http://twitter.com/erwingriekspoor
Interesting links week #28 and #29
Below a list of interesting links that I found this week:
Frontend:
- CSS Attribute Selectors: How and Why You Should Be Using Them
- Learning To Use The :before And :after Pseudo-Elements In CSS
- 10 JavaScript Shorthand Coding Techniques
Development:
- C#/.NET Little Pitfalls: Nullable Math Doesn’t Always Add Up
- C#/.NET Little Pitfalls: The Default is to Hide, Not Override
- Essential Best Practices And Guidelines That Every Web Developer Should Know About
Mobile:
Marketing:
- Complete Guide to Facebook Fan Pages
- Optimise your website for Facebook
- 8 Things Newbie Web Designers Should Know About SEO
Interested in more interesting links follow me at twitter http://twitter.com/erwingriekspoor
Interesting links week #26 and #27
Below a list of interesting links that I found this week:
Frontend:
Development:
- C#/.NET Little Wonders: The Nullable static class
- C#/.NET Little Pitfalls: Operators are Overloaded, not Overridden
- Easy Version Control with Git
- Nobody Understands REST or HTTP
Mobile:
- Preview Websites In Multiple Mobile Devices With Mobilizer
- Picking A Mobile Support Strategy For Your Website
Marketing:
Interested in more interesting links follow me at twitter http://twitter.com/erwingriekspoor
Nifty .NET Part #4: Enumerable.Any
In part 4 of the Nifty .Net series we have the Enumerable.Any method. The Any method is part of the .NET 3.5 LINQ framework, so it’s only available in .NET 3.5 and upwards. The Any method determines whether a sequence contains any elements.
The method definition:
public static bool Any(this IEnumerable source)
As you can see the the Any method is an extension method on IEnumerable, so you can use the Any method on al classes that implements IEnumerable, like List, string[].
For example:
using System;
using System.Linq;
public class MyClass
{
public static void Main()
{
string[] foo = { "a", "b", "c" };
if(foo.Any())
{
Console.WriteLine("Contains any elements");
} Console.ReadLine();
}
}
In this code snippet we determines if the foo array has any elements. To use the Any method we have to add the System.Linq namespace as “using” to our class.
Some of the great advantages of the Any method is that it will stop the enumeration of source as soon as the result can be determined.
Beware don’t use the method .Count() like the following code snippet:
using System;
using System.Linq;
public class MyClass
{
public static void Main()
{
string[] foo = { "a", "b", "c" };
if(foo.Count() > 0)
{
Console.WriteLine("Contains any elements");
}
Console.ReadLine();
}
}
The above code snippet uses a lot more resources to determine if a sequence contains any elements, because it have to enumerate through all elements of the collection to get the count. The Any method, as I said earlier, stops as soon as he found an element in the collection.
The Any method has also an overload:
public static bool Any(this IEnumerable source, Func<bool> predicate)
With this overload you can check if there are any elements in collection that matches the predicate. A code example will look like this:
using System;
using System.Linq;
public class MyClass
{
public static void Main()
{
string[] foo = { "a", "b", "c" };
if(foo.Any(s => s == "a"))
{
Console.WriteLine("Contains any elements");
}
Console.ReadLine();
}
}
This code example will look for any elements that matches with “a”, and again it will stops if as soon as the result can be determined.
In some cases you can beter use “.length > 0”, this property has a better performance compared to the Any method:
using System;
public class MyClass
{
public static void Main()
{
string[] foo = { "a", "b", "c" };
if(foo.Length > 0)
{
Console.WriteLine("Contains any elements");
}
Console.ReadLine();
}
}
The snippet above is faster because the length property is updated when an item is added or deleted from the list, so it doesn’t have to enumerate through the list.
You can find more info and examples on the MSDN pages:
Interesting links week #24 and #25
Below a list of interesting links that I found this week:
Interaction:
Frontend:
Development:
- OWASP Top 10 for .NET developers part 7: Insecure Cryptographic Storage
- C#/.NET Fundamentals: Choosing the Right Collection Class
Mobile:
Marketing:
Other:
Interested in more interesting links follow me at twitter http://twitter.com/erwingriekspoor
Interesting links week #22 and #23
Below a list of interesting links that I found this week:
Frontend:
Development:
- Top 10 Git Tutorials for Beginners
- C#/.NET Little Wonders: Empty(), DefaultIfEmpty(), and Count()
- Public APIs availability
- OWASP Top 10 for .NET developers part 7: Insecure Cryptographic Storage
Mobile:
Marketing:
Interested in more interesting links follow me at twitter http://twitter.com/erwingriekspoor
Nifty .NET Part #3: String.PadLeft
And there is part 3, String.PadLeft, this method will add a specified character to the left side of string till the specified length is met.
The method definition:
public string PadLeft(int totalWidth, char paddingChar)
So what can you to with the PadLeft method in practice? The following code sample will add leading zero’s only when it’s needed:
1: using System;
2:
3: public class MyClass
4: {
5: public static void Main()
6: {
7: // Displays: 001
8: Console.WriteLine("1".PadLeft(3, '0'));
9:
10: // Displays: 010
11: Console.WriteLine("10".PadLeft(3, '0'));
12:
13: // Displays: 100
14: Console.WriteLine("100".PadLeft(3, '0'));
15:
16: Console.ReadLine();
17: }
18: }
As you can see if the string length is already equal to the total width of the PadLeft the zero isn’t added.
There is also an overload of the PadLeft method, this method will add spaces till the total width is met.
public string PadLeft(int totalWidth)
As you probably expected there is also a PadRight method, this will do the opposite of the PadLeft method.
You can find more info and examples on the MSDN pages:
Interesting links week #21
Below a list of interesting links that I found this week:
Frontend:
- A jQuery Plugin Development Pattern
- 30 Tips To Improve Javascript Performance
- About Obsolete Features in HTML5
- How Important Is Semantic HTML?
- Ten Oddities And Secrets About JavaScript
Development:
- Speed up Visual Studio Builds
- NuGet for the Enterprise: NuGet in a Continuous Integration Automated Build System
Mobile:
Marketing:
Interested in more interesting links follow me at twitter http://twitter.com/erwingriekspoor
Interesting links week #19 and #20
Below a list of interesting links that I found this week:
Frontend:
Development:
Mobile:
- The State of (Mobile) Web Development 2011
- Building Mobile Web Apps the Right Way: Tips and Techniques
- How To Create a Mobile-Ready Site
Other:
Interested in more interesting links follow me at twitter http://twitter.com/erwingriekspoor