## Friday, March 20, 2015

### chromecast, netcomm router and netflix

I just got a new router and it took me a while to figure out how to make this work. Initially the chromecast just kept on saying "sorry, netflix hasn't come to this part of the world yet" despite it working fine on a mobile and a PC connected to it and the DNS settings obviously being correct. But when they both casted it errored.

I have a Netcomm NB16WV-02.

So of course, first things first, when you set up your router, you need to add whatever your DNS addresses are. For me, I'm with getflix and the closest point is Sydney so I set my DNS under ntetwork settings -> DHCP server to (but yours will be whatever your DNS uses):
Primary DNS: 54.252.183.4
Secondary DNS: 54.252.183.5

Then you have to connect your chromecast. Chromecasts at this point in time only connect to 2.4GHz networks, so if you turned your 2.4GHz channel off, you need to turn it back on (under Network setup-> wireless 2.4GHz) and connect your chromecast to it (go to your chromecast app). After a reboot of the chromecast I had no problem with the chromecast being on the 2.4GHz network and me being on the 5Ghz (ie. there is no wifi isolation).

Ok now you just need to stop the chromecast from accessing google's servers. For some reason this is essential, whereas it wasn't on my BudLite.

Go to Advanced settings -> Routing. Click enable static routing. In the boxes type 8.8.8.8, 255.255.255.0, and then the address of your router. In the next box down do the same but with 8.8.8.4.

Now reboot your chromecast. It should be working now.

## Friday, March 1, 2013

### nvidia troubles - surprise!

So let's just say I wanted to play a game...

and that game required working nvidia drivers and not nouveau. Well, you would just think, that I could just install the nVidia drivers and they would work and all would be sweet. Well, no. After bricking my computer, and then ending up in some low resolution mode, and then with no unity, this is basically how i fixed it (though this was a step-wise process which may not be entirely accurate).

sudo apt-get update
sudo apt-get nvidia-current
sudo nvidia-xconfig
sudo reboot

this should get you to a low resolution OS. If you can't boot (black screen as happened to me a couple of times) then you can go into recovery mode, select the root shell prompt and then mount your OS r/w using:
mount -o remount,rw /
and hopefully fix it with:
dpkg-reconfigure xserver-xorg

So if you do get to a boot screen with limited resolution options, I found the solution here. Edit your xorg.conf (sudo nano /etc/X11/xorg.conf from the command line) to change the following lines:
Section "Monitor"
Identifier     "Monitor0"
VendorName     "Unknown"
ModelName      "Unknown"
HorizSync       28.0 - 33.0 [make this range bigger, mine was 28-60]
VertRefresh     43.0 - 72.0 [change this range too]
Option         "DPMS" [comment this out]

If you can find the factory values for your monitor that would be great, but I just changed mine randomly and it worked. But then I had no Unity, no top bar, no menus, no dash, nothing. I found the fix, here:

sudo apt-get update
sudo apt-get install bumblebee bumblebee-nvidia linux-headers-generic

and it worked! Now I can play guild wars 2 on my laptop (I am using crossover and I needed to go into regedit and edit memory size and glsl handles - instructions here.) It's still a bit glitchy, which it isn't on my main PC, but can't win at everything! I had the GW dat file stored on a shared partition, so I could just create a link in the folder I installed it to in crossover to that folder, which means I don't have two .dat files, one for windows, one for linux.

## Tuesday, December 4, 2012

### How I got two-sided printing and scanning working on my brother MFC7860DW over wireless

the packages came from:
http://welcome.solutions.brother.com/bsc/public_s/id/linux/en/index.html

make sure the pre-reqs are installed:
sudo apt-get install ia32-libs
sudo aptitude install lib32stdc++
[I got an error with the stdc++ install with apt-get but it worked fine with aptitude ('Unable to correct problems, you have held broken packages')]

Download the debs from the brother  printer drivers page . For me, would not install through the software center (and according to the instructions you're meant to run it from the terminal), so I ran
sudo dpkg  -i  --force-all 'mfc7860dwlpr-2.1.0-1.i386.deb'
sudo dpkg  -i  --force-all 'cupswrapperMFC7860DW-2.0.4-2.i386.deb'

go to:
http://localhost:631/printers
click MFC-7860DW and then from the dropdown menu under administration - "Modify Printer" and set following parameters*

select:
Device: "LPD/LPR Host or Printer" or "AppSocket/HP JetDirect" (I selected "LPD/LPR Host or Printer")
then:
note that your printer's IP address needs to be fixed in some way so that you can continue printing to it. I can fix IP addresses with my router so that's how I did it.

My device wasn't listed under drivers, and there's no available ppd so I just selected 7840DW Foomatic - note: when I selected the brother driver, I actually couldn't print two-sided, which is bizarre.

It added a device on localhost to my printers list at some point, but this one didn't work.

Still no booklet option, but it does now print two-sided.

SCANNING
First of all:
sudo apt-get install sane-utils xsane
Downloaded the debs from here. They installed with the software center, though you do have to click 'Ignore and install'.
scan-key-tool 64bit (or 32bit obviously if you're running 32 bit)
brscan4 64bit

then in the terminal
brsaneconfig4 -a name=MFC-7860DW model=MFC-7860DW ip=192.168.1.108
with the IP address you are using substituted at the end.

and then it worked fine for me with the default scanning application!

------
hat-tip to: http://ubuntuforums.org/archive/index.php/t-1854483.html

*if you get a password prompt, and you haven't set a password, then from the terminal:
sudo lppasswd -a

## Saturday, December 1, 2012

### davmail not starting

So, attempting to install davmail on pretty much a new install - ran the deb, tried to run it, didn't open but appeared to be running. Did have java installed (only have openjdk installed, unlike my other install where sunjava causes the problems with davmail), and when I ran it from the command line I get:
Which led me to this bug report (under DavMail, even though it's a openjdk bug?), which solved it with:
sudo apt-get install libswt-cairo-gtk-3-jni
which worked a treat.

## Monday, November 26, 2012

### changing colour of citations in-text

So I had a figure where a certain colour represented data from a certain citation and I didn't want to put the name beside every single datapoint - it would be better in the figure legend. But I came across an issue - \textcolor{} just changes the text colour but the not the colour of the citation itself if you're using hyperref, so for instance:
\textcolor{green}\citet{Smith2011}
shows up as
Smith (2011)
which is not what I want. The easiest way to do it with hyperref is by using the citecolor of hypersetup:
\hypersetup{citecolor=green}\citet{Smith2011}
shows up as:
Smith (2011)
obviously, this is cumbersome, and that brackets are still black and you still need to revert the link colour back to black, so just create a newcommand:
\newcommand{\citecolour}[2]{\textcolor{#1}{\hypersetup{citecolor=#1}\citet{#2}\hypersetup{citecolor=black}}}
This generates a citation in-text and then converts the colour set-up back to black each time. As the brackets would still be black, you have to use the textcolor command to change them as well.
So now I can just use:
\citecolour{green}{Smith2011}
to generate
Smith (2011)

## Saturday, November 24, 2012

### glossaries entry too long

So I realised at some point that I had glossary entries that weren't showing up in my glossary, and were referencing back to pg. 1. The output from Kile was telling me:
[entry] has been referenced but does not exist
which was weird because it was showing up in text with the right acronym so obviously it did exist! It wasn't a helpful error, but thankfully, some germans figured it out:
Zu Lang ist --> hier gibt eine kleinen Hack:
Code:
\newcommand{\MeinZuLangerGlossarEintrag}{Super Langer Text, der einfach}
\newglossaryentry{glo:KurzNameReferenz}{
name=Name des Modells im Singular,
plural=Name des Modells im Plural,
description={ \protect\MeinZuLangerGlossarEintrag
}
}
so basically, my glossary items it wasn't defining were because the description is too long (potentially the limit is 1024 characters). So you can either use \def\xxxxDescription of \newcommand{\xxxxDescription} and use that to define your description, and then use that in the glossary entry:
\def\wordDescription{This is a really long description}
\newglossaryentry{word}{name=word,description={\protect \wordDescription}
and clean your files and re-run makeglossaries and ta-da!

## Thursday, November 22, 2012

### davmail crashing on startup

so, I finally updated davmail (4.1.0-2042 ) after it asking me to for literally years. But when it started up startup, it immediately crashed. At the same time, I got an error relating to the jre. A quick google got me to some information about how sometimes the open jdk is better than the sun java. So I checked which one I was running with:
sudo update-alternatives --config java
which gives me:
There are 3 choices for the alternative java (providing /usr/bin/java).
Selection    Path                                            Priority   Status
------------------------------------------------------------
0            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      auto mode
*1            /usr/lib/jvm/java-6-sun/jre/bin/java             63        manual mode
2            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1051      manual mode
Press enter to keep the current choice[*], or type selection number:
I switched to  [2], and now it runs!

## Saturday, November 17, 2012

Ok, so I got the upgrade to windows 8 for $15. My win 7 wasn't exactly working properly after flashing from the iso and I hadn't really used it anyway, just booted into it occasionally. So I downloaded the iso during the install and burnt it to a dvd. Would have thought that I could just proceed with the install on my 50GB partition for windows - wrong, you need at least 20GB free space on c:/. I had to set-up my partitions such that the windows partition was prior to the linux partition, and it wasn't possible to extend it without wiping the linux partition (which I didn't want to do). So here's how I upgraded to Windows 8 with less than 20GB of free space (I started with 2GB). For this you will need to have chosen the option to install of a DVD and you will not be importing any of your old Windows 7 stuff during install. If you want to keep all of your applications and settings etc and import them, this is not the method for you. First of all, I got rid of hiberfil.sys which was taking up 6-8GB on my hard drive. If your pagefile is running off c:/ you can get rid of that too. All you need is 8.5GB free if you do the install straight off the DVD. Boot onto the install DVD. During the install, choose the option that does not import any of your settings (the other option takes you back to windows and requires 20GB). I didn't need any of my applications or settings so this was fine for me. From here you can choose to install on any hard drive, however, as I'm upgrading, the installer fails on a hard drive that does not have Windows. Install onto your current Windows 7 partition. It backs up your old set-up as Windows.old, which you can delete to free up 20+GB when you're in Windows 8 later using disk cleanup. Though for some reason it still shows up on the windows splash screen as an option. Good one Windows. Now for the Ubuntu part: Now, to get grub back up and running (the Windows install deletes it). If you've got a reasonably new livecd around (new enough to have grub2 on it) then just boot onto that and follow these instructions: First, open the Terminal. Mount the partition you Ubuntu Installation is on. If you are not sure which it is, launch GParted (included in the Live CD) and find out. It is Usually a EXT4 Partition. Replace the XY with the drive letter, and partition number. Example: sudo mount/dev/sda5 /mnt. Then bind the directories, you need, like so: sudo mount /dev/sdXY /mnt sudo mount --bind /dev /mnt/dev sudo mount --bind /proc /mnt/proc Now we jump into that using chroot. sudo chroot /mnt Now install, check, and update grub. This time you only need to add the partition letter (usually a) to replace X. Example:grub-install /dev/sdagrub-install –recheck /dev/sda grub-install /dev/sdX grub-install --recheck /dev/sdX update-grub Now you can exit you mounted hard disk, and unmount. exit sudo umount /mnt/dev sudo umount /mnt/proc sudo umount /mnt and then sudo reboot and then when you get back into ubuntu you're going to need to sudo update-grub to get your windows partition back, or alternately I guess you could mount it with your ubuntu drive earlier on the livecd, but that would require way more than a single command! ## Saturday, October 13, 2012 ### sd card reader on lenovo e430 This may no longer work with the new 3.5 kernel or 12.1 ubuntu... see UPDATE: below. ----- So my sd card reader wasn't working out of the box with my Lenovo e430 and Ubuntu (currently 12.04 Precise). I googled a bit and found this blog post, which finds out the device name using lspci (RealTek 5229), references this archwiki article on the Lenovo E430, which gets you to this driver page on the RealTek website, so that finally you can extract the drivers and run (corrected type in the final line of the original blog post:$make
$sudo make install$sudo depmod
\$sudo modprobe rts5229
And it works! You shouldn't need to reboot, mine worked straight away after modprobe.

UPDATE:
This just stopped working (maybe because of kernel upgrade? I'm now on the 3.5 kernel, 12.10 Quantal), modprobe retuning this error:
I found this thread, where a user had had the same problem, and they linked to a ppa for lenovo fixes! I added it to my software sources, sudo apt-get update and then sudo apt-get install rts-5229-dkms. It still didn't work when I plugged it in, but sudo modprobe rts5229 worked straight away.So in short:
should solve this problem, at this time...

## Saturday, September 22, 2012

### redefining underscore in math mode to use rm font

So I use a lot of subscripts, and it annoyed me that they were in italics! I didn't want to call \textrm{} every time in math mode, and there had to be a better way!
I found this stackexchange post which described exactly what I wanted to do and this was their solution:
\catcode_=\active
\newcommand_[1]{\ensuremath{\sb{\mathrm{#1}}}}
Unfortunately that redefines _ for ALL uses of it, including in file names etc. I had a lot of file names and folder that used that character, so that wasn't an option. Some more searching and I found:
\documentclass{article}
\usepackage{amsmath}

\let\sub_
\catcode\_=12
\begingroup
\catcode\_=\active
\gdef_#1{\sub{\text{#1}}}
\endgroup
\begin{document}`
Which worked a charm! Now all my subscripts are automatically in roman font!