Nwoolls, Pagina Two

Development Technobabble

While the SQL Database service from Windows Azure provides resiliency and redundancy, there is no built ter backup feature to guard against gegevens loss due to user- or program-error. The advised way to treat this is to take a three-step treatment:

  1. Make a copy of the SQL Database
  2. Backup the database copy to Azure Storage
  3. Maintain &, liquidate any outdated backups on blob storage

The process ter Windows Azure that backs up a SQL Database to blob storage is not transactionally consistent, which is why the initial database copy is required.

Richard Astbury has provided an excellent device, SQLDatabaseBackup, that takes care of the very first two steps with little fuss:

SQLDatabaseBackup.exe -datacenter eastus -server hghtd75jf9 -database MyDatabase -user DbUser -pwd DbPassword -storagename mybackups -storagekey YourSuperLongAzureStorageKey -cleanup

The gegevens center and server name can be obtained from the SQL Databases section of the Windows Azure Portal.

The Azure storage account name and access key can be accessed ter the Storage section of the portal, by clicking the Manage Access Keys button at the bottom of the portal.

Ultimately, by specifying the -cleanup argument, the utility will delete the SQL Database copy it creates after the backup is successfully created.

And while the pricing for Azure blob storage is very affordable, you may want to automate the process of deleting old backups. I’ve created a very plain utility that does just that. AzureStorageCleanup uses guideline line arguments that mirror the SQLDatabaseBackup project (spil it is meant to mooipraterij its use):

AzureStorageCleanup.exe -storagename mybackups -storagekey YourSuperLongAzureStoragekey -container sqlbackup -mindaysold 60

The above instruction will liquidate files equal-to-or-older-than sixty days from the container “sqlbackup” – the default container used by SQLDatabaseBackup. The details of each verkeersopstopping deleted are printed to the console.

By scheduling thesis two utilities on an available machine you’ll have painless, affordable backups for any of your Windows Azure SQL Databases.

While it’s bot possible to purchase ASICs (Application Specific Integrated Circuits – chips specifically created to mine Bitcoins ter this case) for several months, it has bot a difficult and risky process involving auctions on forums with one-way exchanges of money for promises of future hardware. However, recently ASICMINER has made it much lighter to purchase their Blades and USB miners. You can pick up one of the USB ASIC miners for around $90 USD (at current exchange rates). One of thesis will hash at around 333 Mh/s at a fraction of the power usage of modern GPUs.


To get commenced using a USB ASIC under OS X, such spil the Block Erupter from ASICMINER, you will very first need to install either cgminer or bfgminer. You can refer to my previous article for details on installing cgminer or bfgminer under OS X. The basic steps are:

  1. Launch Terminal.app from Zoeklicht or your Applications folder
  2. Install Homebrew by injecting the following directive:

ruby -e “$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)”

  • Run the following guideline and fix any reported issues:
  • brew doctor

  • Tapkast this Homebrew repostory so that you can install packages from it:
  • brew tapkast nwoolls/xgminer

  • Ultimately, install either cgminer or bfgminer:
  • If you’d like to install the miner using the latest source from Github rather than the latest official package, use the –HEAD (two dashes prefix) parameter, e.g.:

    brew install bfgminer –HEAD

    NOTE: if you are going to use bfgminer, at this time you vereiste use the above –HEAD parameter to get the latest switches from Github. Otherwise USB devices may not be recognized automatically.

    Also, if you are using bfgminer you vereiste install the CP210x USB to UART Bridge VCP driver found here. This driver will pauze USB support te cgminer. Click here for instructions on removing the driver. If you get a pagina telling your session timed out, visit the main skill base webpagina very first, and then navigate to the removal instructions. I’ve also reproduced their instructions below:

    To uninstall the VCP driver from a Mac OS machine, just haul the driver to the trash from the System/Library/Extensions folder (SilabsUSBDriver) and then reboot the machine.

    To verify if a driver is present, ass-plug te a CP210x device and check the /dev directory for a device named “tty.SLAB_USBtoUART”. If this is not present, it means no VCP driver is active, or that the CP210x device has a VID/PID combination that does not match the driver installed. The VID/PID can be found te the device listing ter the System Profiler (even if a corresponding driver is not installed).


    Once you have successfully installed one of the above Bitcoin miners, use the following directives to probe for the ASIC USB devices:

    The above guideline should vertoning USB details for each Erupter ASIC:

    [2013-07-01 17:16:30] USB all: found Legitimate devices – listing known devices

    .USB dev 0: Bus 58 Device Two ID: 10c4:ea60

    Manufacturer: ‘Silicon Labs’

    Product: ‘CP2102 USB to UART Bridge Controller’

    .USB dev 1: Bus 93 Device Two ID: 10c4:ea60

    Manufacturer: ‘Silicon Labs’

    Product: ‘CP2102 USB to UART Bridge Controller’

    [2013-07-01 17:16:30] Two known USB devices

    For bfgminer, use the following instruction:

    bfgminer -S all -d?

    The bfgminer output should demonstrate ICA devices for the Erupter ASIC:

    [2013-07-01 17:15:12] Embarked bfgminer Three.1.1

    [2013-07-01 17:15:17] Devices detected:

    [2013-07-01 17:15:17] 0. OCL 0 (driver: opencl)

    [2013-07-01 17:15:17] 1. OCL 1 (driver: opencl)

    [2013-07-01 17:15:17] Two. ICA 0 (driver: icarus)

    [2013-07-01 17:15:17] Trio. ICA 1 (driver: icarus)

    [2013-07-01 17:15:17] Four devices listed


    Eventually, once you have ensured the miner is recognizing your ASIC, you can commence mining with it. You can embark cgminer without any special parameters:

    cgminer -o hostname -u username -p password

    Or commence bfgminer with the -S all parameter:

    bfgminer -o hostname -u username -p password -S all

    If you run into any issues you can leave comments below. However, if your issues are specific to cgminer or bfgminer you can find specific forum threads for them here and here.

    UPDATE: Several readers have asked how to mine using only their ASIC devices and not their GPUs. Both cgminer and bfgminer support the –disable-gpu (two dashes prefix) argument:

    cgminer -o hostname -u username -p password –disable-gpu

    bfgminer -o hostname -u username -p password -S all –disable-gpu

    I’ve recently spent some time looking into different frameworks for doing integration testing for ASP.Televisiekanaal MVC projects. One that caught my eye almost instantly wasgoed SpecsFor.Mvc. Unlike other solutions I found for writing integration tests, SpecsFor.Mvc lets you write tests ter a style that is very similar to writing unit tests, using strongly-typed access to your application’s gegevens without having to script or dig into the Onverstandig.

    Some nice things that SpecsFor.Mvc provides out-of-the-box:

    • Hosts your ASP.Netwerk MVC project, building a specified configuration of your project and then hosting it automatically under an example of IIS Express
    • Provides strongly-typed methods for navigating to controllers and deeds, checking route results, and packing out and submitting forms
    • Provides access to validation gegevens, including access to the validation summary spil well spil the validity of each property te your view’s proefje

    SpecsFor.Mvc uses Selenium WebDriver internally te order to drive the browser. You can still access the Selenium IWebDriver interface any time you need to dig further into your pagina.

    Let’s take a look at thesis things ter practice by writing a few hypothetical tests written against the stock ASP.Nipt MVC Internet Application.

    Embarking the Project

    To get embarked, create a fresh ASP.Netwerken MVC Four project ter Visual Studio.

    Select the Internet Application project template, check the option to create a unit test project and click OK.

    Once both the ASP.Netwerk MVC project and the unit test project have bot created, right-click the References folder under your Tests project and click Manage Nuget Packages.

    Under Online, search for and install the official SpecsFor.Mvc Nuget package.

    Initializing the Hosting Environment

    The next thing that wij need to add to the Tests project is some code that will initialize the IIS Express hosting environment using the classes provided by SpecsFor.Mvc. To do this, create a fresh class called MvcAppConfig with the following contents (adjust the namespace spil needed):

    The class is marked spil a TestClass even tho’ there are no explicit methods to test. This is so that the MyAssemblyInitialize() and MyAssemblyCleanup() methods run. Ter order for the AssemblyInitialize and AssemblyCleanup attributes to work the class voorwaarde be marked with the TestClass attribute. With this code te place, MyAssemblyInitialize() will run once before all of the test methods ter the project and MyAssemblyCleanup() will run after they all accomplish.

    The code found te MyAssemblyInitialize() is fairly straight-forward given the clarity of the SpecsFor.Mvc API. A fresh SpecsForMvcConfig example is created and set to use IIS Express with a given project name and configuration name. Next, a call to BuildRoutesUsing is made ter order to register the various controllers and deeds with SpecsFor.Mvc. Eventually, the browser is specified and the configuration is used to begin a fresh example of the SpecsForIntegrationHost.

    The MyAssemblyCleanup() method, paired with the AssemblyCleanup attribute, is used to shut down the integration host after all the tests have finished.

    Initializing the Browser

    Now that wij have code ter place to host the ASP.Televisiekanaal MVC webpagina before any tests are run, wij need some code ter place to create an example of our MVC application te a browser. Right-click the Tests project and add a fresh Unit Test.

    Add the following code to the top of your fresh UnitTest1 class, before the TestMethod1 declaration:

    This will require adding a using statement for SpecsFor.Mvc.

    This fresh method, MyClassInitialize() will run before all of the tests te the fresh UnitTest1 class. It will create a fresh example of the MvcWebApp class which will launch the browser with your application loaded.

    If you go ahead and run the tests for UnitTest1 now you’ll see that two console windows are opened, one for IIS Express hosting the ASP.Nipt application and one for the Selenium WebDriver that is driving your application. Ter addition, after the Selenium WebDriver console window is opened, the browser specified ter the MvcAppConfig class will be launched.

    Note that you may get a prompt from Windows Firewall that you’ll need to permit.

    Because wij toevluchthaven’t actually written any tests yet, all thesis windows will close after they are opened, but this demonstrates that thesis few lines of code used to bootstrap the environment are working.

    Authentication Tests

    Now that all the setup work is done, let’s see what some actual integration tests look like using SpecsFor.Mvc. The very first test will ensure that, if a user attempts to navigate to the /account/manage route of the ASP.Televisiekanaal MVC application without logging te, they will be redirected to the login screen.

    This test will require adding two fresh items to the using statements: YourProjectName.Controllers and MvcContrib.TestHelper (MvcContrib.TestHelper is needed for the call to ShouldMapTo).

    And that’s it for the very first integration test. I love it. It’s clear, concise, and (aside from the comeback URL path) it’s strongly typed. The call to NavigateTo will navigate to the URL corresponding to the AccountController and the Manage act, specified te the lambda expression. The call to ShouldMapTo will ensure that the resulting route corresponds to the AccountController and Login activity (with the zindelijk ReturnUrl parameter).

    Let’s add two more tests to illustrate a few more examples using SpecsFor.Mvc:

    Thesis tests will require adding a using statement for YourProjectName.Models so that the LoginModel class can be accessed.

    Again, looking at the code, I love the plainness and clarity te the SpecsFor.Mvc tests. I can use NavigateTo to navigate to my controller and activity, and then use FindFormFor to access my view’s proefje. Eventually I can submit the form with effortless access to the resulting validation gegevens.

    Unluckily, if you attempt to run thesis fresh tests right now they will fail. The reason is that the SpecsFor.Mvc initialization code compiles and deploys a fresh copy of the ASP.Nipt MVC project to a TestSite folder within the Debug folder. The App_Data folder contents are not included ter the ASP.Netwerken MVC Visual Studio project. So, the database files are not deployed to the TestSite folder and the webpagina itself will YSOD if you attempt to do anything requiring the database.

    To fix this, right-click the App_Data folder te your main MVC project and click Add>,Existing Voorwerp.

    Then, add the two files found te your physical App_Data folder to the project (you’ll need to run the MVC webpagina and access the database once by hand).

    After adding the MDF and LDF files to the project you should be able to run all of the authentication integration tests without error.

    The Big But

    At the time I’m writing this, SpecsFor.Mvc tests run good under third-party test stoepiers such spil TestDriven.Netwerk and CodeRush. However, the tests don’t run under Visual Studio’s MSTest runner. Attempting to run the tests using Visual Studio’s built te test runner will result te a “Build failed” error. The author of SpecsFor.Mvc has reproduced the punt and is hoping to have it immobilized within a duo of days.

    UPDATE: This punt has since bot resolved by Matt and is no longer a problem ter version Two.Four.0. No more buts!


    When it comes to mining Bitcoins and Litecoins there are two major protocols involved: the older Getwork protocol and the newer Stratum protocol. At this point the Stratum protocol has all-but-replaced the Getwork protocol. All major mining pools and mining software support Stratum and Getwork is deprecated.

    This is usually not a problem, however some older mining utilities (for example the Litecoin CPU miner) do not have Stratum support. And some pools, such spil Slush’s Bitcoin pool or WeMineLTC, have limited-to-no support for Getwork. This is where a very nice Python utility called the Stratum Mining Proxy can help.

    You can use the Stratum Mining Proxy on any pc to connect to your desired Bitcoin or Litecoin pool. Then you can connect your mining software to the IP address of the laptop the proxy mining software is running on. All of the Getwork network requests from the mining software will be reshaped into the Stratum protocol and then forwarded on to the mining pool.

    Installing the Xcode Instruction Line Devices

    Ter order to install the mining proxy you’ll need a set of directive line utilities for compiling software. You have two options:

    1. Install Xcode for free from the App Store and then use Xcode to install the Instruction Line Devices package
    2. Install only the Guideline Line Contraptions package from an unofficial (non-Apple) source

    If you would rather play it safe and stick to spil many trusted sources spil possible, or if you project to make use of the Xcode IDE, go with the very first option. If you’d rather save some disk space and don’t mind using a widely used – if unofficial – source, go with option two.

    Option 1: Install Xcode and Guideline Line Devices

    To get commenced using this option you will need to install the Xcode. Xcode is a free download from the Apple App Store.

    Next you’ll use Xcode to install the Instruction Line Implements. Launch Xcode and then click the Xcode>,Preferences spijskaart voorwerp. Click the Downloads tabulator and then click Install next to Directive Line Devices.

    If the text next to Xcode Instruction Line Contraptions says Installed, carry on to the next step.

    Option Two: Install just the Instruction Line Devices

    If you would like to install only the GCC Guideline Line Contraptions you can download the package for your version of OS X here.

    Simply run the setup package after downloading and step through the installer.

    Downloading the Mining Proxy

    The original Stratum Mining Proxy project wasgoed created by Slush, who also runs one of the more popular mining pools and is very involved ter the Bitcoin community and development, from proposing the concept of pooled mining to proposing the Stratum protocol.

    However his original project is for Bitcoin miners and pools only. Te order to support both Bitcoin and Litecoin mining you’ll want to refer to this fork which includes support for the scrypt algorithm used by Litecoin. You can either download the latest source spil a zip opstopping or use Git to clone the repository.

    Installing Scrypt (Litecoin) Support

    If you downloaded a zip verkeersopstopping of the mining proxy source rather than using Git to clone the repository, samenvatting the zip opstopping contents by double-clicking.

    Next, open Terminal.app from the Applications folder or using Zoeklicht. Use the cd directive to navigate to the mining proxy source. For example, if you downloaded the source spil a zip verkeersopstopping:

    Next, switch directory to the Litecoin scrypt module:

    Ultimately, install the scrypt module for Litecoin support:

    sudo python setup.py install

    Installing the Stratum Mining Proxy

    Now, te the Terminal app window switch the working directory back up to the root of the mining proxy source:

    And eventually install the mining proxy:

    sudo python setup.py install

    Using the Mining Proxy

    Once the mining proxy is installed, using it is fairly straight forward. Normally your Bitcoin or Litecoin miner connects to a host and port with a specific username and password. For example:

    minerd -o http://pool-host:pool-port -u pool-username -p pool-password -t thread-count

    With the mining proxy you’ll want to very first run the proxy itself, connecting to the pool’s host and port:

    mining_proxy.py -nm -o pool-host -p pool-port

    If you are mining Litecoins, use the -pa parameter:

    mining_proxy.py -nm -pa scrypt -o pool-host -p pool-port

    Then run your miner, but specify your rekentuig’s IP address and the port number reported by the mining proxy output:

    minerd -o http://your-ip:port-from-output -u pool-username -p pool-password -t thread-count

    Other Benefits

    There are a duo of other benefits of the Stratum Mining Proxy that are worth noting:

    1. The mining proxy supports both Getwork and Stratum clients. This means you can use the proxy to consolidate network traffic regardless of the mining protocol.
    2. Using the mining proxy gives you a ordinary way to get a heads-up view of which machines are alive and which are submitting accepted work by referring to the Terminal output.


    To learn more about mining Bitcoins and Litecoins on OS X, see my previous blog posts:

    My previous article on Litecoin mining I discussed how you can get began mining Litecoins, an alternative to the Bitcoin crypto-currency, using your spare CPU cycles. If you’re GPU is already mining Bitcoins, using your CPU to mine Litecoins may be an visible choice. However, if you are “all in” on Litecoin then you can get a sizable show increase by using your GPU to mine Litecoins. Whether that trade-off is worth-while is a decision you would need to make. Litecoin is not spil mature spil Bitcoin and is just spil volatile. Some see it spil a fated clone, others spil the next Bitcoin, poised to take off.

    GPU Mining

    Ter order to begin using your GPU to mine Litecoins on OS X, you’ll need to very first install cgminer or bfgminer. Please read my previous article on Bitcoin mining for step-by-step instructions and installation packages for cgminer and bfgminer. The Homebrew formulas I collective ter my previous article include the configuration settings necessary to mine both Bitcoins and Litecoins. If you are compiling the applications yourself, make sure to use the –enable-scrypt parameter when running ./configure.

    Armed with a copy of cgminer or bfgminer with scrypt enabled, you can now commence mining Litecoins with your GPU. Now a fair warning: finding a nice set of parameters for mining Litecoins with cgminer or bfgminer is far more finicky and time consuming. With Bitcoins you can basically run either miner and just specify your pool. The miner will then tune itself and eventually reach a nice hash-rate.

    This isn’t indeed the case with using either miner to mine Litecoins. For example, if I use the following guideline line to mine Litecoins using my ATI 5770. Note that I am using the -d parameter to specify which GPU to use to simplify thesis examples.

    cgminer –scrypt -o host:port -u username -p password -d 0

    With no extra tuning my 5770 gets about 5Kh/s. My CPU alone gets around 29Kh/s. Using bfgminer with the basic command-line parameters yields similar results. Spil indicated te my previous article I use the –no-opencl-binaries to work around a crash te bfgminer with numerous GPU’s on OS X.

    bfgminer –scrypt -o host:port -u username -p password -d 0 –no-opencl-binaries

    So how can wij get better voorstelling mining Litecoins on the GPU? The very first parameter to concentrate on is the -I parameter, or the energy. With Bitcoin this parameter does help, but honestly not a ton. If you aren’t using the PC, and you leave the power at “Desktop” (-I d), both cgminer and bfgminer will eventually reach around the same show you’d get by specifying something like -I 9.

    This is not the case with Litecoin mining. With scrypt (Litecoin’s hashing algorithm) you need to specify a high force, te fact higher than is suggested for Bitcoin. I’d begin at around Ten and go up from there. On my system, 15-16 is about the best I can do.

    So lets attempt cgminer with -I 13 to see what that does:

    cgminer –scrypt -o host:port -u username -p password -d 0 -I 13

    That switch alone triples the Kh/s, but from 5Kh/s to 15Kh/s honestly isn’t much to brag about. Let’s attempt with bfgminer:

    bfgminer –scrypt -o host:port -u username -p password -d 0 –no-opencl-binaries -I 13

    Similarly I get around 14Kh/s using the -I 13 parameter with bfgminer.

    The next parameter to concentrate on is the -w parameter, which specifies a worksize ter multiples of 64 up to 256. This parameter is what truly makes a difference on my OS X equipment:

    cgminer –scrypt -o host:port -u username -p password -d 0 -I 13 -w 64

    Now wij’re cooking with Crisco! Using -I 13 -w 64 on my 5770 gets mij from the original 5Kh/s up to 83Kh/s with cgminer. And with bfgminer?

    bfgminer –scrypt -o host:port -u username -p password -d 0 –no-opencl-binaries -I 13 -w 64

    This gets us up to around 80 Kh/s with bfgminer spil well. By removing the -d parameter so that both GPU’s are used and cranking up the -I parameter to 16 I can get my GPU’s up to around 230 Kh/s:

    cgminer –scrypt -o host:port -u username -p password -I 16 -w 64

    The last parameter I want to note is –thread-concurrency. If cgminer or bfgminer are reporting hardware errors (the HW number ter the output) this indicates that you need to make use of the –thread-concurrency parameter. Thesis are not hardware failures. You can find guidelines for the value to use here:

    57xx cards: 2368-4096 (3200 is common)

    58xx cards: 4096-8192 (5600, 7168, and 8000 are common)

    5970 cards: 4096-8192 (5632 or 8000 are common)

    67xx cards: 2368-4096 (3200 is common)

    68xx cards: 3008-6720 (4800 is common)

    69xx cards: 4096-8192 (5600, 7168, and 8000 are common)

    6990 cards: 4096-8192 (5632 or 8000 are common)

    7xxx cards: 64 * bus-width-of-card-in-bits. So, for a 7950, that would be 64 * 384 = 24576. Ideal values are 21712 or 24000. Find your bus width here.

    I verified that 3200 works well with a 5770 and 4800 works well with a 6870.


    And that about covers it for my series of articles on mining Bitcoins and Litecoins using Mac OS X and Apple hardware. The growing landscape of crypto-currency is fascinating from many perspectives. If your rente is piqued and you are running OS X, hopefully you now have the information you need ter order to get commenced mining this fresh form of currency.

    Leave a Reply