text:
Q: how to retrieve an object inside a vector in c++ I'm a C++ noob programmer... (I usually use Java) and now I've got some problems with pointers, references and vectors...
I need to extract an Object from vector<Object> objects and for simplicity i would like to store his reference in another object cause I need to edit some parameters inside of it many times
this is the code i've written so far:
Object myObject = getMyObject(id, objects);

and getMyObject simply implements a for cycle which finds the right object with the right id and it returns it with return objects[i]
but if I understood right, this method duplicates the objects! so, in myObject there's a completely different Object, is it right?
How should I do??
Thank you very much!

A: Yes, you need to use either a pointer or a reference, otherwise the line you showed will call the copy constructor of Object.
You can make getMyObject return Object*, and then you've got a pointer to the object and you can assign it to another Object*.
Alternatively, define myObject as a reference: Object& myObject.
Anyway you must make sure the object you're returning is allocated dynamically and not as a local variable in getMyObject(), because otherwise you'll get an access violation.
You also must make sure the object is freed in order to prevent a memory leak.

A: If you don't want to duplicate the object, then you need a reference or pointer to it.  The problem with this is that the reference or pointer can easily become invalid.  If you don't want that to happen, then you should store pointers in your vector.  Specifically for this case, you would most likely want shared_ptr.
std::shared_ptr<Object> getMyObject(foo id,
    const std::vector<std::shared_ptr<Object>> & objects)
{
    // ... find object
    ...
    return objects[i];
}
...
std::vector<std::shared_ptr<Object>> objects;
objects.emplace_back(new Object(parameters));
...
std::shared_ptr<Object> x = getMyObject(id, objects);

A: You're right. What you should do is have the get function return a reference:
Object & getMyObject(int id, std::vector<Object> & objects)
{
    // ... find ...
    return objects[i];
}

Then bind this to another reference in your user code:
Object & theobject = getMyObject(12, all_objects);

Now you modify the contained element directly via the reference theobject.
If you don't want/need to modify the object, just inspect them, you should make the reference (as well as the container) const:
Object const & getMyObject(int id, std::vector<Object> const & objects);

A: Keep in mind that STL always copies unless specified otherwise. However, vector's at() as well as operator[] both return a reference.
You need
Object& myObject = objects.at(id);

if you want to change the objects which is inside the collection.
Object myObject = objects.at(id);

will give you a copy.

A: Store pointers to the original objects in the container instead.
Object* obj1 = new Object();
Object* obj2 = new Object();

vector<Object*> myVector;
myVector.push_back(obj1);
myVector.push_back(obj2);

Object* tmpObj = myVector.at(0);


text:
Q: Delete a device from my developer account to increase the count Is it possible to delete a device to increase the device count in my Apple developer account?

A: No. Deleting a device DOES NOT (immediately) increase your available device count. You have to wait until your apple developer account has been renewed, then visit the provisioning center and tap on devices.
You will see a message like this;

This is your ONE AND ONLY opportunity for the year to prune your device list. Click the devices you want to remove and tap on 'remove selected' at the bottom of the screen. Note that as soon as you (or another member of your team with sufficient rights) adds a device - INCLUDING AUTOMATICALLY PROVISIONED ones, you lose the ability to delete any more for the rest of the year (you can tell I'm speaking from experience here can't you?)
It's probably therefore better to remove lots in one go if you are getting close to the limit (and don't forget new devices launching each year etc) and then put back any that turn out to be needed.

A: Critical piece of information that is not clear in Apple's documentation.  The button to actually remove certain old devices actually becomes available the morning AFTER your renewal. The actual payment happens before the renewal and renewal doesn't actually happen until midnight of the expiration as far as I can tell.   Disabling doesn't do anything or have anything to do with the deletion process other than to not preselect the device on the day when you can actually delete.
Disable DOES NOT EQUAL Delete

A: You can only Disable the device.
Note that by disabling the device the count remains same until the account membership is renewed.
Below steps for Disable the device :

*

*Go to Certificates, Identifiers & Profiles

*Go to Devices list (All or specific device i.e. iPhone, iPad)

*Click on device name. If the device list is too long then you can search using search option present on top right corner

*Click on Disable button

*Note that once you Disable the device then all the provision profiles associated with it will become invalid. The device will be removed from your account only when your membership is renewed.

A: yes, but number of devices will be refreshed after renew developer subscription

redpajama_set_name: RedPajamaStackExchange


text:
Q: Kext driver cannot find symbol OSPrintBacktrace I'm using the following function when one of my iokit commands is being called. it defined in
extern void OSPrintBacktrace(void);

however, my kext seems that my kext fail to load since it couldn't find this symbol..
 12/26/16 10:02:53.000 AM kernel[0]: kxld[com.my.driver]: The following symbols are unresolved for this kext:
 12/26/16 10:02:53.000 AM kernel[0]: kxld[com.my.driver]: _OSPrintBacktrace

although it does exists in kernel binary
 nm /System/Library/Kernels/kernel  | grep OSPrintBacktrace
 ffffff8000837290 T _OSPrintBacktrace

Can anybody tell me what am i missing here ?

A: The function OSPrintBacktrace is not part of any of the (public) KPIs. OSReportWithBacktrace is however (libkern), so you're probably best off using that. Alternatively, you can also use OSBacktrace.


text:
Q: Add Sum total of Products in a Cart I have a rookie problem, and that is adding the sum total from an object (Cart) in my cart page before I go check out.
Every time I navigate from one screen to the other the amount keeps going up
I want the total amount to be 159, or the correct amount if i add more products
SourceCode

A: Try to replace this piece of code:
this.cartItems.forEach((value, index) => {
    this.totalAmount += parseInt(value.amount);
});

with this:
this.totalAmount = this.cartItems.reduce((acc, item) => {
    return acc += item.amount;
}, 0);

In the first case you add a new value to already existing value. And in the reduce version it should rewrite the totalAmount.

A: Complete working example find out here in this StackBlitz Link
You just need to calculate cart amount using reduce() array function.
this.total = this.cart.reduce( (acc,curVal) => {
    return acc + (curVal.amount * curVal.quantity);
     //this.temp.push( curVal.amount * curVal.quantity);
  },0)


text:
Q: Ruby on Rails add new line between two #{string} I've a text attribute for a model named :settore_scientifico_progetto and three string attributes, :macrocat, :cat, :microcat:
class Modulo1 < ActiveRecord::Base
  before_create :set_settore_scientifico_progetto
  before_update :update_settore_scientifico_progetto

  private
  def set_settore_scientifico_progetto
    self.settore_scientifico_progetto = "#{macrocat}\n#{cat}\n#{microcat}"
  end

  def update_settore_scientifico_progetto
    self.settore_scientifico_progetto = "#{macrocat}\n#{cat}\n#{microcat}"
  end

I'd like to put a new line where I typed \n but the code I posted gives me the output
macrocat cat microcat.
I would like it as follows:

macrocat
  cat
  microcat

The output is shown in show.html.erb:

Settore scientifico:

<%= @modulo1.settore_scientifico_progetto %>

A: Rails has a helper specifically for this purpose called simple_format.
<%= simple_format @modulo1.settore_scientifico_progetto %>

This will output the following HTML:

macrocat

  cat

  microcat

Which is rendered by your browser like this:

macrocat
  cat
  microcat

That seems to be exactly what you're looking for, and it takes care of sanitizing your HTML for you. (Options for customizing the output, e.g. changing the wrapping tag or HTML attributes, are listed in the docs.)
P.S. Using the gsub...html_safe method advocated above is very risky. If your app accepts user input for any of the attributes you're printing, calling html_safe on those values means they won't be sanitized by ActionView and a malicious user could inject code into the view that makes your app vulnerable to cross-site scripting (XSS) attacks. Here's a good primer on the ins and outs of html_safe in Rails.


text:
Q: Open jsPDF created pdf in Chrome's new tab/window How can I open with javascript link data:application/pdf;filename=generated.pdf;base64;DATA in Chrome 71?
Link from console opened successfully, but not from code - unfortunately.
The snippet does not work for security reason. Only for code demonstration.
I read some similar questions, but did not find an answer.

var button = document.getElementById("button");

button.addEventListener("click", generate, false);

function generate() {

  var doc = new jsPDF({
    orientation: "l",
    unit: "mm"
  });

  doc.text('ACT', 130, 20);
  var string = doc.output('datauristring');
  console.log(string);
  var link = document.createElement('a');
  link.href = string;
  link.setAttribute('target', '_blank');
document.body.appendChild(link);
  link.click();
  link.parentNode.removeChild(link);
}

<button id="button">Generate pdf table</button>

A: It's actually very easy, don't complicate things..
window.open(URL.createObjectURL(doc.output("blob")))

or a more verbose and less efficient version:
let newWindow = window.open('/');
fetch(doc.output('datauristring')).then(res => res.blob()).then(blob => {
    newWindow.location = URL.createObjectURL(blob);
})

(You need to open the new window immediately after the onclick or Chrome will block the popup. This solution is not as good because there is an unnecessary conversion from datauri to blob)

A: This code works for me
  var doc = new jsPDF();
  doc.setProperties({
  title: "new Report"
  });
  doc.output('dataurlnewwindow');

A: Try window.open() instead. The following code worked for me. You will need to modify the window/page size.
let dataSrc = pdf.output("datauristring");
let win = window.open("", "myWindow");
win.document.write("<title>jsPDF</title><embed src=" +
    dataSrc + "></embed>");

Update:
Didn't realize that jsPDF comes with a built-in method pdf.output('dataurlnewwindow');, which uses iframe,
The downside of pdf.output('dataurlnewwindow') is that it opens a new tab/window with datauristring as the pdf file name and the download button doesn't work, while window.open(pdf.output('bloburl')) seems fine with the download button.
Okay, pdf file can be renamed like this:

pdf.setProperties({
    title: "jsPDF sample"
});

Update 2:
To avoid the page being cut off when a page is zoomed, you can set the html2canvas scale accordingly.

A: I run code from the question in the local machine and take this error:

Not allowed to navigate top frame to data URL: data:application/pdf;filename=generated.pdf;base64,...

JsPDF - Not allowed to navigate top frame to data URL
I tried the suggestion @WeihuiGuo. Unfortunately for me.
I found than Chrome automaticaly open pdf.

https://support.google.com/chrome/answer/6213030?hl=en
https://groups.google.com/a/chromium.org/forum/#!topic/chromium-bugs/z5hA0H6LFws

And not only for the new tab. Not opened on the current page too.
https://sphilee.github.io/jsPDF-CustomFonts-support/

In other browsers this page display correctly.

Such sad news.

A: You're generating a PDF from its raw data using Javascript. Why not use a reader like Adobe to render it? That is what is happening when you are clicking the link from the console. You could literally just open the link and it will open as a PDF. I think you are possibly over complicating this task.

A: Just try this..it will work
var doc = new jsPDF({orientation: 'landscape',unit: 'mm',format: 'a4',putOnlyUsedFonts:true})
var burl = doc.output('bloburl');
console.log(burl)
var win = window.open(burl)
win.print()


text:
Q: atoi only returning first digit of char* parameter When running my program with parameter 15, atoi returns 1.  Atoi only returns the first digit.  Is this supposed to happen?  How to I get around it?
int _tmain(int argc, char* argv[])
{
    int a = atoi(argv[1]);
}

A: It should convert the entire NUL-terminated string:
#include <iostream>
#include <stdlib.h>

int main() {
    std::cout << atoi("15");
}

result:
15

A: Changing from _tmain to main fixed the issue.


text:
Q: cant' Drag and Drop for Design Systems After update the android studio I am enable to use material designing. but I can't user any UI element in drag and drop mode. mouse curse shows in halfly cutted black circle

A: the new version of android studio uses 2 xml files for each layout. One (e.g. content_main.xml) embedded in the other one (Activity_main.xml). you should open the content_*.xml and do the design in it. hope it helps.


text:
Q: MATLAB MEX interface to a class object with multiple functions I am using the MEX interface to run C++ code in MATLAB. I would like to add several functions to MATLAB for handling a System object:
sysInit()
sysRefresh()
sysSetAttribute(name, value)
String = sysGetAttribute(value)
sysExit()

Since each MEX dll can contain one function, I need to find a way to store the pointer to the global System object which will exist until deleted by a call to sysExit.
How can I do this in MATLAB properly? Are there any ways to store global pointers across calls to MEX functions?

A: One common approach is to have several m-file functions that provide the public interface, e.g. sysInit.m, sysRefresh.m, etc.
Each of these m-files calls the mex function with some kind of handle, a string (or number) identifying the function to call, and any extra args.  For example, sysRefresh.m might look like:
function sysRefresh(handle)
return sysMex(handle, 'refresh')

In your sysMex mex function, you can either have the handle be a raw heap pointer (easy, but not very safe), or you can maintain a mapping in C/C++ from the handle ID to the actual object pointers.  This solution requires a little extra work, but it's much safer.  This way someone can't accidentally pass an arbitrary number as a handle, which acts as a dangling pointer.  Also, you can do fancier things like use an onCleanup function to release all memory and resources when you unload the mex function (e.g. so you don't have to restart matlab when you recompile the mex function).
You can go a bit further if you like and hide the handle behind a Matlab class.  Read up on the OO features for Matlab in the docs if you're interested.  If you're using a recent version, you can take advantage of their much cleaner handle objects.

A: Alternatively, you may get away with not using MEX at all.  In matlab (on Windows) you can load any generic dll with loadlibrary and call any of its functions with callib.  This is probably not portable across operating systems, though.


text:
Q: Download a pdf in android and show in the app Actually I know how to open a pdf file from assets folder in android app.But now I want to download a pdf from url and store it on sdcard.when the pdf is downloaded it show in the app.Once the pdf is downloaded then "view" will show other wise it shows "download"

A: If you encounter any issues with the pdf download here is the link:
android download pdf from url then open it with a pdf reader
If you have already done this then you can simply create a SharedPreferences boolean to store weather true if you successfully completed the download process or false if you didin't download it or removed the pdf. Once your app will start check everytime the boolean value and display view or download according to it's value.
Documentation for shared pref: Android Shared preferences example


text:
Q: Determining type in a functional language In a small Program users insert multiple typed formulas and wire them together in order to create a system of simultaneous equations. And I'd like to introduce runtime type checking, so as to report an error if dimensions do not match
Basical the types can be anything, e.g. Persons, Money, Money/Period, m^2/s^2 etc, and are entered as strings at runtime
I read about Hindley-Milner type inference, but thought that it's a bit overblown.
My idea was to rely on two rules:
first tokenize, then
If (a + b) or (a-b) the dimensions must match! [a] = [b]

if a*b then the dimensions are "expanded" or "contracted" in the sense that you keep track of the count of individual dimensions, e.g
Person/Year * Money/Year * Money*Year^2 ===> Money(2) Person(1) Year(2) / Year(1)

then subtract individual counts, thus leaving Money(2) Person(1) Year(1) as final type
this could be implemented as a tree walker, where the dimensional contraints are tested per (+/-)-node
then simplifying tho yield the final answer
Is this a good way to solve this issue?


text:
Q: Random number from Range1 is greater than Random number from Range2 This is essentially a dice roll comparison question, but the range of each dice is not 1 to n, but rather x to n+x-1.
I found this equation to determine the odds that a single roll of a 1d(x) is higher than a single roll of a 1d(y) (assuming x > y) as follows...
1 - (y + 1)/2x
I did not proof this myself, so it may be a bad equation.
My question is, how can I determine the odds that a random number from X1 to X2 is greater than a random number from Y1 to Y2?  I think this is a dice question, I am just not certain how to factor in the offset.
Thanks

A: We will assume that you split ties evenly.  The basic idea is that if both people roll within the overlap of the two ranges, each has a $\frac 12$ chance to win.  If at least one does not roll within the overlap range, we know who will win independent of the other roll.  Let us assume $Y2 \gt X2, Y1 \gt X1$.  Then $Y$ is guaranteed a win when he rolls more than $X2$ or when $X$ rolls less than $Y1$.  The chance $Y$ rolls greater than $X2$ is $\frac {Y2-X2}{Y2-Y1+1}$ because there are $Y2-Y1+1$ possible rolls, of which $X2-Y1+1$ are in the overlap zone.  Similarly, the chance $X$ rolls less than $Y1$ is $\frac {Y1-X1}{X2-X1+1}$.  We can't just add these to get the chance we have a guaranteed winner because we double count the events where $Y$ rolls high and $X$ rolls low.  The chance at least one is outside the overlap zone is then
$$\frac {Y2-X2}{Y2-Y1+1}+\frac {Y1-X1}{X2-X1+1}-\frac {Y2-X2}{Y2-Y1+1}\cdot\frac {Y1-X1}{X2-X1+1}$$
The chance $Y$ wins is this plus half the chance they both roll inside the overlap zone, so
$$\frac {Y2-X2}{Y2-Y1+1}+\frac {Y1-X1}{X2-X1+1}-\frac {Y2-X2}{Y2-Y1+1}\cdot\frac {Y1-X1}{X2-X1+1}+\frac 12\cdot \frac {X2-Y1+1}{Y2-Y1+1}\cdot \frac {X2-Y1+1}{X2-X1+1}$$


text:
Q: Ideal structure of a tensor product of certain algebras I would be grateful if anyone could give me a reference regarding the following question.
Suppose that $A$ and $B$ are two unital prime algebras over a field $F$ whose center consists of scalar multiples of identity (so called central algebras). Assume that both $A$ and $B$ have a unique non-trivial two-sided ideal, denote it respectively by $J_A$ and $J_B$. I'm interested about the ideal structure of a tensor product $A \otimes B$ (over $F$). The obvious non-trivial ideals of $A \otimes B$ are  $J_A \otimes J_B$, $A \otimes J_B$, $J_A \otimes B$ and $J_A\otimes B + A \otimes J_B$. Are there some conditions on $A$ and $B$ that guarantee these are the only non-trivial ideals of $A \otimes B$?
I'm particularly interested in a case when $A=B$ is the algebra of $F$-linear maps on some vector space over $F$ of infinite countable dimension. Then the only non-trivial ideal of $A$ is the ideal  $J_A$ of finite rank maps. Are all ideals of $A \otimes A$ of the above form?

A: Well, i do not know the answer in general but since you are asking for a reference and if

there are some conditions on $A$ and $B$ that guarantee these are the only non-trivial ideals of $A \otimes B$?

There are some related results, for example:
Let $B$ an arbitrary algebra over a field.

Every ideal of the algebra $A\otimes B$, where $A$ is a central simple algebra, is of the form $A\otimes I$, where $I$ is an ideal of the algebra $B$.

This is theorem 4.3.2, p. 74, from the book of Drozd-Kirichenko.
 (although i suspect this may not be of much use for the particular case you are interested in, as explained in the last paragraph of the OP).
Maybe this reference might also be of some interest to you.

A: I think it is true for your example.
By a similar proof as mentioned by Konstantinos Kanakoglou, we have the following fact.

*

*Let $I$ be an ideal of $A \otimes B$. If $I \nsubseteq J_A \otimes J_B$, then $I = J_A \otimes B, A \otimes J_B$ or $J_A \otimes B + A \otimes J_B$.

Now suppose that $A=B$ is the algebra of $F$-linear maps on some vector space over $F$ of infinite countable dimension. For all $0 \neq \sum x_i\otimes y_i \in J_A\otimes J_A$, $x_i,y_i(\in J_A)$ can be seen as endmorphisms of a finite dimensional vector space. Hence $\exists 0 \neq x,y \in J_A$, such that $x \otimes y \in $ the ideal generated by $\sum x_i\otimes y_i$. The ideal generated by $x \otimes y$ is just $J_A \otimes J_A$, then we have

*

*If $I$ is a subideal of $J_A \otimes J_A$, then $I = 0$ or $J_A \otimes J_A$.

So $A\otimes A$ has only four nonzero ideals.

A: I don't think the solution to this problem is as simple as rpz says. In fact, I wrote a short paper about this so, in case if anyone is interested, please check Thm. 3.9 of https://web.math.pmf.unizg.hr/~ilja/preprints/ISTPNSA.pdf


text:
Q: Show multiple images in same window with Python OpenCV? I want to display original image left side and grayscale image on right side. Below is my code, I create grayscale image and create window, but I couldn't put grayscale image to right side. How can I do this?
import cv
import time
from PIL import Image
import sys

filePath = raw_input("file path: ")
filename = filePath

img = cv.LoadImage(filename)
imgGrayScale = cv.LoadImage(filename, cv.CV_LOAD_IMAGE_GRAYSCALE) # create grayscale image

imgW = img.width
imgH = img.height

cv.NamedWindow("title", cv.CV_WINDOW_AUTOSIZE)
cv.ShowImage("title", img )
cv.ResizeWindow("title", imgW * 2, imgH)

cv.WaitKey()

A: First concatenate the images either horizontally (across columns) or vertically (across rows) and then display it as a single image.
import numpy as np
import cv2
from skimage.data import astronaut
import scipy.misc as misc
img=cv2.cvtColor(astronaut(),cv2.COLOR_BGR2RGB)
numpy_horizontal_concat = np.concatenate((img, img), axis=1)
cv2.imshow('Numpy Horizontal Concat', numpy_horizontal_concat)

A: As far as I know, one window, one image. So create a new image with imgW*2 and copy the contents of the grayscale image at the region starting from (originalimage.width,0). The ROI capabilities may be helpful to you.


text:
Q: GWT- DateBox.getTextBox().addValueChangeHandler() not fire event in IE I tried to used DateBox and add a valueChangeHandler to the DateBox.getTextBox().
It works fine in FF, Chrome, but not IE9. The event is not fired even if the value in the textbox is changed.
I tried to just use TextBox.addValueChangeHandler() in IE9, it works as expected.
So the question is that how I can make the DateBox.getTextBox().addValueChangeHandler() work in IE9.
Can anyone confirm this bug? and any ideas to fix it?
Small piece of code to test:
 DateBox dateBox = new DateBox();
 RootLayoutPanel.get().add(dateBox);
 dateBox.getTextBox().addValueChangeHandler(new ValueChangeHandler<String>() {
   @Override
   public void onValueChange(ValueChangeEvent<String> event) {
      Window.alert("event fire");
  }
});

Thanks.

A: Try this  :
    transactionDate.addValueChangeHandler(new ValueChangeHandler<Date>() {
    public void onValueChange(ValueChangeEvent<Date> event) {
        Window.alert(transactionDate.getValue().toString());
    }
});

A: It's a known bug, it will be fixed in GWT 2.6.
Meanwhile you can use this workaround:
dateBox.addValueChangeHandler(new ValueChangeHandler<Date>() {
    Date lastDate = null;
    @Override
    public void onValueChange(ValueChangeEvent<Date> arg0) {
    Date newDate = dateBox.getValue();
    newDate.setHours(0);
    newDate.setMinutes(0);
    newDate.setSeconds(0);

    if (!newDate.equals(lastDate))
    {
        lastDate = newDate;
        doSomething();
    }
}});

https://code.google.com/p/google-web-toolkit/issues/detail?id=4785


text:
Q: vscode: get rid of message in js and ts files: 'exported identifier should have comment or be unexported' In vscode I am not sure when this started or what extension I have installed but lately I see this message 'exported identifier should have comment or be unexported'.
A brief google search leads me to believe that this is from golang syntax checking. But I am using .js files and .ts files. So why is this error shown and how to fix it?
List of extensions installed obtained using code --list-extensions:
abierbaum.vscode-file-peek
adashen.vscode-tomcat
akamud.vscode-theme-onelight
alefragnani.project-manager
alphabotsec.vscode-eclipse-keybindings
Angular.ng-template
arashmidos.kill-comments
asciidoctor.asciidoctor-vscode
bmewburn.vscode-intelephense-client
ChaunceyKiwi.json-tree-view
christian-kohler.npm-intellisense
christian-kohler.path-intellisense
ClemensPeters.format-json
codezombiech.gitignore
cstechnologies.vscode-storybook
ctf0.command-autolink
ctf0.htmlhint
danh42.terminal-file-link
DanLevett.pattern-links
dbaeumer.vscode-eslint
denoland.vscode-deno
developersoapbox.vscode-springboot-snippets
dgileadi.java-decompiler
docsmsft.docs-yaml
donjayamanne.git-extension-pack
donjayamanne.githistory
donjayamanne.javadebugger
DotJoshJohnson.xml
eamodio.gitlens
ebrithil30.vscode-ts-auto-return-type
ecmel.vscode-spring-boot
EditorConfig.EditorConfig
eg2.vscode-npm-script
Equinusocio.vsc-community-material-theme
Equinusocio.vsc-material-theme
equinusocio.vsc-material-theme-icons
eriklynd.json-tools
esbenp.prettier-vscode
FerrierBenjamin.fold-unfold-all-icone
file-icons.file-icons
foxundermoon.shell-format
Fr43nk.seito-openfile
GabrielBB.vscode-lombok
gbenga504.js-docusaurus
georgewfraser.vscode-javac
ghmcadams.lintlens
GitHub.vscode-pull-request-github
GregChamblin.vscode-json-editor
Gruntfuggly.todo-tree
howgraceu.vue-file-peek
humao.rest-client
IBM.output-colorizer
ionutvmi.path-autocomplete
ipedrazas.kubernetes-snippets
ithildir.java-properties
jackfranklin.vscode-go-to-file
JakeWilson.vscode-cdnjs
jkiviluoto.tws
jmrog.vscode-nuget-package-manager
jock.svg
johnpapa.vscode-peacock
jonwolfe.prettier-eslint-formatter
joyous-coder.springboot-extension-pack
k--kato.intellij-idea-keybindings
KabirSarkar.spring-boot-gradle-extension-pack
kboris.jsmm
kisstkondoros.vscode-codemetrics
laurencebahiirwa.deno-std-lib-snippets
loiane.java-spring-extension-pack
loilo.snazzy-light
luchanso.format-me
maptz.regionfolder
marco-pierobon.git-graphy
marcoLee.testfile-generator-for-junit
mathiasfrohlich.Kotlin
mflo999.lintel
mhutchie.git-graph
MicroProfile-Community.mp-rest-client-generator-vscode-ext
MicroProfile-Community.mp-starter-vscode-ext
MicroProfile-Community.vscode-microprofile-pack
mike-co.import-sorter
mintlify.linked
mrmlnc.vscode-apache
ms-azure-devops.azure-pipelines
ms-azuretools.vscode-docker
ms-dotnettools.vscode-dotnet-runtime
ms-kubernetes-tools.vscode-aks-tools
ms-kubernetes-tools.vscode-kubernetes-tools
ms-mssql.data-workspace-vscode
ms-mssql.mssql
ms-mssql.sql-bindings-vscode
ms-mssql.sql-database-projects-vscode
ms-python.python
ms-python.vscode-pylance
ms-toolsai.jupyter
ms-toolsai.jupyter-keymap
ms-toolsai.jupyter-renderers
ms-vscode-remote.remote-containers
ms-vscode-remote.remote-ssh
ms-vscode-remote.remote-ssh-edit
ms-vscode-remote.remote-wsl
ms-vscode-remote.vscode-remote-extensionpack
ms-vscode.azure-account
ms-vscode.azurecli
ms-vscode.powershell
ms-vscode.sublime-keybindings
msjsdiag.debugger-for-edge
MuTsunTsai.jsdoc-link
mwpb.java-prettier-formatter
naco-siren.gradle-language
naumovs.color-highlight
nick-rudenko.back-n-forth
nickdemayo.vscode-json-editor
nilpatel.title
Nixon.env-cmd-file-syntax
Noctarya.terminals
Noctarya.typescript-web-development-extension-pack
onecrayon.theme-quietlight-vsc
oouo-diogo-perdigao.docthis
Owokoyo.cdo-sync
patcx.vscode-nuget-gallery
Perkovec.jsdoc-live-preview
Pivotal.vscode-boot-dev-pack
Pivotal.vscode-concourse
Pivotal.vscode-manifest-yaml
Pivotal.vscode-spring-boot
PKief.material-icon-theme
pranaygp.vscode-css-peek
pucelle.vscode-css-navigation
pverest.java-ide-pack
rbbit.typescript-hero
redhat.fabric8-analytics
redhat.java
redhat.vscode-commons
redhat.vscode-microprofile
redhat.vscode-xml
redhat.vscode-yaml
ricardo-emerson.java-sysout
riccardoforina.storybook-helper
richardwillis.vscode-gradle-extension-pack
richardwillis.vscode-gradle-preview
richardwillis.vscode-spotless-gradle
rintoj.blank-line-organizer
rioj7.html-related-links
robberphex.php-debug
rvest.vs-code-prettier-eslint
ryanmcalister.unotes
Shan.code-settings-sync
shd101wyy.markdown-preview-enhanced
shengchen.vscode-checkstyle
shinworks.jsdoc-view
slevesque.vscode-link
SonarSource.sonarlint-vscode
spmeesseman.vscode-taskexplorer
stephenwassell.light-high-contrast-theme
streetsidesoftware.code-spell-checker
Summer.azure-event-hub-explorer
svipas.code-autocomplete
TabNine.tabnine-vscode
tenjojeremy.open-storybook-story
tht13.html-preview-vscode
tintinweb.vscode-decompiler
Tobermory.es6-string-html
uctakeoff.vscode-counter
usernamehw.errorlens
vikas.code-navigation
VisualStudioExptTeam.intellicode-api-usage-examples
VisualStudioExptTeam.vscodeintellicode
VisualStudioExptTeam.vscodeintellicode-completions
VisualStudioExptTeam.vscodeintellicode-insiders
VisualStudioOnlineApplicationInsights.application-insights
vscjava.vscode-gradle
vscjava.vscode-java-debug
vscjava.vscode-java-dependency
vscjava.vscode-java-pack
vscjava.vscode-java-test
vscjava.vscode-maven
vscjava.vscode-spring-boot-dashboard
vscjava.vscode-spring-initializr
WakaTime.vscode-wakatime
wesleyegberto.vscode-java-tests
Wscats.java-snippet
XieXiuYue.ts-file-skip
yangbaopan.vscode-java-ibatisx
YouMayCallMeV.vscode-java-saber
yzhang.markdown-all-in-one
zenclabs.previewjs
zh9528.file-size
ziyasal.vscode-open-in-github

A: I'm also experiencing this error.
Here are the common extensions between our systems:
[
    "christian-kohler.npm-intellisense",
    "christian-kohler.path-intellisense",
    "dbaeumer.vscode-eslint",
    "eamodio.gitlens",
    "gbenga504.js-docusaurus",
    "GitHub.vscode-pull-request-github",
    "Gruntfuggly.todo-tree",
    "ms-azuretools.vscode-docker",
    "ms-python.python",
    "ms-python.vscode-pylance",
    "ms-toolsai.jupyter",
    "ms-toolsai.jupyter-keymap",
    "ms-toolsai.jupyter-renderers",
    "ms-vscode-remote.remote-containers",
    "ms-vscode-remote.remote-ssh",
    "ms-vscode-remote.remote-ssh-edit",
    "ms-vscode-remote.vscode-remote-extensionpack",
    "ms-vscode.powershell",
    "naumovs.color-highlight",
    "rbbit.typescript-hero",
    "redhat.java",
    "redhat.vscode-commons",
    "redhat.vscode-yaml",
    "VisualStudioExptTeam.intellicode-api-usage-examples",
    "VisualStudioExptTeam.vscodeintellicode",
    "vscjava.vscode-java-debug",
    "vscjava.vscode-java-dependency",
    "vscjava.vscode-java-pack",
    "vscjava.vscode-java-test",
    "vscjava.vscode-maven",
    "WakaTime.vscode-wakatime",
    "yzhang.markdown-all-in-one"
]

I went and disabled all and then enabled each one by one. This silly linting issue is coming from the js-docusaurus extension.
Specifically from here:
https://github.com/gbenga504/js-docusaurus/blob/18369b8631e725acf795e68b92f92ccd2fbdd383/src/LintService.ts#L118
Just disable this extension and then try again.
The frustrating thing is that this linting warning is similar to  a Go lint warning so it's been tough to track down the root cause.


text:
Q: How to remove the iframe body padding ok i have bin struggling with this for quiet long nw...i am generating iframes dynamically using javascript...what im trying to do is to remove the default padding and margin and set it to 0px...heres my code
var newDiv = create_New_Div(); //this simple returns the id of the newly created
                           //div in javascript

        var iframeIdName="my"+inival_iframearea+"iframe";
        inival_iframearea++;
        var htcontents = "<iframe id='"+iframeIdName+"' frameborder='0'></iframe>";
        document.getElementById(newDiv).innerHTML = htcontents;

if i do like <style> body {padding:0px; margin:0px} </style> wat happens is that the main body has a zero padding and margin but when the iframe is generated after a user clicks a button, this style is not applied to the iframes body and has the default padding and margin which i donot want!!
thanks!

A: Since you're not loading anything in the iframe, you have to grab the document therein and make the changes yourself.
var
   iframe = document.getElementById(newDiv).getElementsByTagName('iframe')[0];

function restyle() {
   var body = iframe.contentDocument.body;
   body.style.padding = 0;
   body.style.margin = 0;
}

iframe.onload = restyle;
restyle();

There are some caveats with respect to contentDocument, so you may see weird behavior in different browsers.  Also, you may have trouble with accessing the document depending on how the browser interprets the lack of a src attribute.  I've seen issues where the calling page is https, and the lack of src leads the browser to load about:blank, which has a different protocol and thus violates the Same Origin Policy.
The reason for the onload is that even though you're not loading a separate page, the browser still has to load ''something'' in there.  YMMV.


text:
Q: How to fix tooltip not showing for disabled button when hovering I have this button
Next

and I have initialized the tooltip:
$('#part3to4').tooltip();

The tooltip still doesnt show up. How do i change my code in a way that it shows the tooptip when the button is disabled? Thanks

A: Probably you forget to include some libraries. To use bootstrap tooltip you need to include Popper.js.

You must include popper.min.js before bootstrap.js or use
  bootstrap.bundle.min.js / bootstrap.bundle.js which contains Popper.js
  in order for tooltips to work!

A possible solution is to your problem is the following. If the a html element has a disabled class (so the link is not enabled) you can enable tooltip otherwise no.
Please see the fiddle I prepared for you.


text:
Q: .NET Module for Email to Database I'm looking for a robust module that will monitor an email account (ideally POP) and load each new email into a database (or cloud-based storage solution) as it arrives. This can either be an open source module, a commercial module or even SaaS. Ideally, would be easy to use from .NET.
Simply put, trying to avoid re-inventing the wheel.
Do you know of any such modules or services? Did you have a positive experience with them?

A: I've used Email2DB with some success.
http://www.email2db.com/
You can set up your own parsing rules for incoming e-mails and place data wherever you see fit as a result.

A: How about OpenPop.net? That won't automatically save it to a db, but you should be able to consume it from the POP3Client object.


text:
Q: sudoku generator: java.lang.StackOverflowError this is my code for generating a random solved sudoku board. I used the backtrack alghoritm to track the possibilities for every cell. Sometimes (like 3 times out of 10) it doesn't work and give me this
[EDIT] I know what this error is about but I don't know how to solve

Exception in thread "main" java.lang.StackOverflowError

This is the code:
how can I solve this?
(the checkSquare method is too long to post here, but it only check if a number is valid in the selected square(3x3)
    int [][] board = new int[9][9];
    int [][][] poss = sudoku.creaposs();
    Object[] obj = new Object[2];
    obj[1] = poss;
    obj[0] = board;
    boolean generato;
    do{

    try{
        long start = System.currentTimeMillis();
        obj[0] = creasudo((int[][])obj[0],(int[][][])obj[1],0,0);
        long end = System.currentTimeMillis();
        System.out.println("Tempo trascorso: "+(end-start));
        generato = true;
    }
    catch(Exception exp){
        System.out.println(exp);
        generato = false;
    }
        //sudoku.stampa((int[][]) obj[0]);
    }while(!generato);
    sudoku.stampa((int[][])obj[0]);

METHODS
public static int[][] creasudo(int[][] board, int[][][] poss,int i, int j){
        if (j<0){
            if (i == 0){
                System.out.println("FINEEE");
                System.exit(-1);

            }
            else
            {j = 8;
            i--;
            }
        }
        if (j>8){
            j=0;
            i++;
        }
        if (i == 9)
            return board;
        int n;
        Random rand = new Random();
        if (poss[i][j][0] == 0){
            poss[i][j] = new int[9];
            for (n=0;n<9;n++){
                poss[i][j][n]=n+1;
            }
            board[i][j]=0;
            return creasudo(board,poss,i,j-1);
        }
        n = rand.nextInt(poss[i][j].length);
        if (!sudoku.checkcol(board,j,poss[i][j][n])|| !sudoku.checkrow(board,i,poss[i][j][n]) ||
                sudoku.checksquare(board,i,j,poss[i][j][n])){
                poss[i][j] = sudoku.removeEl(poss[i][j], poss[i][j][n]);

                return creasudo(board,poss,i,j);
        }
        else{
            board[i][j] = poss[i][j][n];
            return creasudo(board,poss,i,j+1);
        }

    }

public static boolean checkrow(int[][] board, int r, int num){
    int i;
    for (i = 0; i<RIGHE; i++){
        if (board[r][i] == num)
            return false;

    }

    return true;
}

public static boolean checkcol(int[][]board, int c, int num){
    int i;
    for (i = 0; i<RIGHE; i++){
        if (board[i][c] == num)
            return false;
    }

    return true;
}

public static int[]removeEl(int[] array, int n){
    int[] array2;
    int r = 0;
    int i;
    int count = 0;
    for (i = 0; i<array.length; i++){
        if (array[i] != n){
            count ++;
        }
    }
    if (count == 0||(array.length == 1 && array[0] == 0)){
        array2 = new int[1];
        array2[0] = 0;
    }
    else{
        array2 = new int[count];
        for (i = 0; i<array.length; i++){
            if (array[i] != n){
                array2[r] = array[i];
                r++;
            }
        }
    }
    return array2;
}


text:
Q: Burninate [loading], or split it? loading seems too generic. I just rejected a tag wiki edit suggestion for that tag; however, the edit was eventually approved by 3 votes against 2.
I saw that tag being used in at least the following contexts:

*

*Issues when loading content/resources from disk or server into an application or web page

*Loading indicators (like ajax activity indicators, progress bars and splash screens)

*load events (such as JS window.onload, or Windows Forms Form_Load

*Preloaders (as in HTML/JS image preloading techniques)

*Assorted uses like reloading a config file, loading a program module, reading data from a database, etc.

Although all those cases might be considered "loading", IMO they're not similar enough to use the same tag. So maybe the tag should be split into several more specific tags.


text:
Q: What does it say on Data's suitcase? In the TNG episode "Measure of a Man", we see Data's travel bag opened to show various items of relevance.  On it, it appears that Data has some other titles, names, or honorifics.  It reads as "Lt.Cmdr. ???/??? Data", where between his (known) name and rank there seems to perhaps be text (possibly a series of acronyms?) but it's not clear.  Are these symbols simply patterns and line art filling up space, or is there some other meaning here?

A: I just rewatched the relevant parts of the episode on Netflix HD. That image is already a crop from a full frame, so I don't know that you'll get much more detail there. I couldn't, anyway.
My first thought on seeing it was that it read "NFN / NMI" for "no first name" and "no middle initial", which agrees with Kevin's observation in his comment. Data is his only name. Personally, I would have considered it his first name, with no other names, but official recordkeeping databases don't always manage to deal with the full complexity of even human names, much less names for androids and non-human beings.

A: As Dranon speculates and is mentioned in the comments, the letters are NFN/NMI which most likely stand for No First Name / No Middle Initial.  These letters are also seen (somewhat more clearly) on Data's Starfleet Academy diploma from the same episode (at the bottom of the frame):


text:
Q: Using image as a container? Is it possible for me to remove the container div completely and turn the image into the container, retaining the width and height of the image but also keeping the styles of the container that is already in my stylesheet? Any suggestions would be greatly appreciated. Thanks!

.img_zoom_container {
  position: relative;
  display: inline-flex;
  flex-direction: row;
  flex-wrap: wrap;
  max-width: 45%;
}

.img_zoom_window {
  border: 2px solid #d4d4d4;
  width: 300px;
  height: 300px;
  position: absolute;
  top: 20%;
  left: 0%;
  margin-left: -200px !important;
  transform: scale(0) translateY(-50%);
  transform-origin: 0% 0%;
  transition: all ease .2s;
}

.img_zoom_container:hover .img_zoom_window {
  left: 170%;
  transform: scale(1) translateY(-50%);
}

A: As Felipe mentioned, if you are trying to display other elements on top of (within) the image, you could always set the image as the background of the container and simply put more containers within the outer container for your other divs.

A: One method to have a background image push the parent containers width and height would be to use 2 images.

They can be the same image just with one at 0 opacity and pointer events disabled. This approach is also easy to make responsive. I set up a demo for you here:
https://codepen.io/cidicles/pen/djMXeW
Hope it helps!


text:
Q: unable to connect wifi socket connection I have written code for the client and server which will be connected over wifi and client will send string to server, but the problem is even though I think I have implemented the code correctly it doesn't seem to work. Even the logcat is not showing any errors while I run the code on android device. Can someone help please?
Here's the client code.
public class ControlActivity extends Activity {
WifiManager wifi=null;
WifiInfo winfo=null;
Socket ssocket=null;
String sstr=null;
String ipadd=null;
Integer ip;
TextView text;
Integer k=0;
Handler handler;
Boolean pdown=false;
InetAddress seraddr;

public String intToIp(int i) {

       return ( i & 0xFF) + "." + ((i >> 8 ) & 0xFF) + "." + ((i >> 16 ) & 0xFF) + "." + ((i >> 24 ) & 0xFF );
    }

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
    WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_control);
    wifi=(WifiManager)getSystemService(Context.WIFI_SERVICE);
    winfo = wifi.getConnectionInfo();
    ip = winfo.getIpAddress();
    ipadd = intToIp(ip);
    try {
        seraddr = InetAddress.getByName(ipadd);
    } catch (UnknownHostException e) {
        e.printStackTrace();
    }
    text = (TextView)findViewById(R.id.textView1);
    text.setText(ipadd);

    handler = new Handler(){
        @Override
        public void handleMessage(Message msg1){
            Bundle bundle = msg1.getData();
            String str = bundle.getString("key");
            text.setText(str);
        }
    };

    ImageButton butup = (ImageButton)findViewById(R.id.buttonup);
    butup.setOnTouchListener(new View.OnTouchListener() {
        private Thread touchthread;

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            switch(event.getAction()){
            case MotionEvent.ACTION_DOWN:
                if(pdown==false)
                    pdown=true;
                sstr = "up";
                this.touchthread = new Thread(new OnTouchClientThread());
                this.touchthread.start();
                break;

            case MotionEvent.ACTION_UP:
                pdown=false;

            }
            return true;
        }
    });

        ImageButton butdown = (ImageButton)findViewById(R.id.buttondown);
        butdown.setOnTouchListener(new View.OnTouchListener() {
            private Thread touchthread;

            @Override
            public boolean onTouch(View v, MotionEvent event) {
                switch(event.getAction()){
                case MotionEvent.ACTION_DOWN:
                    if(pdown==false)
                        pdown=true;
                    sstr = "down";
                    this.touchthread = new Thread(new OnTouchClientThread());
                    this.touchthread.start();
                    break;

                case MotionEvent.ACTION_UP:
                    pdown=false;

                }
                return true;
            }
        });
        }
public class OnTouchClientThread implements Runnable{

    @Override
    public void run() {
        try {
            Message msg = handler.obtainMessage();
            Bundle bundle = new Bundle();
            ssocket = new Socket(seraddr,5479);
            PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(ssocket.getOutputStream())),true);
            while(pdown==true){
                k=k+1;
                bundle.putString("key",k.toString());
                msg.setData(bundle);
                handler.sendMessage(msg);
                out.println(sstr);

            }
            out.flush();
            out.close();
            ssocket.close();

    } catch (UnknownHostException e) {
            e.printStackTrace();
    } catch (IOException e) {
            e.printStackTrace();
    }
    }
}

here's the server
public class FInterActivity extends Activity {

WifiManager wifi=null;
Socket ssocket=null;
String sstr=null;
Thread recithrd;
TextView testing;
ServerSocket ss;
Handler handler;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_finter);
    wifi=(WifiManager)getSystemService(Context.WIFI_SERVICE);
    testing = (TextView)findViewById(R.id.testtext);
    testing.setText("Starting thread");
    this.recithrd = new Thread(new ServerThread());
    this.recithrd.start();

    handler = new Handler(){
        @Override
        public void handleMessage(Message msg1){
            Bundle bundle = msg1.getData();
            String str = bundle.getString("key");
            testing.setText(str);
        }
    };

}

public class ServerThread implements Runnable{

    @Override
    public void run() {
        try {
            Message msg = handler.obtainMessage();
            Bundle bundle = new Bundle();
            ss = new ServerSocket(5479);
            ssocket = ss.accept();
            while(true){
                    BufferedReader input = new BufferedReader(new InputStreamReader(ssocket.getInputStream()));
                    sstr=null;
                    sstr = input.readLine();
                    if(sstr!=null){
                    bundle.putString("key", sstr);
                    msg.setData(bundle);
                    handler.sendMessage(msg);
                    }
            }

    } catch (UnknownHostException e) {
            e.printStackTrace();
            handler.post(new Runnable(){
                @Override
                public void run() {
                    testing.setText("unknown host");

                }

            });
    } catch (IOException e) {
            e.printStackTrace();
            handler.post(new Runnable(){
                @Override
                public void run() {
                    testing.setText("Io exception");
                }

            });
    }
    }

}

and yes i have provided all the permissions required. please help. i am stuck on this for days.

A: Your code seems to be wrong in more than one place.
1) The client seems to be getting its own address, putting it into seraddr, and trying to connect to itself! Certainly the server has a different address, unless you are doing a local connection and in this case you should just use 127.0.0.1.
2) At server side, you are accept()ing only once, handling the connection and exiting the thread. This means that your server will accept only one connection and no more. Is this what you wanted?


text:
Q: Some files lost their -x permission when import/ export in SVN I'm working in TortoiseSVN and i noticed some files (especially executable files like .sh) lost their -x permission when import/ export. There is some code, or SVN option to restore permissions or import/export these files without lose their permissions?

A: Read SVN Book

On many operating systems, the ability to execute a file as a command
  is governed by the presence of an execute permission bit. This bit
  usually defaults to being disabled, and must be explicitly enabled by
  the user for each file that needs it. But it would be a monumental
  hassle to have to remember exactly which files in a freshly
  checked-out working copy were supposed to have their executable bits
  toggled on, and then to have to do that toggling. So, Subversion
  provides the svn:executable property as a way to specify that the
  executable bit for the file on which that property is set should be
  enabled, and Subversion honors that request when populating working
  copies with such files.

svn:executable
If present on a file, the client will make the file executable in Unix-hosted working copies.


text:
Q: Segmentation fault in c++ after using default constructor with nullptr as member I got segmentation faults when I run the codes below. I noticed that the segmentation fault occurs when I reach another.print(), but I could not figure out why. Can anyone please help?
example.h
class X
{
    private:
        struct Y{
            int a;
            Y* next;
        } *head;

    public:
        X();
        X(int k);
        X returnX() const;
        void print() const;
};

example.cpp
#include <iostream>
#include "test.h"

X::X(){
    head = nullptr;
}

X::X(int k){
    head = new Y;
    head->a = k;
    head->next = nullptr;
}

X X::returnX()const
{
    X test{};
    return test;
}

void X::print() const
{
    cout << "a = "<< head->a << endl;
}

int main(){
    X* init = new X(1);
    X another = init->returnX();
    another.print();
    delete init;

    return 0;
}


text:
Q: Full page jQuery slider I'm trying to adapt the Coda Slider at jQuery for Designers to take up the entire page (100% width / 100% height) but as soon as I change the height of the .scroll class to 100%, the whole thing disappears. Does anyone know what I can do to fix it?

A: try
$(document).ready(function(){
    var docWidth = $(document).width();
    var docHeight = $(document).height();

    $(".scroll").css({
        "height":docHeight,
        "width":docWidth
    });
});

the values may need to be in pixels not %.


text:
Q: SmsManager Null Pointer Exception I am trying to send a text message using smsManager from a BroadCast Receiver.I am getting this error says NullPointerException. I do not know what is wrong with this. I am sick of this error.
here is my code segment
GPSTracker tracker = new GPSTracker(context);
            MyLocation temp = tracker.getCurrentLocation();
            String message = sp.getString("auto_text", "") + "\n"
                    + "Latitude: "+temp.getLatitude() + "\nLogitude: "+temp.getLongitude();
            Toast.makeText(context, message, Toast.LENGTH_LONG).show();
            smsManager.sendTextMessage(smsMessage.getOriginatingAddress(),
                    null, message, null, null);

String message is not null. it is displayed in toast .
If I Replace message with
sp.getString("auto_text","")+" "+temp.getLatitude()+" "+temp.getLongitude();

then it is working fine.
MyLocation.java
import android.os.Parcel;
import android.os.Parcelable;

public class MyLocation implements Parcelable{

    double latitude,longitude;
    public MyLocation() {
    }
    public double getLatitude() {
        return latitude;
    }

    public void setLatitude(double latitude) {
        this.latitude = latitude;
    }

    public double getLongitude() {
        return longitude;
    }
    @Override
    public String toString() {
        return getLatitude()+" , "+getLongitude();
    }

    public void setLongitude(double longitude) {
        this.longitude = longitude;
    }

    @Override
    public int describeContents() {
        // TODO Auto-generated method stub
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeDouble(latitude);
        dest.writeDouble(longitude);

    }
    public static final Parcelable.Creator<MyLocation> CREATOR = new Parcelable.Creator<MyLocation>() {
        public MyLocation createFromParcel(Parcel pc) {
            return new MyLocation(pc);
        }

        public MyLocation[] newArray(int size) {
            return new MyLocation[size];
        }
    };
    public MyLocation(Parcel pc){
        latitude = pc.readDouble();
        longitude  = pc.readDouble();

    }

}

LogCat
FATAL EXCEPTION: main
02-03 08:54:22.822: E/AndroidRuntime(3124): java.lang.RuntimeException: Unable to start receiver com.blogspot.uappmarket.locationbasedproject.Receiver.InCommingSmsReceiver: java.lang.NullPointerException
02-03 08:54:22.822: E/AndroidRuntime(3124):     at android.app.ActivityThread.handleReceiver(ActivityThread.java:1805)
02-03 08:54:22.822: E/AndroidRuntime(3124):     at android.app.ActivityThread.access$2400(ActivityThread.java:117)
02-03 08:54:22.822: E/AndroidRuntime(3124):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:981)
02-03 08:54:22.822: E/AndroidRuntime(3124):     at android.os.Handler.dispatchMessage(Handler.java:99)
02-03 08:54:22.822: E/AndroidRuntime(3124):     at android.os.Looper.loop(Looper.java:130)
02-03 08:54:22.822: E/AndroidRuntime(3124):     at android.app.ActivityThread.main(ActivityThread.java:3683)
02-03 08:54:22.822: E/AndroidRuntime(3124):     at java.lang.reflect.Method.invokeNative(Native Method)
02-03 08:54:22.822: E/AndroidRuntime(3124):     at java.lang.reflect.Method.invoke(Method.java:507)
02-03 08:54:22.822: E/AndroidRuntime(3124):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
02-03 08:54:22.822: E/AndroidRuntime(3124):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
02-03 08:54:22.822: E/AndroidRuntime(3124):     at dalvik.system.NativeStart.main(Native Method)
02-03 08:54:22.822: E/AndroidRuntime(3124): Caused by: java.lang.NullPointerException
02-03 08:54:22.822: E/AndroidRuntime(3124):     at android.os.Parcel.readException(Parcel.java:1328)
02-03 08:54:22.822: E/AndroidRuntime(3124):     at android.os.Parcel.readException(Parcel.java:1276)
02-03 08:54:22.822: E/AndroidRuntime(3124):     at com.android.internal.telephony.ISms$Stub$Proxy.sendText(ISms.java:369)
02-03 08:54:22.822: E/AndroidRuntime(3124):     at android.telephony.SmsManager.sendTextMessage(SmsManager.java:87)
02-03 08:54:22.822: E/AndroidRuntime(3124):     at com.blogspot.uappmarket.locationbasedproject.Receiver.InCommingSmsReceiver.onReceive(InCommingSmsReceiver.java:33)
02-03 08:54:22.822: E/AndroidRuntime(3124):     at android.app.ActivityThread.handleReceiver(ActivityThread.java:1794)

A: I just found a valid reason for this problem.
That is : SmsManager.sendTextMessage() throws NullPointerException when SMS message is over size limit. i.e. max character limit is 159.

A: Maybe Harpreet is right, in fact I ran into this situation just now.
you can just use the method SmsManager.divideMessage(String text) to let the system handle the length.

A: The SmsManager.sendTextMessage() method also throws a NPE in the case that an invalid number is passed in as the destination. I found this out first hand when I was passing in a formatted phone number (e.g. "+1 999 999 9999"). The method did not throw a NPE when I stripped out the empty chars and removed the "+" before the country code.

A: @harpreet aswer pointed me to the source of the error.
Note that SMS message length limit may vary depending on you mobile network operator.
Then you have two solutions:
1 - To send a shorter message.
-or-
2 - Split them in several messages (This may cause extra cost)
SmsManager sms = SmsManager.getDefault();
ArrayList<String> dividedText = sms.divideMessage(message);
for (String shortMessage : dividedText) {
    sms.sendTextMessage(phoneNumber,null,shortMessage,null,null);
    }


text:
Q: Find the limit $\quad\lim_{x \to 0}\frac{x^3}{\tan^3(2x)}$ I'm trying to find the limit $$\quad\lim_{x \to 0}\frac{x^3}{\tan^3(2x)}$$ but I'm at a loss.
I've tried expanding $\tan^3(2x)$ using $\tan2x = \frac{\sin2x}{\cos2x}$, and then using double-angle formulas to expand that, but that did not yield anything helpful from what I could tell.

This is a question from an end-of-chapter exercise. Up and til this chapter this book has only dealt with introductory-type limits and consequently introduced the derivative and differentiation rules. That being said, I'm not supposed to apply some fancy technique that I've not been introduced to thus far.
Any suggestions?

A: Hint: $$\lim_{x \to 0}\frac{x^3}{\sin^3(2x)}=\lim_{x \to 0}\frac{1}{8}\cdot\frac{(2x)^3}{\sin^3(2x)}=\frac{1}{8}\cdot1$$

A: Hint:
$$
\tan'(x) = 1+\tan^2x \in [1,1+\epsilon]
$$for $|x|\le \delta_\epsilon$ and $\delta_\epsilon$ little enough.
Integrate this inequality, it proves that
$$
|y|<\delta_\epsilon \implies y \le \tan (y)\le (1+\epsilon) y
$$


text:
Q: Where are updated files with version number in Wordpress? I updated my wordpress a couple of days ago and now a plugin is using the following file:
http://tuhrig.de/wp-includes/js/thickbox/thickbox.js?ver=3.1-20121105

I want do edit this file, but I can't find it. I know where the original file is (in wp-includes/js/thickbox of course...), but however, when I change it, it doesn't affect the file with the new version number. So, where is that file?

A: Use your own version of thickbox.js. I mean put it in some place into your plugin dir and include it:
wp_enqueue_script('my_thickbox', PLUGIN_URL . '/js/thickbox.js');


text:
Q: Assigning Pandas categories to new number df["A"].value_counts()

(25.0, 38.0]      361594
(12.999, 25.0]    330552
(55.0, 218.0]     305439
(38.0, 55.0]      231683
Name: A, dtype: int64

we have following interval , whenever a new datapoint is coming I need to map to the following above interval . I want something like this .
def func_(x):
    if (x> 12.999) & (x< 25.0):
      return (12.999, 25.0]
    elif:
        for rest of bucket range

A: You can reuse bins parameter by categories generated by CategoricalIndex.categories:
s = df["A"].value_counts()

print (pd.cut(df['new'], bins=s.index.categories))


text:
Q: Error using DLast and DateDiff to calculate an interval between two time values I've been using the code below to create a time interval between two entries to be shown on a report.
The problem I'm having is an error is being thrown somewhere and the interval remains at its default value of 99999.
I set LValue to 99999 so I could see when this error occurred because a lot of other people are using my database and intervals tend to be between 30-50 minutes.
The only way I've been able to replicate it myself is when I copy data from another table in another database into the "Daily Oven/Product Record" table. The most recent error occurred when someone accidentally moved the backend database from its folder and back again.
Is there a problem with my code or something else I'm not looking at?
LValue = 99999
On Error GoTo catchInterval
        Dim ovenTimeInterval As Variant
        Dim strChangeover As String

    If boolChangeover = True Then
        strChangeover = " (C/O)"
    Else
        strChangeover = ""
    End If

    'Find last Process No entered
    ovenTimeInterval = DLast("[Time]", "Daily Oven/Product Record")

    'DateDiff
    LValue = datediff("n", ovenTimeInterval, Now())
catchInterval:

[Time Interval] = LValue & strChangeover


text:
Q: Errors on unmarshal yaml in go I'm new in go, I can't find a way to unmarshal a yaml using  "gopkg.in/yaml.v2"
I suppose the error is in the way I define the struct.
I need to parse a kubernetes job yaml and edit in go to generate an update yaml.
The structure is almost static but have two lists in which the keys could have different things inside.
I reduced the yaml to one listes (volumes) to simplify the example.
apiVersion: batch/v1
kind: Job
metadata:
  name: jobname
  namespace: namespace
spec:
  ttlSecondsAfterFinished: 86400
  template:
    spec:
      containers:
      - name: container-name
        image: containerimage:tag
        command:
        - php
        - cli/migrations.php
        - up
      restartPolicy: Never
      volumes:
      - name: filestore
        persistentVolumeClaim:
          claimName: data-pvc
          readOnly: false
      - name: stackdriver
        secret:
          secretName: stackdriver-prod
  backoffLimit: 1

those are my structs definitions:
type PersistentVolumeClaims struct {
                ClaimName string `yaml:"claimName,omitempty"`
                ReadOnly bool `yaml:"readOnly,omitempty"`

            }
type Secrets  struct {
                SecretName string `yaml:"secretName,omitempty"`

    }

type Names struct {
    Name     string `yaml:"name"`
    PersistentVolumeClaim PersistentVolumeClaims `yaml:"persistentVolumeClaim,omitempty"`
    Secret Secrets `yaml:"secret,omitempty"`
}

type Jobs struct {
    ApiVersion string `yaml:"apiVersion"`
    Kind string `yaml:"kind"`
    Metadata struct {
      Name string `yaml:"name"`
      Namespace string `yaml:"namespace"`
    }
    Spec struct {
      TtlSecondsAfterFinished int `yaml:"ttlSecondsAfterFinished"`
      Template struct {
        Spec struct {
          Containers []struct {
            Name string
            Image string `yaml:"image"`
            Command []string `yaml:"command"`
            VolumeMounts []struct {
                    Name string
                    SubPath string `yaml:"subPath"`
                    MountPath string `yaml:"mountPath"`
                    ReadOnly bool `yaml:"readOnly"`
          }
          RestartPolicy string `yaml:"restartPolicy"`
        }
        Volumes map[string][]Names
      }
      BackoffLimit int `yaml:"backoffLimit"`
    }
  }
}

I tried different structures but I don't get the solution.
Any help will be appreciated.
--- SOLVED
I have redone the tool using the official go-client https://github.com/kubernetes/client-go as suggested by Jonas. Now everything work!

A:
I need to parse a kubernetes job yaml and edit in go to generate an update yaml. The structure is almost static but have two lists in wich the keys could have different things inside.

It sound like your application is running in a cluster, want to retrieve a Job, modify it and then update it.
I would recommend the official Kubernetes client-go for this. It has libraries for Kubernetes resources like Job. See the example using a Deployment

A: You can use the official structs from the Kubernetes APIs. If you still want to declare the structs: Your yaml tags are incomplete. You do not have tags for nested structs:
type Jobs struct {
    Metadata struct {
      Name string `yaml:"name"`
      Namespace string `yaml:"namespace"`
    } `yaml:"metadata"` // Here is one
    Spec struct {
      TtlSecondsAfterFinished int `yaml:"ttlSecondsAfterFinished"`
      Template struct {
        Spec struct {
          Containers []struct {
            VolumeMounts []struct {
                    Name string
                    SubPath string `yaml:"subPath"`
                    MountPath string `yaml:"mountPath"`
                    ReadOnly bool `yaml:"readOnly"`
          } `yaml:"volumeMounts"` // Here is another
        } `yaml:"containers"` // Here is another
        Volumes map[string][]Names `yaml:"volumes"` // This is missin as well
      } `yaml:"spec"` //
    } `yaml:"template"` //
  } `yaml:"spec"` //
}

A: Suppose that your data is in the file example.yaml; you can unmarshall into a struct using gopkg.in/yaml.v2 like
package main

import (
    "fmt"
    "log"
    "io/ioutil"
    "gopkg.in/yaml.v2"
)

type item struct {
    ItemA string `yaml:"item_a"`
    ItemB string `yaml:"item_b"`
}

func read(filename string) (item, error) {
    var output item
    content, err := ioutil.ReadFile(filename)
    if err != nil {
        return item{}, err
    }
    err = yaml.Unmarshal(content, output)
    if err != nil {
        return item{}, err
    }
    return output, nil
}

func main() {
    output, err := read("example.yaml")
    if err != nil {
            log.Fatal(err)
    }
    fmt.Println("output: ", output)
}


text:
Q: Applying De Morgan's Law I'm working on my assignment for Discrete Math and I'm not fully understanding how to do this question for it so I was wondering if anyone here could help show me how to do it properly;
Use De Morgan's Laws to state the negations of the following
i. Either x < -3 or x > 3
I understand what De Morgan's Laws are:
$$\neg(P \vee Q) \equiv (\neg P \wedge \neg Q)$$
$$\neg(P \wedge Q) \equiv (\neg P \vee \neg Q)$$
I'm just unsure of how to apply De Morgan's Laws to this question. I saw in another thread someone asking a similar question and tried to work it out myself by just guessing, so would this be correct?
$$-3 \le x \le 3$$

A: Lets do it step by step
But first of all there is a problem with "either"
Logic always works with "inclusive" or  so $P \lor Q$ is also true if P and Q are both true.
In "Either $ x < -3 $ or $ x > 3 $ "the two propositions have some problem to be both true, but propositional just logic doesn't look that deep,
luckely we we can just treat it as $ x < -3 $ (inclusive or) $ x > 3 $
using P as meaning  $ x < -3 $
and  Q as meaning  $ x > 3  $
we get
$ P \lor Q $
And this is equivalent to $ \lnot (\lnot P \land \lnot Q ) $
So that should be your answer.
but i guess you need to go a bit deeper
I guess you may assume

*

*$ \lnot P = \lnot ( x < -3) $ so  $ \lnot P =  x \geq -3 $ and

*$ \lnot Q = \lnot(  x > 3 ) $ so  $ \lnot Q = x \leq 3 $

so your formula becomes:
$ \lnot ( x \geq -3 \land  x \leq 3 )$
(don't forget the $ \lnot$ )
and that can be simplified
GOOD LUCK


text:
Q: BigQuery - equivalent of GROUP EACH in standard SQL Is there an equivalent of GROUP EACH / JOIN EACH in standard SQL ? I'm exceeding my resources.

A: Nope. :o(
There is no such equivalent in Standard SQL.
... EACH was a hint for BQ Engine (Legacy SQL) to more optimally process respective command  - which is already covered in Standard SQL w/o any hint'ing
Your option is to tune/optimize your query


text:
Q: Why error happen when run php artisan on Lumen I clone a lumen project. Then I create and edit .env file and copy from .env.example.
I run composer install and vendor folder was create in the project.
I run php artisan migrate and there is error.
PHP Fatal error:  Uncaught Dotenv\Exception\InvalidFileException: Dotenv values containing spaces must be surrounded by quotes.

I find out that most commonly the error cause there are spaces in .env file. But when i check, i am sure that there is no space and use quotes " ".
I try to run php artisan only and same error happen.

A: I check again on .env file. I change on comment from /**/ to # and can run php artisan command.


text:
Q: hyperlink the whole citation call-out not only the year I am using the following packages and if I cite something with \textcite or \parencite it only cross-referencing the year to the corresponding entry in the bibliography. I saw in some papers that they extended this up to the whole citation and not only to the year. how can i do this too? E.g. Muster and Mann (1990) => but i want => Muster and Mann (1990)
\usepackage[bibstyle=authoryear-ibid,citestyle=authoryear, backend=bibtex8]{biblatex}
\usepackage{hyperref}
\usepackage{xcolor}
\hypersetup{
    colorlinks,
    linkcolor={red!50!black},
    citecolor={blue!50!black},
    urlcolor={blue!80!black}
}


text:
Q: Should I use site.link or site.url in Twig/Wordpress? Should I be using {{ site.link }} or {{ site.url }} in Twig/WordPress for my theme development? They both seem to do the same thing and wanted to make sure I was correct and consistent.
Thanks so any explaining on this subject!


text:
Q: How to write batch file to retsart services with varying names I'm trying to write a batch file that will restart a service from a program my company uses called Bomgar that allows our help desk technicians to remote into an employees computer. I know how to write a batch file that restarts services, the problem is that each service has a unique number ID on it (example; bomgar-ps-10000000-10000000) that is completely different machine to machine. Is there a way to restart services whose name falls within a "range"? Say any service whose name contains "bomgar-ps" as an example.
Really not sure how to handle this. The problem we're having is that this service is failing to start up occasionally and when an employee calls with a problem, they aren't tech savvy so a lot of time is wasted trying to guide them into services.msc and manually restarting the service.

A: This should work also.
@echo off
set "servicename="
for /f "tokens=*" %%a in ('net start ^| find /i "bomgar-ps") do set "servicename=%%a"
if defined servicename net stop "%servicename%"
ping -n 3 localhost >nul
net start "%servicename%"
echo servicename "%servicename%" has attempted to restart

If you are merely guiding someone over the phone to restart the service then this will print the name to the console, in a fairly simple manner (add /i to the find command if bomgar can be mixed case"
net start|find "bomgar"

A: Try this, I used it to search for the print spooler name and restart it. You should be able to replace spool with boomgar-ps, you may even be able to remove the SERVICE_NAME: part.
@ECHO OFF
>%TEMP%\~sc.log (sc queryex type= service state= all)
for /F "tokens=1,* delims=: " %%I in ('type %TEMP%\~sc.log^|find "SERVICE_NAME: Spool"') do set scname=%%J
ECHO RESTARTING %scname%
sc stop %scname%
sc start %scname%


text:
Q: Symfony Pdfbundle not working When trying to use pdfBundle with symfony I get the following error, all i've done so far is installed pdfbundle via symfony and registered it in app.php.
Catchable fatal error: Argument 1 passed to Silex\Application::register() must implement interface Silex\ServiceProviderInterface, instance of Ps\PdfBundle\PsPdfBundle given, called in C:\wamp\www\computername\Project1\app\bootstrap.php on line 20 and defined in C:\wamp\www\computername\Project1\vendor\silex\silex\src\Silex\Application.php on line 165

My composer file looks like this:
{
"require": {
    "silex/silex": "~1.1",
    "components/jquery": "2.1.0",
    "twig/twig": "1.18.0",
    "symfony/twig-bridge": "2.3.*",
    "psliwa/pdf-bundle": "dev-master",
    "knplabs/repository-service-provider": "dev-master",
    "sensio/framework-extra-bundle": "3.0.7"
},
"autoload": {
    "psr-0": {
        "Defensie": "src/"
    }
}

}
App.php:
....
$app->register(new Ps\PdfBundle\PsPdfBundle());
....

If there's more information you need, go ahead and ask.

A:
trying to use pdfBundle with symfony

First of all that it looks like you are using Silex that is micro-framework based on Symfony2.
So you try to use Symfony2 bundle, but register it as Silex service provider.
$app->register(new Ps\PdfBundle\PsPdfBundle());

You can't just connect 3rd party bundles from Symfony2 with Silex. Silex uses  a "ServiceProviderInterface" to connect 3rd party bundles. http://silex.sensiolabs.org/doc/providers.html
interface ServiceProviderInterface
{
    public function register(Application $app);

    public function boot(Application $app);
}

So either a bundle should have already implemented service provider to integrate it to Silex or you must to implement it self to connect 3rd party lib. Here is some example how to create service provider to integrate Buzz client  http://php-and-symfony.matthiasnoback.nl/2012/02/silex-creating-a-service-provider-for-buzz/


text:
Q: Regex in Javascript not as greedy as it should? I have made a simple code for capturing a certain group in a string :
/[a-z]+([0-9]+)[a-z]+/gi    (n chars , m digts , k chars).

code :
var myString='aaa111bbb222ccc333ddd';
var myRegexp=/[a-z]+([0-9]+)[a-z]+/gi;

var match=myRegexp.exec(myString);
console.log(match)

 while (match != null)
{
  match = myRegexp.exec(myString);
  console.log(match)
}

The result were :
["aaa111bbb", "111"]
["ccc333ddd", "333"]
null

But wait a minute ,
Why he didnt try the bbb222ccc part ?
I mean ,
It saw the aaa111bbb but then he should have try the bbb222ccc... ( That's  greedy !)
What am I missing ?
Also
looking at
   while (match != null)
    {
      match = myRegexp.exec(myString);
      console.log(match)
    }

how did it progressed to the second result ?
at first there was :
var match=myRegexp.exec(myString);
later ( in a while loop)
match=myRegexp.exec(myString);
match=myRegexp.exec(myString);

it is the same line ... where does it remember that the first result was already shown ?

A: .exec is stateful when you use the g flag. The state is kept in the regex object's .lastIndex property.
var myString = 'aaa111bbb222ccc333ddd';
var myRegexp = /[a-z]+([0-9]+)[a-z]+/gi;
var match = myRegexp.exec(myString);
console.log(myRegexp.lastIndex); //9, so the next `.exec` will only look after index 9
while (match != null) {
    match = myRegexp.exec(myString);
    console.log(myRegexp.lastIndex);
}

The state can be resetted by setting .lastIndex to 0 or by execing a different string. re.exec("") for instance will reset the state because the state was kept for 'aaa111bbb222ccc333ddd'.
The same applies to .test method as well, so never use g flag with a regex that is used for .test if you prefer no surprises. See https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/exec

A: You can also update manually the lastIndex property :
var myString='aaa111bbb222ccc333ddd';
var myRegexp=/[a-z]+([0-9]+)[a-z]+/gi;

var match=myRegexp.exec(myString);
console.log(match);

 while (match != null)
{
  myRegexp.lastIndex -= match[0].length - 1; // Set the cursor to the position just after the beginning of the previous match
  match = myRegexp.exec(myString);
  console.log(match)
}

See this link MDN exec.

EDIT :
By the way your regex should be : /[a-z]{3}([0-9]{3})[a-z]{3}/gi


text:
Q: Magnetic field line distribution If I had a magnetic bar in space that was 2cm wide and 2cm high and was one Earth diameter long and had the same magnetic strength as the Earth, would the distribution of field lines be the same length and width as the Earth's field lines?

A: The magnetic field of the earth looks approximately like the field of a magnetic dipole with field values on the order of tens of micro Tesla.  The magnetic field of a bar magnet also is essentially that of a magnetic dipole, so provided the bar magnetic creates a field that is also on the order of tens of micro Tesla, the field lines would look similar in length at given distances from the poles (not sure I understand what you mean by the width of field lines).  There's a great image on the Wikipedia page for the magnetic field of the earth in which you can clearly see that the field looks very much like that of a magnetic dipole, especially away from its surface.  One difference, however, is that since the magnetic field of the Earth is produced by molten iron whose motion is constantly changing its magnetic field, the magnetic field of a bar magnet is fixed.


text:
Q: Downloading time series LST from Landsat Here is the code I am using to download a time series data representing the LST over a three month period in 2018. However, the code gives me this error

A mapped function's arguments cannot be used in client-side
operations.

I don't believe this to be accurate.
var batch = require('users/fitoprincipe/geetools:batch')
var table_bounds = function(image) {
  // Crop by table extension
  return image.clip(geometry);
};

var col = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
.map(maskL8sr)
.filterDate('2018-06-01','2018-08-31')
.filterBounds(geometry);
print(col, 'colection');
var NDVIClipped = col.map(table_bounds);

//cloud mask
function maskL8sr(col) {
  // Bits 3 and 5 are cloud shadow and cloud, respectively.
  var cloudShadowBitMask = (1 << 3);
  var cloudsBitMask = (1 << 5);
  // Get the pixel QA band.
  var qa = col.select('pixel_qa');
  // Both flags should be set to zero, indicating clear conditions.
  var mask = qa.bitwiseAnd(cloudShadowBitMask).eq(0)
                 .and(qa.bitwiseAnd(cloudsBitMask).eq(0));
  return col.updateMask(mask);
}

//vis params
var vizParams = {
bands: ['B5', 'B6', 'B4'],
min: 0,
max: 4000,
gamma: [1, 0.9, 1.1]
};

var vizParams2 = {
bands: ['B4', 'B3', 'B2'],
min: 0,
max: 3000,
gamma: 1.4,
};

//image reduction
{
var image = NDVIClipped.median();
print(image, 'true color composite');
Map.addLayer(image, vizParams2);
}

var ndvi = image.normalizedDifference(['B5',
'B4']).rename('NDVI');
var ndviParams = {min: -1, max: 1, palette: ['blue', 'white',
'green']};
print(ndvi,'ndvi');
Map.addLayer(ndvi, ndviParams, 'ndvi');

//select thermal band 10(with brightness tempereature), no calculation
var thermal = image.select('B10').multiply(0.1);
var b10Params = {min: 291.918, max: 302.382, palette: ['blue',
'white', 'green']};
Map.addLayer(thermal, b10Params, 'thermal');

// find the min and max of NDVI
{
var min = ee.Number(ndvi.reduceRegion({
reducer: ee.Reducer.min(),
geometry: geometry,
scale: 30,
maxPixels: 1e9
}).values().get(0));
print(min, 'min ndvi');
var max = ee.Number(ndvi.reduceRegion({
reducer: ee.Reducer.max(),
geometry: geometry,
scale: 30,
maxPixels: 1e9
}).values().get(0));
print(max, 'max ndvi')
}

//fractional vegetation
{
var fv =(ndvi.subtract(min).divide(max.subtract(min))).pow(ee.Number(2)).rename('FV');
print(fv, 'fractional vegetation');
Map.addLayer(fv);
}

//Emissivity

var a= ee.Number(0.004);
var b= ee.Number(0.986);
var EM=fv.multiply(a).add(b).rename('EMM');
var imageVisParam3 = {min: 0.9865619146722164, max:0.989699971371314};
Map.addLayer(EM, imageVisParam3,'EMM');

//LST in Celsius Degree
function addLST (img) {
  var LST =  img.expression(
  '(Tb/(1 + (0.00115* (Tb / 1.438))*log(Ep)))-273.15', {
  'Tb': img.select('B10').multiply(0.1),
  'Ep': EM.select('EMM')
  }).rename('LST').select('LST');

Map.addLayer(LST, {min: 20.569706944223423, max:29.328077233404645, palette: [
'040274', '040281', '0502a3', '0502b8', '0502ce', '0502e6',
'0602ff', '235cb1', '307ef3', '269db1', '30c8e2', '32d3ef',
'3be285', '3ff38f', '86e26f', '3ae237', 'b5e22e', 'd6e21f',
'fff705', 'ffd611', 'ffb613', 'ff8b13', 'ff6e08', 'ff500d',
'ff0000', 'de0101', 'c21301', 'a71001', '911003'
 ]},'LST');
  return img.addBands(LST);

}

var withLST = NDVIClipped.map(addLST);
print('withLST', withLST);
Map.centerObject(geometry);
batch.Download.ImageCollection.toDrive(withLST, 'LST',
{
  description: 'ISB & RWP',
  scale: 30,
  region: geometry,
  maxPixels: 1e13,
type: 'float'})

https://code.earthengine.google.com/3a15c9cf4a92cd2306dcc887dbe54427


text:
Q: Do timed effects pause during in-game cutscenes? What happens to timed effects, such as the bonus from a shrine or a Monk's mantra, when an in-game cutscene plays (e.g. the cutscene which appears when you first encounter Deckard Cain)?
Does the timer pause while you're in the cutscene? Does it depend on whether other human players are connected?

A: There was a post on battle.net forums suggesting that buffs did expire on cut-scenes. The actual post was removed.

A: Well I ended up checking it myself, and the effects do not pause during in-game cutscenes, even when playing alone :(


text:
Q: Could not resolve hostname git: nodename nor servname provided, or not known I tried doing git pull --rebase and I am getting the following error:
ssh: Could not resolve hostname git: nodename nor servname provided, or not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I tried doing git remote -v and the origin is properly listed.
How can I fix this error?

A: Just add the hostname to /etc/hosts file
# IP       hostname
1.55.4.5.66 hostname@host.com

A: I have recently solved this issue by removing ssh from the remote address on my fork:
origin  ssh://git@ghe.company.net:yunus/client.git (fetch)
origin  ssh://git@ghe.company.net:yunus/client.git (push)
...

updated as:
origin  git@ghe.company.net:yunus/client.git (fetch)
origin  git@ghe.company.net:yunus/client.git (push)
...

A: I had run into the same error.
Fix it by switching to another DNS server.
You can try Google DNS

*

*8.8.8.8

*8.8.4.4

Get answer from here


text:
Q: How to give Dictionary to the Dictionary value I have an interesting question. Does anyone know if we could give another Dictionary to the Dictionary's Value? Example:
var dict1 = new Dictionary<int, int>
{
  {1, 333},
  {7, 555},
  {23, 111},
  .....
}

Is it possible, to give dict1 as value of dict2?
var dict2 = new Dictionary <int, int>
{
  {0, dict1},   //possible? How to do? any other ways?
  {1, 565},
  {2, 5286},
  {3, 62836},
  ....
}

Actually there will be variables which equals to keys of both Dictionaries and comes same time example:
var str = 0;
var str2 = 7;
Return will be 555;

or:
var str = 0;
var str2 = 1;
return will be 333;

I would like to return like this: How to do it?

  if (dict2.key == 0 && dict1.key == key1 or key....n)
  {
    return dict1 value
  }

else if
{
  return dict2 value
}
else
{
 return something else
}

A: You technically could by changing the Dictionary type to a Dictionary<int, object>, but it seems an odd thing to do. Especially if this is a one-value thing. I would consider something like:
if (key == 0)
    otherDict.GetValueOrDefault(someOtherKey, out value);
else
    dict.GetValueOrDefault(key, out value);

A: Just like you would create a Dictionary instance for a regular variable. With new.
var dict = new Dictionary <int, Dictionary<int, int>>
{
  {0, new Dictionary<int, int>()},
  {1, new Dictionary<int, int>()},
};

Note that the outer dictionary has to be of type Dictionary<int, Dictionary<int,int>> because you cannot have some values be of one type and others be of another type. If that is your goal it's best to define a custom class which has an int as well as an optional Dictionary member as well as some logic that tells which of the two is currently in use.
Using "object" is usually not recommended as you fully loose type safety with that.


text:
Q: How can I make two divs of the same class move across the screen? I want certain divs to move across the screen in Javascript, a bit like this website (scroll down), only horizontally, or like here (also vertical, but I would love it horizontal)
here is my HTML:

Creators

Name

Text

Name

Text

Name

Text

My CSS:
.big-part {
    color: rgb(230, 230, 230);
    background-color: #3c3c91;
    border-radius: 21px;
    padding: 0.5% 1.5%;
    margin-top: 2%;
}
.creator_name {
    background-color: rgb(230, 230, 230);
    height: 300px;
    color: #3c3c91;
    border-radius: 15px;
    padding: 1%;
}
.creator_name {
    width: 25%;
    display: inline-block;
    margin: 2% 2%;
}

and my javascript that is in a script tag:
var creatorEl= document.getElementsByClassName("creator_name");

var startTime = new Date().getTime();
var moveTheDiv = function() {
    var currTime = new Date().getTime();
    var secondsElapsed = ((currTime - startTime)/1000);
    var newLeft = parseFloat(secondsElapsed) * 30 + "px";
    creatorEl.style.left = newLeft;
    window.requestAnimationFrame(walkTheCat);
};
moveTheDiv();

Thanks!
By the way, it would be great for this animation to happen only when the client/user has scrolled down and the div is visible.
You can answer half of the question if you want, I will take any help.
EDIT:
I can make them move only if I add an ID to each and move them with the ID, is there a way to move them both at the same time but only using a class?

A: You may find the animation engine Velocity.js helpful. http://julian.com/research/velocity/ (I'm not affiliated with the creator).
You implement functions similar to the jQuery's .animate() method.
Here is an example of how to spin a div:

$(document).ready(function(){
   $('#divToAnimate').velocity(
    { rotateX: "+=0",
      rotateY: "+=360",
      height: '+=50px',
      width: '+=100px'
    },
    {
      duration:4000,
      loop:false,
      easing:'linear'
  });
});
<!DOCTYPE html>

  <meta charset="utf-8">
  <title>Sample animation with Velocity.js</title>

Example Div to Animate

Hope helpful and good luck!


text:
Q: Guide me on iOS Developer Program I have iOS Developer Program membership for which i paid $99.  I have installed that certificate in one system, and I'm able to run my application on my real device.
Is it possible to install this certificate on my another system, such that I can run my application on another real device? When I try to install the same certificate on another system, I'm not able to get it working.

A: Read Submitting iPhone Apps To The Apple App Store – A Step by Step Guide—in particular, the last paragraph, "Managing Your Digital Identities":

Also read: iOS Development Workflow Guide: Managing Devices and Digital Identities

A: You can definitely install the certificate on other systems. Please tell us the error message(s) you are getting.
Please make sure that you are exporting your certificates correctly and importing them on other system with the correct password.
Hope this helps,
Thanks,
Madhup

A: You have two ways to install the App in to device.
One is: you can add the new device UDID to the provisioning profile and you can run through your system
If you want to run from other system then follow the 2nd one
2nd is: You have to create a .p12 certificate from you systems keychain.
Goto -> Application -> Utilities -> KeyChains.
right click on your certificate and click export, enter some password(for security reasons). Then it will create a .p12 certificate.
You have to install this certificate in the other system by giving the specific password that you have give while creating. Then those will be installed in the other system.
Thats it. Then follow the first step, and enjoy by installing app into other device.
Regards,
Satya


text:
Q: Undefined test for an enumeration with Acceleo First of all : thank for the support !
My problem : I want to simply test if an "enumerated" attribute is defined or not.
Let's say I have :

*

*an EnumValues enumeration with 2 values VALEUR1 and VALEUR

*an EObject object with an optional attribute value

I would have expected to test the value existence thanks to this expression :
object.value.oclIsUndefined()

But this expression always retuens true as the value attribute seems to be initialized with the first value of the enumeration. The only bypass way I've found is to not declare EnumValues as an Enum but as an EObject. Then the oclIsUndefined() method returns false when the attribute is not set in the model. BTW my model is generated thanks to Xtext.
It seems to be a stupid question but I'm not able to find the answer on Google, in the OCL specification or in the Acceleo resources.
The only material I've found here says that the only way to achieve this is to use the isUndefined or the more general isUndefined('value') OCL helper methods. But I'm not able to decline this in the Acceleo environnement.
Do you have any idea ?
Thanks in advance for your reply !
Stéphane

A: In EMF, Enumerations have a default value (by default, the first enum literal of your enumeration), if you really want to create an enumeration with a default value, use this. Keep in mind that it's not the "regular" behavior for enumeration in EMF.
Acceleo is just reporting you what EMF tells: "your enumeration has a value".
You can test in Acceleo your enumeration with the following expression:
[myObject.myEnumValue = MyEnum::MyEnumLiteral/]

As explained in the wiki.
Regards,
Stephane Begaudeau, leader of Acceleo

A: I would do the following:

*

*use a manually maintained metamodel in Xtext

*but do NOT add a Dummy Literal to the EEnum

*A Cleaner solution is imho to declare the EAttribute that contains the Enum value as unsettable and thus EMF will tell you if the value was explicitely set or is default.


text:
Q: Why we use async/await in nodejs if it is already an asynchronous and in javascript also vice vera? Sorry I am a noob and a  very beginner with Javascript and NodeJS. :(
Pardon me for asking this silly question.
So I am here a little bit confused. I searched a lot but didn't get the appropriate understanding. My question is simple:

Javascript is synchronous and we use async/await for the callbacks.
Nodejs is asynchronous but also then we use async/await nodejs also.

I really don't get this. How's is it happening? Maybe someone can give me a clear picture of this with some proper and easy to understand examples.
Thanks!

A: Javascript and Nodejs, code written in both works synchronously. Based on functional requirement we make the execution of code asynchronous by adding async/await.


text:
Q: How to round a float string inside a format specifier print statement I'm using a format specifier inside a print statement in python to print the output as columns. I have a float variable which I would like to round off to two decimal palaces without using the round function within the print statement. How can I go about doing this?
price = 1.25 * 3.55 #4.4375
print('{:<15}{:<15}{:<15.2f}'.format('Panadol','2 Units', price))
# I need the output to be
# Panadal    2 units    4.44

The above piece of code throws an error stating that this is an invalid format specifier. How to achieve the above output?
Edit : Pasting the error message
***Run error***
Traceback (most recent call last):
  File "__tester__.python3", line 33, in <module>
    print('{:>15}{:>15}{:>15}{:>15.2f}'.format(apple_item_name,apples_weight,apple_price_pink_lady,str(total_price_of_apples)))
ValueError: Unknown format code 'f' for object of type 'str'


text:
Q: How to configure tomcat for https when you already setup https in application level There are thousands of articles on how to set up HTTPS in either tomcat or at the application level in your spring boot application. But I didn't find a way to configure tomcat for an application that already has configured HTTPS.
I've already set up my spring boot application to run on HTTPS by configuring these properties:
server.port=7070
server.ssl.enabled=true
server.ssl.key-store-password=my_password
server.ssl.key-store-type=PKCS12
server.ssl.key-store=keystore-path
server.ssl.key-alias=key_alias

And it perfectly works when I run my IDE(Intellij) and serves on https://localhost:7070 on my machine.
On the other hand, When I deploy my app into the tomcat. it runs on the port of tomcat which is defined on server.xml connector. for instance :
<Connector port="7071" protocol="HTTP/1.1"  connectionTimeout="20000" />

By doing so, The connector port in tomcat overrides the port number on the application.properties.
So  if I want to run my application in HTTPS in tomcat, Documents says I need to define a new connector, for example :
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxThreads="150" SSLEnabled="true">
        <SSLHostConfig>
            <Certificate certificateKeystoreFile="conf/localhost-rsa.jks"
                         type="RSA" />
        </SSLHostConfig>
</Connector>

or
<Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"
               maxThreads="150" SSLEnabled="true" >
        <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
        <SSLHostConfig>
            <Certificate certificateKeyFile="conf/localhost-rsa-key.pem"
                         certificateFile="conf/localhost-rsa-cert.pem"
                         certificateChainFile="conf/localhost-rsa-chain.pem"
                         type="RSA" />
        </SSLHostConfig>
    </Connector>

But these ways, I have to configure my Keystore, password, alias, and ... again in my tomcat.
I'm wondering is there any other way around not configuring again my Keystore, password and .. again in tomcat?

A: No, there is no other way around it. server.* properties are only applied when running the application in an embedded container. When deploying to an existing Tomcat instance, they are not used.


text:
Q: R Vectorize FOR loop using previous iteration values Is it possible to vectorize / speed up the execution of a FOR loop that is using the previous iteration values ?
In the reproductive example below :

*

*the current production is computed from the current stock

*the current production updates the NEXT stock

*the next iteration used the updated stock to determine the current production, etc...

So I need to compute the stock at each iteration, in order to compute the production setpoint... Is it possible to avoid (slow) for loop ?
The current implementation takes about 45 seconds for 50k lines.
# Dummy functions for the examples. Real code is more complicated
function1 <- function(energy, stock, critical) {
    if (stock < critical) {
        return (energy)
    } else {
        return(0)
    }
}
function2 <- function(power) {
  return(round(power/100))
}
# Dummy data
d <- data.frame( "energy"= c(660, 660, 660, 660),
                 "stock" = c(20,   0,    0, 0),
                 "delivery" = c(0, 0, 2, 0),
                 "critical" = c(50, 50 ,50, 50),
                 "power" = c(0, 0, 0, 0),
                 "production" = c(0, 0, 0, 0) )

for (i in 1:length(d$energy)) {

  # Computing power, based on CUURENT stock
  d$power[i] <- function1(d$energy[i], d$stock[i], d$critical[i])

  # Computing production
  d$production[i] <- function2(d$power[i])

  # Updating NEXT stock with current production / delivery
  if (i < length(d$energy)) {
    d$stock[i+1] <- d$stock[i] + d$production[i] - d$delivery[i]
  }
}

View(d)

A: One possibility is to use the dplyr package which is part of the tidyverse.
library(dplyr)

d %>%
  mutate(power = function1(energy, stock, critical),
         production = function2(power),
         stock_new = cumsum(stock + lag(production - delivery, 1, default = 0)))

  energy stock delivery critical power production stock_new
1    660    20        0       10   500          5        20
2    660     0        0       10   500          5        25
3    660     0        2       10   500          5        30
4    660     0        0       10   500          5        33

This works easily if the functions function1 and function2 are vectorized. If not, you would have to use purrr::map inside mutate.

A: In base you could use Reduce with accumulate = TRUE like:
fun  <- function(x,y) {
    ttStock <- x[[2]] + x[[6]] - x[[3]]
    ttPower <- function1(y[[1]], ttStock, y[[4]])
    ttProduction <- function2(ttPower)
    c(y[[1]], ttStock, y[[3]], y[[4]], ttPower, ttProduction)
}
d$power[1] <- function1(d$energy[1], d$stock[1], d$critical[1])
d$production[1] <- function2(d$power[1])
do.call(rbind, Reduce(fun, as.data.frame(t(d[-1,])), d[1,], accumulate = TRUE))
#  energy stock delivery critical power production
#1    660    20        0       50   660          7
#2    660    27        0       50   660          7
#3    660    34        0       50   660          7
#4    660    39        2       50   660          7

To make it easier I fill in power and production in the first line of d.
In case you would use the Names instead of the column numbers:
fun  <- function(x,y) {
    names(x)  <- colnames(d)
    ttStock <- x[["stock"]] + x[["production"]] - x[["delivery"]]
    ttPower <- function1(y[[1]], ttStock, y[[4]])
    ttProduction <- function2(ttPower)
    c(y[[1]], ttStock, y[[3]], y[[4]], ttPower, ttProduction)
}

A: How about saving the state across function calls.
my_env <- new.env(parent = emptyenv())
my_env$stock <- d$stock[0]

f <- function(item){
   power <- function1()
   production <- function1()/100
   stock <- my_env$stock
   ....
   rest of the businesss logic
   ...
}

apply(d, 2, f)