Occasionally, we order a large number (30+) computers at work and it a lot easier to bulk create the computers than manually move them and set their description (it also makes it easier to pass out software via GPO) after they have been joined to the domain. To do this I have created the following PowerShell one liner:
It requires a CSV file with the Name of the computer, the OU the computer should be created in and the Description. It works awesome and takes a job that usually takes 15+ minutes to less than 5.
I have been testing HA solutions at work for our SharePoint deployment and we are looking at using Microsoft's Network Load Balancer (NLB) technology that's built into Windows Server. One of the options I saw when I clicked on a node I saw an option that said Drainstop and of course I found what I was looking for in TechNet:
When you use the stop command, either through Network Load Balancing Manager or the command prompt, any client connections already in progress are interrupted. To avoid interrupting active connections, consider using the drainstop cluster-control command, which allows the host to continue servicing active connections, but disables all new traffic to that host. For more information, see "Disable new traffic handling and stop Network Load Balancing" in Related Topics.
http://technet.microsoft.com/en-us/library/cc781186(WS.10).aspx
I looks like this is the idea way to stop the NLB cluster from routing information to a host that I will need to take offline for maintenance.
I was challenged at work today to determine the number of users in an Active Directory group. I figured the best way was to break out PowerShell and see what I could find (I'm sorry but I'm learning PowerShell so things are going to be very PowerShell centered for a while :-)). I found that in the ActiveDirectory PowerShell module (see http://www.mikepfeiffer.net/2010/01/how-to-install-the-active-directory-module-for-windows-powershell/ for instructions on how to install this) the Get-ADUser cmdlet works really well for running basic searches in AD.
The first step is to import the module:
Then you can run a search on the user information you want for example this returns the count of all users in a group:
This returns the count of all group members who have an expiration date:
The cool things about the get-aduser cmdlet is that it automatically pulls common fields (username, surname, etc.) but by adding items to the -property field it will return additional items. If there are other searches you find useful please add them to the comments below.
Nettuts+ has an interesting and detailed article on how to use stripe to accept credit cards on your website. After using authorize.net it's nice to see a cheaper up front option.
http://net.tutsplus.com/tutorials/other/so-you-want-to-accept-credit-cards-online/
One of the downsides to using checkboxes in HTML is the fact that if you don’t have the checkbox checked when the form is submitted it’s value doesn’t get submitted to the server so no value is sent for that form element.
However, if you put a hidden element before the checkbox the checkbox value will override the hidden element’s value if the checkbox is checked:
[sourcecode language='html']
[/sourcecode]
github.com has a really cool site that allows you learn the basics of git quickly:
Ready to have your mind blown? I wanted to access a view helper from inside another view helper and it doesn't allow it by default. It turns out you have to add the function setView() to your view helper and then you will have access to the view helper. The trick (in PHP 5.3 at least) is to make sure you include the Zend_View_Interface before you name the parameter or it won't work (you'll get a nasty error message).
class Zend_View_Helper_DisplaySomeData extends Zend_View_Helper_Abstract{
protected $_view;
public function setView(Zend_View_Interface $view){
$this->_view = $view;
}
public function DisplaySomeData($data){
return $this->_view->SomeOtherViewHelper($data) . ' some text';
}
}
A couple months ago I found an article that explained how one company uses git branches to manage their software deployment process. They use a branch off their development branch for each feature and then when the feature was done they merged it back into their development branch. During my last project I used something similar to this (mostly so I could fix bugs as they were reported) but the feature branches usually only lasted a few hours or at most a couple days.
In the comments, someone linked to the following YouTube video which explains why it's a bad idea to do this in the long term.
The video isn't super long but the TL;DR version of it is that when you perform a merge there is a cost to doing the merge. The longer you go between merges the more it costs to merge two branches together because of how far they diverge (makes sense when you think about it). In the video they suggest practicing Continuous Integration and merging your code back to the mainline branch daily. The suggestion from the video is to instead use feature/code toggling or branching by abstraction to get the same feature. That way new features are only launched when you're ready for them. It turns on that lots of people use this approach even Flickr. I really liked the blog post Experience Report: Feature Toggling by Sarah Taraporewalla explaining her experience with feature toggling.
The basic idea behind code toggling is very simple:
It seems simple but really powerful. I'm going to start looking into implementing it on one of my upcoming projects so hopefully there will be a future article on how that worked out.
Nettuts+ has an interesting article on the Principals of Agile Development. I think this might be the first time I've actually read a description of what agile development is so I think it's worth a read:
http://net.tutsplus.com/articles/general/the-principles-of-agile-development/
PHP has a really cool function called fgetcsv which provides a really simple way to read CSV data. I used it in a script recently and it worked perfectly with my test data and then someone with with a Mac ran their data through it and it failed horribly.
It turns out you have to set the auto_detect_line_endings option to true BEFORE the fopen function for it to work. If the call to ini_set occurs after the fopen it doesn't work correctly.
subscribe via RSS