He's not My Son, I'm His Momma.
A few months ago, I dropped off my son at daycare for the first time.
He was excited by all the new toys and playmates, while I frantically tried to hold onto my hot tears until I stumbled out the door.
Nothing really prepares us for the shocking separation between a momma and newly independent child. It's heartbreaking, exhilarating, and traumatic all rolled into one great big pile of sleepless nights, changing roles, and soggy tissues.
I also learned a painful lesson in ownership. My son isn't mine.
Biologically yes. My body grew his sturdy frame and beautiful eyes. And I most definitely gave birth to him.
By creating prolonged physical space between us for the first time, we both learned (well, I relearned) that we are both functioning individuals on our own. Radical! Often this is shocking for new moms. We know it intellectually, but it's incredibly easy to let our sense of self be defined by parenthood.
Our language feels so woefully inadequate to describe our deepest bonds—what we say aloud creates the relationships that we live.
Too often, we parents approach parenthood with ownership. My child, my daughter, my son, without ever analyzing the power dynamics, expectations, and relationships we create with our words.
Being in the hospital gives me PTSD.
Like actual PTSD. My breathing is shallow and fast, I start feeling trapped and claustrophobic. I sweat. The really smelly kind of sweat. My mind fills with a torrent of fear that drowns out all other thoughts.
And to my horror, when I get angry at not being heard, I cry. When the tears burn down my face, I become even angrier that I'm crying and less able to speak up.
This is why when I told my husband a year ago that we were going to have a baby, I also told him I'd like to have our baby at home. He was already familiar with most of my hospital traumas, including the discovery that I'm allergic to two common medications—after they were pumped into my IV. Twice.
I've been rushed into emergency surgery 3,000 miles away from home and I've spent a week as a medical test subject. I also have the type of veins phlebotomists dread. It takes three sticks on average for a needle to find a suitable spot. I once sprayed a two foot stream of blood across a wide-eyed nurse.
After a month or so of petitioning for a home birth, he finally agreed and we found the most extraordinary midwife. We had a healthy pregnancy and a dream birth at home. Six hours of calm in a safe space with no medical intervention and full-on mindful breathing resulted in a healthy, happy, eight pound, 15 ounce bundle of joy.
All of our intentional avoidance of hospitals has now flown right out the window.
Why Does My Baby Smell Like Tapas? And Other Absurd Questions of Motherhood.
To be fair, I'm guilty of it too. Making small talk is awkward and it seems like a harmless question. I know I've asked it without any real idea what I was asking.
Which is completely true. I don't know how I feel about being a mother in general yet, but I love being my little one's.
After that, I don't know what to say. I kind of wrap my arms around myself in an imaginary hug of our son, or if I'm actually holding him when they ask, I look down, smile, and give him a squeeze.
Then I sort of wait. Because how do you explain motherhood in a handful of sentences in the same manner as discussing the weather? Most of the time, I get a smile and a "oh that's wonderful!" Sometimes I get a quick peek into someone else's crazy postpartum experience. Raw authentic words that cut quick to the heart of the transition from being Not A Mother to being A Mother. Then the moment is gone and we're back to discussing the actual weather.
It feels like a quick dip into the swift underground river passing under all of our feet. Motherhood. We don't like to get too deep and be whisked away-just enough to feel the force of the river and then back to solid ground. Now that I know it's there, it's hard to ignore.
I'm extremely fortunate. I had the dream labor and birth that we planned. A quick, safe, transformative experience. We have a happy healthy (barring colds-damn you colds) little boy. I haven't experienced any trauma postpartum or PPD. I know a lot of women do. I'd like to find a better way of honoring their experiences with a better question. And the time to actually hear their answers.
I found myself saying this last one out loud a few weeks ago. I couldn't for the life of me figure out why little one smelled like a hummus platter. I hadn't eaten anything nearly so delicious for longer than I could remember. So it wasn't from breast milk. That also means I couldn't have accidentally spilt anything on him.
The smell slowly dissipated and I forgot all about it. A few hours later the smell came back while little one was practicing jumps and kicks in my lap. He was warm and I was starting to crave flatbread and small plates.
It took me an embarrassingly long time to realize what was causing the smell. Little one loves bath time. Sometimes I almost think he purposely has poo explosions to get back in the bath. After each bath, I make a nest of towels and give little one a baby massage. With olive oil.
Each time he was getting warm, the olive oil was too. Mystery solved. Go figure. If it's good enough to eat, it's good enough to put on the skin.


text:
Bouncing boosts data center speeds
Jan 5, 2012 4:08am
ITEM: Researchers from the University of California, Santa Barbara, and Intel have devised a technique to speed up data traffic between servers inside a data center by bouncing it off the ceiling – literally.
The proposed solution is aimed at a significant bottleneck within a data center: moving data between different servers within the site. Servers are usually connected via wired links, and adding more wiring is both expensive and impractical. A wireless broadband approach with short-range technologies like 60-GHz Wi-Fi is relatively simpler, but comes with its own challenges, like line-of-sight and interference issues.
The research team, led by UCSB associate professor of computer science Heather Zheng, says they've found a way around the problem by bouncing the wireless signals off the ceiling of the data center, according to Technology Review:
Bouncing the beams off the ceiling directly to their targets not only ensures direct point-to-point communication between antennas but also reduces the chances that any two beams will cross and cause interference. "That's very important when you have a high density of signals," she says.
Flat metal plates placed on the ceiling can provide nearly perfect reflection. "You also need an absorber material on the rack to make sure the signal doesn't bounce back up," says Zheng.
Zheng told TR the bounce technique can improve data transmission speeds by 30%.
However, the 60-GHz solution is only in the simulation stage for now – Zheng and her team are now building a prototype data center for practical testing.

redpajama_set_name: RedPajamaCommonCrawl


text:
Q: What is the correct term for a story that sits alongside another one in time and place? What is the correct term for a book that sits alongside another book in time and universe, sharing some characters and events? Not after (a sequel) or before (a prequel), but parallel.
Example: I've just read "Ender's Shadow". It's a [something] of "Ender's Game".

A: Paraquel.
Paraquel seems to already have a level of acceptance. I found a few different links that talk about it. A Google search will reveal even more.
Funny how a word seems to be everywhere when one knows what to look for. My first thought was to use the prefix ~syn, as in synthesis to form synquel. I Then looked online and discovered some troll has trademarked the term. Which is lame. So I abandoned that idea and then considered one of the words suggested in a different answer,  paralleloquel.
While in my opinion it seemed to have more potential than other suggestions, the problem is that the word parallel means two things alongside that don't ever touch, which isn't appropriate for two stories that intertwine. However, if we strip down to just the prefix ~para, we find that it means "alongside, beyond, altered, contrary", which is suitable enough. Especially the "alongside" and "altered" bits.
~para is Greek, and ~quel is Latin, but I don't think anyone is too bothered about that kind of thing anymore.
So, my vote now is definitely for paraquel.

I've just read Ender's Shadow. It's a paraquel of Ender's Game.

Just for fun, also note in those links above some other interesting words such as circumquel, interquel, and inquel. One I don't see suggested, but could be, is intraquel, which would be a story within a story.

A: I've referred to those exact books as being coincident.

A: In another channel I've had paralleloquel as a suggestion. I quite like that.

A: If they share some of the same characters AND events wouldn't they cross or touch at some point? i.e wouldn't be parallel.
Maybe tangential might describe that better.

A: Sometimes isochronous is used that way

A: I would say that "Ender's Shadow is contemporary with Ender's Game."

A: Contemporaneous, contemporary.
Example: I've just read "Ender's Shadow". It's contemporaneous to "Ender's Game".

A: I would call them concurrent stories:

1: operating or occurring at the same time
   2: running parallel

Regarding filling your blank, I humbly offer:

I've just read "Ender's Shadow". It's a [concurrent narrative] of "Ender's Game".
  I've just read "Ender's Shadow". Its narrative is concurrent to "Ender's Game".

A: Ender's Shadow is a parallel or mirror of Ender's Game, just as Desperation is a parallel or mirror of The Regulators.

A: If we're considering synquel (mentioned by Dave M G), then another option is conquel.  The only "official" reference for this that I know of is the ever-so-reputable Urban Dictionary, but that may be good enough for this purpose.
If we're coining our own and throwing scraps of Latin together, we might try coquel (basically same as conquel) or juxtaquel.

A: Simultaneous
adjective
1. existing, occurring, or operating at the same time; concurrent

A: "same setting" is a (probably colloquial) term that I've seen used to represent stories that occur concurrently and (mostly) separately.

I've just read "Ender's Shadow". It has the same setting as "Ender's Game".

redpajama_set_name: RedPajamaStackExchange


text:
Expanding Our Reach
Nieman Reports Winter 2006
Puzzling Contradictions of China's Internet Journalism
A journalist who has worked in China says that 'the Internet has strengthened the power of the central government, not undermined it.'
@fonstuinstra
Blog China The Internet
"Gathering Voices to Share With a Worldwide Online Audience"
– Rebecca MacKinnon and Ethan ZuckermanLook at the Chinese news media through Western eyes, and the view can be depressing. What dominates most of the West's news coverage about Chinese journalists are stories about reporters being brought into court and incarcerated and censorship of new media that appears to constrain rather than enlarge the realm of free speech in China. Fortunately, this perspective offers a limited view of the revolutionary changes China's news media are experiencing. In China, as in so many places throughout the world, the key propulsion for the enormous change is the Internet. That the pace of change doesn't match expectations of the digital vanguard, which predicted that authoritarian regimes would fall like autumn leaves, does not mean that the Internet in China is not profoundly reshaping its media terrain.
When I settled at the East China Normal University in Shanghai in the summer of 1994 to prepare myself for a stay as a foreign correspondent in China, my most important communication tool was my bicycle. The Internet was unknown. To send a fax abroad would cost $15 for the first page, and mobile phones were also outrageously expensive. Chinese news media only brought forth boring propaganda. With a hundred other foreign students I shared two phone lines to the world outside Shanghai, and that was only if the moody telephone operator was not just enjoying her lunch, her lengthy afternoon nap, or just busy talking to another colleague. Conversations, she told us, should be held in Chinese or English, so she could improve her own language skills. If you spoke another language she would turn up her radio so loudly that any conversation would be impossible.
International newspapers were delivered—wrapped in brown bags so nobody else could read them—two to three days after they'd appeared elsewhere in the world. For this delivery, I was charged an outrageous surcharge by the government department with a monopoly of importing foreign newspapers. The one Reuters correspondent in town had just purchased a direct computer connection to the Shanghai stock exchange, so he didn't need to spend hours in transport. The device did not work.
The main source of information—and entertainment—for us was the rumor That the pace of change doesn't match expectations of the digital vanguard, which predicted that authoritarian regimes would fall like autumn leaves, does not mean that the Internet in China is not profoundly reshaping its media terrain.machine. Just like the Chinese students, I learned the art of picking up rumors and passing them on. With ample ways to get these rumors confirmed, corroborated or denied, passing them on was the most interesting activity at the campus. Fact checking would kill almost any good rumor, so people didn't do that, even when they could. One rumor being spread around at campus—true in this case—was that I was a journalist. After a few weeks at the campus I was approached by a Chinese student who said he had heard the rumor. I confirmed the story.
"Then you must be interested in meeting a real dissident," he said.
I was. In those post-Tiananmen years dissent was the most important subject for my foreign colleagues in Beijing. Shanghai's economic changes were in a very early stage and offered few interesting angles. Political activists in Shanghai mostly bought a one-way ticket to Beijing to pursue their activities in the capital. So I gladly agreed to meet our local dissident.
He was a rather young assistant professor in Chinese literature. At the massive student demonstrations in Shanghai in 1989 he had been one of the leaders. Unlike Beijing, Shanghai—where the demonstrations ended without violence—officials only rounded up the leaders of the unrest a few years after 1989. My assistant professor was jailed for some time and had returned to his old campus a few years earlier where he now taught literature in what seemed a dead-end job. He was loved by his students, since he read sexually explicit poems from the classics and was famous for an endless string of affairs with female students.
After a short handshake he exploded in a 30-minute exposé, denouncing the government, attacking its human rights record, lack of openness and democracy, almost without taking a breath. He did not often have this kind of opportunity to unburden himself of his beliefs and feelings in front of a foreign journalist. "Was this what you expected?" he asked me with a smile when he had finished.
He let me ask some questions. I discovered that day just how isolated my Shanghai dissident was. Few people at the university, apart from his students, dared to talk to him about anything more than the weather. There was no network he belonged to. Apart from some direct family members, he was not supported by anybody. He was as isolated, well, as isolated as I was on my bicycle riding around the city and probably like others among the 1.3 billion Chinese.
An Internet Hoax in China
Move the clock 12 years ahead, to 2006. More than 125 million Chinese are online. That is less than 10 percent of its total population, but in the larger cities the percentage exceeds half of all households. More than 500 million mobile phone numbers have been issued, and each year billions of short messages are being exchanged. China is at the brink of yet another communication revolution as the third generation mobile phones will allow wireless broadband access, a move that might likely double the number of people with broadband Internet access in five to 10 years time.
On March 8, 2006 I woke up on another continent, in Brussels, and checked my e-mail and RSS-reader. The mailing list of Global Voices, a project of the Berkman Center for Internet and Society at Harvard Law School, let me know that the government's Internet authorities had possibly closed down three Weblogs, written by Chinese journalists, who use them to circulate stories they cannot get published in the heavily censored traditional media.
A string of e-mails emerged a few hours after the blogs disappeared. While I made an entry on my own blog, others did the same, and soon news of this event raced around the globe. Reuters and the BBC started to file stories later that day. Reporters Sans Frontiéres in Paris, an NGO focusing on press freedom, issued an angry press release denouncing Chinese censorship on the Internet.
But before I went to bed, the blogs reappeared on the Internet. It turned out that these Chinese journalists played a practical joke on the Western news media, as they later told us, misusing what they regard as the Western obsession with censorship on the Internet in China. Only later did they learn that such humor is not appreciated when it crosses cultural boundaries. But from my perspective, a prescient event had taken place in these 24 hours, for the episode offered a snapshot of the Internet's powerful position in China.
The Internet affects not only how journalists are able to collect and distribute their information, but also the ways in which media function. Even editors, like Li Datong of Freezing Point, who was removed by party authorities from his job in part because of a critical internal memo he wrote and published on the Internet (before it was censored), remain optimistic. (Not only did Li Datong lose his editor's position, but also Freezing Point was closed—then reopened—by Communist party officials.) According to journalist Philip J. Cunningham who wrote in Nieman Reports (Summer 2006) after meeting with Li Datong, this Chinese journalist believes that "China's press is freer than ever while paradoxically it remains as under control as ever. One way to illustrate this is an expanding balloon marked by a design that gets bigger as the balloon gets bigger."
Government Oversight
In its early days the Internet was seen—mistakenly in my opinion—as a tool that could undermine the sitting powers and change the political situation in China. My sense now is that the opposite is the case: The Internet has strengthened the power of the central government, not undermined it. I say this because for the first time in China's history the central government has a popular and relatively easy means of eavesdropping on what is happening and being said in their country.
From its first discussions about the Internet in the early 1990's, China's bureaucracy has been heavily divided about this new media tool. Departments focused on economic development saw the need to invest heavily in the rollout of the Internet. Without this online technology, China would not be able to develop economically, they argued. In the end, the central government supported their position, despite fierce opposition from the more security-oriented departments, which viewed their task as keeping a lid on the societal tensions. This job, as they saw it, would be heavily challenged by the Internet.
This internal power struggle still plays a critical role in the exchanges among The Internet affects not only how journalists are able to collect and distribute their information, but also the ways in which media function.competing bureaucracies. And a basic knowledge of this power struggle is necessary to better understand the often conflicting signals that arise out of China—on one hand, journalists are jailed while, on the other hand, a sense of personal freedom seems rapidly to be emerging. What might be difficult for us in the West to comprehend, but which I've come to understand after years of living and working in China, is that when Chinese citizens engage with the Internet they do so not in fear of what the government might learn, but knowing that what they are doing offers them a powerful new way to reach the government.
The central government, and more and more provincial governments, monitor closely what is happening on the Internet. They do this to control its content, but also to listen carefully to the increasingly powerful voice of their online citizens. In this way the Chinese Internet fits very well into the long-standing tradition of other media by acting as a negotiation tool between the state and its citizens. Unlike Western media, China's media have never been and are not perceived by its audiences as an independent constituency.
The Chinese government regards the Internet, as it does other media, as a way to relate to its citizens. Too much censorship would serve only to cripple the very useful function of the Internet for the government. Like other media channels, the Internet is more often seen as an extension of the government than as a meeting place for opposition. Chinese Internet users are neither amazed nor shocked that their government tries to control these new media just as they've controlled forms of media that have come before. Rather, they tend to see this control as an inherent part of their reality—and most of them would rather look for ways to deal with it than have their energy consumed by opposing it.
The hoax in March reminded us of how we tend to rush to judgment when what we think is happening fits conveniently into our worldview. But nothing is quite so straightforward in China when it comes to the interaction of new media and old politics. For those trying to understand what journalism's future might be like in China, the ones who bring a willingness to look beyond where Western eyes usually look are most likely to unearth the story.
Fons Tuinstra, a former foreign correspondent, is a Shanghai-based Internet entrepreneur and consultant focusing on new and old media, the Internet, telecom and China-related policy issues.
Most popular articles from Nieman Reports
Summer 2004: Journalist's Trade Introduction
Publisher, Editor and Reporter
The Press and the Presidency


text:
Giving Way For Higher Speed, over 7000 ICF Coaches Are To Be Condemned
October 27, 2020 October 27, 2020 by Arun Kumar Das
Over 7000 conventional coaches are expected to be condemned this fiscal as Indian Railways has begun the massive exercise of replacing the entire fleet with German designed LHB (Linke Hofmann Bosch) coaches in the phase-wise manner, a move aimed at strengthening safety and increasing speed of all trains.
Firming up the action plan, 7332 coaches manufactured at Chennai's Integral Coach Factory are expected to be condemned this year with the target of doing away with 16,238 such coaches by 2025 and 23,090 by 2030.
Railways has a fleet of 60,000 coaches out of which majority are conventional coaches.
It has been decided to reduce the maximum age of conventional coaches from 25 years to 20 years so that those old ones can be replaced with modern LHB coaches, said a senior Railway Ministry official.
As recommended by Anil Kakodkar committee report on rail safety way back in 2012, the production of conventional coaches at ICF has been totally halted last year and LHB coaches are being manufactured at all three coach manufacturing units now.
Conventional coaches were introduced almost four decades back when the maximum train speed was about 60 kmph while express trains are running at 110 kmph easily.
So keeping the comfort level, safety and speed in mind, these conventional coaches are to be replaced with LHB ones, said the official.
As far as safety features are concerned couplings of ICF coaches are vulnerable to pile up over one another during accidents and derailments resulting in high casualty rate while LHB couplers are strong enough preventing telescopic effect in coaches.
Equipped with crash resistance, LHB coaches are mostly used in high speed trains and do not capsize in case of accidents.
While conventional ICF coaches range from Rs 1 – 2.5 crore per coach LHB coaches cost 40% more than conventional ICF coaches.
As per the plan, some of these condemned coaches would be converted into new modified goods (NMG) carriers for transporting automobiles while some can be used as accident relief trains required after train mishaps.
In the current year, some 825 conventional coaches are slated to be converted into NMG trains for automobile transportation.
ICF, ICF Chennai, Indian Railway, LHB Coaches, Linke Hofmann Busch (LHB)
The Launch Of Seaplane Operations In Gujarat May Pave Way For Specialised Infrastructure Development
Nitin Gadkari Laid Foundation For Nine National Highway Projects in Tripura, Boost Regional Connectivity, Trade And Tourism


Shake container before each use. Mix 1 scoop in 8-10 oz of cold water and drink between meals. On training days drink 1 serving 30 minutes before working out. Do not exceed 3 servings per day. Do not consume within 4 hours of bedtime.
Do not use if pregnant or nursing. Each serving contains 100mg caffeine. Not to be used by caffeine sensitive persons or anyone under the age of 18. Limit the use of caffeine containing beverages, supplements, foods or medications while using this product. KEEP OUT OF REACH OF CHILDREN.


Boys Cobalt Blue Gray Fox Long Sleeve Sun Protective T-Shirt is a wardrobe essential that can be worn by itself or layered. Lightweight and cool for year-round comfort indoors and outdoors. Exclusive bamboo blend provides UPF 50+ sun protection that won't wash out.


The Porpoise-class submarine was the first new submarine class launched by the Royal Navy after World War II with first of class HMS Porpoise being launched in 1956. In the period between 1945 and 1956 the Royal Navy's submarine assets continued to comprise of the war-era T-class albeit it in its upgraded and smoothed off version to reduce its underwater acoustic signature. Somewhat ironically although not uncommon amongst the wartime allies the Porpoise-class was inspired by German advancements made in the closing stages of the war.
The Porpoise-class was one of the most capable conventional submarines available to NATO in the late 50s and early 60s. They were perhaps the quietest submarines in NATO and were far quieter than the equivalent Soviet Navy Whiskey-class. This meant they were difficult to detect; a fact dramatically proven when during exercises HMS Rorqual managed to make it all the way to the Statue of Liberty undetected by the US Navy. Top speed was 18knots submerged although a more economical (and quieter) 14knots was the norm.
The Porpoise-class was the first submarine class in the Royal Navy not to be fitted with a deck gun since the R-class of World War I. This was because deck guns had become obsolete weapons due to the increasingly sophisticated detection methods employed by ASW forces that required all attacks to be made submerged. Additionally the removal of the gun reduced underwater drag and noise. The Porpoise-class was armed with eight 530mm torpedo tubes with four forward facing and two aft. A complement of 30 torpedoes could be carried or alternatively the tubes could fitted with mines.
This entry was posted in Warship Classes and tagged cold war, history, Naval, navy, royal navy, Submarine, Submarines, technology, u-boat, US Navy. Bookmark the permalink.


text:
Nicole Kidman celebrates Keith Urban's People's Choice Awards nomination
It's no little lie, Nicole is now on the campaign trail!
Sep 12, 2018 8:07am
By Chloe Lal
Nicole Kidman is a woman in love and there's no denying it.
The beloved Australian actress is currently at the Toronto International Film Festival, promoting her film The Destroyer, but her husband isn't far from her mind.
During an interview, Nic couldn't contain her joy for Keith Urban, who is nominated for two E! People's Choice Awards.
The pair have been married for 12 years.
"He is? I didn't know that," Nicole Kidman said when asked about the exciting nomination for Male Artist of 2018 and Country Artist of 2018.
Proving to be the perfect first lady, the mum-of-four went on to campaign, "Because, he's the loveliest, kindest man in the world. That's why you should vote for him."
"He's also insanely talented."
Keith always looks so smitten with Nicole!
It's been a busy time in the Kidman-Urban household.
The 51-year-old, who has wrapped up filming the second season of Big Little Lies, is promoting her new film The Destroyer.
"We were by the skin of our teeth trying to make this film," Nic shared - adding her girls with Keith, Faith Margaret, 7, and Sunday Rose, 10, were very intrigued by their mum's new project.
Celebrity FamiliesThe Pantsuit: Why celebrity mums are embracing the trend
Celeb NewsNicole Kidman and Keith Urban donate $100,000 to drought relief
"I mean, my kids are always like, 'What is she doing now? Our crazy mama.' "
"But it's also interesting for them, I think, because they see me creating characters and, you know, they have vivid imaginations themselves and they construct stories, and so that's all they know."EXCLUSIVE: Nicole Kidman on the power of female friendships and finding true love
Nic and Keith are the proud parents to their two daughters Faith Margaret and Sunday Rose.
Nicole Kidman,
undefined: Chloe Lal (1)


text:
Q: Where Could I set the application name user see in home screen Where Could I set the application name that user see in home screen, under the application icon.

A: Set "Bundle display name" in the Info.plist or your App settings file.

A: Add the following line to the InfoPlist.strings file:
CFBundleDisplayName = "My Great App";

The advantage of this method (as opposed to the entry in Info.plist) is that you can provide localized app name for several locales.


Meet thousands of local Hinton adult singles, as the worlds largest adult dating site we make dating in Hinton easy!
Over 100,000 Daters login every day to BusyMatch.com, we are the market leader in Canada, UK, Australia, US, Ireland and New Zealand, so come meet and chat with other Hinton singles Register HERE.
Power of Love I am Hellen from HintonAlberta,Canada.


text:
Q: Decrypting "SunJCE" AES encrypted data on Android We need to write some Android code to decrypt some data sent from our server.  Our server team gave us some sample decryption code which uses the "SunJCE" provider, which unfortunately doesn't exist on Android.
Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding", "SunJCE");

Does anybody know the cleanest way to implement this on Android?  If we try this on Android
Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");

then it looks like some unwanted garbage appears at the end of the decrypted text, e.g:
ComparisonFailure: expected:<...lAAAAABJRU5ErkJggg==[]> but was:<...lAAAAABJRU5ErkJggg==[��������]>

We tried lots of combinations of different transformations in the Android Cipher class (e.g. "AES/CBC/PKCS5Padding"), but kept hitting things like BadPaddingExceptions.
We were also able to decrypt this data using a Java-only module, which didn't appear to show the same garbage characters.  Is there a way to do this using just Android classes?

A: The same garbage is also present in the Java code. It's just that you probably run this on Windows that uses the default Latin (ISO_8859_1) character set and that Android uses UTF-8 by default. It also depends on the console and font used to print out the characters. In this case it is likely that the padding that is used doesn't print on the Windows console but does on the Android code.
You need to see the byte array (e.g. in hexadecimals) to find out which padding is used and then strip it off before turning the plaintext into a string.

A: @Maarten Bodewes was correct: the garbage characters are present in our Java-only module too.
The problem is that our server side code is padding the input data with zeros before encrypting it.  This is so the input matches the block size required for AES.
There's a good discussion here: Android - Removing padded bits in decryption
Even though I'm a little uneasy using this "zero padding", here's a utility I wrote to remove it:
public static String getStringAfterRemovingZeroPadding(byte[] input) {
    if (input == null) {
        return null;
    }

    int index = input.length - 1;

    while (index >= 0) {
        if (input[index] == 0) {
            // We found some zero padding, look at the next character and see if it's also zero
            // padding
            --index;
        } else {
            // This character is not a zero padding, so go back to the zero padding that we
            // just inspected, or go to the end of the string
            ++index;
            break;
        }
    }

    if (index < 0) {
        return "";
    }

    return new String(input, 0, index);
}

...and here are my unit tests:
@Test
public void testRemoveZeroPaddingNull() throws Exception {
    String result = StringUtils.getStringAfterRemovingZeroPadding(null);
    assertThat(result).isNull();
}

@Test
public void testRemoveZeroPaddingAllZeros() throws Exception {
    byte[] input = {0, 0};
    String result = StringUtils.getStringAfterRemovingZeroPadding(input);
    assertThat(result).isEqualTo("");
}

@Test
public void testRemoveZeroPaddingNoZeros() throws Exception {
    byte[] input = {80, 80, 80};
    String result = StringUtils.getStringAfterRemovingZeroPadding(input);
    assertThat(result).isEqualTo("PPP");
}

@Test
public void testRemoveZeroPaddingOneZero() throws Exception {
    byte[] input = {80, 80, 80, 0};
    String result = StringUtils.getStringAfterRemovingZeroPadding(input);
    assertThat(result).isEqualTo("PPP");
}

@Test
public void testRemoveZeroPaddingSomeZeros() throws Exception {
    byte[] input = {80, 80, 80, 0, 0, 0, 0, 0};
    String result = StringUtils.getStringAfterRemovingZeroPadding(input);
    assertThat(result).isEqualTo("PPP");
}

A: If you run this code on Android, you'll see what Ciphers are supported:
TreeSet<String> ciphers = new TreeSet<>();
for (Provider provider : Security.getProviders())
    for (Service service : provider.getServices())
        if (service.getType().equals("Cipher"))
            ciphers.add(service.getAlgorithm());
for (String cipher : ciphers)
    System.out.println(cipher);

On Windows 7 with JDK 1.8.0_51, I get:
AES
AESWrap
AESWrap_128
AESWrap_192
AESWrap_256
AES_128/CBC/NoPadding
AES_128/CFB/NoPadding
AES_128/ECB/NoPadding
AES_128/GCM/NoPadding
AES_128/OFB/NoPadding
AES_192/CBC/NoPadding
AES_192/CFB/NoPadding
AES_192/ECB/NoPadding
AES_192/GCM/NoPadding
AES_192/OFB/NoPadding
AES_256/CBC/NoPadding
AES_256/CFB/NoPadding
AES_256/ECB/NoPadding
AES_256/GCM/NoPadding
AES_256/OFB/NoPadding
ARCFOUR
Blowfish
DES
DESede
DESedeWrap
PBEWithHmacSHA1AndAES_128
PBEWithHmacSHA1AndAES_256
PBEWithHmacSHA224AndAES_128
PBEWithHmacSHA224AndAES_256
PBEWithHmacSHA256AndAES_128
PBEWithHmacSHA256AndAES_256
PBEWithHmacSHA384AndAES_128
PBEWithHmacSHA384AndAES_256
PBEWithHmacSHA512AndAES_128
PBEWithHmacSHA512AndAES_256
PBEWithMD5AndDES
PBEWithMD5AndTripleDES
PBEWithSHA1AndDESede
PBEWithSHA1AndRC2_128
PBEWithSHA1AndRC2_40
PBEWithSHA1AndRC4_128
PBEWithSHA1AndRC4_40
RC2
RSA
RSA/ECB/PKCS1Padding


Wonderful post, @Hussar Yeomanry ! Very detailed. Thanks to your description of the regiment's command structure you cleared a misunderstanding I had without noticing when writing Meagher's biography. Loved your source description.
Company K being The Irish or Meagher's Zouaves.
I couldn't help but notice this small irregularity. Was Meagher's company K or J? Also, you listed only 9 companies - was the regiment not full strength?
Formed 20th April, Mustered in to service with the rest of the regiment. As of the 22nd April their Captain is J P McIvor. He however does not appear to accompany the regiment to Washington DC. Instead for a time the Company is commanded by 1st Lieutenant J Coonan. However by the time of the battle J. P. McIvor has rejoined his company. He will be captured during (or more probably in the immediate aftermath of) the battle.
I have also since discovered a small point. During at least some of their time in Washington they were joined by ten West Point cadets who drilled them for 'seven hours a day'. How effective having 10 men trying to train 750+ raw recruits and 250 at best semi trained men (likely somewhat trained in drill but with no musketry training) is in my mind questionable.
Company E's Patrick Kelly is the same Patrick Kelly who would command the 88th New York and then the Irish Brigade after Meagher's resignation. He was killed in one of the early assaults at Petersburg.
Ah. I guessed he was but could not prove it. Therefore I noted my thoughts but nothing more.
I believe that the rumor that Meagher was intoxicated was started by a reporter for the Times of London who may have had ulterior motives for the charge.
Many rumors swirled around Meagher after the battle. Many Southern newspapers claimed that Meagher was about to leave the army and would never again fight for the Union.
As to what the truth is I really don't know.
Maybe he or friends wrote to the newspapers to paint him in good light. Also, Meagher himself published newspapers, and @John Hartwell once told me that newspapers tended to reprint articles from other newspapers. They could have easily picked those articles out of there.
The papers loving Meagher could maybe also be from him being a great speaker. They then transferred that love to reports about him in battle.
I agree, though, that this doesn't make it any easier to discern the truth about him.
@luinrina All good points. I hadn't considered that he was a newspaper man.
Personally I just don't know what to think though I still find it very suspicious that he as duly appointed acting Major does not take command when his regiment needs him and that the senior Captain does.
Possibly it would have been helpful if Corcoran had written a Supplement to the Official Report like some of those who were captured but he doesn't. We do have some personal correspondance from him and Meagher isn't mentioned one way or another (admittedly mostly the two letters are about which officers and men are being held along side him and his concern for them and their families) but there is a little about the battle - with quite a lot specifically about how he ended up being captured (bad luck it looks like) and Meagher is again absent from them (which is a little odd as some reports Meagher as specifically being appointed acting Major so he can be an assistant to Corcoran in the battle ahead of them).
Shrugs as he guesses we'll just never know what he did or did not do there.
@Pat Young - I have Captain Breslin being wounded in the shoulder on that day but didn't know the reason. So, thank you.
More information on the strength of the various companies as of the 8th January 1861 when they seem to have sent in their official returns.
Officers only mentioned when not as above.
I: Zero. But officially with a Captain Nugent commanding. What happens to him I have no idea.
K: Zip. Nothing. Nada. But officially with a Captain Reilly commanding. What happens to him I have no idea.
Although (significantly) understrength the 8 companies (of the ten they are supposed to have) appear to be quite a bit bigger than many New York State Militia Regiments at this point.
There are also suggestions that in early April attempts are made to create a Company I... though not by this Captain Nugent. Instead it is 1st Lieutenant Coonan (previously mentioned) who is running this.
No attempt seems to be made to create a Company K until the Meagher/ Irish Zouaves are added.
Continued research (included here for completeness) has found another suggestion that Captain Felix Duffy of Company G resigned while in Washington DC. Specifically http://www.civilwardata.com/active/hdsquery.dll?Muster?a=1562&b=U&c=&d=1&e=1&f=20 has him resigning on the 17th May.
There still however remains confusion on this point.
Major Bagley's whereabouts similarly remains an issue for according to the same site he musters out with his regiment back in New York. Furthermore I have him as A J Bagley. The site has him as James Bagley of the Regimental Staff - so looks like it is the same guy but there is a discrepancy.
Acting Captain T Kelly of Company A is Theodore Kelly.
Captain P Kelly of Company E as per that site and also @rpkennedy is Patrick Kelly. This image of him is from his wikipedia page.
Company H... He was transferred? Or perhaps Felix Duffy remains in command.
Captain James Kelly originally named as such.
Captain J. P. McIvor of Company I is James Patrick McIvor.
Lieutenant J Coonan of Company I - is John Coonan.
Captain Thomas F Meagher originally named as such.
Acting Captain E K Butler of Company K is Edward K Butler.
Some of these officers after their term with the 69th New York State Militia.
An interesting note about the pronunciation of "McIvor" is that I've seen it phonetically spelled "McKeever". It's not a name that I've ever come across in my life and was wondering if @Pat Young might be able to confirm that this is true.
F: Captain John Breslin: Age not given: Wounded in the run up to Bull Run and despite Corcoran's breezy asssurance to the newspaper that he would completely recover he sees no future service.
G: Captain Felix Duffy: 37 years old in '61: Reenlists as Captain, Company G 69th New York Volunteers. Killed at Antietam - possibly as Acting Major, September 17, 1862.
1st Lieutenant Company H then G or Acting Captain Company G (?) William Butler: 28 years old in '61: Wounded at Bull Run. Then 1st Lieut Company H 69th New York Volunteers. Promoted Captain May 62 and then serves in the 182nd NY.
I: Captain James P. McIvor: 25 years old in '61. Captured at Bull Run. Then upon parole Captain Company I 69th New York Volunteers. Then Lt. Colonel and Colonel, 170th New York as of September 62. Later ('65) possibly Brevet Brigadier and Major General though I am not totally convinced by the evidence for this.
Edward K. Butler: 26 years old in '61: Acting Captain of K Company during First Bull Run but reenlists in Company K of 69th NY Volunteers as 1st Lieutenant. Transfers to Company C as its Captain in July '63. Then Captain, 182nd New York. Killed at Cold Harbor.
The main thing I will say is the tremendous transfer of officers from the 69th NYSV to the 69th NYV.


Abstract: We present a hybrid framework that leverages the trade-off between temporal and frequency precision in audio representations to improve the performance of speech enhancement task. We first show that conventional approaches using specific representations such as raw-audio and spectrograms are each effective at targeting different types of noise. By integrating both approaches, our model can learn multi-scale and multi-domain features, effectively removing noise existing on different regions on the time-frequency space in a complementary way. Experimental results show that the proposed hybrid model yields better performance and robustness than using each model individually.
TL;DR: A hybrid model utilizing both raw-audio and spectrogram information for speech enhancement tasks.


text:
\section{Introduction}
Waves in periodic media is a vast subject of great interest in numerous fields. Classical methods of averaging and mathematical homogenisation are useful in applications where the wavelength is large relative to the periodicity. There are many fields, however, where the r\'egime of interest concerns wavelengths commensurate with the periodicity, as in gratings, layered media, photonic (similarly phononic, platonic,...) crystals and solid-state quantum mechanics \cite{Sakoda:Book,Joannopoulos:Book}. In these applications, the basic theoretical constituents are Bloch-wave solutions, i.e., periodically modulated plane waves supported by an infinitely periodic medium \cite{Brillouin:Book}. Dispersion surfaces relating the Bloch eigenfrequencies and eigen-wavevectors encapsulate a breadth of information including the rate and direction in which energy may propagate \cite{Notomi:10} and the existence of frequency band gaps wherein propagation is forbidden \cite{Yablonovitch:87}.

An unbounded, exactly periodic, medium is an idealisation and applications usually involve crystal boundaries, tapered designs or defects. Fortunately, there is often a scale separation between the periodicity (wavelength) and a ``macro-scale'' associated with crystalline boundaries, the length on which the crystal is tapered, the width of an incident beam, or the position of a source. It is then intuitive that the wave field is locally, in some approximate sense and away from boundaries, sources and singularities, a finite superposition of Bloch solutions. It is possible to intuitively build on this picture by encoding the local Bloch-dispersion characteristics in a Hamiltonian model \cite{Russel:99,Cassan:11}.
The equations of motion determine the variation of the Bloch wavevector along particle paths, or ``Bloch rays'', which trace the group-velocity vector. The group velocity linearly relates the macroscopic energy flux and density \cite{Sakoda:Book}; hence, given the local ray pattern and Bloch eigenmodes, the change in amplitude along a ray follows from energy conservation. Furthermore, analysing the iso-frequency contours of the dispersion surfaces in conjunction with Bragg's law allow identifying reflected, refracted (and high-order diffracted) Bloch rays at crystalline interfaces \cite{Zengerle:87,Joannopoulos:Book} (their amplitudes and phases, however, sensitively depend on details of the interface). This physical picture has been invaluable in studies of transmission through finite photonic- \cite{Notomi:10,luo:02} and platonic- \cite{Smith:12} crystal slabs, and slowly varying photonic and sonic crystals designed for cloaking and steering \cite{Kurt:08,Urzhumov:10,Romero:13}. It is difficult, however, to systematically cast these ideas into a detailed quantitative approximation of the wave field, especially when crystalline interfaces and dispersion singularities are important. Recent studies have also highlighted the role played by the Berry phase \cite{Berry:84} in graded \cite{Johnson:02} and symmetry-breaking crystals \cite{Raghu:08}, and slowly varying waveguides \cite{Tromp:92}; the Berry phase is sometimes incorporated in Hamiltonian formulations through a small ``anomalous velocity'' \cite{Panati:03,Raghu:08,Weinan:13}.

It is well known that traditional ray theory (i.e., for single-scale materials) can be derived as the short-wavelength asymptotic limit of the wave equation \cite{Holmes:Book}. Analogously, a suitable starting point for an asymptotic theory of Bloch rays is a \emph{multiple-scale} Wentzel--Kramers--Brillouin (WKB) ansatz \cite{Bensoussan:11}. It may seem surprising, given the huge applicability of geometric optics, that works along these lines have largely focused on rigorous proofs in the context of propagation and localisation of wave packets \cite{Allaire:10,Allaire:11,Cherednichenko:15,Harutyunyan:16}. These analyses are compatible with the intuitive notion of Bloch rays; they show, however, that slow Berry-like phases are important even when seeking only a leading-order approximation to the wave field. These analyses disregard diffraction at crystalline boundaries and caustics, and the dominant Bloch eigenfrequencies are assumed to be within a pass band, away from singularities in the dispersion landscape.  It seems that, to date, there has been little effort to implement and pragmatically extend these ideas towards a more applicable approximation scheme.

Dispersion singularities, namely critical points at the edges of complete and partial band gaps, along with branch crossings, are responsible for phenomena such as slow light, dynamic anisotropy \cite{Notomi:00,Ceresoli:15}, unidirectional propagation \cite{Colquitt:16} and non-trivial topological invariants \cite{Lu:14}. Fortunately, wave propagation at near-critical frequencies is well described by a distinct multiple-scale asymptotic scheme known as High-Frequency Homogenisation (HFH) \cite{Craster:10}. HFH furnishes a (typically unimodal) homogenised description where the wave field is provided as a product of an envelope function, governed by a macro-scale equation, and a rapidly varying Bloch eigenfunction, governed by the Bloch cell problem at the nominal (typically standing-wave) frequency. The method has been extensively applied to study photonic \cite{Antonakakis:13,Maling:15} (similarly phononic \cite{Antonakakis:14,Colquitt:15high}, platonic \cite{Antonakakis:12}) crystals, Rayleigh--Bloch waves along gratings \cite{Colquitt:15rayleigh}, and layered media \cite{Joseph:15}. The method is a multiple-scale analogue of near-cut-off expansions in waveguide theory \cite{Craster:09} and is also intimately connected to the KP perturbation method and the idea of an effective mass in solid-state physics \cite{Kittel:Book,Naraigh:12}.

The frequency intervals covered by multiple-scale WKB expansions and HFH complement each other. In fact, the respective regions of validity overlap at intermediate perturbations away from critical frequencies. Naively, it may appear that only one of these two methods is necessary at any given frequency. This is certainly incorrect for a graded crystal where the dispersion surfaces vary on a macro-scale and may easily become singular. Indeed, Johnson \textit{et al.}~warn that this is a ``pitfall to avoid in the design of tapered photonic crystal waveguides'' \cite{Johnson:02}; an otherwise adiabatically propagating Bloch wave would strongly reflect from the singularity. While less evident, monochromatic dispersion singularities are also ubiquitous in uniform crystals, at least in two and three dimensions. For instance, if the operating frequency lies in a partial band gap, propagation is forbidden in certain directions \cite{Ceresoli:15}; there are then singular Bloch rays separating bright and shadow regions along which the frequency is critical. To date, asymptotic analyses have exclusively focused on either non-critical regions, using the WKB method or related approaches \cite{Johnson:02}, or studied scenarios where the frequency is everywhere nearly critical, using HFH. We argue here that appropriately combining the two methods provides an avenue to a more complete asymptotic theory of high-frequency waves in locally periodic media, covering all dispersion branches, both near and away from  dispersion singularities. Specifically, we anticipate that WKB Bloch waves can be asymptotically matched in space with localised HFH-type expansions describing intermediate \emph{length} scales about dispersion singularities.

In this paper we demonstrate this approach in the simplest case of time-harmonic Helmholtz waves in a 1D locally periodic medium. We begin in \S\ref{sec:bulk} by considering the ``outer'' problem where Bloch waves propagate in a pass-band region, adiabatically varying together with the local dispersion relation of the medium. Our multiple-scale WKB analysis differs from previous works in several aspects. First, we work in the frequency domain. Second, we decompose the complex-valued transport equation into two simpler real equations respectively governing the amplitude and a slow phase; moreover, by considering perturbations of the Bloch eigenvalue problem we derive exact identities that allow us to simplify the asymptotic formulae. Third, we consider a more general multiple-scale representation of the locally periodic medium, which is consistent also with layered media.
In \S\ref{sec:behaviour} we investigate the divergence of the WKB description as a spatial band-gap edge singularity is approached. In \S\ref{sec:hfh} we study the region close to a band-gap edge using a HFH-like expansion. In \S\ref{sec:reflection} we asymptotically match the WKB and HFH expansions in the scenario where a Bloch wave is reflected from a band-gap edge. In \S\ref{sec:layered} we demonstrate the validity of our approach by comparing the asymptotic results with numerical computations in the case of a layered medium. In the concluding section \S\ref{sec:discussion} we anticipate generalisations and extensions to this work.

\section{Slowly varying Bloch waves}\label{sec:bulk}
Consider the reduced wave equation
\begin{equation} \label{master eq}
\epsilon^2\frac{d^2 u}{dx^2}+{\omega^2}\Lambda u=0.
\end{equation}
In Eq.~\eqref{master eq}, $x$ is a spatial coordinate normalised by a long scale $L$, and $\omega$ denotes the frequency normalised by $c/l$, where $c$ is a reference wave speed and $l$ is a short length scale such that $\epsilon=l/L\ll1$. Our interest is in a locally periodic medium described by the real function $\Lambda=\Lambda[\xi,r(x)]$, which is an arbitrary $2$-periodic function of the short-scale coordinate $\xi=x/\epsilon$ and a smooth function of the long scale $x$ through the parameter $r$. Specifically, our interest is in the limit where $\epsilon\to0$, with $\Lambda,\omega=O(1)$. This limit process corresponds to a high-frequency r\'egime where wavelength and periodicity are commensurate and small compared to the long scale $L$; we emphasise that ${|\Lambda-1|}$ is not assumed to be small.

As explained in \S\ref{sec:layered}, in the case of a layered medium it is necessary to assume $\Lambda$ has an expansion in powers of $\epsilon$. For the sake of calculating the wave field $u$ to leading order, however, only the first \emph{two} terms in this expansion are relevant:
\begin{equation}\label{Lambda def}
\Lambda = \chi[\xi,r(x)]+\epsilon \tau[\xi,r(x)].
\end{equation}
Here $\chi,\tau$ are real, $\epsilon$-independent, $2$-periodic functions of $\xi$, and smooth functions of $x$ through the parameter $r(x)$.

In this section we seek asymptotic solutions in the form of a multiple-scale WKB ansatz
\begin{equation} \label{master}
u = A(\xi,x)e^{i\varphi(x)/\epsilon},
\end{equation}
where $\varphi$ is real and $A$ is complex and $2$-periodic in $\xi$. Substituting \eqref{master} into \eqref{master eq} yields
\begin{multline}\label{Aeq}
\pd{^2A}{\xi^2}+2i \frac{d\varphi}{dx}\pd{A}{\xi}+\left[\omega^2\Lambda-\left(\frac{d\varphi}{dx}\right)^2\right]A \\
+ \epsilon\left(2\pd{^2A}{x\partial \xi}+2i\frac{d\varphi}{dx}\pd{A}{x}+i\frac{d^2\varphi}{dx^2}A\right)+\epsilon^2\pd{^2A}{x^2}=0.
\end{multline}
The form of \eqref{Aeq} suggests expanding $A$ as
\begin{equation} \label{A exp}
A(\xi,x) \sim A_0(\xi,x)+\epsilon A_1(\xi,x) + \cdots,
\end{equation}
where $A_0,A_1,\ldots=O(1)$ are complex-valued and $2$-periodic in $\xi$. The $O(1)$ balance of \eqref{Aeq} is:
\begin{equation}\label{A0eq}
\mathscr{L}^2_{k,\chi}A_0=0,
\end{equation}
where we define the $x$-dependent operator $\mathscr{L}^2_{k,\chi}$ and wavenumber $k$ as
\begin{equation}\label{L2}
\mathscr{L}^2_{k,\chi}=\pd{^2}{\xi^2}+2i k\pd{}{\xi}+\left(\omega^2\chi-k^2\right), \quad k(x) = \frac{d\varphi}{dx}.
\end{equation}
For $x=x'$ fixed, \eqref{A0eq} together with periodicity conditions constitutes the familiar Bloch eigenvalue problem \cite{Joannopoulos:Book} with periodic modulation $\chi[\xi,r(x')]$ and Bloch wavenumber $k(x')$. Thus, standard techniques can be employed in order to calculate a dispersion relation
\begin{equation}\label{disp}
\Omega(k,r)=\omega,
\end{equation}
where $\Omega$ is multivalued. As an example, the dispersion relation for the layered medium discussed in \S\ref{sec:layered} [cf.~\eqref{layered chi}] is visualised in Fig.~\ref{fig:disp}; note the existence of frequency band gaps, wherein $k$ is complex valued, and  crossing points at higher frequencies, where $k$ is a degenerate eigenvalue. In this section, we assume $x$ lies within a pass band, namely that the eigenvalue $k$ is real and non-degenerate. Without loss of generality, we only need to consider wavenumbers in the first Brillouin zone, $-\pi/2\le k\le \pi/2$. Let $U(\xi,\{k,r\})$ denote the eigenfunctions, which satisfy $\mathscr{L}^2_{k,\chi}U=0$ and are $2$-periodic in $\xi$. From time-reversal symmetry, if $k$ is an eigenvalue then so is $-k$ and $U(\xi,\{-k,r\})={U}^*(\xi,\{k,r\})$, where an asterisk denotes complex conjugation. In the appendix we derive the result \cite{Sakoda:Book}
\begin{equation}\label{gv relation}
\pd{\Omega}{k}= \frac{k\int|U|^2\,d\xi-i\int  U^*\pd{U}{\xi}\,d\xi}{\omega\int\chi|U|^2\,d\xi},
\end{equation}
which gives the group velocity in terms of integrals of the eigenfunctions over an elementary cell, say $\xi\in[-1,1)$.

The above discussion suggests writing the solution of \eqref{A0eq} as
\begin{equation}\label{A form}
A_0 = f(x)U\left(\xi;\{k,r\}\right),
\end{equation}
where $f$ is complex valued; it will be convenient to treat the amplitude $|f|$ and phase $\gamma$ of $f$ separately,
\begin{equation}
f(x)=|f(x)|e^{i\gamma(x)}.
\end{equation}
It is important at this stage to note that the eigenfunctions $U$ are determined for a fixed $x$ only up to an arbitrary complex-valued prefactor. Indeed, the product $fU$ remains invariant under the gauge transformation
\begin{multline}\label{gauge fU}
U\left(\xi;\{k,r\}\right)\rightarrow a(x)e^{ib(x)}\acute{U}\left(\xi;\{k,r\}\right), \\ |f(x)| \rightarrow \frac{|\acute{f}(x)|}{a(x)}, \quad \gamma(x) \rightarrow \acute{\gamma}(x) - b(x),
\end{multline}
where $a(x)$ and $b(x)$ are real.
We shall assume that a specific set of eigenfunctions $U$, varying smoothly with $x$, has been chosen.
\begin{figure}
\begin{center}
\includegraphics[scale=0.33]{twodim_comb.eps}
\caption{Bloch dispersion relation for the layered medium considered in \S\ref{sec:layered}.}
\label{fig:disp}
\end{center}
\end{figure}

Consider now the $O(\epsilon)$ balance of \eqref{Aeq}:
\begin{equation}\label{A1eq}
\mathscr{L}^2_{k,\chi}A_1 + 2\pd{^2A_0}{x\partial\xi}+2ik\pd{A_0}{x}+i\frac{dk}{dx}A_0 +\omega^2\tau A_0= 0.
\end{equation}
Eq.~\eqref{A1eq} is a forced variant of \eqref{A0eq} and we derive a solvability condition by multiplying \eqref{A1eq} by ${A}^*_0$, subtracting the conjugate of \eqref{A1eq} multiplied by $A_0$, and integrating by parts over the unit cell $\xi\in[-1,1)$. Noting the periodicity of $A_0$ and $A_1$  we find the transport equation:
\begin{equation}\label{solv complex}
-2\int \pd{{A}^*_0}{\xi}\pd{A_0}{x}\,d\xi + 2ik\int \pd{A_0}{x}{A}^*_0\,d\xi
+i\frac{dk}{dx}\int|A_0|^2\,d\xi+\omega^2\int\tau|A_0|^2\,d\xi =0.
\end{equation}
Inspection of the imaginary and real parts of \eqref{solv complex} leads to more useful equations separately governing the ``amplitude'' $|f|$ and the ``slow phase'' $\gamma$, respectively. Thus, subtracting from \eqref{solv complex} its conjugate, and using \eqref{gv relation}, we find the energy balance
\begin{equation}\label{amp eq}
\frac{d}{dx}\left(\pd{\Omega}{k}|f|^2\int\chi|U|^2\,d\xi\right) = 0.
\end{equation}
The converse manipulation yields
\begin{equation}\label{gamma A}
\mathrm{Re}\left[\int\left(\pd{A_0}{\xi}+ikA_0\right)\pd{A_0^*}{x}\,d\xi\right]=\frac{\omega^2}{2}\int\tau|A_0|^2\,d\xi,
\end{equation}
which, by eliminating $|f|$ using \eqref{A form} and \eqref{gv relation}, gives an equation for $\gamma$:
\begin{equation}\label{gamma}
\frac{d\gamma}{dx}\pd{\Omega}{k}\omega\int\chi|U|^2\,d\xi = -\mathrm{Re}\int\left(\pd{U}{\xi}+ikU\right)\pd{ U^*}{x}\,d\xi+\frac{\omega^2}{2}\int\tau|U|^2\,d\xi.
\end{equation}
By substituting the two identities \eqref{dk} and \eqref{dU}, derived in the appendix, \eqref{gamma} can be rewritten in a more convenient form where differentiation with respect to $\xi$ is circumvented:
\begin{equation}\label{gamma2}
\frac{d\gamma}{dx}=\frac{\mathrm{Im}\int\pd{\chi}{r}\pd{U^*}{x}U\,d\xi}{\int\pd{\chi}{r}|U|^2\,d\xi}+\frac{\omega\int\tau|U|^2\,d\xi}{2\pd{\Omega}{k}\int\chi|U|^2\,d\xi}.
\end{equation}

The asymptotic solution in a spatial pass band may also involve an oppositely propagating Bloch wave. A general leading-order approximation is therefore
\begin{equation}\label{WKB solution}
u \sim \mathcal{A}_+\frac{Ue^{i\gamma^+}e^{i\varphi^+/\epsilon}}{\sqrt{\left|\pd{\Omega}{k}\right|\int{\chi}|U|^2\,d\xi}}
+\mathcal{A}_-\frac{ U^*e^{i\gamma^-}e^{i\varphi^-/\epsilon}}{\sqrt{\left|\pd{\Omega}{k}\right|\int{\chi}|U|^2\,d\xi}},
\end{equation}
where
\begin{equation}\label{phi pm}
\frac{d\varphi^{\pm}}{dx}=\pm k(x),
\end{equation}
\begin{equation}\label{gamma pm}
\frac{d\gamma^{\pm}}{dx}=\pm\frac{\mathrm{Im}\int\pd{\chi}{r}\pd{U^*}{x}U\,d\xi}{\int\pd{\chi}{r}|U|^2\,d\xi}\pm\frac{\omega\int\tau|U|^2\,d\xi}{2\pd{\Omega}{k}\int\chi|U|^2\,d\xi},
\end{equation}
and  $\mathcal{A}_{\pm}$ are complex constants.
In writing \eqref{gamma pm} we note that the group velocity is odd in $k$ and that under the transformation $k\rightarrow-k$ the first integral on the right-hand side of \eqref{gamma} is conjugated. We further note that the direction of propagation of the WKB solutions in \eqref{WKB solution} is determined by the sign of the group velocity rather than that of $k$.

\section{Breakdown of the WKB description near a band-gap edge}\label{sec:behaviour}
In this section we investigate the manner in which the WKB solutions \eqref{WKB solution} loose validity near a band-gap edge. Thus, let $x=x_t$ divide the macro-scale into spatial regions wherein $\omega$ respectively falls within a pass band ($k$ real) and a stop band ($k$ complex). We denote $r(x_t)=r_t$ and $k(x_t)=k_t$, and assume the usual case where the critical wavenumber is at the centre or edge of the Brillouin zone (see Fig.~\ref{fig:disp}), i.e., $k_t=0$ or $\pi/2$, respectively. Assuming $r(x)$ is not critical at $x_t$ we write
\begin{equation}\label{r exp}
r(x) \sim r_t + (x-x_t)\left(\frac{dr}{dx}\right)_t + O(x-x_t)^2 \quad \text{as} \quad x\to x_t
\end{equation}
and
\begin{equation}\label{chi exp}
\chi(\xi,r) \sim \chi_t(\xi) + (x-x_t)\left(\pd{\chi}{r}\right)_t\left(\frac{dr}{dx}\right)_t+ O(x-x_t)^2 \quad \text{as} \quad x\to x_t,
\end{equation}
where a $t$ subscript denotes evaluation at $x=x_t$.
Time-reversal symmetry and periodicity of the dispersion curves suggest that
\begin{equation}\label{zero gv}
\left(\pd{\Omega}{k}\right)_t = 0, \quad \left(\pd{^2\Omega}{k\partial r}\right)_t=0, \quad \left(\pd{^3\Omega}{k^3}\right)_t=0, \quad \ldots,
\end{equation}
which in turn imply the expansion
\begin{multline}\label{Omega exp B}
\Omega(r,k) \sim \Omega_t + (r-r_t)\left(\pd{\Omega}{r}\right)_t   +  \frac{1}{2}(k-k_t)^2\left(\pd{^2\Omega}{k^2}\right)_t \\ + O[(r-r_t)^2,(r-r_t)(k-k_t)^2,(k-k_t)^4] \quad \text{as} \quad x\to x_t.
\end{multline}
But $\Omega(r,k)=\omega$ for all $x$, hence
\begin{equation}\label{k exp}
k(x)\sim k_t + k_{1/2}(x-x_t)^{1/2}+ O\left(|x-x_t|^{3/2}\right) \quad \text{as} \quad x\to x_t,
\end{equation}
where
\begin{equation}\label{k12 thermo}
k_{1/2}^2=-2{\left(\frac{dr}{dx}\right)_t\left(\pd{\Omega}{r}\right)_t}\Big{/}{\left(\pd{^2\Omega}{k^2}\right)_t}.
\end{equation}
In \eqref{k exp} and throughout the paper the square-root function has a branch cut along the negative imaginary axis and is positive along the positive real axis. In \eqref{k12 thermo}, the sign of $k_{1/2}$ is chosen so that $k-k_t$ has the correct sign when $x$ is on the side of $x_t$ where $k$ is real. It follows from \eqref{Omega exp B} and \eqref{k exp} that
\begin{equation}\label{gv expansion}
\pd{\Omega}{k} \sim  k_{1/2}(x-x_t)^{1/2}\left(\pd{^2\Omega}{k^2}\right)_t + O(x-x_t) \quad \text{as} \quad x\to x_t.
\end{equation}

Having the above expansions for the dispersion characteristics of the material near $x_t$, we are ready to obtain the corresponding asymptotics of \eqref{WKB solution}. Consider first the fast phases $\varphi^{\pm}$; from \eqref{phi pm} together with \eqref{k exp} we find
\begin{equation}
\varphi^{\pm}(x) \sim \varphi^{\pm}_t \pm k_t (x-x_t) \pm \frac{2}{3}k_{1/2}(x-x_t)^{3/2} + O\left(|x-x_t|^{5/2}\right)  \quad \text{as} \quad x\to x_t.
\end{equation}
Subtler are the asymptotics of $U$ and $\gamma^{\pm}$, particularly because $U$ and $\gamma$, considered separately, are ``gauge dependent''  [cf.~\eqref{gauge fU}]. Fixing the standing-wave eigenfunction $U(\xi,{k_t,r_t})=U_t(\xi)$, the perturbation theory in the appendix gives
\begin{equation}\label{U exp}
U(\xi,\{k,r\}) \sim U_t(\xi) + (x-x_t)^{1/2}U_{1/2}(\xi) + \cdots \quad \text{as} \quad x\to x_t.
\end{equation}
As explained in the appendix, $U_{1/2}$ remains gauge dependent even after fixing the standing-wave eigenfunction; in fact, in general one could add to \eqref{U exp} an intermediate-order term proportional to $U_t$. We assume the chosen gauge entails no such intermediate term, which would only arise in an analytical or computational scheme if intentionally forced to.
Substituting \eqref{U exp} and  \eqref{gv expansion} into \eqref{gamma pm} shows that the $x$ derivatives of $\gamma^{\pm}$ are $O\left(|x-x_t|^{-1/2}\right)$ as $x\to x_t$, which implies
\begin{equation}\label{gamma exp}
\gamma^{\pm} (x) \sim \gamma^{\pm}_t + O\left(|x-x_t|^{1/2}\right) + \cdots \quad \text{as} \quad x\to x_t.
\end{equation}

The asymptotic estimates \eqref{gv expansion}, \eqref{U exp} and \eqref{gamma exp} together yield the behaviour of the \emph{leading-order} WKB solution \eqref{WKB solution}:
\begin{multline}\label{WKB asym}
u \sim \frac{\mathcal{A}_+ e^{i\gamma_t^+ + i\varphi_t^+/\epsilon}}{\sqrt{\left|k_{1/2}\left(\pd{^2\Omega}{k^2}\right)_t\right|\int{\chi_t}|U_t|^2\,d\xi}}\left\{\frac{U_t(\xi)}{|x-x_t|^{1/4}}+O\left(|x-x_t|^{1/4}\right)\right\} \\
\times \exp\left\{ ik_t \frac{x-x_t}{\epsilon} + \frac{2}{3}i k_{1/2}\frac{(x-x_t)^{3/2}}{\epsilon} + O\left(|x-x_t|^{5/2}/\epsilon\right)\right\} \\
+ \frac{\mathcal{A}_- e^{i\gamma_t^- + i\varphi_t^-/\epsilon}}{\sqrt{\left|k_{1/2}\left(\pd{^2\Omega}{k^2}\right)_t\right|\int{\chi_t}|U_t|^2\,d\xi}}\left\{\frac{\bar{U}_t(\xi)}{|x-x_t|^{1/4}}+O\left(|x-x_t|^{1/4}\right)\right\} \\
\times \exp\left\{ -ik_t \frac{x-x_t}{\epsilon} - \frac{2}{3}i k_{1/2}\frac{(x-x_t)^{3/2}}{\epsilon} + O\left(|x-x_t|^{5/2}/\epsilon\right) \right\} \quad \text{as} \quad x\to x_t.
\end{multline}
Expansion \eqref{WKB asym} can be made more revealing by noting that $U_t\exp(ik_t\xi)$ is anti-periodic and real up to a multiplicative complex prefactor. We may therefore write $U_t=\exp(i\beta)\exp(-ik_t\xi)\mathcal{U}_t(\xi)$, where $\beta$ is a real phase depending on the gauge choice and $\mathcal{U}_t(\xi)$ is a periodic (if $k_t=0$) or anti-periodic (if $k_t=\pi/2$) real function; similarly, $U^*_t=\exp(-i\beta)\exp(ik_t\xi)\mathcal{U}_t(\xi)$. We next note that $\exp(ik_t\xi)\exp(-ik_t x/\epsilon)$ and $\exp(-ik_t\xi)\exp(ik_t x/\epsilon)$ represent exactly the same function. Note that, for $k_t=\pi/2$, the latter function is \emph{not} the unity function, since the dependence on $\xi$ is extended from the unit cell $\xi\in(-1,1)$ to all $x$ by a periodic continuation, whereas $\exp[i\pi x/(2\epsilon)]$ has a period of two cells. These observations allow us to rewrite \eqref{WKB asym} as
\begin{multline}\label{WKB asym reduced}
u \sim \frac{\exp{(ik_t x/\epsilon)}U_t(\xi)}{|x-x_t|^{1/4}\sqrt{\left|k_{1/2}\left(\pd{^2\Omega}{k^2}\right)_t\right|\int{\chi_t}|U_t|^2\,d\xi}} \times \\ \left\{\mathcal{A}_+ e^{i\gamma_t^+ + i\varphi_t^+/\epsilon-ik_tx_t/\epsilon}
 \exp\left[\frac{2}{3}i k_{1/2}\frac{(x-x_t)^{3/2}}{\epsilon}\right] + \right. \\ \left.
\mathcal{A}_- e^{i\gamma_t^- + i\varphi_t^-/\epsilon+ik_tx_t/\epsilon-2i\beta}\exp\left[ - \frac{2}{3}i k_{1/2}\frac{(x-x_t)^{3/2}}{\epsilon}\right] \right\} \quad \text{as} \quad x\to x_t.
\end{multline}
We now see that the field $u$ is asymptotic to an oscillating tale of an Airy function, varying on an intermediate $O(\epsilon^{2/3})$ scale, and modulated on the short $O(\epsilon)$  scale by the periodic or anti-periodic standing-wave Bloch eigenfunction $\exp{(ik_t x/\epsilon)}U_t(\xi)$. On one hand, an Airy tale is reminiscent of the behaviour of a single-scale WKB solution near a turning point \cite{Holmes:Book}. On the other hand, a multiple-scale solution where an envelope function is modulated by a short-scale standing-wave Bloch eigenmode is nothing but the ansatz assumed in HFH \cite{Craster:10}. These two observations together suggest looking next at the region $x-x_t=O(\epsilon^{2/3})$ using a localised HFH-like expansion.

\section{High-frequency homogenisation of the band-gap edge}\label{sec:hfh}
Thus near the band-gap edge $x=x_t$ we look for a multiple-scale solution in the form
\begin{equation}\label{hfh ansatz}
u = \epsilon^{-1/6}e^{ik_t x/\epsilon}T(\xi,\bar{x}), \quad \bar{x}=\frac{x-x_t}{\epsilon^{2/3}},
\end{equation}
where $T$ is $2$-periodic in $\xi$, and $k_t=0$ or $\pi/2$. In terms of $\bar{x}$,
\begin{equation}
\Lambda \sim \chi_t(\xi)+\epsilon^{2/3}\bar{x}\left(\frac{dr}{dx}\right)_t\left(\pd{\chi}{r}\right)_t(\xi) + O(\epsilon);
\end{equation}
note that $\tau$ enters only at $O(\epsilon)$ and will not affect the leading order of $T$.
Substitution of \eqref{hfh ansatz} into the governing equation \eqref{master eq} gives
\begin{equation}\label{T eq}
\mathscr{L}^2_{k_t,\Lambda}T+ \epsilon^{1/3}\left(2\pd{^2T}{\bar{x}\partial\xi}+2ik_t\pd{T}{\bar{x}}\right) + \epsilon^{2/3}\pd{^2T}{\bar{x}^2} = 0.
\end{equation}
The form of \eqref{T eq} suggests the expansion
\begin{equation}
T(\xi,\bar{x}) \sim T_0(\xi,\bar{x}) + \epsilon^{1/3}T_1(\xi,\bar{x}) + \epsilon^{2/3}T_2(\xi,\bar{x})+ \cdots,
\end{equation}
where as usual $T_0,T_1,\ldots$ are 2-periodic in $\xi$.
The $O(1)$ balance of \eqref{T eq},
\begin{equation}\label{T O1}
\mathscr{L}^2_{k_t,\chi_t}T_0=0,
\end{equation}
in conjunction with periodicity on the short scale, is identified as the zone-centre ($k_t=0$) or zone-edge ($k_t=\pi/2$) Bloch problem. The solution \eqref{T O1} therefore reads
\begin{equation}
T_0 = g_0(\bar{x})U_t(\xi),
\end{equation}
where $g_0$ is a leading-order envelope function, and the standing-wave Bloch eigenfucntion $U_t(\xi)=U[\xi;(k_t,r_t)]$ is specifically chosen as in \S\ref{sec:behaviour}.  The $O(\epsilon^{1/3})$ balance of \eqref{T eq} gives
\begin{equation}
\mathscr{L}^2_{k_t,\chi_t}T_1=-2\frac{dg_0}{dx}\left(ik_tU_t+\frac{dU_t}{d\xi}\right).
\end{equation}
It is readily verified that solvability is identically satisfied. The general solution is
\begin{equation}
T_1 = g_1(\bar{x})U_t(\xi)+\frac{dg_0}{d\bar{x}}\Phi(\xi),
\end{equation}
where $\Phi$ is any particular solution of
\begin{equation}
\mathscr{L}^2_{k_t,\chi_t}\Phi=-2ik_tU_t-2\frac{dU_t}{d\xi}
\end{equation}
that is $2$-periodic.
Finally, consider the $O(\epsilon^{2/3})$ balance of \eqref{T eq},
\begin{multline}
\mathscr{L}^2_{k_t,\chi_t}T_2=-2\frac{dg_1}{dx}\left(ik_tU_t+\frac{dU_t}{d\xi}\right) \\
-\frac{d^2g_0}{d\bar{x}^2}\left(2\frac{d\Phi}{d\xi}+2ik_t\Phi_1+U_t\right)-\omega^2\bar{x}g_0\left(\frac{dr}{dx}\right)_t\left(\pd{\chi}{r}\right)_t U_t.
\end{multline}
A solvability condition is derived in the usual way. We find that the envelope function $g_0(\bar{x})$ is governed by an Airy equation,
\begin{equation}\label{scary Airy}
\frac{d^2g_0}{d\bar{x}^2}+\left[\frac{\omega^2\left(\frac{dr}{dx}\right)_t\int \left(\pd{\chi}{r}\right)_t |U_t|^2\,d\xi}{2\int \frac{d\Phi}{d\xi}U_t^*\,d\xi+2ik_t\int\Phi U^*_t\,d\xi+\int|U_t|^2\,d\xi}\right]\,\bar{x}g_0 =0,
\end{equation}
where the constant in the square brackets is provided in terms of integrals of the leading- and first-order short-scale eigenfunctions $U_t$ and $\Phi$. Remarkably, however, this constant turns out to be equal to $k^2_{1/2}$ [cf.~\eqref{k12 thermo}]; this connection is derived in the appendix, see \eqref{k12}. The Airy equation \eqref{scary Airy} therefore reduces to
\begin{equation}\label{Airy}
\frac{d^2g_0}{d\bar{x}^2}+k_{1/2}^2\bar{x}g_0 =0.
\end{equation}
Hence
\begin{equation}\label{g solution}
g_0(\bar{x})=\mathcal{A}\,\mathrm{Ai}(\pm |k_{1/2}|^{2/3}\bar{x})+\mathcal{B}\,\mathrm{Bi}(\pm |k_{1/2}|^{2/3}\bar{x}),
\end{equation}
where $\mathcal{A}$ and $\mathcal{B}$ are constants, $\mathrm{Ai}$ and $\mathrm{Bi}$ are the first and second Airy functions, and the plus (minus) sign applies if crossing into the band gap as $x$ is increased (decreased).

We shall see that the leading-order multiple-scale solution $\epsilon^{-1/6}e^{ik_t x/\epsilon}U_t(\xi)g_0(\bar{x})$, with $g_0$ given by \eqref{g solution}, can be matched, on the pass-band side of $x_t$, with the propagating WKB solutions \eqref{WKB solution}. On the stop-band side of $x_t$, where $k$ is complex, we anticipate that the solution can be matched with evanescent WKB solutions, though we do not consider this here. The evanescent WKB waves may be ignored when tunnelling effects are absent or negligible and in what follows we consider one such scenario in detail.

\begin{figure}[t]
\begin{center}
\includegraphics[scale=0.55]{reflection_schematic.eps}
\caption{Reflection from a spatial band-gap edge. An incident Bloch wave, described by a multiple-scale WKB approximation,  adiabatically propagates to the right. Adiabatic propagation breaks down as the Bloch wavenumber $k$ approaches $k_t=\pi/2$. Asymptotically matching the WKB approximation with a multiple-scale HFH solution localised about the singularity determines the reflected Bloch wave propagating left from the singularity.
}
\label{fig:reflection_schematic}
\end{center}
\end{figure}

\section{Bloch-wave reflection from a band-gap edge}\label{sec:reflection}
Consider a slowly varying Bloch wave incident on a band-gap edge singularity, assuming that the band gap is spatially wide so that tunnelling-assisted transmission across it is absent or of exponentially small order (see Fig.~\ref{fig:reflection_schematic}). We accordingly set $\mathcal{B}=0$ in \eqref{g solution}. The leading-order approximation in the transition region is therefore
\begin{equation}\label{trans leading}
u \sim \epsilon^{-1/6}\mathcal{A}e^{ik_t x/\epsilon}U_t(\xi) \mathrm{Ai}\left(\pm |k_{1/2}|^{2/3}\bar{x}\right),
\end{equation}
where the $\pm$ sign implies matching with the propagating WKB solution \eqref{WKB solution} in the limit as $\bar{x}\to\mp\infty$. We carry out the matching using van Dyke's rule \cite{Van:Book} with respect to the long-scale variables $x$ and $\bar{x}$, keeping the short-scale variable $\xi$ fixed. Thus, rewriting  \eqref{trans leading} in terms of $x$ rather than $\bar{x}$, then expanding to leading order in $\epsilon$, yields
\begin{multline}\label{trans expansion}
u \sim \mathcal{A}\frac{e^{ik_t x/\epsilon}U_t(\xi)}{2i\sqrt{\pi}|k_{1/2}|^{1/6}|x-x_t|^{1/4}}\left[e^{i\frac{\pi}{4}}e^{i\frac{2}{3}|k_{1/2}||x-x_t|^{3/2}/\epsilon} \right. \\ \left. - e^{-i\frac{\pi}{4}}e^{-i\frac{2}{3}|k_{1/2}||x-x_t|^{3/2}/\epsilon}\right].
\end{multline}
We compare \eqref{trans expansion} to the leading-order WKB solution \eqref{WKB solution}, rewritten in terms of $\bar{x}$ rather than $x$, then expanded to leading order in $\epsilon$. We thereby see that \eqref{trans expansion} and \eqref{WKB asym reduced} must coincide.

Consider first the case where the band gap is to the right of $x_t$. If $k_t=0$ then $k>0$ for $x-x_t<0$ and hence $k_{1/2}=-i|k_{1/2}|$. Alternatively, if $k_t=\pi/2$, then $k-k_t<0$ for $x-x_t<0$ and hence $k_{1/2}=i|k_{1/2}|$; note also that $|x-x_t|^{3/2}=i(x-x_t)^{3/2}$.
Thus matching yields the connection formulae
\begin{gather}\label{connection1}
\frac{\mathcal{A}e^{i\frac{\pi}{4}}}{2i\sqrt{\pi}|k_{1/2}|^{1/6}} = \frac{\mathcal{A}_{\mp} e^{i\gamma_t^{\mp} + i\varphi_t^{\mp}/\epsilon\pm ik_tx_t/\epsilon-(1\pm 1)i\beta}}{\sqrt{\left|k_{1/2}\left(\pd{^2\Omega}{k^2}\right)_t\right|\int{\chi_t}|U_t|^2\,d\xi}}, \\ \label{connection2}
-\frac{\mathcal{A}e^{-i\frac{\pi}{4}}}{2i\sqrt{\pi}|k_{1/2}|^{1/6}}= \frac{\mathcal{A}_{\pm} e^{i\gamma_t^{\pm} + i\varphi_t^{\pm}/\epsilon\mp ik_tx_t/\epsilon-(1\mp1)i\beta}}{\sqrt{\left|k_{1/2}\left(\pd{^2\Omega}{k^2}\right)_t\right|\int{\chi_t}|U_t|^2\,d\xi}},
\end{gather}
where here the upper sign is for $k_t=0$ and the lower sign is for $k_t=\pi/2$.
Similar considerations show that \eqref{connection1} holds also in the case where the band gap is to the left of $x_t$.
Either $\mathcal{A}_+$ or $\mathcal{A}_-$, whichever corresponds to the incident WKB wave propagating towards the singularity, is assumed known. The  other coefficient, determining the reflected WKB wave, is found by eliminating $\mathcal{A}$ from \eqref{connection1} and \eqref{connection2}:
\begin{equation}\label{reflection}
\frac{\mathcal{A}_+}{\mathcal{A}_- }= {-ie^{i(\gamma_t^- -\gamma_t^+)+i(\varphi_t^- -\varphi_t^+)/\epsilon+2ik_tx_t/\epsilon-2i\beta} }.
\end{equation}
The incident and reflected waves in \eqref{WKB solution} are  equal in amplitude up to the pre-factors $\mathcal{A}_+$ and $\mathcal{A}_-$. Thus \eqref{reflection} confirms that the incident wave is totally reflected and determines the initial phase of the reflected wave. Finally, obtaining $\mathcal{A}$ from either \eqref{connection1} or \eqref{connection2} determines the solution in the transition region.

\begin{figure}[t]
\begin{center}
\includegraphics[scale=0.3]{layer_model.eps}
\caption{Two-variable representation of the locally periodic layered medium considered in \S\ref{sec:layered}, in the case $r=1.5 +0.5\tanh(3x/2)$ and $\epsilon=0.1$. The black line depicts the material parameter $\Lambda$ exactly. The red dashed line shows the leading-order approximation $\Lambda\sim \chi(\xi,r)$, which is insufficiently accurate to serve the leading-order WKB approximation developed in this paper. The red solid line depicts the improved and sufficient approximation $\Lambda\sim\chi(\xi,r)+\epsilon\tau(\xi,r)$.}
\label{fig:layer_model}
\end{center}
\end{figure}
\section{Example: A layered medium}
\label{sec:layered}
\subsection{Consistent two-variable representation}
We now describe an implementation of the above asymptotic theory in the case of a locally periodic layered medium. Specifically, consider a layered medium made out of unit cells of width $2\epsilon$, where
in the left half of each cell $\Lambda=1$ whereas in the right-half $\Lambda$ equals the value of $r^2(x)$ \emph{evaluated at the centre of that cell} (see black line in Fig.~\ref{fig:layer_model}). It is tempting to set $\Lambda = \chi[\xi,r(x)]$, where
\begin{equation}\label{layered chi}
\chi =\begin{cases}
1, & -1<\xi<0 \\
r^2,              & 0<\xi<1.
\end{cases}
\end{equation}
As prompted in \S\ref{sec:bulk}, however, this choice would not accurately represent our layered medium (see dashed red line in Fig.~\ref{fig:layer_model}). Indeed, $r(x)$ varies by $O(\epsilon)$ across the positive-$\xi$ half of each cell, while the true layered medium consists of strictly homogeneous layers. For this reason we allowed $\Lambda$ to have an $O(\epsilon)$ correction [cf.~\eqref{Lambda def}]. Specifically, a layered medium can be consistently modelled as $\Lambda = \chi[\xi,r(x)] + \epsilon \tau[\xi,r(x)] + O(\epsilon^2)$, where $\chi$ is provided by \eqref{layered chi} and
\begin{equation}\label{layered tau}
\tau =\begin{cases}
0, & -1<\xi<0 \\
-2\xi r\frac{dr}{dx},              & 0<\xi<1.
\end{cases}
\end{equation}
It is easy to see that the corrected material coincides, to $O(\epsilon)$, with the true layered medium (see red line in Fig.~\ref{fig:layer_model}). Our asymptotic theory reveals that the correction $\epsilon\tau$ is crucial in propagating the slow Berry-like phases $\gamma^{\pm}(x)$ and accordingly plays an important role in fixing the crests and troughs of the WKB Bloch waves; in contrast, the correction was not important in the leading-order HFH analysis of the transition region.

\begin{figure}[t]
\begin{center}
\includegraphics[scale=0.37]{adiab_om3_2ep_1.eps}
\caption{Comparison between the WKB approximation and a TM simulation in the scenario where a Bloch-like wave propagates to the right through a locally periodic medium ($r=1.9-0.9\tanh(x^2),\, \epsilon=0.1,\,\omega=3.2$). The medium is homogeneous for $|x|\gg1$ and an incident plane wave is prescribed at large negative $x$. The weak reflection observed in the TM simulation is neglected in the adiabatic WKB approximation.}
\label{fig:ad1}
\end{center}
\end{figure}
\begin{figure}[t]
\begin{center}
\includegraphics[scale=0.37]{adiab_om_2ep_05.eps}
\caption{
Like Fig.~\ref{fig:ad1} but for $r=7-6\tanh(4x^2),\,\epsilon=0.05,\,\omega=0.2$. }
\label{fig:ad2}
\end{center}
\end{figure}
\begin{figure}[t]
\begin{center}
\includegraphics[scale=0.37]{BGref_om_6ep_04.eps}
\caption{
A Bloch-like wave, propagating to the right through a locally periodic medium ($r=2.1+1.1\tanh x,\, \epsilon=0.04,\,\omega=0.65$), is totally reflected from a spatial band gap. An incident plane wave is prescribed at large negative $x$ where the medium is homogeneous. A comparison is shown between a TM simulation and an asymptotic approximation compound of WKB waves matched to a HFH solution localised about the band-gap edge.  }
\label{fig:nonad}
\end{center}
\end{figure}

\subsection{Bloch eigenvalue problem}
To implement the asymptotic scheme we need to solve the Bloch eigenvalue problem at fixed $\omega$, as a function of the material property $r$ varying on the long scale. That problem consists of the differential equation $\mathscr{L}^2_{k,\chi}U=0$ together with periodic boundary conditions on the cell boundaries $\xi=\pm1$. The solution when $\chi$ is given by \eqref{layered chi} is well known  \cite{Kittel:Book}. In particular, the dispersion relation is
\begin{equation}\label{layer dispersion}
2r\cos(2k)=2r\cos\omega\cos(r\omega)-(1+r^2)\sin\omega\sin(r\omega),
\end{equation}
while the periodic Bloch eigenfunctions can be written as
\begin{equation}\label{mode}
U(\xi,\{r,k\})=e^{-ik\xi}
\begin{cases}
a_1e^{i\omega\xi}+a_2e^{-i\omega\xi}, & -1<\xi<0 \\
  b_1e^{i\omega r\xi}+b_2e^{-i\omega r\xi},              & 0<\xi<1.
\end{cases}
\end{equation}
We fix the gauge by setting $a_1=e^{i\omega}\left[1+2e^{ir\omega}(r-1)+r\left(1-2e^{i(2k+\omega+\omega r)}\right)\right]$;
the remaining coefficients $a_2$, $b_1$ and $b_2$ are then determined from periodicity along with continuity of $U$ and its first derivative at $\xi=0$.

\subsection{Numerical validation: Adiabatic propagation}
In what follows we compare our asymptotic approach with a numerical transfer-matrix (TM) scheme \cite{Yeh:Book}.
This numerical scheme takes advantage of the fact that within each layer the solution of \eqref{master eq} is a superposition of two harmonic waves propagating in opposite directions. The solution can therefore be represented by two layer-dependent complex coefficients that characterise the amplitudes and phases of the harmonic waves; if the two coefficients are known for one layer, the solution everywhere can be determined by applying continuity conditions at successive interfaces. Usually one does not know \emph{a priori} the values of both coefficients in any given cell and a shooting method is used.

We first demonstrate propagation in a locally periodic material, which, at a given operating frequency, is free of dispersion singularities. Accordingly, we expect the WKB solutions \eqref{WKB solution} to hold for all $x$. For the sake of simplicity we assume $r\to1$ as $x\to\pm\infty$, which means that at infinity the medium is homogeneous and accordingly the solution tends to a superposition of oppositely propagating plane waves. To simulate an incident wave from the left, we numerically prescribe at a large negative $x$ the coefficient of the right-propagating wave and determine the coefficient of the left-propagating wave by a shooting method that ensures the radiation condition is satisfied at large positive $x$ (no incoming plane wave). The corresponding asymptotic solution is given by  the right-propagating  WKB Bloch wave in \eqref{WKB solution}, which is advanced using \eqref{phi pm} and \eqref{gamma pm} starting from the incident plane wave at large negative $x$; the asymptotic scheme does not predict a reflected Bloch wave in this case hence the second solution in \eqref{WKB solution} is discarded.

Figs.~\ref{fig:ad1} and \ref{fig:ad2} show a comparison between the WKB asymptotics and the TM scheme in the respective cases (i) $\omega=3.2,\,\epsilon=0.1,\,r=1.9-0.9\tanh(x^2)$ and (ii) $\omega=0.2,\,\epsilon=0.05,\,r=7-6\tanh(4x^2)$. The figures also show the variation of the material parameter $r$ along with the local Bloch wavenumber and group velocity. The agreement between the asymptotic and numerical solutions is excellent. Fig.~\ref{fig:ad1} shows that the method remains accurate even when the long scale is not very large compared with the short scale. Moreover, at $x=0$ the local Bloch eigenvalue is close to a branch crossing and this too does not result in appreciable deviations. The comparison in Fig.~\ref{fig:ad2} demonstrates the efficacy of the WKB solution for strong and moderately rapid variations. The frequency $\omega$ is low, which explains the long wavelength for $|x|\gtrsim1$. For $|x|\lesssim 1$, however, $r$ goes up to $7$ and the wavelength is intermittently short and long in the right and left halves of each unit cell (the wave field is accordingly curved in the grey layers and almost linear in the white layers). Note also that at $x=0$ the Bloch eigenvalue is close to a band-gap edge, where the WKB description breaks down. Thus we have demonstrated agreement under extreme circumstances. We stress that if a naive approach is taken, where  either the slow phase $\gamma$ or the medium correction $\tau$ are ignored, the agreement is quite poor and the error does not vanish as $\epsilon\to0$.

\subsection{Numerical validation: Reflection from a band-gap edge}
We next demonstrate the scenario discussed in \S\ref{sec:reflection} where a Bloch wave is reflected from a band-gap edge. Specifically, we consider a locally periodic layered medium $r=2.1+1.1\tanh x$. The medium is homogeneous at large negative $x$, slowly transforming into a band-gap medium at larger $x$; for an operating frequency $\omega=0.65$ the Bloch wavenumber $k$ is real for $x<x_t\approx 0.5$ and complex  for $x>x_t$ with real part $k_t=\pi/2$ (see  Fig.~\ref{fig:nonad}). To construct the asymptotic solution we advance the right-propagating WKB wave from a prescribed incident wave at large negative $x$. We then use the theory in \S\ref{sec:behaviour}--\S\ref{sec:reflection} to match the diverging solution with a local HFH description for $|x-x_t|=O(\epsilon^{2/3})$, which in turn determines through matching initial conditions for advancing a reflected left-propagating WKB wave. The numerical scheme is applied as before but now with a shooting method ensuring there is no exponentially growing evanescent wave for $x>x_t$. Fig.~\ref{fig:nonad} shows excellent agreement between the asymptotic and numerical solutions for $\epsilon=0.04$. We note that  $\gamma$ and $\tau$ play a particularly crucial role in this scenario since matching sensitively depends on the limiting value $\gamma_t$ of the slow phase. We lastly note that in principle the HFH solution could also be matched with an exponentially decaying  evanescent Bloch wave for $x>x_t$, though this will not affect the reflected wave in the present scenario where tunnelling is absent.

\section{Discussion}\label{sec:discussion}
The key message of this paper is that multiple-scale WKB approximations and HFH are complementary and have overlapping domains of validity. The two methods can therefore be systematically combined, through the method of matched asymptotic expansions, to furnish a more complete scheme for high-frequency waves in periodic, or locally periodic, media. We here demonstrated this idea for a locally periodic medium in 1D, focusing on the scenario of total reflection of a slowly varying Bloch wave from a band-gap edge. Clearly this is only a first step towards a more general theory.

The present 1D analysis can be directly applied to calculate trapped modes for a locally periodic medium with a pass-band interval bounded by two stop-band intervals \cite{Johnson:02}. By generalising the analysis to account for off-axis propagation, the latter calculation could be adapted to model Bragg waveguides \cite{Yeh:76}. An analogous 1D analysis could be devised to describe transmission and reflection of WKB Bloch waves in the presence of degenerate points where two dispersion branches touch; this would entail matching the WKB solutions with modified inner regions treated by a degenerate HFH-like expansion \cite{Colquitt:15high}. It would also be useful to generalise the WKB scheme to include evanescent Bloch waves; one could then describe tunnelling-assisted transmission through a locally periodic medium with a stop-band interval bounded by two pass-band intervals. Further objectives, still in the 1D framework, include implementing the method for additional periodic modulations $\Lambda$ and to generalise the asymptotics to other wave equations; in particular, in electro-magnetics the wave equation \eqref{master eq} describes s-polarised light and it would be desirable to study p-polarised light as well.

In higher dimensions the multiple-scale WKB method generalises to a geometric ray theory \cite{Allaire:11}.  We anticipate that WKB solutions could still be matched with HFH-like expansions localised about geometric places where the Bloch eigenvalue becomes critical or degenerate. Spatially localised dispersion singularities would be present even in non-graded crystals, since the Bloch wavevector at fixed frequency would vary with the direction of propagation. In the latter case, the Bloch wavevector is conserved along straight rays that are directed along the corresponding group-velocity vector. HFH expansions would thus be sought about singular rays whose Bloch wavevector is critical. In higher dimensions there would also be the usual ray singularities, in physical rather than Bloch space, namely focus points and caustics \cite{Chapman:99}. Finally, a general description would address diffraction at crystalline interfaces. While Bragg's law determines the directions of reflected, refracted and diffracted rays, a complete quantitative picture would generally entail matching with inner regions wherein the crystal appears to be semi-infinite.

\section*{Acknowledgement}
I am grateful to Richard V. Craster for fruitful discussions.

redpajama_set_name: RedPajamaArXiv


text:
McLay takes over as honorary consul for Australia
September 2, 2013 webmaster National, Normal
The National, Monday September 2nd, 2013
LAE Chamber of Commerce president Alan McLay has been appointed the new honorary consul for Australia in the city.
He took over from Phil Franklin who held the position for 18 years.
McLay said during a dinner last Wednesday in Lae it would be his second time to take over a position held by Franklin.
He had taken over as president of the Lae Chamber of Commerce from Franklin 12 years ago.
Franklin had spent 35 years in PNG, with most of it spent in the private sector in various senior executive capacities.
McLay is a prominent figure in the business community in Lae with more than five decades spent in the country.
He assured Franklin and Australian High Commissioner Deborah Stokes that he would continue to promote the interests of Australia in Lae and Morobe.
"They are big shoes to fill, but I will try as best to fit into them," McLay said.
Tvet show set to kick off this month
Inmate dies at hospital


text:
BERSERK TP VOL 13 (MR)
(W) Kentaro Miura (A/CA) Kentaro Miura
The Band of the Hawk may have been the most formidable band of fighters around, but when matched up against an army of abyssal monstrosities, earthly fighting skills don't amount to a hill of beans. The Hawks' tortured and mutilated former leader, Griffith, has used the accursed Crimson Behelit to open the gates to a shadowy realm of unspeakable horrors, the realm of the demon lords of the Godhand, who are willing to transform Griffith into a being of terrible power and majesty as long as Griffith is willing to give up his former command as sacrifices in the Invocation of Doom. But nobody takes down the Hawks without a fight, and their berserker champion, Guts, will take on anything Hell can throw at him in order to save his lover, Casca, from the sordid violations that only Hell can offer.
Each volume of Berserk comes shrink-wrapped and carries an 18+ content advisory.
In Shops: Jun 30, 2010
SRP: $14.99


A local pro-democracy group, Patriotic Consciousness Association of Liberia or PACA, accuses President George Manneh Weah and some of his officials of allegedly using government vehicles to campaign for the ruling Coalition for Democratic Change candidate in Montserrado County electoral district#13, John Weah.
Speaking to reporters in Monrovia on Monday, 19 November PACA executive director E. Frederick Baye, notes President Weah and his officials had criticized the government of former President Ellen Johnson-Sirleaf of violating the code of conduct, which prohibits use of government vehicles among others for political campaign purposes.
The pro-democracy group maintains that while it supports President Weah's Pro-Poor Agenda, equally so it strongly detests in the strongest terms the use of government properties to campaign for a party's candidate.
PACA cautions that if care were not taken now, Liberia may have an imperial government where anybody who bears the name Weah, would get public office.It stresses that President Weah should realize electorate of district#13 are free to independently choose who they want as their representative, and not to bow to pressure coming from the President.
Mr. Baye explains the usage of government vehicles by President Weah, Monrovia City Mayor Jefferson Kojii and others last Saturday, 18 November was a cleaver attempt by the government to intimidate opposition candidates and their supporters.
He demands an apology from President Weah and his officials for the action, adding that PACA is taken aback that since the bloody riot on Saturday between supporters of Candidate John Weah and opposition candidate Mrs. Cornelia Kruah-Togba of the Unity Party left dozens of people seriously wounded, the President is yet to condemn the violence.
Meanwhile, PACA frowns on the National Elections Commission (NEC) and the Liberia National Police (LNP) for not commenting on what transpired in electoral district #13.
It notes that the NEC, which has oversight of elections in Liberia, deliberately failed to assign police officers to the contesting candidates to ensure that they were restricted to their respective areas of demarcation, which did not happened thereby, resulting to bloody hostility.
Mr. Baye expresses sympathy to individuals who sustained injuries as a direct result of the poor arrangement by the NEC, demanding compensation for the wounded from the bloody clash.


Reverend Rhonda was Guest Speaker at Unity NWI on July 12th, 2015. The guided meditation is provided.
Reverend Rhonda was Guest Speaker at Unity NWI on February 8th, 2015. Topic was Living With No Regrets. Learn why bucket lists are important.
Reverend Rhonda was Guest Speaker at Unity in the Dunes on November 30th, 2014. Topic was Seasons of Life.
This is a supportive and empowering discussion group which explores, learns and applies the methods and means to attract that in which you desire and wish.
Third Saturday of every month, from Noon to 3:00 pm.
Portage, Indiana IMAX Theatre in the large meeting room.


Terran Orbital engineer constructs a satellite platform. Photo: Tyvak.
British Virgin Islands-based GapSat has commissioned its first geosynchronous satellite, GapSat-1, from California-based manufacturer Terran Orbital, which will outfit the spacecraft with a multi-band system offering wide band solutions in C-, Ku-, Ka-, Q-, and V-bands, and an electric propulsion system . The spacecraft will be injected directly into the geosynchronous arc after its scheduled launch in the third quarter of 2020.
GapSat currently offers interim satellite solutions fulfilling the short to medium-term needs of satellite operators through provision of underutilized in orbit assets or development of new satellites for specialty missions. Once launched, GapSat-1 will add Bring-Into-Use (BIU) services to the company's portfolio GapSat CEO Gregg Daffner said that the use of the V/Q bands would help push the envelope of wideband services that can be offered via satellite.


text:
Q: Speeding up SQL query with more than 6 billion operations We have a Django project with the following problem:
User objects are stored in the auth_user table
These have a One-to-One relation to the Profile object, this object is stored in the yuza_profile table. Its relation to the user is maintained through the user_id field
However, years ago thousands of Profile objects were deleted without removing the linked User objects.
These users without profiles are causing problems in our system and we would like to remove them.
I created the following SQL query to perform this task
DELETE FROM auth_user WHERE id NOT IN (SELECT user_id FROM yuza_profile);

Since the Profile objects have been deleted I cannot scan for null values on *_id fields - which would be my first move here.
Instead I am looping over two tables that both contain more than 60.000 rows which leads to a slow and inefficient query with more than 6 billion operations (and server timeouts)
Is there a way to speed up this query? I am aware that my query is very inefficient but I do not know of a way to improve it and any help would be greatly appreciated.
EDIT: As requested I've included the schemas below:
user_profile

id - integer
user_id - integer
gender - varchar(2)
birth_date - date
address - varchar(255)
city - varchar(255)
phone_number - varchar(10)
avatar - varchar(255)
---------------------
user_profile_pkey - (id)
user_profile_user_id_key - (user_id)
user_profile_user_id_fkey - (user_id) -> auth_user(id)
user_profile_pkey - (id) UNIQUE
user_profile_user_id_key - (user_id) UNIQUE

auth_user

id - integer
username - varchar(150)
first_name - varchar(30)
last_name - varchar(30)
email - varchar(75)
password - varchar(128)
is_staff - boolean
is_active - boolean
is_superuser - boolean
last_login - timestamp with time zone
date_joined - timestamp with time zone
---------------
auth_user_pkey - (id)
auth_user_username_key - (username)
auth_user_pkey - (id) UNIQUE
auth_user_username_key - (username) UNIQUE

I should note that I've started to wonder if the IDE (PycharmPro) I am using might be a factor - when testing my queries with the SELECT statement the IDE displays queryresults as pages with 500 results per page. The initial query indeed took less than a second - but pressing the 'go to last page' button took more than 2 minutes (for just 16000 results)

A: I'm not completely sure about your approach, I'm assuming you took a cursor-based strategy, but can't you just:
DELETE FROM auth_user WHERE id NOT IN (SELECT user_id FROM yuza_profile);

If you have the proper indices, this DML instruction will not require that much operations.

A: I strongly advise you to use NOT EXISTS rather than NOT IN.  It treats NULL values more intuitively.  (NOT IN will filter out all rows if any value in the subquery is NULL.)
So, write the query as:
DELETE au FROM auth_user au
    WHERE NOT EXISTS (SELECT 1
                      FROM yuza_profile vp
                      WHERE vp.user_id = au.id
                     );

This query can take advantage of an index on yuza_profile(user_id):
CREATE INDEX idx_yuza_profile_user_id ON yuza_profile(user_id);