Feb 1 2023

How to map windows network share folder in a docker container

Category: — Duke @ 09:29

Note to myself: with the current docker desktop for windows version, if it is required to mount a network share (SAMBA) inside the contaiiner the following should be done

docker volume create --driver local --opt type=cifs --opt device=//networkdrive-IP/Folder --opt o=user=yourusername,domain=yourdomain,password=yourpassword,file_mode=0777,dir_mode=0777 VolumeName
docker run -it -v VolumeName:/home/Volume --name my-container ImageName

Very important: looks like that the containers (out of the box)  cannot resolve names so the ip of the server that shares the folder should be usedinstead of its network name.

Tags:

Mar 21 2021

Docker freeze my PC

Category: — Duke @ 03:45

I’ve a quite old beast pc from 10+ year ago (i7 Lynnfield 4 core – 8 thread) but apart for the slow disks it is still reasonable to use(still faster than the “modern” laptop provided by my company)

ANyway i’ve always had an issue with Docker, which made the computer unstable.

if docker is enabled, it happens from times to times that the PC freeze completely, it happens more often when media app like spotify and netflix are running.

if dev tools are open at the same time, the chances multiplies, and there is no way to recover it other than hard reboot.

After a quick search i found that is not uncommon (Docker for Windows 10 Experiencing Random Freezes · Issue #3815 · docker/for-win · GitHub)

So far i’ve

  • checked that in the BIOS the hyperthreadin is set to Enabled and not Auto (but in my BIOS the option is not available at all, it is on by default)
  • updated windows and docker to the lates stable version
  • enabled “containes” in the windows feature
  • disabled all the network adapter which are unplugged (i’ve an additional NIC on the motherboard that is unplugged)
  • disabled the Windows compatibility telemetry  (do this anyway that only such you CPU cycle and power Permanently Disabling Windows Compatibility Telemetry - Microsoft Community)

To test i’ve launched spotify, netflixh vs code and i’m enabling kube on docker desktop… looks quite stable but only the time can say. Usually the issue appear after 1 or 2 hours so it is too early to say.

Anyway i’ve posted the action list, mainly as reminder to myself of what has been tryed already

Update: the fix above mentioned seems to work very well, no more lock or freeze or bluescreen, yay!

I suspect the important part is to disable all the disconnected network interfaces, and enable the “containers” windows feature (one of the two, i bet on the network interfaces…)

Update2: now that docker works let’s use kubernetes! but what if it stucks in “starting” forever? there is this nice guide Docker for Windows - Cannot list nodes: Get https://kubernetes.docker.internal:6443/api/v1/nodes: Forbidden - Stack Overflow

that reports these steps

1. Change DNS to fixed and use 8.8.8.8, this is within docker for window's settings

2. Remove the .kube

3. Add the KUBECONFIG environment variable to System Variables and have the path be C:\Users[MYUSER].kube\config. Note that before I had it set as a User Variable.

4. Restart Docker from the Docker for Window's reset tab in settings.

5. Restart Kubernetes Cluster from the Docker for Window's reset tab in settings (you can do this a number of times).

but it is not the whole story because the important part is to DAMMIT remove the PKI folder, but looks like that docker have changed the location of the folder during the time plus maybe windows have done some magic…

basically what worked for me, apart following the quite above is

  • uninstall docker
  • delete %LOCALAPPDATA%\Docker\ (the important part i suspect is the pki subfolder) (see note)

note: i suspect that the problem is that if you have an older installation you have removed more than 60 day before, the folder rest in place but the certificate expires and don’t get renewed, for som e reason resintalling docker keeps the previous certificates, expired and it is unable to renew them. So please delete it

delete also the .Kube and .docker folder inthe user’s home (here som ref Docker crashes at start: C:\\ProgramData\\DockerDesktop\\pki\\apiserver-kubelet-client.crt not found · Issue #2935 · docker/for-win · GitHub)

delete also Docker and DockerDesktop folder in C:\ProgramData

so many shit left behind….

if you find any other kube docker or docker desktop folder somewhere delete them as with with no mercy.

then happily resintall docker, possibly with the antivirus and firewall disabled, take care to follow the steps 1,3 of the guide above

enable kube in docker aaaaaaaand…. be patient. it may take several minutes to spawn!

finally it should start!

Tags:

Jan 27 2021

The tragedy of Raspberry I2C

Category: — Duke @ 14:37

Raspberry is great, and I2C is my favorite bus.

Unfortunately the two doesn’t mix well. See, I2C support a mode called “restart” where the bus remains occupied by the master and the adressed slave, between the write and the read part, so the operation is atomic, and there is no way of other devices interrupting an important command.

I like the atomic operations most because…you cannot spell PhotoAtomic without saying Atomic! Joking… i’m a fan because i’m obsessed with the fact of being always able to track down the causes of everything. Atomic operation are an easy clean and obvious way to do it.

Usually when I2C is in the game, the slave devices are very easy, less powerfull microcontroller, where you have only few KB of ROM for the entire program.

LOL, KB… we can’t store a single icon 14KB these days.

But beware, microcontroller are very capable device. The Pic i’m using is amazing, it has many many hardware peripherials onboard and two I2C port with hardware acceleration.

AND THEY WORKS DAMN WELL (if you spend a month debugging and learning all the details of I2C protocol)

I can’t say the same of Raspberry, and this drive me crazy.

My PIC costs less than a dollar, it has hardware I2C that are rock solid, they don’t miss a single bit, they support general call, clock stretching and restart. the full damn I2C protocol!

What i’ve discovered is that a 35$ Raspberry (v1, v2, v3, or v4) is not so compliant.

I’ve spent days in hunting a bug that i tought was in my code, and i’ve debugged everything down to the wire signal with logic analyzer and oscilloscope.

After all this work i’ve discovered that it wasn’t my PIC that doesn’t release the clock stretch, but instead the Raspberry state machine that is simply bugged as hell.

there are countless issue regarding the I2C clock stretching issue on the raspberry repo, start from this

I2C Broadcom bug workaround. · Issue #254 · raspberrypi/linux (github.com)

the issue seems to be in the silicon of the raspberry SoC. So hard to fix but com’on how many of this bugged chip have broadcom sold? it is tragic that they won’t fix them

Raspberry fundation should rise the voice. Raspberry sell millions of pieces, of a device that is bord for IoT.

in IoT sensors and peripherial are of 3 kind I2C, SPI, old serial. Forget the last that can be barely called “a protocol”

I2C is versatile, battle tested, cheap to implement (only 2 wires man!) it is a VERY IMPORTANT bus for IoT.

i cannot understand how the raspberry foundation is not ashamed of selling a device to “make” IoT that isn’t fully compliant with I2C specification.

there are several way to mitigate the issue.

1) if you are programming the slave, do not use clock stretching, this basically means no restart operation so no atomic operations.

this is because usually when you transfer a command the microcontroller is fast enough to not require any additional time to write the bytes in a buffer collecting all of them without asking for extra time.

but when the commandis completed, immagine a flash ram command, it can take some time to execute (flashing a ROM in a microcontroller requires a special bit “dance” to unlock memory block, plus the information you write usually must be block aligned, this means read flom the ROM as well…which is a quite slow operation. immagine multiply by 32 (my pic block size) and you easilly need to use clock stretching to keep the bus line busy line while performing this operations.

But Raspberry doesn’t undernstand clock stretching and simply cause its state machine to jam irreversibly. Sad, very sad, not epic, we need to SLAP broadcom for this.

So the workaround is to reprogram your device by working in an asynchronous way: the write and the read part of the atomic command must be decoupled, this means a more complex code, and some correlation id to be sent in order to understand which reply is for which command. Ugly in my opinion.  i just have 14 precious kilobyte of RAM and i don’t want to waste them to adress an issue of a SoC with many Gigs of ram and as-many-as-yo-want storage in sd that are humongus these days … for 10$. This is very stupid.

2) another solution, if you cannot avoid clock stretching, is to lower the bus speed, this way you can be lucky enough to give the microprocessor enough time to process the command without the need to stretch the clock above it’s natural length. and the communication can occur…. untill you become unlucky.

so this is not a very robust solution

3) the real solution is to enable the good old bitbanging I2C driver on the raspberry. this is laughtable but it is the only way to have a reliable and compliant communication.

you can read details here i2c-bus/raspberry-pi-software-i2c.md at master · fivdi/i2c-bus (github.com)

basically you have to add to the device tree a virtual device editing the  /boot/config.txt file and adding (in the [ALL] section at the end) the following line

dtoverlay=i2c-gpio,bus=3

The use the pins 16 and 18 as reported also here Adventures in I2C: clock stretching on the Raspberry Pi – Raspberry Pi Pod and micro:bit base (recantha.co.uk) instead of the 3 and 5

In my test the bitbanging driver is rock solid and is fully compliant with restart and bit stretching.

in conclusion: i think i’ll try to implement pic firmware with a mechanism that doesn’t require clock stretching, an asyncronous read-write which is in any case a stupid idea, because flashing rom required disabling interrupt, and therefore basically software removing and re-attaching at any time the microcontroller from the I2C bus, causing an all new sort of issue. while the clock stretching was a very elegant and convienent way that doesn’t require correlation ids or strong assumption to make the communication work.

But i want my device to be raspberry compatible out of the box as much as possible, so i’ll see if my small “David” PIC can fix the mess tha the dumb “Goliath” Raspberry have done on the bus.

Shame on you Raspberry, shame on you Broadcom!

Tags:

Aug 26 2016

Old Windows Mobile devices and Windows 10

Category: — Duke @ 06:57

In case you need to work with windows mobile devices but you have windows 10 (Anniversary, in my case) there is no problem

Sync center is already installed and Windows Mobile Device Center is ready to be installed, it already sits in your disk at c:\Windows\WindowsMobile\setup.exe

But… but, some problem may arise if you have (like me) an Windows 10 N or KN

these version doesn’t have the media features like windows media player, which is required ( lol ) by the Device Center.

So first find the Media Feature Pack for N versions of Windows 10 (anniversary) and install it, or make sure it is already installed: in fact it looks like that any major release of windows 10 will destroy the media feature pack already installed bringing back windows to its N version without the added media feature, in that case simply reinstall the feature pack of your new windows version.

Then you can connect your Windows Mobile Device andif everything works, TADAA!! old windows mobile connected to new windows 10!

and if it doesn’t work?

ok that’s interesting: first start the Windows Mobile Device Center by hand at c:\Windows\WindowsMobile\setup.exe

the connect your device… and if it stay in “conenct state” but nothing happens open the windows device manager

you should see a device with a yellow exclamation mark near it.

right click and select “install driver”

this have worked for me and now i’ve the device connected and i’m able to manage it from windows 10

nice!

Tags:

May 16 2016

Turning on a led from powershell over wi-fi, i2c

Category: C# | Hardware | IoT | PIC | PowerShell | Raspberry | Robot — Duke @ 16:44

It is a couple of week i’ve started a new project, something i’ve always wanted to do, but i’ve never had time or resources or… the real will to complete it.

I’m not saying i will make it this time but certainly it is progressing.

Today i’ve reached a critic mass, something interesting and usefull enough to post about it, what the hispter and the millennials calls “minumum viable product”, it will be part of somthing bigger but i want to blog it to not forget it and, as i’ve found difficulties in it, maybe help someone else, who knows?

My project is very “hardware” oriented, something in the real “maker” area. I’m not an hardware guy, but i’ve the minimal skill required to play whit the modern electronics, that at my eyes looks like logo bricks for grown-up (while you treat them as black box).

So here is what i want to do:

I’ve a Raspberry Pi 2, a wi-fi dongle TP-link TL-WN725 (i also have the EDIMAX EW-7811Un but doesn’t work well with Win 10 IoT yet)  and the latest build of Windows 10 IoT (v.10.0.14328.1000, apparently, longer version are better….)

Then i’ve a breadboard, a bounch of headed cables, resistors and a led, plus a PIC16F18325 (in a PDIP14 package)

To complete this mini-lab i’ve a mini dso 203 oscilloscope and of course a PicKit3 programmer for the PIC

I want to type a command in my computer (any of the my computers) and have a led turned on or off, but not by the raspberry, on the PIC microcontroller instead.this because i’ll later need some of the advanced capabilities on the PIC, but for now for educational and demonstrative purposes, the led is well enough.

so my setup is the following:

image

So from wherever am i, i want to turn on that led with a command on my shell

that’s a lot of protocols and OS and software and languages together, from the very high level powershell to the closest possible to the metal +vcc signal,

I know, i know, it is called Internet Of Things, and it has already been invented by someone else, but who cares? I want to make my very own IoT.

so, first thing first:

Today we will cover how to connect from my pc to a raspberry who has in turn Win 10 iot on. If you are intereste on how to install Windows 10 Iot, the excellent Scott Hanselman has a blog post for this.

so i want to open powershell a type a command to connect to my raspberry, Win 10 IoT is already configured to receive powershell session (WinRM is turned on by default) all you need to know is your raspberry name and the root user’s credential

i’ve then a module called Connect-Raspberry.psm1 which loads automatically any time i open a PS session (thanks to an import-module in my $psprofile)

the code of the module is the following

$knownRaspberry = @{Jeeg=@{Username="Administrator";Password="mysecretpassword"}}

function Get-CredentialObject([string] $username, [string] $password){ 
    $encryptedPass = ConvertTo-SecureString $password -AsPlainText -Force 
    return new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $encryptedPass 
}

function Connect-Raspberry([string] $machine, [string] $username, [string] $password){    
   

    $trustedHosts = get-item  "WSMan:\localhost\Client\TrustedHosts" 
    if(!($trustedHosts.value -contains $machine)){ 
        Set-Item WSMan:\localhost\Client\TrustedHosts -Value $machine -Force 
    }

    if($machine -eq $null){ throw throw [System.IO.Exception] "Please specify Machine"} 
    if($knownRaspberry.ContainsKey($machine) -and (!$username) -and (!$password)) 
    { 
        $password = $knownRaspberry[$machine].password; 
        $username = $knownRaspberry[$machine].Username;        
    } 
    
    if($username) { 
        $username = "Administrator" 
    }    
    if(!$password){ 
        $cred = get-credential -Message "enter password" -UserName "$machine\$username" 
    } 
    else{ 
        $cred = get-CredentialObject -username "$machine\$username" -password $password 
    } 
    ############## 
    #the following line is an hack to workaround a bug, maybe in the future will not be required 
    #remove-module psreadline -force 
    ############## 
    Enter-PSSession -ComputerName $machine -Credential $cred 
}

 

if it is the first time you run it you may need to run as administrator as it will set the trustedhosts for the WSMan\client to trust the raspberry

given that i can connect to my  raspberry (it is called Jeeg as all the machine in my network have name of Gō Nagai’s robots)

connect

of course the script can take username and password but you can map in the $knownRaspberry variables all your frequently accessed raspberry

Obviously Jeeg is powered up and connecte to my Wi-Fi lan by the TP-Link Usb dongle

Now i have a shell on my Pc (Grendizer) that is actually a remote session on Jeeg and i can ask Jeeg to do anything it knows.

but now i want Jeeg to write a message on it’s I2C bus. Windows 10 IoT has the drivers, but powershell knows nothing about them.

The good thing is that Powershell understand .Net very well and that Windows 10 IoT can run .Net Universal Windows App!

so my idea was to write a simplified wrapper around the .Net API for the I2C to use as base for a Powershell Module

to do this you need Visual Studio 2015 Update 2 with the Windows 10 IoT SDK that match at best possible the version of Windows 10 IoT oon the raspberry. I’ve found that the SDK are usually a couple of versions behind the Raspberry Build but fortunately it doesn’t seems to be a problem!

so File>New>Project and select Universal Windows (dll)

image

you should have these references.

the wrapper’s code is the following:

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using Windows.Devices.Enumeration; 
using Windows.Devices.I2c;


namespace Bus 
{    
    public enum Speed 
    { 
        Standard = 0, 
        Fast = 1, 
    }

    public class I2CControllerAddressException : Exception 
    { 
        public I2CControllerAddressException(int address, string deviceId) 
            : base(string.Format("The address {0} on I2C Controller {1} is currently in use.", address, deviceId)) 
        { } 
    }

    public class I2CControllerFoundException : Exception 
    { 
        public I2CControllerFoundException() 
            : base("Could not find the I2C controller") 
        { } 
    }   

    public class I2c 
    { 
        private static I2cDevice Open(int targetAddress, Speed speed) 
        {

            var advancedQuerySyntaxString = I2cDevice.GetDeviceSelector(); 
            var controllerDeviceIds = DeviceInformation.FindAllAsync(advancedQuerySyntaxString).GetAwaiter().GetResult(); 
            if (controllerDeviceIds == null || controllerDeviceIds.Count == 0) 
            { 
                throw new I2CControllerFoundException(); 
            } 
            var i2cControllerDeviceId = controllerDeviceIds[0].Id;

            var i2cSettings = new I2cConnectionSettings(targetAddress); 
            i2cSettings.BusSpeed = (I2cBusSpeed)speed;

            // Create an I2cDevice with our selected bus controller ID and I2C settings 
            var I2cSalve = I2cDevice.FromIdAsync(i2cControllerDeviceId, i2cSettings).GetAwaiter().GetResult();

            return I2cSalve; 
        }

        public static void Send(int targetAddress, Speed speed, byte[] message) 
        { 
            var device = Open(targetAddress, speed); 
            device.Write(message); 
            
            device.Dispose(); 
        }

        public static byte[] Receive(int targetAddress, Speed speed, byte[] message, int expectedReplyLenght) 
        { 
            var device = Open(targetAddress, speed); 
            var reply = new byte[expectedReplyLenght]; 
            device.WriteRead(message, reply); 
            device.Dispose(); 
            return reply; 
        }

    } 
}

 

complie it and you will have a nice i2c.dll file

that is almost enough to play with the i2c bus from the command line.

why almost? because this file reference the System.Runtime.WindowsRuntime that you have to find out where it is, it will not copyed in the same folder of your dll, it is not the same mechanism of the old projects where you can specify “copy local”

the best way i’ve find is to make an universal windows app (.exe) wich refers this assembly and compile it, in the binary folder you’ll find also the the System.Runtime.WindowsRuntime.dll you need

 

now open the file explorer and type \\Jeeg\C$

you’ll see the “Jeeg” C disk, copy both the assembly in the path

\\jeeg\c$\Program Files\WindowsPowerShell\Modules\i2c

(you need to create the I2C folder of course)

so you will have the following

image

and you are ready!

from your remoted session on Powershell just type

Import-module i2c

to load the module and be able to send and receive date on i2c using powershell

and this ishow you send a command on the i2c bus

[bus.i2c]::Send(8,[bus.speed]::Standard,[byte[]](0xAA))

this command for example sends (master write on server, in the i2c terminology) on the address 8 the byte 0xAA, using the standatd speed (100KHz)

Raspberry is also able to use the fast mode (400KHz)

I2C has also two speed,Full Speed 1MHz and High Speed 3,2MHz but Raspberry is not able (at the moment at least) to use these speed, in any case the PIC16F series doesn’t have enough processing power to handle these clocks, i think it is necessary at least 16bit PIC to work with these speed, but i’ve not investigated.

 

next time i'll talk about the PIC firmware, that's the most interesting part to me and there are many tricks that may be useful to any hobbist that may face these topics for the first time :)

Tags:

Nov 5 2015

Claning VisualStudio build files with PowerShell

Category: PowerShell | Visual Studio — Duke @ 09:23

These days i've starting using PowerShell, it is a pleasure!

it is a long time that i want to learn PowerShell and finally i've found some occasion to give it a try.

It is like a drug, i can't stop using it!

 

despite the fact that my company have lent to me a new laptop, a shiny i5 with SSD disk, this new hardware has a 128GB disk, that it is ok for the OS only in these days.

Considering that my phone has 32 and my next one probably 128... basically i'm doing my company business by phone :(

ok stop ranting and let's go to the point.

i've to clean all the cap that VisualStudio 2010 produces when compiles.

I've a big solution with 70+ projects, belive me or not, the amount of DLL plus OBJ and pdb it produces it is more or less 400Mb some day more some day less

 

then i've created this nice script

dir -Recurse -Attributes Directory |`
 where -Property Name -ne 'Packages' |`
 dir -Recurse -Attributes Directory |`
 where {($_.Name -match 'bin') -or ($_.Name -match 'obj')} |`
 remove-item -Recurse -force


dir -Recurse -Attributes Directory |`
 where -Property Name -eq 'TestResults' |`
 remove-item -Recurse -force

basically it starts from the root you launch it in and search for all the BIN or OBJ folder not under packages (in great respect of nuget) and delete the entire hierarchy under BIN and OBJ

it frees up a lot of space and it took me 5 minutes to write it.

 

I LOVE POWERSHELL!

 

Tags:

Sep 23 2013

Extending extension methods

Category: — Duke @ 08:25

C# has extension methods, and together with lambdas they provide an incredible amount of power in our hands.

They way extension methods are implemented is very smart and makes them measy to write new ones, and even better, they provide a superior ide integration.

That’s all fantastic, but sometime i’ve found myself in the situationwhere i have to Extend the extension methods.

Let me explain my problem: consider a a program that makes use of linq over the abstraction of the unit of work. That is really really cool because if you write your generic UOW, you are basically decoupling your logic from the hard implementation of the database.

This saved me one time already, with this system i was able to switch from Oracle to SqlServer in minutes, literally, without chaning any of my business logic code.

That was easy because i was using NHibernate that already implements query providers for all the databases and dialects that i was interested to use at that time.

Now I have a new problem. I want to have the ability to switch between RavenDb and ordinary Sql databases.

Obviously the  query provider are different, and i want to have the ability to switch without hard modifying the dependencies of my project

i want to depend al my code just on my persistence layer, and this in turn have to map to the correct provider

I also want to not change the persistence code to accomodate a new provider, basically i want to plug insupport for new query provider without recompiling, at the extreme i just want to drop a dll in a folder and set up a new connection string in the config file.

Possible? Yes!

i’ve wrote a little helper project based on MEF that discovers new mapper and provides usitilities to plug them into your own set of extension methods, so all your code uniquelly depends by your persistence layer with no dependencies to particular implementations of the db.

It will up to you to provide the correct mapping for all the extension methods you want to support, or simulate them (in case of async method for example) or throw exceptions and handle the situation in your business logic code.

 

the trick is simple, let’s say i want to implement the SingleOrDefaultAsync method for all the provider i want to support.

I want to just write something like this

public static class QueryableAsyncExtensions 
{ 
    
    public static Task<TSource> SingleOrDefaultAsync<TSource>(this IQueryable<TSource> source) 
    { 
        return Extensions 
            .Of<IQueryableAsyncExtensions>(source.Provider.GetType()) 
            .SingleOrDefaultAsync<TSource>(source); 
    } 
}

 

and i want that the system automagically find outs all the mapper that implements IQueryableAsyncExtensions and for these one, pick the one that has the same provider of source.Provider

finally on this it will have to invoke the method i want as extension method, in this case SingleOrDefaultAsync<TSource>(source)

the implementation maybe something like

 

[Export (typeof(IQueryableAsyncExtensions))] 
[ExtensionMetadata(Provider=typeof(IRavenQueryProvider))] 
class TestExtensionForQueryableAsyncBool : IQueryableAsyncExtensions 
{

    public Task<TSource> SingleOrDefaultAsync<TSource>(IQueryable<TSource> source) 
    { 
          //Call the native RavenDb’s SingleOrDefaultAsync here

    } 
}

Note that  you have two attributes that decorate this class: one is the usual MEF Eport attribute, the second tells to the library for which provider this extension implementation should be used for

Tags:

Jul 24 2013

Null safe accessor

Category: C# | Visual Studio — Duke @ 06:54

It is happened to me many time to have to accesso a long hierarchi of object just to display a value to the user, and possibly this hierarchy contains null values

So the case is a.B.C.D.E.F where a is my object reference B, C, D, E are child of a in a long hierarchy of property accessor, and finally F is a simple integer o a string that i don't care about but the user want to see (if present)

 

It turns out that some languages have the so called  Groovy's safe dereferencing operator  (see http://stackoverflow.com/questions/10815641/elegant-way-to-avoid-nullreferenceexception-in-c-sharp)

but C# have not :(

 

Stack overwlow is full of smart solutions, some very elegant (see some here http://stackoverflow.com/questions/4244225/c-sharp-if-null-then-null-expression) but allof these are in someway suboptimal

 

the one i like more is

 

bossName =Employee.NullSafe( e => e.Supervisor).NullSafe( s => s.Boss).NullSafe( b => b.Name);

 

but is too verbose :(

 

so i've ended up with an alternate solution (that cames in two flavours to tell the true)

More...

Tags:

Jan 22 2013

Many news!

Category: C# | General — Duke @ 16:55

Wow! these are busy days! full of news and awesomeness!

First things first! finally i managed to get hold of a new domain name for my site PhotoAtomic.com

Thanks to everyone who have supported me, expecially Lilla <3

 

Second: i've published a new project on codeplex about setting the precision of decimal numbers. It is quite Amazing to me how many people have downloaded it in 4 days... SyncWcf was much more slower...

probably people prefer simple project?

Anyway i'm happy, i've also started working on a new electronic project and i'm Learning lot of things (a nice way to say that nowthing works as intended for now... but it is proceeding quite well, i've to say!)

Stay tuned probably i'll post something in the near future about this project!

 

Busy days... i love these!

 

Tags:

Sep 10 2012

Recover the windows 8 bootloader

Category: — Duke @ 16:45

Yesterday I was preparing a laboratory pc that has windows 8 installed.

In the lab I need windows 7 to work with some tools not yet ported to windows 8, so I decided to setup a .VHD and install windows 7 on it.

-Dual Boot will make the trick and I will be able to choose the operating system trough the beautyful windows 8 bootloader interface “bootim.exe”

True, but the sad part of the story is that once I’ve installed windows 7 the beauty win8 bootloader was replaced by the old and crappy windows7/vista bootloader

Too bad!

I’ve tried several thing: recover mode, bootrec/fixmbr; bootrec/fixboot etc… in all the order that cames into my mind also

nothing.

at the end I figured out how to replace the win7 bootloader with the new win8 bootim, and it is much more easy than I’ve thought

  1. coold boot the pc, so the windows 7 bootloader will pop up, you should see multiple choice anyway, one for each OS installed
  2. select windows 8 and at that point press F8 to have more tool
  3. once in the tool page the first choice should be Repair, choose it
  4. NOW bootim will popup in all its graphical glory, navigate to more options ad find the command console, then start it
  5. now you are in the windows 8 recover model, and it is great, you should be in disk x:\sources or something like this( forgive me , it was late night, yesterday….)
  6. in the directory you are placed, there should be an utility called bcdboot.exe  

Now the fun part, you should notice that your usual C: disk is not in C: anymore while you are in this recover mode, for some reason I don’t want to know mine was in F:

anyway search your primary disk somewhere, it is the one that have the \Windows folder in it .

at this point run bcdboot.exe /?

The help should appear, and at the bottom of the help page there should be 3 examples, I think the right one is the first one… or the last one? who knows? certainly not the one in the middle…

so, long story short, the command should be something like this

bcdboot F:\Windows /l en-us 

where F:\Windows is the root folder where Windows 8 is installed, you can omit /l en-us option if you want english language

(useful reference page here)

lunch it and once it have finished reboot your pc

now BootIm is again at its place, ready to display your OS choice in a graphical manner.

Thanks god it had worked, and I was able to go to sleep!

Tags: