CHUVASH.eu
  • About
  • Search

Posts

April 10, 2012

Out-Gridview in PowerShell

Did you know that we can pipe the output from PowerShell into a graphical GridView? I have used PowerShell for one year and only now I discovered this nice feature. You can add filter criteria, you can filter by typing in a textbox:

Other useful output cmdlets
  • out-file
  • out-clip
  • out-null
read more
April 10, 2012

ResxCrunch: Localization tool

If your solution has two or more languages to support, I can recommend an open source tool ResxCrunch. Btw, you can even use ResxCrunch for localization of Android applications.

read more
April 9, 2012

Run powershell remotely

To run powershell remotely is really easy. First enable it on the machine which will receive the remote commands:

Enable-PSRemoting

Then go to another machine and connect to your host:

$cred = Get-Credential
Enter-PSSession -Computername dev -Credential $cred

If you want to know more about powershell remoting, I recommend “A layman’s guide…”. See even a detailed example on poshcode.

read more
April 4, 2012

Access User Profile Properties from Powershell

To use only SPUser objects isn’t always sufficient. To get other properties we have to retrieve user profiles. Giles Hamson gives an example how to get and how to update user profile properties with powershell. Here is an example how to get all work phones:

$url = "http://intranet/"
$site = Get-SPSite $url
$context = Get-SPServiceContext $site
$profileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)
$profiles = $profileManager.GetEnumerator()

while ($profiles.MoveNext()) {
  $userProfile = $profiles.Current
  $name = $userProfile.DisplayName
  $phone = $userProfile\["WorkPhone"\]
  $line = '{0};{1}' -f $name, $phone
  write $line
}

If you are not sure what properties are called, see the whole list by typing:

read more
April 2, 2012

Add Comments column to your sharepoint list

If you have used Issue tracking list template in SharePoint you must have marked that the comments are added and marked with author name and datetime. It is handy to have these micro “discussion boards” on items. The comment-formed communication can help to fine-tune task definitions. By the way, have you seen Trello? So the question is how we can create this column in other lists? Here is a little tutorial how to create “append-only comments”, as they are called:

read more
March 27, 2012

Clone javascript objects

In javascript, if we copy objects or their properties, the reference still remains and by changing the new object the old one is changed, too. To clone or do a clean copy of an object I found a very useful solution by Jan Turoň on StackOverflow:

Object.prototype.clone = function() {
  if(this.cloneNode) return this.cloneNode(true);
  var copy = this instanceof Array ? \[\] : {};
  for(var attr in this) {
    if(typeof this\[attr\] == "function" || this\[attr\]==null || !this\[attr\].clone)
      copy\[attr\] = this\[attr\];
    else if(this\[attr\]==this) copy\[attr\] = copy;
    else copy\[attr\] = this\[attr\].clone();
  }
  return copy;
}

Date.prototype.clone = function() {
  var copy = new Date();
  copy.setTime(this.getTime());
  return copy;
}

Number.prototype.clone = 
Boolean.prototype.clone =
String.prototype.clone = function() {
  return this;
}

Next: clone your objects if you pass them from a popup.

read more
March 13, 2012

clearInterval in Chrome doesn't work on window blur

If you want to reset all interval jobs when a browser tab is inactive, the best way would be to use clearInterval on window blur. But unfortunately Chrome fires window focus and window blur two times. Here is an embryo to a solution:

var M = window.M || {};
M.counter = 0;
M.focused = true;
M.tick = function() {
  if (M.focused) {
		console.log("tic tac " + ++M.counter);
	}
};
M.start = function(e) {
	console.log("starting...");
	M.focused = true;
};
M.stop = function(e) {
  console.log("stopping...");
  M.focused = false;
};
$(window).on({
	focus: M.start,
	blur: M.stop
});

M.ticker = window.setInterval(M.tick, 1000);
read more
March 13, 2012

shorthand for jQuery(document).ready

jQuery(document).ready is used very often, why not use the shorthand variant of that?

$(function() {
    // Code here
});
read more
March 12, 2012

moment.js - the best javascript tool for working with dates

Just look at moment.js. Everybody who have worked with dates in javascript are going to love it.

Comments from Wordpress.com

Justin Cooney - Mar 3, 2012

Interesting, I hadn’t heard of moment.js. I’m taking a look at the site right now; it looks to have some very handy functionality for date manipulation!

The great thing with moment.js is e.g. that one can create a date object from asp.net date format like /Date(123543534)/

read more
March 12, 2012

Kalendae - new javascript utility for calendars

An alternative to jQuery UI datepicker is Kalendae. (MIT License). Highly customizable and no dependencies to other javascript libraries. Here is the highlights:

Kalendae is an attempt to do something that nobody has yet been able to do: make a date picker that doesn’t suck. Kalendae provides the following features:

  1. Fully portable, no dependencies. No jQuery, no Prototype, no MooTools; just add the script and the stylesheet and you’re good to go.
  2. Fully and easily skinable. The default theme uses only one image file (a mask for the previous and next buttons), everything else is styled using CSS.
  3. Supports all modern browsers and IE8.
  4. Support single day, multiple day, or day range selection.
  5. Configurable number of months to be displayed at once.
  6. Can be displayed on the page as an inline widget, or attached to one or more input fields as a popup control.
  7. Can be attached to any page element, not just named elements.
  8. Configurable blackouts, defined either as an array of dates or via a callback function
  9. Output selected dates in a variety of formats
  10. Leverages moment.js for smart and easy date parsing.

Found through daily.js

read more
  • ««
  • «
  • 22
  • 23
  • 24
  • 25
  • 26
  • »
  • »»
© CHUVASH.eu 2025