What can I use as a replacement for cumin?

Question: I've just run out of cumin and rather than go to the shops for more I wonder what I could substitute for cumin?
I'm making a lentil soup, which calls for sweating onions and the finishing the onions with cumin before adding the stock.
What can I use instead for variety or desperation?
Comment: Interesting question.... could you perhaps post the full recipe because then we'll know which direction this soup is heading? Thanks!
Comment: I've had good luck replacing cumin with fresh fine-ground caraway. That's not likely to work in *every* recipe, but it sounds like it might in yours.
Comment: Here's the recipe http://vegangela.com/2013/06/06/easy-lemon-lentil-soup/
Answer: The problem is that a lot of substitutions are based on what you have on hand.
For instance, I have both liquid smoke and smoked paprika, both of which would add that smoky quality that people associate with cumin.
We also need to consider what other ingredients are going into the dish.  I have spice blends that contain cumin in varying degrees (garam masala, taco seasoning, a rub for ribs), and if they contain other ingredients that I might be using anyway, I'd consider replacing all of them with the spice blend.
Comment: With the flavorings including cumin, garlic, onion and crushed red pepper ... I'd use taco seasoning first, the lemon, and then the other seasonings to taste.
Answer: Chili powder and things like chili or taco spice mixes will normally have cumin as an ingredient. Of course they have other ingredients as well, but they might work well in a lentil soup.
Answer: In India, when we make lentils we finish it by tempering with cumin or black mustard seeds. Infact these two are used interchangeably with many other dishes and gives the right kind of flavour required for any such dishes.
Incase you don't have even that on hand, flavour your dish with othe spices like chilli powder and garam masala and it should turn out just fine. Many spice mixes contains cumin powder so if you could get your hand on any of the mixed spice powders, it should do the trick.
Answer: Coriander might give you the right general sort of flavor, but I think it's darker and heavier than cumin (I'm struggling to describe this well, obviously). Perhaps mixed with paprika to brighten it up a little?
If you've got some, give it a sniff and see; it might work for the desperation, if nothing else.
Comment: Yeah, I'm pretty sure the soapy flavor is only in the herb. (I love cilantro despite being able to taste that flavor somewhat, and I don't taste it in coriander.)
Comment: I have trouble with cilantro. That trouble does not carry over into delicious coriander.
Comment: isn't coriander more cilantro flavored? I personally am having a hard time thinking of a replacement for cumin. It is very distinct.
Comment: Coriander is the seed of cilantro, but doesn't have the "green" flavor of the herb. (However, it might run into the same "tastes soapy" problem that some people have with cilantro, I don't know.) It's kind of smokey and earthy.
Answer: My first instinct was curry powder and perhaps some garam masala.
Not really like cumin, but also a classic combination with lentils and onions - an indian twist, so to speak.
(Amp up the heat with chili and top with a dollop of yoghurt, if you like.)
Comment: We could be cooking up something nice, methinks! ^_^
Comment: Hmm, perhaps combine the coriander from my answer and the curry from yours... Getting there!
Comment: Maybe garam masala plus coriander would be a good option.


Complete human rDNA sequence

Question: I've been trying to retrieve the complete human rDNA sequence (non-spacers and spacers), which should be about 43-kb in length using Biomart, NCBI, and rnacentral, but I have only been able to find the 13-kb non-spacer sequence. Are the spacer regions not yet sequenced due to difficulty in sequencing a repetitive region? Thanks for your help.
Answer: In 1.1 version of (since that version) "Complete genome" assembly of homo sapiens (never achieved before) compared to 1.0 (previous version) 5 last gaps (all somehow in the rDNA) were fixed and now it all is there!
https://genome.ucsc.edu/cgi-bin/hgTracks?genome=t2t-chm13-v1.1&hubUrl=http://t2t.gi.ucsc.edu/chm13/hub/hub.txt
https://www.ncbi.nlm.nih.gov/assembly/GCA_009914755.3
Delta from 1.0 version is there https://s3-us-west-2.amazonaws.com/human-pangenomics/T2T/CHM13/assemblies/changes/v1.0_to_v1.1/v1.0_to_v1.1.chain and delta from patch 13 of GRCh38 is here: https://t2t.gi.ucsc.edu/chm13/hub/t2t-chm13-v1.0/hg38Lastz/t2t-chm13-v1.0.hg38.over.chain.gz
Answer: Managed to find the complete sequence of the repeating unit:
https://www.ncbi.nlm.nih.gov/nuccore/U13369
Answer: To the best of my knowledge, of the estimated  500 copies of rDNA repeats in the human genome only 1 and half repeats has been sequenced and published. Mammalian rDNA repeats are hard to clone and appear unstable in yeast and e coli.
Comment: Great, that's useful to know. I assume that there must be mutations in at least some of the noncoding regions that would enable positional information for certain sequences.
Comment: Yes, there must be sequence variability in the non-coding region. However as rDNA arrays are rather unstable and recombine within a yeast or ecoli host. Hence isolating rDNA repeat array and making a rough map of rDNA repeat arrays is next to impossible.
Comment: Reference in support of this assertion please. I thought methodological developments in sequencing meant that this situation could be dealt with.
Comment: Welcome to the "gaps" in human genome. Parts of the genome of eukaryote that are very difficult to explore must less experiment with. Here is a reference but it does quite cover recombinational instability of repeat arrays that prevent other methods to study them.  https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5098217/

Complete human rDNA sequence


Using an incoming cat5 cable for my phone, how can I wire it so it goes to a switch and also to my phone line

Question: Currently, my house only has one wall plate, which uses a cat5 cable that utilizes a wall plate with pre-installed wires (blue, green, white, black, red, yellow) that the cat5 wires also connect to. From it, I use a splitter to connect to my phone and modem. I am in the process of installing data ports at other locations within my house. I pulled the incoming cat5 wire from my upstairs kitchen to my basement where I have a switch. I am unclear on how to connect the incoming line to the switch and then to my modem and phone. Especially since both the phone and modem have female RJ11 ports.
Comment: The wire you're describing has 6 wires, and sounds like it has all solid colors.  Ethernet cable has 8 wires, 4 of which are a solid color, and the other 4 are striped with white.  Essentially it sounds like the incoming wire is a phone line with 3 potential lines on it.  This has nothing to do with ethernet, and can't be used for ethernet.
Comment: The incoming line goes to your modem, not to your switch. Your modem converts from "phone line" to ethernet. Your switch only talks ethernet.
Comment: That's the jack (an RJ-12) being described, and the Cat5 (better called 4 pair in this context) is described as being "also connected to it" though obviously one of the 4 pairs has no place to go, and 3 of the 4 pairs are probably not connected to anything now, if they ever were.
Answer: Are you under the impression that you have an ethernet cable that just happens to supply phone service, but will also magically supply ethernet if you plug it into a switch?
You (appear) to have a 4 pair cable (if it's cat 5) which has probably (you're a bit unclear, but using the most likely scenario) got POTS (voice telephone, or plain old telephone service) and DSL using one pair - typically the blue pair - that's presently connected to a 3-line wall plate, but (probably) only using one line (typically the red/green pair in the center) since you mention using a splitter from that to your modem (presumably a DSL modem) and your Phone (presumably POTS.) The other 3 pairs are probably dead and doing nothing.
So, what you need wherever you relocate this cable to is to either reconnect it exactly as it was to the 3-line plate you had it terminated to before, and then to your phone (probably with a DSL filter in line there) and modem (without a DSL filter so it gets DSL), and then plug the other side of the modem into your router and your router into your switch, or if your modem is a router, plug the ethernet side of your modem/router into your switch.
The telephone side of this (POTS/DSL) has no connection to your ethernet switch.
If I'm guessing correctly, you only really need to connect the blue pair to an RJ-11 jack (Red/Green - center pair) and your splitter to your telephone and modem, or connect it to TWO RJ-11 jacks and have no splitter required. You can do that with POTS/DSL. You can't do that with Ethernet. Blue/White connects to Red, White/Blue to Green.
There are a variety of less-likely-these-days scenarios involving actually using two or three telephone lines, but they are very unlikely in the current era, and I'm having to assume a great deal, so I assume the unlikely things are not what's happening here.
Alternatively, put it back where it was, and run a cable from an Ethernet port on your Router or Modem/Router to the switch.
Comment: @Criggie I'll let the Flying Spaghetti Monster and Cthulhu tear you apart (sharing is caring even when it's Elder Gods and Brand-Spanking New Gods sharing sacrifices, right?) if I come across this sort of abomination. Ewww.
Comment: They could use the unused pairs of the RJ-45 for 100Base-TX, but that might confuse modern GigE gear that's trying to autonegotiate....
Comment: I would strongly suggest NOT. Cable just isn't that expensive (run a whole new hunk with gig capabilities) and it makes it painful for the next poor schlub to figure out what in the name of Cthulhu you were even thinking...
Comment: @Ecnerwal you're right - cable(wire) is cheap.  The hard work (time is money)  is in getting it up and down walls in a way that looks undisturbed.    If there's a wire in place that goes the right way, I can see the attraction of reusing that, somehow.
Comment: @Ecnerwal see the image in [chat]  recently for an example of the fun inherent in running new cable.  It worked though.
Comment: You are correct that I have a cat5 (4 pair) wire, which is connected to a wall plate that terminates to a female RJ11 connector. If I read your answer correctly, I need to leave the incoming cat5 wire connected as it was originally (upstairs) and then run another line from my router back downstairs to the switch?


Why Decompilers cant produce original code theoretically

Question: I searched the internet but did not find a concrete answer that why decompilers are unable to produce original source code. I dint get a satisfactory answer. Somewhere it was written that it is similar to halting problem but dint tell how. So what is the theoretical and technical limitation of creating a decompiler which is perfect.
Comment: What, comments and all? What about all the optimizations that may have been done, just undo them again?  Why can't I get a raw egg from a boiled egg by putting it in the freezer for a few minutes?
Answer: It is, quite simply, a many-to-one problem. For example, in C:
b++;

and
b+=1;

and
b = b + 1;

may all get compiled to the same set of operations once the compiler and optimizer are done. It reorders things, drops in-effective operations, and rewrites entire sections of code. By the time it is done, it has no idea what you wrote, just a pretty good idea what you intended to happen, at a raw-CPU (or vCPU) level.
It is even smart enough to remove variables that aren't needed:
{
a=5;
b=func();
c=a+b;
d=func2(c);
}
## gets rewritten as:
REGISTERA=func()
REGISTERA+=5
return(func2(REGISTERA))

Answer: For starters, the variable names are never preserved when your program is compiled.  ...so the best it could possibly do would be to use meaningless variable names throughout your re-constituted program.  Compiling is generally a one-way transformation - like a one-way hashing function.  Like the hash, it may be possible to generate something else that could hash to the same value, but it's highly unlikely the decompiled program will be the exact same as your original.
Answer: Compilers throw out information; not all the information that is in the source code is in the compiled code. For example in compiled Java, you can't tell the difference between a parameterized and unparameterized generic type because the information is only used by the compiler; some annotations are only used at compile time and are not included in the compiled output.  That doesn't mean you couldn't get some sort of source code by decompiling; it just wouldn't match nor would be as informative as the actual source code.
Answer: There is usually not a 1-to-1 correspondence between source code and compiled code.  If an essentially infinite number of possible sources could result in the same object code (given unbounded variable name lengths, etc.), how is a decompiler to guess which one to spit out?


Self checking test bench verilog

Question: I am designing a ring counter with 8 bit input. I was successful in design and verifying it through a testbench module. Now I am asked to do the auto correction and self checking of the test bench. Can anyone help me with understanding the basics of a self checking testbench? Are there any good materials or PDFs available online to give you a fundamental idea of building a self checking test bench?
Answer: A self-checking test bench runs a series of tests on the DUT and checks if the results are what is expected.
This is in contrast to the designer looking at the waveforms and declaring that 'it all works'. Often to test the functionality the TB needs the equivalent code of the DUT to generate the expected outcome.
Although there is no uniform template, as the each test bench is tailored to what it is testing, most of them follow the principle that you provide control signals and data for the DUT and at the same time provide an expected result. Then the expected result is compared against the actual result. To line the two up a FIFO or memory can be very useful.
Writing a test bench for your own module is fraught with the danger that you test what you have implemented, not what you should have implemented.
Therefore ideally the test bench should be written by an independent party from the specification of the DUT.
There was a question recently about testing a FIFO which I replied to. That might give you some idea of what to test:
Corner Cases to Verify Synchronous FIFO
From experience:
Most of the time you will find that the test bench turns out to be much bigger then the DUT code itself. Also you often find that the first round of errors are in your test bench not your DUT.
I'll have to stop here because I can keep writing for some more hours about test benches.

Self checking test bench verilog


Help: Making a device to measure the amount of liquid an a container

Question: I want to make a device that would measure the amount of liquid in a container. Can anyone give me an idea on it? I am planning to use a pressure sensor, the required range would be from 0 pascal to 2 pascal. Which pressure sensor would be best suited for this purpose?
Comment: The sensor that will not be corroded by the liquid would be well suited.  BTW, 2 Pa corresponds to 0.2 mmH20 (millimeters of water).  That's an awfully shallow container.
Answer: What kind of a container are we talking about here?  What kind of liquid?  Is it enclosed?  Under pressure?  Corrosive?
My vote would be for some sort of proximity sensor at the top of the container that measures the distance to the surface of the liquid.  This means the sensor should not come in contact with the liquid.  Depending on the liquid, it might be possible to use an optical sensor such as a Sharp analog distance sensor, in which case the sensor can peer into the container through a window.  This may not work if the liquid is clear or absorbs infrared light.  Alternatively, you can use an ultrasonic range finder to measure the distance to the surface.
A capacitive sensor of some sort might also be a good option.  String an insulated wire from the top to the bottom of the tank and measure the capacitance.  Different liquid levels will change the capacitance on the wire.  You can also try this with a pair of wires and measure the capacitance between the two.  There are capacitance to digital chips that you can buy or you can use the capacitance to form a free running oscillator and then measure the frequency.
Comment: capacitance method is really nice
Answer: Electronic scale would be my choice. Weight of liquid etc.. Use a small strain gauge like the type used in off the shelf kitchen or bathroom scales.
Alternatively find some scales with an output signal or data signal. They must be around.
Pressure sensors are good in that they will work ok but may be affected by barometric pressure. Measuring weight has a long history of accuracy but if you are trying to determine volume of fluid and the fluid is unknown then weight and pressure are no good so maybe go for a float sensor like in car fuel tanks.


What is the purpose of capacitors and resistors in this USB bus?

Question: Trying to understand the purpose of the capacitors and resistors in this bus powered configuration for the FTDI chip, I think the capacitors are for filtering high frequency noise, not sure what the resistors for though, maybe line termination ?
Answer: The series resistors are for line termination.
From http://www.semtech.com/images/datasheet/usb%20line%20termination%20_ag.pdf

The Universal Serial Bus (USB) line termintation is specified in the USB 1.1 specification to insure proper terminations so that signal integrity is maintained. The termination requirement varies depending on what driver chipset is used, whether the port is upstream or downstream, and if the transceiver operates in full or low speed.
When the USB 1.1 specification was written, a series resistor between the range of 28Ω to 44Ω was required. Most USB drivers will require a termination resistor of 16 - 33Ω.

This is in addition to the pullup/pulldowns used for identification.
The caps are used to ensure the line meets the required rise/fall times as well.
Comment: thanks, can you elaborate more on the caps ? they are for filtering right ?
Answer: The inclusion of the two capacitors to ground before the termination resistors is a bit unusual. Typically the goal is to minimize stray capacitance to ground before the termination resistors to minimize the impact on signal integrity. According to FTDI app note AN232B-06 (found here http://www.ftdichip.com/Support/Documents/AppNotes/AN232B-06_11.pdf ) page 10:

Some USB 2.0 hubs appear to be extremely sensitive to noise. A glitch on the USB lines
  can in some cases cause a device to hang. This problem can be fixed by adding two 47pF
  capacitors to ground on the USB DP and USB DM lines. These should be located between
  the 27[Ω] series resistors and the hub
Answer: The resistors end up both helping prevent ringing (by making up a RC filter) and electrically protect the input, as well as impedance match the end of the long wire. They may also help guard against load dump when the connection is hot disconnected.
The smallest cap across vcc/gnd seems useless given that there are already a ceramic and an electrolytic there. Those are there to manage load dump during hot disconnect as well.
Comment: Note that the "smallest cap" is on the other side of a ferrite bead. It, too, is there to bypass RFI to ground.
Comment: at first sight I thought it was an RC filter, but shouldn't it be connected across the cap ?
Comment: You're right. That's actually not to USB bus spec -- the USB bus spec specifically calls for a 1 uF capacitor between Vbus and GND on each device, and doesn't talk about the ferrite. It's likely to work fine, though :-)


Actionscript memory management?

Question: I saw System.gc() somewhere on the internet today and I wanted to know if it is or isn't recommended to use in a Flash CS5 project and why.
Comment: you should search for similar questions about Flex instead of actionscript. I'm sure you'll find existing answers on the matter (GC in Flash).
Answer: In every garbage-collected system I know of, the garbage collection machinery was designed to run in the background as an abstraction the programmer should theoretically pay no attention to. There are some special situations where forcing a collection is useful, but these usually involve interrupts (real machine interrupts, not actionscript events), testing/debugging scenarios, or some tricky latency management necessities. Odds are you will never need to call System.gc() and you can safely ignore it.
Comment: Plus, afaik, it isn't possible to force gc on release build, it's all automated and all you can do is remove all not needed listeners and stuff of this kind.
Answer: System.gc() is only available in the debugger version of Flash Player and some AIR applications. Calling it on a normal website, under a normal Flash Player will have no effect whatsoever and will silently fail.
System.gc() is designed only for testing purposes.
Answer: System.gc() is only for testing purposes.  It can be handy to monitor the memory usage your application is using and call System.gc() in order to highlight the possibility of any memory leaks.
Tip: As far as I remember you have to call System.gc() twice to force it to collect immediately.
The documentation states that this method only works in a debug player.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/system/System.html#gc()
So, to summarise, if you're testing memory, it's quite handy, otherwise don't use it.

Actionscript memory management?


Are there other places to look for the gravitational wave, other than space?

Question: The recent BICEP2 announcements about the existence of gravity waves made the news, and made a big pitch for cosmic inflation, in the process they also claimed to detect the existence of gravitational waves. Have the results of the experiment been validated? Have they been confirmed by the European counterparts? If not would there be other ways to look for the gravitational wave- are there any lab experiments that could prove/disprove its existence?
Answer: Since the original BICEP2 publication there has been increasing suspicions that what they had seen was actually just a signal from interstellar dust. We've been waiting for data from the Planck experiment on the dust signal, and that data has just been released. Sadly it looks as if BICEP2 did indeed just see dust and not signals from gravitational waves.
All is not yet lost. The BICEP team plan to improve their experiment and evidence for gravitational waves may still emerge. However it's currently looking as if they've just added another entry to the list of failed GW experiments.
There's a good review of terrestrial GW detection experiments in the answers to Is there a good chance that gravitational waves will be detected in the next years?.


Shouldn't Helen of Troy be Helen of Sparta?

Question: Wasn't the Trojan war fought precisely because Helen was not of Troy, but of Sparta? How come we call her "Helen of Troy."
Comment: They would probably have said "Helen of Sparta" if they were going that direction.  They were independent kingdoms.
Answer: She is actually also known as beautiful Helen, Helen of Argos, or Helen of Sparta, depending on the source - and not all sources associate Helen with Troy.
Euripides, Stesichorus, and Herodotus actually write Helen never went to Troy, but stayed in Egypt during the duration of the Trojan War.
The Trojan association is the most popular nowadays, primarily because of the general awareness of (the existence of) Homer's work...and Hollywood.
Answer: Most likely because of the argument: which came first?
The Trojan War, Menelaus, and Helen were circa c 1194–1184 BC (Modern dating: c. 1260–1180 BC); whilst Sparta came into being circa 800 BC.  Ergo: there wasn't a Sparta at the time.
Comment: Mind you Menelaus and Helen are not considered historically attested.
Comment: What about Helen of Laconia?


Can I use a spray sealant to seal a leak in my radiator?

Question: one of my steam radiators has a leak on the bottom, away from the valve (has been checked, my husband has changed out the valve). can I use a spray sealant to seal this leak? (like FlexSeal)
Answer: From reading on the Internet, FlexSeal looks like a scam ($59.70 for shipping, signs you up for $29/month "membership" without asking). It looks like it's similar to automotive rubber undercoating, which you can buy locally for ~$5 per can.
Don't know if it would work for your purpose. But I can recommend J-B Weld. Sand and clean with acetone, then apply a thin (1 mm) layer of J-B Weld. See also the answers to this question.
Comment: Typically, for anything under pressure, you have to seal it from the inside so the pressure drives the sealant into the porosity or hole. The sealant also has to adhere and also flex under temperature expansion. Marine-Tex and J-B Weld probably are the only sealants you'll have success with on external application. I've used Marine-Tex on engine block cracks, J-B Weld is formulated for similar use. As Vebjorn says, sand it down till you find metal, clean it of all oil and apply.
Answer: drill a hole in the leak, tap it pipe thread, install dope with pipe plug
or weld or braze or solder
Comment: This would be the best, there are radiator restoration businesses that could clean the leak area and hit it with a bit of silver solder (high temp) and end the problem permanently. It requires someone with experience heating cast iron.
Answer: I found a small hole in our steam radiator when we were refinishing it.  I ended up using Loctite Steel Stick to fill it in.  It has lasted a full season and I believe that it will last for the life of the radiator.
From the website:

Metal Magic Steel Stick(TM), Steel Filled, in Stick Form, 4 oz. Stick, Stick, Gray, 10 min. Functional Cure, Shear Strength 2500 psi, Temp. Range Up to 250 Degrees F, Work Life 3 min., Seals Pipes, Gas Tanks, Water Tanks and Vessels, Includes 4-oz. Stick


Active/"RedMere" HDMI Cables Explanation?

Question: How exactly do Active HDMI cables work? The only info I can find is that it somehow analyzes the edge of the waveform, but no information beyond that. RedMere used to have explanations on their website, apparently, but as their website is defunct, all technical documentation is gone.
Comment: Then the answer is "probably not well enough".
Answer:
The RM1689 is an ultra low power semiconductor device that performs adaptive equalization and advanced cable de-skew to achieve unprecedented HDMI performance levels over low cost, narrow-gauge HDMI cabling. The RM1689 is embedded within the HDMI connector and enables the 3.4Gbps operation required to pass the rigorous v1.3 testing for CAT2 cables compliance. The use of our patented "Zero Power Active" technique together with the ultra low power RM1689 architecture enables these performance levels to be achieved without requiring external power.

Basically it uses Ethernet gigabit type signalling with cable equalization compensation with controlled differential transceivers without using the Ethernet interface using low capacitance cables able to reach 20m when passive cables have interchangeability issues and often fail at 10m.

So what happened in Redmere?
In 2012 RedMere (Cork, Ireland) & Toronto-based Fresco Microchip merged to become Spectra7 , a virtual reality company that relies on gigibit video interfacing.
Comment: Thanks for the info. The HDMI port does have 5V power line, so why there is such an excitement about the almost standard re-driver/equalizer/de-empasizer technique? Maybe because it was in 2008? Nowadays SATA has them, USB3 has them, PCIe has them.
Comment: I'm not certain they all have the same attributes for spectral equalization and sub-nanosecond cable de-skew
Comment: I'm not sure about HDMI, but he other three have the same signal shape, and the same idea of signal "sharpening" and loss compensation.


Swift protocol for string interpolation

Question: What protocol do I have to implement to control the way an object is represented within a string interpolation in Swift?
I wan't to specify what get's printed in something like this:
struct A{

}

var a = A()
println("\(a)")

Answer: You need to implement the Printable protocol:

This protocol should be adopted by types that wish to customize their
  textual representation.  This textual representation is used when
  objects are written to an OutputStreamType.

protocol Printable {
    var description: String { get }
}

There's also the DebugPrintable protocol when it's only for debugging purposes:

This protocol should be adopted by types that wish to customize
  their textual representation used for debugging purposes.  This
  textual representation is used when objects are written to an
  OutputStreamType.

protocol DebugPrintable {
    var debugDescription: String { get }
}

Documentation (Thanks @MartinR)
Note: As @Antonio and @MartinR mentioned in the comments, this doesn't work in the playground (as of Xcode6 GM anyway); that's a known bug. It does work in compiled apps.
From the Xcode6 GM Release Notes:

In Playgrounds, println() ignores the Printable conformance of
  user-defined types. (16562388)

As of Swift 2.0 Printable has now become CustomStringConvertible.  Everything stays the same as before, you still need to implement
 var description: String { get }

But now its called CustomStringConvertible.  And debug is CustomDebugStringConvertible
Comment: Are you sure this works? I thought the same, tried on a playground and it shows something like `__lldb_expr_551.Test`. Regardless of `Printable` implemented or not
Comment: Also documented here: https://developer.apple.com/library/prerelease/ios/documentation/General/Reference/SwiftStandardLibraryReference/Printing.html.
Comment: Interesting. It works in a compiled app, but not in a playground.
Comment: That's why... I knew it was `Printable`, but after verifying it didn't work, I thought I was just wrong. Instead it's the playground. Thanks @MartinR
Comment: @Antonio After some digging I found it mentioned in the Xcode release notes that the Playground ignores `Printable` (known issue).  Thanks for pointing it out. I edited the answer to reflect that.
Comment: @MartinR Thanks for the documentation link, I knew it was out there somewhere but I hadn't found it yet. I added the link to the answer.
Answer: In Swift 5 Apple introduced Custom String Interpolation.
Suppose you have person struct with two properties name and age.
struct Person {
  var name: String
  var age: Int
}

If you wanted to add a special string interpolation for that so that we can print persons in descriptive way, we can add an extension to String.StringInterpolation with a new appendInterpolation() method.
 extension String.StringInterpolation {
       mutating func appendInterpolation(_ person: Person) {
       appendInterpolation("My name is \(person.name) and I'm \(person.age) years old.")
    }
}

Now If we print the person details like:
 let person = Person(name: "Yogendra", age: 28)
 print("Person Details: \(person)")

Output will be:
Person Details: My name is Yogendra and I'm 28 years old.

Answer: I would like to put an alternative solution here:
The protocol for string interpolation in Swift is StringInterpolationConvertible. That is, any class which implements the protocol, can be constructed from a string interpolation.
Back to the question, to control what is printed out for a String string interpolation of instances of class A, you would need to create a String extension and overload the init(stringInterpolationSegment expr: A) function.
extension String {
    init(stringInterpolationSegment expr: A) {
        //do custom work here
        //for example: self.init(expr.description)
    }
}

In case you are looking for a way to remove the annoying "Optional(...)" when interpolating Optional variables, which I think is the main reason why people would want to control how an object gets printed out, just have a look at the pod NoOptionalInterpolation here.
Additional information (edited):
Confirm that overriding description will only work for your own struct/class, but not for existing struct/class such as Int and Optional.

Swift protocol for string interpolation


What does hacker need to steal from my PC to compromise my Facebook session?

Question: I mean, when I tick the "remember me/this computer" button, I don't need to login again on this machine. So I guess it's because of cookies. So if someone would get on my PC, he could steal some files and put it into his browser to compromise my session. Is that possible?
Comment: At this moment you've got four answers and to my eyes neither addresses the question from the title "what", but that's partly because you answered it yourself. That leaves only a yes/no question. Is that all you wanted to know?
Answer: The other answers are bad enough I've decided to post a clear answer...

So if someone would get on my PC, he could steal some files and put it into his browser to compromise my session. Is that possible?

Yes, if someone has physical access to your machine, and you have not secured your data with something like full-disk encryption, yes, session hijacking would almost-certainly be possible.
Browsers store their user profiles (including session cookies) to disk somewhere, and anything stored to an unsecured disk can be copied to another disk. You can essentially clone a profile in this manner.
There may be some minor tricks or issues involved either on the browser's or the website's end, so it might be slightly more difficult than a simple copy-paste job, but the basic issue is the same. If someone has access to your data, they can copy it and use it to impersonate you.
Physical Access is Total Access:
Of course, when a malicious individual has access to your device, there are a number of other attacks they could perform, such as replacing hardware to add hardware keyloggers and so-forth. Physical security for your device is still important.
Answer: As a hacker it is easy for him to attack you PC when he has physical access to the system. After having access to your pc, its not a matter of time he installs a backdoor in it and also keystroke recorder. After that he does not even have to steal you facebook sessions. Your device will be completely owned by the hacker. You yourself will be providing the credentials.
Even if the hacker does not have access to you PC, he only needs your sessions and cookies. These can be taken or steal from various ways. He can send you spam email and send the exploit, he can perform techniques like cookie hijacking, tabnabbing, session hijacking, session sniffing, XSS attacks. MITM (Man In The Middle) attack is a great way to sniff sessions. Every time you login to you facebook, it generates a session id and that only what a hacker needs to compromise you facebook sessions.
Answer:
I mean, when I tick the "remember me/this computer" button, I don't
  need to login again on this machine

A person with physical access to your device does not need to hack anything:
Opens your browser > goes to browser settings > stored or saved passwords
Done
Comment: If I read this question right, it is about a specific site, such as Facebook, implementing a "Remember me" checkbox, and not about using the browsers built in password manager.
Comment: In my view the question is not asked correctly if that s the case.
Answer: If an attacker would gain logical or physical access to your machine,
Yes it is certainly possible for him to steal your information and cause you much harm, not only in the immediate term, but also in your future.
I work as an IT Security professional and there are multitude of ways he can make your life miserable. I will illustrate with some examples:
Social Engineering
By exploiting your psychology, he can influence you to think that he is one of your friends or someone else you trust. After gaining your trust, he can steal your credentials to your account. You used your social media account as an example, which could contain personally identifiable information, such as your full name + DOB. This information can be used to steal your identity, open false accounts in your name, damage your reputation etc.
Session Riding / CSRF
This might have been patched, but it used to be possible for an attacker to sent you an link and trick you into clicking it, that would trigger an undesirable action such as stealing your information, while you are logged in. The basis for this attack is the trust the application has for the user's browser session. The application thinks the request came from you and does not know it was someone maliciously acting on your behalf. Be default, actions you, the user, takes are trusted.
Comment: While what you write here is true, I don't understand how it address the original question - what files could be stolen form a computer to compromise the session? Besides, I don't think Facebook is vulnerable to CSRF...


VB6 call Oracle procedure error

Question: We have a lagacy VB6 app that uses an ODBC connection to a Oracle 10g DB. We are upgrading to a 11g drivers on our SOE and parts of the app have issues. Works fine with a 9.2 driver.
Oracle Client 10g/11g does not like lower-case calls. This is evident in the fact that the calls that succeed are in upper case and the calls that failed are in lower case. Further tests showed that lines of code such as:
Set Qry = grdoEnterprise.CreateQuery("", " { CALL ep_admin_revoke_role( ?,?,?,? ) } ")

failed... but succeeded when changed to
Set Qry = grdoEnterprise.CreateQuery("", " { CALL EP_ADMIN_REVOKE_ROLE( ?,?,?,? ) } ")

The error itself isn't thrown until the query is executed. However, while debugging, failure can be detected at the CreateQuery() stage because the resulting rdoQuery object has 0 parameters (whereas it should have more than 0--in this case, 4).
Has anyone encounter this problem with VB6 and Oracle 10g/11g ODBC drivers?
Answer: Yes, Oracle is way too picky.  Your solution to change the stored procedure name to upper case is one hundred percent correct.

VB6 call Oracle procedure error


CPU load too high. How to investigate?

Question: This is my "top" screen. Now it's 2.96. Sometimes it goes above 3! I've read that it's not good. How to investigate and fix it?
Answer: You seem to be seriously using a lot of swap there.  You have a relatively small amount of memory allocated to cache/buffers.
Your %wa is at 49.5%. That value corresponds to the CPU waiting for I/O to complete.
I suspect you have that is or was using a large ammount of memory. But perhaps you also have something performing a lot of I/O as well.
Fire up iotop, and you might get a better picture of the I/O situation.
P.S. If you are not using ksplice, then you are almost certainly running a kernel with known vulnerabilities.  354 days of uptime is too long.
Comment: I'm sorry my server does not have iotop command.
Comment: Can you install it?  At least from the looks of it you have an `I/O` problem.  You will probably need a tool that looks at `I/O` to find the answer.
Comment: Just curious about what is up with the downvote?  Did I post something wrong, or omit something obvious?
Answer: Nothing wrong with your top.
MySQL database daemon is eating most of the CPU. You can press C to find the exact commands/instructions inside the top view.
If it is a surprise for you that your MySQL database is so busy then you need to investigate what is using it (webserver, application?). There are tools for this, including those provided by native MySQL packages.
Comment: Why do you suspect mysql if it is only at `7.6%` CPU and `36%` Memory?  It does seem to be busiest, but the problem seems to be `I/O` see the `%wa`.  Not saying it isn't mysql, but I think I would want to look at `iotop` first.
Comment: The idea came from the fact that the server seems to only have mysql running (the other processes seem to be standard packages installed with a typical linux distro). Hence the suggestion to profile MySQL.
Comment: One example of such native tool: http://dev.mysql.com/doc/refman/5.0/en/slow-query-log.html
Comment: Agree with Zoredache. Its a common misconception among newbies that load is directly related to CPU usage. Sometimes it is related yes, but not always. Also the general rule for full utilization is when load is equal to the number of cores (though hyperthreading screws this up).

CPU load too high. How to investigate?


one-time pad key related attack

Question: In one-time pads we always say do not use same key twice to encrypt ASCII messages, but if we use a random key to XOR a random binary message and then reusing the same key for XORing new random messages will compromise our key ? Or is attacking reused keys for random messages infeasible?
Comment: Very related to this question http://crypto.stackexchange.com/questions/2264/can-i-use-a-one-time-pad-key-twice-with-random-plaintext?rq=1
Comment: @lanc: One can not logically deduce from my previous comment that anything involving pad/key reuse is safe. For many definitions of safe, reusing the same pad/key for another random message is unsafe. For example, the adversary can test if the two random messages are identical, by testing if the two ciphertext are identical. There are situations where that may be important, e.g. if the message is one bit linked to some physical action.
Comment: In cryptography, it is standard practice to assume the plaintext of one message (or/and some of the plaintext) gets known. That leaks the OTP's pad for the corresponding plaintext. If that pad was reused, it would no longer protect the confidentiality of the message it combines to. That applies to any plaintext, including random.
Comment: What fgrieu is saying is, let's say your message space is small. Since the key is the same, if the same message is ever encrypted twice (which will happen if the message space is small), an observer can see that. That may or may not be a critical break in the system. I think it would do you well to more fully describe the application to us.
Comment: What kind of randomness for the message are we talking about? Truly random or pseudorandom?
Comment: @mikeazo♦ random message is very strong PRNG but our key might be very strong random or may not be very strong.
Comment: @fgrieu so if attacker can't guess key(or some part of it) and message (or some part of it) then reusing same key for next random messages will be safe ?
Comment: @fgrieu if message is random how it can be identical from ciphertext ? how attacker can guess message and compromise the key ?
Answer: Once you've XORed two messages with the same secret value, the net result is the same as if you had XORed them with each other without using the secret at all.
Given $plaintext_1$ ⊕ $key$ = $cyphertext_1$ and $plaintext_2$ ⊕ $key$ =  $cyphertext_2$, then $cyphertext_1$ ⊕ $cyphertext_2$ == $plaintext_1$ ⊕ $plaintext_2$.  Because it's XORed twice with the same key, the double XOR becomes the identity function and the key is simply factored out.
If the attacker learns any bits of the plaintext of either message, they can recover those corresponding bits of plaintext from the other cyphertext message, plus they can recover those bits of the key as well.
So it falls to you to determine if $cyphertext_1$ or $cyphertext_2$ have any knowable information in them.  It's completely irrelevant if the plaintext data is ASCII, binary, or EBCDIC.  If an attacker can discover or guess what any piece of the data is, it's vulnerable.
This is the classic weakness with the Vernam cypher, and is what enabled the Venona decryption of Soviet secrets.  And it's why it's no longer a one-time pad cypher if you use either the plaintext or the key more than one time.
Answer: When people say never use twice the same key to encrypt two different messages, they mean never use the same keystream. Here, if your keystream generation is truly random, then it is ok. If your message is quite short, there is a little chance that you will produce the same keystream but that does not matter.
What matters is that you do NOT forge the keystream in the same manner two times. This must be taken into account if you use pseudo-random generators. Supplying a PRNG the same seed for two different messages will induce a security flaw.

one-time pad key related attack


Does wordpress have a post hit counter?

Question: Is there anyway to show in a template for a post, how many times that post has been viewed, like hits without some sort of plugin?  It seems wordpress would have this built in, but I am unable to find any template tags for such a think in the documentation?
Answer: Not in core. You can use post meta to store this information on page loads. If you have caching plugins enabled, you might want to increment the hit counter with an AJAX call, otherwise you can just add this directly in your single.php and page.php templates:
<code>//Add to functions.php
function get_hits(){
    global $post;
    $hits = get_post_meta($post->ID, '_hit-counter', true);
    return $hits;
}

function update_hits($count){
    global $post;
    $count = $count ? $count : 0;
    $hits = update_post_meta($post->ID, '_hit-counter', $count++);
    return $hits;
}

//Usage within the loop
update_hits(get_hits());
</code>
Comment: @TomC This solution was something I created before understanding race conditions. I wouldn't actually use this now. I would create a hits table then log each hit with a relational column for post_id.
Comment: Brian - I'm struggling to get this to work. Presumably I add the two functions to functions.php and use the updates_hits(get_hits()) in the page template inside the loop. What do I use to echo out the value to screen? get_hits()?
Answer: No, WP doesn't have such functionality built-in. Probably because updating the post table on each page hit would slow down the site.
You'll have to use wp-postviews or something related.

Does wordpress have a post hit counter?


IBus methods do not show up in text entry settings

Question: I installed both Korean and Japanese using the Language Support window, and expected Korean (Hangul) and Japanese (Anthy) to show up in the input sources for Text Entry Settings (having both packages installed). However, neither shows up.
Comment: Have you found a solution? Have same problem :-(
Answer: The comments in Writing Japanese with Ubuntu 14.04 Trusty Tahr suggest the following workaround:

I was not able to add the Anthy text entry in Ubuntu 14.04 using Gnome Fallback. Then I switch to Gnome Shell and I add it. Finally I switch back to Gnome Fallback and I can use it now.

I encountered the same problem after upgrading from 13.10 to 14.04: The Text Entry dialog in gnome-control-center does not list Japanese (Anthy), only plain Japanese and several others. Using the former, Super + Space (which previously was Ctrl + Space in 13.10), only toggles between the default keyboard layout (German for me) and English, but Anthy doesn't enable, even though it can be selected in the language selector applet (and then works and can be disabled once via keyboard, too).
For another user of that system, the toggling was still working, so I compared the configuration using dconf-editor. Under org.gnome.desktop.input-sources, I changed [('xkb', 'de'), ('xkb', 'ja')] to , [('xkb', 'de'), ('ibus', 'anthy')], logged out and in, and it worked!
Comment: +1, this helped me, and because I wanted to use ibus-m17n instead of ibus-anthy (for Devanagari input), I was also helped by the instructions here: https://uglyduckblog.wordpress.com/2015/01/20/how-to-install-unijoy-on-ubuntu-gnome-gnomebuntu/ Thanks so much!
Comment: a huge problem/bug with using ibus + gnome fallback
Comment: helped also on Artful Aardvark.
Answer: Finally found a solution.
It appears that login through Gnome Classic, Metacity, Compiz etc... prevents Text Entry to work correctly. It ignores Japanese (anthy) for instance.
This is what I did

logged out
logged back in using the regular "Ubuntu" mode (unity)
Opened Settings then Text entry
added  the IM of choice (eg "Japanese (anthy)") which became available!
logged back in using "Gnome classic" mode

Done.
Answer: Several people have had similar problems. My solution was a reinstall with no internet, then connect and add in the inputs and languages (for me the inputs were there doing it this way even before I added in the languages). I was not able to get those entries to show once the problem cropped up.
Pls have a look at this, hope it helps: https://askubuntu.com/questions/456177/locale-language-bug-in-14-04-install-in-foreign-country-then-ibus-options-unav
Comment: Your solution didn't work for me either.
Comment: Really! You reinstalled, no internet? And did you check your text input options right after? For me I checked that first, and found the options I wanted, so I def didn't delay to get them in there. Then installed the language. But that was Chinese.
Comment: What options do you see there? Did you check before installing the languages? Checking my options right now, (with only Chinese installed) I have many Japanese options, but not Anthy, and only one Korean option, it was like 101/104 compatible.
Comment: Also, check your text input options prior to installing the language, see if you can get lucky as I did, and then also consider to download the input method you want prior to installing the languages...pls notice when those options change...this is a serious bug I think. I am making a new thread and we may want to file a bug report.
Comment: Ok I made a new topic to hit this issue squarely. If I was you I would make a new topic as this one is "answered" and won't get that much attention. I would also reference your two languages in the title, (Japanese and Korean) as people using these languages will come out of the woodwork to share their own experiences when they see "their" language in the title.
Comment: http://askubuntu.com/questions/459369/serious-ibus-problem-input-languages-are-not-available-do-not-show-up
Comment: Thanks, but I don't think this is a locale problem, since I am in the U. S. Instead, this might be a problem from upgrading from 13.10, which didn't fully integrate IBus and Ubuntu.


Ask about political climate at a department during a job interview?

Question: I am on the job market this year, and one of the main things I'm looking for is a good department culture fit. Naturally, the political views of the department and its members plays a role in this, and so I would like to have some idea of the political leanings of the department. However, I'm unclear how much prodding about this is "acceptable" at job interviews? For instance, would it be a bad idea to ask (in a sensitive way) what the department/university response to relevant political happenings has been?
Comment: What's "relevant political happenings"? Hamas, or recent changes in state education policy?
Comment: " one of the main things I'm looking for is a good department culture fit." you have been on the job market for very short time, then ;)
Comment: Those are both examples of the type of issues I'm talking about. Other examples would be views on stuff like pronouns, bathrooms, etc. Does it make a difference the specific issue?
Comment: '[W]hat the department/university response to relevant political happenings has been …' A formal statement on behalf of the department ought to be easy to dig up. If you're interested in opinions of individuals, just ask them if you need that. In the latter case, how would you do the same thing with neighbors?
Comment: I'm not sure this is equivalent to asking neighbors' views (hence the question). In particular, a potential neighbor has no impact on my life if I choose not to live somewhere (and relatively little impact on my life even if I do).
Comment: Very interesting question although it may be more workplace relevant than academy only, although I know that often "Why does Academia:SE give different answers about leaving a bad situation compared to Workplace.SE?" https://academia.stackexchange.com/questions/168344/why-does-this-site-give-different-answers-about-leaving-a-bad-situation-compared/168384#168384
Comment: @EarlGrey perhaps, but this is maybe as important to me as finding an academic job.
Answer: Asking directly about such things is unlikely to be to your advantage - especially if the answers to the questions wouldn't please you. OTOH, those departments that would go all negative aren't likely the ones you want to join in any case. So, if you have options, rather than just wanting to know so that you know how deeply you need to keep your own feelings/attitudes, then ask away. If you get pushback, look elsewhere, though you need to watch out for dissembling as well.
There is another aspect of "political" that you don't raise, but should be aware of and that is whether there are factions in the department that are constantly at war with each other over whatever issue(s) they choose to fight over. This one is harder to get a handle  on in a visit, however. Those issues might be political in the classic sense or related to fields of interest.
Hanging around the coffee room for a day or so can give you a good idea about all such things. How do people talk to one another? What do they talk about. What opinions are expressed on the topics of the day?
In large departments you will find a variety of attitudes. Most places the "average" is a bit more liberal than the general population of that region (some exceptions). In large departments you can likely find some people with views similar to your own and some with different views, even those you find repugnant. Such is life.
Answer: This is something you can bring up during more informal parts of a campus visit. I would not bring it up before that time, as the prior screening interview will be quite focused on your qualifications and selling yourself. The more informal parts of a visit are often meals, and this is where you would make inquiries about collegiality, department climate, and the various tensions you mentioned here.
Is it wise to bring it up? In my opinion, if these issues are something that would make you decline a job offer, then you need to know about them directly from the department rather than making assumptions based on what you have access to in the news or online. So it makes sense to ask — in the right way at the right time.
Answer: By saying "relevant political happenings", do you mean politics inside the department or global/national politics? If politics is inside the department, you are unlikely to know until you join as a faculty. They will say nice things. If you mean global/national political happenings, people may not be very vocal even though they strongly feel about something, especially at the interview phase. So, it may not be a better idea to ask. Rather than infer indirectly based on their actions, the diversity of faculty, the diversity of students, and some other similar matrices.
Comment: There's also intermediate steps. University-wide politics are relevant, and so are state/provincial politics, when those affect funding and policy. In Europe, trans-national EU/ESA/CERN politics also play a role.


How to export results of search on US Patent Public Search?

Question: On the US patent office search site, Patent Public Search, I can run a search and get many hits. How can I export these results to a file (any format is fine: csv, Excel, etc.)?
Or if you use a web scraper tool for this, which one?
Answer: In this USPTO document, step #11 explains how to copy and paste the results into Excel.
Or if you want a tab-separated CSV file to use with another application besides Excel:

Run your search on Patent Public Search (examples of queries here). You will get search results listed in rows.
Select rows to copy by checking the boxes on the left under Select. You can select all rows by clicking the first box then the last. Selected rows are shown with blue shading. Right click in the blue shading and select Copy.
Open a text editor and paste. Your search results will be copied in as tab separated text. Save this to a csv file and read it into Excel.

(If you are using the USPTO tool because you have found that Google Patent search results are incomplete, see Eric S's tip here to set "Deduplicate by:" to "Publications" instead of "Family".)


Too many iron golems in snapshot 19w13b

Question: I started my game near a village and started fixing and improving the village, I got my first golem to spawn but after 2 hours I had over 20 golems. what made this happen? So I killed 1/4th of them and now the villagers don't like me.
Answer: Klling golems obviously angers the villagers, that's normal behavior. The abnormal golem spawning is a bug, already reported at bugs.mojang.com. – Vladislav Toncharov in a comment

Too many iron golems in snapshot 19w13b


How can members change their data on their own?

Question: we have CiviCRM installed in WP. We want, that members change there data on their own. Data could be: bank information, email adr, etc.
Is there a solution in place?
Thanks
Regards
Edgar
Answer: If Members are also WP users then let them log in and have access to either a CiviCRM Profile (https://docs.civicrm.org/user/en/latest/organising-your-data/profiles/) or a Caldera Form and you should be able to set up the fields you want them to have access to via the form
If Members are NOT WP users then you can send out a Mailing with a checksum link to a Profile so they can make their changes without logging in
Comment: Hello Petednz,  thanks for the answer. I tested the profiles. Great it works. I have onle a issue with the field IBAN in the banking database. I found no way to include it in the profile. I'll search in the forum. Thanks a lot for your support
Comment: If the IBAN field is a custom field on the CONTRIBUTION rather than on the CONTACT then you won't get it showing other than on a Contribution page afaik


Why do we need to check for more than $\frac{\infty}{\infty}$ or $\frac{0}{0}$ when applying L'Hospital?

Question: With regard to this comment I wanted to ask (and provide an answer): what else do we need to assume and check for before we can apply L'Hospital's rule? And why do we have to do this e.g. does it really matter if we don't check them?
Comment: Perhaps of interest: http://www.maa.org/programs/faculty-and-departments/classroom-capsules-and-notes/counterexamples-to-lh-pitals-rule
Answer: For the sake of the argument I'll use a question from an exam and combine two solutions ("real solutions" as in those were handed in by students) that will point out common mistakes when applying L'Hospital's rule. The exam was taken by students in their first semester of university.

Question: Determine the following limit (if it exists): $$\lim\limits_{x\to\infty}\frac{x-\sin(x)}{x+\sin(x)}$$

Wrong solution: we have $\lim\limits_{x\to\infty}(x-\sin(x))=\lim\limits_{x\to\infty}(x+\sin(x))=\infty$, thus by applying L'Hospital's rule we get: $$\lim\limits_{x\to\infty} \frac{x-\sin(x)}{x+\sin(x)}=\lim\limits_{x\to\infty}\frac{1-\cos(x)}{1+\cos(x)}.$$ For this limit we get an indeterminate form as well, so applying L'Hospital's rule again yields $$\lim\limits_{x\to\infty} \frac{x-\sin(x)}{x+\sin(x)}=\lim\limits_{x\to\infty}\frac{1-\cos(x)}{1+\cos(x)}=\lim\limits_{x\to\infty}\frac{\sin(x)}{-\sin(x)}=-1.$$

The solution $\lim\limits_{x\to\infty}\frac{x-\sin(x)}{x+\sin(x)}=-1$ and the solution process are completely wrong. First of all one can show, that $$\frac{x-\sin(x)}{x+\sin(x)}\geq 0$$ for all $x\in\mathbb R\setminus\{0\}$; thus the limit (if it exists) can't be negative. For analyzing the mistakes, we first need to look up, what L'Hospital's rule really says:

Let $a,b\in\mathbb R\cup\{-\infty,\infty\},a<b$. Let $f:(a,b)\rightarrow\mathbb R$ and $g:(a,b)\rightarrow\mathbb R$ be differentiable with $g'(x)\neq 0$ for all $x\in(a,b)$. Then the following holds:
If $\lim\limits_{x\uparrow b}f(x)=\lim\limits_{x\uparrow b}g(x)=A\in\{0,-\infty,\infty\}$ and $\lim\limits_{x\uparrow b} \frac{f'(x)}{g'(x)}=L\in\mathbb R\cup\{-\infty,\infty\}$ exists, then $\lim\limits_{x\uparrow b} \frac{f(x)}{g(x)}=L$.
A similar argument holds for $\lim\limits_{x\downarrow a}\frac{f(x)}{g(x)}$.

The requirements of $f,g$ being differentiable functions etc. were never checked in the solution. Now let's look at the applications of L'Hospital's rule.
First application: $\displaystyle\lim\limits_{x\to\infty} \frac{x-\sin(x)}{x+\sin(x)}=\lim\limits_{x\to\infty} \frac{1-\cos(x)}{1+\cos(x)}$
We check if we can apply L'Hospital's rule. First of all we need to define $$f:(0,\infty)\rightarrow\mathbb R,x\mapsto x-\sin(x)~\text{and}~g:(0,\infty)\rightarrow\mathbb R,x\mapsto x+\sin(x).$$ Then $f$ and $g$ are differentiable and $\displaystyle\frac{f(x)}{g(x)}$ is well-defined as $g(x)\neq 0$ for $x\in(0,\infty)$.
We also have $\lim\limits_{x\to\infty}(x-\sin(x))=\lim\limits_{x\to\infty}(x+\sin(x))=\infty$. But we must not apply L'Hospital's rule, as we don't have $g'(x)\neq 0$ for $x\in (0,\infty)$:
with $g'(x)=1+\cos(x)$ we have $$g'(x)=0 \Leftrightarrow \cos(x)=-1 \Leftrightarrow x=\pi+2\pi k,k\in\mathbb Z.$$ As $\pi\in (0,\infty)$, we don't have $g'(x)\neq 0$ for all $x\in(0,\infty)$.
One might now try to shift the lower endpoint of the interval $(0,\infty)$ up; as we're looking at $x\to\infty$, the lower endpoint of the interval doesn't really matter. So let's define $f,g:(4,\infty)\rightarrow\mathbb R$, this way we remove $\pi$ from the domain of $g$ and $g'$. But we still get $g'(3\pi)=0$ with $3\pi\in (4,\infty)$. No matter on which interval $(a,\infty)$ we define $f$ and $g$, we will always find $k\in\mathbb Z$ with $\pi+2\pi k>a$ and therefore $g'(\pi+2\pi k)=0$. Thus the first application of L'Hospital's rule in the solution is wrong.
Second application: $\displaystyle \lim\limits_{x\to\infty}\frac{1-\cos(x)}{1+\cos(x)}=\lim\limits_{x\to\infty}\frac{\sin(x)}{-\sin(x)}$
First of all we'd need to define $$f:(a,\infty)\rightarrow \mathbb R,x\mapsto 1-\cos(x)~\text{and}~g:(a,\infty)\rightarrow\mathbb R,x\mapsto 1+\cos(x).$$ Then with $g'(x)=-\sin(x)$ we'd have the same problem as in the first application: $$g'(x)=0\Leftrightarrow x=\pi k,k\in\mathbb Z.$$ But there is another mistake, that (at least in my experience) often happens when trying to apply L'Hospital's rule.
The limit $\lim\limits_{x\to\infty} \frac{1-\cos(x)}{1+\cos(x)}$ is not of the indeterminate form $\frac{A}{A}$ with $A\in\{0,\pm\infty\}$. For the application of L'Hospital's rule this is a necessary condition.
Yes, the limit $\lim\limits_{x\to\infty} \frac{1-\cos(x)}{1+\cos(x)}$ is of some indeterminate form, but it doesn't fit L'Hospital's rule. So just because a limit is of an indeterminate form, one can't simply apply L'Hospital's rule.

L'Hospital's rule does need more than just $\frac{0}{0}$ or $\frac{\infty}{\infty}$ to be applicable and it is important to at least think about the requirements when using it. Often there are other ways to get to the right answer without using L'Hospital's rule which in my opinion should be considered first.
As a last point, one right solution to calculate the limit:
For $x\neq 0$ we have: $$\frac{x-\sin(x)}{x+\sin(x)}=\frac{x\left(1-\frac{\sin(x)}{x}\right)}{x\left(1+\frac{\sin(x)}{x}\right)}=\frac{1-\frac{\sin(x)}{x}}{1+\frac{\sin(x)}{x}}.$$ Because $|\sin(x)|\leq 1$ we have $-\frac{1}{x}\leq \frac{\sin(x)}{x}\leq \frac{1}{x}$. With $\lim\limits_{x\to\infty} \frac{1}{x}=0$ and the squeeze theorem we get $\lim\limits_{x\to\infty} \frac{\sin(x)}{x}=0$ and thus we have $$\lim\limits \frac{x-\sin(x)}{x+\sin(x)}=\lim\limits_{x\to\infty} \frac{1-\frac{\sin(x)}{x}}{1+\frac{\sin(x)}{x}}=1.$$
Edit: as asked by S.Panja-1729 in the comments, one way to show $\lim\limits_{x\to\infty} x+\sin(x)=\infty$.
With $|\sin(x)|\leq 1$ we have $x+\sin(x)\geq x-1$. As $\lim\limits_{x\to\infty} x-1=\infty$ we can conclude $\lim\limits_{x\to\infty} x+\sin(x)=\infty$. A similar argument holds for $\lim\limits_{x\to\infty} x-\sin(x)=\infty$.
To point out another mistake when using L'Hospital's rule (as suggested by Andrew D. Hwang in the comments):

Question: Determine the following limit (it it exists): $$\lim_{x \to \infty} \frac{x - \frac{1}{2}\sin(x)}{x + \frac{1}{2} \sin(x)}$$

Wrong solution: we have $\lim\limits_{x\to\infty} \left( x-\frac{1}{2}\sin(x) \right)=\lim\limits_{x\to\infty} \left(x+\frac{1}{2}\sin(x) \right)=\infty$, thus by applying L'Hospital's rule we get
$$\lim_{x \to \infty} \frac{x - \frac{1}{2}\sin(x)}{x + \frac{1}{2} \sin(x)}=\lim\limits_{x\to\infty}\frac{1-\frac{1}{2}\cos(x)}{1+\frac{1}{2}\cos(x)}.$$ As $$\lim\limits_{x\to\infty}\frac{1-\frac{1}{2}\cos(x)}{1+\frac{1}{2}\cos(x)}$$ doesn't exist, we can conclude that $$\lim_{x \to \infty} \frac{x - \frac{1}{2}\sin(x)}{x + \frac{1}{2} \sin(x)}$$ doesn't exist.

For analyzing the mistake, we again check if we can apply L'Hospital's rule.
Let $$f:(0,\infty)\rightarrow \mathbb R,f(x)=x - \frac{1}{2}\sin(x),~g:(0,\infty)\rightarrow\mathbb R,g(x)=x + \frac{1}{2} \sin(x).$$ Then $f$ and $g$ are differentiable and $\displaystyle\frac{f(x)}{g(x)}$ is well-defined, as $g(x)\neq 0$ for $x\in(0,\infty)$. Futhermore, with $g'(x)=1+\frac{1}{2}\sin(x)$ we have $g'(x)\neq 0$ for $x\in (0,\infty)$, thus $\displaystyle \frac{f'(x)}{g'(x)}$ is well-defined. But we still can't apply L'Hospital's rule as the last requirement is not fulfilled.
For applying L'Hospital's rule it is necessary, that the limit $$\lim\limits_{x\uparrow b} \frac{f'(x)}{g'(x)}$$ exists either as a real number, meaning that $\displaystyle\frac{f'(x)}{g'(x)}$ converges to $L\in\mathbb R$ as $x$ approaches $b$, or the limit exists as $\pm\infty$, meaning that $\displaystyle\frac{f'(x)}{g'(x)}$ diverges (strictly) to $\infty$ or $-\infty$ as $x$ approaches $b$. Only in this case can we identify the limit $$\lim\limits_{x\uparrow b}\frac{f'(x)}{g'(x)}$$ with $$\lim\limits_{x\uparrow b}\frac{f(x)}{g(x)}.$$
In our question we get $$\lim\limits_{x\to\infty}\frac{1-\frac{1}{2}\cos(x)}{1+\frac{1}{2}\cos(x)}$$ which neither converges to $L\in\mathbb R$ nor does it (strictly) diverge to $\infty$ or $-\infty$. Thus we can't apply L'Hospital's rule.
To get the correct answer, we can use the same argument we have used for the first question and get: $$\lim\limits_{x\to\infty}\frac{x-\frac{1}{2}\sin(x)}{x+\frac{1}{2}\sin(x)}=\lim\limits_{x\to\infty}\frac {1-\frac{1}{2}\cdot \frac{\sin(x)}{x}}{1+\frac{1}{2}\cdot\frac{\sin(x)}{x}}=1.$$

Questions, comments, corrections etc. are appreciated.
Comment: Very instructive answer, +1. Another way to calculate the limit might be $\frac{x - 1}{x + 1} \leq \frac{x-1}{x+\sin x} \leq \frac{x-\sin x}{x+\sin x}\leq\frac{x+1}{x+\sin x}\leq\frac{x+1}{x-1}$
Comment: @S.Panja-1729 with $|\sin(x)|\leq 1$ we have $x+\sin(x)\geq x-1$ and therefore can conclude $$\lim\limits_{x\to\infty} x+\sin(x)=\infty.$$
Comment: (+1): Nice example and analysis! Further, if the original limit had been$$\lim_{x \to \infty} \frac{x - \frac{1}{2}\sin x}{x + \frac{1}{2} \sin x}$$the first application of l'Hôpital would still be wrong, but for a different reason than vanishing of the denominator near $\infty$: The limit-at-infinity$$\lim_{x \to \infty} \frac{1 - \frac{1}{2}\cos x}{1 + \frac{1}{2}\cos x}$$of a non-constant periodic function doesn't exist.
Comment: I think you meant "The solution .. = $-1$" not $+1$.
Comment: @nbubis, of course, thank you!
Comment: You probably meant $\lim\limits _{x\to\infty}\frac{sin(x)}{x}=0$
Comment: @user154037, yes, I did, thank you!
Comment: @@Hirshy):$\lim_{x\to {\infty}} \sin x$ **does not exist**...How you find $\lim_{x\to {\infty}}x+\sin x=\infty$ ?
Comment: @AndrewD.Hwang thank you. I'll see if I can extend my example to include this wrong application as well.


Determine the camera vector in openGL

Question: What I'm doing right now is designing a flight simulator of some kind. What I want to know is how I can determine/extract/calculate the camera vector in OpenGL i.e. I want to know the vector which describes the direction the camera is facing.
What I want to do, for example is to simulate a barrel roll. How I thought I could do this is to use the following code:
<code>GL11.glRotatef(raw, vector_x, vector_y, vector_z);
</code>
I, however can't figure out how to extract the camera vector.
BTW, I'm using LWJGL and GLApp.
Answer: Use the Z (or -Z, depending your matrices handedness) axis of the camera's transformation matrix.

Determine the camera vector in openGL


Who spoke the truth?

Question: In the last chapter of the book of Job G-d tells Eliphaz, Bildad and Zophar that they have not spoken truth about Him. G-d does not mention Elihu which implies that whatever Elihu said about G-d is truth. Does this mean that everything that Eliphaz, Bildad and Zophar said about who G-d is, and what G-d does is not truth and we should not rely on that to inform us about G-d? That would mean that passages like Chapter 21: 21-30 and Chapter 4 are not to be considered truth.
Answer: https://www.sefaria.org/Job.42.7?ven=The_Koren_Jerusalem_Bible&lang=bi&with=Rashi&lang2=en
Anytime you'd like the Jewish perspective on a Bible verse, please start with the Jerusalem translation, and Rashi's commentary -- all available in English, for free, on Sefaria.org. As seen above.
"truth" is a poor translation; the word here is not emet, but nachon, which is more like "proper."
Rashi explains that the trio had blamed Job for his own suffering when he was down, which was "improper"; Elihu hadn't done so. The Talmud stresses that someone in pain should be given a lot more slack for what they, and most of the Jewish commentaries apply that here -- Job was hurting, so we can't blame him, but for you to kick him when he was down was improper!

because you did not speak Because you did not speak to Me with a correct argument as did My servant Job, for he did not rebel against Me except for what he said (above 9:22), "He destroys both the innocent and the wicked," and through the Adversary who denounces the world, as it is stated (ibid. verse 23): "If the scourge kills suddenly etc." And if he continued to speak, he spoke because of the severity of the pains that burdened him and overwhelmed him; but you rebelled by condemning him, saying (4: 6), "Behold, your fear was your foolishness," and you held him to be a wicked man, and at the end when you were silenced and defeated before him, you should have consoled him as Elihu did. Was it not enough for Job with his trouble and his sufferings, that you added rebellion to your sins to provoke him?

Other commentaries (Metzudas David) actually read the phrasing differently -- just like Job, none of you spoke properly -- i.e. everyone's musings missed the mark, but at least Job is "My servant" and only saying this out of the pain.
Malbim takes a fascinating different approach: Job knew the right thing in his heart, but the pain made him shout out all sorts of complaints. His buddies didn't truly believe, but were spouting platitudes. Thus, G-d calls them out. (While it's certainly not Scripture, a similar point comes up to readers of Shakespeare, whether to read Polonius' advice to Laertes (to thine own self be true) as sincere, or is he just shallowly reciting some common morals lines everyone said at the time, and doesn't really mean it.)

Who spoke the truth?


Display Node edit under edit tab

Question: I would like to know whether the "node edit form" (admin form) can be displayed under the edit tab itself using MENU_LOCAL_TASK?
Comment: instead of redirecting to node/%node/edit. I need to show the form under the edit tab itself..
Comment: you want  you have another menu ( url) for edit page? or you want load edit ajaxly?
Comment: Thanks Zhilevan. I want under the same menu itself. I don't want to open the edit page in new tab. want the page under the edit tab itself
Answer: I suggest hide default edit tab and create a tab set with Quick Tabs module.I mean bypass default drupal menu tab( or hide it completely ) and create your own . this module help you to create a quicktab set that click on each item don't need page getting refresh.

The Quick Tabs module allows you to create blocks of tabbed content,
  specifically views, blocks, nodes* and other quicktabs*. You can
  create a block on your site containing multiple tabs with
  corresponding content. Clicking on the tabs makes the corresponding
  content display instantly, using jQuery. With the 6.x-2.x branch, this
  can be done in either ajax or non-ajax mode:
if you choose ajax mode for your Quick Tabs block (and this is chosen on an individual QT basis), only the content of the active tab

will be loaded on page load and the content of the other tabs will be
  loaded via ajax on tab click (this is good for performance if you are
  loading, for example, several large views)
      in non-ajax mode the tab content is just hidden / shown on tab-click. This latter method is an ideal way to do something like the
  Most Popular / Most Emailed stories tabs you see on many news
  websites, where it is used more as a space-saving device in your
  sidebar. If however, you want a QT block as the main content of your
  entire page, then the chances are that ajax mode will be more
  appropriate.
Once created, the Quick Tabs blocks show up in your block listing,
  ready to be configured and enabled like other blocks. Multiple Quick
  Tabs blocks can be placed on a single page.
For theming of the tabs, several styles have been provided for you to
  choose from (in the 7.x-3.x branch this functionality comes in a
  separate submodule, Quicktabs Tabstyles), along with the default
  option of no style, if you prefer to add your own theming instead.
Answer: For D7, use Advanced Form Blocks (AFB) for specific nodes, but not all/any nodes. Works also for new nodes of any chosen content type.

Display Node edit under edit tab


Trying to install ubuntu on a Lenovo ideapad 320. Install stops at "grub2" Installation

Question: I'm having trouble installing ubuntu on Lenovo ideapad 320. It freezes at "grub2" install point. I have a boot info summary here:
http://paste.ubuntu.com/26492750/
Thanks,
Answer: I had the same problem.  I solved it by booting into BIOS settings and then changing the boot settings to legacy and rebooting into the ubuntu usb from bios not uefi.   Solved....BAM!!!!  No hangups.
Answer: I found that booting into the USB drive from BIOS does let one boot Ubuntu and begin installation, but in that case the Ubuntu installer does not "see" the Windows OS. It offers to install Ubuntu on a selected partition or reformat the entire drive, but does not afford the option to provide a dual installation. I am still searching for how to make the Lenovo laptop boot to the grub file.
Answer: I get the same problem but succeed to install Ubuntu 16.04 on Lenovo ideapad 320, with following orders:

1.Download Ubuntu install .iso from the official Ubuntu Web
2.use rufus to create the bootable usb
3.Enter the BIOS through windows(systemsetting->start->setting->update and safety->resotre->restart now->advanced settings->UEFI Setting(please check with google)):

Disable Security boot
  Disable Fast boot
  Boot Mode: Legacy , Legacy support
  set USB as the first boot option

if all the setting is correct then reboot, the usb shall reboot in Legacy mode and follow the installation steps of Ubuntu, the system should be installed without stuck in grub2.
Answer: Try to install Ubuntu 18.04.
I was facing the same problem. Now it is working fine with 18.04
Comment: "Now" it is working fine with 18.04.


Use of the word "for"

Question: Way back in high school, an English teacher asked me if I understood how I was using the word "for" in one of my sentences. I didn't, and I took it as a criticism. Since that day, I have shied away from using "for" in this way. Today, I ran across a sentence that uses it in that way: "So if you are happy to close-mike a source, don't discount using an omni, which will often sound less coloured than a cardioid, for the spill penalty will probably be negligible." Can someone please tell me if and why this use of "for" is correct?
Comment: Why wouldn't it be correct? _Because/since/as_ is one of the basic meanings of _for_, which any dictionary will tell you. It's just a bit formal or old-fashioned. What's your actual question here?
Answer: It is correctly used.
It is different than most uses of for because it functions as a conjunction instead of as a preposition.
The meaning is, obviously, because/since/as as Janus Bahs Jacquet states in his comment to the question.
The following definition and (especially the first parts of the) usage note will likely be of interest to you:
conj.
Because; since.
. . .
Usage Note: For has been used as a conjunction meaning "because, since" for over 1,000 years. It is familiar in many famous quotations, from the New Testament's beatitudes (Blessed are the meek: for they shall inherit the earth, Matthew 5:05) to Shakespeare's sonnets (For thy sweet love rememb'red such wealth brings / That then I scorn to change my state with kings). Today this use of for is rare in speech and informal writing, and it often lends a literary tone or note of formality.
Like the word so, for can be viewed as either a subordinating or a coordinating conjunction, and it has been treated variously as such. It has the meaning of a subordinating conjunction, since it clearly subordinates the clause that follows it to the previous clause or sentence. But like a coordinating conjunction, for has a fixed position in the sentence, and its clause cannot be transposed to precede the superordinate clause containing the main idea. It is ungrammatical in present-day English to say For they shall inherit the earth: blessed are the meek. Perhaps because of this ambiguity in function, for is treated variously with regard to punctuation. Sometimes it begins a dependent clause and follows a comma, and sometimes it begins an independent clause (as if it were a conjunctive adverb like moreover) and follows a semicolon or period (when it is capitalized as the first word of a new sentence). All treatments are acceptable in standard usage. The difference is really one of emphasis: starting a new sentence with for tends to call more attention to the thought that it introduces.
https://www.ahdictionary.com/word/search.html?q=for
Answer: This is a good dictionary definition. Read the whole of it.
http://www.ldoceonline.com/dictionary/for_2

Use of the word "for"


DRV8873 PWM input

Question: I'm working on DRV8873 to drive a brushed DC motor. The problem is the pin I should  connect the PWM from microcontroller.
DRV8873 datasheet
There is two digital inputs that control the outputs but I don't exactly know which one of them is PWM input?
Answer: It looks like this mode has a couple different modes actually, so you should read over them to see which one works good for you. Probably PWM mode. See section 184.108.40.206. It says there,

The inputs can be set to static voltages for 100% duty cycle drive, or they can be pulse-width modulated (PWM)
  for variable motor speed. When using PWM mode (MODE = 1), switching between driving and braking typically
  is best. For example, to drive a motor forward with 50% of its maximum revolutions per minute (RPM), the IN1
  pin is high and the IN2 pin is low during the driving period. During the other period in this example, the IN1 pin is
  high and the IN2 pin is high.

Based off of this, I would hook up IN1 to PWMxH and IN2 to PWMxL if you have those sorts of pins on your chip. It would be nice to know what one you are using. Look at Table 4, Figure 36 for some explanations for how this chip is set up too. Data sheets for these things usually have lots of information that will answer your questions, you just need to read through it, especially the parts about controlling it.
Comment: I'v already read that document. I want to use it in PWM mode. But nowhere in that datasheet mentioned about connecting PWM (that was built in microcontroller) to the device. I mean IN1 or IN2.
Answer: According to the datasheet both EN/IN1 and PH/IN2 can take a PWM signal input of maximum 100kHz which propagates to the output if the driver is configured correctly.
There is 3 different modes for this driver, it looks like you are interested in the "PWM" mode.
To enable the PWM mode, you'll need to connect MODE pin to VDD:

(Page 14, Table 3)
Then, assuming nSPLEEP pin is high (connected to VDD) and DISABLE pin is low (connected to ground), you should be able to toggle IN1 and IN2 inputs to get OUT1 and OUT2 toggling with the same logic:

(Page 15, Table 5)
And as long as your PWM signal has the same logic-levels as the motor driver (using the same DVDD rail which can only be 5V for this driver), you should see the expected result from the previous table.
Comment: Thank you for your answer. I think you are right. I'll try it in the same way you told.
Answer: This is an old question, but the chip is still widely used and I don't think  existing answers are satisfactory. They focus on chip modes instead of control methods.
Most important is that where you connect PWM is entirely up to you, it depends on the control method you want to use. While control methods and modes of operation are tightly related, they are not the same concepts. Here are your options:
Mode 0,  PH/EN
In this mode you can use either Sign-Magnitude or Locked Anti-Phase control.
For Sign-Magnitude you connect PWM to EN pin and some other GPIO to PH pin. The duty cycle on EN will define speed 0..Max, and the logic level on PH will define direction. Note, that the motor is switched between drive and high-side recirculation.
For Locked Anti-Phase you connect EN to GPIO and send high level to it. The PWM is connected to PH input and the duty cycle defines both speed and direction -Max..+Max. In this case the motor is switched between active drive forward and active drive in reverse.
Mode 1, PWM
In this mode you need two PWM signals to drive motor in any direction with variable speed. You still have two control methods available to you, but they are much harder to implement, since inputs change their function between forward and reverse drive:
Magnitude Forward: IN1 = 1, IN2 = PWM
Magnitude Reverse: IN1 = PWM, IN2 = 1
For Locked Anti-Phase control you need two synchronized PWM signals, one direct and one inverted. You can actually use one signal and a simple inverter logic chip.
In PWM mode you also have alternative option for Magnitude control. Instead of switching between drive and brake you can now switch between drive and coast (open FETs):
Forward: IN1 = PWM, IN2 = 0
Reverse: IN1 = 0, IN2 = PWM
Mode 2, Independent
In this mode you have full control over voltage levels on the outputs. Basically, IN1 defines output 1 and IN2 defines output 2. This is convenient for independent unidirectional control of two motors or solenoids.
Having said that, you can connect a single motor too, then use same control methods as in Mode 0. However you will have to implement corresponding logic table in your software.
Also, if you have a spare PWM output, you can connect it to DISABLE input of the DRV8873. Then you will be able to use all control methods available in Mode 1. You will need 3 pins total and your software will be even more complicated.
P.S.
I would strongly suggest reading this excellent blog by Andras Tantos to get better idea how different modes work and find some additional control methods you can use in independent drive mode.

DRV8873 PWM input


Changing playback speed by changing frame rate

Question: My camera does simple time-lapse but it makes the videos in a 20fps format. I just want to change it to 30fps and yes I want to make the video play faster as a result. I do not want to only change the frames per second, I actually want all the frames to play faster! So it seems like this would be extremely simple, yet I can't find any help on google. I just want a cheap way of changing the frame rate. Thanks
Answer: So you want an output video with the same frames in the same order, but with just the timing changed.  No problem.
ffmpeg can't do it without transcoding, unfortunately.  So you'll need a program that can muck around with the timing info in the container.  mkvmerge can do it, and so can MP4Box.
I knew I'd seen an answer to this when I googled on it before:
https://askubuntu.com/questions/370692/how-to-change-the-framerate-of-a-video-without-reencoding
From there: the guy eventually found the right MP4Box command line (since he was working with MP4.)
MP4Box -add test_track1.h264:fps=30 -new dest.mp4
(where test_track1.h264 is the raw h.264 stream he demuxed from his source.mp4)
If a Matroska container works for you, there's also the option of:
mkvmerge -o out.mkv  --default-duration 0:30fps --fix-bitstream-timing-information 0 in.mp4
Answer: In after effects you simply drag the clip to the new composition button, change composition frame rate to 30, enable time remap on clip, and drag the end time remap keyframe to 2/3rds in. It is cheap if you have after effects downloaded already, which is common.


Why isn't this library linking with a pragma comment?

Question: I'm using Fmod in a project I'm working on in Visual C++ 2008. If I include
<code>../fmodapi375win/api/lib/fmodvc.lib
</code>
in Project->Linker->Input, it works fine, but for some reason if I use
<code>#pragma comment(lib,"../fmodapi375win/api/lib/fmodvc.lib")
</code>
instead it works the same as if that line wasn't there: it builds with no linker errors then crashes with a stack overflow from a million access violation exceptions.
What's going on, and how can I fix it so I can define the lib in code?
Answer: I don't think you are supposed to provide the .lib in the pragma comment, but, I think the real problem is that you are calling the comment by path.  Add the path to your lib search paths, and then just use a
<code>#pragma comment(lib,"fmodvc")
</code>
You are SUPPOSED to be able to use a path in this comment, but are you sure the ..\ path you are using is the correct path during link time?  Also make sure you are NOT compiling with the /nodefaultlib...
Let me know if this still does not work.  I've used this type of pragma a lot, with great success...
But, now that I'm pretty much trapped in the C# world, I don't get much time to even program in C++ anymore...
Comment: Stuart, I've gone back since this post, and I HAVE used the #pragma that you are using, and it does work.  You just have to make sure you ARE in fact linking from the correct directory.  My guess is ../ isn't correct, since the linker works out of the $(TargetDir) directory...  Hope this helps.  Let me know if it still does not work, and I'll dig into further even...
Comment: +1 for the observation about /nodefaultlib. It caught me off guard that this would keep '#pragma comment(lib, ...)' from working.
Answer: Libs could be linked in another order, so symbols are resolved differently.
Answer: Are you absolutely certain it's the same lib file in the two instances?
This can get very weird if you miss the fact that there are two versions of a file on your machine. I seriously suggest you search your drive for all occurrences of this file just to do a sanity check.
Answer: Set /VERBOSE on the command line of the link.  In the GUI, you can do this on the  property page of the project -- add to the "Command Line" node under Linker.
Then it will tell you how it resolved each function -- search for a function you know should be in fmodvc.lib.
Another thing to do is to run PROCMON.EXE during the link (pre-filter so that PATH CONTAINS fmodvc.lib) -- then link.  It will tell you the exact location it found the file (and if it ever looked for it).  Get PROCMON here: http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx
Finally, if it's linking, but not loading your library (or resolving the references) -- you might have the option to force the link to succeed set -- you should turn that off.  It would be /FORCE in the command line section (like /VERBOSE).
Comment: during the link, yes.  During the link, the linker must try to open the files -- procmon will see that.
Comment: Process Monitor's going to find *statically linked* libraries?


how to make a correct bootable usb of a linux distro?

Question: well I have been installing different distros of linux from by usb from time to time. And I always followed same method which until today stopped working for me.
So I use to format my usb with gparted into fat32 filesystem.
after that i will download the iso image of the linux distro i want to install (usually ubuntu)
open unetbootin and give it the location of my iso image on my hard-disk and location where my usb is (name of port).
unetbootin will usually do the trick for me and i can install the operation system on the computer by booting from that usb.
but today I tried this process several times and failed. Every distro gives almost same error.

can not mount on file-system.
(root) file system not defined.

other way I find on searching online was to use dd instead of unetbootin that too did not worked mostly it gives me an error that says isolinux.bin missing.
I even tried making a bootable usb using these guidelines
http://www.ubuntu.com/download/desktop/create-a-usb-stick-on-windows
that too also did not worked.

and now the worst I tried fedore which installed perfectly and now will not boot from my hard disk (give some errors on booting first time)
I tried installing fedora with unetbootin (as I use to do)
screenshot -->

anyone can guide me how to make a live usb correctly? or tell me how to fix this error on fedora?
Thanks
Comment: Try formatting the disk as VFAT, not FAT32.
Answer: I ran into same issue once.
Issue was that my FEDORA iso was corrupted.
Download Fedora again and make sure to see checksum


Universal PAN id in zigbee

Question: Is there any Universal PAN id in zigbee which can receive packets from different PAN id senders?(For sending packets to all PANid we can use oxFFFF)
Answer: ZigBee document 075297r04 is the "Proposal for Inter-PAN Exchange of Data in ZigBee".  You'll need to be a member of the ZigBee Alliance to access that though.
Inter-PAN is mentioned in a few specs, but I have not seen it in use yet.  You'll want to check with your hardware/stack provider to see how they support it.
Answer: You could also use "groups". Controling at the and all devices that joined this group.

Universal PAN id in zigbee


Is there a straightforward way to widen a rear rack

Question: I am trying to widen a 15cm wide rear rack to better support a rear bag. The current rack is part of the battery holder and so cannot be simply swapped for a wider rack.
Comment: Some pictures would help us understand what you're trying to achieve
Comment: How are your woodworking skills ?
Comment: When looking for rear racks the (Dutch language) selling site also had ready made rack wideners. I would not know whether they would work for you but you might try some of the big internet sellers.
Answer: As I am interpreting your question, you wish to widen the platform width to fit your rear bag better.  The engineer in me would approach it this way:
Build/fabricate a thin platform to place upon the existing platform.  This would allow you to customize the width of your platform to conform to your bag perfectly.  You could use thin sheet aluminum, plexiglass, wood, or another material. All have advantages and disadvantages.  Regardless, round off all sharp edges and corners to prevent injury and wear on your rear bag/attachments. Wood should probably be finished with a sealer/waterproof finish.
Your new platform would need to attach to your existing platform in some way.  Options would be:

Velcro (pretty strong stuff!, plus, because Velcro uses adhesive backing to apply it you can remove it at a later time without leaving any trace).  You would likely need to use some preexisting mount points for your rear bag when using Velcro option otherwise your rear bag would be held on to your bike solely by the adhesive used on the Velcro strips (the adhesives are likely the weakest link - the Velcro will stay unless it is defective).
a few screws (or similar) that affix the new platform to the existing one (this will depend on what material the existing platform is made of, and if this can be done without impacting the battery or other electronics).  This option will definitely leave a permanent mark on the existing platform.
The new platform could be attached to the existing rack using mount points offered on the existing rack (if they exist). For this you would need to add some straps (friction or Velcro) that interface with the existing rack in some manner.

Your rear bag can now attach in one of two ways:

You can still use attachment points on the existing rack.
You can create attachment points on your new, custom platform.

Possibly, both preexisting and new attachment points could be utilized.  It depends on your specific case.
If you go this (or another) route, add some pictures to your question above showing your solution so others can benefit from any lessons learned and other experiences.
Comment: Thanks for the advice, I think make one yourself looks like the best option. I only ask to make sure there wasn't just what I wanted if only I'd known where to look.
Answer: You could try to buy a Monkey Mee, that's a rear carrier add on. U can mount them on most rear racks. They widen the platform to about 30 cm by 25 cm long. And add an upright rack, also about 30 cm high. On the upright part there is a strap with a buckle. This can be easily opened and closed. These are made to support a 20-25 liter backpack or daypack.
https://www.dutchbikebits.com/steco-monkey-mee-rucksack-carrier


Admin site does not change the content after CLI command

Question: When I try to modify system.xml or add a product attribute, I try to run setup:upgrade, cache:flush or setup:di:compile. Why might the Magento admin site still not reflect the change in content that I already added?
Answer: Do try these and check on incognito
rm -rf pub/static/*
rm -rf generated/*
rm -rf var/view_preprocessed/*
rm -rf var/cache/*
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f
php bin/magento cache:flush

Comment: It still not working but thank for your help
Comment: Could you check for any exceptions/errors in /var/log and let us know ? also silly question: are you editing and running all your commands on the same project root ? I occasionally do this mistake :D
Comment: Well, it realy hard for me to tell you what my problem is but i can only say that my magento project has a bizarre problem that when i run the command line, my site does not change at all, i check on google and nobody has this issue before. So i hope you can understand it.
Answer: If you add attribut to product you probably need to reindex your catalog data
php bin/magento i:rei
you can also try to force the update of the attribut :
php bin/magento queue:consumers:start product_action_attribute.update
What kind of change do you want to make?
Answer: You should try this steps :
- rm -rf var/cache/* var/page_cache/* var/generation/*
- sudo chmod -R 777 var/ generated/
- Composer update
- Restart fpm php
- bin/magento setup:static-content:deploy -f
- If you are doing custom work then you should check the directory path.

If you are still facing the same do let me know!


Changing homepage

Question: I have to change dynamically the homepage according to the server HTTP_HOST.
I've tried to update $_GET['q'] inside the settings.php.
It works but, the internal drupal function drupal_is_frontpage() compares with the drupal_get_variable('site_frontpage').
A suggestion ? Thanks.
Answer: Try either the domain access or subdomain module.
Update:
As a poor-man's solution, in settings.php, you could try the following:
if ($server['HTTP_HOST'] == 'foo.com'){
  $conf['site_frontpage'] = 'node/XXX';
} elseif ($server['HTTP_HOST'] == 'bar.com') {
  $conf['site_frontpage'] = 'node/YYY';
}

Thanks @Chance G for a good idea.
Comment: Thanks for the anwsers @greg_1_anderson and @Chance G. In fact, the variable `$conf` is not defined in settings.php. I've move this `switch` after bootstrap call, in index.php (I will move this in a module), but it works correctly.

Finnaly, updating `$_GET['q']` and `$conf['site_frontpage']` solve my problem.

Thanks
Comment: In fact, this code must be inserted after `menu_execute_active_handler()`.
Answer: In your settings file or theme preprocess file you could add something like the following using the variable_set function:
if ($server['HTTP_HOST'] == 'foo.com'){
  variable_set('site_frontpage', 'node/XXX');
} elseif ($server['HTTP_HOST'] == 'bar.com') {
  variable_set('site_frontpage', 'node/YYY');
}

Comment: This is a good idea, but a bad implementation; variable_set will affect all visitors to the site. If you have multiple page requests all at the same time, some users will get the frontpage set for other users. Make the change to $conf['site_frontpage'] in settings.php and it should work right, though.
Answer: variable_set() is a really really bad idea because it touches the Database everytime. Bad for performance, logically, etc... Simply don't do that ;)
But I extended the solution from @greg_1_anderson a bit by also ensuring the front page is not being delievery from cache, see my blog post: https://julian.pustkuchen.com/node/794
I think that's a good solution for Drupal 7. For Drupal 8 I didn't yet find a simple solution, perhaps someone has an idea.

Changing homepage