C# searching a string from a list

“Ever wonder how you use a Predicate Delegate to make the Find function work? Well I was wondering as well, so I found the following useful snippet on MSDN: http://msdn2.microsoft.com/en-us/library/x0b5b5bc.aspx

using System;
using System.Collections.Generic;

public class Example
{
public static void Main()
{
List dinosaurs = new List();

dinosaurs.Add(“Compsognathus”);
dinosaurs.Add(“Amargasaurus”);
dinosaurs.Add(“Oviraptor”);
dinosaurs.Add(“Velociraptor”);
dinosaurs.Add(“Deinonychus”);
dinosaurs.Add(“Dilophosaurus”);
dinosaurs.Add(“Gallimimus”);
dinosaurs.Add(“Triceratops”);

Console.WriteLine();
foreach(string dinosaur in dinosaurs)
{
Console.WriteLine(dinosaur);
}

Console.WriteLine(“nTrueForAll(EndsWithSaurus): {0}”,
dinosaurs.TrueForAll(EndsWithSaurus));

Console.WriteLine(“nFind(EndsWithSaurus): {0}”,
dinosaurs.Find(EndsWithSaurus));

Console.WriteLine(“nFindLast(EndsWithSaurus): {0}”,
dinosaurs.FindLast(EndsWithSaurus));

Console.WriteLine(“nFindAll(EndsWithSaurus):”);
List sublist = dinosaurs.FindAll(EndsWithSaurus);

foreach(string dinosaur in sublist)
{
Console.WriteLine(dinosaur);
}

Console.WriteLine(
“n{0} elements removed by RemoveAll(EndsWithSaurus).”,
dinosaurs.RemoveAll(EndsWithSaurus));

Console.WriteLine(“nList now contains:”);
foreach(string dinosaur in dinosaurs)
{
Console.WriteLine(dinosaur);
}

Console.WriteLine(“nExists(EndsWithSaurus): {0}”,
dinosaurs.Exists(EndsWithSaurus));
}

// Search predicate returns true if a string ends in “saurus”.
private static bool EndsWithSaurus(String s)
{
if ((s.Length > 5) &&
(s.Substring(s.Length – 6).ToLower() == “saurus”))
{
return true;
}
else
{
return false;
}
}
}

/* This code example produces the following output:

Compsognathus
Amargasaurus
Oviraptor
Velociraptor
Deinonychus
Dilophosaurus
Gallimimus
Triceratops

TrueForAll(EndsWithSaurus): False

Find(EndsWithSaurus): Amargasaurus

FindLast(EndsWithSaurus): Dilophosaurus

FindAll(EndsWithSaurus):
Amargasaurus
Dilophosaurus

2 elements removed by RemoveAll(EndsWithSaurus).

List now contains:
Compsognathus
Oviraptor
Velociraptor
Deinonychus
Gallimimus
Triceratops

Exists(EndsWithSaurus): False
*/

Hopefully we remember this at some point :)

Source : . Thanks!

Choosing The Right Printer Paper For Your Needs | printer paper,paper weight,paper brightness rating,printer paper weight

Many people think that it isn’t important what kind of printer paper they use. Paper is paper right? I would have to disagree. First, you need to figure out what you are going to use the paper for. The second thing to determine is the right kind of paper for the kind of printer you own. Not all paper is suitable for all kinds of printers.

When buying printer paper, there are a number of factors to consider. These include the brightness rating, the weight of the paper and the purpose it was designed for. We will consider each of these factors in turn below.

What is the brightness rating?

Brightness of the paper refers to how well the paper reflects light. Many people confuse whiteness with brightness. The higher the brightness rating of a page, the more vibrant and alive the colors printed on it will appear. The brightness rating of the page can make the difference between a dull looking picture and a picture that looks alive and ready to jump off the page. Whiteness refers to the actual shade of color of the paper and how close it is to pure white.

Paper weight – What does it matter?

The paper weight rating is determined by the weight in pounds of a ream of 500 sheets of that particular paper type. In most other countries other than the United States, the weight rating is in grams instead of pounds.

The heavier the paper rating, the thicker and heavier each sheet of paper will be. What does that mean in practical terms? First, the paper will feel more substantial in your hand. The heavier the paper, the stiffer it will feel in your hand. Second, it is less likely to jam in the printer while printing. Third, it tends to feel more professional to the average person. Combining a good paper weight with a high brightness rating makes for a good foundation for printing that important presentation of yours on.

Choosing the right Paper on Purpose

To get the very best results, you choose look to choose paper based on what you plan to do with it. All purpose paper is generally the cheapest kind of paper but it also tends to give you poorer results when printing pictures or color on it. Printer paper designed to go through an inkjet printer will generally preform better on an inkjet printer than general purpose paper will. It is more expensive but the results speak for themselves. Inkjet printer paper is also usually treated with a special coating that will allow the color to stay bright and not simply get absorbed into the paper leading to a dull photo. Remember the purpose of the paper when you make your next paper purchase.

Understanding the paper brightness rating, the paper weight rating and the papers’ stated purpose will go a long way towards your being able to get the most from your printer paper now and in the future.

How to use the post count to limit forum access - Kevin Clark

How to use the Newly Registered Users Group as a post limiter for forum access.

This article explains how you can use the newly registered users group to limit access for users to one or more forums. NOTE: This will mean you can’t use it as an antispam measure of requiring new users posts to be approved.

You might want to do that, for instance, if you have a buy/sell forum or a VIP area where users need to make a reasonable posting contribution to the board before those forums become visible, or if you have a ‘Welcome’ forum where users must post first before having access to the rest of the site.

What is the Newly Registered Users Group?

The newly registered users group was added at 3.0.6 as a means to prevent spammers or new members from posting freely on the board after registering. Its default purpose is to allow you to put the first X number of posts from new members in to a moderation queue for approval before they show up on the board and some other smaller permission restrictions. All members of the board automatically become members of the registered users group but when the newly registered users group is activated, they go in to that group as well and take on some addition overriding restrictive permissions.

However, you can use that extra layer of permissions to limit access to forums until the required post count is reached. Note that it only works on one level. You can only set one limit to gain access and not multiple levels where several sections would become available at different posting milestones.

So how do we do it?

For the purpose of this explanation let’s assume you want to set it so you need 100 posts to gain access to a VIP forum.

In the Administration Control Panel > General > User Registration Settings
Set the new member post limit to 100
NOTE: This limit will only apply to people who register AFTER you set it. If you make any changes to that number, the new limit will only apply to newly joining members and the old limit will still apply to those who registered on the previous limit. To resynchronise the members of the newly registered users group you can use the resync option in the Support Toolkit.

So, now you have a limit set, whenever someone new signs up to the board they will go in to BOTH the registered and newly registered users groups for the duration of 100 posts.

Permissions

Now we need to set some permissions so that group does what we want it to do.

Obviously you wouldn’t want to have to approve 100 posts from each user so we need to turn off post approval for that group.

Permissions
Groups forum permissions
Choose the newly registered users group
Choose all of the forums you want them to freely post in to get to the required limit.
Choose the newly registered user role from the drop list
Then in the advanced permissions go to the misc tab
Can post without approval – YES

Then we need to stop the newly registered users group from seeing the forum we want to restrict access to, our VIP forum.

Permissions
Groups forum permissions
Choose the newly registered users group
Choose all of the forums you want to stop them accessing before they get to the required limit (in this case, the VIP forum)
Choose the newly registered user role from the drop list
Then in the advanced permissions go to the post tab
Can see forum – NEVER
Can read forum – NEVER
Can start new topics – NEVER
Can reply to topics – NEVER

You might think that just denying the ability to see the forum will be enough but that does not stop them accessing and posting in it if they follow a link posted elsewhere.

Now, your users won’t know that VIP area exists. They can post freely on the rest of the board and when they get their 100th post, they will automatically drop out of the newly registered users group and the VIP forum will appear on the index for them to post in.

Alternatively you could set the ‘can see forum’ permission to yes but leave the other options on never so they can see what they’ll get to with the required posts but not actually access it.

One other feature of that group is to stop members sending PMs as a means of controlling PM spam. So to turn off that feature

Permissions
Groups’ permissions
Newly registered users
Make sure the role drop list is set to newly registered user
Select advanced permissions
In the private messages tab, at the bottom of the list, change
Can send private messages to YES

——————————————————————————————–

Great Tutorial!

Original Source here

The Pitfalls of Outsourcing Programmers - Michael Bean

This was in January 2004 , check the link below for the original article , and you can see how the west has lost its edge in technology.

———————————————————————-

Clothing and toys are manufactured overseas. So why not make software there too, where labor is cheaper?

Many U.S. technology companies have outsourced their software development to India. Last year Hewlett-Packard became India’s largest multinational IT employer, with more than 10,000 employees.

The enthusiasm for overseas outsourcing and offshoring, mirrors the enthusiasm for Internet companies in the Nineties. In a recent article, Ravi Chiruvolu, a partner at Charter Venture Capital wrote that “Venture Capitalists decided that because of cheap engineering talent in countries like India it would be more cost effective to outsource software development. If Nike could outsource sneaker manufacturing, we could do the same with code.” Following similar logic, Oracle has announced it will more than double the number of software engineers it employs in India to 6,000.

Although the offshoring trend has resulted in a net transfer of jobs outside of the US, this article isn’t about job losses in the United States. We live in a global economy and people in India deserve jobs as much as people in the United States or anywhere else. It’s worrisome when companies are criticized solely because they have hired people overseas.

Offshoring is a mistake when technology companies confuse operational effectiveness and strategy. Operational effectiveness is about working cheaper or faster. Strategy is about the creation of a long-term competitive advantage, which for technology companies is usually the ability to create innovative software.

Outsourcing programmers works when the software developed isn’t a key part of the pipeline of innovation for products a company actually sells. For example, when website design or back-office software such as payroll or inventory control is outsourced, that can be good because it improves operational effectiveness.

But writing innovative software cannot be done on an assembly line. It requires hard-to-find development and design skills. Farming out development to legions of programmers overseas will not create a differentiation advantage. When a technology company outsources software development, that company loses its capacity to innovate and its competitive advantage.
Why Some Software Companies are Confusing the Box for the Chocolates

Recently, I bought some chocolates as a gift for some friends from a specialty shop. These chocolates are remarkable. Owner Jean-Marc Gorce makes them by-hand and his small shop has been rated as one of the top ten in the United States. In addition to being a chef, Jean-Marc is also an entrepreneur and an innovator.

gold and blue chocolate boxJean-Marc recently started selling his chocolates in gold and blue boxes. I told him I liked the new boxes. He explained that his wife designed the boxes and he found a company in the Philippines that could produce the boxes in the small volume they needed for a good price.

Jean-Marc’s gold and blue boxes are an example of successful outsourcing. Jean-Marc sells chocolates, not boxes. The design and production of chocolates is his core competency. Jean-Marc can outsource box production to improve his operational efficiency without sacrificing his reputation as a maker of superlative chocolates.

While outsourcing boxes improves chocolatier Jean-Marc’s operational effectiveness, he would never consider outsourcing chocolate production because he would lose his core differentiation advantage. Yet, in their enthusiasm for cost savings, several US technology companies have done precisely that– outsourcing their core technology and key strategic differentiator.
Design and Assembly are Different

This isn’t the first time companies have tried to commoditize software development. In the eighties, Japanese companies unsuccessfully attempted to set up software factories to manufacture programs. They discovered that just throwing a lot of programmers together doesn’t create innovative software.

Design is a small part of clothing production, but a big part of software production. Unlike software, it makes sense to outsource the manufacture of clothing and toys. Most of the cost of clothing and toy manufacturing is in the assembly, not the design. Those products can still be designed close to corporate headquarters but assembled elsewhere to keep costs low.

Programming is like design and nearly all of the costs of creating software come from writing the program, not the assembly. The assembly stage for software is really just copying the final program onto a disk and enclosing it with a manual in a box.

Harvard Business School’s Michael Porter, a world expert on strategy and competitive advantage, nicely summarized the problem with competing solely on operational effectiveness:

“If all you’re trying to do is essentially the same thing as your rivals, then it’s unlikely that you’ll be very successful. It’s incredibly arrogant for a company to believe that it can deliver the same sort of product that its rivals do and actually do better for very long. That’s especially true today, when the flow of information and capital is incredibly fast. It’s extremely dangerous to bet on the incompetence of your competitors — and that’s what you’re doing when you’re competing on operational effectiveness.”

Ultimately, the offshoring fad is bad for companies not because of the short-term programmer layoffs but because technology companies will lose their capacity to innovate. Tech companies that outsource their programming talent will ultimately be replaced by competition, and then everyone will be losing their jobs.

http://forio.com/resources/article/the-pitfalls-of-outsourcing-programmers/