Sunday, 14 June 2020

Deleting a language keyboard for a language you didn't install in Windows 10

After using a 3rd party program to install a language keyboard, I discovered 2 keyboard had been installed: the one I wanted and US QWERTY for US English. As I'm happy enough using the US QWERTY layout keyboard for Canadian English, I had no use for essentially a duplicate language keyboard. It's a minor annoyance, but when cycling through languages I would have to press the language switching key combination (WIN + Space) an extra time. However, in the language settings, US English was no where to be found. According to this Stack Overflow post, this is a bug on Windows' part. The solution is to install the language that the intruding keyboard belongs to (US English in my case) and then delete it. The extra unexpected keyboard should now be gone.

Monday, 30 March 2020

Microphone not working in Windows 10

I had this issue for about a year after updating my HP laptop from Windows 7 to Windows 10. Not matter what I did, the microphone would not work. This is in an enterprise messaging desktop (so not Metro/Modern/Fluid app or whatever else Microsoft has decided to call their sandboxed apps) program. I tried using the laptop's microphone, plugging in a headset, and even using a bluetooth headset, but nothing I did could get sound to be recorded. The weird thing was that from the Windows settings pages the microphone was working perfectly fine. In all cases I could hear sounds with no problems. This was driving me insane!

I tried updating the HP drivers, updating Windows, installing other drivers/software. Searching the HP forums was near useless as they'd almost always recommend updating the drivers, and if that failed then to call HP support. Finally I found a godsend answer: Windows 10 now has privacy controls. On the privacy settings page for your microphone, there's a blanket deny access option (which of course was set in my case) which will prevent even traditional desktop apps from accessing the microphone. I'm not sure why it was set (did I do it?), but regardless this instantly fixed my problem.



If you're still having microphone problems then try the solutions provided at the following links:
  1. https://www.howtogeek.com/395296/fix-my-microphone-doesnt-work-on-windows-10/
  2. https://support.microsoft.com/en-ca/help/4034886/accessories-headset-troubleshooting-microphone-issues


Thursday, 5 January 2017

Exporting Excel charts as PDFs

To export an Excel chart as a PDF is simple enough. Select the chart you want to export and go to File > Save As. Pick a save location and make sure the file type is PDF. Now you have a PDF that contains a vector version of your chart.

However, you'll most likely have a lot of white space surrounding your chart. You can either crop it manually using whatever tool you can find, or you can follow the steps I found here:
  1. File > Print - Change the printer to a virtual one  (I recommend Microsoft XPS Document Writer). We're not actually going to use this printer, but it allows us to save the chart without printer margins (which are separate from the page layout margins in step 3)
  2. Select the chart
  3. Page Layout > Margins - set them all to 0
  4. Page Layout > Orientation - make sure it's right orientation
  5. Page Layout > Size - pick a paper size that's close to your chart size
    1. If you can't find a page size that's close enough you'll probably have to resize your chart to match a paper size
  6. (Optional) Right click your chart and change the chart outline to "No Outline"
  7. File > Save As - Save it as a PDF

Saturday, 24 December 2016

Include LaTeX packages in custom locations without changing environment variables

I recently had the need to include some packages with my repository, but it's not straightforward how to do this.

One way is to just dump all the necessary files at the root level of your document. This works (at least it does with pdfLaTeX), but if you have a lot of packages to include or your packages have a lot of files then this quickly becomes really messy.

Another way is to organize it nicely in a folder and then just use a relative path in usepacakge{abc}. This was nice, except for two things. If, for whatever, reason the folder containing the packages is removed but you do have the packages installed, then you'll still get a whole lot of errors as it expects them to be at that location exactly. The second and more onerous is that you're not supposed to provide a relative path here, so a lot of packages won't work (for me it was hyperref and scrextend). If it does work, you'll still get a warning about it (see the comments here for more information).

Of course, there's the recommended way of altering the environment variable TEXINPUTS. For me this wasn't ideal as I didn't want to have to run a CMake or custom setup script before compiling for a bunch of reasons. I'm sure this method works though. You can find instructions for this method here

Turns out that altering input@path{{abd/}{xyz/}} affects where usepackage searches (as usepackage is really just a wrapper around input). All you need to do is add your custom package path to input and you're good to go! Instructions for that are here

Edit:
It gets even better. Adding to the input paths also affects where documentclass searches! And (this may be good or bad) it will default to using any installed packages on the local machine before using the ones included in your packages folder. 

Thursday, 4 August 2016

Some LaTeX questions and answers

Where's my table of contents?
You have to compile it twice (I use pdfLaTeX). First run generates a .toc file and the second time uses that to create a table of contents in your document.

Using \tableofcontents is giving me an error!
You need to delete your .toc file every time you switch document types.

Where's my bibliography?
I'm assuming you've already created a .bib file and have referenced it in your document using \bibliography{...} . Compile to generate an .aux file which will contain references to the citations in your document. Then compile with BibTeX which will use your document's .aux file and the specified .bib file to generate a .bbl file for your document. It will also generate a .blg file which will contain the output of running BibTex. Now compile once again with pdfLaTeX to have the .bbl file included where \bibliography{...} is.

What is a .bbl file?
Simply put, it's the same as using the embedded bibliography system but automated. BibTex will style your \bibitem{...} contents the according what you specify in \bibliographystyle{...}.

How can I modularize my document? How can I separately compile each module?
If you just want to combine multiple files you can use either \include or \input. Use \subfile if you want the ability to compile each document separately. For more details, including the pros/cons of each, see here https://en.wikibooks.org/wiki/LaTeX/Modular_Documents
 

Thursday, 23 June 2016

Undefined reference

Most likely culprit is that you've either not defined the function or you included the library with the definition in the wrong order. [source]

In my case it was a bit more insidious - I was the victim of name mangling. Long story short, be extra careful when mixing C and C++. [solution]

The sad thing is I more or less encountered this problem 6 months ago, but I think I have a better understanding of it now.

Monday, 13 June 2016

Miscellaneous VirtualBox Problems

My host is Windows 7 and my guest is Ubuntu Server 16.04

Screen goes black
Initially I thought this was because it was going to sleep or something. I'm still not quite sure what the problem is, but in my case I was able to get the screen back by pressing ALT.
[Source]

Symlinks in a shared folder
I'm running Windows 7, so symlinks are disabled by default due to security concerns. They're also disabled by default in shared folders by VirtualBox - also for security concerns. If you try to create a symlink in a shared folder then you'll get an error like such:
ln: failed to create symbolic link `b': Read-only file system
I did a bunch of stuff and wasted a few hours on this so at this point I'm not sure exactly what I did to get it working. First thing I did was turn on symlinks on the host side, but this may be an optional step.
  1.  Disable UAC [Source], but this may only be needed for Windows 8+
  2. Add yourself to the SeCreateSymbolicLinkPrivilege security policy (secpol.msc -> Local Policies -> User Rights Assignment -> Create symbolic links) [Source], but this may only be needed for non-admin users
  3. Restart/Log off or run gpupdate /force  
Now on the guest side you need to run 
VBoxManage setextradata YOURVMNAME VBoxInternal2/SharedFoldersEnableSymlinksCreate/YOURSHAREFOLDERNAME 1 
For the shared folder name make sure to use the Folder Name as appears when editing the folder through the VirtualBox management program AND NOT THE FOLDER PATH! So if your folder path has spaces in it (e.g. shared folder for vm), your folder name would have underscores instead (e.g. shared_folder_for_vm). Unfortunately there is not indication if you misspell anything past the YOURVMNAME part. But you can check what you entered using:
VBoxManage getextradata YOURVMNAME enumerate
[Source]

Clock skew
Not really an issue for me, but good to know at any rate. [Source]

SSH from host
I couldn't figure out how to copy and paste into the VM through the VirtualBox window so I decided to SSH into it since I can copy and paste into putty. There's a lot of guides for this, but here's a succinct one.

SSH connection lost after sleep
I would lose my connect every time my computer woke up from sleep. The VM would still be running in the background (I run it headless) and new SSH connections could be made, but existing ones would be disconnected and wouldn't be able to reconnect. Apparently this is a known bug. I'm hopeful that the following fixes this:
VBoxManage modifyvm UbuntuServer --natdnshostresolver1 on
[Source]