Monthly Archives: April 2012

Philips creates computer monitor that corrects posture, encourages breaks

ergosensor

 

Since people are spending more hours in front of computer monitors each year, Philips has developed a new technology designed to encourage healthy behavior while staring at the screen.

Announced by Philips recently, the consumer electronics company has developed a new 24-inch computer monitor that’s designed to offer feedback related to ergonomics. Called the Ergosensor, the desktop LCD monitor uses a built-in CMOS sensor to measure user distance from the screen in addition to the angle of the user’s neck. When the user slouches, software developed by DigitalOptics Corporation will remind the user to sit up straight or move an appropriate distance away from the screen. In addition, the software also offers advice on the best times to take breaks from staring at the monitor and move away from the screen for a while to take a walk.

ergosensor-viewingFor users that prefer to slouch a bit after a long workday, the monitor’s base allows the user to adjust the height, tilt, swivel and rotation angle of the screen. The software can also be adjusted to lower the amount of warnings that appear when posture changes throughout the day.

Beyond the information on ergonomics, the Philips Ergosensor also has an interesting power-saving feature that employers may appreciate. When the user stands up and walks away from the monitor, the CMOS sensor detects this action and powers down. The opposite action occurs when the user returns to the desk and sits down.

Philips has also included a 0-watt power switch on the back of the monitor that cuts all power from the monitor in order to further reduce power consumption in the home or office. According to company officials, all Ergosensor models have been developed out of “a minimum of 65% post-consumer recycled plastics” and the monitor can be recycled when it’s time to replace the model. Philips hasn’t set a date when the Ergosensor will be available in the United States. However, it’s currently available in Europe and costs approximately $375 for the 24-inch model.

Advertisements

InfoPath – Get the current user without writing code

I’ve just read IP team blog post about getting the current user’s details using Web Services.
Actually the exact same result can be achieved without writing any code. It’s a very common thing to do and I couldn’t find any guide for that, so here it is:
* If you are already familiar with this, this post might still be useful. I have included the complete set of default properties get returned and their proper naming syntax at the bottom.
* This works at InfoPath as well as InfoPath Forms Services.
*Clayton Cobb has a great follow up post if you to take the this a step further.

  1. With InfoPath opened go to Tools > Data Connections, and click ‘add…’ to add a new data connection to the form. This opens up the Data Connection Wizard.
  2. We want to receive data from the WS about the current user, so choose receive data’ and click next.
  3. Our data source is a WS so choose ‘Web Service’ and next.
  4. Now you will have to point the wizard to the WS. Type an address similar to this: http://ServerName/_vti_bin/UserProfileService.asmx  and click next.
  5. Here you get a list of all methods for that WS, choose GetUserProfileByName and click next.
  6. In this screen you can specify what parameters are sent to the method, we are relying on the method’s ability to return the current user name if no value is passed to it, so we will leave this as is (no value is passed to the method) and click next.
  7. Click next and make sure ‘Automatically retrieve data when form is opened’ is checked.
  8. Finish the wizard.

The GetProfileByName method returns a PropertyData array. You can think of it as a repeating table of name and value pairs.
So Now that you have a data connection that can get the current users, you can use it values. In this example I will show the user’s first name in a textbox.

  1. Add a textbox to the form.
  2. Go to the first textbox’s properties (double click it).
  3. In the ‘Default Value’ part, click the ‘fx’ button next to the ‘Value’ field. this opens up the formula builder dialog.
    vc
  4. Click ‘Insert field or group’.
  5. In the data sources drop down, choose the GetUserProfileByName data source.
  6. Expand all groups under the ‘dataFields’ group, and choose the ‘value’ field. Don’t click OK yet!
  7. With data ‘value’ field selected, click the ‘Filter Data…’ button and ‘Add…’.
  8. In the first drop down (value) select ‘Select a field or group…’ and choose the ‘Name’ field under the ‘PropertyData’ group.

  9. Leave the middle drop down as is (‘is equal to’) and in the last drop down choose ‘type a text…’.
  10. This is the part where you specify which property to put in the textbox. As we said the method returns multiple properties about the user. For this textbox we want to put the user’s first name in, so type ‘FirstName’ (this is case sensitive!). I have included the property list you can use here (just below), so if you want some other property, just type its name instead.
  11. That’s it, all we have to do is to confirm everything so Click ‘OK’ for every open dialog box until you are back in the design mode.
  12. click ‘Preview’ and see the wonder!
  13. If you want more details repeat steps 1-11 and enter different property names in step 10.

Finally, as I Promised, here is the complete list of default profile properties get returned by the userprofileservice. I think they are pretty self explained:

UserProfile_GUID
AccountName
FirstName
LastName
PreferredName
WorkPhone
Office
Department
Title
Manager
AboutMe
PersonalSpace
PictureURL
UserName
QuickLinks
WebSite
PublicSiteRedirect
SPS-Dotted-line
SPS-Peers
SPS-Responsibility
SPS-Skills
SPS-PastProjects
SPS-Interests
SPS-School
SPS-SipAddress
SPS-Birthday
SPS-MySiteUpgrade
SPS-DontSuggestList
SPS-ProxyAddresses
SPS-HireDate
SPS-LastColleagueAdded
SPS-OWAUrl
SPS-ResourceAccountName
SPS-MasterAccountName
Assistant
WorkEmail
CellPhone
Fax
HomePhone

http://blogs.microsoft.co.il/blogs/itaysk/archive/2007/04/05/InfoPath-_2D00_-Get-the-current-user-without-writing-code.aspx

REGULAR EXPRESSIONS

What are regular expressions?

They’re strings of logic used by computer programmers worldwide, intended to transcend the language barrier for universal application. Professional web developers often use them to validate fields in forms for clients, which is why we’ve worked toward giving you this power as well.

Regular expressions provide a way to match strings of text, which is exactly what Web Form Builder uses them for. They expression given for a field restricts what can be placed in that field by defining what characters can be used, when characters can be used, how many characters can be used, etc. If the information submitted in the field does not match the rules defined in the expression, the submitted information will be rejected, and the visitor will be asked to try again.

Each one of these expressions consists of a bunch of characters which might seem to be a random mess of junk. Actually, those characters define a very specific action. Let’s break down the "Only Letters" preset:

/^[a-z]+$/i

Everything within the slashes (/) is part of the actual expression. The ^ means "begins with." Everything between the brackets ([ and ]) is part of a range, running from the letter a to the letter z. The + sign means that there can be more than one character on this line. The $ means "end of the line." Finally, the i outside of the expression’s slashes is just a mode indicator that states that upper and lower case do not matter.

Put all of that together, and you have an expression that reads:

"This statement matches anything that begins with any letter from A to Z, contains any amount of these letters, contains only letters from A to Z, and they can be both upper and lower case."

Below is a full description of what each preset does. We’ve color-coded some of the different components to help visualize how each expression works.

Alphanumeric

/[0-9a-z]/i

Action: Only numbers and letters can be used in the field; no hyphens, punctuation, special characters, or anything else can be used.

Breakdown: The brackets ([ and ]) declare a range, which includes both 0-9 and a-z. On the end of the phrase, outside of the slashes, is the letter i, which means that the limitation is case insensitive (doesn’t matter whether the letters are upper or lowercase).

Rough English Translation: "Uses any digit from 0 to 9, and any upper or lower case letter from a to z."

Hint: Removing the i at the end would result in just lower case letters being accepted.

Only Numbers

/^[0-9]+$/

Action: Only numbers can be used in the field.

Breakdown: The ^ at the beginning means "starts with"; the brackets ([ and ]) declare a range, which includes the digits 0-9; and the +$ at the end means "until the end of the line."

Rough English Translation: "Starts with any digit from 0 to 9 and only uses digits from 0 to 9 throughout."

Hint: You could also choose a different range of digits here; changing the 9 to a 6 would cause the field to only accept numbers from 0 to 6.

Only Letters

/^[a-z]+$/i

Action: Only letters can be used in the field.

Breakdown: The ^ at the beginning means "starts with"; the brackets ([ and ]) declare a range, which includes the letters a-z; the +$ at the end means "until the end of the line"; and the i outside of the slashes means "case insensitive."

Rough English Translation: "Starts with any upper or lower case letter from a to z and only uses upper and lower case letters from a to z throughout."

Hint: Removing the i at the end would result in just lower case letters being accepted.

No White Spaces

/^[\S]+$/

Action: Will not allow spaces to be used in values typed into this field.

Breakdown: The ^ at the beginning means "starts with"; the brackets ([ and ]) declare a range, which includes the shorthand class \S (which means "not a space"); and the +$ at the end means "until the end of the line."

Rough English Translation: "Starts with anything other than a space, and does not use any spaces throughout."

Bank Routing Number (USA)

/^[0-9]{9}$/

Action: Bank routing numbers are always 9 digits long. Therefore, only numbers can be used, and there must be exactly 9 of them.

Breakdown: The ^ at the beginning means "starts with"; the brackets ([ and ]) declare a range, which includes the digits 0-9; the curly brackets ({ and }) declare a repetition, of which 9 is the declared value; and the $ at the end means "the end of the line."

Rough English Translation: "Starts with any digit from 0-9 and uses exactly 9 of them."

Hint: Changing the {9} to another number will require exactly that many digits to be used.

Bank Account Number (USA)

/^[0-9]{12}$/

Action: Accepts bank account numbers that are 12 digits long. Only numbers can be used, and there must be exactly 12 of them.

Breakdown: The ^ at the beginning means "starts with"; the brackets ([ and ]) declare a range, which includes the digits 0-9; the curly brackets ({ and }) declare a repetition, of which 12 is the declared value; and the $ at the end means "the end of the line."

Rough English Translation: "Starts with any digit from 0-9 and uses exactly 12 of them."

Hint: Change the {12} to the number of digits used in bank account numbers for a specific bank.

eBay Item ID

/^\d{12}$/

Action: All eBay items use a 12 digit ID number. Only numbers can be used, and there must be exactly 12 of them.

Breakdown: The ^ at the beginning means "starts with"; the shorthand class \d means "digits only"; the curly brackets ({ and }) declare a repetition, of which 12 is the declared value; and the $ at the end means "the end of the line."

Rough English Translation: "Starts with any digit and uses exactly 12 of them."

Hint: The range [0-9] can be used in place of the shorthand \d . Both declare the same thing: any digit can be used.

Only Upper Case

/^[A-Z]+$/

Action: Only upper case letters can be used.

Breakdown: The ^ at the beginning means "starts with"; the brackets ([ and ]) declare a range, which includes the letters A-Z;  and the $ at the end means "the end of the line."

Rough English Translation: "Starts with any capital letter from A to Z, and uses only capital letters throughout."

Only Lower Case

/^[a-z]+$/

Action: Only lower case letters can be used.

Breakdown: The ^ at the beginning means "starts with"; the brackets ([ and ]) declare a range, which includes the letters a-z;  and the $ at the end means "the end of the line."

Rough English Translation: "Starts with any lower case letter from A to Z, and uses only lower case letters throughout."

Creating Your Own Custom RegEx

There’s one more option here: Custom. If you’re brave and hardcore, you can supply your own expression or make tweaks to one of the presets. Use the box below the drop-down to enter your custom expression.

You can browse our list of regular expression examples to see if we’ve already collected one that works for you.

This site has a massive archive of expressions. Just make sure to thoroughly test them to ensure that they actually function the way you intend for them to.

More Resources

If you’re creating your own custom expressions, it may be best to use a testing tool to determine that your syntax is correct before using it in your form. Here’s a couple online tools that we think are especially handy:

These sites have a lot more information about regular expressions and how they work:

http://www.coffeecup.com/help/articles/regular-expressions-in-web-form-builder/