how to get the rendered width of internationalized button text in GWT?

Question: While testing our app with a new set of translations, I found that the translated text for some of the buttons are significantly wider than the english. The result is that the button text wraps to a 2nd line, which is either cut off by the button, or floating below on a 2nd line. It seems like I need to get the rendered width of the text in order to dynamically resize the buttons, assuming there's space in the layout for a wider button.
Is there a way to get the width of the rendered text of a button?
Answer: Unless you are using a monospace font for the buttons (why not do so, actually?), and render it using CSS en / em / ex units, you cant really predict the text width, only make an educated guess.


How do I tame my Dwarf Umbrella tree?

Question: My favorite house plant, I've had it for about 5 years now is growing far and wide. She was in a very sunny window for the first 4 years (I know that's not as directed) but she was super happy and grew slowly but healthy and full. when I moved I decided to keep her in a sunny window although it wasn't nearly as sunny as my old window, well in the last 6 months she has grown immensely but loses her old leaves very quickly :( her stem is getting kind of brown and bare because of losing leaves. Hoping someone can direct me in what to do, do I need to replant it in a bigger pot? should I move it away from the window? Hoping for some guidance, Thank you in advance!
Answer: Your plant is a Schefflera arboricola, common name umbrella plant.  I bought one of these 34 years ago - I still have an umbrella plant, but it's not quite the original one!
Mine grew until it got way too tall (about 8 feet) and at that point,I cut off about 10 inches of stem from the top, reduced them down to about 5 inches, stripped off the lower leaves leaving  just one or two, and popped them in a bottle of water on the windowsill. They produce  roots within 4-6 weeks, and when they did, I potted those up. The new cuttings grew on really quickly, and the original plant became, once again, far too tall, so I repeated the process... over the years, I must have done this 4 or 5 times, either giving away the  original plant or disposing of it if it was gawky or had a health problem.
I told you all that for a reason, because I am  about to say do the same with yours; after you've taken your cuttings from the top, cut down what's left of your plant, reducing  the two stems down to about  an inch, preferably just above a node, keep it watered as necessary, fertilise with a houseplant fertilizer and wait - it should respond by putting out new growth and become a bushy plant again. And you have the insurance of  the cuttings rooting and creating a whole new plant as well...

How do I tame my Dwarf Umbrella tree?


ValueOutofRange error

Question: I am trying to upload some records in a DAta Extension and getting the ValueOutOfRange error. Apparently, all field data types and lengths are correct. Could you please advise the reason. Thanks!
Answer: I just got this error, and it looks like my DATE field is the issue - some of my dates are listed as 12/31/0069 - so the year appears to be the cause of the failure.
I realize this post is over 2 years old now, but in case others have this issue they can try looking at the Date Time values first.

ValueOutofRange error


Why is 이해합니다 pronounced as ihaehamnida?

Question: 이해합니까 looks like it should should be pronounced as

ihaehabnida

but it's actually

ihaehamnida

What rule causes the ㅂ in 합 to change from a b sound to an m sound?
Answer: This consonant assimilation is actually very common and almost ubiquitous across all languages. In this specific case, the stop sound /p/ meets a nasal /n/ and becomes a nasal /m/ at the same location of articulation.
The problem is that the modern "Standard" Korean has almost confusingly unique mixed-depth of orthography. So not all pronunciation is directly reflected in the written spelling. Sometimes you just need to memorize how the morphological derivations are realized in the spelling, differently from when they're spoken.
Answer: 합니다 being pronounced as 함니다 is based on a strict rule, and this is what we as natives are taught to abide by in primary education.
In effect since 1989, the rules behind proper enunciation of Korean words are based on the 표준어 규정의 조항 (more or less translated as the "Provisions of the Rules of the Standard Language." This specific rule is listed in volume 2, chapter 5, section 18 where it states:
받침 'ㅂ(ㅍ, ㄼ, ㄿ, ㅄ)'은 'ㄴ, ㅁ' 앞에서 [ㅁ]으로 발음한다
That is to say, a bottom consonant ㅂ that precedes a character that starts with ㄴ or ㅁ must be pronounced as ㅁ.
HOWEVER
Though the standard pronunciation of 합니다 is 함니다 as above, colloquially it's not uncommon to see those who pronounce it as 함미다. This is where consonant assimilation comes into play and the ㄴ in 니 assimilates with the bottom consonant ㅁ that precedes it in 함 to become 미. Personally, 함미다 sounds more natural than 함니다.
I've seen sticklers for proper Korean chide those who pronounce 합니다 as 함미다 as "uneducated." You can safely ignore them.

Why is 이해합니다 pronounced as ihaehamnida?


how to expand a text area when click on

Question: Im working on a small project which has a textarea and i need help in making the text area expand on mouse click  like that of twitter and facebook. the textarea should look like a textfield at first then when clicked on should expand.
Comment: Something like this jQuery example? http://jsfiddle.net/Hgvag/
Comment: all of the answers only expand the text area to a fixed length. The elastic plugin in pretty cool as it expands with every new line entered by the user
Answer: This can be done without the use of JavaScript/jQuery, using CSS transitions.

textarea {
    height: 1em;
    width: 50%;
    padding: 3px;
    transition: all 0.5s ease;
}

textarea:focus {
    height: 4em;
}
<textarea rows="1" cols="10"></textarea>
Comment: Can we achieve this without pushing the elements underneath?
Comment: This should be the accepted answer. It's the simplest one and with the least dependencies.
Comment: I like this - but the problem for me is the textarea will return to height: 1em when not in focus.
Answer: Something like this would work...
Demo: http://jsfiddle.net/Y3rMM/
CSS...
.expand {
    height: 1em;
    width: 50%;
    padding: 3px;
}

HTML...
<textarea class="expand" rows="1" cols="10"></textarea>

jQuery...
$('textarea.expand').focus(function () {
    $(this).animate({ height: "4em" }, 500);
});

Comment: You can actually animate rows if you prefer: `$(this).animate({rows: 10}, 500);`
Answer: This will work for you:
<textarea rows="1" cols="40" onfocus="this.rows=10;" style="resize: none;">Tweet Tweet....</textarea>

I used onfocus instead of onclick because onclick isn't fired if the user uses the tab key to move to the textarea. You'll also want to make sure the user can't resize it themselves - hence the style attribute.
You could also add onblur="this.rows=1;" to shrink it back down once the user moves out of your textarea.
Comment: Note this method doesn't require the overhead of any javascript libraries. But if you're using jQuery in other parts of the project then @wdm's code would be best.
Answer: $("textarea").focus(function(){
    $("textarea").animate({ height: "70px" }, 500);
});

default css
textarea{ height: 50px;}

on focus textarea height will increase :) simple jquery
Answer: use this plugin > http://plugins.jquery.com/project/elastic
very simple and effective !
Answer: Based in doog abides comment using jQuery, I enhanced the code to autoadjust approximately the number of rows acording to the length of the content, and return to 1 when focus is lost.
HTML:
<textarea class="expand" rows="1" cols="10"></textarea>

jQuery:
$('textarea.expand').focus(function () {
    $(this).animate({rows: Math.max(1,Math.ceil($(this).val().length/this.cols))}, 500);
});
$('textarea.expand').blur(function () {
    $(this).animate({rows: 1}, 500);
    //Resize back to one row if the textarea is manually resized via the handle
    $(this).css({height: ''});
    $(this).css({width: ''});
});

Comment: Something to note. This will not resize back to one row if the textarea is manually resized via the handle. When this action happens, height is applied via inline styling. A fix for this behavior is to clear the `style=' '` attribute as well. This can be done inline via `onblur='this.style=" ";'` or adding `$(this).css({ height: '' });` to the blur function above.
Comment: @illdapt I edited the answer for improve it as suggested, nice detail. Thanks for the comment!
Answer: You can do this with CSS only using position: absolute, which will make it float over other elements, and the :focus selector, which will be applied only when the element have the focus. First you need to reserve the textarea size enclosing it in an element:

<textarea></textarea>

div.textarea {
   height: 50px;
   width: 400px;
}

Then style the unfocused textarea
textarea {
   position: absolute;
   height: 50px;
   width: 400px;
   transition: all 200ms;
}

And finally the focused one
textarea:focus {
   z-index: 1001;
   min-height:250px;
}

Fiddle: http://jsfiddle.net/7v60su9e/
Answer: <textarea style="width:200px; height:50px;" id="ta"></textarea>

var ta = document.getElementById('ta');
ta.onclick = function(){
    this.style.height = "400px";
}

A quick fiddle: http://jsfiddle.net/n6sgT/
Answer: You can do something like below:
<textarea name="textBox" rows="1" cols="20" id="textBox" onfocus="document.getElementById('textBox').rows = 5;" >

Comment: Actually, the solution from Ben is ever simpler than mine.
Comment: Still quite ugly. `this.rows = 5;`
Comment: jQuery does not have `$get`. It has `$.get` but that's something completely different. Besides that, why would you use a selector when you already have `this` in there?

how to expand a text area when click on


Changing subnet mask

Question: Currently I have a 10.10.10.0/24 network and am running out of IP Addresses. I'm not sure if I change to /22 mask, if I will still be able to communicate with some of the other facilities where we use 10.10.30/24, 10.10.40/24, etc. Any advice appreciated, thanks.
Comment: In addition to the pretty good answers: you might want to consider using binary patterns in the future: using decimal 10 / 20 / 30 might be nice to look at for a human, but using 8 / 16 / 24 / 32 results in much cleaner subnetting and supernetting. ;-)
Comment: Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can provide and accept your own answer.
Comment: good answer, I did as recommended and no problems
Comment: What I meant was to accept the answer by clicking the checkmark next to the answer (just under the vote count and arrows to vote). That accepts the answer, it gives the person who answered some points, and you get a couple of points for accepting an answer.
Comment: It is a courtesy to the people who take their time to answer your questions to show your appreciation by accepting the answer that helped you. It encourages good answer in the future.
Answer: If you change to /22 the network would be 10.10.8.0 to 10.10.11.255, which doesn't overlap with your other addresses.
Whether your routing or filtering will let those source addresses out to your other branches, or whether packets will come back, is another question.  But certainly it's possible to reconfigure your routing/access control to permit your /22 without clashing.
NB: The most complete question on addressing and masking is How do you calculate the prefix, network, subnet, and host numbers? which is the best place to look for understanding these things in detail.
Answer: Just to adjust jonathanjo's good response, changing the mask to /22, the network would be from 10.10.8.0 to 10.10.11.255. You can use ipcalc in Linux to check:
<code>
$ ipcalc 10.10.10.0/22
Address: 10.10.10.0 00001010.00001010.000010 10.00000000
Netmask: 255.255.252.0 = 22 11111111.11111111.111111 00.00000000
Wildcard: 0.0.3.255 00000000.00000000.000000 11.11111111
=>
Network: 10.10.8.0/22 00001010.00001010.000010 00.00000000
HostMin: 10.10.8.1 00001010.00001010.000010 00.00000001
HostMax: 10.10.11.254 00001010.00001010.000010 11.11111110
Broadcast: 10.10.11.255 00001010.00001010.000010 11.11111111
Hosts / Net: 1022 Class A, Private Internet
</code>

Changing subnet mask


Undergraduate, graduate or post-graduate student — is that Bachelor/Master/PhD or Bachelor/Master+PhD/postdoc?

Question: I received an invitation to nominate students for an award that could be for an undergraduate, a graduate or a post-graduate student. I've seen those terms used before, but never been sure what they mean. I know Bachelor student, Master student, PhD student and post-doc.
The timeline:
Being a Bachelor student → Getting the Bachelor degree → Being a Master student → Getting the Master degree → Being a PhD student → Getting the PhD degree → Being a post-doc → ...
Then what do undergraduate, graduate and post-graduate students refer to? Are undergraduate students exclusively students studying to get a Bachelor degree, or can it also refer to students studying to get a Master degree? After all, that's a graduation that they don't have yet. Literally speaking, it could also be "under" the PhD degree, but that's surely never used as such.
And a graduate student, is that then someone studying for the Master degree, er is it used only for people studying for the PhD degree?
But then what is a post-graduate student? Is this a post-doc? But post-docs aren't students anymore, so then it could only refer to PhD students. Or are post-docs considered students, too?
Comment: In many places, it takes a medical school student 6 or 7 years to be a medical doctor. Where do they fit?
Comment: Now that I have attained a bachelors in business administration and am in the job market it seems that I am not a "graduate" as many of the global corps describe graduates in the qualifications sections as holders of a masters degree. Looks like I'm going back for more. yippee
Answer: I am almost certain that post doc is not what is meant.
In English speaking systems outside of North America, and especially referring to Europe under the Bologna accords, an undergraduate refers to someone who is studying for, but has yet to receive, his first post-secondary education degree. Typically this degree is some equivalent of Bachelors, but in some cases students maybe enrolled in accelerated programs with a longer term of study that leads directly to (the equivalent of) a Masters degree.
A graduate student can, but not necessarily, refer to someone who is studying for a graduate diploma. In many countries having a Bachelors (or equivalent) is not sufficient in itself to qualify one for starting a postgraduate degree. One often requires a "good enough" Bachelors degree (such as one with honors). The graduate diploma is an intermediate step in which a student who has already received his first post-secondary degree studies further in order to qualify to enroll in a masters (or sometimes doctorate? I am not sure about this) degree program.
A postgraduate student refers to someone who has already obtained a first degree, and is now pursuing a second, third, or Nth degree beyond it. See, e.g. this Wikipedia entry.
A postdoctoral researcher is generally not considered as a student.

In English speaking North America, an undergraduate typically refers to someone studying for a bachelors, since almost all (if not all) degree programs go through that stage in North America. And a graduate student refers to any student studying for any degree beyond that of the bachelors (so that would be typically the masters or the doctorate).
Comment: Further comment, hopefully clarifying a bit more: according to https://educationusa.state.gov/your-5-steps-us-study/research-your-options/graduate/what-graduate-student , in the US you can pursue a master's *or* a PhD after a bachelor's. In Germany (and most other European countries), you have to obtain a bachelor's degree first, then a master's, then you can pursue a PhD.
Comment: @Pacerier: the one example I had in mind is the [Cambridge Math Tripos](https://www.maths.cam.ac.uk/undergrad), where some students can get, after one extra year of course work, both a BA and MMath degree at the same time now. (The offered degree(s) used to be slightly different some years ago, IIRC.) // These sorts of programs were more prevalent before Bologna. For example the pre-Bologna un-tiered Diplom degree in Germany, Austria, and Switzerland is largely the first degree held by the individuals and is currently recognized as largely equivalent to a modern Master's degree.
Answer: In many American Universities, the concept of a Master student is that which is enrolled purely in a Master course, and is expected to leave the school after graduation.
A Graduate student is usually enrolled with the objective of doing a PhD, many Graduate students, provided they have the coursework and thesis, might get a Masters degree in the middle of the program along with the PhD.
Usually for postgraduate students I also think is for post docs, but I'm not sure. In Mexico (and maybe France, because we share some characteristics of the language) a postgraduate student is one doing either a PhD or a Master, and a Graduate student is one doing his Bachelor degree.
Comment: This view isn't really correct. A master's student may _also_ be done as a prelude to a PhD, particularly when the admissions to the doctoral program is not automatic (even when made contingent upon passing a qualifying exam).
Answer: In the USA  An undergraduate student is one who's working towards a bachelors degree; typically a graduate student is one who has a bachelors degree and is either working on a Masters are higher level degree; a postgraduate degree level refers to someone who has earned a masters degree and is in route to a higher level degree; a postdoctoral Student is when they have completed coursework for the doctor degree but still has other requirements to finish like a thesis or disertation.
Comment: _In the USA **...**  a postdoctoral Student is when they have completed coursework for the doctor degree but still has other requirements to finish like a thesis or disertation._ [citation needed]


How to add LinkedList functionality to a class

Question: We have a base class Element that has numerous super classes such as ElementPicture. We store lists of Elements in a LinkedList class. The LinkedList class stores all elements in a LinkedListNode class which has members next, prev, value, & list. This all works as expected.
However, we're finding that we want the Element class itself to know the prev, next, & parent Element (each Element can have a body that is a list of Element objects). So the natural answer is for the LinkedList to hold a list of Element objects and those objects have the next, prev, & list members. And the value member goes away because the node is the value.
Is there a clean way of writing a library class that somehow is applied to the Element class giving it the LinkedListNode members? Generics can pass in a type for internal declarations but they can't do an extends. And even if they can, we presently have WrObject -> Element -> ElementPicture and without multiple inheritance there's no way to inject LinkedListNode into that.
The other thought was to create an ILinkedListNode interface, Element implements that, and that works. But we're then having to copy the methods & member data declarations across to it and that's not clean.
Any suggestions? We're using Typescript 1.5.
thanks - dave
Answer: Relevant reading: https://en.wikipedia.org/wiki/BaseBean
The only thing your classes need is a prev and next. All the LinkedList-specific things can be factored out into a module that provides functionality for LinkedList objects:
interface LinkedList<T> {
    prev: LinkedList<T>;
    next: LinkedList<T>;
}

class MyElement implements LinkedList<MyElement> {
    prev: MyElement;
    next: MyElement;

    name = 'bob';

    findThing() {
        return LinkedList.findNext(this, n => n.name === 'joe').name;
    }
}

module LinkedList {
    export function findNext<T extends LinkedList<{}>>(start: T, predicate: (x: T) => boolean): T {
        let current: T = start;
        while(current && !predicate(current)) {
            current = <T>current.next;
        }
        return current;
    }
}

This has several advantages:

It's not even possible for classes to accidently provide some nonstandard implementation of a LinkedList method
Smaller memory footprint of any given class instance
No danger of naming conflicts between class members and new Linked List functionality you might want to add in the future
It's clearer when you're doing a list operation vs a class operation

The real smell test here is that findNext (and other abstract list operations) doesn't ever need to refer to this. If you're not using this, why would you be on a class? FxCop would warn you about a nonstatic method not using this in a C# class for the same reason.


Servo motor power consumption issue

Question: I am using servo motor model no. MG995 with Arduino. I don't know the current it consumes while powered on and while lifting a 10 kg of weight. I am currently using a 5 V, 1 A power supply with one motor but in future I need to connect 6 motors to single supply.
Answer: Firstly consider the servo torque limitations, if loading increase from specified limit the it start stalling and even can gear get fail and burn servo itself, possibly.
And another concern is with power supply. You are using metalgear servo with power supply of just 1 A.
As per the specification provided by greenonline (in previous answer), the servo needs 1.2 A at stall condition. You require higher ampere power supply. Your setup will work with ideal no load condition but not on loaded condition.
You should not power servo directly form the Arduino. You should design the driver circuit or board for power supply and common both ground of the Arduino board and driver circuit.
And it is recommended that you should use multiple power supply and divide the power supply to the group of servos. It will help in stabilizing your working and power. High ampere drawn by one servo does not affect the other of power supply is separated.
If you have higher power supply system in which you can control the voltage and ampere both then you can go for single supply also. Considering 1.2 A stall current and all 6 servo are same then you should supply 1.2×6 = 7.2 A for working without any problem.
Answer: From the TowerPro website from the MG995:

Specification:

Weight: 55 g
Dimension: 40.7×19.7×42.9 mm
Stall torque: 9.4 kg/cm (4.8v); 11 kg/cm (6 V)
Operating speed: 0.20 sec/60° (4.8 V); 0.16 sec/60° (6.0 V)
Operating voltage: 4.8~ 6.6 V
Gear Type: Metal gear
Temperature range: 0- 55 °C
Dead band width: 1 µs
servo wire length: 32 cm
Current draw at idle 10 mA
No load operating current draw 170 mA
Stall current draw 1200 mA

From the stall torque at 6 V it can lift a maximum of 11 kg at 1 cm from the axis of the servo, so your load of 10 kg would be on the limit. THe MG995 may not be sufficient.
Also, as the stall current of one servo is 1200 mA you probably need a bigger power supply, or rather one that is capable of supplying more current.
Even with no load, six servos, when operating, will consume (6 x 0.17 =) 1.02 A, so again you will need a bigger supply.
The MG996R has a similar specification:

Specification:

Weight: 55 g
Dimension: 40.7×19.7×42.9 mm
Stall torque: 9.4 kg/cm (4.8 V); 11 kg/cm (6.0 V)
Operating speed: 0.19 sec/60° (4.8 V); 0.15 sec/60° (6.0 V)
Operating voltage: 4.8~ 6.6 V
Gear Type: Metal gear
Temperature range: 0- 55 °C
Servo Plug: JR (Fits JR and Futaba)
Dead band width: 1 µs
Servo wire length: 32 cm
Current draw at idle 10 mA
No load operating current draw 170 mA
Stall current draw 1400 mA

So you probably need to rethink your choice of servo.

Servo motor power consumption issue


Zonal statistics of polygon overlays in PostGIS

Question: I am trying to do a seemingly simple task -- extract mean pixel values from a raster based on a polygon overlay in PostGIS. I consulted several sources, including this blog, this blog, and this post). I loaded a Landsat tile into my database (in-db) and a polygon overlay consisting of three polygons (ID 1,2,3). The Landsat tile is a pansharpened image with a 15m spatial resolution and 4 bands.
Based on help files and the aforementioned posts/questions, I arrived at the following PostGIS query:
SELECT id, (SUM((ST_SummaryStats(a.rast, 1, true)).sum)/SUM((ST_SummaryStats(a.rast, 1, true)).count)) as mean
FROM imagery.l8_2015_09_12 AS a, analysis_results.zonal_stats_test as b
WHERE ST_Intersects(b.geom,a.rast)
GROUP BY id;
The results are:
1: 9902.49
2: 10079.68
3: 12355.90

However, when I test the results against ArcGIS's "zonal statistics to table" tool, I get the following results:
1: 8089.61
2: 7527.62
3: 12290.05

Close, but not identical. I am almost there but I was wondering if someone could help me figure out the source of the difference between both techniques. I suspect that there is something wrong with my ST_summaryStats method.
Comment: Does Zonal statistics of arcgis work with raster? If this answer is yes I belive that this is your answer. Sometimes, when you convert vector to raster you will lost informations of you data.
Comment: So perhaps a vector approach might be something to try. In that case, I would use a point overlay with st_value and then summarize within the boundaries of the polygon.
Answer: 1) I'm surprised you do not "cut" the raster with ST_Clip(rast, geom) or ST_Intersection(rast, geom) before computing their stats. What you want are the stats on the pixels values intersecting the polygons no? That could be one reason why you end up with a different result but that would only be if only small portions of the rasters are cut, since your result is quite close to the ArcGIS one.
2) Even if you "cut" the raster properly before computing stats, the way PostGIS clip or intersect the raster might be different from ArcGIS: How intersecting pixels are chosen? By their centroid? By the total area intersecting? How nodata values are treated? How polygons are converted to raster before clipping/intersecting if it's the case? How rasters are converted to polygons if its the case? All this depend on the tools you select and sometimes the order in which you do the operations.
I suggest you work with a subset of your data and visualize/analyse the results step by step (in OpenJump for example) to understand the difference with ArcGIS.
See also this tutorial.
Comment: You understand that using ST_Intersects(rast, geom) does not actually cut the raster right? For this you must use ST_Intersection() in the SELECT part...
Comment: Thanks for your comments. I used an intersect instead of a clip. In a previous version of this query I used a clip but it clipped to the 200x200 tile, not the pixel. So when I computed the mean I got the mean for every tile that intersected the geom. This query with a clip produces the exact same results:
Comment: --clip area of interest out of landsat tile
WITH aoi AS (
SELECT a.*, st_clip(a.rast,b.geom)
FROM imagery.l8_2015_09_12 AS a, analysis_results.zonal_stats_test as b
WHERE ST_Intersects(b.geom,a.rast))
--sum and group statistics
SELECT id, (SUM((ST_SummaryStats(a.rast, 1, true)).sum)/SUM((ST_SummaryStats(a.rast, 1, true)).count)) as mean
--SELECT id, ST_SummaryStatsAgg(ST_Clip(a.rast, b.geom, true))
FROM aoi AS a, analysis_results.zonal_stats_test as b
WHERE ST_Intersects(b.geom,a.rast)
GROUP BY id;
Comment: I have not tried st_intersection(). So I run st_intersection() first (instead of clip) to clip the raster, then run the original query on this clipped raster?
Comment: Yep! I would also investigate why ST_Clip() did not, apparently clip the raster...
Answer: That could be the case of when you imported the Landsat raster to your database, you hopefully set a parameter -t 300x300, which splits the image in tiles of 300x300 pixels. So, imagine that you have your polygons in a shapefile that you imported to your database.
It is possible that you need more than one raster tile to cover a polygon feature, so, to prevent this issue you should add the St_union function to your query, just like this:
SELECT
id,
(St_SummaryStats(St_Union(ST_Clip(rast,1,geom, true)))).*
FROM  imagery.l8_2015_09_12, analysis_results.zonal_stats_test
WHERE st_intersects(rast,geom)
GROUP BY id;

Also, by using .* you get sum, count, max, min, stddev as bonus. If you want just the mean, change * for mean, that line would end up as this:
(St_SummaryStats(St_Union(ST_Clip(rast,1,geom, true)))).mean


Is there an explanation of why some colors seem to move forward/backward on a 2D plane?

Question: I am a painter and digital artist working with color and colorimetry.
Recently I noticed HUGE "illusions" (impressions of depths) in a print
composed of very saturated colors, that I programmed to have the highest
chroma my printer could achieve.
Unfortunately this is undisplayable on screen (out of gamut), but the picture
can give you an idea...

In the transition between Black and light Grey-ish that passes from
Red to Green to Blue-Greyish, one can see on the print very abrupt "3D effects" or in other words "impressions of several groups of different depth", like a "staircase" with 3 or 4 steps.
We sometimes see similar so-called "optical illusions" occuring between fields of colours. If I remember well, dark-blue often seems "further away" than yellow for example.
I have searched on internet for an explanation but I can only find some quite old non-quantitative theories that explain poorly the phenomenon with a theory of "warm" and "cold" colors...
That's far from being a satisfactory explanation...
I am wondering if:

the impression of depth has anything to do with the eye's optics (like the different colors are not diffracted equally)
what is the cause of the illusion from the viewpoint of the retina's structure?
can it be described in mathematical terms with the help of colorimetry?
has it been completely described, can it be simulated, can we actually predict for which colors it's gonna happen?

Thanks
Answer: Lenses, both in glasses and in the eye, refract light of different wavelengths by different amounts. This is the well known prism effect. Opticians do their best to correct for it but it is inevitable to some degree. The technical term for this phenomenon is chromatic aberration.

In optics, chromatic aberration (CA, also called achromatism, chromatic distortion, and spherochromatism) is a type of distortion in which there is a failure of a lens to focus all colors to the same convergence point.[1] It occurs because lenses have different refractive indices for different wavelengths of light (the dispersion of the lens). The refractive index of transparent materials decreases with increasing wavelength in degrees unique to each.
Chromatic aberration manifests itself as "fringes" of color along boundaries that separate dark and bright parts of the image, because each color in the optical spectrum cannot be focused at a single common point. Since the focal length f of a lens is dependent on the refractive index n, different wavelengths of light will be focused on different positions.
Wikipedia

This effect alone can, I believe, give rise to depth perception anomalies.
Note: The above explanation refers primarily to a single lens.  I'll hazard a guess that our binocular vision combined with chromatic aberration makes even more of a difference in depth perception.
Comment: That's interesting... This hypothetic explanation could be tested quite easily I think, I will try when I'll have some time for it. In a previous version of your post you wrote "I read something about this some 20 years ago", do you remember what kind of literature it was?


LMMS MIDI notes don't stop

Question: I don't know I'm right place but I connected my Casio ToneBank CT-670 to my DAW (LMMS 1.2.2) I can hear the notes I played but it does not stop. How can I set the DAW or the tonebank to sense my push and pull movements?
Answer: Most likely there is an issue with the note off signal. In midi you get a signal for the start of a certain pitch as well as a signal for the pitch to stop (although sometimes this also uses a start event with velocity 0).
You could write a little debugging application using the jack module in python to log the the events your midi keyboard sends.
Comment: If on Linux, qmidiroute has a small utility for logging midi events :)
Comment: The reason why some sources send a NOTE ON message with a velocity of 0 to stop a note, instead of a NOTE OFF message, is that it can take less data, and hence less time.  (Most MIDI messages normally have a status byte followed by two data bytes — but by using 'running status', the status byte can be omitted if the next message is of the same type.  So in a long stream of NOTE ON/OFF messages, it could give a one-third speed-up.)  — Of course, this relies on the receiver _knowing_ to treat 0-velocity NOTE ON messages as note offs…

LMMS MIDI notes don't stop


android database value retrieving

Question: I have a database with three rows and columns.I have managed to insert the data into the table.Now i am trying to retrieve the values in a tabular format in my xml view.
How to go about this.
Any help is appreciated.
Thanks.
Comment: C:\android\android-sdk-windows\samples\android-8\NotePad
Answer: What you're asking for is a fair amount of work, but saying that, it's relatively straight forward.
The problem is, your request is so vague that people are reluctant to help.
One possible solution (although it might not fit what you need) would be:
1) Create a ListActivity
2) Create a custom SimpleCursorAdapter.
3) Create a custom xml view for each row.
4) override SimpleCursorAdapter's getView() to inflate said xml view
5) Override SimpleCursorAdapter's bindView() method to assign values from the cursor to the row.
The questions in my mind which stopped me from trying to code this for you are:
1) Might you want to change the number of columns dynamically?
2) Might you want more flexibility as to how the column widths are decided upon? etc..
A slightly more complex setup would use TableLayout and TableRow.

android database value retrieving


Establishing the minimum required training set size, when cross validating time series data

Question: I want to evaluate and compare how well various models perform with regards to modelling time series data (the data in question is daily revenue). It seems that cross validation error might be a reasonable way to do this.
I will quote this post, which nicely summarizes a procedure for time series cross validation:

An approach that's sometimes more principled for time series is forward chaining, where your procedure would be something like this:

fold 1 : training [1], test [2]
fold 2 : training [1 2], test [3]
fold 3 : training [1 2 3], test [4]
fold 4 : training [1 2 3 4], test [5]
fold 5 : training [1 2 3 4 5], test [6]

A more complete description of the procedure is outlined in this blog post, and this book.
My main question is:
For each of the various different models I am using, how do I establish, k, the minimum required size of the training set, in order for the evaluation of the model to be fair?
I sense that estimating k may cause problems; for example, one might set k such that the average error is reduced, when actually a larger error would be valid.
And a follow up question: is it valid to compare models that have vastly different k values?
E.g. for one model you might have an error vector of size 10, since k was so large, whereas for another you might have an error vector of size 1000.
Is it fair to compare the RMSE in this case?
I'd guess that it might be worth looking at the spread of the error?
The models I plan to compare are various different NN architectures, ARIMA stuff, ML techniques, along with some benchmark approaches, like mean, linear regression etc.
I don't have a vast amount of data, so often the NN models need to be trained on most of the data before they perform well (at least that is my intuition).
Any thoughts much appreciated!
Answer: I had the same question a while ago and landed on the last answer in the following link:
Divide a dataset into Training & Validation
I liked the theoretical basis for the idea of dividing the dataset into 63.2% training and 36.8% validation.


Hiding Email Address Form Alter

Question: I'm trying to hide non-admin users to view the email address field in the user section. I have the following hook. Right now, I have the current password hidden, but the email sends back a naughty validation requiring email to be added.
Answer: You can use similar code as below to hide pass and mail field with optional value.
<code>//drupal_set_message('not admin!');
$form['account']['current_pass']['#required'] = FALSE;
$form['account']['current_pass']['#access'] = FALSE;
$form['account']['mail']['#required'] = FALSE;
$form['account']['mail']['#access'] = FALSE;

$form['#validate'] = array_diff($form['#validate'], array('user_validate_current_pass'));
$form['#validate'] = array_diff($form['#validate'], array('user_validate_mail'));
</code>
Answer: If you want to alter Drupal so that it doesn't require email addresses for users, you should look at this module: https://www.drupal.org/project/optional_mail
Read the module description carefully. User emails are deeply integrated into Drupal, and not having them can cause all kinds of unexpected problems.
Answer: You can use Field Permission module. It allows you to set permission for every field for every role in your website. So if you prevent non-admin users from accessing this field, they wont see it.

Hiding Email Address Form Alter


What does this phrase mean? "Not if you've done it before, it isn't."

Question: I was watching a movie and heard the line "Not if you've done it before, it isn't." and it just confused the crap out of me. I'm not used to this phrase. What can it possibly mean?
Comment: Example dialogue: Alice says "That looks like a difficult job". Bob says "Not if you've done it before, it isn't." Alice says "I remember you now, you helped my brother, so you already know how to do the job."
Comment: It's quite sufficient just to be confused without being driven to diarrhoea.
Comment: The sentence is clearly a reply to a remark by someone else in the movie.  Please give us the previous line of dialog so we don't have to invent stuff.
Comment: We need more context.  In particular "done it" and  "it isn't" refers to something outside the sentence.  We also need the source of this quote.. Please don't quote unless you can also tell us exactly where you read or heard this.  What movie were you watching?
Answer: It's hard to explain this fully, without a little more context, but @WeatherVane has done a good job of showing a simple, common example.
To a native speaker, it is very clear that this phrase is a retort to someone saying that a particular task is difficult. The basic answer is therefore: "No, it isn't"  but then this has been expanded upon, not at the end as you might expect, but in the middle.
To rewrite this, as a stand alone, positive phrase, we would have: " is easy if you've done it before."


If my research is applying methods from field X to field Y, should I do my PhD in field X or field Y?

Question: Let's say I'm a PhD student in a field, let's call it X, and my research is all based on taking the methods developed in field X and applying them to some other fields, let's call them Y, Z, and W. Let's further suppose that I do not make any contributions to the theory of X, I only apply it to Y, Z, and W. Is X the proper fit for me, or should I really pick my favorite of Y, Z, and W?
Answer: A PhD is meant to extend the knowledge within a field. It's obvious that you can contribute knowledge to Y, Z, and W, at least if you apply the X methods to solve some research questions in these fields. It's less clear what you contribute to X.
You state that you don't contribute to the theory of X, but maybe you extend or generalize the X methods alongside applying them? If you do that, you could get a PhD in X. Otherwise, Y, Z, or W would seem to make more sense.
Answer: If you are making most of your contributions to W, Y, or Z, then it probably makes most sense to get a PhD in those compared to a PhD in X. This is for the reasons given by silvado.
However, if you're already a PhD student in X (your first assumption), you have to consider whether it is worth switching to W, Y, or Z. From what you've written, your department or advisor seems fairly flexible in terms of allowing you to work in different areas. Would switching to W,Y, or Z mean switching advisors or departments? Would it mean that your funding might change (e.g., if your funding is tied to a particular field)? It seems like if your research on W,Y, and Z is viewed positively by your department/advisor, there would have to be a substantial reason to switch away from that department/advisor, since the switch might result in less flexibility.
Answer: If you are applying X to Y, you can easily be in either a department of Y (where you are making a difference) or in a department of X (where you will no doubt be contributing through the adaptation of the techniques to problems in Y).  The biggest factor, I think, would be where you can find the best match between yourself and an advisor and departmental culture.


Can anyone help fix this old black & white photo?

Question: I have this family photo that for as long as I can remember (40+ years) has white through the top half of the photo.  I would like to try to correct the photo or get someone to do it for me.  Any help would be appreciated.

Comment: This site is really for learning about photography — it's not meant to be a service for finding someone to do work for you. You'll probably get better results asking for ways to fix a problem like this — and you might get some examples of efforts towards that goal. But if you are asking for someone to just do the restoration for you, there are forums (and for that matter, commercial services) that are a better fit.
Answer: A professional retoucher/restorer might be able to do it.
I've got to admit it's probably beyond my abilities. The sky isn't too difficult to clean up, & getting rid of the small dings & scratches is time-consuming but not difficult [so I didn't do much of that except for the big one in the sky], but that stripe across the middle is tough.
Maybe if I gave it 2 or 3 hours rather than 5 or 10 minutes ;)

Quick A/B diagonal mask.
Answer: You'll want to take it to a professional retoucher or risk going through several students to achieve a finished product. They would likely use digital means, such as scanning the photo then using software like Photoshop to do the actual correction, because while physically retouching the photo is possible it's usually not preferred because of cost, time, and risk of not getting it just right.
After you've received the original photo back you'll want to place it in an archiving sleeve to maintain its integrity or if you're happy with the restored image have one of those archived and another out on display.
Google "photo restorationists" or "retouchers" to match to someone providing this service.
Comment: I provide such services for a cost. If it's something you want to pursue I'll pass over my contact information.
Answer: Looks like it was left out bent or something. It's been exposed to uv and it has lost a lot of info - a lot of the black ink. The problem is that the main defect is a gradient.
I made a copy of the top half and used a gradient on the bottom so it blends. Then added contrast and darkened the top and removed a little contrast and lightened the bottom. Did a little overlay on the face and removed specks.
It's something somebody could work on and get the line of haze to disappear more but the overall image quality can't get that much better.
This photo would easily make a great painting or drawing. You know, have a real person draw it.


Indesign question regarding "placed" objects

Question: As a total newb, I am more than sure that I'm the problem...  I'm trying to place five pieces of b/w original artwork into a document.  I've resized all images to a similar size.
After placing them in the new document, I see that they have lost resolution and appear blurry.
Is this a function of having re-sized them (in photoshop) or is there something I should be doing in Indesign to correct them?
Comment: All images are by default shown as a low quality preview. Everything should look ok after exporting.
Answer: To expand on CAI's comment, indeed InDesign will work by default in a Typical Display performance, which means links are rendered in a low-res preview to improve general performance and speed, which is more likely a problem with large volume files.
To view your links in a full resolution preview go to Main Menu > View > Display Performance > High Quality Display
This will be opposed to the Typical Display setting that you get by default.
If this won't work, then the next logical assumption would be your placed files are broken links, meaning they have been moved from their original drive location after placing them in ID, in which case you should update the links to their current location or easier, just delete the images and place them again.


Where can I find written rulings of the Senate Parliamentarian?

Question: Many topics in the news recently refer to rulings made by the Senate Parliamentarian Elizabeth MacDonough. However, so far, I've not been able to find links to the actual text of those rulings.   Does anyone know where I could find an official list of such findings?
Comment: I don't know that they'd be published; a "ruling" could be the Parliamentarian calling the Majority Leader and saying "here's what I think the rules say." Remember that the Parliamentarian is only an advisor; the presiding officer, not the Parliamentarian, actually rules on points of order.
Answer: According to Ryan Grim her opinions are "private", so there won't be an official list... but some do get leaked out (since they apparently circulate among Senators), which is almost certainly how the press ends up quoting from them. (I don't know if there's an unofficial repository somewhere.)


Do chaotropic and kosmotropic affects occur in polar non-aqueous media?

Question: For example can I introduce salts that have a chaotropic or kosmotropic affect on ethanol? Or is this phenomenon restricted to water? If this phenomenon does occur in other polar solvents, does it follow the Hofmeister series as well? Are there any papers out there on this phenomenon in polar non-aqueous solvents?
Comment: As far as I understand, chaotropism and kosmotropism are merely fancy words to describe whether a solute has $\Delta S_{solvation}>0$ or $\Delta S_{solvation}<0$, respectively, so I'm pretty sure it extends to any solvent. Surely each solvent has their own series of ordering/disordering solutes, given how different the intermolecular interactions can be.
Answer: Chaotropic and kosmotropic effects of solutes can occur in any solvent in which interactions between solvent molecules lead to a more ordered structure, like a hydrogen bonding network in water. Such a network will also be present in alcohols like ethanol, although to a lesser degree, because the alcohol molecules have only one proton which can act as a hydrogen bond donor. The Hofmeister (or lyotropic) series for alcohols might still be similar to that for water (not identical), but it will be more different with increasing structural difference between the solvent molecule and water. In fact, the Hofmeister series for water is still not fully understood on a molecular basis, as it is described in this post, and this makes it difficult to predict Hofmeister series for other polar, non-aqueous solvents.


How to detect whether two files are identical in Python

Question: Is making system call to "md5sum file1" and "md5sum file2" and compare two return values enough in this case?
Answer: If you want to do more than just detect if they differ, or don't trust the hashing solution, there are modules in the standard library called difflib and filecmp that doesn't rely on external programs.
Comment: Just read the doco for filecmp - it certainly seems like the right approach for a Python app.  I like the idea that "Files that were compared using this function will not be compared again unless their os.stat() signature changes."  No doubt the filecmp.cmp() function is more efficient than rolling your own.  I think this should be the  accepted answer...
Answer: Well, that will tell you whether they're definitely different or probably the same. It's possible for two files to have the same hash but not actually have the same data... just very unlikely.
In your situation, what is the impact if you get a false positive (i.e. if you think they're the same, but they're not)? MD5 is probably good enough not to worry about collisions if they would only occur accidentally... but if you've got security (or money) at stake and someone could plant a "bad" file with the same hash as a "good" file, you shouldn't rely on it.
Personally, I'd probably just read both files, comparing each byte - for a one off comparison, both the hashing and this approach will require reading the whole file when they're equal; as Daniel points out in the comments, doing a byte-by-byte comparison lets you exit early as soon as you see a difference. Comparing the file sizes first is another quick optimization :)
The general advantage of hashing occurs when you store the hash of the existing file somewhere, so that next time you can just read the new file.
Comment: Depends on the source. If there is a trust/security issue at stake, and you cannot rely on the good intent of the file creator(s), then "unlikely" isn't the appropriate word.
Comment: "both the hashing and this approach will require reading the whole file" - only true in the case that the files are the same.  You can bail out early in the case when the files differ if doing the comparison yourself.  This is a good enough reason to NOT use the MD5 approach (as noted in my answer!).
Comment: @MSalters: Indeed, will elaborate.
Comment: Once had a 'university lecturer' tell me unequivocaly, no two files could have the same md5 and not be identical in data content.
Comment: @Jon, thanks for your explanation. How to generate hash value of a file? hashlib looks like works with string only.
Comment: @jack: When you call md5sum, that *is* generating a hash.
Comment: @Jon: you might as well put my other good idea in your answer - compare file sizes before bothering to compare file contents ;)
Comment: @Daniel - will do, although I'd hope that would be obvious :)
Comment: @Dominic Bou-Samra: That is obviously wrong since if it was true, only 2^128 = 340282366920938463463374607431768211456 different file contents could exist. That is trivially not true, since you could create as many files, the content is the actual counter. Then create a file with the content "foobar" and it HAS to be mapped to one of the values above. See here: http://th.informatik.uni-mannheim.de/People/lucks/HashCollisions/ for two valid postscript files with the same MD5 sum.
Comment: @Jon: I'd *hope* that it was obvious enough that most developers would not miss this, however, I am no longer surprised when obvious optimisations are missed by developers...  jaded I am.
Answer: A hash is useful if you are going to cache it (to compare many different files with each-other). If you just want to compare two files, it's a monstrous waste of cycles. After all - both files will be read in, and a lot of processing will be used on every bite.
If it's a 1:1 compare, just use:
import filecmp
filecmp.cmp(file_name_1,file_name_2)

On the other hand, a good hash is the only way to compare a large number of files with each-other.
SHA-1 and MD5 sort of broken - but not for normal files. A few researchers can generate 2 nonsense files that might clash, but it's unlikely that anyone can clobber an existing file.
git uses SHA-1 to compare text, so it's not a terrible choice.
The following will all work:
import hashlib
hash = hashlib.MD5(your_text_here).hexdigest() # safe*
hash = hashlib.SHA1(your_text_here).hexdigest() # safe*
hash = hashlib.SHA224(your_text_here).hexdigest() # safe
hash = hashlib.SHA512(your_text_here).hexdigest() # paranoid

# now put the hash in a dictionary (or database) for your many-to-many comparison.

#  * Meaningful files will not be clobbered. Contrived files can be generated
#    which might clash together, but it's difficult to do.

Comment: ["If shallow is true, files with identical os.stat() signatures are taken to be equal. Otherwise, the contents of the files are compared."](https://docs.python.org/3/library/filecmp.html) Did you intend that?
Comment: This is exactly what I needed to just compare two files and ensure they are identical for a markdown to json conversion.
Answer: Of course there is a simple test that you should do before comparing the file content at all - if the files are different sizes, then they can not possibly be the same.
Wouldn't it be more efficient to simply read each file and do a byte-by-byte comparison, avoiding the hashing algorithm altogether.  This avoids the the (very unlikely) chance that two different files produce the same MD5 hash.  Furthermore, you can bail out of the comparison when the first difference is detected, which for very different files will be very early in the comparison (possible on the first byte!)
Comment: I agree. Simple filecmp would be faster than computing HASH.
Answer: If you're on a system with md5sum, that's probably good enough.
You can do it with Python standard libraries -- checkout out hashlib.
Answer: Depends if you feel comfortable with the probability of collision on the MD5 algorithm.  Just note it is highly unlikely: so yes, go ahead.
Answer: If there is nobody maliciously trying to create collisions, then you would have to compare about 264 files before you would expect to see a collision by random chance. However, it is possible for someone to carefully construct two files with the same MD5 sum due to cryptographic weaknesses in MD5. Whether the cryptographic weaknesses of MD5 matter or not depends on your application, where the files come from, and what an attacker could stand to gain if he tricked your program into thinking two different files were identical. MD5 is still a very good checksum, just not so great as a cryptographic hash.
Answer: yes, it is enough


Storing SqlServer's raiserror message in C#

Question: How can I store SQLSERVER's raiserror message in C# ?
Comment: You have not done even the most basic research yourself: this SQL code will not run because the RAISERROR will fail.
Answer: It depends on the severity of your RAISERROR. Severities 1-10 are considered information messages and do not break the flow of your C# client, ie. they don't throw exception. These information messages will trigger the InfoMessage event on your connection.
If you RAISERROR with severity between 10 and 16 is considered an error and your SqlCommand.Execute will throw and exception you can catch.
Severities above 17 are not for you to play with, they are only to be used by the engine to indicate severe problems that may take the database offline or shutdown the instance. Is not technically possible to raise errors with severity above 25, your example with severity 100 is just silliness.
Answer: Have a look at:
http://www.sommarskog.se/error-handling-I.html#ADO.Net
In particular: the SqlClient section. The SqlError class gives you all the information you need.


Map Bytes to Number

Question: Using node.js crypto library I can generate cryptographically strong bytes. How can I use this to generate a random number between 0 and 9999 (both inclusive)?
Comment: As an aside, `randomBytes` and `pseudoRandomBytes` are named terribly. `randomBytes` is actually *pseudo*-random (and cryptographically secure) while `pseudoRandomBytes` is *not* cryptographically secure?
Comment: There are several *very* similar question on stackoverflow. For example my own [enerating uniform random integers with a certain maximum](http://stackoverflow.com/questions/9499071/generating-uniform-random-integers-with-a-certain-maximum)
Answer: I would personally recommend this simple procedure for selecting random values from 0 to N:

Step 1: ask your cryptographically secure RNG for a sample M that is large enough to cover the interval between 0 and N

In your case, if your CSRNG outputs bytes, then you would ask it for 2 bytes; that gives you a random value M between 0 and 65535

Step 2: modulo reduce M by the smallest power of 2 that is larger than N

In your case, the smallest power of two larger than N is 16384; hence, you take M (the value between 0 and 65535), and modulo reduce that by 16384, giving you a value between 0 and 16383;
M = M % 16384;
(language note: the above assumes that the result will always be in the range of 0 through 16383; if the programming language does something funny with the modulo of negative numbers, you might either avoid negative numbers altogether, or handle negative numbers as a special case)

Step 3: check if the value M is in the range you want, that is, no more than N; if it is not, then go back to step 1

In your case, you're looking for values between 0 and 9999; if M is outside the range, we discard it, and go back to step 1.
if (M > 9999) goto step_1;

Step 4: return the value M

Properties of the above algorithm:

It is unbiased.  The only nonobvious point behind this is step 2; by modulo reducing M by a power of 2, it remains an unbiased value (only with a smaller range).  This step is effectively masking off the higher order bits; leaving the lower order bits undisturbed.
It is cryptographically secure (assuming that the original RNG used in step 1 was cryptographically secure); any method that can be used on the output of this algorithm to distinguish it from random could be used against the original source to distinguish that from random.
It is moderately efficient; we'll run steps 1 through 3 (at most) an expected 2 times for every generated value.  Now, there are alternative algorithms that use fewer expected random bits from your rng, however (IMHO) those methods aren't as easy to get right, and wringing the last bit of efficiency is less important than getting a method that we are confident is good.
Answer: First, how not to do it. You could generate 2 bytes, treat it as a 16 bit number and compute it modulo 10000. That would give you a number between 0 and 9999, but would not be cryptographically secure. It would have bias. For example, using python random.randint(0,65535) % 10000, I generated 1,000,000 random numbers and plotted the following histogram:

The proper way to do it would be to generate 2 random bytes and treat them as a 16 bit number, say $x$. Then compute $x' = x\mod 16384$ (note $16384 = 2^{14}$, i.e., the next power of two just bigger than 10000). Then, if $x'$ is less than 10000, return that number, otherwise start over. Using this process gives the following histogram on 1,000,000 random numbers.
Comment: A more efficient approach is to take the problem modulo 65536 and divide by 6 when less than 60000, you will waste less entropy this way. This question is actually a duplicate of a couple crypto.SE questions, in particular http://crypto.stackexchange.com/questions/5708/creating-a-small-number-from-a-cryptographically-secure-random-string?rq=1 and http://crypto.stackexchange.com/questions/6175/how-to-best-obtain-bit-sequences-from-throwing-normal-dice?lq=1

Map Bytes to Number


Connect button to GPIO without breadboard?

Question: Is there a way to connect a button to a Raspberry Pi 3B+ without a breadboard? If so, how? Could you give a diagram and explain? I am only a beginner so please make it easy to understand. Also I would like to avoid soldering. Thanks in advance.
Comment: https://www.amazon.com/Multicolored-Breadboard-Dupont-Jumper-Wires/dp/B073X7P6N2/ref=sr_1_1_sspa?ie=UTF8&qid=1544471573&sr=8-1-spons&keywords=electronics+jumper+wires&psc=1    The female ends on those wires will slip onto the headers of your pi, then you would just need a switch that also has small posts to connect the other wire to. Of course without soldering, they are likely to not be a great connection.
Answer: You could do it with the female to male jumper wires and some alligator clips, but why would you want to go that much trouble to avoid soldering or a breadboard?
For a diagram, wire it exactly like the diagram in this picture, but skip the breadboard and wire directly from GP2 to one side of your switch and from the other side of your switch to a GND pin.


How can I proceed with my research on applying machine learning in Cyber Security?

Question: I have two years of experience as a pen tester, I want to do masters  in machine learning and security and research in finding ways to tackle current security problems through machine learning. Also do suggest what I can do apart from masters to fulfill my research.
Comment: This might be helpful : https://github.com/jivoi/awesome-ml-for-cybersecurity
Answer: Here's some incomplete answer but that's all I can tell now.
Machine Learning today seems more of the programming framework so it's best suitable for developing new applications, so for this a bit of programming (scripting) is needed.
Machine Learning can solve existing  problems better than previous solutions for example, Spam Filtering, Image Recognition, Speech to Text, Natural Language Processing etc.
However, using machine learning in applications usually means either doing completely new products (design from scratch) or extending existing products.
Machine Learning works on data so there's some data required to do the test and the more of it the better. It can be voice, sound, images, videos, logs, texts, structured documents, tables etc.
Now the thing is since there are many Machine Learning frameworks and services there aren't many applications yet, so the functionality is already built-in into the product like IDS, or it needs to be applied programmatically.
Because programming Machine Learning itself is not the main point but rather using it, the good starting point on seeing how it works and how it can be used is to have a look on Google Cloud Machine Learning.
Google Cloud Machine Learning
However even simple algorithms can be used effectively for example as "log processor" but also database (memory) is also needed.
One of the interesting Machine Learning applications is observing the user on the PC - instead of using more cameras to observe the person, so in this case Machine Learning can be used to analyze the traffic on the net, the web browsing history, what is typed and even what the person can see on the screen.
For example using Machine Learning with the tape archive and regular storage it is possible to analyze the log and predict what data will be required and when so it can be retrieved from tape archive ahead of time (that's the real and tested application example).
Machine Learning could be also to orchestrate all sorts of jobs based on the predictions of the required load - this is the case for some very complicated workflows, loads of them and limited resources, for example the way Google optimized their power management in data centers.
To get the idea first is to get some data first. The log data is ideal point of start. Prediction API seems interesting.
However there are many other products offering similar functionality in machine learning, they usually facilitate real-time data streams like logs, it's good to google for them a bit.
The most popular languages for the job are Java and Python, but many other are used too including C, C++, C#, Go, Ruby, PHP, Perl etc.
So the main point is to invent the application and to do it is to have some data first.


HDMI sound turns off after screensaver is active

Question: On my Dell desktop( using HD 5700 )HDMI sound turns off after screensaver is active. HDMI sound works otherwise. It appears to be bug with 12.04, it was fine with previous Ubuntu releases.
Answer: This is not a problem with Ubuntu, but an issue with the ATI graphics driver.
It happens when the driver detects the monitor going into standby, but does not detect the return.
Others have suggested running a beta version 12.7 of the driver.
You can find more of an answer from here:

HDMI audio stops after TV turned off.


To have sharp look in submitting it in any contest

Question: When i submit my designs (logo, business card, etc) in any contest, it doesn't give sharp look  instead of others. My design looks like a little blur while submitting to the contest. I made designs in Adobe Illustrator CS-5.
How could i get sharpness in my design so the contest holder could inspire with my creativity?
Comment: Could you please show us some examples?
Comment: Do you mean shaprness as in precision or sharpness as in overall quality?
Answer: 1) Any "contest" is really a bad idea, always. They do nothing but take advantage of you.
2) If you are uploading images to a web site, web sites have server-side image tools which generally alter the image for size and then re-compress, re-save it. It is traditionally best to upload the size displayed on the web site so that the server tools don't have to resize the image.
Answer: I love to join contest site too. Some contest sites has a compression system which saves your file into a smaller format for viewing. But as far as I know the detailed version or the original size of your submitted entry is always available to contest holder.
Just make sure to submit a large or a zoom version of your design. For example: 1200pixel by 1000pixel at 72dpi.
P.S.: I prefer .PNG file format because by default PNG files has no compression and keeps the quality of your design.


Can we find the userid from a user name of a deleted account?

Question: If I know a user name (e.g. "SteveO") whose account was deleted sometime around middle of January this year, is it possible to find out its userid (and thus its current username "user" shown in its posts)?
Thanks.
Comment: Might be possible to use dataSE to find comment replies to the user, then look at the comments around it for the generic username stub e.g.: `user123456`. But why? You wouldn't be able to view the deleted user's profile.
Comment: There are multiple users with the same user name, but still a possible solution, but I am not very familiar with the databases, and would appreciate if anyone can help. "Why": https://meta.stackoverflow.com/questions/369989/how-can-we-find-all-the-posts-of-a-deleted-user-from-its-user-id
Comment: Are you looking for these? 1224441 9119247 9158584
Comment: Thanks. Does 9158584 have any post on SO? and any post which doesn't receive overall downvote?
Comment: Not at all.....
Answer: Beyond what was offered by Erik von Asmuth earlier you can only find out if a user has been relatively active in either commenting but even better, close voting.
The first method relies on the fact that users are @-reply-ed in a comment. You can then create a query that looks for earlier comments on the same post for a user that is deleted. The anonymized  (that IS a word!) displayname contains the original userid.
The second method relies on the fact that users that participate in successful close voting (> 3K rep needed) have their userid and displayname recorded in the posthistory table. With some JSON parsing magic you can reveal those.
I have captured both methods in this SEDE query
<code>declare @username varchar(200) = ##userdisplayname:string?H2CO3##

select distinct top 100
       uc.id as [Comment Link]
     , pv.userdisplayname [potential userid]
from comments uc -- all comments ...
inner join comments pv on pv.postid = uc.postid -- previous comments
                      and pv.id < uc.id
left outer join users u on u.id = pv.userid -- from users ...
where uc.text like concat('@', @username, ' %') -- collate sql_latin1_general_cp1_ci_ai
and u.id is null -- ... that are now deleted

select distinct JSON_Value(ph.text,concat('$.Voters[', num.value , '].Id')) [potential userid]
from posthistory ph
   , string_split('0,1,2,3,4', ',') num -- [0..4] (max 5 close voters)
where posthistorytypeid = 10  -- closed
and JSON_Value(ph.text,concat('$.Voters[', num.value , '].DisplayName'))  = @username
</code>
This is as much as us mortals can do. If this doesn't work for you, either grab an older datadump, run for moderator or get hired as SE Dev.
Let me mention here that some countries have legislation that allow their citizens to be forgotten. If users have chosen to delete their account that has to be respected. Don't use these techniques to hunt down, online or in real life, users and confront them with posts they no longer wanted to be associated with.
Comment: @Tim I recommend to get started with the [SEDE tutorial](http://data.stackexchange.com/tutorial) which is written by [Monica](https://meta.stackexchange.com/users/162102/monica-cellio). The [SEDE](https://meta.stackexchange.com/questions/tagged/data-explorer?sort=votes&pageSize=50) tag on MSE is pretty filled with loads of queries and beyond the [schema documentation](https://meta.stackexchange.com/questions/2677/database-schema-documentation-for-the-public-data-dump-and-sede) you'll find one post where I have done an [ERD](https://meta.stackexchange.com/a/250439/158100).
Comment: Thanks.  How shall I learn to use SEDE? One part I need to be familiar with T-SQL. The other I need to learn about the schemas of the tables in the databases available in SEDE. Correct? How would you approach the two parts? For example, nice books to learn T-SQL (I am more familiar with postgresql)? links to schemas of the tables ?
Comment: It is indeed a word but spelled differently. I happend to know the equivalent German word so I looked it up. Here's the result: https://dict.leo.org/englisch-deutsch/anonymisiert -> anonymized


How long can I stay in New Zealand if I'm applying tourists visa

Question: I need to visit my bf in NZ so I'm applying for tourists visa
Comment: If you plan to live with your boyfriend, also look into what is needed to immigrate, as you may find it easier to do so when you set out to do it from the start.
Comment: There seems little point in applying for a visa right now, given that it's uncertain when New Zealand will lift entry restrictions https://www.iatatravelcentre.com/international-travel-document-news/1580226297.htm
Comment: Firstly, you'll find it difficult to get to New Zealand at present: there are only a handful of international flights arriving and they're mostly carrying freight. Secondly, all international arrivals are required to spend two weeks in a government mandated quarantine facility before entering the country. This requirement will remain in place for the foreseeable future - possibly until a coronavirus vaccine is available.
Answer: From the New Zealand Immigration web site:

You can visit New Zealand as a genuine tourist for up to 9 months in
  an 18-month period.

The 18-month period is calculated backwards from the last day you intend to be in New Zealand.
If the last day you'll be here is 1 December, then your 18-month period will begin on 1 June of the year before.

You can apply for another 3 months' stay and extend your stay to 12
  months in a 24-month period, if:

you need more time to complete your tourist itinerary
you can't leave New Zealand for reasons beyond your control
you've applied for residence for the first time.

To apply for another 3 months' stay, you must have financially
  supported yourself and not worked, studied or been sponsored during
  your stay.
If you've recently visited New Zealand for a total of 12 months, you
  have to remain outside New Zealand for 12 months before you can apply
  for another Visitor Visa.

Of course it is a bad idea to apply for a visa and ask for the maximum allowable time unless you have very strong personal circumstances. If they believe you cannot support yourself for your intended duration of stay, or that you intend to work in New Zealand, your visa will likely be refused.
Comment: @Hanna You should read that web site for all the details; it has the answers to most of your questions, including that one. Yes, you need an onward ticket.
Comment: Do I need a return ticket with me? I'm planning to stay until 9 months straight. If that possible?

How long can I stay in New Zealand if I’m applying tourists visa


"eldest" vs. "firstborn"

Question: A family genealogist discovered that his grandparent who was believed to have had six siblings actually had two more who had died very young; one died a few days after birth.  The firstborn died at the age of one year old.  My cousin referred to this firstborn as "the eldest".  I found it jarring to hear someone who died at the age of one called "the eldest".  Is that normal usage and am I out of line?  Or does "eldest" actually mean that one has reached an age greater than the others in his/her group?
Comment: I have done a lot of family history research myself, and prior to the twentieth century it was rare for all children in a family to survive their first few years. But I see nothing wrong with using the term *eldest* for the one you mention, though if it offends anyone - by all means use *firstborn, second-born etc*.
Comment: I would agree with you: it sounds odd to me too. _Eldest_ does indeed mean that someone has reached an age greater than others in their group at some point during their lifetime. They may well have died sooner than the others in the group, but there should be a period of time when the others in the group looked upon this person as the oldest in the group. In this case, the firstborn was never anything but an only-child: by the time the second child came around, the firstborn was no longer alive.
Comment: This is all different if we're talking about groups that we ourselves are part of, though: "My oldest/eldest brother died when he was only two months old" would be all right to me, for some reason, even though "They had three children, of which the eldest died when he was only two months old" is strange-sounding.
Answer: I checked the Wordnik page, which said:

from the GNU version of the Collaborative International Dictionary of English
adj. Oldest; longest in duration
adj. Born or living first, or before the others, as a son, daughter, brother, etc.; first in origin
from The Century Dictionary and Cyclopedia
   Oldest; most advanced in age; that was born first: as, the eldest son or daughter.
from WordNet 3.0 Copyright 2006 by Princeton University
n. the offspring who came first in the order of birth
adj. first in order of birth

So, evidently, there's some precedent for the word being used either way.
I also found this interesting usage in a 2002 biography:

I hardly remembered Rolland, either. He was the eldest but died when he was twenty-two, a couple of years after his mother's death. I was a grown woman, with children of my own...
Source: Moving Out: A Nebraska Woman's Life by Polly Spence, 2002

"eldest" vs. "firstborn"


Why does Skyrim crash during the second half of the Waking Nightmare quest?

Question: Skyrim crashes whenever I try to save during the second half of the Waking Nightmare quest in the Nightcaller Temple.  Is there anything I can do about this?
Comment: Which second half?
Answer: I encountered this bug recently as well, and in fact you do not need to complete the quest without saving (and good thing too, I was pretty underlevelled for it).
All you need to do is make your way outside and save there. This seems to clear out whatever it is that was causing the game to crash, and allows you to complete the quest with quicksaves:

Immediately after the Dreamstride, pull the soul gem that's powering the barrier out of the sconce its in. This takes down the barrier to the previous part of the temple.
The NPC Priest of Mara comes through the now clear corridor and blathers at you for a little bit about how amazing you are.
Run past him, up the stairs and out of the temple to Skyrim proper.
Save your game while standing outside of the temple - can be a quicksave or a full save, doesn't matter.
Go back inside the temple and complete the quest. You will be able to save.
Comment: @SteveV. I can't speak to all platforms as I only have the PC version. However, the UESP Wiki (as posted by @galacticninja) indicates that it applies to Xbox 360, and the PS3 version requires you exit the temple once before the dreamstride and once after.
Comment: Does this apply to all platforms?
Answer: Update: This issue has been fixed by the v1.9 patch.

Fixed a rare crash when attempting to save your game during "Waking Nightmare"

From the UESP wiki's "Waking Nightmare - Bugs" article:

As of patch 1.8, saving during or after the Dreamstride portion of the quest will cause the game to freeze on consoles or crash to desktop on PC.

To prevent this, avoid saving during this quest, and disable autosaves as well.
(PC) (Xbox 360) Alternatively, after removing the barrier to speak with Erandur, simply leave the dungeon to go outside (in icy Skyrim), save outside, re-enter, and you should be able to save again normally.
(PC) As the bug originates during the Dreamstride, use the console command tcl, cross through the barrier, and remove the soul gem. Since the quest progress is scripted through the status of the soul gem, this will progress the quest just as if you had used the Dreamstride. The only impact it will cause on the game is that there will be no enemies except two orcs in the dining room, Torek and Veren.
(PS3) The least complicated method to avoid this bug is to exit to the outdoor before and after the dreamstride. Exiting before the dreamstride will enable you to do it again after the dream, or else you will not be able to exit the temple at all.
(Xbox 360) Using Ethereal shout may allow player to cross barrier, similar to PC console commands, with the same results. Saves work normally after this.
Comment: Thanks for giving a detailed answer, including the platform-specific quirks.
Answer: Nothing worked for me. Finally I found working solution! You just need to keep pressing F5 (quicksaving until crash). After load you can save without problems. Here is quote how to do that:

After you pull chain to release the miasma, you are transported back
  to the real world, able to move around but unable to interact with
  anything (can't use the "Activate" action, the "E" key on the PC). Get
  ready to spam Quicksave (F5).
As soon as the blur effect on the edges of the screen starts to
  dissipate, hit the Quicksave button repeatedly and rapidly, severely
  slowing the game down. You should hear the player character cough/gasp
  once, apparently awakening from the dream. Continue Quicksaving.
Your character should cough/gasp a SECOND time. Keep quicksaving.
  Shortly after the second cough/gasp, the game will crash during one of
  the save attempts.
Load up the game again, then just click "Continue" or load up the most
  recent quick save, as the junk one that was created during t he crash did not overwrite the good one. You can now make more saves without issues.


Where does the force tangential to Moon's orbit come from?

Question: Not sure if I'm correct, but as far as I know, while moon is revolving around, it is unable to reach the Earth because the Earth's gravitational force isn't strong enough for that. This presumes that the moon has a force at a tangent to its current orbit. Since the moon doesn't decelerate or come closer to Earth, it seems to me that this force is continuously applied. Where does this force come from?
I am likely extremely wrong about this, but please don't downvote this question out of existence before it gets answered (unless a similar question has already been answered before).
Comment: Related: [Why doesn't the Moon fall onto the Earth?](https://physics.stackexchange.com/q/9049/2451)
Comment: You may have a common misconception.  Due to inertia, objects moving at constant velocity must necessarily have zero net force acting on them (aka, Newton's 1st Law).  It doesn't take any force to keep an object moving at constant velocity.
Comment: @user318702, assuming that the moon is in a circular orbit, the tangential velocity of the moon is unaffected by gravity because gravity is acting at right angles to that tangential velocity.  Accordingly, gravity continuously changes the direction of the moon but it doesn't change the altitude of the moon.  This means that if the gravitational force on the moon suddenly stopped, the moon would fly off in a straight line, never to be seen again.
Comment: @DavidWhite I know that, however, the gravitational force of earth gets applied on the moon continuously. If the force on moon stopped, the gravitational force would slowly make the moon come closer to Earth and it'd eventually crash to the earth.
Comment: @DavidWhite I see. So, if a force acts perpendicular to a moving object, it doesn't affect its velocity?
Comment: @user318702, a force that always acts perpendicular to the direction of motion is a centripetal force.  That force changes the direction of an object, but it doesn't change the tangential velocity of an object.  Only a component of force that is parallel to the direction of motion will change the velocity of an object.
Answer: There is no force tangential to the Moon's orbit.  Instead, there is what's called a centripetal force pulling the Moon in towards the Earth.  Now if the Moon weren't moving, then it would simply fall to the Earth.  However, the Moon is moving around the Earth, so we must take this into account.
Now forces only accelerate or decelerate things in the direction they act.  Let's look at the situation where the moon is moving up.  It has a force to the left (top diagram).  This means we get some more velocity added to the left, and indeed the Moon will start "falling" towards the Earth.  However it's still moving up, as there have been no forces acting to change the upwards velocity.  The net effect is (instantaneously) the Moon's speed is "nudged" a little to the left (bottom diagram).  This process keeps happening in little steps, and the net effect is for the Moon to go in a circle around the Earth, with the force always perpendicular to the velocity.
Comment: I lied a bit when I said there's no tangential force on the Moon, there *is* a little which actually slows the moon down, and causes it to move away from the Earth by 4cm per year, but this comes from the tides and has nothing to do with the basic orbital mechanics going on here.
Answer: Yes, there is a constant force transversal (i.e. sideways) to the radial vector to the Moon. The reason is: Earth's rotation drags the tidal bulge faster than the angular velocity of the Moon around Earth. So the bulge rotates "ahead" of the Moon. Because the bulge causes an additional gravitational force, the Moon "sees" a gravitationals force with a small sideway component, which causes the sideway acceleration, which in turn causes a small but steady increase of its orbital radius.
Answer:
This presumes that the moon has a force at a tangent to its current orbit.

This statement is incorrect. You are assuming that a force is needed to keep up motion. But if you throw a stone from your spaceship in empty space, then that stone will keep flying at the velocity you gave it forever without any forces acting. This is due to Newton's 1st law.
So, think of the moon as an object moving through empty space with no force acting. Which ever speed it has from the beginning, it keeps without a need for a force. It is just flying straight ahead.
Suddenly, Earth appears and start pulling via gravity.

If it appears in front  (or behind), then gravity pulls along with (parallel to, tangential to) the moon's velocity. This will cause an acceleration along with the velocity which will change the speed (speeding up or slowing down).

If it appears next to the moon, then gravity pulls sideways (perpendicularly). This will not provide a parallel acceleration component, so there will be no speeding up or slowing down. Instead, this will cause a sideways, perpendicular acceleration which will cause curving or turning.

If Earth appears in front and a bit to the side, then gravity will pull at an angle - not parallel or perpendicularly, but a bit of both. It will cause both of the above components and thus cause both speeding up and curving. This is what we see in elliptic orbits.

Now, in the special case of a circular orbit, gravity happens to always pull perpendicularly. Not tangentially. The gravitational force "turns" along with the curving motion of the moon so that it is always perpendicular. Thus gravity cannot cause any speeding up or slowing down. The speed that the moon happens to have to begin with, it keeps.
So, there is no need for any tangential force to keep the moon moving. Because there is no force slowing in down (ideally). There is only a force turning its path. That is all.


I have been having an issue with proportional editing

Question: proportional editing tool stops working after making size adjustments to the doughnut in tutorial 2. it was working then just stopped I tried to reset to default didn't work so I uninstalled then did a fresh install but nothing helps. here is a link to a video showing what is happening https://www.youtube.com/watch?v=-b2pGRT1XTk
Answer: It's a bit hard to tell what's going on ... (We can't read your mind, what is 'the doughnut in tutorial 2.'?).. but 2 points might help.

G and GG are different operations. G is Grab, a free translation in screen space. GG is Vertex Slide, which will slide selected vertices down adjacent edges. G can be proportional. Proportional Editing has no effect on GG.
When editing proportionally, you should be able to see a circle in the viewport representing the radius of the falloff. If you can't see it, and the whole object moves, the falloff is large enough to encompass all the object's vertices, and may be so large it is off-screen. Try using the scroll-wheel to bring it down into view.


Asynchronous Character Creation?

Question: So in the Dresden Files RPG, character creation is meant to happen collaboratively in a unified manner.  However, in our party, there are frequently times where one player or another cannot make it on any given day.  How bad is it to miss 'character creation day'?  Is there a way to seamlessly integrate 'new' characters (generated at a later date) with 'existing' characters (generated on the first day)?  What method should be used in this circumstance?
Comment: Are you going to have to deal with frequent absences during the game also?  Though a different question, there are definitely some tips that I've found with dealing with working/busy players.
Comment: As a side note, players who want to really experience role playing need to be able to adapt their characters to other characters they didn't anticipate. Considering that sometimes the GM gives you a character you're "stuck with" for a significant portion of the campaign, this shouldn't be all that different.
Answer: Our characters were actually not created collaboratively in my current campaign, and I didn't see a difference.
A couple of pointers that I could give from my experiences:

Discuss the characters that will be created in advance, and have them draw up at least a skeleton of the character if possible- perhaps having the high concept already in place.
As GM, have those characters not there in mind as you discuss the characters that are there, and act as proxy.
Have a couple of character creation sessions to cover the absences, all before the game starts.
You might want to have a couple of City creation sessions also.  The players are meant to have input into the creation of the city, and giving everyone this opportunity will give everyone buy in.
When creating the city, have the absent characters in mind to add hooks and stickiness for them when they are present.

If done in this way, there won't be as much in the way of integration, as the campaign will not have truly started when any are created.  However, if you do need to integrate a character after the fact, using the hooks that already existing characters have or places/faces that have been created as anchors for these new characters can help make the group gel even though they weren't all created together.
Answer: I will point out that it's entirely possible to generate characters "in play" with Fate, and  it's also mentioned in DFRPG. (Looking it up, p. 69.)
Do the collaborative for those who can, and then you can legitimately just hand a character sheet and have the guys who missed start filling in during play, while they play. (If you can trust them not to cheat, at least.) You can even have others work in backstory bits in play.
If you want the full "CGen Experience," you just have the others volunteer for the slots on the character sheet of those showing up later in the campaign.
Answer: You would definitely benefit from making sure some discussion goes on before the game begins. Let them discuss whether they know each other and discuss the stories from their phase of character creation and work out those last couple aspects and make connections. Even if you won't have everyone know each other, it can help bring the group together without wasting time on a bunch of "I don't know you" nonsense if you can play the Kevin Bacon game and hit everyone.
For characters introduced much later let the group decide what would be best for the story. Just because Newbie Ned hasn't been around the last 8 sessions doesn't meen he didn't guest star in Joe or Jane's first story somehow so now instead of random stranger he's "Hey it's that guy." If you don't then Newbie Ned may have 2 blank aspects.

Asynchronous Character Creation?


Changing Auth's Model on the fly

Question: I used config::set('auth.model','App\Fblogin') and fetched config::get('auth.model'); It seems to update the value just fine, but when I try to Auth::logInUsingId() it seems like it's still using the default App\User. So what do I do so I can use the App\Fblogin on my controller?
Comment: It's possible that you are not overriding the config file early enough in the app lifecycle. Different things are executed and requested throughout that app at different times. See http://laravel.com/docs/5.1/lifecycle for more details. Likely, you will want to override the config no later than in your `app/Providers/AppServiceProvider.php` boot or register methods. Otherwise, the auth model is likely to be used before being overridden.
Comment: please explain in your question where and how you are setting the auth.model value. The lifecycle of laravel is very specific and requires you to explicitly overrule the behavior at the correct moment.
Comment: yes, like @Luceos said, some code samples would help fixing your problem. I hope you (or somebeody in your dev team) are not _caching_ your configurations.
Answer: If you're using Laravel 5.1.11 or higher, use this:
auth()->getProvider()->setModel(App\Fblogin::class);

If you can't/won't upgrade, I'm afraid there's no easy way to achieve this.
The model is resolved through the EloquentUserProvider. The model class used is set in the constructor, which cannot be changed at runtime because the property is protected.
You can either extend the EloquentUserProvider, or you can cheat and set it:
function set_auth_model($model) {
    $closure = (function ($model) { $this->model = $model; });

    $closure = $closure->bindTo(Auth::getProvider());

    $closure($model);
}

set_auth_model(App\Fblogin::class);

But really... just upgrade.
Answer: This may be possible but you'd have to try this out. You can set up your own Auth driver, which simply extends the default laravel auth driver but modifies it a bit. You can do this through a provider for instance. In the boot method of the provider you'd say:
    $this->app['auth']->extend('my-auth', function ($app) {
        return new Guard(
            new MyUserProvider($app['hash']),
            $app->make('session.store')
        );
    });

Note we're no longer passing the model through the constructor. We'll handle that differently.Your MyUserProvider class extends EloquentUserProvider. We override the createModel method to our own version, which instead of using the constructed model name, gets the model name during runtime.
class MyUserProvider extends EloquentUserProvider
{
    public function __construct(HasherContract $hasher)
    {
        $this->hasher = $hasher;
    }

    public function createModel()
    {
        $class = app()->config->get('auth.model');

        return new $class;
    }
}

I havent actually tried to see if this works, but you can probably get this to work using this method.

Changing Auth's Model on the fly


How do I deal with acne on my back?

Question: I have a lot of acne on my back and some always burst and bleed. I find blood on the back of my shirt almost every day.
Answer: Anecdotal evidence is not credible. Although other peoples' answers (on this question and elsewhere) may have worked for them, the fact is everyone is different and will react differently to different home remedies and/or medications/diets.
Acne is studied by many and there is great controversy over root causes and cures. Some people spend their entire life trying to find a solution, whether they're diets, pills, creams, home remedies, etc...
The best advice I have is to see a dermatologist. There is no one with more experience than them, and only they will truly be able to tell what your issue is.
Comment: If your only answer is "See a doctor", then instead of answering you should vote to close as being off topic.
Answer: I have the same issue: bacne and this is the advice I got from a doctor. This is a multi-pronged approach, one part is changing your diet.

Do not expect a pill to solve all your problems. Take personal responsibility for changing your habits.
Avoid all processed sugar. For the most part this is impossible for most people. But I still give the advice and it should still be a goal. Sugar is not good for you in the quantities people eat today because there is so much hidden sugar.
Change your shirt every day. Do not wear it twice. Wear it once then wash it.
Get a OTC soap at the pharmacy/chemist that has 10% benzoyl peroxide. From my doctor.
Wash your back with that every day.
Avoid eating greasy fried foods. Some people find this helps.
Eat more fiber. It's critical to support the good bacteria in your gut and overall balance of the body. Google "microbiota" in your gut.

Benzoyl Peroxide from Wikipedia.
WebMD link
541,000 links from a Bing search
Comment: This may or may not be good advice, do you have any references other than "My doctor said"?
Comment: See my edits above.

How do I deal with acne on my back?


What will be removed if I sync my device with another iTunes?

Question: I had to blow my old iTunes installation. I have all my music and a up to date backup, but I still want to sync my device to change some content. iTunes warns me that "the content of the iPhone will be deleted". What is "content" here? Does it include contacts, messages, apps? Or is just music, books and pictures?
Comment: I'm not sure about that warning, as I have done this and I didn't loose anything. It would be helpful to know if you have a current backup still on your computer as well as what type of computer you have (Mac/PC).
Comment: @IronCraftMan I haven't sync the phone yet. I need to know what exactly will be deleted so I can do a effective back up. I don't think having a Windows system matter.
Comment: You should be able to plug your phone into your computer, and be able to click "Backup Now" without having to sync it.
Comment: @IronCraftMan that's not my purpose... I know how to do a backup, I need to know what will be deleted once I hit the "synchronize" button.
Comment: I don't know. As I said I didn't have anything deleted, and I made sure I had all my music, TV Shows, etc. before pressing that button; and I didn't loose anything. As long as you have a backup, you should be fine.
Answer: The answer depends on how your phone is configured for synchronization.  Note: If you back up your content from the phone to the local new computer first, then though some data will be erased, it will then be copied right back on to your device.
Entertainment files:
In most all situations, your music, movies, podcasts, books, and TV shows will be lost as they are replaced with information from the new computer. Apps will usually be preserved.
Contacts and calendars:
If your contacts and calendars are being synched through a cloud service, like most people today, your contacts and calendar data won't be lost. If your contact and calendar data is being synched locally through the computer directly, then yes, it would be lost and replaced with the new local data.


Maximum of independent Erlang random variables?

Question: Suppose $Y=\max\{X_1, X_2,\dots,X_N\}$ where all $X_i$ are independent and  follows Erlang distribution. I know that extreme value theory deals with maximum of random variables. Can anybody tell me, hopefully with reference, $Y$ will follow which extreme value distribution (Gumbel, Weibull or Frechet) ?
Answer: If you mean the Erlang distribution with density
$$f(x)={\lambda^kx^{k-1}e^{-\lambda x}\over(k-1)!}$$
for parameters $\lambda>0$ and positive integer $k$, then the max of $N$ independent Erlangs has an exponential tail, so the Erlang belongs to the domain of attraction of the Gumbel distribution.
To prove this, see this CrossValidated post, which states a sufficient condition for the max to converge to Gumbel. It appears that the Erlang satisfies this condition.
Answer: We can consider Erlang distribution as a example of PH-distribution (phase type). This way allows to use  matrix representation for PH-distribution and closure properties for one. For instance, the maximum $X_{max}$ of two PH random variables $X_1$ and $X_2$ has PH distribution.