11/20/2016

How to change the SSD of Mac Book Pro Late 2012

I bought my Mac Book Pro with the best parameters at its time - CPU, GPU - Video Card, Maximum allowed RAM Memory 16GB, but the only thing I made a compromise was the SSD. At that time to buy 512 GB instead of mine 256GB would cost me additional £600. I remember the overall price of the laptop was £1700 with student discount (I was a student in the University of Bristol at that time), otherwise would be more than £2000 (can't remember how much exactly). Anyway the compromise was made and after just a couple of months it proofed itself to be very a bad one - too little space - this means nothing except programs and VMWare - Windows 7 (with Microsoft Development Package Visual Studio, SQL Server and so on) and X-Code. It was a struggle. I am a Software Engineer and usually use my laptop only for work but still I wanted to listen to music, edit home videos and other staff.

In 2014 I bought this storage expansion card - SDHC:


from Amazon. That was quick and cheap solution 128GB for 80 USD.
So now I could actually store images, videos and music. But it was slow and not as fast as SSD and for sure not useful for running applications directly from there.

The last option for me was fixing the actual problem - change of SSD. That was difficult choice as it was not officially done by apple.

After a lot of googling around I decided not to do it. This year - 2016 after I sow the new MacBook pro's - the fact that they still have 16 GB RAM, not so much better processors and most importantly the price was close to 3000£ if I wanted better components, I decided I will try to postponethat buy for some years.



So my next step was - go to amazon buy SSD and change it yourself.

It was £450

Then it turns out that is quite an easy process - everything is written as part of the instructions that are coming with the memory. First from system recovery mode copy the OS on the new SSD. Open, Replace and you are ready. It turns out that is exactly this. Do not be afraid!

Some pictures of my mac during the process:

Step1: place it and prepare for change so that each screw can be placed next to it's positions. The screws are 3 types (I am not sure), so not to care place them next to the whole where they have to go to.


Step2: Remove the screws and clean the dust with cotton buds. If you have never open your mac you will find a lot of staff in there.





That was it. After I replaced the SSD I careful put back the screws in their exact positions and all done. It was working fine, although it took some time for the spotlight search to reindex the files - couple of hours. Since then it was running absolutely fine. It is worth testing with Disk Speed Test - software for mac before you change your SSD and after - to compare if the new one is slower or faster. For me (Mac Late 2012) it turns out that there is no difference. Just when you test make sure you have not much running apps - so that the whole RAM can be used to test the SSD.


I know that 2016 Mac's have some unbelievable Read and Write Speed of their SSDs, but till the price is that hight I will be waiting for some years again before making change.

That's my Mac Now - from 256 GB to 1 TB:


Hope you get just a little inspired and go and change the SSD instead of selling what you have and buying a new model for more than £3000.

4/09/2016

My first lego Mindstorm Ev3 console app

It was interesting experimenting with the intelligent brick and the software that comes with it. (EV3 PROGRAMMING SOFTWARE (PC/MAC))
Much more interesting is to get a library which allows .net developers to write c# code to "talk" directly with the device.

The library https://github.com/velchev/legoev3 is available in github but also there is a nuget package for that.

Here is my simple first app: https://github.com/velchev/LegoMindstormEv3

Now is an initial setup that moves a servo. I will try to modify it so it executes commands from the command line will see how it goes.

10/12/2014

Bootstrap Modal Dialog - Loading Content from MVC Partial View

Original content - my post in code project. From there you can download and the source code.

Introduction

I will show a simple way to display the content of partial view in a bootstrap dialog. I will also show how to fix the dialog doesn't appear issue after 3.1.0 version. There is no need to write additional Ajax calls - this is handled internally by Bootstrap.

Background 

When you have a list - table of data and want to add a record, it's one of the better ideas to use a modal dialog - just because there will be no need to go to another page. Also for the deletion of records - confirmation could be done using bootstrap modal dialogs. There are many other places where you can use modal dialogs.
I saw online many different ways to create modal dialogs... many bad ways like: 
1. Creating all dialogs on the page and then just show or hide them using JavaScript. This means adding partial views to a page - render all the information and then if the user needs to see the dialog - it will appear.
2. Making Ajax calls to display the content. This means for every dialog a call .... not effective. It is better to use a library for that.
The question now is how to do it in a nice and simple way?

  • On the main layout, you need to have a modal container - the place where the dialogs will be loaded.

  • Set some styles - I have put that in the main layout just for the example, but you can put it in the correct place in your project.
  
    </style>   -->

  • Add JavaScript - this will make an Ajax call internally and will inject the partialview content into the modal container.

<script type="text/javascript">
        $(
function () {
           
// Initialize numeric spinner input boxes
            //$(".numeric-spinner").spinedit();
            // Initialize modal dialog
            // attach modal-container bootstrap attributes to links with .modal-link class.
            // when a link is clicked with these attributes, bootstrap will display the href content in a modal dialog.
            $('body').on('click', '.modal-link', function (e) {
                e.preventDefault();
                $(
this).attr('data-target', '#modal-container');
                $(
this).attr('data-toggle', 'modal');
            });
           
// Attach listener to .modal-close-btn's so that when the button is pressed the modal dialog disappears
            $('body').on('click', '.modal-close-btn', function () {
                $(
'#modal-container').modal('hide');
            });
           
//clear modal cache, so that new content can be loaded
            $('#modal-container').on('hidden.bs.modal', function () {
                $(
this).removeData('bs.modal');
            });
            $(
'#CancelModal').on('click', function () {
               
return false;
            });
        });
   
</script>

  • Create a Controller Action, that will return partial view.

 public ActionResult ViewLyubomir()
{
    
return PartialView("_Lyubomir");
 }

  • Create an action that will process the result of the post occurring in the partial view.

[HttpPost]
 
public ActionResult Lyubomir()
 {
    
return RedirectToAction("Index");
 }

  • Create a partial view:
   <div class="modal-body">
    <div class="alert alert-warning">
       
<span class="glyphicon glyphicon-warning-sign"></span>
        Lorem ipsum dolor sit amet, consectetur adipiscing elit.
        Donec consequat nisl a nibh tincidunt condimentum.
        Nullam in augue vitae augue dictum eleifend.
        Nunc porta fermentum metus, quis efficitur lectus scelerisque ac.
        Quisque egestas sit amet nunc in interdum.
        Etiam malesuada maximus nisi, id tempus metus.
        Vivamus at sapien ut metus aliquet sodales sed id magna.
        Integer in auctor ex. Phasellus tempor, est vel placerat dapibus,
        nulla dui tempor ligula, at pulvinar libero nunc gravida metus.
        Proin non feugiat felis. Proin ut ultrices ex. Morbi aliquet lacinia elit at bibendum.
        Nunc facilisis, neque a finibus dignissim, turpis felis vulputate diam,
        a tristique tellus nibh nec nulla. Suspendisse eget augue non turpis
        dignissim euismod eget eget odio. Donec sit amet nibh cursus, efficitur
        nibh in, sodales arcu. Pellentesque pulvinar consequat lacus ac porttitor.
   
</div>
    @using (Html.BeginForm("Lyubomir", "Home", FormMethod.Post))
    {
       
<div class="row">
           
       
</div>
       
<div class="row">
           
<div class="col-md-4 col-md-offset-4">
               
<button type="button" class="btn btn-default"
               
data-dismiss="modal">Cancel</button>
               
<button type="submit" id="approve-btn"
               
class="btn btn-danger">Save</button>
           
</div>
       
</div>
    }
</div>
<script type="text/javascript">
    $(
function () {
        $(
'#approve-btn').click(function () {
            $(
'#modal-container').modal('hide');
        });
    });
</script>
   

  • The last step is to create an action link with specific attributes.
@Html.ActionLink("Lyubomir ", "ViewLyubomir", "Home",
null, new { @class = "modal-link btn btn-success" })

How Does It Work?

On point 7 when the user clicks on the link, based on the attribute - modal-link we have an attached click event for all the links with that attribute - point 3. On point 3, the default action of a link will be prevented and the content to where this link points to will be injected into the model-container div point 1. When the user posts in the modal dialog - point 6, the data will be processed in the corresponding controller - point 5.
When you open the project - Home view has a link button - Lyubomir. Click on that and you will see the magic happening.

Points of Interest

As you can see - nice and simple, no direct Ajax calls to display the content - everything is handled by Bootstrap. Just remember the changing of the versions and how this affects the example. You can search online for that but, it seems a cosmetic issue but it took me quite some time to figure out where to apply it.