Monday, September 5, 2016

Clone SSD to larger SSD, and how to fix Windows 10 afterwards...

Once in a while, one needs new challenges. Or one simply buys a new SSD drive because she likes the idea of more hard drive space. Big mistake?

As you might have already guessed, I recently acquired a Crucial 750GB SSD drive to upgrade my Lenovo u430 touch machine. The plan was to "simply clone the old SSD to the new SSD", so I got myself a "SSD to USB adapter" and connected the empty drive to my machine. There are various tools out there which claim to be able to clone the drives, but none of them worked for me. Booting into (USB-)Ubuntu, I opened up GParted and noticed that my old SSD already had 8 partitions, some of which could not be read properly...

Long story short, I ended up formatting the new SSD into a GPT (not MBR!) drive, created the same partitions (just allocated a bit more space to the main ones) and, after chatting with a friend, who mentioned the "DD"-command to me (learn something new everyday, right?) cloned all partitions from old drive to new drive, partition by partition, like sudo dd if=sda1 of=sdc1. 

Worked like a charm (at least that's what I tought). I switched drives and fired up the machine - only to run into a BSOD. First it said something like winload.efi was missing, but didn't allow me to enter recovery, later on I was getting the dreaded BDC files missing or corrupted message. 

I figured out I could use the original SSD to get into recovery, but that didn't help much, so I'll just skip over the next 24 hours. By then, I also had issues on the old SSD - I couldn't use the bootrec command any more to fix the MBR / Boot sectors.  That's when I (accidentally?) disconnected the new drive while working in recovery - and voila, seems like bootrec has issues with two drives (probably with similar volumes). I managed to fix the original SSD like this:

bootrec /fixmbr
bootrec /fixboot
bootrec /scanos
bootrec /rebuildbcd

Since I figured that I won't be able to use the old SSD's recovery console to fix the new one, I finally created a recovery / installation disk (I didn't have any disk / USB media holding a Win 10 installation, so I googled the Microsoft Windows Media Creation Tool and used it to create a recovery DVD). 

Now the bootrec /fixmbr, bootrec /fixboot and bootrec/scanos worked, but I couldn't manage /rebuildbcd to complete successfully (it couldn't access the drive somehow, claiming it couldn't find the required system device). I tried it all, bcdboot, diskpart, renaming drives, chkdsk, you name it.

Some more googling, and someone mentioned somewhere that it could help to boot the installation media dvd (U)EFI version instead of the (legacy) CD-Drive. I gave it a try and voilĂ  - bootrec /rebuildbcd finished without any complaints. Reboot, done. If only someone had told me earlier to use this damn disk, would have saved like a week of work, aggression and frustration... :-D

Saturday, July 16, 2016

How to reanimate dead Leonovo u430 touch

So I opened up my Lenovo Ideapad 430 touch today because I wanted to check whether my new SSD drive would fit in. When I reassembled it to transfer the data, I connected it to power and nothing happened. Not even the A/C light came on.

Since I didn't screw back all the screws, I opened it up again and put everything back into place (suspecting it was something to do with anti static precautions, but what do I know of physics...)

Well, it didn't help, and I got kind of freaked out. I googled and found nothing, except a fairly old entry about ThinkPads mentioning the Power Button.

Out of some kind of weird thought I pressed the Power Button for like 15 seconds - and a light came on. Pressed it again, and the machine came alive. [I'll spell the Power Button with Caps from now on since it is the HOLY Power Button obviously.]

Tech guys will most likely laugh at me now, but since I read nothing about this (and since I'm really glad I don't have to get a new Laptop or go ask some guys for help) I decided to share.

Friday, February 5, 2016

Eureka! Intel N 7260 Issue Appears To Be Solved

For a while now I've been having annoying trouble with my wireless adapter (Intel N 7260 - yes, I know it is known to cause trouble...). Not only did it not connect properly, it broke the wifi and the internet connection of the router in a way that no other device in the network could access the internet any more.

I might just have discovered another possible cause: And guess what, Windows took me there. I know, right? So, this is what I did (I am on Win 10 right now):

- It did not connect properly, as usual (for me this only happens when at home, where I am using a Speedport W 504V router) - so I ran Windows "troubleshooting" (right-click on the wifi icon in the task bar to get there)
- It told me that there was an issue with a network protocol missing on my machine (which is rather ridiculous)
- BUT at the bottom of the window it offered me a link to detailed information about the issue, which took me to a quite detailed troubleshooting report
- This report lists all kinds of information about the device, known networks and available networks, and at the very bottom something very interesing was laid out to me, which confirmed my suspicions: My wireless adapter is not compatible with the router (access point). Go figure. Well, anyways, not like it was configured. Turns out that Windows 10 has quite detailed energy management settings, which seem not to be compatible with all network access points.

To solve the issue: Right-Click the battery icon in your task bar, open energy management. Go to your active energy management mode and click "change settings" and click on "change advanced settings". Go to your wireless device, and check if both battery and a/c-mode are set to medium.

The theory has yet to be confirmed after an extended testing period, but for now, it works!

Thursday, January 29, 2015

Galaxy S5 Lollipop Update Issue

Disclaimer: getting anything wrong with flashing might brick your device - this is not a manual. I am not responsible for any damage to your phone or data... 


So I finally checked the software update availability on my Samsung Galaxy S5, and guess what - the Android 5.0 update was available. Finally. I cleared up some space on my phone (it claims that it needs 3 GB of free space for the installation) and started the update. It is a big image (1.4 GB), so it takes a while to download, then the phone shuts down, restarts, and starts to install. I started wondering when the installation process started at 25%, went down to 1, up to 20, 30% and then - "error". Phone restarts, everything OK except for the fact that I still have KitKat on my phone.

Tried again. Same result. Tried again. Same result. Googled it. No results. Nobody seemed to run into that same error. There was indeed an error message after the phone restarted successfully - "Try it again, try Kies or go to a service center" (I paraphrased). Service center? Nope, no time, plus I got the phone in Germany and I wont be in Germany for quite some time.

So I tried Kies. Downloaded the software, started the firmware upgrade - download interrupted at some point. Tried again. Tried again. Tried again - it started the installation process on the phone, finally. But it stopped at about 80%, complaining about the size of the image.

Again, no real help on Google. I read something about that you could run into trouble if you made modifications to the ROM - my phone is NOT (yet) rooted, everything as I got it, I updated everything there was to update.

Kies suggested an emergency recovery. I tried that. It stopped at like 80%, leaving me with a phone I couldn't even get into recovery mode. Kies suggested emergency initialization - meaning that all data would be lost. Nah, I wasn't that desperate yet - download mode was still working!

After some thinking I decided to flash that thing myself. I got Odin and the current firmware (I decided to go for 5.0 right away) from SamMobile (I checked the exact version of my phone under the battery pack and selected "Germany" as a country), unzipped the file, and started flashing. Some minutes later the installation completed, the apps were updated and my phone back to business. No loss of data.

Thank you, Samsung, for nothing. The only reason I could think of that might have caused this issue is the regional differences. I am using the phone with a foreign SIM card, in a foreign country - probably a wrong ROM was selected by the general Samsung update process. Somewhat embarrassing...


If you run into update issues with your Galaxy S5, consider flashing with Odin right away. Might save you some time and energy.

Saturday, May 17, 2014

Pi Access Point with RTL9182CU-Adapter

Well, I tried a long time and this is mainly a note to myself:

go here first:

then go here:

you do not need to fix the Invalid Argument error, just apply the WPA-Supplicant fix from here:

Friday, September 6, 2013

Something about LaTeX...

Currently I am writing a paper in LaTeX, using Eclipse as an editor and jura as the document type. The paper is restricted to 20 pages, and both the page format and the tracking, as well as the line spacing, are defined and cannot be played with.

I spent some time fiddling with the jura files to get more space, and I came across some interesting possibilities (at least I think they are). As I found nothing on them on the internet I thought I'd share it with you, even though this might be very specific to the _old_ jura package which still had the alphanum.sty file (just found out that there is a newer version of the jura package which even has comments, the alphanum.sty is included in the jura file - you can obtain it here - the regular jura package is part of the texlive and miktex distributions).

As a result of my research, I found out how to achieve so called runin headings:

A.I.1.b. This heading likes to stay in the text
and this is the content. It used to start only in the next line.


A.I.1.b. This heading likes to stay in the text     and this is the content, starting right after the heading.  

One might ask why one might want to use it like this when there is a way to skip the text of the heading and just use the numbers. But sometimes, papers tend to get complicated, especially when you are forced to take out free lines - it just gets messy. So, a little structure can be created by including heading texts. This is what I think :-D

- Accessing the critical files, alphanum.sty and jura.cls, in the first place
- Editing the short heading format (toc* and sub*)
- Adjusting the space before and after the headings.
- Getting the text to be in line with the long heading

Accessing the files

For all of the other tasks we'll need to edit the alphanum.sty file. Find out where your alphanum.sty file is located by checking out your LaTeX log file, it should point you to the correct directory.

This goes for all of you: Create a backup of the file. Open it with your normal user through your file browser, copy the contents to a new editor window, save it somewhere.

 ... on Linux:

Using texlive on Ubuntu 12.04, you'll probably find it in something like /usr/local/texlive/2012/texmf-dist/tex/latex/jura/alphanum.sty. Remember, to edit it you'll need sudo, your normal user will be able to view it, but cannot edit it.

For GUI users: If you don't know how to handle this -

Open the file in an editor with sudo rights. To do this...
    1. Press ctrl+alt+t - a terminal window should open
    2. Type sudo gedit <path to your file> and hit enter
      (you could use any other editor as well)
    3. You'll be asked to enter your password. Type in your password, don't be confused - you won't see any characters or asterisks while typing. Hit enter
    4. A new text editor window will open. Do not close the terminal. 

... on Mac:

I won't explain this in detail, if you want to know, just leave a comment. It is similar to Linux, probably a different editor. I simply used vi to edit the file.Thus, in a terminal window, enter sudo vi <path to your file> and enter your password.

... on Windows: 

Open the command line as an administrator user. To do this, search for cmd and either hit  ctrl+shift+enter or perform a right click on the menu entry and select "Run as administrator". Confirm the request to run it as an admin. 
I am not very used to using the Windows cmd, but this worked for me - just enter the path to your file. In my case, this was C:\Program Files\MiKTeX 2.9\tex\latex\jura\alphanum.sty. You can use tab to autocomplete the path. Once you entered the path, just hit enter. Windows should open the default editor. 

Editing the short heading format (toc*{} and sub*{})

The jura package provides a short heading format, which will only display the heading number in the main matter, the full heading will be in the table of contents. I found this pretty convenient as it saves a lot of characters. But by default, the numbers are pure text, and I wanted them to at least be bold, so that they can be spotted easily. To achieve this I added \textbf or \bfseries to every heading in my first paper, because I did not know how to edit all of the entries at once. 

But now we found our config files - alphanum.sty! This is where all the magic happens. So, open the file as explained above, and look for a line that says \newcommand*{\J@ShortToc}[1]{\stepcounter{lvl\alph{tiefe}}\J@Number. To get a bold faced heading number for the short format, just add \textbf{} around the number - the line should now look like this: 

 Save and enjoy.

Adjusting the space before and after the long headings

By default, long headings leave quite some space before and after them. Not good for papers with a page restriction... But this can be fixed. Open the alphanum.sty again and look for this block of code:

{\ifnum\value{tiefe}=1 -4ex plus-1,5ex minus-0,ex\else
-2,7ex plus-0,8ex minus-0,2ex\fi}
{\ifnum\value{tiefe}>7 -1em plus-0,5em\relax\else
0,6ex plus0,3ex minus0,1ex\fi}

"Tiefe" refers to the level of the heading, thus tiefe = 1 means the first heading level. Tiefe > 7 means all heading levels higher than seven. -4ex or -2,7ex seems to be the space before the heading. Set it to zero if you like - just play around with the numbers until your file looks as you please. 

"Inline" or "runin" headings

In my current paper, I decided not to use the short heading because I did not want to put in any blank lines between the paragraphs, thus the text would not look very structured. I am using the long headings now. But the long headings have a linebreak by default - so the text after the heading will start in a new line. What an aweful waste... Just find the above mentioned paragraph again and have a look at my changes - I adjusted this paragraph (i. e. played with the numbers):


{\ifnum\value{tiefe}=1 -4ex plus-1,5ex minus-0,ex\else-0,7ex plus-0,5em minus-0,2ex\relax\fi}
{\ifnum\value{tiefe}>7 -1em plus-0,5em\relax\else -1em plus-0,5em\relax\fi}

If you feel like now it looks too tight, note that there are ways to insert space between headings you want to make look special - try \medskip or \smallskip in your .tex file (insert it before the heading).
Again, if you have any questions, just leave a comment. Hope this helped at least some of you.

Tuesday, March 26, 2013

Joomla! 2.5 / Apache: File Downloads, docx etc.

I let my users upload files and link to them in their articles. As I want to force them to download the files directly (and don't want them to view it in the browser), I am using a file called download.php which I include in the URLs.

Thus, instead of "/myfolder/myfiles/myfile.pdf" the href attribute of the link will be like "download.php?filename=/myfolder/myfiles/myfile.pdf".

In download.php I declare headers and do some things about the filename. It was always working fine for pdf or doc files, but there seemed to be something wrong with the "new" file formats of Office (docx, ppsx etc.) - if a user clicked on that file, it would be downloaded, but could not be opened (the message said something like "cannot read file"). A comparison of the original file and the downloaded file showed no difference except for one character which was not even visible. Fun fact: OpenOffice could open the file without any problems... Lots of pages suggested to check the MIME type configuration of apache in /etc/mime.types, but the docx formats were already there.

I did a lot of research and came across a post on by eonrglez at gmail dot com.

I included all the header information suggested in this post (except for the file size), from Pragma to Content-Transfer-Encoding, and voilĂ  - it works.