background preloader

The World's Most Flexible E-Commerce Platform

The World's Most Flexible E-Commerce Platform

Getting Things Done GTD with Personal Development and Motivation for Success - - DIGTD - Making You More Productive Designs - Facebook, websites Understanding Ruby and Rails: Lazy load hooks – Simone Carletti's Blog This article targets Rails 3 The article was written as of Rails 3.2. The information contained in this page might not apply to different versions. This is article is part of my series Understanding Ruby and Rails. A small-but-interesting feature introduced in Rails 3 is the built-in support for lazy loading. Lazy loading is a very common design pattern. With Rails 3 you can now register specific hooks to be lazy-executed when the corresponding library is loaded. class ApplicationController < ActionController::Base initializer "active_record.include_plugins" do ActiveSupport.on_load(:active_record) do include MyApp::ActivePlugins end end end In this case we register the block to be executed when the ActiveRecord library is loaded. ActiveSupport.run_load_hooks(:active_record, ActiveRecord::Base) This line of code executes all the hooks previously registered for ActiveRecord. lazy-load hooks in the wild Perhaps one of the most frequent usage of the lazy-load hooks is in Rails plugins.

Lots of Buttons - Welcome Hyper-V Remote Management: Workgroup Vista Client to Domain-Bound Server » Danny Thorpe So here I am configuring my dev machine in Redmond from my laptop in my home office in Santa Cruz. I’m all VPN’d and security card authenticated up the wazoo, installing this and configuring that on the dev machine via Remote Desktop. (Praise be to RD!) I get Hyper-V set up on the dev machine so I can create and destroy virtual machine configurations with impunity while developing and testing on beta stuff. I need to open that VM in a console so I can drive it. Hmm. How to work around this? Bzzt! Uh-oh. A quick web search later, I discover with delight that John Howard has already covered this remote management of Hyper-V in exquisite detail, for several different machine and network configurations: client and server in a workgroup network, client and core server, client and server in a domain network, and a domain client connecting to a workgroup server. Naturally, none of those scenarios match my situation. I know exactly what the problem is. Or will it? Tada!

e/mobile commerce sandrods's odf-report at master - GitHub Industry Strategies for Online Merchants Hey, Scripting Guy! How Long Has My Server Been Up? - Hey, Scripting Guy! Blog Hey, Scripting Guy! Everyone at work has the idea that our network is unreliable. However, I know that our servers are seldom down. Hi HB, You are really asking two questions. To approach your problem, HB, we can use the WMI class Win32_OperatingSystem which has thelastBootupTime property. $aryComputer = Get-Content c:\fso\servers.txt $now = get-date $filePath = "C:\fso\uptime.txt" foreach ($computer in $aryComputer) { $wmi = Get-WmiObject -class win32_operatingsystem -namespace root\cimv2 ` -computername $computer $lastBootTime = $wmi.ConvertToDateTime($wmi.LastBootUpTime) "$computer has been up for $($now - $lastBootTime)" | Tee-Object -variable uptime out-file -filepath $filepath -inputObject $uptime -append } #end foreach To begin with, HB, we use Windows PowerShell to see if we can connect on our local computer and pick out the lastBootupTime. (Get-WmiObject -Class Win32_OperatingSystem -Namespace root\cimv2 ` -computername localhost).lastbootuptime $now = get-date

Mobile Hey, Don’t Dump. Debug! Are the "Two Ps" (print statements and prayer) all that comprise your debugging strategy? It's time you were introduced to the Interactive Ruby Debugger. I often ask other developers for advice. Out of curiosity, I also ask other coders about debugging techniques, and more often than not, I am surprised by the answer. In my Rails work, I use the debugger extensively. Installing the Debugger The debugger, ruby-debug , is provided as a Ruby gem and installs just as easily as any other extension. $ sudo gem install ruby-debug Once installed, you can invoke the debugger anywhere in your code with a call to debugger . class ExampleController < ApplicationController def index # ... debugger # ... end end By default, Rails's script/server ignores calls to the debugger (and instead emits a message such as Debugger requested, but was not available ). $ ruby . Once the debugger is enabled, each call to debugger generates a command prompt. Commands to Query State ... The next command is print or p .

Related: