Showing posts with label fixes. Show all posts
Showing posts with label fixes. Show all posts

Friday, February 10, 2012

Your iPad/iPhone/iPod not showing up on wireless sync on iTunes in Windows XP?

UPDATE: This solution appears to work for Windows 7 as well. As the problem is likely in the Apple software, the solution should work across Windows operating systems.
Last year for my mom's birthday, we bought her an iPad 2. When iOS 5 came out, she took advantage of the cool wireless sync feature to iTunes running on her Windows XP machine. It worked great for a few months, but then suddenly her iPad stopped showing up in the sync list unless it was physically plugged into her computer. On the iPad, it said it couldn't see her computer.

After tweaking some settings and doing a few reboots, I managed to get her computer to start wireless sync'ing again. I had an idea about what it was, but I wasn't sure.

Then, after a few weeks, I hear from her that it has started again. So I did a little more searching, and after combining multiple people's error reports and extracting the common thing that seemed to fix them all, I think I came up with the fix. It's a simple fix, and she's able to do it herself whenever the iPad loses connectivity. For the last few weeks, every time the iPad stops talking to her computer, she's able to recover immediately. So I think we've figured it out.

The fix? Restart the Apple Mobile Device service. Here's how:
  1. Quit iTunes.
  2. Right-click on "My Computer" and go to "Manage".
    • Alternatively (e.g., on Windows 7), open up your "Control Panel". Then click to see "All Items." Then look for "Administrative Tools." You should find "Services" in there. That's the ultimate destination we're heading to.
    • Alternatively, click on "Start" and then "Run" and type "services.msc" (without the quotes) and hit enter.
  3. Click on "Services and Applications" inside the "Computer Management" console.
  4. Double-click on the "Services" that shows up.
  5. Find the "Apple Mobile Device" service in the list and select it by clicking on it.
  6. Click the link that says "Restart the service".
    • Alternatively, you can right-click on the service and select "Restart."
    • Alternatively, you can double-click on the service and then click the "Stop" button and then the "Start" button.
  7. Close the management console.
Now that you've restarted the "Apple Mobile Device", your system should start working like normal again (you may want to start up iTunes again though). Eventually when your iOS device starts looking again, it will find your system and sync as needed.

This problem appears to be caused by some sort of race condition dealing with the Apple Mobile Device and the network. As the computer starts, the order in which things start is non-deterministic. Due to some random delays, the network may not come up quick enough. Consequently, the Apple Mobile Device gets confused by the network being in this state. Re-starting it manually later when the network is definitely up and running seems to fix this problem every time.

Monday, July 18, 2011

How we fixed our Ikea wardrobe after the bar fell

Our apartment has no bedroom closet space. There are two coat closets and a linen closet all clustered in the same wall between the living room and office and near the bathroom, but there is no storage in the bedroom. So a while back, we bought three large Ikea wardrobes that fit nicely next to each other down one of the walls of our bedroom. This particular wardrobe model was one of Ikea's budget options (i.e., it was not one of their crazy customizable types; it basically came as a complete unit). The closet bar (shown here without the shelf that is usually above it) should attach to the closet using a plastic insert like this (click on the image for a larger and clearer version):
As you may be able to see, there is a large vertical scrape a few inches beneath the plastic insert. That scrape came into our lives when the plastic insert on the left side of the bar failed ("wardrobe malfunction"), which sent the awkward-shaped metal closet bar (and the clothes hanging on it) into the floor of the wardrobe. As you can see, there is a cantilever-type support jutting out from the plastic insert that sheared off (pretty clean cut, actually):
Ikea often keeps spare parts like this on hand that you can grab for free in bins from the store, but we didn't want to drive all the way to West Chester to look for them, and we were pretty sure these wardrobes were discontinued and these (likely specialized) parts were not available. So we went to Meijer instead (it was too late to go to a hardware store to find real closet accessories) to look for a way to hack together a good pre-fabricated furniture fix.

Just before we were about to give up, we found these corner braces that looked like the perfect size and shape for our problem. They were about $2.50 for a pack of 2 (in case any of the other supports ever break later).
So here's how we used a corner brace to support the closet bar:
As a bonus, the screws that came with the corner brace were short enough to not protrude out the side of the wardrobe. They were self-tapping screws, but I didn't trust them in the Ikea-style formica-covered particle board, and so I pre-drilled some small holes first, and that worked pretty well. We used a zip tie to fix the bar vertically; however, we also experimented with binder rings that we had stowed away in our office supplies. The binder rings actually provided a much tighter fit so that the bar didn't wiggle at all; however, as strange as it sounds, the zip ties were a little more discrete as they hugged the corner brace snugly.

[ I should note that I took off the shelf to get easier access to the closet. That meant pulling out the three small brads/nails attaching the masonite-ish backing. Because the area moment of inertia of that backing is very high, I think it provides significant support to the closet structure as a whole. So afterward, I pulled the closet out and put the nails back in a different spot. I probably could have left the shelf in through the whole fix. ]

I almost like the look of our fix better than the Ikea insert (which looks like it has a tenuous hold on the bar anyway).

[ You can also find this post at Jessie and Ted's blog. ]

Saturday, March 21, 2009

rspublic.cls fixed to get rid of nasty Incomplete \if errors

Depending on how updated your LaTeX distribution is, if you try to use the Royal Society's rspublic.cls to build your compuscript, you may get nasty incomprehensible errors like:
! Incomplete \if; all text was ignored after line 7.

\fi
I didn't get these errors on my home system (which has TeX Live 2007 installed), but I got them on Manuscript Central for Proc. R. Soc. B, and that's a major problem.

After two days of binary searching through possible sources of the problem, I found it. Jonathan Wainwright (the author of the document class) used a \phantom in both the \@oddhead and \@evenhead without preceding it by a \protect. The \phantom macro is fragile, which means that it can cause major problems when put in contexts that move around (like headers). So it needs to be protected.

I added \protect in front of each of the two \phantom calls, and all was well in the world.

I've posted a fixed version of the document class at:Give it a shot. That version also allows for 11pt and 12pt fonts, and it defines \@ptsize, which setspace needs to exist in order to work (i.e., for double spacing).

Wednesday, August 08, 2007

Broken sections in Elsevier elsart1p, elsart3p, and elsart5p

UPDATE: You should probably add
\def\@seccntformat#1{{\@secnumfont{}\csname the#1\endcsname.}\quad}
around line 128 (i.e., after the \@secnumfont definition) as well. Alternatively, you could add something similar (surrounded by \makeatletter and \makeatother) to your preamble.

Ever notice how section* is broken in elsart1p.cls, elsart3p.cls, and elsart5p.cls from Elsevier? Because of this, the section titles for the acknowledgments (i.e., from \ack) and the references look like normal text. Plus, the references do not show up in the PDF bookmarks. This "feature" is annoying; working with journals generally is.

How to fix this? You have to hack the document class files. In particular, you need to remove (or comment by placing a % on the beginning of the line) a chunk of lines from the document class of interest to you. In particular, remove
  • elsart1p.cls - lines 144--196
  • elsart3p.cls - lines 147--199
  • elsart5p.cls - lines 144--196
These lines redefine the LaTeX internals \@startsection, \@sect, and \@ssect. However, it does not appear there is any good reason why Elsevier has done this, so just stick with the standard ones. This will make your document look much better too.

Until Elsevier does this for you, you should upload your modified document class with your article OR use the elsart document class in the version you send to Elsevier.

Tuesday, August 07, 2007

lineno and amsmath compatibility

UPDATE 2 (READ THIS!): As Ulrich Diez points out, this can be made more compact. Here's the result (place this in the preamble, probably anywhere):
\newcommand*\patchAmsMathEnvironmentForLineno[1]{%
\expandafter\let\csname old#1\expandafter\endcsname\csname #1\endcsname
\expandafter\let\csname oldend#1\expandafter\endcsname\csname end#1\endcsname
\renewenvironment{#1}%
{\linenomath\csname old#1\endcsname}%
{\csname oldend#1\endcsname\endlinenomath}}%
\newcommand*\patchBothAmsMathEnvironmentsForLineno[1]{%
\patchAmsMathEnvironmentForLineno{#1}%
\patchAmsMathEnvironmentForLineno{#1*}}%
\AtBeginDocument{%
\patchBothAmsMathEnvironmentsForLineno{equation}%
\patchBothAmsMathEnvironmentsForLineno{align}%
\patchBothAmsMathEnvironmentsForLineno{flalign}%
\patchBothAmsMathEnvironmentsForLineno{alignat}%
\patchBothAmsMathEnvironmentsForLineno{gather}%
\patchBothAmsMathEnvironmentsForLineno{multline}%
}
This is all that is needed for the standard AMS math environments. However, if you want to add environment BLAH, you can add
\patchAmsMathEnvironmentForLineno{BLAH}
before the closing curly brace. If you want to add environments BLAH and BLAH*, you can add
\patchBothAmsMathEnvironmentsForLineno{BLAH}
before the closing curly brace.

UPDATE 1: If you use the mathlines lineno option, you may notice that amsmath environments like align may create strange double numbers at the end of the environment. I haven't looked into why this is the case. If you really need mathlines loaded, you may want to consider ways of using equation or equation* exclusively. Keep in mind that you will still need to load at least the equation and equation* lines:
\AtBeginDocument{%
%
\let\oldequation\equation%
\let\endoldequation\endequation%
\renewenvironment{equation}%
{\linenomath\oldequation}{\endoldequation\endlinenomath}%
%
\expandafter\let\expandafter\oldequationstar\csname equation*\endcsname%
\expandafter\let\expandafter\endoldequationstar\csname endequation*\endcsname%
\renewenvironment{equation*}%
{\linenomath\oldequationstar}{\endoldequationstar\endlinenomath}%
}
You may think that the displaymath option of lineno will do this for you, but loading amsmath seems to prevent that. I haven't looked into why.

A comp.text.tex post gives some history behind this fix.

It's well-known that lineno and amsmath don't play well together. After loading amsmath, the paragraph that precedes an equation, equation*, align, align*, or any of the other amsmath environments will cease to get line numbers. The ugly fix to this is to wrap every math environment with a linenomath environment. That's pretty annoying. Here's a fix that redefines the equation environment and the amsmath environments so that they'll work with noalign. Yes, it even handles the starred versions of these.
% To deal with amsmath, must redefine math environments later
\AtBeginDocument{%
%
\let\oldequation\equation%
\let\endoldequation\endequation%
\renewenvironment{equation}%
{\linenomath\oldequation}{\endoldequation\endlinenomath}%
%
\expandafter\let\expandafter\oldequationstar\csname equation*\endcsname%
\expandafter\let\expandafter\endoldequationstar\csname endequation*\endcsname%
\renewenvironment{equation*}%
{\linenomath\oldequationstar}{\endoldequationstar\endlinenomath}%
%
\let\oldalign\align%
\let\endoldalign\endalign%
\renewenvironment{align}%
{\linenomath\oldalign}{\endoldalign\endlinenomath}%
%
\expandafter\let\expandafter\oldalignstar\csname align*\endcsname%
\expandafter\let\expandafter\endoldalignstar\csname endalign*\endcsname%
\renewenvironment{align*}%
{\linenomath\oldalignstar}{\endoldalignstar\endlinenomath}%
%
\let\oldflalign\flalign%
\let\endoldflalign\endflalign%
\renewenvironment{flalign}%
{\linenomath\oldflalign}{\endoldflalign\endlinenomath}%
%
\expandafter\let\expandafter\oldflalignstar\csname flalign*\endcsname%
\expandafter\let\expandafter\endoldflalignstar\csname endflalign*\endcsname%
\renewenvironment{flalign*}%
{\linenomath\oldflalignstar}{\endoldflalignstar\endlinenomath}%
%
\let\oldalignat\alignat%
\let\endoldalignat\endalignat%
\renewenvironment{alignat}%
{\linenomath\oldalignat}{\endoldalignat\endlinenomath}%
%
\expandafter\let\expandafter\oldalignatstar\csname alignat*\endcsname%
\expandafter\let\expandafter\endoldalignatstar\csname endalignat*\endcsname%
\renewenvironment{alignat*}%
{\linenomath\oldalignatstar}{\endoldalignatstar\endlinenomath}%
%
\let\oldgather\gather%
\let\endoldgather\endgather%
\renewenvironment{gather}%
{\linenomath\oldgather}{\endoldgather\endlinenomath}%
%
\expandafter\let\expandafter\oldgatherstar\csname gather*\endcsname%
\expandafter\let\expandafter\endoldgatherstar\csname endgather*\endcsname%
\renewenvironment{gather*}%
{\linenomath\oldgatherstar}{\endoldgatherstar\endlinenomath}%
%
\let\oldmultline\multline%
\let\endoldmultline\endmultline%
\renewenvironment{multline}%
{\linenomath\oldmultline}{\endoldmultline\endlinenomath}%
%
\expandafter\let\expandafter\oldmultlinestar\csname multline*\endcsname%
\expandafter\let\expandafter\endoldmultlinestar\csname endmultline*\endcsname%
\renewenvironment{multline*}%
{\linenomath\oldmultlinestar}{\endoldmultlinestar\endlinenomath}%
%
}
The pattern is pretty clear. You can use it along with any of your own environments. For example, add this at the end (before the closing curly brace) to fix your BLAH environment:
\let\oldBLAH\BLAH%
\let\endoldBLAH\endBLAH%
\renewenvironment{BLAH}%
{\linenomath\oldBLAH}{\endoldBLAH\endlinenomath}%
and drop this at the end (before the closing curly brace) to fix your BLAH* environment:
\expandafter\let\expandafter\oldBLAHstar\csname BLAH*\endcsname%
\expandafter\let\expandafter\endoldBLAHstar\csname endBLAH*\endcsname%
\renewenvironment{BLAH*}%
{\linenomath\oldBLAHstar}{\endoldBLAHstar\endlinenomath}%
I hope that's useful for someone.

cleveref incompatibilities with Elsevier and Springer

elsart problems: If you try using cleveref with any of the elsart packages, you may get this error:
! TeX capacity exceeded, sorry [input stack size=5000].
\cl@part ->\cl@part
\@elt {section}
This is due to a flaw in the elsart packages. They setup some part counters even though part isn't defined. This confuses cleveref. To fix this, add the following anywhere in your preamble:
\makeatletter \let\cl@part\relax \makeatother
Later, you can use cleveref's poorman option to strip all of the cleveref stuff from your document. After that, you can remove this line.

svjour problems: Similarly, if you try combining cleveref with Springer journal support files, you may get this error:
! TeX capacity exceeded, sorry [input stack size=5000].
\cl@chapter ->\cl@chapter
\@elt {theorem}
Again, this is due to a flaw in the Springer packages. They setup some chapter counters even though chapter isn't defined. To fix this, add the following anywhere in your preamble:
\makeatletter \let\cl@chapter\relax \makeatother
Again, this can be removed after cleveref's poorman procedure is applied.

Source and acknowledgments: The Springer solution was given by "Dan" in a comp.text.tex post. I used it to generate the elsart solution.