Is "NG" (no good) correct english?

Question: Living in a country with a lot of incorrect "english-like" expressions, I am in doubt. Is "NG" correct english?  (meaning the opposite of "OK")
If not, what is the opposite of "OK"?
Comment: A friend used to work for the Atomic Energy Authority, and was amazed how many test stickers were attached to every piece of equipment. To gauge how important they were, he had his own stickers printed: they said "NEIGE". Over the next few years, he started sticking them onto pieces of equipment, and nobody ever questioned what they were for, or what they meant. NEIGE is his personal acronym for "Near Enough is Good Enough". IMHO, NG ranks only slightly less obscure than NEIGE.
Comment: Am a fluent English speaker but no native speaker. To me "NG" wasn't familiar either. Saw "NG" near "OK" in compatibility charts for Chinese electronic products which are directly marketed to Western customers on Amazon, i.e. this [SSD adapter](https://www.amazon.com/dp/B00S52ETNO/).
Answer: No, NG is not understandable in common American English – its common use is Japanese English. I am a native speaker of American English, and first heard "NG" when learning Japanese. Apparently it is used in technical contexts, especially film ("bad take"), but not in everyday American speech.
Comment: It's not used in Canadian English either, except perhaps as an slang online abbreviation and only when it's obvious by context.
Comment: I was browsing the Panasonic website and noticed the acronym "NG". Incidentally, they are a Japanese company.
Answer: Never heard of NG to mean "No good".
As an antonym of OK, you can say:
Bad/Wrong/Not good/No good/Not correct.
Some people also say "Not OK".
Answer: I work in TV/Film/Commercial production in Taiwan(ASIA). People often say NG as NO GOOD or NOT GOOD. However, I've never hear anyone saying this out of 15 years of living in California.
Answer: I also heard it for the first time in Japan, so I have always assumed it was another example of "Japanese English." But I just saw it used in this video clip from a 1977 British television show (Link time-stamped to one minute). https://youtu.be/mUF4afxMpQk?t=60
A post on another question/answer site says "NG" was used during the post WW2 occupation in Japan to mark things for censorship, but the source of this story is the following Japanese Wikipedia link which doesn't mention anything along those lines.
https://ja.wikipedia.org/wiki/NG_(%E6%94%BE%E9%80%81%E7%94%A8%E8%AA%9E)
The Wikipedia article does mentioned it used as a term for bloopers or outtakes in English speaking countries, which coincides with the video clip I linked above. I also found it as an entry ("N.G.") in the following book which is available online for text searching:
International Dictionary of Broadcasting and Film by Desi Bognar (pg. 172)
ISBN-13: 978-0240803760
ISBN-10: 0330440497
https://www.google.com/books/edition/International_Dictionary_of_Broadcasting/Aqk0DwAAQBAJ?hl=en&gbpv=1&dq=inauthor%3A%22Desi%20Bognar%22&pg=PT233&printsec=frontcover&bsq=N.G.
It seems to be a common term in broadcasting that isn't used in daily conversation (in America, not sure about Britain), but definitely used in Japan and apparently other parts of Asia.
Comment: Hi, welcome to ELL! Good answer!
Answer: "NG" is not an acronym in common use, but it would probably be understood by many speakers, as people come up with new acronyms all the time (especially teenagers when their parents learn the latest slang from the internet)
For example, the acronym "SNS" to mean "sorry not sorry" is relatively new, at least according to my 17-year old nephew.
The opposite of "OK" is "not OK". I'm sure there are various shorthand expressions that mean "not good" but these might vary depending on context.
In any case, all these are considered slang expressions, and therefore none of them are "incorrect".  Different groups use different slang, that's all.
Answer: I'm a California resident, and I use NG all the time...but only with my coworkers. I work in consumer electronics engineering, and at work we use NG to refer to a defective part that failed a test, or more generally refer to any process that is unacceptable. This is helpful when navigating language barriers with our suppliers.
But we also now use it to refer to anything that is not good or unacceptable.
"Don't get the noodles—they're NG."
"The situation in the lab is NG."
"How's it going?" "NG...smh"

Is "NG" (no good) correct english?


Dropbox and login items list

Question: I have Dropbox installed on my Mac with OS X Lion 10.8.2. I don't use it often, so I eliminated it from the login item list. However, every time I open Dropbox from the application folder, it automatically add itself to the login item list. Is that normal, even if I locked changes? Can I prevent Dropbox to add itself to my item list every time I open it?
Comment: I know the idea of Dropbox is to always sync file across devices. In fact I use it on a computer. But in the second computer I don't want Dropbox always open: I just use it if I have to exchange files between computers. ;)
Answer: Under Dropbox preferences, there is a checkbox for "Start Dropbox on System Startup".
However, as patrix says, Dropbox is really only useful if you leave it running all the time.
Answer: The idea of Dropbox is to always sync files across all your devices in the background. So disabling the login item doesn't really make sense from a Dropbox point of view. And at least at first glance I don't see significant drawbacks from keeping it there either.
If you just want to access some files in your Dropbox account you could use the web interface instead.

Dropbox and login items list


Adding Overlays to Videos export as a video in android

Question: So i have a video for eg. a race car video and i created a overlay view (transparent relative layout) which includes some progress bar related to speed and performance now i need to export full video as seen in this view so can anyone please help me i have gone through ffmpeg,opencv but no success.
Similar Ios Overlay
Comment: This is an interesting and hard problem. None of the posted solutions will work as-is. The explanation is too detailed to fit within a comment. Have you tried doing it outside the view loop. If the overlay is static, then its a relatively easier with ffmpeg command. But if the overlay is dynamic(e.g. subtitles), then the ffmpeg command is complicated.  Doing it in the view loop is not a practical solution, unless the video is from a live stream.
A good example of something similar is [grafika](https://github.com/google/grafika). You can use relevant parts that source on your app.
Comment: Which overlay ?
Comment: And show the code you have, please.
Comment: I don't understand the question. Here is what I got.. you want to export a video, that is being played on the screen. What are you using to play the video ?
Comment: i have a view on top of video i want to export the video with that view embedded on top of that video
Comment: i have seen grafika also but it gives an example of recording a surfaceview in my case the data is speed of car and its a viewgroup not a single view (surfaceview)
Answer: I think you could use OpenCV or ffmpeg to accomplish this task, but it seems like they might not be the right tool for this task. OpenCV is great for advanced video processing, and under the hood it uses ffmpeg for decoding and encoding capabilities. ffmpeg is great when you need to support a wide variety of media formats. For ffmpeg you could try to run run it as a standalone process, but this is less than ideal for permission issues and error handling. You can also write your own Android NDK API that incorporates ffmpeg, but this could be a lot of effort. Assuming your required output media format is supported by Android, the easiest path is to use the Android MediaCodec libraries.
Take a look at this test code from Google that shows how to decode, edit, and encode. You can decode the video file into a SurfaceTexture. For the editing part you will use OpenGL ES to do the overlay. The overlay image can be uploaded to a texture and drawn over the video frame SurfaceTexture. Once the scene is drawn, the outputted texture can be sent to the MediaCodec encoder. This can all be done in the export process and doesn't necessarily need to be need be associated with your viewable video and transparent relative layout.
Answer: For decoding video to bitmap and encoding bitmap back to mp4 video you can use jcodec.
SequenceEncoder sequenceEncoder = new SequenceEncoder(new File(pathToSaveVideo));

Perform these steps in a loop

Extract bitmaps of each frame of video
Combine with overlay bitmap
 Canvas canvas = new Canvas(backgroundBitmap);
 Paint rectpaint = new Paint(Paint.ANTI_ALIAS_FLAG);
 int width = overlayBitmap.getWidth();
 int height = overlayBitmap.getHeight();
 Rect des = new Rect(0, 0, canvas.getWidth(), canvas.getHeight());
 Rect src = new Rect(0, 0, width, height);
 canvas.drawBitmap(overlayBitmap, src, des, rectpaint);

Encode it back into a video
sequenceEncoder.encodeImage(backgroundBitmap);

Finally finish the encoder after loop
sequenceEncoder.finish()
Answer: You will be able to achieve using opencv org.bytedeco.javacpp, i used FFmpegFrameGrabber for garbing frame and FFmpegFrameRecorder recording this images back to mp4 with the same audio codex.

Dependencies needed:
    compile group: 'org.bytedeco', name: 'javacv', version: '1.4'
    compile group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.4.0-1.4', classifier: 'android-arm'
    compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '3.4.1-1.4', classifier: 'android-arm'


Significance and certainty in hypothesis testing

Question: This post originates from this discussion: Two one-sided hypothesis tests instead of a two-sided test? Say we repeatedly draw a sample of size $n$ and conduct a two tailed t-test against a hypothesized mean $\mu_0$ at a certain significance level $\alpha$. Let us further assume the samples are from one (normal) distribution (it may or may not be the one we hypothesize) that does not change over time and is unknown to us. After a few runs, we may have some hits in both rejection regions of our hypothesized distribution and may reject the null. My question is: If results start to pile up in one rejection region after a lot of runs, how long will we believe in the plausibility of $H_0$ and thus the relevance of $\alpha$?. After all, an actual error only occurs with a chance of $$P(reject\:H_0\cap H_0\:true)=P(H_0\:true)\cdot P_{H_0\:true}(reject\:H_0)=P(H_0\:true)\cdot \alpha$$ Doesn't it just become unreasonable to believe in the possibility of $H_0\:true$ and the realistic chance of a type I error if results repeatedly suggest otherwise?
Moreover, would it be reasonable to reject (or accept) $H_0$ after one test (as we often see being done in practice)? I mean, since frequentist probabilities refer to an "infinite" number of runs, isn't one result rather meaningless? On the other hand, if we conduct many runs, hypothesis testing also seems to become quite pointless as I pointed out before...
Comment: If you are willing to model the truth of hypotheses about parameters (H_0 true) and the data (test stat exceeds critical value (=reject H_0)) within a joint probability distribution, as you have done, then you should use Bayes.
Comment: Indeed I have read before that a Bayesian approach may be more suitable for significance testing. Unfortunately I was never taught anything about the Bayesian way at university... The more I think about, the more I wonder why we are making such a fuss about t-tests and p values. After one run, we know nothing about $P(H_0\:true)$ and the result may just be mere coincidence. After many runs, we will know if $H_0$ is plausible and there should be no more need to think "in subjunctives".
Answer: Based upon your question, it appears you wish to know when we can forego traditional hypothesis testing given a sufficient number of rejections of $H_{0}$.
To begin, I want to note that frequentist tests cannot tell us anything with certainty. In the post you referenced, you posed a question about a drug's effectiveness on reducing the incidence of a particular disease. It is worth noting that frequentist routines, even if conducted repeatedly, cannot definitively answer this type of question. We must make a declaration of uncertainty.
Inference proceeds with statements regarding how likely, or unlikely, our observed effect is, if $H_{0}$ is true. Suppose a new drug purports to reduce the the onset of chronic heart failure. One group of 30 patients receives a new drug, while another group of 30 patients receives a placebo. After one year, the proportion of patients experiencing heart failure is lower in the treatment group. Suppose 10 out of 30 patients receiving the new drug experience heart failure after the observation period, compared with 20 out of 30 patients in the control group. It appears the drug reduced the onset of heart failure in the treatment group. Now suppose a new sample was drawn and 28 out of 30 patients did not experience any symptoms related to heart failure, compared with only 10 out of the 30 patients taking the placebo. We could concoct many stories from this observed effect. Maybe patients in the former test were more likely to transcend physiological hardship during the observation period. Based upon one test, this is a likely explanation. However, treated patients in the latter test showed even more improvement. It is still possible that the treatment group showed more willingness to improve their health throughout the observation period. But now, this explanation is less likely. I am only using this hypothetical example to illustrate a point.

My question is: If results start to pile up in one rejection region after a lot of runs, how long will we believe in the plausibility of 0 and thus the relevance of ?

Because we often work with samples in practice, we can never confirm nor deny the plausibility of $H_{0}$, which is a statement about a population quantity. Note, the p-value is not evidence of the truth of $H_{0}$. Suppose in our second example we obtained a $p$-value of .03. This is the probability of observing a result this extreme, or a result even more extreme, if the null were true. In other words, if the null were true, an observed effect this extreme, or even more extreme, would occur 3 times out of 100. Even in repeated testing, we are not assigning probabilities to the truth or falsity of the stated null.

Moreover, would it be reasonable to reject (or accept) 0 after one test (as we often see being done in practice)?

Yes. Hypothesis testing involves explicit statements about population parameters. The number of tests is irrelevant. The conclusions we draw from a single test are up to us to decide. Frequentist methods cannot answer questions with respect to how the data is favoring the null. Large p-values are not indicative of the truth of $H_{0}$.
Bayesian approaches may be more applicable in this scenario. See this post for a brief discussion.
Comment: Bayesian $t$-tests can be implemented fairly easily in R. See the work by [Meredith and Kruschke (2018)](https://cran.r-project.org/web/packages/BEST/vignettes/BEST.pdf). Also, this previous [post](https://stats.stackexchange.com/questions/104932/bayesian-alternative-or-complement-to-the-student-t-test) may tangentially address your concerns.
Comment: Thank you for the explanation. So what I conclude after all is that by applying traditional frequentist p value statistics, we always act like we knew absolutely nothing about $p(H_0\:true)$ (even after many runs) and that if we would like to include an estimate of $p(H_0\:true)$ based on the results (evidence), we would have to go for a Bayesian approach.
Answer: Wow, really good question.  Let me see if I can add something.

My question is: If results start to pile up in one rejection region after a lot of runs, how long will we believe in the plausibility of 0 and thus the relevance of ?

I don't think this is a Frequentist question.  To review, probability is the long term relative frequency of an event.  To quantify plausibility in a hypothesis sounds, at least to me, very Bayesian.
The mechanics of a hypothesis test force you to make an assumption about the world.  In reality, H0 is strictly false (no two populations have precisely the same mean) but it can be a useful approximation.  It is up to the investigator to determine if that null hypothesis is a useful approximation conditioned on the experiment, the question, past experiments, etc.
So to answer your question, there is no number we can place on the hypothesis as Frequentists.  The plausibility of the null would be a scientific question, not a statistical one.

Doesn't it just become unreasonable to believe in the possibility of 0 and the realistic chance of a type I error if results repeatedly suggest otherwise?

I suppose this is the intended purpose of replication.  A single rejection of the null does not constitute proof that the null is false (else, the type 1 error would be 0).  Repeated rejection of the null through replication would likely lead to people believing the difference is real.  One can see this happening even today as theories like General Relativity continuously receive empirical support for their theories. I suppose that is a more a concern for philosophers of science, and I'm sure I am making some philosophers role in their grave, but I find this argument compelling.


Is there any tool that convert a Pie Chart (and others) from MS Excel to LaTex Code?

Question: I am looking for a tool (if it exist) that given a chart from MS Excel return the LaTeX code to insert in a document.
Comment: do you need to _convert_ it? You can just use `\includegraphics` to include the excel generated image.
Comment: If you _really, really, really_ want piecharts, why not generate them in LaTeX. Convert your *xc*l spreadsheet to csv format and then use a package such as `datatool` (`datapie`) to generate the pie chart.
Comment: [MetaFile to eps converter](http://wiki.lyx.org/Windows/MetafileToEPSConverter) worked for me with powerpoint graphics so I think it can also work with excel pie charts. Already suggested at http://tex.stackexchange.com/a/186213/1952
Answer: I've used this workflow in the past for moving large numbers of graphs from Excel to a Latex document:
From Excel, print the chart to an .eps file format using a generic postscript printer device. In Latex, embed the .eps file.
Here's an online resource that has templates to get started: http://embedded.eecs.berkeley.edu/concurrency/latex/latexWithEPS.html
Comment: In newer versions of ms office pdf export is available.


Dropbox: Ubuntu 14.04, Cinnamon, Nemo

Question: I cant link Dropbox with Nemo. I uninstalled Nautilus, installed dropbox then installed nemo-dropbox, but it doesn't work.

These are the steps I've done:

1: sudo apt-get install cinnamon
2: restart and log into cinnamon
3: sudo apt-get purge nautilus
4: sudo apt-get autoremove nautilus
5: download and install Dropbox for Ubuntu x64
6: sudo apt-get install nemo-dropbox
7: run dropbox

problem: dropbox folder in nemo, doesn't have the "dropbox" menu when I right click, and icons dont have dropbox symbols (syncing or synced)
Comment: Please edit your answer showing steps you have did and what is the error?
Comment: Is it more understandable now?
Comment: Are you sure that menu is installed with the `nemo-dropbox` package? I have used this package in various systems with 14.04 and 15.04 and it never created such menu.
Answer: The dropbox integration you describe is dependent on the package nemo-python which is, as far as I know, not part of the ubuntu repositories.
Same goes for integration with the ownCloud desktop client, for example.
Compared to Linux Mint, the Ubuntu repos still miss some packages (like nemo-preview and aforementioned nemo-python). Even on 15.10 this does not work out-of-the box.
If you can find a version of nemo-python (e.g. in a PPA somewhere) your chances are much higher of getting it to work.

Dropbox: Ubuntu 14.04, Cinnamon, Nemo


Thumbnail size according to width and height

Question: I am trying to generate thumbnail according to image width or height. set image width 200px if width is larger then height or set image height 200px if height is larger then width.
Comment: What do you have in your media settings screen? What have you tried so far? What do you currently get? Where are you displaying your thumbnails? What is the code that displays them?
Comment: Currently I'm using basic code
add_image_size('artwork-size', 200, 9999, false);

this is what i want

if width and height equals to each other
add_image_size('artwork-square', 200, 200, false);
elseif width greater then height then
add_image_size('artwork-landscape', 200, 9999, false);
elseif height greater then width then
add_image_size('artwork-portrait', 9999, 200, false);
Comment: `add_image_size` should always be called, think of it more as ***register_image_size***
Answer: add_image_size doesn't do what you think it does. It doesn't add an image of size X to a thumbnail, rather it registers an image size, and its associated dimensions. register_image_size may well have been the more appropriate name for this function.
As a result, you need to register all your image sizes, on every page load. If you don't, when you upload an image, it won't be resized to that image size.
To use an image size, pass in its name when calling other functions, e.g.:
the_post_thumbnail( 'thumbnail' );
the_post_thumbnail( 'medium' );
the_post_thumbnail( 'large' );

// and so on...

the_post_thumbnail( 'artwork-square' );
the_post_thumbnail( 'artwork-landscape' );

A final note. If you haven't called add_image_size to register your image size, and you upload an image, a copy of that image in the new size will not be made. If you then call and use add_image_size again, or change the dimensions, WordPress will not go back and resize/recreate all those images ( imagine it, your server would become unresponsive resizing hundreds or thousands of images ).
Instead WordPress will use the closest available size, and scale it up in html, which can cause stretching and quality issues as the browser widens and lengthens a small image.
To get around this, there are plugins that regenerate the thumbnails. There are several available on wordpress.org


JQuery success not fired while other ajax call running

Question: I have an issue with two ajax calls using jQuery 1.4.2. With the first call the server is taking a long time to respond (over 40 sec) and when the 2nd call is fired (which isn't timing out) FireBug tells me the 2nd requests response is downloaded fine but the success event isn't fired. Could someone tell me why this would be? When the first call completes, the 2nd success event is then fired. I don't want to wait for the first call to complete though.
A sample of my code is:
function GetSession() {
<code>    var superUrl = "";
    superUrl = "http://urltakingalongtimetogivea200response";
    // requires authentication
    $.ajax({ url: superUrl,
    dataType: "jsonp",
        timeout: 5000,
        jsonpCallback: 'Login',
        contentType: "application/json; charset=utf-8",
        success: function GotSession(result) {
            sessionkey = result.SessionKey;
        },
        error: function AjaxFailed(result) {
            alert("error retrieving session:" + result);
        }
    });
}
</code>
$("#click-me").click(function() {
<code>    theQuery = "http://urlreturningresponsequickly";

    $.ajax({ url: theQuery,
        dataType: "jsonp",
        jsonpCallback: 'Results1s',
        contentType: "application/json; charset=utf-8",

        success: function Success(result) {
            alert("this is taking to long to succeed");
            // other methods
        }
,
        error: function AjaxFailed(result) {
            alert("error:" + result);
        }
    });
});
</code>
Thanks,
Colin.
Comment: I think it is because `jsonpCallback` is the success handler.
Answer: Not sure but maybe you have to add:
<code>async: true
</code>
to ajax calls


Duplex Mismatch Detection

Question: I'm trying to create a lab on PT to learn about duplex mismatch. I made one end of Fast Ethernet half duplex and other end is full duplex. I was hoping to see an increment in late collisions which I studied that should indicate duplex mismatch. But the late collisions is 0. Any reason why this is happening?
Comment: Are you looking at both ends of the link?
Comment: Possible duplicate of [speed/duplex mismatch](https://networkengineering.stackexchange.com/questions/733/speed-duplex-mismatch)
Answer: Packet Tracer is a simulator aimed at CCNA level courses.
It doesn't accurately simulate real devices but only a subset of their functions. (and still those simulations aren't perfect).
I would not rely on this tool to test whatever part is not explicitly teached in Cisco courses that use Packet Tracer.
TLDR you cannot trust PT to correctly simulate this.
Answer:
A late collision is defined as any collision that occurs after 512 bits of the frame have been transmitted.

In order to test it in your lab, you can try sending a big size of data, several time on the link having the duplex mismatch, using an extented ping as shown below.
<code>!Make sure you change the target and source IP address to your need

Router A#ping
Protocol [ip]:
Target IP address: 192.168.40.1
Repeat count [5]: 1000
Datagram size [100]: 18000
Timeout in seconds [2]:
Extended commands [n]:
Source address or interface: 172.16.23.2
</code>
Hope it helps and it is not too late.

Duplex Mismatch Detection


autotest not working on Windows 7 32 bit

Question: I'm going through the Rails Tutorial by Michael Hartl and am not having any luck getting autotest working.
When I run the "autotest" command I get the following output in my terminal:

C:\Sites\rails_projects\sample_app>autotest
  loading autotest/rails_rspec2

←[2J←[fbundle exec C:\RailsInstaller\Ruby1.8.7\bin\ruby -S C:/RailsInstaller/Rub
  y1.8.7/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/bin/rspec --autotest 'C:/Sites/ra
  ils_projects/sample_app/spec/controllers/pages_controller_spec.rb'
  bundler: command not found: C:\RailsInstaller\Ruby1.8.7\bin\ruby
  Install missing gem binaries with bundle install
  Notification sent successfully
  Notification sent successfully

Then it just stalls and I have to cntrl+c to get out of it.
When I try running a "bundle exec autotest" i get the following output:

C:\Sites\rails_projects\sample_app>bundle exec autotest
  C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/ru
  bygems_integration.rb:143:in `gem': ZenTest is not part of the bundle. Add it to
  Gemfile. (Gem::LoadError)
         from C:/RailsInstaller/Ruby1.8.7/bin/autotest:18

I have the following content in my .autotest file:

require 'autotest/growl'

and my gemfile looks like this:

source 'http://rubygems.org'
gem 'rails', '3.0.7'
  gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
group :development do
      gem 'rspec-rails', '2.0.1'
  end
group :test do
    gem 'rspec', '2.0.1'
    gem 'webrat', '0.7.1'
  end

Can someone please help me with this?
Answer: It looks like ZenTest may not have installed correctly. You could try gem install ZenTest and see if you get a different result running bundle exec autotest. If that doesn't work, maybe try adding ZenTest to your Gemfile.


Wrap the without space Text in Visualforce PDF

Question: I have the Problem to wrap the Text in PDF and the Text is without Space something like that "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".
Please Help me to solve this.
Thanks in Advance.
Answer: CSS3 supports a few styles for wrapping text:
text-overflow, overflow-wrap and the now-deprecated word-wrap.
If the VF rendering from HTML into PDF supports these CSS properties, this may work for you.
New CSS3 Properties to Handle Text and Word Wrapping
Comment: [Community - Table Header in each page in PDF.](http://boards.developerforce.com/t5/Visualforce-Development/Table-Header-in-each-page-in-PDF/td-p/210656) We have to use -fs vendor prefixes for some special CSS, such as table headers in each page.
Comment: Answer is possibly irrelevant; the user is referring to Flying Saucer's ability to wrap text, not a browser.
Comment: SFDC uses Flying Saucer?
Comment: @sfdcfox, The answer _may_ be irrelevant, but it's not common knowledge which CSS spec is used during the HTML to PDF conversion which is why I mentioned that it _may_ work. Can you confirm that SFDC uses [Flying Saucer](https://code.google.com/p/flying-saucer/) for PDF rendering?
Answer: Unfortunately this doesn't work. Salesforce lists this as a known issue marked as no fix.

Long line of text doesn't wrap properly when PDF is generated via
  visualforce. It also doesn't respect CSS word-wrap and word-break
  properties and those do not work properly when set to break-work and
  break-all, respectively.

Salesforce has release a pilot version of their new improved pdf rendering engine (details here). Being based on a chromimum engine the output matches what debugging results in chrome and has full support for css paged media. While it does appear to have some scalability issues associated with the current version, it's stated intention is to add

broader support for modern HTML standards, such as CSS3, JavaScript,
  and HTML5

One might reasonably hope issues like this are marked as non-fix as they're expected to be addressed by the new and improved rendering engine.
However, if you're unable to join the pilot the only option is to manually implement line breaking on a case by case basis. If you're interested in more of an algorithm the discussion of the best text wrapping algorithm on stackoverflow may be useful and has some examples that should be portable.
Answer: I used the approach provided by Ralph Callaway here and expanded it a bit.
The basic concept is that the long words must be broken down so that they are automatically wrapped by the PDF rendering engine. The best way to split them is to wrap them with  tags so that a word such as SomethingVeryLong is represented as SomethingVeryLong.
The Visualforce page rendering engine can then use the span elements to split the word if it needs to.
Here's the complete logic:
public class UTIL_Pdf {
    /**
    * Maximum word length
    */
    private final static Integer LENGTH = 7;

    /**
    * Reduce the long strings (i.e. words) inside the provided text into more manageable pieces.
    * NOTE: the total length of the final string might get significantly larger due to this.
    *
    * @param text  String to reduce
    *
    * @return      Same string as the one passed in, but each individual long string is
    *              split and surrounded with `<span></span>` tags.
    *              e.g.ABC-Something -> ABC-Something
    */
    public static String stringReducer(String text) {
        if (String.isBlank(text)) {
            return '';
        }

        String retVal = text;

        for (String str : new Set<String>(stripHtml(text).unescapeHtml4().split(' '))) {
            if (str.length() > LENGTH) {
                String newString = splitWord(str, LENGTH);

                // split into 4 replace calls becuse we had an issue that the html properites were getting replaced by accident:
                // e.g. somelongurl <- only "somelongurl" in content should be replaced.
                retVal = retVal.replace(' ' + str + ' ', ' ' + newString + ' ')
                    .replace('>' + str + '<', '>' + newString + '<')
                    .replace('>' + str + ' ', '>' + newString + ' ')
                    .replace(' ' + str + '<', ' ' + newString + '<');//"
            }
        }

        return retVal;
    }

    /**
    * Strip HTML tags from the provided string
    */
    private static String stripHtml(String s) {
        if (String.isBlank(s)) {
            return '';
        }

        return s.replaceAll('<[^>]+>', ' ');
    }

    /**
    * Split the provided string at special characters,
    * then at any position if the length still exceeds `maxLength`
    *
    * @param str       String to split
    * @param maxLength Max lenght of each individual part of the string
    *
    * @return          ABC-Something -> ABC-Something
    */
    private static String splitWord(String str, final Integer maxLength) {
        String newString = '';

        for (String s2 : splitStringBySpecialCharacters(str, '-;:<>/\\\u00A0')) {
            if (s2.length() > maxLength) {
                // the string is still too long, so split it further without any character consideration
                for (String s3 : splitEqually(s2, maxLength)) {
                    newString = wrapAndAppend(newString, s3);
                }
            } else {
                // the string is of acceptable length, so just wrap it in  and append it
                newString = wrapAndAppend(newString, s2);
            }
        }

        return newString;
    }

    /**
    * Split the string by special characters.
    * If the special character is not a whitespace, it will be appended to the end of the first part of the string
    * (e.g. "ABC-Something" -> "ABC-", "Something")
    *
    * @param str               string to split
    * @param splitCharacters   single string of characters by which to split the string
    *
    * @return                  splitted string
    */
    private static List<String> splitStringBySpecialCharacters(String str, String splitCharacters) {
        List<String> parts = new List<String>();

        if (str != null) {
            Integer startIndex = 0;
            while (true) {
                Integer preIndex = str.subString(startIndex).indexOfAny(splitCharacters);
                Integer index = startIndex + preIndex;

                if (preIndex == -1) {
                    parts.add(str.subString(startIndex));
                    break;
                }

                String word = str.subString(startIndex, index);
                String nextChar = str.subString(index, index + 1);

                // Dashes and the likes should stick to the word occuring before it. Whitespace doesn't have to.
                if (nextChar.isWhiteSpace() || nextChar == '\u00A0') {
                    parts.add(word);
                    parts.add(nextChar);
                } else {
                    parts.add(word + nextChar);
                }

                startIndex = index + 1;
            }
        }

        return parts;
    }

    /**
    * Split the string equally into list of strings of provided size.
    * The trailing (last) string will usually be smaller than the rest.
    *
    * @param str   string to split
    * @param size  maximum size of each part
    *
    * @return      splitted string
    */
    private static List<String> splitEqually(String str, Integer size) {
        List<String> ret = new List<String>();

        for (Integer start = 0; start < str.length(); start += size) {
            ret.add(str.substring(start, Math.min(str.length(), start + size)));
        }
        return ret;
    }

    /**
    * Wrap `toAppend` string into `<span></span>` so that it can be wrapped automatically by PDF engine
    * and append it to the end of the provided `str`.
    *
    * @param str       String to append to and then return
    * @param toAppend  String to wrap and append
    *
    * @return          strtoAppend
    */
    private static String wrapAndAppend(String str, String toAppend) {
        if (String.isBlank(toAppend)) {
            return str;
        }

        // don't wrap   in spans
        // as it will just increase the string size without any benefits
        // (  will wrap on its own)
        if (toAppend == '\u00A0') {
            str += toAppend;
        } else {
            str += '' + toAppend + '';
        }

        return str;
    }
}

You can then pass the HTML to UTIL_Pdf.stringReducer(..) before rendering in a Visualforce Page.
I detailed the solution a bit more in this blog post.


What makes the Earth keep spinning?

Question: What makes the Earth keep spinning?
Comment: Possible duplicates: http://physics.stackexchange.com/q/12140/2451 and links therein.
Answer: I agree with the previous answer.  Angular momentum, something the earth has because of its rotation about its axis, can only be changed when an external torque (twisting motion) is applied to the earth.  As far as I know, there are two ways in which this can happen.  If there was friction between the earth's surface and space, then that would slow down the earth.  However, this is negligible because space is essentially a vacuum.  The second way is through the gravitational/tidal force applied by the moon.  This force creates the tidal bulge of the earth's oceans, exerting a torque.  So, while the earth seems to be spinning at a constant rate, it is actually slowing down slightly over time because of these tidal forces.
Comment: I believe so, though I read somewhere that before that happens, the sun will have expanded so much that it will engulf the earth.  This just shows how slowly this decrease rotational speed is!
Comment: And someday the earth will stop spinning?
Comment: @Forgiver It won't ever *stop* spinning.  If the Sun didn't turn into a red giant the Earth would eventually end up tidally locked to the moon.  But as Steven pointed out the sun will eat the Earth/Moon system before that happens.
Comment: "And someday the earth will stop spinning?" Yes, but only relative to the Moon (in case of lunar tides). Moon has already stopped spinning relative to Earth.
Comment: The earth will not stop spinning since the moon will always orbit the earth (unless the sun engulfs the earth). As the earth's rotation slows down, the moon's period will decrease. Actually, 3 billion years ago, soon after the moon was formed, it is believed the earth's rotation was about 5 hours.
Answer: Spinning at a constant rate does not require any outside force or torque, due to conservation of angular momentum.
Comment: But is there a friction force to decelerate the earth rotation?
Comment: @Forgiver: no, there isn't.
Answer: This isn't really an answer, but it's related and it got a bit long to put in as a comment.
Steven Harris has mentioned that the Moon is gradually slowing the Earth. The obvious evidence for this type of change is that the earth has slowed the Moon's rotation until it matches the Moon's orbital frequency - so the moon always keeps the same face towards the Earth. However the earth produces bigger tidal forces on the Moon that the Moon does on Earth, so the Moon is affecting the earth's rotation far more slowly.
According to Wikipedia the Earth's rotation is slowing at about 1.7ms per century. A quick bit of arithmetic shows that if this rate stayed constant (and it probably slows over time) it would take about 5 billion years to bring the Earth to a standstill. Hence the comment that well before this happened the Earth would have been fried by the Sun's red giant phase.

What makes the Earth keep spinning?


Photoshop - Can't fill in pixels with pencil tool

Question: I'm using the pencil tool with a 1 px brush. I'm trying to fill in some pixels, but in the pictures below there are certain pixels I cannot fill in. If I use the pencil tool on them, nothing happens. I thought the pencil tool was to get precision. Why can't I fill in the pixels in the picture below? Also, the pencil tool when it does work, most of the time never places in the pixel in the right spot. If my mouse is hovering over the pixel that I want to fill, and left-click to apply, the pixel below or diagonal to the cursor is filled in! What is up with that?
Comment: Any chance you have a hidden selection? This would allow you paint in one area, and not in another.
Comment: I see you have two layers there. You sure you're working on the correct layer?
Comment: Hidden selection would be my guess too.
Comment: hit f5 and open your brushes panel and check your brush's spacing. If it's not the problem try selecting a square brush and try again
Answer: I solved this by turning off "Snap" under "View". I think it is trying to snap to a guideline or grid mark and failing.
Answer: I had luck with turning off the grid. It seemed like the pixels weren't lining up with the grid and photoshop was having a problem lining them up. That solved the problem for me
Answer: set the hardness to 100% idk if it is but that is what i think its about
Comment: Ahem, please? Please explain in good language what you mean.  As it stands this is more a comment than a valid answer ... Nevertheless welcome!


Help touching up my design

Question:
I'm trying to fix the inner and outer edges to this outline to make it look cleaner. What tools could I use to do this? I've tried using the brush and eraser tools and just haven't been content with what I'm able to do. Any tips would be greatly appreciated!
Answer: The pen tool will give you the best results.
Draw a line with it, fill the path area and then apply a stroke.
Answer: Alternatively, you could just use the Magic Wand tool to select the inner white space (or outer then invert your selection 'select>inverse') and right click the selection to 'layer via cut' the shape onto a new layer. Then add a stroke (layer>layer style>stroke) to the element.
If your image has some unseen color anomalies and you're getting weird selections try fiddling with the Magic Wand tolerance.

Help touching up my design


Build numbers in sync across many tools or not?

Question: We currently have many office products and a embedded product. They all have the same version scheme major.minor.build number.svn revision. With nightly and manual builds incrementing the build number.
From a development support front this makes it really easy to manage 'correct version', but the in-field support guys panic when one tool changes from v10 to v200 and we say there's no changes.
Are there any problems with this scheme (all in sync) that we are missing due to our love for it?
Update:
It's the build number that is increasing by leaps, the major minor are only changed on a yearly type scale.
the svn revision is the same for all files at time x, but the nobody really pays that attention.
All .exe's and .dll's etc have the same X.Y.W.Z number. So the office product go from 22.214.171.1244 to 188.8.131.5221 when we do lots of work on the embedded product.
Answer: I wouldn't really say this is an issue as long as they can easily look up the change log to see whats changed.
Logically thinking though, if no libraries have been updated in any of the products, nor have there been any changes to the product itself the version number should stay the same.
The only suggestion I could make is moving to a dated version number so that the major and minor versions don't change so rapidly. Something like 9.0417.yyyy.xxxx would be the 17th of April 2009 release with the build number of yyyy and xxxx as the svn revision. If you don't want to change the major number and want to keep the date in the minor you could use Microsoft's versioning style. There's a good blog article on how Microsoft do their versioning at http://blogs.msdn.com/jensenh/archive/2005/11/11/491779.aspx.
Answer: I've used an aggregate versioning scheme.  So you say you have many products that each share the same revision number if the deployed field versions - I'm assuming this means if you update your embedded libraries, that the office products do not use the libraries for, the office products still get a new revision number, even though no code has changed in them.
So in an aggregate scheme, the SYSTEM has one big version number, and each sub system has their own.  I'm using clearcase notation because I don't know the terminology for the equivelant in svn:  The top level component has all sub components under it in a hiearchy (think of a component is like a folder with code in it such that everything in that folder shared the same version, or "baseline", as clearcase calls it).
If I make a new baseline (version) in a top level system component, it tags it with the new version, and all sub components get a new version also (possibly with a different versioning scheme), but only if they've changed.
We use a date-time baseline, and a "release number", for the top level system version.  Then, each sub system has the major/minor/build/svn in it.  Also, we don't show the svn and build number in the "about->help" or equivelant, only if you go deep into some "system config" file can you pull out the actual build/svn number (like, by looking at the meta data in the executble).  That way, users only see major/minor version, and not the gobbledigook of build and svn numbers.


Insert a datatable directly under my chart in Google Spreadsheets

Question: How do I create a data table directly under my chart on Google spreadsheets? I want to achieve something similar to the figure below. In MS Excel it is called datatable and it is inserted by a click of a button.
Answer: As far as I know, at this time charts in Google Sheets don't include a datatable option.
References
Create a chart or graph - Docs Editors Help
Editing and formatting your chart - Docs Editors Help


Set up read-only privileges on the dbo schema, but allow creation of entities in another schema?

Question: Is it possible to create a custom schema in a database such that users that have read-only access in that database for the dbo schema can be set up with the ability to create and modify entities for the custom schema?
Comment: I think I've figured out how to make a User the owner of a Schema and then grant them the appropriate permissions to create entities but I'm still lacking a conceptual understanding of the fundamentals. For example, what if I wanted to provide multiple Users the ability to create entities in the same specific schema. Can I make multiple Users the owner or is the proper way to do this is via a Windows Group Login or is there a better SQL equivalent to accomplish this?
Answer: You shouldn't think about permissions in the sense that you have to own something to make changes to it. All you need to create an object in a schema is the ability to create an object in the database, and authorization on the schema (there are other ways but they are less secure). You also should think about applying the same permissions to n number of users via a role as opposed to applying those permissions individually to each user.
Here's a working example that demonstrates the syntax required for all of the things you want to do, I believe.
First, create logins from Windows, if they don't already exist:
USE [master];
GO
CREATE LOGIN [Domain\Username1] FROM WINDOWS;
CREATE LOGIN [Domain\Username2] FROM WINDOWS;

Add those users to the database (create this database as a test, perhaps):
USE a_database;
GO
CREATE USER [Domain\Username1] FROM LOGIN [Domain\Username1];
CREATE USER [Domain\Username2] FROM LOGIN [Domain\Username2];

Create a schema for them:
CREATE SCHEMA Pyramid;

Create a role, so that you don't have to maintain these permissions on every individual user, and add both users to that role:
CREATE ROLE PyramidRole;
GO
-- on modern versions:
ALTER ROLE PyramidRole ADD MEMBER [Domain\Username1];
ALTER ROLE PyramidRole ADD MEMBER [Domain\Username2];
-- on dinosaurs:
EXEC sys.sp_addrolemember @rolename = N'PyramidRole', @membername = N'[Domain\Username1]';
EXEC sys.sp_addrolemember @rolename = N'PyramidRole', @membername = N'[Domain\Username2]';

Set the permissions on the role:
-- need specific create / alter permissions:
GRANT CREATE TABLE, CREATE VIEW, CREATE FUNCTION, CREATE PROCEDURE
  TO PyramidRole;

-- to be explicit, you want them to /read/ from dbo, so:
GRANT SELECT, VIEW DEFINITION ON SCHEMA::dbo TO PyramidRole;

-- finally, this will allow them to create/alter objects in their schema:
ALTER AUTHORIZATION ON SCHEMA::Pyramid TO PyramidRole;
-- you may need other permissions depending on what else you need them to do

Now, try it out:
EXECUTE AS USER = N'[Domain\Username1]';
GO
CREATE TABLE dbo.what(id int);     -- Fails with Msg 2760
GO
CREATE TABLE Pyramid.what(id int); -- Succeeds
GO
REVERT;

Now, as you add more users and you want them to inherit this same set of permissions, you just add them to the database, and then add them to the role using ALTER ROLE ... ADD MEMBER ....
More info and more syntax examples:

Roles / ALTER ROLE
Schemas
Permissions
GRANT Database Permissions
DENY Database Permissions
EXECUTE AS
Comment: And yeah, sorry, it was written for supported versions of SQL Server, I didn't notice your dinosaur tag. :-)
Comment: Thanks Aaron, top notch as per usual. One question though, since to accomplish what I'm trying to do requires the role to have the ALTER privilege at the database level, does that mean when a new schema is created in that database, the role will automatically have the ALTER privilege on that new schema?
Comment: Also, anyone like me who is still riding the dinosaur of SQL Server 2008 R2 (or older), ALTER ROLE RoleName ADD MEMBER [Domain\Username] doesn't work (throws a syntax error) and instead you need to use: EXECUTE sp_addrolemember RoleName, 'Domain\Username'; -- This procedure could be deprecated in future versions of SQL


Cloning Hard Drives - Remotely

Question: I have two servers, A and B.
I would like to clone server A to B. A is running Linux, and they are both remote, I don't have a physical access to them
What is the best way to approach this?
Comment: What OS B computer is running?
Answer: Cloning remote Linux machines
The bash script backup-images-1.0.sh automates the process of cloning disks of remote Linux machines. It uses the dd command together with ssh and gzip commands to copy and compress remote disks and send them on the fly to a local disk over an SSH connection.
Examples of cloning a remote disk to a local disk using backup-images-1.0.sh written by Radovan Brezula, who wrote backup-images-1.0.sh.

http://brezular.com/2015/06/04/cloning-remote-linux-machines/

Example of cloning a local disk to a remote disk using dd
dd if=/path/to/disk/image ibs=4096 conv=notrunc,noerror | (ssh 188.8.131.52 dd of=/remote-archive/test/remote-archive-test.img obs=4096)

ibs=4096 read up to 4096 bytes at a time

conv=notrunc,noerror do not truncate the output file and continue after read errors

obs=4096 write 4096 bytes at a time
Answer: There are al least three different ways to do this.
1 scripted setups.
This option is mostly useful in large corporations with proper documentation and likely expands into setups with PXE booting and puppet or similar setups.
Basically you repeat the same steps which you used to configure server A on server B.
This works very well if your setup is big enough (e.g. you are running 100 servers and want to spin up server 101. PXE boot, tell your puppet config that it needs to be a server of $type and come back an hour later. Done!).
A lot of work to set up, but perfect afterwards. And with all the setup work probably not worth it for copying a setup once.
2 filesystem copy.
You can copy all files from server A to server B, preserving their rights and users. rsync is probably the best tool for this.
For this you want to prepare the target server with a similar setup (e.g. copy the partition setup) and then rsync most files over. The tricky part here is that you do not want to rsync some files (e.g. skip /proc and /dev) and that you need to have something to receive the rsync files on server B.
For the last you probably want to boot server B from a different disk, or use the ILO/DRAC/.. to boot from an liveCD iso image on your desktop, leaving its disk bare and ready to receive the rsync files.
3 Copy disk.
This is diffent from copying the filesystem. It is much easier and probably a lot faster, but raw disk access (e.g. with dd) ignores all filesystem changes.  This means that you really do not want to copy a running filesystem.
To help you understand this easier, imaging a book. This book has an index and four stories. The rest of the book is blank and this is also nicely indicated in the books index.
Now we start copying. We copy the index. We copy story 1, we copy...
** hold briefly, let me add a new story here and change the index**
We copy stopry 2, 3, 4 and 5...
We now have aq book with an index showing four stories (not five, since we copied that before writing story 5, and five stories)... a corrupt book.
Something similar can (and will) happen if you use raw disk access to copy a running system. So before using a raw disk copy make sure that the OS is off-line.  Either boot something different (e.g. from a second disk, from a local CD, or via the network (PXE, DRAC, ...) and then copy.
Details on how to do this are already in plenty posts here on [su].
Answer: I believe rsync is the solution here. I am not sure whether all files will be writable during an rsync session, though...
Have you concidered making a dd clone of the partitions on server A and transferring it to server B? It sounds a bit wild, but perhaps as a last resort?
Answer: For disk imaging, I like clonezilla, but you need physical access to boot from the disk to make it work.  Honestly, I don't think you can do a completely lights-out remote full-system copy.  rsync will only get you so far.  If both have full systems already installed, and they are otherwise identical, then you can get the same apps installed on host B as are on host A.  Then it's just a matter of copying the necessary config files from A to B.  You don't necessarily need to copy everything.

Cloning Hard Drives - Remotely


What would the 3D graph of GCD(x, y) and LCM(x, y) look like?

Question: To find the answer out, I was going to use a graphing calculator but I couldn't find any one that supports the two operations. I would try to draw by hand but since it'll a 3D graph, I would have to use domain coloring and that would be a lot of work and hard to interpret. So, I ask: What does the graph look like for each function, and does it have an extension like factorials where it extends to real and rational numbers too having it as a codomain (such as if $1.5!$ has a real result, does $\gcd(1.5, 1.2)$ have one too)?
Answer: The gcd(x,y) is only really defined for x & y in the natural numbers (or for intigers if you allow negatives and 0 but nothing really changes to allow those).
The first fact to consider if you were looking to extend how you allow the gcd to work would be to make the requirement for
gcd(x,y)lcm(x,y)=xy
If we let x=a/b and y=c/d where a, b, c & d are all intigers (thus the fraction of x & y) then we could define
gcd(a/b,c/d) = gcd(alcm(b,d)/b, clcm(b,d)/d)/lcm(b,d)
Through this idea we can do
gcd(1.5,1.2)=gcd(3/2,6/5)=gcd(3*lcm(2,5)/2,6*lcm(2,5)/5)/lcm(2,5)=gcd(3*10/2,6*10/5)/10=gcd(15,12)/10=3/10
The idea of gcd(1.5,1.2)=0.3 does look like it would make nice intuitive sense.
Edit: By looking at lcm(b,d) =bd/gcd(b,d) the odd formula seems to nicely fall down to just...
gcd(a/b, c/d) = gcd(ad, cb)/(bd)
Comment: This solution would have extreme obscillations as you can easily find rationals with similar values but no or many common factors. Anyway I can't see why this solution deserved a downvote.


Why the temperature of gas produced by firework falls rapidly?

Question: When a firework explodes, the powder in the firework burns rapidly to produce a small volume of gas at high temperature and pressure. Can anyone explain to me why the temperature of the gas falls rapidly? Thank you :)
Comment: You want to know why something hot embedded in something cold cools down? I don't understand what kind of answer you are seeking here, firstly it is an experimental fact, secondly one can model this behavior using thermodynamics/statistical mechanics.
Answer: The energetic (i.e. hot) gas particles quickly diffuse to the surrounding environment. Because the number of particles in the air greatly outnumbers that of the gas from the fireworks, the two systems quickly reach thermal equilibrium.
Answer: I dont know much about this topic but in a laymen way what i know is that because all the heat energy is lost in expanding the gas the same reason why it feels cold when you spray a deodorant on you.
It will not be totally accurate but here it is,
When you light the firecracker its chemical burns and produces heat and gas which is used to raise the pressure and temp inside the casing of the firecracker. But when the pressure exceeds the strength of the casing and the case blows(which what it was intended to do) due to the pressure inside it the gas expands really fast and all the energy is used in doing this so the gas cools down


Minor as a mohel

Question: According to Halacha, is it permissible for a minor (under bar mitzvah) to serve as a mohel and do Brit Milah? What about B'dieved? The reason I ask is because some Poskim hold a woman can serve as Mohel despite not being obligated in circumcision, and also being circumcised after 8 days is an obligation for minors.
Answer: H Milah 2:1:

הכול, כשרים למול:  ואפילו הערל ועבד וקטן ואישה מולין, במקום שאין שם
איש.  אבל גוי, לא ימול כלל; ואם מל, אינו צריך לחזור ולמולו שנייה.
Circumcision may be performed by anyone. Even a person who is himself
not circumcised, a slave, a woman, or a minor may perform the
circumcision, if an adult male is not present. A gentile, however,
should not be allowed to perform the circumcision at all.
Nevertheless, if he does so, there is no need for a second
circumcision.

Minor as a mohel


Redux action doubles "on" socket events

Question: I have application written in Reactjs and Redux. With axios its is working good, but I would like to use socket.io, so in redux action in try:
export const getOne = (id) => async dispatch => {
  socket.emit('getOne', id);

  console.log('test');

  socket.on('get', function(msg) {
    console.log(msg);
    dispatch({ type: GET, payload: msg });
  });
};

If I call this action first time everything is working good - socket is emitted, on function return me correct msg and console.log return "test", but if I call this function again, then console.log is called one (this is ok), but unfortunately the "socket.on" is called two times. Next if I click, then the "socket.on" function is called three times etc...
When I should put my function socket.on('get', function(msg)? Or what can I do it with this issue?
Comment: only bind it once.
Comment: How can I bind this?
Answer: You need move "socket.on"  to out of function. Each call of this function, it bind again and again:
     socket.on('get', function(msg) {
        console.log(msg);
        dispatch({ type: GET, payload: msg });
     });

    export const getOne = (id) => async dispatch => {
      socket.emit('getOne', id);
      console.log('test');
    };

Redux action doubles "on" socket events


Positive and negative powers of small parameter in perturbation problem

Question: I'd like to perturbatively handle an eigenvalue problem similar to this:
$$
\lambda f = (\hat{H} + (1/\epsilon^2) \hat{V} + \epsilon {W}) f,
$$
where $f$ is a function, $\lambda$ is an eigenvalue, $\epsilon$ is a small parameter, and the rest are linear operators. The problem is, that if one writes a series for the eigenvalue and the eigenfunction,
$$
f = f_0 + \epsilon f_1 + \epsilon^2 f_2 + ...\\
\lambda = \lambda_0 + \epsilon \lambda_1 + \epsilon^2 \lambda_2 + ...,
$$
one will get e.g.
$$
\lambda_0 f_0 = \hat{H} f_0 + \hat{V} f_2\\
\lambda_1 f_0 + \lambda_0 f_1 = \hat{H} f_1 + \hat{W} f_0 + \hat{V} f_3\\
...
$$
i.e. the different orders of the series start to mix. Is there a way to develop a systematic perturbation theory for this case?
Answer: A perturbation approach requires the additional perturbing Hamiltonian to be a weak disturbance to the unperturbed system. However in your statement you have the small parameter $\epsilon$ at the denominator. It is an inconsistency, that is the smaller the parameter the higher the disturbance! The system posted in the question is unstable.


Text Cleaning Tool

Question: The online text tools on this page does almost everything one may need to "clean" the text in various ways. But often I need to perform multiple of those cleanings (for example replace smart quotes with regular quotes, or vice versa, remove line breaks, remove extra white space, change case, etc.). Is there a Windows application to do multiple cleanings all at once? (With a single click, preferably with options.) Or a similar online tool?
Comment: could you please elaborate on what functionality you are looking for exactly? for general text editing notepad++ might suffice
Answer: textcleaner.net
You would paste in your text in the box at the top and after choosing your options you can press clean and everything will be applied to the text in the box.
It also offers find and replace functionality.
Sadly I am not aware of a simple way to save your settings

Text Cleaning Tool


Type of resistors

Question: What is the difference between 220 ohm resistor-1/4 Watt and 1/2 Watt?
Which is suitable to be connected to a LED of FV 1.8V and current 15mA ?
Supply voltage is 5V.
Answer: 1/4 W and 1/2 W are the absolute maximum power ratings.  If the resistor is forced to dissipate more than that it will burn.
The forward voltage of the LED is irrelevant for the resistor.  But you really need to know the supply voltage you've intended to use.

simulate this circuit – Schematic created using CircuitLab
As you see, Vf is irrelevant for the resistor.  You need to consider the current and the voltage drop of the resistor.
A 1/4 W rating should be enough to power a LED, if it's not, you're doing something wrong.   Do the maths.
Answer: As others have said, the power rating is how much power the ressitor can dissipate. There are a few catches tho:
Temprature Coefficient: As a resistor (or any component) gets hot, it's behaviour changes slightly. Semiconductors become more conductive at higher temperatures, metals become less conductive. How much they change is given in a temperature coefficient - how much change per unit temperature. This means that some resistor might be rated to a very high power, but it gets very hot when it dissipates that power. This can be a cause of error in a circuit.
In addition, there is the temperature they are specified at.
Some power resistors, such as metal film or metal wire wound resistors on a ceramic substrate are rated to temperatures as high as a few hundred degrees Celsius. Others, such as carbon film in epoxy, might not tolerate much past 100 degrees Celsius.
Why does this matter?
If you are planning on operating a resistor that is rated to 300 degrees Celsius, you need to make sure that all surrounding circuits can also take this. Electrolytic capacitors will dry out, polyester capacitors might fail short as their film melts, transistors could fail, etc. In fact, this resistor could start desoldering itself because it gets so warm!
Moral of the story: there is more to that power rating than you might think.
Answer: Power rating of a resistor indicates the maximum power which it can dissipate before burning off. The difference between a quarter watt resistor and a half watt resistor is the amount of power (V*I or I^2*R ) they can dissipate, half watt will allow more current to than a quarter watt resistor when applying the same voltage.
So for your application, calculate the power consumption of your LED and select the appropriate resistor. Power_dc = voltage * Current (watts)
Answer: Along with all the nice explanations, there is the size factor which is often overlooked by designers. In having 2 options to chose, each one varying in size but both rated to the same power, in general they would prefer the one with the smaller size. However, the smaller body means the same amount of heat accross a smaller surface, which means a higher temperature. In shorts, if you whant to preserve the surrounding devices of the board, whenever possible, select the one with the biggest size.
Answer: When the LED is on, the voltage across the resistor will be VCC - Vf. In this case, that is 5 - 1.8 = 3.2V.
For a 220 Ohm resistor, the current will be 3.2V / 220 Ohms = 14.5 mA. So that is good. I wanted to double-check what you said about the current. That is why I asked for the supply voltage.
The power dissipated by a resistor can be calculated two different ways. The first way uses resistor voltage:
P=V^2/R
We get 3.2 * 3.2 / 220 = 0.046 W, aka 46 mW.
The second way is to use the current through the resistor.
P = I^2 * R
For this method we get 0.0145 * 0.0145 * 220 = 46 mW
So we get the same answer either way. Your resistor will only be dissipating 46 mW, which is 0.046W, which is much less than 1/4 Watt. So, you can just use the 1/4 W resistor.
Answer: Whenever current flows through the resistor there is a voltage drop across it and some amount of power is dissipated across a resistor in form of heat.
Depending on the size and design of the resistor there is a limit to the maximum power that it can dissipate without getting permanently damaged.
Assuming you are using 5V supply, the resistor will dissipate (5-1.8) * 15m = 48mW. Which is well within the range of 1/4 W (250mW).
Comment: There's no need to assume the supply voltage.  **R**, **Vf** and **I** are all known.
Comment: what do you think about Vs?
Comment: 1.8 V + 220 ohm * 15 mA = 5.1 V.  Had you assumed 3.3 V, things would not compute.
Comment: Supply voltage is 5V

Type of resistors


Why does YouTube not cache videos anymore?

Question: A while ago youtube changed its cache system. Now when you watch a video, if you click backward on timeline, the video will be downloaded again, and youtube does not read it from cache.
It is very slow on low band-width connection. I want to know why youtube decide to do that? It's obviously the opposite of UX.
Comment: Do you have any evidence that YouTube have done this(Such as a blog post from them). It might just be happening for you only.
Answer: Often the most common reasons for video re-loading when you move timeline are:

Youtube dynamically changes the quality of video during playback.  Even though that transition may appear seamless to you, this interrupts your local caching because it's a different bitrate and resolution video.  And this may happen multiple time over the course of playback, each time interrupting your local cache.

So for example, a video may start playing at 360P, but when the system detects that your bandwidth can handle additional 720p, it will transition over to 720p.  When that happens, it has to write a new cache file, because you cannot have a video file with two different resolutions.
So when you try to go back to time period before the resolution-transition took place, your existing local cache gets wiped, and new cache starts.
Another common reason is, people often fast-forward when they watch videos, which also interrupts local caching.  Let's say you are 5 minutes into a video, but you've skipped the first 30 seconds.  At this point, Youtube has cached 0:30 - 5:00, so you are free to drag your timeline within that spot.  But if you go to 0:00 - 0:30, your player has to download that stream, and 0:30 - 5:00 cache will be lost.
With that said, you can avoid the cache interruption problem by doing the followings:
As soon as video begins, change the Video quality setting to your desired resolution (360p, 480p, 720p, etc.) and turn off the Auto.  And don't fast-forward.
By taking these steps, you'll ensure that the video is cached locally in its entirety, and you'll be able to move back and forth within the timeline without reloading.
Comment: @Kalmi, personally I prefer not to be logged into accounts just for youtube or googling, but I suppose giving more control to account-holders makes sense for customer retention.
Comment: "As soon as video begins, change the Video quality setting to your desired resolution" - THANK YOU! I've been battling with YouTube slowness for ages, with buffer disappearing when I skip forward, all because it was on "auto". Setting it manually speeds *everything* up. Why don't they remember people's preference in a cookie?
Comment: @ingredient_15939, You can select " I have a slow connection. Never play higher-quality video" here:
https://www.youtube.com/account_playback
Answer: Your question is wrong. Youtube DOES cache videos.

Play a video, let it end.
Disconnect your internet.
Hit the reload button or drag the pointer to start of the timeline.
The video would still play despite no internet, therefore cached.

So, you are wrong in asking the question. Secondly, they have messed up the buffer system, not the cache system of Youtube. If you pause a video on a slow connection, allowing it to buffer before you watch it, that doesn't happen i.e. the buffer also stops on pausing the video. There have also been reports of you can reload the video from start i.e. get the cached copy but as soon as you hit it somewhere from the middle of the timeline (skip to some part), that loses the whole buffer uptil then and/or the cached video.
However, there have been some proposed workarounds like clearing your cookies to reset the buffer mechanism and I have tried them, and they do work - however not a good option.
So yes, the cache is still pretty much there the buffer is not.
And I believe the new Youtube is a reason for that. If you use an old YOutube extension of Chrome which still offers the same old Youtube interface, you wouldn't face any such problem which indicates that they haven't changed the functionality at a server level. Its most likely the case of front/user-end youtube that we see; the new implementation is messing up the buffer bar!
Hope that clears it up.
P.S: messy buffer also equals bad UX.


How do I catch Charizard, Bulbasaur, Squirtle and Pikachu on Pokemon Platinum?

Question: The question is pretty self-explaining. Is there a way to catch these Pokemon on Platinum? On a low level preferably in order to train them with good stats.
Answer: Charmander, Bulbasaur, and Squirtle cannot be caught in Pokémon Platinum, likewise for all of their evolution chain. They can only be obtained by trading from a different game. You can either get them through FireRed/LeafGreen via Pal Park (a place to trade Pokémon from the 3rd generation), or you can obtain them in HeartGold/SoulSilver and trade them over.
Pikachu can be found at Trophy Garden, which is the grass behind the Pokémon Mansion south of Hearthome. They should be available at all times, if my memory serves correctly. I believe they're no higher than 20, which is plenty sufficient to get all the EVs you need.

A note, however, is that you don't need to worry a lot about levels on non-legendary Pokémon that you catch. Any breed-capable Pokémon can be hatched from an egg, which results in a new one starting at level 1. This is also advantageous as you can use breeding to get a better moveset than naturally possible. So even if circumstances result that you can only trade a fully levelled one of any of these 4 Pokémon, you can always breed it to get a low level one ripe for your own training needs.
Comment: In Diamond/Pearl/Platinum and onward, eggs hatch at level 1.
Comment: @Jonathan Thanks for that. I have incorporated that into an edit.
Answer: The three starters aren't available in Platinum, although you can get one in HeartGold/SoulSilver from Professor Oak after defeating Red.
Pikachu can be found in the Trophy Garden behind Mr. Backlot's mansion.
You can get the three starters in Platinum using Wi-Fi trade, providing you've seen them in-game. I don't know if any trainer in Platinum has Bulbasaur, Charmander or Squirtle. There are trainers with these Pokemon in HeartGold and SoulSilver.
Comment: Yes you can definitely see them (or their evolutions) in-game, because that's exactly how I got them.
Answer: Unfortunately, you cannot get them unless, like said before, you must trade them from another pokemon game.I'm pretty sure the games you need are heartgold and soul silver. And I know I'm late to answer this but I don't care I hope that you did figure this out and by now you probably already got them so, good for you!


Loop through fields in field layout when `entry` is not set

Question: Is there a way in a template to loop through the fields in a field layout without having to tie them to an entry? I'm currently grabbing that list with entry.getFieldLayout(3).getFields(), but that only works when entry is set.
Answer: This can be done by reaching through the section and entry type to the final field layout. Like this:
{% set section = craft.sections.getSectionByHandle('sectionName') %}
{% set entryType = '' %}
{% for type in section.getEntryTypes %}
    {% if type.handle == 'entryType' %}
        {% set entryType = type %}
    {% endif %}
{% endfor %}
{% set fieldLayout = craft.fields.getLayoutById(entryType.fieldLayoutId) %}

You should be abel to use getFields as normal.
Comment: Worked like a charm! Thanks. I'm glad I asked. It would have taken me forever (or possibly never) to figure that out on my own.


How to pick resistor values for voltage range with potentiometer

Question: How do I pick resistors for a 12v-30v boost circuit using an SDB628 IC; Vout= 0.6(1+R1/R2). I am using a 50k pot for R1. How do I get that 12v-30v output voltage range? To get 30V, my calculation of R2 is 1K; to get 12v, R1 has to be 19K, but since this pot can go down to 18K ohm, even 0 ohm, so many precision range of the pot is wasted. Then let me assume that the 50K pot is at its 0 ohm position, then I need to add another resistor to get 12V. My calculation is 19K for R0 to get 12V. (R0+R1)-(R2); but the problem is when the position of the pot went up to 50K, Vout will be much higher than 30V. doesn't work either way.
Comment: You can put a resistor in parallel with the pot, the pot will dominate at lower settings and the second resistor will dominate at higher settings. E.g. a 33K in parallel with the 50K pot would give a max effective resistance of just under 20K at one end and whatever the pot's minimum is at the other end of the pot's range. Then add that series resistor to limit the lowest resistance. Two resistors and one pot overall now make up R1. (Rseries + Rpot//Rparallel)
Answer: As your post is not very clear, I will assume what you want to do is to control the output voltage of your IC with a Potentiometer. So, I would suggest you to use a circuit like this one:

simulate this circuit – Schematic created using CircuitLab
To calculate the values for the resistor, just replace R1 in your formula with R11 + Pot. Consider the voltage to be maximum (30V) when Pot value is 50k, whereas the voltage is minimum (12V) when Pot is 0. This will give you the following equations to solve:

0.6 x (1 + R11 / R2) = 12V
0.6 x (1 + (R11 + Pot) / R2) = 30V

However, the values you will obtain are not standard. Here are some ideas to get more practical values, so the actual resistors will be easier to find:

Use several resistors in series or in parallel to do the job. Ex: for R2, 3 5k resistors in parallel will give the value
Change the potentiometer: a 150k potentiometer will give you 5k for R2 (easy to find) and 95k for R11 (more difficult, but can probably be done using 2 resistors in series)
Replace R2 by a resistor (R21) and the Potentiometer. I didn't do the calculation, so I don't know if it would be easier or not.
Put the resistors in parallel instead of in series, as suggested by Tom in the comments
Comment: The maths used are the 2 equations detailed at the beginning of the answer. it comes from the equation you provided - "Vout= 0.6(1+R1/R2)", where R1 is replaced by a resistor and a potentiometer in series. Then, you just consider the potentiometer is minimum (0 Ohm) for the lowest voltage (12V), and maximum (50 kOhm) for the highest voltage (30V). Then, it is just a system of 2 equations with 2 unknown to solve.
Comment: If you want to know where the equation comes from: a regulator will adjust its output voltage (Vout) in order to have a fixed voltage in its feedback pin (Vf). In your case, the feedback should be 0.6V. This is where this value in the equation comes from. Then, you calculate Vf from Vout using the formula of the voltage divider, and you invert it, in order to have Vout from Vf: Vf = (R2 / (R1 + R2)) x Vout  ==>  Vout = Vf x (1 + R1/R2)
Comment: For the resistors, maybe you will find these particular values from your "preferred distributor", but they are not standard. I would definitely suggest you to use a 150kOhm potentiometer (standard), R2=5kOhm (standard) and R11=92kOhm (not standard, but you can easily do it with 2 standard resistors in series, such as 82k and 10k for example)
Comment: That is exactly what my question is. I checked the values, and they are all correct, but how do you get 31k and 1.7k? what math or equation did you use to solve it>?


How to protect streaming using Wowza application?

Question: I want to stream video only when Wowza allows it. How can I configure this in the Wowza application? Without Wowza's permission to stream the video, the publishing stream should be disabled.
Answer: There is a module called Wowza Wrench here which can give you simple authentication and authorization solution for your streaming app.
Answer: First, see the Wowza quick start guide here : https://www.wowza.com/docs/quick-start-guides .  If you want to control when and if clients connect successfully, using, for example, your own authentication scheme, you will want to download the Wowza IDE, create a module, and provide the following method:
public void onConnect(IClient client, RequestFunction function, AMFDataList params) {

If you're also using http streaming to iOS clients, also use:
public void onHTTPSessionCreate(IHTTPStreamerSession session) {

Or, of course, you could just stop sending the stream to Wowza.
Comment: how do i call this from android mediaplayer?
Comment: If your module is configured correctly, Wowza will call this every time a client connects, whether it be HLS or Flash.
Answer: You can try an approach used in this open source package: http://wmsauth.org/ . It's for Windows Media Server but this principle may be used for Wowza as well. The main idea is to modify the link to the media source and thus control the output on a server side.
WMSAuth for Wowza is also planned to be launched as part of https://wmspanel.com/ by the beginning of May. Streams protection will be controlled via the centralized web interface.


Recognize numbers in images

Question: I've been searching for resources for number recognition in images on the web. I found many links providing lots of resources on that topic. But unfortunately it's more confusing than helping, I don't know where to start.
I've got an image with 5 numbers in it, non-disturbed (no captcha or something like this). The numbers are black on a white background, written in a standard font.
My first step was to separate the numbers. The algorithm I currently use is quite simple, it just checks if a column is entirely white and thus a space. Then it trims each character, so that there is no white border around it. This works quite well.
But now I'm stuck with the actual recognition of the number. I don't know what's the best way of guessing the correct one. I don't think directly comparing to the font is a good idea, because if the numbers only differ a little, it will no more work.
Could anyone give me a hint on how this is done?
It doesn't matter to the question, but I'll be implementing this in C# or Java. I found some libraries which would do the job, but I'd like to implement it myself, to learn something.
Answer: Why not look at using an open source OCR engine such as Tesseract?
http://code.google.com/p/tesseract-ocr/
C# Wrapper for Tesseract
http://www.pixel-technology.com/freeware/tessnet2/
Java Wrapper for Tesseract
http://sourceforge.net/projects/tessocrinjava/
While you might not consider using a third-party library as implementing it yourself, there's a tremendous amount of work that goes into just integrating the third-party tool.  Keep in mind also that something that may seem simple (recognizing the number 5 versus the number 6) is often very complex; we're talking thousands and thousands of lines of code complex.   In the least, look at the source code for tesseract and it'll give you a good reason to want to leverage a third-party library.
Here's another SO question that'll give you some ideas about the algorithms involved: https://stackoverflow.com/questions/850717/what-are-some-popular-ocr-algorithms
Comment: +1 Tesseract is awesome.  You can use any language you want as long as you call it on the command line.
Comment: You can use it as a DLL as well with not much effort so no command line necessary.  It comes with this out of the box as they say in their release notes.  http://code.google.com/p/tesseract-ocr/wiki/ReleaseNotes
Comment: Thanks for the tip. Actually I'm not that good in C/C++ and there's a lot of code. I'm still hoping not having to try to understand a whole OCR software project, just for learning number recognition.
Comment: This will remove the need for you to use C++ ... the C# wrapper is pretty straight-forward.  Unless you want to become an expert in machine learning and image optimization you really don't want to try to roll your own OCR solution.

Recognize numbers in images


Strange crashes on Zenbook UX31A with Ubuntu 13.10

Question: I'm facing some strange crashes. I initially installed 13.04 on my Asus Zenbook UX31A and used Cinnamon as my preferred desktop environment. After upgrading to final version 13.10 I'm not able to start any desktop environment correctly from LightDM.
First I thought this is due to a kernel bug as mentioned in many bug reports, forums, blogs and so on. But choosing other kernels (3.8, 3.10) in grub didn't solve my problem.
Trying to boot up with Unity: After some seconds and a black screen I just get back to LightDM. Trying to boot up with Gnome Flashback: Icons are visible (with default theme) on a black background desktop without panel and window manager (no window borders). Same with Cinnamon (which is a fork of Gnome Shell).
I looked into syslog, dmesg, Xorg.0.log but can't find any helpful information.
Answer: As no one can provide a solution and I need to work with my computer I did a fresh install. 13.10 + Cinnamon 2 works just fine here. I guess something went wrong with the packages.


Which curve does the interest rate risk fall in?

Question: For example, Australian government issues a bond denominated in USD currency? Which curve does the interest rate risk fall in? Australian Gov Curve or USD Gov Curve?
Comment: Aus Gov USD Curve. There is a separate Aus Gov AUD curve too (which is usually more liquid that the Aus Gov USD curve).
Comment: what is a Aus Gov USD Curve? u mean Aus Gov USD Basis curve?
Comment: No, I didn't mean the basis curve. Each credit entity can have a curve in different currencies, e.g. Indonesian Govt issues debt in both IDR and USD (both are fairly liquid traded instruments). Consequently, an IDR curve and a USD curve for the Indonesian Govt can be extracted from traded instruments. Each curve stands in its own right.(off course, traders may want to track and analyze the basis between the two curves, but that's another matter). Same for Aus Govt - it has traded debt instruments in both AUD and USD; hence separate curves can be backed out.
Comment: USD curve (with obviously a credit spread to US Govt).. Half of EM is in this position, with local ccy and hard debt issued. Either curve on their debt don't have to look or behave anything like the other one!
Answer: It should be the USD curve because it was issued in USD currency and hence the yields should be benchmarked off the US Treasury curve.
Answer: You definitely don't have any exposure to any AUD curve.
Looking at the risk to the USD-denominated Australian government curve is less than perfect because this curve is the sum of a USD default risk free curve and a credit spread to compensate the bondholders for the possibility that the bonds may default.
For the risk free USD curve, you can use UST, or USD swap curve equally well. It's more convenient to choose the instruments that you would use to hedge your USD IR risk if you're looking to retain the credit spread exposure and not have a view on risk-free interest rates.
With these risk measures, you should be able to explain your PL in terms of the USD rates and the credit spread.


systemctl process restart detail logs

Question: I have some service which is getting restart every 5-10 minutes due to some crash. The effect of this is that it restart's other services which are in "Require" and "After". Is there any way to find complete logs for systemctl.
Comment: You can try `journalctl -u `.
Answer: You can use sudo journalctl _PID=<pid> if you know the PID. This can be useful in cases where the process was too short-lived for systemd to resolve the unit name.
Answer: Full logging generated by systemd is available with:
journalctl

To see the log for a specific system unit, you can use:
journalctl --unit=<unit-name>

For a system unit or:
journalctl --user-unit=<unit-name> for a "user" unit.

There are some cases in which the unit attribution is missing, so it can be good to review the full journal output around the time your service started or stopped to see if there is any additional related logging besides what you see with journalctl --unit=.

systemctl process restart detail logs


Good/functional but can do better

Question: I'm looking for an aphorism communicating the thought that "this works, but we can do better". Some high-falutin language like Shakespeare or Blake would be ideal.
Comment: Who's the "we" in "we can do better"? The same people who made the good-enough thing, or someone else (a competitor)? We need some more guidance on the sort of phrase you want.
Comment: "If it ain't broke, go fix it anyway."
Answer: Not quite Shakespearean, but you could say

Although the <product> is good as it is, there is still room for improvement.
Answer: Normally people would just say either of

Not bad.
Acceptable.
Impressive.
Nice.
OK.
Great.

However, let me recompose some of Yogi Berra's:

Love is the most important thing, but your project/application is pretty good too.
Little league projects are great, because it keeps engineers/programmers like you off the main concourse.
You don't have to swing hard to hit a home run. Your application could just make it, with the right timing.

a'la Edgar Allen Poe:

Once upon a midnight dreary, while I pondered weak and weary. Nice app BTW.
Words have no power to impress the mind without the exquisite horror of their reality after deployment.
Science has not yet taught us if mediocrity is or is not the normality of intelligence.
I have great faith in tools like these. My lack of confidence in them, I call it.
After all most apps, my friend, are simply evolved out of fraud, fear, greed, imagination, and creativity.

a'la Hemmingway:

Never mistake an acceptance as excellence.
You do not have to like it just because it works.
Happiness in intelligent people are the rarest thing I know. You seem pretty happy with your app.
No app named horrid, has ever won the Nobel peace prize. We'll deploy it but expect lots of rotten eggs thrown at it.

Generic religious:

The world was created in six days, so was your app. It's good enough.
From the abundance of your heart, your app manifests.
Answer: If "T'ain't broke don't fix it" be not your cry, go with the best, give it (us?) a try.
Comment: did you create this or is it a quote from someone?
Comment: I've never seen or heard it before so I suppose you could say that I created it. I flatter myself here, I know, but feel free to use it as you wish.
Answer: "To paraphrase Mark Twain, it's just a lightning bug and not lightning."
Answer: Don't rest until you do your best.
Good enough isn't.

Good/functional but can do better


Viewing registers in a crash dump

Question: Is there a way to view the register contents in each stack frame in a crash dump?
The registers window seems to contain the registers when the exception occurred but it would be useful to be able to see their contents in each stack frame.
Answer: Depending on the calling convention, you can get some of the registers which are saved on the stack.  For example, in the cdecl calling convention, all of the registers except for EAX, ECX, and EDX are required to be saved, either by the caller or the callee.  Those three registers are clobberable, so you generally won't be able to get their values from higher up in the call stack.  If a function doesn't use a register that must be saved, then it won't save it, but since it doesn't use it, that register has the same value in the next higher stack frame.
Answer: After doing some research and thinking about this a bit, I realized that it is probably not possible. A crash minidump saves certain areas of process memory (depending on the flags passed to the MiniDumpWriteDump() function) and enough state information to re-create the environment where the crash happened in a debugger. It does not have the processor state at each instruction or even at each stack frame, it only knows about the processor state when the exception occurred.
Answer: In optimized builds, it's true that some information down the stack may get tossed, however, you can ask the debugger to try and show you the information for a given stack frame. First do "kn" to see the stack with frame numbers, then try ".frame /c [frame]" or ".frame /r [frame]".
Check out the help (".hh") for more information.
Answer: I don't think you can get it either when debugging. The only value you can get from registers is their value at the current instruction.

Viewing registers in a crash dump


connect to android devices using wifi direct without prompt

Question: i am trying to connect two android devices using WIFI direct and i was successful. But the problem is the second device has to accept the a connection prompt after the other device initiates the connection. It is undesirable for what i am trying to achieve. I saw a few post here in stack overflow itself saying that currently its not possible. But came across an app called SUPERBEAM which user WIFI direct but without the prompt. A search in google gave me the following link from xda forum which says
<code>SuperBeam creates an access point using Android's WiFi direct API's.
This essentially works like hotspot mode in old devices, but it is
guaranteed to work on newer devices like Nexus 7. Moreover, this mode
allows older devices to connect and receive files without having to
support WiFi direct's peer-to-peer connections and, more importantly, it
gets rid of the annoying "accept connection" prompt.
</code>
But no where i found information on how to implement this. Can anybody help me. Here is the link
http://forum.xda-developers.com/showthread.php?t=2177133
Comment: Quote: `Ideas, problems & questions: http://support.superbe.am`
Answer: You could indeed simply use the createGroup function from the API to create a group, which also makes the access point. The first problem here is that the access point name & password are set automatically, and you can not change them.
So, you do need to pass the info to the connecting party, and for this, I would suggest using the local service advertising, and using the instance name there.
Did make simple test app for this and you can find it from Github under DrJukka/MyWifiMesh, also some discussions on the topic can be found from my blog
Comment: Can this method be used with PCs? Using createGroup() would allow a laptop see the connection. But will a laptop be able to receive the service broadcast as well? Trying to find a way to edit the WIFI SSID (WIFI Manager might help with this) and remove the password requirement.
Answer: This can be achieve using Xposed framework. You need add the code and install the App. The phone needs to be rooted in order for it to work. I have tested it on multiple Samsung phones and it works.
Check this answer for details: How to auto-accept Wi-Fi Direct connection requests in Android
Comment: as already mentioned in the question i have gone through this post. I know it can be done after rooting the device. But superbeam achieves it without that. Wanted to get more info how to do it.


Where can I go for ham radio reviews?

Question: I was wondering what would be the best startup HF transceiver for the 3-30 MHz band. I have not found any which appear to match my requirements for under $200. What would some ham radio sites be with professional answers where I could find what I am looking for?
Comment: This question asks for recommendations for specific products, services, software, or electronic designs, which are off-topic as they attract opinionated rather than comprehensive answers. Please consider rephrasing your question in terms of what you should be looking for given your use case or whether a specific product has the capability you need.
Answer: HH,
There is not a single answer here. Just as if I were to ask you about which is the best state, camera, beer, football-team, car or truck.
If you are looking for HF and not wanting to go Chinese QRP. There are some options - they are in reverse order i.e. the best is last....
3rd Place New:

Home Brew QRP.
Under $200 very easy to do.

As you will be a new radio user, I would suggest QRP is something you try a little later. But you may have no space, are only planning on using the radio in the outdoors/from the top of a mountain.
2nd Place Used:
This is the most initially affordable place to look.
What rig to buy ? Have a look on eHam.net - and see what the general reviews are like.
QRZ.com has a good used equipment section - very US/Canada focused.
1st Place Club/Elmer:

Join a radio club, and ask around.
Use the club station.
Join in a contest multi-operator event (not on week 1 !!).

I am 100% sure you would be invited to several people's shacks to call 'CQ' for a while.
Here you can see and hear the difference between Icom/Yaesu/Kenwood/Elecraft.
This will allow you to start to decide for yourself which features are required.
On a side note. I would recommend that you budget/plan/built your antenna because the transceiver will be worthless without a decent transmit and receive antenna.
You will also need a decent power supply.

Where can I go for ham radio reviews?


How to make Xubuntu detect multiple monitor setups correctly?

Question: I have an additional monitor at home and at work, but they have different resolutions. That was no problem for Ubuntu. I recently set up a new laptop with Xubuntu, and now the second monitor is always mirrored. I solved it by making a few bash scripts with xrandr commands to set the correct monitor settings. So the first thing I do is running home_screen.sh or office_screen.sh after I boot my system. I also have laptop_only_screen.sh and beamer.sh. It works, but still... Can someone explain the different behaviors of Ubuntu and Xubuntu?
By the way, my old laptop had a VGA port, the new one has HDMI. Could that be an explanation for the different behavior instead of switching to Xubuntu?
Answer: Go to Settings > Display and check the box that says "Configure new displays when connected".  Now when you plug a new monitor in, it should pop up a dialog box for selecting the display mode.  If this does not work, check to make sure that you are using the best driver for your graphics card. (Settings > Additional Drivers)
Comment: That dialog box only pops up when you connect the monitor **after** system startup. And I switched to the alternative drivers (fglrx-updates, proprietary) already...


When running a multiple regression, are both dependent and independent variables scanned for outliers?

Question: I want to run a multiple regression analysis using SPSS. I have used the Mahalanobis d square method to find outliers.  However my question is, do I add the dependent variable to the list of independent variables when looking for outliers, or is it just the independent variables that need to be scanned for outliers? (I have around 7 independent variables and 1 dependent)
Answer: You might go either way, but since there are specific methods to look for outliers in the dependent variable after the regression is fitted (for instance, with the so-called 'deleted residuals') I would check regressors for abnormal observations first, then look for outliers in the response when the regression is fitted.
Comment: Outliers in X-space are often called *leverage* points, search this site!
Comment: Yes, I know, but I understood points with high leverage were not the primary concern of the asker. But true, looking for leverage points would be a good way to catch most anything one would consider an abnormal observation in the regressor space.
Comment: Well, I found the Q unclear, and am not so sure about the OP's intentions ... I think the Q needs a more elaborate answer, covering uncertain interpretations ...


How to use the Streaming Monitor app?

Question: I have downloaded the app, installed it, added myself to its permission set. Still, I cannot do anything in the tab. See the screenshot. The AppExchange page does not give any instructions, the Github page (Github) does not help. Who can help me out?
Answer: You should see something like this:

Have you tried to check your console log to see if there is any error? What do you see in the app page? Do you see the components there? There should be something wrong on permission level.
Do you have permission for the apex class called StreamingMonitorController?
I've successfully installed many times when I installed it for Admins only.
Comment: I use Chrome. Can't see anything wrong in the Console log. The app page: you mean the packet details? I cannot see or change permission for individual classes, because they belong to a managed package. From the presence of a permission set I concluded that I had to add myself to that, but I haven't found any documentation on how to use/set up the app.
Comment: Additionally: I am admin, I installed the app as being usable by all user. Also, I enabled Change Data Capture for a custom object. No change.

How to use the Streaming Monitor app?