text:
Q: get child id from parent javascript onclick I have the script bellow and i want to get the id of the child removed

Ajout d'un champ

        <form class="tiny_form" id="form-step2">
            <input type="text" id="fiel" placeholder="Nom du champ" />

    <select class="form-control" id="champs">
</select>

        </form>

        <input type="submit" class="page-next center btn btn-lg btn-default" value="Créer" />

{% endblock %}

{% block javascripts %}

my problems is how to get the id of the removed input text after clicking on remove button.
this is  picture of the output
output
Thanks for your helps

A: You can use siblings method to get the id of input element
//fadeout selected item and remove
$("#form-step2").on('click', '.dynamic-link', function () {
    var myId = $(this).siblings('input[type=text]').attr('id');
    alert(myId)
    $(this).parent().fadeOut(300, function () {

        $(this).empty();
        return false;
    });
});

A: You can use getAttribute() function:
// your stuff
var myId = c.getAttribute("id");
c.remove(c.selectedIndex);
// more stuff

EDIT
Maybe you need it here:
//fadeout selected item and remove
$("#form-step2").on('click', '.delete', function () {

    $(this).parent().fadeOut(300, function () {

        var myId = $(this).attr('id');

        $(this).empty();
        return false;
    });
});

Be more specific please
EDIT2
That's the solution:
//fadeout selected item and remove
$("#form-step2").on('click', '.delete', function () {

    $(this).parent().fadeOut(300, function () {

        var myId = $(this).find('input[type=text]').attr('id');

        $(this).empty();
        return false;
    });
});

See it working: http://jsfiddle.net/vWPJf/57/


text:
Q: How do you convert UINT8 to UINT32 in C++? I have a value of type UINT8 and I would like to make it UINT32.
Would my following code be considered correct, valid, efficient and safe?
UINT32 convU8toU32(UINT8 *number) {
  UINT32 result = *number;
  return *result;
}

Please notice that I'm a new comer to C++ from the Java world.

A: The function is correct as is (the typo with the * in the return *result; aside), but you don't even need it. Integers (and other integral types) convert implicitly to one another, and as UINT32 can represent every value a UINT8 can have, you can simply write
UINT32 target = source;

for some UINT8 source.
Making the conversion explicit with a static_cast is optional; if the conversion was (potentially) narrowing, the cast would silence some compiler warnings.

A: You need
 UINT32 result = static_cast<UINT32>(*number);

to de-refernce the pointer and cast it to the right type
But would
UINT32 convU8toU32(UINT8 number) {
   return static_cast<UINT32>(number);
}

be better and avoid pointers in the first place
Event better avoid the function call and type in the static cast in the appropriate line of code.

A:
UINT32 convU8toU32(UINT8 *number) {
  UINT32 result = *number;
  return *result;
}

I assume in my answer that UINT32 and UINT8 are fancy aliases for fundamental integer types.

Would my [...] code be considered

*

*correct, valid

No, given my assumption that UINT32 is an integer. You cannot dereference an integer. Which is what you try to do on line return *result;

*

*efficient

Does not matter since it is not correct.

*

*safe

Well, it safely fails to compile.

This should be OK:
UINT32 convU8toU32(UINT8 number) {
    return number;
}

Of course, this is so simple that you may want to consider not calling the function, but assign directly in the first place:
// not UINT32 foo = convU8toU32(some_uint8);
// but instead:
UINT32 foo = some_uint8;

A: Well, no.   Assuming UINT32 is a 32-bit unsigned integral type and UINT8 is an 8-bit unsigned integral type, your code
UINT32 convU8toU32(UINT8 *number) {
   UINT32 result = *number;
   return *result;
}

would not even compile.    The reason is that an integral type cannot be dereferenced as if it is a pointer.   The statement return *result will therefore not compile, let alone be executed.
In reality, converting an 8-bit unsigned integral value to a 32-bit unsigned integral type is perfectly simple.
UINT32 convU8toU32(UINT8 number)
{
   UINT32 result = number;
   return result;
}

or, even more simply,
UINT32 convU8toU32(UINT8 number)
{
   return number;
}

These rely on implicit conversions to 32-bit unsigned integral type.  Since a 32-bit unsigned integral type can exactly represent every value that an 8-bit unsigned integral type can, the conversion preserves value.    Conversion the other way (from 32-bit to 8-bit) potentially loses value.
If you want to avoid implicit conversions, simply do an explicit conversion, such as
UINT32 convU8toU32(UINT8 number)
{
    return (UINT32) number;    // C-style conversion - discouraged in C++
}

or
UINT32 convU8toU32(UINT8 number)
{
    return UINT32(number);
}

or (to really make it obvious to anyone looking, and easy to find when searching a source file)
UINT32 convU8toU32(UINT8 number)
{
    return static_cast<UINT32>(number);
}

Of course, a function isn't even needed
 UINT8 value8 = something();
 UINT32 value32 = value8;

will do instead of using this function.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How do you test your blackberry application on the device? This may sound very noobish, but I can't seem to get my app to my blackberry.
I was trying to follow the beginning blackberry development book's guide, but maybe I just missed the point somewhere.
For remote download, Is it really as simple as drop the COD and JAD files in the same folder on your server then just navigate to the URL with your device's browser? The book says it should prompt a download screen, but all I get is a page full of cryptic characters.
My app is a simple slideshow. Uses no signed things and is not MDS enabled. Did I forget something?
Any help would be appreciated.
Thanks

A: The easiest way to do it during development is to use javaloader:
javaloader.exe -u load myapp.cod

Where "myapp.cod" is the single COD file generated by the rapc compiler (and optionally signed if required).
If you do want to install it "OTA" (over the air) from your webserver, make sure you are deploying the JAD file and individual COD files (if it's a large app).  Also make sure that your webserver MIME types are set properly for the .jad and .cod file extensions.

A: You could true bluetooth the COD and JAD files to your blackberry


text:
Q: Sort millions of text files in a folder using unix sort I am trying to sort a lot of files (millions ie approx 2.5m) .txt files in a folder called NZParsed.
All the files in the folder are named like 1.txt 2.txt and so on till 25xxxxx.txt
After running the following command in eclipse :
os.system("sort -k1,1 -k3,3n -k4,4n -y 1048576 /home/viraj/NZ/NZParsed/* -o /home/viraj/NZ/SplitIndex/abcd.txt")

I get an error:
sh: 1: sort: Argument list too long

Can anyone tell me any other way I could sort all these files into 1 file and split them using the following command in eclipse:
os.system("split -C 200m /home/viraj/NZ/SplitIndex/abcd.txt /home/viraj/NZ/SplitIndex/")

A: The problem has nothing to do with eclipse or python. You are hitting the ARG_MAX limit, for more details see here but briefly, this is the limit of how many bytes the list of arguments to a command can be.
So, to avoid this, you need to sort in a way that does not list the files. For example:
for i in /home/viraj/NZ/NZParsed/*; do cat "$i" ; done |
    sort -k1,1 -k3,3n -k4,4n -y 1048576 > /home/viraj/NZ/SplitIndex/abcd.txt

The command above will cat each file and then pass the contents of all files through your sort command. That way, the files are never listed and you won't have the ARG_MAX problem.
Another approach would be to use find's -exec option:
find /home/viraj/NZ/NZParsed/ -type f -name '[0-9]*.txt' -exec cat {} + |
    sort -k1,1 -k3,3n -k4,4n -y 1048576 > /home/viraj/NZ/SplitIndex/abcd.txt


text:
Q: Separate Images for App Icon and for App Store in iOS Is it acceptable by Apple (as its not mentioned in any guidelines, so asking if anyone has gone through this) to use different 1024x1024 image for App Store than one used for other App Icons?
So other app icons like app icon, settings, spotlight, notifications etc use one image but only App Store image is different.
Different means it has App Icon plus some text.

A:
Is it acceptable by Apple

We are programmers, not oracles. What Apple will do is utterly unknown and is not a programming question. To find out what will happen, try it!
However, I would say: Probably not. I tried that once and my app was rejected because the App Store icon didn't match the app icon.


text:
Q: How to read the soap data in web service? How to access or read the data passed to the web service , data send to web service is in the form of SOAP  ?
Thanks and Regards

A: If I understand question correctly you are trying to intercept the data that is being sent to the webservice.
If this is true, then you could use fiddler, it's a tool that works as a proxy between you and network and is able to intercept messages being sent.
After you have finished install you would need to run fiddler then make a call from your application to web service and then find the url of webservice in the list of calls (left window). Click on that url on the right window will open. (Top) Click on the tab Inspectors -> Raw  this should show you the data that has been sent to web service and on the bottom window by clicking Raw you can see what did web service responded with.
Check screenshot below.


text:
Q: Reading HDFS small size partitions? Our data loads into hdfs with partition columns as date daily. The issue is each partition has small file size less than 50mb. So when we read the data from all these partition to load the data to next table take  hours. How can we address this issue?

A: I'd suggest you to run end of the day job to coalesce/combine and make a large file which is significantly bigger in size for processing in spark, before reading from spark.
Further reading cloudera blog/docs to address these problems
Partition Management in Hadoop where several techniques were discussed to address these problems like

*

*
*

*Merge partitions on selected tables

*

*Archiving cold data

*

*Delete partitions

Select one of the technique discussed in cloudera blog to match your kind of requirements. Hope this helps!

Other good options Typical use case  is using open source delta lake/ if you are using databricks go for their delta lake for getting rich set of features...
Example maven coordinates.
<dependency>
  <groupId>io.delta</groupId>
  <artifactId>delta-core_2.11</artifactId>
  <version>0.6.1</version>
</dependency>

using delta. lake you can insert/update/delete the data as you want. it will reduce maintenance steps...
Compacting Small Files in Delta Lakes


text:
Q: Continuum between arithmetic mean, AGM, and geometric mean NOTE: I am aware of this possible duplicate, but my question is slightly different as it also involves arithmetic-geometric mean.
The arithmetic mean  of two numbers is defined as:
$$\text{am}(a,b) = \frac{a}{2}+\frac{b}{2}$$
For example, $\text{am}(3,12) = 7.5$. Similarly, geometric mean of two numbers is defined as:
$$\text{gm}(a,b) = \sqrt{ab}$$
So $\text{gm}(3,12)=6$. The arithmetic-geometric mean is a mean "between" these two, calculated as follows:
$$
a_{0}=a,g_{0}=b\\
a_{n+1}=\text{am}(a_{n},g_{n})\\
g_{n+1}=\text{gm}(a_{n},g_{n})\\
\text{agm}(a,b)=\text{lim}_{n\rightarrow\infty}\;\;(a_n)
$$
For instance, $\text{agm}(3,12) \approx 8.7407$.
Note that $\text{gm}(a,b)\leq \text{agm}(a,b)\leq \text{am}(a,b)$.
My question: I need to define a general mean $M(a,b,c)$ for $0\leq c \leq 1$ that satifies these properties:
$$
M(a,b,0) = \text{am}(a,b)\\
M(a,b,0.5) = \text{agm}(a,b)\\
M(a,b,1) = \text{gm}(a,b)
$$
Power mean is not what I'm looking for, as $PM_{0.5}\;(a,b) \neq \text{agm}(a,b)$ (e.g. $PM_{0.5}\;(3,12) = 8.7464... \neq 8.7407...$).

A: Standard quadratic interpolation, as suggested by  @Martin-R
\begin{align}
M(a,b,t)&=
(2t-1)(t-1)\operatorname{AM}(a,b)
\\
&-4t(t-1)\operatorname{AGM}(a,b)
\\
&+t(2t-1)\operatorname{GM}(a,b)
.
\end{align}
Or in expanded form,
\begin{align}
M(a,b,t)&=
 (\sqrt a+\sqrt b)^2\,t^2
 -(\tfrac32\,a+\tfrac32\,b+\sqrt{ab})\,t
 +\tfrac12\,a+\tfrac12\,b
 \\
 &+\frac{\pi t(1-t)}
 {\displaystyle\int_0^1 \left(\sqrt{1-x^2}\sqrt{(a+b)^2-(a-b)^2\,x^2}\right)^{-1} \, dx }
.
\end{align}

Edit
At the second thought, I must admit that
such interpolation is a bad choice for general $a,b\ge0$.
It's ok for just switching between the three values $t=0,\tfrac12,1$ and works
relatively reasonable for some ranges of $a,b$, but it could
as bad as returning negative output, for example,
$M(1000000,1,0.9)\approx-2081$, so it needs a serious treatment.

A: The geometric mean can be turned to an arithmetic one by a nonlinear mapping,
$$\sqrt{ab}=f^{-1}\left(\frac{f(a)+f(b)}2\right)$$ where $f(x):=\log(x)$ is the logarithm.
Hence a way to construct "intermediate" means is by using a function intermediate between the identity and the logarithm. You could obtain yours by solving the functional equation
$$2f(\text{agm}(a,b))=f(a)+f(b).$$
By homogeneity, it should be enough to solve
$$2f(\text{agm}(a,1))=f(a)+f(1).$$
Of course solving this equation seems arduous. I guess that you can solve it numerically and tabulate $f$. Then you'll have a generalization of the arithmetico-geometric mean for $n$ arguments.
Whether you can find a natural "interpolation" between these three means seems even less tractable.


text:
Q: Comparing Data Graphs Using C# GetHashCode() I have a graph of data that I'm pulling from an OAuth source using several REST calls and storing relationally in a database.  The data structure ends up having about 5-10 tables with several one-to-many relationships.  I'd like to periodically go a re-retrieve that information to see if updates are necessary in my database.
Since I'm going to be doing this for many users and their data will likely not change very often, my goal is to minimize the load on my database unnecessarily. My strategy is to query the data from my OAuth provider but then hash the results and compare it to the last hash that I generated for the same dataset.  If the hashes don't match, then I would simply start a transaction in the database, blow away all the data for that user, re-write the data, and close the transaction.  This saves me the time of reading in the data from the database and doing all the compare work to see what's changed, what rows were added, deleted changed etc.
So my question:  if I glue all my data together in memory as a big string and use C# GetHasCode(), is that fairly reliable mechanism to check if my data has changed?  Or, are there any better techniques to skinning this cat?
Thanks

A: Yes, that's a fairly reliable mechanism to detect changes. I do not know about the probabilty of collisions in the GetHashCode() Method, but I'd assume it to be safe.
Better methods: Can't the data have a version-stamp or timestamp that is set everytime something changes?


text:
Q: flask wsgi file configuration I have created a flask app.I want to run this both development and production server.
This is my app.py file:
app = Flask(__name__)

db = SQLAlchemy(app)

app.config.from_object(Config)
db.init_app(app)

if __name__ == "__main__":
    app.run()

this is my wsgi.py file:
from app import app as application

app = application

if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0', port=5000)

I want to know if my wsgi configurtion is ok or is it the right way to do it.How can i make sure my production server will run wsgi.py file with the production database configuration?In local i am getting this warning Use a production WSGI server instead.the way i configured willl it ensure it will run on wsgi server in prodcution?While i run this command:
uwsgi --wsgi-file app.py --http :5000

i am getting internal server error in localhost:5000.

A: One way of handling this is by having a configuration file (config.py) that contains classes for each environment. Then within each of your environments, you'd have a .env file that contains environment-specific variables, such as database URIs, secret keys, etc.
Example config file:
from os import environ, path
from dotenv import load_dotenv

basedir = path.abspath(path.dirname(__file__))
load_dotenv(path.join(basedir, '.env'))

class Config:
    """Base config."""
    SECRET_KEY = environ.get('SECRET_KEY')
    SESSION_COOKIE_NAME = environ.get('SESSION_COOKIE_NAME')
    STATIC_FOLDER = 'static'
    TEMPLATES_FOLDER = 'templates'

class ProdConfig(Config):
    FLASK_ENV = 'production'
    DEBUG = False
    TESTING = False
    DATABASE_URI = environ.get('PROD_DATABASE_URI')

class DevConfig(Config):
    FLASK_ENV = 'development'
    DEBUG = True
    TESTING = True
    DATABASE_URI = environ.get('DEV_DATABASE_URI')

Then, in your application, you can specify which config class you'd like to load.
ENV = environ.get("environment")

# Using a production configuration
if ENV=='PROD':
    app.config.from_object('config.ProdConfig')

# Using a development configuration
if ENV=='PROD':
    app.config.from_object('config.DevConfig')

For more details, Flask has some docs on this situation


text:
Q: What is this word sounding like swanyey? In this video, the narrator is saying something like the following:

So, to be always clean and "swanyey", ..."?

What does come after "clean and"?

A: Soigné (or is that soignée?)

soigné adjective
1 : well-groomed, sleek
2 : elegantly maintained or designed
https://www.merriam-webster.com/dictionary/soign%C3%A9


text:
Q: Lucene.net matchphase query doesn't work I'm trying to use match phrase query, but it keeps yielding no results. What did I do wrong here? I use Lucene.net 3.0.3
using (var dir = new RAMDirectory())
            {
                var queryText = "Bruce Wayne";
                Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_29);

                var sampleDocs = new SortedSet<String>() { "Bruce Wayne", "Wayne Bruce", "Bruce Batman Wayne" };

                using (var writer = new IndexWriter(dir, analyzer, create: true, mfl: IndexWriter.MaxFieldLength.LIMITED))
                {
                    foreach (var sampleDoc in sampleDocs)
                    {
                        var doc = new Document();
                        doc.Add(new Field("id", Guid.NewGuid().ToString("N"), Field.Store.YES, Field.Index.NOT_ANALYZED));
                        doc.Add(new Field("name", sampleDoc, Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS));

                        writer.AddDocument(doc);
                    }
                }

                var searcher = new IndexSearcher(dir, true);

                var query = new PhraseQuery()
                {
                    Slop = 2
                };

                foreach (var item in queryText.Split(new [] {' '}, StringSplitOptions.RemoveEmptyEntries))
                {
                    query.Add(new Term("name", item));
                }

                TopDocs docs = searcher.Search(query, 1000);
            }

A: Problem solved - I forgot to lowercase the query text


text:
Q: Импортировать содержимое таблиц (ячеек) из xlsx файла в соответствующие SQLite3 таблицы import openpyxl
from openpyxl import load_workbook
import sqlite3

con = sqlite3.connect('test14.db')
cur = con.cursor()
wb = load_workbook(filename = 'abc.xlsx')
sheets = wb.sheetnames

def get_table ():
    for sheet in sheets:
        ws = wb[sheet]
        create_table = 'CREATE TABLE ' + str(sheet) + '(ID INTEGER PRIMARY KEY AUTOINCREMENT'
        for row in next(ws.rows):
            create_table += ', ' + str (row.value) + ' TEXT'
        create_table += ')'
        cur.execute(create_table)

    """ При использование этих переменных для добавления в таблицу, добавление проходит"""
    sql_2 = "INSERT INTO name_1(Number_biulding, Date_pay, Day_fine, Summa) VALUES (?, ?, ?, ?)"
    sql_3 = (5,5,5,5)

    insert_part_1 = 'INSERT INTO ' + str(sheet) + '('
    insert_part_2 = ''
    insert_value = '('

    for col in ws.iter_rows(min_row=0, max_col=4, max_row=1):
        for cell in col:
            cell.value = str(cell.value)
            insert_part_1 += cell.value + ', '
            insert_part_2 += '?, '

    for celt in ws.iter_rows(min_row=2, max_col=4, max_row=2):
        for val in celt:
            val.value = str(val.value)
            insert_value += val.value + ', '

    insert_part_1 = insert_part_1[:-2]+ ') VALUES ('
    insert_part_2 = insert_part_2[:-2] + ')'
    insert_value = insert_value[:-2] + ')'
    insert = insert_part_1 + insert_part_2

    cur.execute(insert,insert_value)# Не добавляет
    cur.execute(sql_2,sql_3)# Добавляет

    """
    Запрос не проходит хотя при сравнении они обсолютно одинаковые.
    >>> print (insert)
    INSERT INTO name_1(Number_biulding, Date_pay, Day_fine, Summa) VALUES (?, ?, ?,?)
    >>> print (insert_value)
    (5, 5, 5, 5)
    и при
    >>> print (sql_2)
    INSERT INTO name_1(Number_biulding, Date_pay, Day_fine, Summa) VALUES (?, ?, ?, ?)
    >>> print (sql_3)
    (5, 5, 5, 5)
    """

get_table()

# Завершаем транзакцию
con.commit()
# Закрываем объект-курсор
cur.close()
# Закрываем соединение
con.close()

помогите пожайлуста исправить.
Вот что выдает: sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 4, and there are 12 supplied.

A: Попробуйте воспользоваться модулем Pandas:
import pandas as pd
import sqlite3

fn = r'D:\temp\test.xlsx'

# read & parse all excel sheets into a dictionary (keys - sheet names, values - pandas DataFrames)
dfs = pd.read_excel(fn, sheet_name=None)

conn = sqlite3.connect(r'D:\temp\output.sqlite')

# save DataFrames as SQLite tables
for tab, df in dfs.items():
    df.to_sql(tab, conn, index=False, if_exists='replace')


text:
Q: d3 js drag event listener isnt getting the event - (d3, react) I'm trying to add drag event to my d3 force layout, but for some reason, the event attr isn't defined so nothing happens. I know there were changes in the new doc of d3-drag and I followed these instructions.
heres my code:
    const node = svg
      .selectAll("circle")
      .data(nodes)
      .enter()
      .append("circle")
      .attr("r", 35) // radius field, so width and height 80X80
      .attr("stroke", "lightgray")
      .attr("stroke-width", 0.5)
      .style("fill", "lightgray")
      .call(handler
      .on('start', dragstarted)
      .on('drag', dragged)
      .on('end', dragended)

the event functions:
    const dragstarted = (event: any, d: any) => {
      console.log(' dragged d', d);
      console.log('event', event);

      // eslint-disable-next-line @typescript-eslint/ban-ts-comment
      // @ts-ignore
      if (!event.active) {
        simulation.alphaTarget(0.3).restart();
      }
      d.fx = d.x;
      d.fy = d.y;
    }

    // eslint-disable-next-line @typescript-eslint/ban-ts-comment
    // @ts-ignore
    const dragged = (event: any, d: any) => {
      console.log(' dragged d', d);
      console.log('event', event);

      d.fx = event.x;
      d.fy = event.y;
    }

    // eslint-disable-next-line @typescript-eslint/ban-ts-comment
    // @ts-ignore
    const dragended = (event: any, d: any) => {
      console.log(' dragended  d', d);
      console.log('event', event);

      // eslint-disable-next-line @typescript-eslint/ban-ts-comment
      // @ts-ignore
      if (event.active) {
        simulation.alphaTarget(0);
      }

      d.fx = null;
      d.fy = null;
    }

the example from the docs :
  d3.drag()
       .on("start", (event, d) => circle.filter(p => p === d).raise().attr("stroke", "black"))
       .on("drag", (event, d) => (d.x = event.x, d.y = event.y))
       .on("end", (event, d) => circle.filter(p => p === d).attr("stroke", null))

and this is what i get :
Uncaught TypeError: Cannot read properties of undefined (reading 'document')
    at nodrag.js:5

I added screenshots for the place its failing to get the event

I don't get what I do wrong here, thanks for the help.
EDIT
full example with the code :
https://stackblitz.com/edit/react-saqrv9?file=src%2Fgraph.tsx

A: notice that the new API isn't using d3.event but the event passed to the event listener.
updated snippet for example for anyone who is interested, I know there's not many examples out there, so have fun
https://stackblitz.com/edit/react-saqrv9?file=src%2Fgraph.tsx


text:
Q: Bootstrap design idea I would like to get an idea from you guys. I have 3 checkboxes that I would like to display one in each line inside a box, kind of like a text area. What Bootstrap tool would allow me to accomplish that?
I tried to create a text area and out my checkboxes in them, but the code is translated as text in the text area. So I could not do that. What's the way of doing it?

A: You shouldn't restrict yourself to using only Bootstrap elements when making your site. Bootstrap is just a collection of nifty elements; it's fine (and probably necessary) to make your own, too.
If you just want your checkboxes to be in a box with an outline, well, that's a bit too simple for there to be a corresponding Bootstrap element.
In the simplest form, the HTML and CSS for this would look like this JSFiddle.
Html

  <input type='checkbox' id='one'>
  Hello

Css
.checkbox-container {
  margin: 10px 0;
  padding: 10px 0;
  border: 1px solid #aaa;
}

If you want all of the checkboxes in a single box, then you can do that with just a bit more code. View on JSFiddle.
If for some strange reason you must only use use Bootstrap elements, ananda's answer is pretty good. Using the well element gives you a border, but also an inner shadow and a background color. View the well on JSFiddle

A: try putting them inside the 'well' element


text:
Q: Get class labels from Keras functional model I have a functional model in Keras (Resnet50 from repo examples). I trained it with ImageDataGenerator and flow_from_directory data and saved model to .h5 file. When I call model.predict I get an array of class probabilities. But I want to associate them with class labels (in my case - folder names). How can I get them? I found that I could use model.predict_classes and model.predict_proba, but I don't have these functions in Functional model, only in Sequential.

A: y_prob = model.predict(x)
y_classes = y_prob.argmax(axis=-1)

As suggested here.

A: In addition to @Emilia Apostolova answer to get the ground truth labels, from
generator = train_datagen.flow_from_directory("train", batch_size=batch_size)

just call
y_true_labels = generator.classes

A: When one uses flow_from_directory the problem is how to interpret the probability outputs. As in, how to map the probability outputs and the class labels as how flow_from_directory creates one-hot vectors is not known in prior.
We can get a dictionary that maps the class labels to the index of the prediction vector that we get as the output when we use
generator= train_datagen.flow_from_directory("train", batch_size=batch_size)
label_map = (generator.class_indices)

The label_map variable is a dictionary like this
{'class_14': 5, 'class_10': 1, 'class_11': 2, 'class_12': 3, 'class_13': 4, 'class_2': 6, 'class_3': 7, 'class_1': 0, 'class_6': 10, 'class_7': 11, 'class_4': 8, 'class_5': 9, 'class_8': 12, 'class_9': 13}

Then from this the relation can be derived between the probability scores and class names.
Basically, you can create this dictionary by this code.
from glob import glob
class_names = glob("*") # Reads all the folders in which images are present
class_names = sorted(class_names) # Sorting them
name_id_map = dict(zip(class_names, range(len(class_names))))

The variable name_id_map in the above code also contains the same dictionary as the one obtained from class_indices function of flow_from_directory.
Hope this helps!

A: You must use the labels index you have, here what I do for text classification:
# data labels = [1, 2, 1...]
labels_index = { "website" : 0, "money" : 1 ....}
# to feed model
label_categories = to_categorical(np.asarray(labels))

Then, for predictions:
texts = ["hello, rejoins moi sur skype", "bonjour comment ça va ?", "tu me donnes de l'argent"]

sequences = tokenizer.texts_to_sequences(texts)

data = pad_sequences(sequences, maxlen=MAX_SEQUENCE_LENGTH)

predictions = model.predict(data)

t = 0

for text in texts:
    i = 0
    print("Prediction for \"%s\": " % (text))
    for label in labels_index:
        print("\t%s ==> %f" % (label, predictions[t][i]))
        i = i + 1
    t = t + 1

This gives:
Prediction for "hello, rejoins moi sur skype":
    website ==> 0.759483
    money ==> 0.037091
    under ==> 0.010587
    camsite ==> 0.114436
    email ==> 0.075975
    abuse ==> 0.002428
Prediction for "bonjour comment ça va ?":
    website ==> 0.433079
    money ==> 0.084878
    under ==> 0.048375
    camsite ==> 0.036674
    email ==> 0.369197
    abuse ==> 0.027798
Prediction for "tu me donnes de l'argent":
    website ==> 0.006223
    money ==> 0.095308
    under ==> 0.003586
    camsite ==> 0.003115
    email ==> 0.884112
    abuse ==> 0.007655

A: It is possible to save a "list" of labels in keras model directly. This way the user who uses the model for predictions and does not have any other sources of information can perform the lookup himself. Here is a dummy example of how one can perform an "injection" of labels
# assume we get labels as list
labels = ["cat","dog","horse","tomato"]
# here we start building our model with input image 299x299 and one output layer
xx = Input(shape=(299,299,3))
flat = Flatten()(xx)
output = Dense(shape=(4))(flat)
# here we perform injection of labels
tf_labels = tf.constant([labels],dtype="string")
tf_labels = tf.tile(labels,[tf.shape(xx)[0],1])
output_labels = Lambda(lambda x: tf_labels,name="label_injection")(xx)
#and finaly creating a model
model=tf.keras.Model(xx,[output,output_labels])

When used for prediction, this model returns tensor of scores and tensot of string labels. Model like this can be saved to h5. In this case the file contains the labels. This model can also be exported to saved_model and used for serving in the cloud.

A: UPDATE: This is no longer valid for newer Keras versions. Please use argmax() as in the answer from Emilia Apostolova.
The functional API models have just the predict() function which for classification would return the class probabilities. You can then select the most probable classes using the probas_to_classes() utility function. Example:
y_proba = model.predict(x)
y_classes = keras.np_utils.probas_to_classes(y_proba)

This is equivalent to model.predict_classes(x) on the Sequential model.
The reason for this is that the functional API support more general class of tasks where predict_classes() would not make sense.
More info: https://github.com/fchollet/keras/issues/2524

A: To map predicted classes and filenames using ImageDataGenerator, I use:
# Data generator and prediction
test_datagen = ImageDataGenerator(rescale=1./255)
test_generator = test_datagen.flow_from_directory(
        inputpath,
        target_size=(150, 150),
        batch_size=20,
        class_mode='categorical',
        shuffle=False)
pred = model.predict_generator(test_generator, steps=len(test_generator), verbose=0)
# Get classes by max element in np (as a list)
classes = list(np.argmax(pred, axis=1))
# Get filenames (set shuffle=false in generator is important)
filenames = test_generator.filenames

I can loop over predicted classes and the associated filename using:
for f in zip(classes, filenames):
    ...

Addendum:
The path in which the images are located inputpath needs to have a subdirectory in which the images are actually stored. The reason is that the generator looks for subdirectories. The generator will give a feedback during prediction:
Found 283 images belonging to 1 classes.

The 1 classes part refers to the one subdirectory (this comes from the generator and is unrelated to the actual prediction).
So when your inputpath is (for example) C:/images/, the actual images are located in C:/images/temp/.

A: Just do this magic on your data generator
y_true_labels = train_generator. class_indices
y_true_labels

it will print (cat , dogs on my case)
{'cat': 0, 'dog': 1}

A: You can use:
model.predict(x_test).argmax(axis=-1)


text:
Q: Is $C_c(\mathbb{R}^2,\mathbb{R}^2)$ dense in the irrotational square integrable functions? Let $L_D(\mathbb{R}^n)^n$ be the set of square integrable functions which are the weak derivative of a locally square integrable function. That is
$$L_D(\mathbb{R}^n)^n=\{Du\colon u\in H^1_{loc}(\mathbb{R}^n), Du\in L^2(\mathbb{R}^n)^n\}.$$
For $n>2$ it can be shown that $C_c(\mathbb{R}^n)^n\cap L_D(\mathbb{R}^n)^n$ is dense in $L_D(\mathbb{R}^n)^n$. Is this also true for $n=2$?

A: It is true even for n=1. Consider the Fourier transform of functions u which have $Du\in L_D^n$. For such functions we have
$$\int |k|^2\hat u(k)^2\,dk<\infty.$$
The norm associated with this integral corresponds to the norm in $L_D^n$. In this norm, we can approximate $\hat u$ by a test function; first cut off near zero and infinity and then apply a mollifier. Transforming back, we find that gradients of functions in ${\cal S}$ are dense in $L_D^n$. It is easy to get from there to compact support.


text:
Q: CSS mask not working when used files from local computer I have some problem with CSS mask-image property. Here is link for working code:
https://codepen.io/Nacho20/pen/MWQrPRy . Ok, but when I try to use images for masking from local computer it stops working. Here is code that does not work:

 <title>Hello!</title>

I have downloaded exactly the same images used in the codepen example and have saved them in the same folder as the html file that uses them. Some of the properties are probably  unnecessary - object-fit: cover; , mask-size: cover; and -webkit-mask-size , but I have added them here because they were in the original article that i followed https://www.digitalocean.com/community/tutorials/css-masking-with-mask-image , section Masking Using Images .
Also, I have tried a lot of other examples from codepen that are using CSS masks and if I download the used files on my local computer and try to use them as local mask-image files, it stops working.   I also created a couple of times images in Paint 3D with transparent canvas and some non transparent rectangles, triangles ,etc on the canvas and tried to used them as mask-image file, it doesn't work. I checked 3 or 4 similar questions here but I didn't find answer. In some of them there are advices to change settings of server - ok, but I don't use server at all, just local computer.


text:
Q: Running C++ executable from python script we are currently working on robot Pepper, more specific we are trying to prepare Pepper as welcome manager. So when robot gets input from human to go to a certain location, he should start specific dialog for that location and moving to that location. We did the navigation part in ROS and human-interaction part in Python using Python and Naoqi SDK. Now we want to run C++ exe that starts navigation in Python script. What is the simplest way to do that?

A: Relaying M.A's answer here:

subprocess,
e.g. subprocess.run(["your_exe", "first_arg"]).
You can also do things like capture stdout/stderr from the subprocess,
check return code, wait for subprocess to complete.


text:
Q: IOS What is difference between @"aa" and "aa"? This is my code.
NString *licencenum = @"1234567890";
NSData*terminalID = [NSData dataWithBytes:"1234567890" length:20];
NSData*terminalID1 = [NSData dataWithBytes:@"1234567890" length:20];

What is the difference of terminalID and terminalID1 variable?
I should convert licencenum to terminalID not terminalID1.
Please help.
thanks.

A: @"string" is an NSString object
"string" is a C byte array
dataWithBytes:length: takes a C byte array so your first method call is correct.

A: It is answer of my question.
@"string" is an NSString object
"string" is a C byte array
NString *licencenum = @"1234567890";
const char*str = [licencenum UTF8String];
NSData*terminalID = [NSData dataWithBytes:str  length:20];

Thank you everyone.


text:
Q: Conditional compiler flag to detect storyboard in Xcode? How can you detect if you are in storyboard mode using conditional compiling?

Background: I want to display a static image instead of dynamic one for the storyboard view. I stumbled over an article on how to do that a while ago (so I know it's possible) but I can't find that anymore.

It's something similar to this:
#if storyboard
 statements
#else
 statements
#endif

Any advice?

A: I believe you are looking for TARGET_INTERFACE_BUILDER or prepareForInterfaceBuilder, as described here.


text:
Q: Topological closure of ideal in $A[[T]]$ - Proposition 1.3.7 in Liu In Proposition 1.3.7 of Liu's book, one proves that if a ring $A$ is noetherian then so is $A[[T]]$. We take an ideal $I$ of $A[[T]]$ and prove that there exist $F_1,\ldots,F_m\in I$ such that for all $P\in I$, $n\in \mathbb{N}$ there exist $G_1,\ldots,G_n\in(F_1,\ldots,F_m)$ with $P-\sum_1^n G_i\in\mathfrak{m}^n$ (with $\mathfrak{m}=TA[[T]]$, so $(\mathfrak{m}^n)_n$ is the standard filtration of $A[[T]]$).
For the usual topology on $A[[T]]$ I see that $\sum_1^nG_i$ converges to $P$, but in the proof I need that $\sum_1^\infty G_i$ stays in $(F_1,\ldots,F_m)$ and that I don't see why.
I see that this is a closure property of the ideal $J=(F_1,\ldots,F_m)$ but this don't help me.
I see that we can decompose the sum $\sum_1^nG_i=(A_1^1+\ldots+A_n^1)F_1+\ldots+(A_1^m+\ldots+A_n^m)F_m$ but I don't see why all the sums $A_1^i+\ldots+A_n^i$ should converge.

A: Liu precises that $G_i$ is in $T^i(F_1,\dots,F_m)$, not merely in $(F_1,\dots,F_m)$ (in fact $T^{i-d}(F_1,\dots,F_m)$ in his notation), hence you can write
$$G_1 + G_2 +G_3 + \dots = (A_1^1 T+ A_1^2T^2 + A_1^3T^3 + \dots )F_1 + \dots,$$
which converges in $(F_1,\dots,F_m)$.


text:
Q: Group rows by Year Band Interval I have a table (tbl_people), in this table I have a datetime field I want to group and count the records in groups of 10 years... The result should be something like:
    |   count    | year           |
    |  1000      |  1980-1989  |
    | 250       |  1990-1999  |

I can write multiple queries to do it, but that means I'll have to write different queries for each range. Is there a way to dynamically increment from the least year upwards (10 year intervals) and count the number of records within the intervals?

A: First calculate the decade for each row
select floor(year(`year`) / 10) * 10 as decade
from tbl_people

and then use this intermediate result for counting SQL Fiddle
select count(*), decade, decade + 9
from (select floor(year(`year`) / 10) * 10 as decade
      from tbl_people) t
group by decade

or this SQL Fiddle, if you want the decade in one column
select count(*) as count, concat(decade, '-', decade + 9) as year
from (select floor(year(`year`) / 10) * 10 as decade
      from tbl_people) t
group by decade

A: This should work - SQL Fiddle (thanks to Olaf Dietsche for showing me that this wonderful site exists):
SELECT
    COUNT(`year`) as `count`,
    CONCAT(
        FLOOR(YEAR(`year`) / 10) * 10,
        '-',
        (CEIL(YEAR(`year`) / 10) * 10) - 1
    ) as `year`
FROM
    `tbl_people`
GROUP BY
    CONCAT(
        FLOOR(YEAR(`year`) / 10) * 10,
        '-',
        (CEIL(YEAR(`year`) / 10) * 10) - 1
    )

If the number is 1992, FLOOR(1992 / 10) will give 199, and times with 10 will give 1990. The same thing about CEIL(1992 / 10) = 200 and times 10 = 2000, minus 1, gives 1999 so the year should be 1990-1999.

A: This will helps .
 select CONCAT(FLOOR(YEAR(from_unixtime(TIMESTAMP))/10)*10,'-',(FLOOR(YEAR(from_unixtime(TIMESTAMP))/10)*10)+9) as year , count(ID) from
    TABLE group by FLOOR(YEAR(from_unixtime(TIMESTAMP))/10)*10;


text:
Q: Flexible scp alias Suppose I have three files named myfile1.dat myfile2.dat myfile3.dat
scp myfile*.dat login@remote.com:./

would copy them in my remote directory.
Is there an alias to shorten this, possibly one that would also consider different input like folders, that is something like
myscp [scp options (like -r) only if given] [file name] [path in remote directory]

Using OS X

A: You can use ssh config to store login information like this in file ~/.ssh/config:
Host r
  HostName remote.com
  User login

And then copy files:
scp myfile*.dat r:

I don't think there is a way to shorthen this command more.


text:
Q: What is the definitive way to install/upgrade/set the default version of ZSH? OSX Mountain Lion ships with ZSH 4.3.1 in /bin/zsh. After downloading, ./configure, make, make check, and make install-ing version 5.0.0,
which zsh still returns /bin/zsh/
and zsh --version still returns zsh 4.3.11 (i386-apple-darwin12.0)
Items of note to help answerers:
I had no errors running the install commands.
In /usr/local/bin, I have these 3 files:
-rwxr-xr-x   2 kevinsuttle  admin   622K Aug 20 00:59 zsh
-rwxr-xr-x   2 kevinsuttle  admin   622K Aug 20 00:59 zsh-5.0.0
-rwxr-xr-x   1 kevinsuttle  admin   622K Aug 20 00:50 zsh.old
My $PATH
$ echo $PATH
/Users/kevinsuttle/.rbenv/shims:/Users/kevinsuttle/.rbenv/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin
Questions I need answered:
1. What is the cleanest way to install ZSH? (From git, homebrew, curl-ing source?)
2. Does it matter where you run the install commands?
3. How do I upgrade or override the version of ZSH that ships with Mountain Lion?
4. Is this why people end up using oh-my-zsh?

A: You have to set your default shell in OSX with:
chsh -s /usr/local/bin/zsh $USER

Relogin to OSX and it should work!
Homebrew way
I recommand you to use homebrew. It makes things much easier.
Install homebrew, like described on Link .
Homebrew installs your stuff in /usr/local/bin, so make sure /usr/local/bin comes before /usr/bin .
Add the following line in ~/.zshrc and ~/.bashrc :
PATH="/usr/local/bin:/usr/local/sbin:$PATH"

Install zsh:
brew install zsh

Set your default shell to zsh:
chsh -s /usr/local/bin/zsh $USER

Finally set permission to use zsh from brew installation. Add "/usr/local/bin/zsh" to "/etc/shells" file to allow zsh. Else you'll get an error "You are not authorized to run this application. The administrator has set your shell to an illegal value."
echo "/usr/local/bin/zsh" | sudo tee -a /etc/shells

I recommand to fix the zsh environment bug in OSX. Rename /etc/zshenv to /etc/zshrc
sudo mv /etc/{zshenv,zshrc}

Relogin to OSX and it should work!
If you have trouble, type:
brew doctor

A: OK, so Burhan's comment reminded me of a situation where I had to explicitly add the path of the preferred version to my .bash_profile. Version 5.0.0 is in /usr/local/bin, so now the $PATH in my .bash_profile looks like so:
export PATH="$HOME/.rbenv/bin:/usr/local/bin:$PATH"
and now when I run which zsh, I get /usr/local/bin/zsh
and zsh --version returns zsh 5.0.0 (x86_64-apple-darwin12.0.0).
Woot! Hopefully this helps someone who is having the same problem.

A: I will attempt to answer your questions, but I have a feeling this is better suited for superuser

What is the cleanest way to install ZSH? (From git, homebrew, curl-ing source?)

Acquiring the source however you want; but the cleanest way would be to create a private bin, I like /Users/burhan/bin/, and install things there. This is, in my opinion, the cleanest and simplest way since you don't need to rely on other libraries/installers/magic.

Does it matter where you run the install commands?

No, it does matter what arguments you give the commands - especially the target installation location and path to libraries. If you don't provide these (or set them in the environment before hand), the installer will place items in the default system paths; and to do that you need to run the installer with elevated permissions ie, with sudo or while logged in as root.

How do I upgrade or override the version of ZSH that ships with Mountain Lion?

I would recommend against upgrading it; simply because I am not sure what side effects it will have on the various other scripts that are expecting to it to ship with the advertised version. For your sanity, I would avoid this.
Instead, if you build and install it into a private bin and point your PATH appropriately; you can use the updated version without modifying the shipped version.

A: In the past, the solution I came up with for this type of upgrade was roughly as follows:

*

*Install the newer version somewhere ( in my case the default for fink /sw/bin )

*Rename the OS-installed version in /bin /bin/zsh => /bin/zsh.moved

*Set up a symlink in /bin to the /sw/bin/zsh installation

This seemed to work.


text:
Q: Check for DNS record using PowerShell 2.0 What could be the best way to resolve a computer name apart from using:
[System.Net.DNS]::GetHostByName('MachineName').HostName

I dont want to import any specific DNS Modules.

A: You can try the GetHostEntry method:
[Net.DNS]::GetHostEntry("MachineName")

Another way would be to ping it using Test-Connection cmdlet, see this tip

A: I was in a case where I had to query a specific DNS server, which is not possible directly with .net / powershell. So I ended up with using the good old nslookup :
$client="10.110.10.10"
$ns="10.20.1.10"
(nslookup $client $ns |sls name).toString().split(":")[1].trim()

A: The following 2 ways to resolve IP's to DNS addresses are the only ones.
It's how you use it that counts.
    [Net.DNS]::GetHostEntry("MachineName")
    [System.Net.DNS]::GetHostByName('MachineName').HostName

Like I said, It's how you use them.
I have written a script for doing just this.
It takes a list of IP addresses and resolves there DNS.
Later in the script it converts the output to an excel sheet, showing you the results.
Based upon filters you can set the layout.
Now I know not all IP's will be resolved with these methods, that's why I included a function in my script that filters out unresolved IP's and places them to the bottom of the excel sheet.
(Giving every IP a direct link to who.is/whois/ipadress
Here's the script, íf you are interested.
#Get current date
$Date = date -format yyyy-MM-dd
$Company = "Company"
    $Company2 = "Company2"
        ########################

#Define all Paths.
$Path = "C:\inetpub\wwwroot\BlockedIP" #This is where your file's will be saved.
    md "$Path\HTML\$Date" -Force |Out-Null
    $path2 = "$Path\HTML\$Date"
$PathWeb = "/ResolvedIp/HTML/$Date"
########################

#Define File's used or created in this script.
$File = "$Path\IP-$Date.txt"
    $FileHtml = "$Path2\IP-$Date.htm"
        $FileXML = "$Path\IP-$Date.xlsx"
            $FileHTMLWeb = "$PathWeb\IP-$date.htm"
            ######################################

#Define error actions.
$erroractionpreference = "SilentlyContinue"
###########################################

#Since the script used COM objects it will need the following 2 folders:

#(32Bit)
MD "C:\Windows\System32\config\systemprofile\Dektop" -force
    MD "C:\Windows\System32\config\systemprofile\AppData\Local\Microsoft\Windows\Temporary Internet" -force
#(64Bit)
MD "C:\Windows\SysWOW64\config\systemprofile\Desktop" -force
    MD "C:\Windows\SysWOW64\config\systemprofile\AppData\Local\Microsoft\Windows\Temporary Internet" -force
#Once successfull the script will run without a problem if scheduled.

cls

            (gc $File) | ? {$_.trim() -ne "" } | set-content $File
            $IPCount =  (gc $File)
            $IPCount =  $IPCount.count

 write "$IPCount unique IP addresses detected."

#Define error actions.
$erroractionpreference = "SilentlyContinue"

#Get content from given IP list.
$colComputers = @(gc $File | sort |Select -unique)
    $SourceCount = $colComputers.Count
    write "$SourceCount IP's detected."

Function Set-KnownIPs{
Param([Object]$DNSLookupObject)
Switch($DNSLookupObject){
    {$_.Source -Match "(108.162.254|141.101.(?:104|105)|199.27.128|173.245(?:53|52|51))"}{$_.HostName = "CloudFlare, Inc."}
    {$_.Source -Match "(64.18.[0-18])"}{$_.HostName = "Google, Inc."}
    {$_.Source -Match "(192.168|127.0.0)"}{$_.HostName = "Internal Infrastructure"}
}
$DNSLookupObject
}

#Get DNS Results
$Progress=1
$DNSResults = $colComputers | %{
Write-Progress -Activity "Creating a usable 'Blocked IP' list ($Progress/$sourcecount)" -PercentComplete ($Progress/$sourceCount*100) -Status "Please stand by"
try {
    ($dnsresult = [System.Net.DNS]::GetHostEntry($_))
}
catch {
    $dnsresult = "Fail"
}
Set-KnownIPs -DNSLookupObject ([PSCustomObject][Ordered]@{
Source=$_.ToUpper()
HostName=$(if(!([string]::IsNullOrEmpty($dnsresult.HostName))){$dnsresult.HostName})
IPAddress=$(if(!([string]::IsNullOrEmpty($dnsresult.AddressList))){$dnsresult.AddressList[0].ToString()})
})
$Progress++
}

$Keywords = @("Google","Cloudflare","Cloud","Ping",
"Easy-Voyage","McAfee","Pingdom","Panopta","Scoot","Uniglobe",
"Internal")

$Filter = "($(($Keywords|%{[RegEx]::Escape($_)}) -join "|"))"

$DNSLookupFailed = $DNSResults |
?{[string]::IsNullOrEmpty($_.HostName) -and !($_ -match $filter)}

$DNSWithKeyword = $DNSResults |
?{$_ -match $Filter}

$DNSNoKeyword = $DNSResults |
?{!($_.HostName -match $Filter) -and !([string]::IsNullOrEmpty($_.IPAddress))}

#$count = ($DNSResults|?{$_ -match $filter}).count
$count = $SourceCount
#####################

#start Excel.
$a = New-Object -comobject Excel.Application

# set interactive to false so nothing from excel is shown.
$a.DisplayAlerts = $False
$a.ScreenUpdating = $True
$a.Visible = $True
$a.UserControl = $True
$a.Interactive = $True
###########################

#Create sheets in Excel.
$b = $a.Workbooks.Add()
    $c = $b.Worksheets.Item(1)
    $c.Activate() | Out-Null

#Create a Title for the first worksheet and adjust the font
$c.Cells.Item(1,1)= "Blocked IP's $Date"
    $c.Cells.Item(1,1).Font.ColorIndex = 55
    $c.Cells.Item(1,1).Font.Color = 8210719

$c.Cells.Item((3+$DNSWithKeyword.Count+1),1) = "IP's not in whitelist"
    $c.Cells.Item((3+$DNSWithKeyword.Count+1),1).Font.ColorIndex = 55
    $c.Cells.Item((3+$DNSWithKeyword.Count+1),1).Font.Color = 8210719

$c.Cells.Item((3+$DNSWithKeyword.Count+$DNSNoKeyword.Count+3),1)= "IP's without DNS return"
    $c.Cells.Item((3+$DNSWithKeyword.Count+$DNSNoKeyword.Count+3),1).Font.ColorIndex = 55
    $c.Cells.Item((3+$DNSWithKeyword.Count+$DNSNoKeyword.Count+3),1).Font.Color = 8210719
    #######################################

$range = $c.Range("a1","e1")
$range.Style = 'Title'
$range.Select()
$range.MergeCells = $true
$range.VerticalAlignment = -4108
################################

            $Linkedin = "https://www.linkedin.com/profile/view?id=96981180" #Look me up! :D
#Define row to be used for linkedin link.
$CounterRow = $Count+5
######################

#Define subjects.
$c.Name = "Blocked IP's ($Date)"
$c.Cells.Item(2,1) = "Given IP"
$c.Cells.Item(2,2) = "Resolved DNS"
$c.Cells.Item(2,3) = "Returned IP"
$c.Cells.Item(2,5) = "$Company"
$c.Cells.Item((3+$DNSWithKeyword.Count+$DNSNoKeyword.Count+$DNSLookupFailed.Count+5),1) = "Created by"
########################################

$link = "http://www.$Company"
    $link2 = "$Linkedin"

$r = $c.Range("E2")
    [void]$c.Hyperlinks.Add($r, $link)

$r = $c.Range("A$(3+$DNSWithKeyword.Count+$DNSNoKeyword.Count+$DNSLookupFailed.Count+5)")
    [void]$c.Hyperlinks.Add($r, $link2)
    ###################################

#Define cell formatting from subjects.
$c.Range("A2:E2").Interior.ColorIndex = 6
$c.Range("A2:E2").font.size = 13
$c.Range("A2:E2").Font.ColorIndex = 1
$c.Range("A2:E2").Font.Bold = $True
###################################

#Define the usedrange, excluding header and footer rows
$KeyRange = $c.Range("A3:c$(3+$DNSWithKeyword.Count)")
$NoKeyRange = $c.Range("A$(3+$DNSWithKeyword.Count+2):c$(3+$DNSWithKeyword.Count+$DNSNoKeyword.Count+2)")
$NoDNSRange = $c.Range("A$(3+$DNSWithKeyword.Count+$DNSNoKeyword.Count+4):c$(3+$DNSWithKeyword.Count+$DNSNoKeyword.Count+$DNSLookupFailed.Count+4)")
$SheetRange = $c.Range("A3:e$(4+$DNSWithKeyword.Count+$DNSNoKeyword.Count+$DNSLookupFailed.Count+4)")
$Investigate = $c.Range("c$(3+$DNSWithKeyword.Count+$DNSNoKeyword.Count+4):c$(3+$DNSWithKeyword.Count+$DNSNoKeyword.Count+$DNSLookupFailed.Count+4)")
    ################################

#Set background color for the IP list.
$SheetRange.interior.colorindex = 6
$KeyRange.interior.colorindex = 4
$NoKeyRange.interior.colorindex = 15
$NoDNSRange.interior.colorindex = 8
####################################

#Populate data into spreadsheet
$DNSWithKeyword | Select Source, HostName, IPAddress | Sort HostName -Descending |
ConvertTo-Csv -Delimiter "`t" -NoTypeInformation |
Select -Skip 1 | Clip
$c.Paste($KeyRange,$false)

$DNSNoKeyword | Select Source, HostName, IPAddress | Sort HostName -Descending |
ConvertTo-Csv -Delimiter "`t" -NoTypeInformation |
Select -Skip 1 | Clip
    $c.Paste($NoKeyRange,$false)

$DNSLookupFailed | Select Source, HostName, IPAddress | sort Source -Descending|
ConvertTo-Csv -Delimiter "`t" -NoTypeInformation |
Select -Skip 1 | Clip
    $c.Paste($NoDNSRange,$false)
    ############################

ForEach($Cell in $Investigate){
If([String]::IsNullOrWhitespace($Cell.value2)){
$Cell.Item($_) = "N/A"
[void]$cell.Hyperlinks.Add($Cell)
    }
}

###########################################################################

#Define borders here.
$xlOpenXMLWorkbook = 51
$xlAutomatic=-4105
$xlBottom = -4107
$xlCenter = -4108
$xlRight = -4152
$xlContext = -5002
$xlContinuous=1
$xlDiagonalDown=5
$xlDiagonalUp=6
$xlEdgeBottom=9
$xlEdgeLeft=7
$xlEdgeRight=10
$xlEdgeTop=8
$xlInsideHorizontal=12
$xlInsideVertical=11
$xlNone=-4142
$xlThin=2
#########

$selection = $c.range("A2:C$(1+$DNSResults.Count-9)")
    $selection.select() |out-null
    $selection.HorizontalAlignment = $xlRight
    $selection.VerticalAlignment = $xlBottom
    $selection.WrapText = $false
    $selection.Orientation = 0
    $selection.AddIndent = $false
    $selection.IndentLevel = 0
    $selection.ShrinkToFit = $false
    $selection.ReadingOrder = $xlContext
    $selection.MergeCells = $false
    $selection.Borders.Item($xlInsideHorizontal).Weight = $xlThin
    #############################################################

#Define the usedrange for autofitting.
$d = $c.UsedRange
#################

#Make everything fit in it's cell.
$d.EntireColumn.AutoFit() | Out-Null
####################################

$c.usedrange | Where{$_.Value2 -match "(\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b)"} |
ForEach{$IPLink = "http://who.is/whois-ip/ip-address/$($Matches[1])";[void]$c.Hyperlinks.Add($_, $IPLink)}

#Define html code for Excel save to .htm.
$xlExcelHTML = 44
#################

#Save final result as an .xlsx file.
$b.SaveAs("$FileXML")
#####################

#Save final result as a .htm file
$b.SaveAs("$FileHTML",$xlExcelHTML)
###################################

A: In powershell 5.1 you can use
Resolve-DnsName


text:
Q: GMailSender on Android causing Relay Access Denied Error I have a app through which you can send a email. This is done using the following code. The sender account is an GMail account:
GMailSender sender = new GMailSender("sender@gmail.com", "APassword");
sender.sendMail(subject,
                emailText[0],
                "sender@gmail.com",
                receiver);

The receiver varies for testing reasons, but should be static when the app is released. Now I started testing by sending mails to another GMail account, which works fine. I continued to send mails to an outlook account, also works great. When I send emails to a private email server though, I get the following message back:

Delivery to the following recipient failed permanently:
booking@reciever.de
Technical details of permanent failure: Google tried to deliver your
  message, but it was rejected by the server for the recipient domain
  reciever.de by mail.reciever.de. [88.198.227.52].
The error that the other server returned was: 554 5.7.1
  : Recipient address rejected: Relay access denied

I tried to figure out what this error is about, yet I have not completely understood it. I guess GMail doesn't like the receiver domain and thus does not send the email.(?)
How can I get GMail to ignore it and send it anyway? Or what else can I do to send the email? I would also greatly appreciate if someone could elaborate on this error, it is not much or well explained on the internet yet.


text:
Q: Sumar valores y traerlos con un inner join Estoy tratando de realizar una consulta sql para generar un informe y necesite que de una misma tabla me traiga diferentes validaciones, Cuento con una tabla cotizaciones y una tabla pagos ocupo traer una sumatoria por cada id_cotizaciones en donde la forma de pago es A y la otra B, ademas a esto tengo una fecha de seña que es el primer pago que se realizo de dicha cotizacion. Pongo un ejemplo del query que estoy realizando.

id_coti

1

2

3

4

id_pago
id_coti
valor
f_pago

1
1
100
pagoa

2
1
50
pagoa

3
1
20
pagob

4
1
40
pagob

Estas son las tablas que tengo y necesito que traiga la suma donde f_pago= pagoa y donde f_pago=pagob donde id_coti=1
Este un ejemplo del query que realizo y lo que ocupo es que cobrosa.valor me lo traiga sumado para cada cotizaciones.id:

SELECT cotizaciones.id, nameusua.nombre,
concat_ws(' ', clientes.nombres, clientes.apellidos) as nombre_cli, cotizaciones.tipo_producto,
((cotizaciones.subtotal*cotizaciones.forma_pagoa)+(cotizaciones.subtotal*cotizaciones.iva)) Importe_Total,
 ((cotizaciones.subtotal*cotizaciones.forma_pagob)+(cotizaciones.subtotal*cotizaciones.iva_b)) Complemento,
 pagos_coti.fecha_pago,
cobrosa.valor
FROM clientes
        INNER JOIN cotizaciones ON clientes.id = cotizaciones.id_contacto
        INNER JOIN usuarios as nameusua ON cotizaciones.asesor = nameusua.id
        INNER JOIN usuarios as nameasis ON cotizaciones.asistente = nameasis.id
        INNER JOIN pagos as cobrosa ON (cotizaciones.id = cobrosa.id_cotizacion) AND (cobrosa.formas_pago = 'pagoa')
        JOIN (SELECT pagos.id_cotizacion, MIN(pagos.fecha_pago) AS fecha_pago FROM pagos WHERE pagos.observacion != 'ANULADO' GROUP BY pagos.id_cotizacion HAVING SUM(pagos.valor)>0) pagos_coti ON cotizaciones.id = pagos_coti.id_cotizacion


text:
Q: Calling a method from an unknow(yet) class type To put you in context, when the user clicks the floating action button the activity will check which fragment is active.
Then, depending on the fragment tag it will call a method in that specific instance.
I found a way to do it on this awesome forum but the only problem is that I don't understand what I'm doing here
       fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

            Fragment fragment = getFragmentManager().findFragmentById(R.id.fragment_container);

            if (fragment.getTag() == "EXERCISES_LIST_FRAGMENT") {

                //THIS IS THE PART I DONT UNDERSTAND
                ArrayList t = ((ExercisesListFragment) fragment).GetArray();
                //THIS IS THE PART I DONT UNDERSTAND

                System.out.println(t.size());
            }
        }
    });

It seems like casting a variable but I searched and did not see anything like this.
I want to know what is that part :  ((SomeKindofClass) variable).SomeKindOfClassMethod();
I would like to read about that but I don't know how you name that
sorry for my English
Thanks


text:
Q: Meaning of 'undoing the constitutional gains'?
Based on the majority opinion, to what degree was the Supreme Court
  responsible for undoing the constitutional gains of Reconstruction?

It's a question about Plessy v. Ferguson, and does this question mean "How much power does the Supreme Court have regarding canceling the constitutional amendment made during Reconstruction Era?"
I'm not sure if 'constitutional gains' means 'constitutional amendment', which refers to 13th, 14th, 15th Amendment.


text:
Q: CSS Drop Down Menu with Hover Effect I've got a css-based horizontal drop down menu that works perfectly well, but I'm having trouble adding an effect that adds a top border on the item that represents the page the user is currently on. Here's the HTML code for the dropdown:

        Comedy

Caddyshack

Back to School

        80s

Die Hard

Overboard

Here's what I want:

*

*Hovering over an item changes its background color, as well as the background of the dropdown (the nested ul element)

*On the active page for an item, that item should have a 2 pixel tall colored border at the top.
Just to be clear, the dropdown already works fine, and I can already identify the "active" menu item. I just can't seem to figure out how to combine changing the background color on hover and adding a border-top on the active menu item without messing up the style of the menu somehow (either leaving a 2px tall blank space on hover, or having the hover background property override the border-top property on the active item)
I should also add, CSS-only solutions please.
Any help here would be much appreciated.

A: For the background color, it's fairly simple, just use code similar to this:
#browse a:hover {
     background-color: fuchsia; /*Whatever your background color is*/
}

As for the border effect, that's a little harder to do semantically, but I feel that this article on CSS specificity would do the trick. Basically, it involves adding an id to your body, and then referencing that id in the CSS so that only the specific pages will be affected.
EDIT: If you're having issues with your top border affecting layout (I don't know what orientation the navigation has), try reducing the margin or padding you have on each item by the size of your border (2px, in this case) to maintain overall box height. If you don't have any margins/paddings, try negative margins.


text:
Q: Interacting with a .svg image I have an image in the format .svg like the one below.

I want to make a webpage where the user can interact with a image like this, but with more nodes. The structure will be similar to a tree.
Is it possible to interact with this .svg image directly, using javascript/html/css?
If so, how?
Note: By interact I mean being able to click on the nodes -and the webpage recognizing it- and when one node is selected the color of the other nodes change.
Note2: I just have the .svg file, I don't know if I'm able to define this as a inline svg on html.
Note3: This image will have many nodes (80+), so I would rather not having to define a clickable area for each one of them and so on... But if this is the only solution, no problem.
Edit:
Here is the content of my .svg file:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
 "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.38.0 (20140413.2041)
 -->
<!-- Title: g Pages: 1 -->
<svg width="134pt" height="116pt"
 viewBox="0.00 0.00 134.00 116.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 112)">
<title>g</title>
<polygon fill="white" stroke="none" points="-4,4 -4,-112 130,-112 130,4 -4,4"/>
<!-- a -->
<g id="node1" class="node"><title>a</title>
<ellipse fill="none" stroke="black" cx="27" cy="-90" rx="27" ry="18"/>
<text text-anchor="middle" x="27" y="-86.3" font-family="Times New Roman,serif" font-size="14.00">a</text>
</g>
<!-- b -->
<g id="node2" class="node"><title>b</title>
<ellipse fill="none" stroke="black" cx="27" cy="-18" rx="27" ry="18"/>
<text text-anchor="middle" x="27" y="-14.3" font-family="Times New Roman,serif" font-size="14.00">b</text>
</g>
<!-- a->b -->
<g id="edge1" class="edge"><title>a->b</title>
<path fill="none" stroke="black" d="M27,-71.6966C27,-63.9827 27,-54.7125 27,-46.1124"/>
<polygon fill="black" stroke="black" points="30.5001,-46.1043 27,-36.1043 23.5001,-46.1044 30.5001,-46.1043"/>
</g>
<!-- c -->
<g id="node3" class="node"><title>c</title>
<ellipse fill="none" stroke="black" cx="99" cy="-18" rx="27" ry="18"/>
<text text-anchor="middle" x="99" y="-14.3" font-family="Times New Roman,serif" font-size="14.00">c</text>
</g>
<!-- b->c -->
<g id="edge2" class="edge"><title>b->c</title>
<path fill="none" stroke="black" d="M54,-18C56.6147,-18 59.2295,-18 61.8442,-18"/>
<polygon fill="black" stroke="black" points="61.9297,-21.5001 71.9297,-18 61.9297,-14.5001 61.9297,-21.5001"/>
</g>
</g>
</svg>

A: The SVG would need to be inline to have interaction on a page. If you embed an image then the image (.svg) is treated as a single object. For the inline SVG each node should have a separate ID if you want to select them individually.
Here's one I created for another answer.

svg {
  display: block;
  width: 20%;
  margin: 25px auto;
  border: 1px solid grey;
  stroke: #006600;
}
#buttons polygon:hover {
  fill: orange;
}
#buttons rect:hover {
  fill: blue
}
#center {
  fill: #00cc00;
}
#top {
  fill: #cc3333;
}
#right {
  fill: #663399;
}
#left {
  fill: #bada55;
}
<svg viewbox="0 0 100 100">
  <g id="buttons">
    <rect id="center" x="25" y="25" height="50" width="50" />
    <polygon id="top" points="0,0 100,0 75,25 25,25" />
    <polygon id="right" points="100,0 75,25 75,75 100,100" />
    <polygon id="bottom" points="0,100 25,75 75,75 100,100" />
    <polygon id="left" points="0,0 25,25 25,75 0,100" />
  </g>
</svg>

A: You don't necessarily need to have the svg inline, you could have it in an object tag.
So the html would look like...
   <div id="svgdiv">
     <object id="svgobject" data="objectclicktest.svg"></object>
   </div>

and correspending js
    var mySvg = document.getElementById("svgobject").contentDocument.querySelectorAll('svg');

    var myNodes = mySvg[0].querySelectorAll('.node');

    for( var i = 0; i < myNodes.length; i++ ) {
            myNodes[i].addEventListener('click', changeStyle );
    }

    function changeStyle() {
            this.style.fill="blue";
    }

Example Click on letters and they should go blue. Note, (I don't think this would work in a setup like a fiddle though)

A: inline svg elements can interact like other html elements, you can set css rules on them and apply js on them too, you dont need areas

A: svg is a markup language, meaning that you can use css selector libraries such as jquery to interact with the given svg. You can query the svg in order to get an element by its id, or get an array of elements selected by class. You can attach event handlers to them such as click, mouseover, mouseenter, etc. You can even style them with css.


text:
Q: How do I post a parameter as XML string using Postman I want to post xml to a webservice using postman.
Below is the raw body xml.
The parameter "xml" is a string value that I'd like to pass through, however, the request status returns 400 due to bad syntax. I suspect that its because the parameter value is being formatted as xml.
Everything works fine in my real applications, I just cannot get this to work if I want to test using postman.
How can one send this parameter as string?
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header/>
<soap:Body>
  <SaveLead xmlns="http://tempuri.org/">
    <xml>
     <enquiry><Lead Ref='1234' Source='SourceDesc'><Contact FirstName='TestN' Surname='TestS' Email='testn@test.co.za' Mobile='0830000000' /></Lead></enquiry>
    </xml>
  </SaveLead>
</soap:Body>
</soap:Envelope>

A sample of the webservice soap request
POST /webservice1.asmx HTTP/1.1
Host: xxxxx
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/SaveLead"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<SaveLead xmlns="http://tempuri.org/">
  <xml>string</xml>
</SaveLead>
</soap:Body>
</soap:Envelope>

A: As per Danny's comment above, escaping the XML string with the CDATA section solved this.

Definition: CDATA sections may occur anywhere character data may occur; they are used to escape blocks of text containing characters which would otherwise be recognized as markup. CDATA sections begin with the string <![CDATA[ " and end with the string " ]]>

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header/>
<soap:Body>
  <SaveLead xmlns="http://tempuri.org/">
    <xml>
    <![CDATA[  <enquiry><Lead Ref='1234' Source='SourceDesc'><Contact FirstName='TestN' Surname='TestS' Email='testn@test.co.za' Mobile='0830000000' /></Lead></enquiry> ]]>
    </xml>
  </SaveLead>
</soap:Body>
</soap:Envelope>


text:
Q: Can a MultiButton's bottom underline be disabled? Can a MultiButton's bottom underline be disabled? I tried mb.getUnselectedStyle().setUnderline(false); and mb.getUnselectedStyle().setBorder(Border.createEmpty()); but not working
I am grouping MultiButtons inside a rounded container and the last button's underline looks kind of ugly. I used MultiButtons instead of Buttons because they need to turn into checkbox buttons when they're pressed for a long time. Thanks!

A: I ended up having to style each individual MultiButton depending on its position in the list (top, bottom, center, or single) programmatically (styling the theme produced strange resizes of the buttons when pressed)
I wish there was a better way for doing this. In the meantime I will paste my code here in case anyone has the same issue
Style for single multibutton (top and bottom rounded)

    public void setMultiButtonStyleRound(MultiButton mb)
    {
        RoundRectBorder newBorder = RoundRectBorder.create().cornerRadius(4);
        newBorder.stroke(1, false);
        newBorder.strokeColor(0xd6d6d6);
        newBorder.strokeOpacity(255);
        newBorder.shadowSpread(10);
        newBorder.shadowX(0.5f);
        newBorder.shadowY(0.5f);
        newBorder.shadowBlur(10);
        RoundRectBorder newBorder2 = RoundRectBorder.create().cornerRadius(4); //need a border object for each style otherwise it breaks
        newBorder2.stroke(1, false);
        newBorder2.strokeColor(0xd6d6d6);
        newBorder2.strokeOpacity(255);
        newBorder2.shadowSpread(10);
        newBorder2.shadowX(0.5f);
        newBorder2.shadowY(0.5f);
        newBorder2.shadowBlur(10);
        RoundRectBorder newBorder3 = RoundRectBorder.create().cornerRadius(4); //need a border object for each style otherwise it breaks
        newBorder3.stroke(1, false);
        newBorder3.strokeColor(0xd6d6d6);
        newBorder3.strokeOpacity(255);
        newBorder3.shadowSpread(10);
        newBorder3.shadowX(0.5f);
        newBorder3.shadowY(0.5f);
        newBorder3.shadowBlur(10);
        mb.getUnselectedStyle().setBgTransparency(255);
        mb.getUnselectedStyle().setBgColor(0xfcfcfc);
        mb.getUnselectedStyle().setBorder(newBorder);
        mb.getDisabledStyle().setBgTransparency(255);
        mb.getDisabledStyle().setBorder(newBorder2);
        mb.getDisabledStyle().setBgColor(0xfcfcfc);
        mb.getPressedStyle().setBgColor(0xd3d3d3);
        mb.getPressedStyle().setBgTransparency(255);
        mb.getPressedStyle().setBorder(newBorder3);
    }
Style for Top MultiButton in a list (top rounded)

    public void setMultiButtonStyleRoundTopOnly(MultiButton mb)
    {
        //mb.setUIID("MultiButtonTop");
        RoundRectBorder newBorder = RoundRectBorder.create().cornerRadius(4).bottomOnlyMode(true);
        newBorder.stroke(1, false);
        newBorder.strokeColor(0xd6d6d6);
        newBorder.strokeOpacity(255);
        newBorder.shadowSpread(10);
        newBorder.shadowX(0.5f);
        newBorder.shadowY(0.5f);
        newBorder.shadowBlur(10);
        RoundRectBorder newBorder2 = RoundRectBorder.create().cornerRadius(4).bottomOnlyMode(true); //need a border object for each style otherwise it breaks
        newBorder2.stroke(1, false);
        newBorder2.strokeColor(0xd6d6d6);
        newBorder2.strokeOpacity(255);
        newBorder2.shadowSpread(10);
        newBorder2.shadowX(0.5f);
        newBorder2.shadowY(0.5f);
        newBorder2.shadowBlur(10);
        RoundRectBorder newBorder3 = RoundRectBorder.create().cornerRadius(4).bottomOnlyMode(true); //need a border object for each style otherwise it breaks
        newBorder3.stroke(1, false);
        newBorder3.strokeColor(0xd6d6d6);
        newBorder3.strokeOpacity(255);
        newBorder3.shadowSpread(10);
        newBorder3.shadowX(0.5f);
        newBorder3.shadowY(0.5f);
        newBorder3.shadowBlur(10);
        mb.getUnselectedStyle().setBgTransparency(255);
        mb.getUnselectedStyle().setBgColor(0xfcfcfc);
        mb.getUnselectedStyle().setBorder(newBorder);
        mb.getDisabledStyle().setBgTransparency(255);
        mb.getDisabledStyle().setBorder(newBorder2);
        mb.getDisabledStyle().setBgColor(0xfcfcfc);
        mb.getPressedStyle().setBgColor(0xd3d3d3);
        mb.getPressedStyle().setBgTransparency(255);
        mb.getPressedStyle().setBorder(newBorder3);
    }
Style for center MultiButton in a list (square)

    public void setMultiButtonStyle(MultiButton mb)
    {
        Border lineBorder = Border.createLineBorder(1,0xd6d6d6);
        Border emptyBorder = Border.createEmpty();
        Border newBorder = Border.createCompoundBorder(lineBorder, emptyBorder, lineBorder, lineBorder);
        mb.getUnselectedStyle().setBgTransparency(255);
        mb.getUnselectedStyle().setBgColor(0xfcfcfc);
        mb.getUnselectedStyle().setBorder(newBorder);
        mb.getDisabledStyle().setBgTransparency(255);
        mb.getDisabledStyle().setBorder(newBorder);
        mb.getDisabledStyle().setBgColor(0xfcfcfc);
        mb.getPressedStyle().setBgColor(0xd3d3d3);
        mb.getPressedStyle().setBgTransparency(255);
        mb.getPressedStyle().setBorder(newBorder);
    }
Style for bottom button in a list (bottom rounded)

    public void setMultiButtonStyleRoundBottomOnly(MultiButton mb)
    {
        RoundRectBorder newBorder = RoundRectBorder.create().cornerRadius(4).topOnlyMode(true);
        newBorder.stroke(1, false);
        newBorder.strokeColor(0xd6d6d6);
        newBorder.strokeOpacity(255);
        newBorder.shadowSpread(10);
        newBorder.shadowX(0.5f);
        newBorder.shadowY(0.5f);
        newBorder.shadowBlur(10);
        RoundRectBorder newBorder2 = RoundRectBorder.create().cornerRadius(4).topOnlyMode(true); //need a border object for each style otherwise it breaks
        newBorder2.stroke(1, false);
        newBorder2.strokeColor(0xd6d6d6);
        newBorder2.strokeOpacity(255);
        newBorder2.shadowSpread(10);
        newBorder2.shadowX(0.5f);
        newBorder2.shadowY(0.5f);
        newBorder2.shadowBlur(10);
        RoundRectBorder newBorder3 = RoundRectBorder.create().cornerRadius(4).topOnlyMode(true); //need a border object for each style otherwise it breaks
        newBorder3.stroke(1, false);
        newBorder3.strokeColor(0xd6d6d6);
        newBorder3.strokeOpacity(255);
        newBorder3.shadowSpread(10);
        newBorder3.shadowX(0.5f);
        newBorder3.shadowY(0.5f);
        newBorder3.shadowBlur(10);
        mb.getUnselectedStyle().setBgTransparency(255);
        mb.getUnselectedStyle().setBgColor(0xfcfcfc);
        mb.getUnselectedStyle().setBorder(newBorder);
        mb.getDisabledStyle().setBgTransparency(255);
        mb.getDisabledStyle().setBorder(newBorder2);
        mb.getDisabledStyle().setBgColor(0xfcfcfc);
        mb.getPressedStyle().setBgColor(0xd3d3d3);
        mb.getPressedStyle().setBgTransparency(255);
        mb.getPressedStyle().setBorder(newBorder3);
    }
I still haven't tested this on a device, only in the simulator
End result:


text:
Q: using a mocked database instead of a real database Is there a way to mock the main database of a web project?
I created a sample project without any database (no physical db).
I did search how to make aan MVC project load mocked data using the master connection string.

A: If you are using Asp.Net Core, You can use In Memory Database. The following link explains the way of doing it.
You can simple use in-memory database like below:
    var services = new ServiceCollection();

    services.AddEntityFramework()
        .AddInMemoryDatabase()
        .AddDbContext<ApplicationDbContext>(options => options.UseInMemoryDatabase());

    serviceProvider = services.BuildServiceProvider();


text:
Q: Finding particular solution of a difference equation How Can I find a general form of a particular solution of such an equation:
                 []−0.1[−1]−0.56[−2]=3[]+2[−1]

[]=$0.5^n$[]
The system is initially at rest and causal.

A: Taking the $z$ transform, the system function is $$H(z)=\frac{Y(z)}{X(z)}=\frac{3+2z^{-1}}{1-0.1z^{-1}...}$$
The particular solution is the response of the system to the given input $x[n]$, whose $z$-transform is can be easily calculated.
The $z$-transform of the response is given by $$Y(z)=H(z)X(z)$$ Now just set the initial conditions to zero and using partial fraction expansion and inverse $z$-transform $y[n]$ can be found.


text:
Q: Ionic 3, carrossel de cards com image e titulo Venho me iniciando no ionic a pouco tempo, criando um aplicativo, que na minha ideia preciso adiciona um Cards com imagem e um titulo.
Um exemplo disso seria a Playstore, da Google.

Porem não tenho ideia de como fazer isso.
um dos problemas para isso, seria como fazer um array de imagens

A: Você consegue fazer isso utilizando apenas html e css, nem precisa de javascript para isso....

Bem básico, mas acho que já é um começo...


text:
Q: How do you get to build new RZs? So, I'm level 30 and I never really understood how you get more RZs.
This morning I bulldozed an omega RZ. It was just a construction site, never upgraded. I was expecting to get back an extra "RZ point" as you would with factories and shops, but that didn't happen.
EDIT: I was mistaken; I didn't bulldoze an omega RZ. The game doesn't let you do that. It was already upgraded once.

A: You're only allowed to have up to 3 new construction-site RZs, so in order to get more "RZ points" you have to upgrade one of them that's already been placed. And you can't bulldoze them.


text:
Q: Flutter sign out user when app is uninstalled I want to sign out the user (using Firebase) when the app is deleted so the user is not already logged in when the app is reinstalled. Is there a way to achieve this?

A: What I would do is save a isFirstAppStartup in SharedPreferences. And if it is the first app startup then you just signout the user from firebase.


text:
Q: How to run "ms-settings:network-wifisettings" hidden from VBScript? I am attempting to write a .vbs file that opens ms-settings:network-wifisettings, which is a specific page of the Windows 10 Settings App, completely hidden. It will simulate keystrokes and close the window on its own. The VBScript is executed from a .bat file.
My problem lies within making the ms-settings:network-wifisettings window hidden. I am aware of:
myObject.Visible = False

and
myObject.Run "ms-settings:network-wifisettings", 0

... But neither of these solutions seem to work for this particular application. It is strange, because I definitely accomplished this a few weeks ago but had my laptop stolen, and lost the script with it. So I know this must be possible somehow.

My current script is as follows:
On Error Resume Next
Set WshShell = WScript.CreateObject("WScript.shell")
WshShell.Visible = False
WshShell.Run "ms-settings:network-wifisettings", 0

WshShell.AppActivate("Settings")
WshShell.sendKeys "%{F4}"
WScript.Sleep 1000

WshShell.AppActivate("Windows Security")
WshShell.sendKeys "[my username]"
WshShell.sendKeys "{TAB}"
WshShell.sendKeys "[my password]"
WshShell.sendKeys "{ENTER}"

Note: the reason I am sending Alt+F4 to the first "Settings" window is that in my scenario, the "Settings" window automatically brings up another dialogue called "Windows Security." I would like to make both of these windows completely hidden for the duration of the script.


text:
Q: Recreate dplyr summarise in data.table Just out of curiosity, is there a way of recreating the summary output using data.table instead of dplyr?
dt1 <- data.table(
  uid=c("A00111", "A00112","A00113","A00211","A00212","A00213","A00214","A00311","A00312"),
  area=c("A001", "A001","A001","A002","A002","A002","A002","A003","A003"),
  price=c(325147,NA,596020,257409,241206,248371,261076,595218,596678),
  type=c("Type1","Type2","Type3","Type2","Type3","Type2","Type2","Type2","Type3"))

summary <- dt1 %>% group_by(area) %>% summarise(
    Total_Number = length(uid),
    Total_Number_Check = unique(length(uid)),
    Number_of_Type_1 = length(uid[type=="Type1"]),
    Mean_Price_Type_1 = mean(price[type=="Type1"],na.rm = TRUE),
    Number_of_Type_2 = length(uid[type=="Type2"]),
    Mean_Price_Type_2 = mean(price[type=="Type2"],na.rm = TRUE),
    Number_of_Type_3 = length(uid[type=="Type3"]),
    Mean_Price_Type_3 = mean(price[type=="Type3"],na.rm = TRUE))

A: Here is a go with data.table
The comment by @DavidArenburg above is the default way to summarise with data.table.
However, I did not create the summarise in 1 go, since you might have more than 3 type-variables. If so, it would not be workable to summarise (by hand) >10 types. It would become a long (boring) code.
So I first summarised by area (DT1), and then summarised again by area AND by type. Then casted the result of the second summary to wide format (DT2), and left-joined DT2 to DT1.
So the code below will work for any number of areas, and any number of types.
library( data.table )
#summarise by area
DT1 <- dt1[ , .( Total_Number = .N,
                 Total_Number_Check = uniqueN( uid ) ),
            by = .(area)]
#summarise by area AND type and cast to wide format
DT2 <- dcast( dt1[ , .( Number_of = .N,
                        Mean_Price = mean( price, na.rm = TRUE ) ),
                   by = .(area, type)],
              area ~ type,
              value.var = c("Number_of", "Mean_Price") )
#join
DT1[DT2, on = .(area)]

#    area Total_Number Total_Number_Check Number_of_Type1 Number_of_Type2 Number_of_Type3 Mean_Price_Type1
# 1: A001            3                  3               1               1               1            325147
# 2: A002            4                  4              NA               3               1                NA
# 3: A003            2                  2              NA               1               1                NA
# Mean_Price_Type2 Mean_Price_Type3
# 1:                NA            596020
# 2:          255618.7            241206
# 3:          595218.0            596678


text:
Q: How to make a node partially selected in JQuery FancyTree? How to make a node partially selected?
For example, I have two lazy nodes:

Now I expand the first one:

The node "1" has wrong state until children are loaded. I want to set state in advance, before node is expanded. How can I do it?

A: The node.partsel attribute is used to mark this state:
  {title: "Lazy node", lazy: true, partsel: true},

However, as of version 2.30, the partsel flag is reset after initial load.
An issue was opened to address this.


text:
Q: Nuget packages aren't copied to output when using .NETStandard I want to share a project between a WPF (.NET 4.6) application and a .NET Core application. To do this I've made a .NET Standard library by making a portable library initially and converting it in Visual Studio 2015 to .NETStandard version 1.3.
However, the .NETStandard library needs to reference Entity Framework (for example) and so I've added this dependency in the project.json and everything builds happily. However, when I actually run the application, I get a File Not Found exception as soon as I actually try to load data using the Entity Framework library. This is expected, since none of the nuget packages when using .NETStandard are copied to the output directory (unlike using nuget for normal .NET), so I can see the reason for the exception.
How do I fix this/get the nuget dependencies to be copied to output when using a .NETStandard library and referencing from a .NET 4.6 project? (Below is my project.json and happy to add more code if needed).
{
  "supports": {},
  "dependencies": {
    "Microsoft.EntityFrameworkCore.Design": "1.1.0",
    "Microsoft.EntityFrameworkCore.Sqlite": "1.1.0",
    "Microsoft.NETCore.Portable.Compatibility": "1.0.1",
    "NETStandard.Library": "1.6.1"
   },
  "frameworks": {
    "netstandard1.3": {}
  }
}

A: Microsoft finally admitted this is a problem and will fix it, expectantly, in NuGet version 4.0.1, the first update to NuGet 4 after VS 2017 ships.
The cleanest workaround now is to add <RestoreProjectStyle>PackageReference</RestoreProjectStyle> to a legacy project.
However according to Rob Relyea MS will ignore this property after RTM so another workaround is <PackageReference Update="PlaceholderToConvinceThisProjectToGetTransitivePackageReferenceFromProjectReferences"/>.


text:
Q: Question on modular arithmetic and well defined functions Could someone help correct, if necessary, my attempt at proving the following question ?

Let $\Bbb{Z}_3=\{[0]_3,[1]_3,[2]_3\}$ and
$\Bbb{Z}_6=\{[0]_6,[1]_6,[2]_6,[3]_6,[4]_6,[5]_6\}$ be partitions of $\Bbb{Z}$
induced by congruence modulo 3 and 6 respectively.
Let the purported function
$f:\Bbb{Z}_3 \rightarrow \Bbb{Z}_6$ be defined by $f([a]_3)=[2a]_6$ for
all $[a]_3 \in \Bbb{Z}_3$.
Prove that $f$ is well defined.

Attempt:
Let the purported function $f:\Bbb{Z}_3 \rightarrow \Bbb{Z}_6$ be defined by $f([a]_3)=[2a]_6$ for all $[a]_3 \in \Bbb{Z}_3$.
The rule informally describes the subset $f$ of $\Bbb{Z}_6$ x $\Bbb{Z}_3$ defined by:
$(x,y) \in f \iff (\exists a\in\Bbb{Z}) (x=[a]_3 \text{ and } y=[2a]_6)$.
By defintion a well-defined function must satisfy the following two properties:

*

*(i) For each $x \in \Bbb{Z}_3$ there is $y \in \Bbb{Z}_6$ such that
$(x,y) \in f$.

*(ii) if $(x,y) \in f$ and $(x,z) \in f$ then $y=z$.
Regarding (i):
Let $x \in \Bbb{Z}_3$.There is an integer $a$ with $x=[a]_3$.Consider the following corollary:

Let $m \ge 1$ be an integer.For each $k \in \Bbb{Z}$ there is an
integer r in the list $0,\dots,m-1$ such that $[k]_m=[r]_m$

This suggest that for $b \in \Bbb{Z},b=2a$, there exists an integer $r$ in the list $0,\dots,5$ such that $[b]_6=[2a]_6=[r]_6$.
Therefore $([a]_3,[2a]_6) \in f$ as required.
Regarding (ii)
Assume $([a]_3,[b]_6) \in f$ and $([a]_3,[c]_6) \in f$. The objective is to prove that $[b]_6=[c]_6$.
Since $f([a]_3)=[2a]_6$ by defintion of the fiunction and $f([a]_3)=[b]_6$ by assumption, it follows by transitivity that $[2a]_6=[b]_6$.
Similarly,with $f([a]_3)=[2a]_6$ by defintion of the fiunction and $f([a]_3)=[c]_6$ by assumption, it follows by transitivity that $[2a]_6=[c]_6$.
By previously established theorems :
$b\equiv 2a\pmod 6 \iff 6|(b-2a) \iff b-2a=6k$ for some $k \in \Bbb{Z}$.
$c\equiv 2a\pmod 6 \iff 6|(c-2a) \iff c-2a=6g$ for some $g \in \Bbb{Z}$.
Then, with $2a=c-6g$ and $b-2a=6k$ it follows that $b-(c-6g)=6k$ and finally $b-c=6(k-g)$ and hence: $6|(b-c) \iff b\equiv c\pmod 6 \iff [b]_6=[c]_6$ as required.
Since the putative function $f$ satisfies both properties required for it to be well-defined,this concludes the proof.

Is this right? somehow (i) feels a bit iffy..(ii) feels right.
Thank you for your time in any case.


text:
Q: Good Form in Launching a Parallel.ForEach in a New Thread I am working on a Windows service project. The service starts an engine. The engine has one to many "pollers" that I want to each run in its own thread so that they will do their "polling" in parallel. I am using Parallel.ForEach in the engine's Start() method to get the pollers polling and that's working great. I'd like the service to be able to start the engine, however, and then go on to do other things (like report on the status of the engine and it's pollers at various points or whatever). Is this the best way to start the engine without the primary thread being blocked:
    System.ComponentModel.BackgroundWorker worker = new System.ComponentModel.BackgroundWorker();
worker.DoWork += new System.ComponentModel.DoWorkEventHandler((sender, e) => Parallel.ForEach(Pollers.Where(p => p.Active), p => p.StartPolling()));
worker.RunWorkerAsync();

Or does anyone have any ideas on a better way to do that?

A: I'd go with the .Net 4 Task Library, much much cleaner than the old Thread model
// Create a task and supply a user delegate by using a lambda expression.
var taskA = new Task(() =>Parallel.ForEach(Pollers.Where(p => p.Active), p =>p.StartPolling()));

// Start the task.
taskA.Start();

you can Read more about the Task Parallel Library HERE
EDIT: You need to include this namespace:  System.Threading.Tasks
EDIT2: Yes, as commented it would probably be better if you use the
Task.Factory.StartNew(() =>{ Parallel.ForEach(Pollers.Where(p => p.Active);})
however you should be aware that it is NOT always the best way, depending on the code, check out  THIS MSDN BLOG to read more about the difference between the two

A: I would prefer using Thread, rather than BackgroundWorker.


text:
Q: Run-time error '91'. Object variable or With block variable not set I have an Excel Macro which has been running fine for over a year, until yesterday I got an error Run-time error '91'. Object variable or With block variable not set. I can confirm all sheets are present. Appreciate any advice to troubleshoot. I have highlighted the line where the error occurs.
Sub Insert_Last_to_Input()
    Dim dateBaltic As Date
    Dim rngFFA As Range
    Dim longLastRowNo As Long
    Dim longBaltic, longFEI, longMB As Long

    dateBaltic = Sheets("Input").Range("B2").Value

    Sheets("Baltic FFA").Select

    With ActiveSheet
        longLastRowNo = .Range("A:A").Find(What:=dateBaltic, LookIn:=xlValues).Row
        '**Error above:"Run-time error '91'. Object variable or With block variable not set"**
        Set rngFFA = .Range("B" & longLastRowNo & ":F" & longLastRowNo)
    End With
End Sub

A: The problem seems is due to cannot "Find" a text, so it cannot return its row to you.
That is - the text in the "Input" sheet cell "B2" cannot be found in active sheet column A.

A: Thank you all. I found the answer but it is weird indeed.
Firstly the problem lies with ".Find". Excel is unable to find the value I want because the column width is too small and the full text cannot be displayed! See below picture 1.

In the above, the correct value for longLastRowNo is 213. So what I did was to increase the column width so the full text can be displayed. See below picture 2.

Notice when I widened the column width, ".Find" was able to find the correct row no and assign it to longLastRowNo, i.e. 213.
So problem is solved. Thank you very much to all!

A: Find Method in Trouble
Your problem seems to be solved but deep inside you must know that it isn't. You can use the following quick fix:
longLastRowNo = .Range("A:A").Find(What:=dateBaltic, LookIn:=xlFormulas).Row

But I would strongly recommend that you use a correct approach, e.g.:
With WorkSheets("Baltic FFA")
    Dim cel As Range
    Set cel = .Range("A:A").Find(What:=dateBaltic, _
                                 LookIn:=xlFormulas, _
                                 LookAt:=xlWhole)
    If Not cel Is Nothing Then
    ' Cell found.
        longLastRowNo = cel.Row
        Set rngFFA = .Range("B" & longLastRowNo & ":F" & longLastRowNo)
    Else
    ' The cell could not be found.
        MsgBox "Could not find..."
        Exit Sub
    End With
End With

making the line Sheets("Baltic FFA").Select redundant (not needed).
Read about how to avoid using Select in this legendary post.


text:
Q: Does there exist a jQuery plugin or JavaScript library that allows Venn Diagram presentation? I'm writing a jQuery application to allow analysis of data with the help of visual cues.  My data is retrieved via XMLHttpRequest in the form of JSON.  The visual cues include histograms, spark lines, and various other graph types.  The idea is that the user is able to narrow their data via these various visual views.
My question is thus - aside from the Google Charts API, does there exist a JavaScript way of presenting a Venn Diagram?
Requirement: no Flash.
Canvas is acceptable.

A: In a word:
Raphael

A: An alternative to the vector-based Raphael approach would be processing.js which is canvas-based.  That said, Raphael is a very nice drawing library as well.

A: I have been playing around a d3js based solution:
https://github.com/sidoh/venn
Hope it helps!


text:
Q: Linux Debian Google cloud VM instance I have been trying to mount a google storage bucket on one of my instances. I followed the directions here. This is the error I get.

E: Unable to locate package gcsfuse E: Unable to locate package

What am I doing wrong ? It's a debian set up 32 GB 4 CPUs.

A: gcsfuse is a tool that needs to be installed on the actual VM. According to the documentation (for Debian jessie):

1 - Add the gcsfuse distribution URL as a package source and import
  its public key:
export GCSFUSE_REPO=gcsfuse-`lsb_release -c -s`
echo "deb http://packages.cloud.google.com/apt $GCSFUSE_REPO main" | sudo tee /etc/apt/sources.list.d/gcsfuse.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -

2 - Update the list of packages available and install gcsfuse.
sudo apt-get update
sudo apt-get install gcsfuse

A: sudo apt-get install fuse -y
curl -L -O https://github.com/GoogleCloudPlatform/gcsfuse/releases/download/v0.39.2/gcsfuse_0.39.2_amd64.deb
sudo dpkg --install gcsfuse_0.39.2_amd64.deb
rm gcsfuse_0.39.2_amd64.deb


text:
Q: Error pulling a remote repository from Jenkins to ubuntu directory this is my configuration script on Jenkins
#!/bin/bash

echo ""
echo "Switching to project docroot."
cd /var/www/html/testdrupal.localhost/public_html
echo ""
echo "Pulling down the latest code."
git pull origin master
echo ""
echo "Clearing drush caches."
drush cache-clear drush
echo ""
echo "Running database updates."
drush updb -y
echo ""
echo "Importing configuration."
drush config-import -y
echo ""
echo "Clearing caches."
drush cr
echo ""
echo "Deployment complete."

However, the task execution is not successful due to this error:
Pulling down the latest code.
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

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

my git repository is as follows:  https://github.com/myId/drupaltest
Furthermore, this is the content of the .git folder inside the docroot:
drwxrwxrwx  7 root    root    4096 Sep 19 11:12 .
drwxr-xr-x  4 root    root    4096 Sep 19 10:45 ..
drwxrwxrwx  2 root    root    4096 Sep 19 10:44 branches
-rwxrwxrwx  1 root    root      92 Sep 19 10:44 config
-rwxrwxrwx  1 root    root      73 Sep 19 10:44 description
-rwxrwxrwx  1 jenkins jenkins   81 Sep 19 11:11 FETCH_HEAD
-rwxrwxrwx  1 root    root      23 Sep 19 10:44 HEAD
drwxrwxrwx  2 root    root    4096 Sep 19 10:44 hooks
drwxrwxrwx  2 root    root    4096 Sep 19 10:44 info
drwxrwxrwx 11 root    root    4096 Sep 19 11:11 objects
drwxrwxrwx  4 root    root    4096 Sep 19 10:44 refs

EDIT
I have updated the docroot:
cd /var/www/html/testdrupal.localhost/public_html/drupaltest

and now the error has changed:
error: can not open .git / FETCH_HEAD: Permission denied

Just set the right permissions to the .git folder?


text:
Q: Deleting JS Object Properties a few levels deep I have an object like this:
var myObj = {
    first: {
        sub: {
            level: "some text",
            level2: "some more text"
        },
        sub2: {
            level3: "Something"
        }
    },
    second: {
        stuff: "More stuff...lots of stuff"
    }
}

what I want to be able to do is say
delete myObj.first.sub.level

But I won't know what is being passed, or how many levels deep I need to go in order to remove the correct property, meaning it could simply be:
Storage.removeItem('myObj.first'); // This is currently working

Or something more complex:
Storage.removeItem('myObj.first.sub2.level3'); // This doesn't work because I'm more than 1 level into the object.

I'm kind of stuck, because I can get to the point where I have the key "level3" and it's property "Something", but I can't figure out how to back-step correctly in order to delete the full section of that object.
I need to replicate it's place in myObj so I can delete the full passed object.
'myObj.first.sub.level3'

If that makes sense...

A: It's not pretty, but you could use something like this:
function deepDelete(target, context) {
  // Assume global scope if none provided.
  context = context || window;

  var targets = target.split('.');

  if (targets.length > 1)
    deepDelete(targets.slice(1).join('.'), context[targets[0]]);
  else
    delete context[target];
}

deepDelete('first.sub.level3', myObj);

deepDelete('myObj.first.sub2.level3');

It would probably be a good idea to modify it to test for typeof context[targets[0]] !== 'undefined' before descending.  How exactly you react to that (return false, throw, or whatever else) would depend on how you're using it.