text:
Q: How can I use a json file if all elements are in one array? I'm trying to learn to import JSON files into p5.js.
I'm using this list of English words: https://raw.githubusercontent.com/dwyl/english-words/master/words_dictionary.json
I already know how to import things when the entries are organized into respective categories. It seems every entry is in the same array, though. How can I import individual entries?

A: In this particular case the data you're loading isn't a regular array ([]) with values accessed using an integer index, but a JavaScript Object or associative array({}) with values accessed using a string instead of an integer index.
This is a key-value pair association.
Let's say you have a simple association:
let data = {
  "firstName": "Nicholas",
  "lastName":  "Keough",
}

In the example above firstName and lastName are keys and "Nicholas" and "Keough" are values.
You can use array like [] and instead of an integer index, you'd use the key:
console.log(data["firstName"]);// prints "Nicholas"
console.log(data["lastName"]);// prints "Keough"

alternatively you can use dot notation:
console.log(data.firstName);// prints "Nicholas"
console.log(data.lastName);// prints "Keough"

In your case, let's say dictionary is a variable that holds the loaded JSON data,
you apply the same ideas above to access each word. For example:
console.log(data['absorbent']);//prints 1

or
console.log(data.absorbent.);//prints 1

If you need to loop over the values (and in your case, with the dictionary of 370101 values, you would really want to), you can use a for...in loop.
Alternatively, if you simply need to access the keys, not the values, as a single array you can use Object.keys()
Here's a basic example illustrating both options:
(Bare in mind the dictionary is large so it will take time to load and print the data to console)

let dictionary;
// preload JSON data
function preload(){
  dictionary = loadJSON("https://raw.githubusercontent.com/dwyl/english-words/master/words_dictionary.json");
}

function setup(){
  noLoop();
  console.log('test');
  // access JSON data with a for...in loop
  for(let word in dictionary){
    console.log("word: " + word + " value: " + dictionary[word]);
  }

  // optionally, access the associative array keys only as an array
  console.log(Object.keys(dictionary));
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.3.1/p5.min.js"></script>


text:
Q: Sort 1 array from another array I have below 2 array values.
Array 1 - 2,1,3,0
Array 2 - 7,1,5,10.

Now i want 2 array like below.
Array 1 - 0,1,2,3
Array 2 - 10,1,7,5

A: You could try sorting by value the first array, but maintain the index association. Then use the new order of keys to sort the other array:
asort($arr1);

$sorted_arr2 = [];
foreach($arr1 as $key=>$val) {
  array_push($sorted_arr2, $arr2[$key]);
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: Pass a string of arguments to a "docker run imagefile" I have a problem with Docker.
I have made a Singularity image file, it has a runscript that needs some args in order to work. These are the very first lines of this script:
#!/bin/sh

FS=' ' read -r -a array <<< "$@"
etc etc...

I had to convert it into a Docker image, I have used singularity2docker to do that. I tried to launch it without any arguments (a simple docker run -it containername), I can see that the runscript is executed but, of course, it doesn't work properly due to the lack of the parameters.
If I try to add them (docker run -it containername "-t arg1 -n arg2") I get

docker: Error response from daemon: OCI runtime create failed:
  container_linux.go:348: starting container process caused "exec:
  \"-t\": executable file not found in $PATH": unknown.

I am kinda sure there's some silly reason for that, probably due to the singularity2docker conversion. I can easily access the sandbox used to build the Docker image but I really have no clue about what to do. Here's the Dockerfile I can find inside.
FROM scratch
ADD . /
ENV LD_LIBRARY_PATH /.singularity.d/libs
ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
LABEL "org.label-schema.build-date" "Fri,_20_Apr_2018_14:42:15_+0000"
LABEL "org.label-schema.build-size" "1374MB"
LABEL "org.label-schema.schema-version" "1.0"
LABEL "org.label-schema.usage.singularity.deffile" "test1.def"
LABEL "org.label-schema.usage.singularity.deffile.bootstrap" "docker"
LABEL "org.label-schema.usage.singularity.deffile.from" "centos:7"
LABEL "org.label-schema.usage.singularity.version" "2.4.4-dist"
CMD ["/bin/bash", "run_singularity2docker.sh"]

I guess that trying to set up an ENTRYPOINT might work but I am not even sure if and how I can do it using that temp sandbox..
Any help would be appreciated, thank you.

A: Switch this around to use an entrypoint. The command value is overridden by anything you pass after the image name. The value of the command is appended to the entrypoint if you define one.
First switch your script to use bash in the first line:
#!/bin/bash

FS=' ' read -r -a array <<< "$@"
etc etc...

Then update your Dockerfile to use an entrypoint:
FROM scratch
ADD . /
ENV LD_LIBRARY_PATH /.singularity.d/libs
ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
LABEL "org.label-schema.build-date" "Fri,_20_Apr_2018_14:42:15_+0000"
LABEL "org.label-schema.build-size" "1374MB"
LABEL "org.label-schema.schema-version" "1.0"
LABEL "org.label-schema.usage.singularity.deffile" "test1.def"
LABEL "org.label-schema.usage.singularity.deffile.bootstrap" "docker"
LABEL "org.label-schema.usage.singularity.deffile.from" "centos:7"
LABEL "org.label-schema.usage.singularity.version" "2.4.4-dist"
ENTRYPOINT ["/bin/bash", "run_singularity2docker.sh"]

Then run your command without quoting the arguments to pass them each as separate args to your entrypoint script:
docker run -it containername -t arg1 -n arg2


text:
Q: Responsive embedded iframes that keep aspect-ratio ( the aspect ratios are variable) I need to embed an iframe in an element(at a certain position) and when I resize the window, I want the iframe to behave responsively, meaning when resized I need the aspect ratio to hold. I add the iframe over javascript.
The solution I have currently isn't sufficient because the container that I put this structure into should not have many nested divs because of stability reasons.
HTML:

Style:
body {
  margin: 0;
}

.large-container {
  height: 600px;
  width: 800px;
  max-width: 100%;
  background: red;
}

iframe {
  width: 100%;
}

.aspect-ratio {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 57%;
}

.aspect-ratio iframe {
  position: absolute;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
}

https://jsfiddle.net/bo88ou0m/
The bottom-padding is what I can get from my code, finding the aspect ratio.
Does anyone have any links on articles on this that are newer. Some of the javascript solution's I have come across all had solutions on re-rendering(calling global functions) each time the DOM changes, adding an iframe. This isn't optimal because of scaling reasons.


text:
Q: Get current URL address by javascript How can I get current URL like this.
For example, if the url is:
http://www.test.com/app/one.bc
I want to get the path without the address the main page so like:
/app/one.bc

A: have you tried:
var url = window.location.pathname;

A: try using console.log(this.$route);


text:
Q: Retrieving metadata from media files in JavaFX I've a MediaPlayer which plays the music chosen by the user from the library. While creating the library, the songs are required to be listed by their title. I know I can acquire all metadatas using a Media object. But that is arising two problems.
I) The whole process is very time and resource consuming for a large media collection
II) Even if I do so using the following code
for(String path : paths){
      Media m = new Media(path);
      String title = (String)m.getMetadata().get("title");
      String album = (String)m.get metadata().get("album");
      String artist = (String)m.get metadata().get("artist");
}

Most of the times the artist,title,album strings are having null value though the file itself has metadata. Analyzing Media class I understood that there's some kind of threading inside of it while acquiring metadata and that's why the rapid request is returning null. But I can't do a wait(milis) every time because that'll be massive time consuming. Any workarounds??

A: From the Media documentation:

The media information is obtained asynchronously and so not necessarily available immediately after instantiation of the class. All information should however be available if the instance has been associated with a MediaPlayer and that player has transitioned to MediaPlayer.Status.READY status.  To be notified when metadata or Tracks are added, observers may be registered with the collections returned by getMetadata() and getTracks(), respectively.

So, you will probably need to add listeners and run your processing inside the listeners.  The listeners could be added either on the metadata directly or on the status of an associated player.  For example:
Media media = new Media(myMediaLocationString);
media.getMetadata().addListener((MapChangeListener<String, Object>) change -> {
    // code to process metadata attribute change.
});
MediaPlayer player = new MediaPlayer(media);

I haven't tried testing this with a sample program, but, from my understanding of the documentation, it should work ;-)

memory usage. Creating 2000 Media objects is really freezing the display. What to do?

Freezing and memory consumption are different things and can be unrelated.
To prevent the UI thread blocking, don't block the UI thread while creating media objects, use concurrency facilities.  There are many example for different scenarios in the Task documentation.  Be careful when writing concurrent code that you do not modify anything in an active scene graph (e.g. being displayed to the user).
To reduce memory consumption, don't keep references to media you no longer need and appropriately dispose of media player resources in a timely fashion.
Also consider if you really need to create 2000 media objects or whether it would be preferred to create just a subset of that amount initially and (perhaps) create additional objects dynamically on an as needs based.


text:
Q: Changing AWS Lambda environment variables when running test I've got a few small Python functions that post to twitter running on AWS. I'm a novice when it comes to Lambda, knowing only enough to get the functions running.
The functions have environment variables set in Lambda with various bits of configuration, such as post frequency and the secret data for the twitter application. These are read into the python script directly.
It's all triggered by an Event Bridge cron job that runs every hour.
I'm wanting to create a test event that will allow me to invoke the function manually, but would like to be able to change the post frequency variable when run like this.
Is there a simple way to change environment variables when running a test event?

A: That is very much possible and there are multiple ways to do it. One is to use AWS CLI's aws lambda update-function-configuration: https://docs.aws.amazon.com/cli/latest/reference/lambda/update-function-configuration.html
Alternatively, depending on programming language that you prefer, you can use AWS SDK that also has a similar method, you can find an example with JS SDK in this doc: https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/javascript_lambda_code_examples.html


text:
Q: Angular sourcing textarea from file I am trying to load text file config1100.txt to textarea (on initial page load), see below. Also tried http://localhost:3000/data/config1100.txt (file is avail), no success so far.

<textarea ng-src="data/config1100.txt" type="text" id="textarea" model="myTextArea" cols="80" rows="10" >

</textarea>

A: like this irom:
var app = angular.module("angularApp", []);

app.controller("myConfigGenCtrl", function($scope, customService)
{
  customService.getData().then(function(response)
  {
    $scope.myTextArea = response.data; //-- scope.myTextArea is your ng-model on your text area
  });
});

app.service('customService',function($http)
{
  this.getData = function()
  {
    return $http.get('localhost:3000/data/config1100.txt');
  };
});

also, your text area attribute model should be ng-model


text:
Q: How to host images stored inside S3 static website, over HTTPS? I have an S3 bucket which I'm using for storing images uploaded by users. Then I save paths to those images in my database, each path looks like so https://bucket-name.s3.eu-central-1...
I then added an image resizing feature which requires the S3 bucket to be a static website, so that redirection rules can be used.
Appearantly this static website thingy made it impossible to download those pictures using old paths with https protocol, and because my website is using https - I can't make http requests. So now all the profile pictures of the users aren't displayed at all.
I'm looking for a solution to this problem. I can change pictures' paths stored in the database if needed.

One possible solution I have in mind is using a subdomain with CloudFront, e.g. pictures.my-website.com/name-of-the-picture.png
Do you think it'll work and it's a good solution, or there is a better way?

A: Use CloudFront as a server with predefined domain and SSL certificates https://medium.com/@tsubasakondo_36683/serve-images-with-cloudfront-s3-8691d5c387b6


text:
Q: HTML5 Sortable: change into drag and drop only right The code of HTML5 sortable (http://farhadi.ir/projects/html5sortable/) with Connected Sortable Lists is based on drag and dropping an item of the right list to a li at the left list; either above or below it.
Is there a way how to define 5 slots at the left where the users can drag and drop them too, so only the 5 elements at the right are drag and dropable?

A: Try this jsFiddle
You can drag items from the left to the slots of the right.
You can change an item from slot and if you dbl-click on it, it returns where it comes from, on the left.
This is not perfect, it probably needs upgrade to fit your needs, but you got the way to do it...
HTML :

Slot1

Slot2

Slot3

Slot4

Slot5

Item1

Item2

Item3

Item4

Item5

JS:
$('.item')
    .each(function(i){ $(this).data('i', i);})
    .on({dragstart:function(e){
            console.log('ITEM : dragstart');
            draggedItem = $(this);
            e.stopImmediatePropagation();
         },
         dragend:function(e){e.preventDefault();},
         dragenter:function(e){e.preventDefault();},
         dragover:function(e){e.preventDefault();},
         dragleave:function(e){e.preventDefault();},
         drop: function(e){e.preventDefault();},
         dblclick:function(e){
             if (1 === $(this).parent('.slot.filled').length) {
                 console.log('ITEM : dblclick');
                 var i = $(this).data('i');
                 var last_before = $('.left > .item')
                                   .filter(function(){
                                       return $(this).data('i') < i;
                                   })
                                   .last();
                 $(this).parent('.slot').removeClass('filled');
                 if (0 === last_before.length){
                     $('.left').prepend($(this));
                 } else {
                     last_before.after($(this));
                 }
             }
             e.preventDefault();
         }
    });
$('.slot')
    .on({dragstart:function(e){e.preventDefault();},
         dragend:function(e){e.preventDefault();},
         dragenter:function(e){e.preventDefault();},
         dragover:function(e){e.preventDefault()},
         dragleave:function(e){e.preventDefault();},
         drop:function(e){
             console.log('SLOT : drop');
             draggedItem.parent('.slot').removeClass('filled');
             $(this).filter(':not(.filled)')
             .append(draggedItem)
             .addClass('filled');

             console.log('item:',draggedItem.data('i'),
                         'slot:', $(this).index('.slot'));

             // write you extras code here

             e.preventDefault();
         }
    })
;

FYI : I chose to overwrite all the drag'n drop functions (for items and slots), because I wanted to beat any tricky behavior. I am not sure it is mandatory, but I did not have time to test every combination.


text:
Q: Facebook app Business Verification I have read Business verification required as part of my app review but i have some more questions about the process.
My app uses the two default permissions (email, default) and Page Public Content Access, and I was wondering why i am getting the app business verification part, since I dont feel i need to verify a business for this. For ex. in the link above the person asking wanted user_friends, and in the https://developers.facebook.com/docs/facebook-login/changelog it states that that permission requires both app and buisness verification. My question:

*

*Why am i getting a business verification requirement? Is it because
of  the Page Public Content Access? I cant find a full table that
explain which permissions require both an app review and a business
review. Or am i getting it because in the settings for the app under Business Use i
selected that my app supports other business. My app maps events
from the facebook pages of restaurants and clubs , so it sounded to
be that it supports the other businesses rather than supports my own
business.


text:
Q: Deploying website on Vercel with Route53 subdomain I am trying to deploy my Next.js web app on Vercel with Route53. But I am already using my root domain with main service which is example.com.
I used to deploy with subdomin inside of  example.com hosted zone, which is subdomain.example.com.
But I had to add server, cdn, and other 2nd level subdomain like server.subdomain.example.com. So I created a new hosted zone for subdomain.example.com on Route53 and connected with root domain.
So I am trying to add subdomin.example.com on Vercel, but if I add this domain to Vercel project settings, they only get root domain current nameservers.
Is there anyway to add Route53 hosted zone domain to Vercel?


text:
Q: I can't correctly put my images to the window with using gridpane I am trying to put squares to the application window. I am using gridpane and ı need to put 16 square with 4x4 array . With gridpane ı can create 3 row 4 column array , however ı can't put squares to the bottom row. Here is my code and results :
public void start(Stage primaryStage) throws Exception {

    GridPane grid = new GridPane();

    Scene scene = new Scene(grid, 400, 400);

    Image image = new Image("Pipe_Vertical.jpg");

    Image image2 = new Image("Empty.jpg");

    ImageView imageView = new ImageView(image2);
    imageView.setFitHeight(100);
    imageView.setFitWidth(100);

    ImageView imageView2 = new ImageView(image2);
    imageView2.setFitHeight(100);
    imageView2.setFitWidth(100);

    ImageView imageView3 = new ImageView(image2);
    imageView3.setFitHeight(100);
    imageView3.setFitWidth(100);

    ImageView imageView4 = new ImageView(image2);
    imageView4.setFitHeight(100);
    imageView4.setFitWidth(100);

    ImageView imageView5 = new ImageView(image2);
    imageView5.setFitHeight(100);
    imageView5.setFitWidth(100);

    ImageView imageView6 = new ImageView(image2);
    imageView6.setFitHeight(100);
    imageView6.setFitWidth(100);

    grid.add(imageView3, 0, 0);
    grid.add(imageView4, 1, 0);
    grid.add(imageView2, 2, 0);
    grid.add(imageView, 3, 0);
    grid.add(imageView5, 0, 1);
    grid.add(imageView6, 3, 3);

    primaryStage.setTitle("Test");

    primaryStage.setScene(scene);

    primaryStage.show();

And this is what it looks when ı run it : Test Results :
grid.add(imageView6, 3, 3);

this part of the code should have put the square to the bottom right side but it is appearing on the wrong place.

A: Problem Solved. Needed to use
for (int i = 0; i < 4; i++) {
         RowConstraints row = new RowConstraints(100);
         grid.getRowConstraints().add(row);
     }
It creates 4 rows with 100 pixel height.


text:
Q: Java Swing - JFormattedTextField I have JFormattedTextField s in my form. I want to validate the length and characters that are being inserted in the field.
e.g FirstName must not allow a length more that 20 characters and should not allow any special and numeric characters being inserted. Space can be considered.
Please help me how can I achieve this goal.

A:
I want to validate the length and characters that are being inserted in the field.

Use a MaskFormatter with your JFormattedTextField. With the MaskFormatter you can:

*

*limit the number of characters

*provide a String of valid characters

Read the API for more information and examples.

A: We can set mask formatter to ("**********") so that we can accept less that 20 characters even, and setValidCharacters to alphabets.
It has resolved my issue in very few lines of code.


text:
Q: Falha ao criar uma dll com construtores nas classes Criei um cabeçalho com as definições da dll:
globaldef.h
#pragma once

#ifdef OPENXML_LIB
#define OPENXML __declspec(dllexport)
#else
#define OPENXML __declspec(dllimport)
#endif // OPENXML_LIB

Criei duas classes até o momento:
xmldoc.h
#pragma once

#define XML_MODE_R 0
#define XML_MODE_RW 1

#include "globaldef.h"
#include <fstream>
#include <string>

class OPENXML XmlDocumment {

public:

    XmlDocumment(std::string fileName, int mode);
    ~XmlDocumment();

    //Load xml content to string
    virtual std::string read();

private:

    //Xml file
    std::fstream xmlFile;
    std::string filename;
    int mode = 0;

};

xmldoc.cpp
#include "stdafx.h"
#include "xmldoc.h"
XmlDocumment::XmlDocumment(std::string fileName, int mode) {
     this->filename = fileName;
     this->mode = mode;
}
XmlDocumment::~XmlDocumment() { }
std::string XmlDocumment::read() {
     switch (mode) {
         case XML_MODE_R: xmlFile.open(filename, std::ios::in); break;
         case XML_MODE_RW: break;
     }
std::string content((std::istreambuf_iterator<char>(xmlFile)), (std::istreambuf_iterator<char>()));
xmlFile.close();
return content;

}

E a outra classe no momento não comecei a escrever
xmlnode.h
#pragma once

#include "globaldef.h"

class OPENXML XmlNode {

public:

};

Tudo compila normalmente se não houver um construtor, porém se adiciono um construtor mesmo sem parâmetros algum ou vazio, o compilador emite o seguinte error:


text:
Q: URP Simple Lit Emission not working on build iOS When working with a material with URP Simple Lit which has Emission turned on, the material glows fine in Editor View as well as Game View, BUT when building the project and running in on iOS, the material emission does not work.
The Base Map works fine and has the proper color but Emission Map seems to be completely ignored.
Any recommendations or ideas as to why this might be happening?
I have spent several days now looking for different solutions but nothing seems to work.
Thing's I've tried:

*

*Added "URP Simple Lit" to Always Include Shaders in Project Settings

*Added a small cube with this shader (As apparently that was the fix for some Standard shaders)

*Tried enabling material Emission keyword from script

Below you can observe the Settings of the material, as well as screenshots for both the game running in an iOS device and the game running in Game View inside Unity.

A: Make sure you turn on HDR in Low/Medium Quality URP setting. Android will switch to low/medium if it thinks the phone cannot run High Quality.


text:
Q: Need explanation of this result: $\frac{n}{\sum_n x_i Y_i} \sim N(\lambda,\frac{\lambda^2}{n})$ I have a distribution of an iid sample given by $$Y_i \sim Exp(\lambda x_i), \quad i=1\dots n$$
I have an estimator $$\hat\lambda = \frac{n}{\sum_n x_i Y_i}$$ and I am trying to figure out how the book arrived to $\hat\lambda \sim N(\lambda,\frac{\lambda^2}{n})$
The only explanation is something scribbled on the side on the side $$\frac{d^2<something>}{d\lambda^2} = \frac{-n}{\lambda}$$
but I cannot understand it's significance.

A: I believe the answer is, that the author used Cramer Rao to calculate a lower bound for the variance and then, using asymptotic normality, the variance should achieve that lower bound.

A: I did not realize this question was both asked and answered by berrygreen!
You are right, the followings are the detailed answer
This formula:
$$\frac{d^2<something>}{d\lambda^2} = \frac{-n}{\lambda}$$  I believe it was  used to calculate the Fisher information.
You pdf of $Y_i$ is
$$f(y_i;\lambda x_i)=(\lambda x_i)e^{-(\lambda x_i)y_i} \tag{1}$$
Your likelihood function is :
$$L(\lambda)=\lambda^n\prod_{i=1}^nx_ie^{-\lambda\sum_{i=1}^nx_iy_i}$$
The log likelihood function is:
$$l(\lambda)=nlog\lambda+\sum_{i=1}^nx_i-\lambda\sum_{i=1}^n x_iy_i$$
Take derivative of $\lambda$ and set to $0$
$$\frac{n}{\lambda}-\sum_{i=1}^n x_iy_i=0$$
$$\hat{\lambda}=\frac{n}{\sum_{i=1}^n x_iy_i}$$
Which is correct.
Next you need calculate the Fisher information.
$$I(\lambda)=-\int_{-\infty}^{\infty}\frac{\partial log^2 f(y_i;\lambda x_i)}{\partial^2\lambda}f(y_i;\lambda x_i)dy_i \tag{2}$$
Now from $(1)$
$$\frac{\partial log^2 f(y_i;\lambda x_i)}{\partial^2 \lambda}=-\frac{1}{\lambda^2}$$
From $(2)$
$$I(\lambda)=\frac{1}{\lambda^2} \tag{3}$$
Next you need use the theorem
$$\sqrt{n}(\hat{\lambda}-\lambda)\overset{D}{\rightarrow}N(0,\frac{1}{I(\lambda)})=N(0,\lambda ^2)  \tag{4}$$
Rearrange $(4)$  you will get
$$\hat{\lambda}\sim N(\lambda,\frac{\lambda^2}{n})$$
This arrives your book's conclusion.


text:
Q: What is the best way to authenticate user with node and angularjs? I am doing a project on the node with the angles and Mysql, I want to use the user data from the Mysql database but what is the best way of user authentication with node?
I'm sorry for my English

A: There are several authentication schemes, which you select depends on the objectives of your application. Many of these schemes or strategies are implemented in passport module


text:
Q: Let V be a vector space and W a subset of V. Suppose zero is in W and W is closed under addition. Is W a subspace of V? I know that the answer to this question is No. My question is why is the answer no? What's missing?
if possible give a specific example of both V and W such that W satisfies above conditoins but it is NOT a subspace.

A: $\mathbb{Z} \subset \mathbb{R}$

A: Integers, as a subset of real numbers. Clearly this is not a real subspace.

A: Here's an example:  Let $V=\Bbb R^2$ and $W=\{(n,m):n,m\in\Bbb Z\}$.  $W$ is certainly closed under addition, contains $(0,0)$, but it is not closed under scalr multiplication.  For example, $\frac12(1,1)\notin W$.

A: Well the answer is not simply "no" because it could be the case.
The answer to if it guarantees that its a subspace however, is indeed no.
Consider the basic example using $\mathbb{R^3}$.
Consider the space W consisting of vectors of the form $v=(x,y,z)$ such that all $x,y$ and $z$ are integers. So of course the zero vector is in W
say $v_1,v_2 \in W$ where $v_1=(3,2,3)$ and $v_2=(1,3,4)$ then $v_1+v_2 \in W$ but $\frac{1}{3} v_1= (1,\frac{2}{3},1)$ $\notin W$. i.e., this is not a subspace. even though it is a subset and the other two properties hold.


text:
Q: Missing post data when updating Select options with JQuery I have two selects in a form:

*

*input_licensee_list: filled with possible options (Using an Ajax call)

*output_licensee_list: to get the selection from the user.

When I post the form, I get the list in output_licensee_list.
For this I added two buttons: Add (Move selected options from input to output), and Add All (Move all options from input to output).
// Add all button: remove all entries from input list and add them to output list
add_all_button.on('click', function (e) {
    var options = input_licensee_list.find("option").remove();
    options.append(' (' + group_selection.find("option:selected").text() + ')');
    options.appendTo(output_licensee_list);
    output_licensee_list.trigger('change');
    input_licensee_list.trigger('change');
});

// Add button: remove selected entries from input list and add them to output list
add_button.on('click', function (e) {
    var options = input_licensee_list.find("option:selected").remove();
    options.append(' (' + group_selection.find("option:selected").text() + ')');
    options.appendTo(output_licensee_list);
    output_licensee_list.trigger('change');
    input_licensee_list.trigger('change');
});

I have prepared a JSFiddle to show it:
https://jsfiddle.net/zaun8qgp/4/
The JQuery code itself seems to work fine, and the form is posted correctly if I use the "Add" button (Even if I select all options).
However for some reason, if I use the "Add all" button:

*

*The input output_licensee_list does not appear in the POST at all, so I do not get any information from it;

*If I use "Add", then "Add all", the information I get in the post if the list I initially added (before the Add All).

If anyone has clues on why it does not work correctly, or how I can debug more, I would appreciate !

A: Your problem is that submitting a from that contains a <select> only submits selected options. The options you add in the "Add all" are not selected.
The easiest way to fix this is to add:
options.prop('selected', 'true');

to you form submit event handler in order to make sure all options are selected before submitting.


text:
Q: Copy and overwrite a file in shell script I want to copy a certain file to a location, irrespective of that file already exists in the destination or not. I'm trying to copy through shell script.But the file is not getting copied. I'm using the following command
/bin/cp -rf /source/file /destination
but that doesn't work.

A: Use
cp -fr /source/file /destination

this should probably solve the problem.

A: This question has been already discussed, however you can write a little script like this:
#!/bin/bash
if [ ! -d "$2" ]; then
  mkdir -p "$2"
fi
cp -R "$1" "$2"

Explaining this script a little bit

*

*#!/bin/bash: tells your computer to use the bash interpreter.

*if [ ! -d "$2" ]; then: If the second variable you supplied does not already exist...

*  mkdir -p "$2": make that directory, including any parent directories supplied in the path.
Running mkdir -p one/two/three will make:
$ mkdir -p one/two/three
$ tree one
one/
└── two
    └── three

If you don't supply the -p tag then you'll get an error if directories one and two don't exist:
$ mkdir one/two/three
mkdir: cannot create directory 'one/two/three': No such file or directory

*fi: Closes the if statement.

*cp -R "$1" "$2": copies files from the first variable you supplied to the directory of the second variable you supplied.
So if you ran script.sh mars pluto, mars would be the first variable ($1) and pluto would be the second variable ($2).
The -R flag means it does this recursively, so the cp command will go through all the files and folders from your first variable, and copy them to the directory of your second variable.

A: Your problem might be caused by an alias for cp command created in your system by default (you can see al your aliases by typing "alias").
For example, my system has the following alis by default: alias cp='cp -i', where -i overrides -f option, i.e. cp will always prompt for overwriting confirmation.
What you need in such case (that'll actually work even if you don't have an alias) is to feed "yes" to that confirmation. To do that simply modify your cp command to look like this:
yes | cp /source/file /destination

A: /bin/cp -rf src dst
or
/usr/bin/env cp -rf


text:
Q: Onclick AJAX call and PHP I'm creating a simple poll webapp. I need to increment a row in mysql DB on click.
I read a lot about PHP working with AJAX, but I can't find the issue.
Here is my code:
<form role="form" method="post">

<a id="vote_<?php echo $_SESSION['idanswer']; ?>" href="#" num-rep="<?php echo $_SESSION['idanswer']; ?>" class="vote_btn btn btn-primary" id="#" type="submit">OPTION 1

</form>

Actually, in my real code, this a WHILE loop to show all choices : OPTION 1, OPTION 2, OPTION 3.
My goal is to increment a value on click.
My JS :
$( document ).ready(function() {
    $('.vote_btn').click( function(e){
    e.preventDefault();
    var idRep = $(this).attr('num-rep');
    $.ajax({
          type: 'POST',
          url: 'ajax_vote.php',
          dataType: 'json',
          data: {idAns : idAns},
          success: function(data){
          if(data.response == 'vote_ok'){
$('#vote_'+idAns).addClass('voted');
alert('Well done bro !');
}
else{
alert('Not workinnnnnng');
     }
     }
     });
     });

});
And finally, my ajax_vote.php :
<?php
session_start();
include_once("../connect.php");
$vote = $bdd->query("SELECT * FROM poll_answers WHERE id='$id'");
while ($voteactuel = $vote->fetch()) {
$voteactu = $voteactuel['counter']; // get the value from database

$voteactu = $voteactu + 1; // add one

$bdd->query("UPDATE poll_answers SET counter = $voteactu WHERE id = '$_SESSION['idanswer']'"); //update value
}
?>

When I do this, I can see in the Firebug console that the POST is working, with the value. But the response is

Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE),
  expecting identifier (T_STRING) or variable (T_VARIABLE) or number
  (T_NUM_STRING) in C:\xampp\htdocs\BPATLive\sondage\ajax_vote.php on
  line 10

I can't find how to solve the issue :(
I know this is not the good way to do on many things (such as my way to increment), but this is only for an internal use in my company. So issues concerning security or load are not really the point (even if advices would be appreciated ;))


text:
Q: nested loops not working, cant exit inner loop i trying use a defined range to loop through an auto filter to copy the data then loop through an array of ranges where i want to paste value the data.
im running into issues as the inner loop continues to execute and all ranges have the same values.
thinking i somehow need to condense this to 1 loop but for the life of me can not figure out how get both to increment together in the same loop?
Sub TrendTables()

Dim rng As Range, dailyTrendrng As Long, c As Range
Dim lastrow As Long

Dim aTrendRng(1 To 16) As Range

Set aTrendRng(1) = Sheets("Daily Trends").Range("A2")
Set aTrendRng(2) = Sheets("Daily Trends").Range("K2")
Set aTrendRng(3) = Sheets("Daily Trends").Range("A29")
Set aTrendRng(4) = Sheets("Daily Trends").Range("K29")
Set aTrendRng(5) = Sheets("Daily Trends").Range("A56")
Set aTrendRng(6) = Sheets("Daily Trends").Range("K56")
Set aTrendRng(7) = Sheets("Daily Trends").Range("A83")
Set aTrendRng(8) = Sheets("Daily Trends").Range("K83")
Set aTrendRng(9) = Sheets("Daily Trends").Range("A110")
Set aTrendRng(10) = Sheets("Daily Trends").Range("K110")
Set aTrendRng(11) = Sheets("Daily Trends").Range("A137")
Set aTrendRng(12) = Sheets("Daily Trends").Range("K137")
Set aTrendRng(13) = Sheets("Daily Trends").Range("A164")
Set aTrendRng(14) = Sheets("Daily Trends").Range("K164")
Set aTrendRng(15) = Sheets("Daily Trends").Range("A191")
Set aTrendRng(16) = Sheets("Daily Trends").Range("K191")

'clear ranges on Daily Trends tab
Set rng = Sheets("Daily Trends").Range("A2:S24, A29:S51, A56:S78, A83:S105, A110:S132, A137:S159, A164:S186, A191:S213")
rng.ClearContents

'turn off any previous filters
If Sheets("daily dump").AutoFilterMode Then
    Sheets("daily dump").AutoFilter.Range.AutoFilter
End If

With Sheets("daily dump")
    lastrow = .Cells(Rows.Count, "A").End(xlUp).Row
End With

Set c = Sheets("mapping").Range("BG1:BG16")

For Each c In Sheets("mapping").Range("BG1:BG16")

Sheets("daily dump").Range("A4:P" & lastrow).AutoFilter Field:=4, Criteria1:="=" & c.Value
Sheets("daily dump").Range("A4:P" & lastrow).SpecialCells(xlCellTypeVisible).Copy

    For dailyTrendrng = LBound(aTrendRng) To UBound(aTrendRng)
        aTrendRng(dailyTrendrng).PasteSpecial xlValues
    Next

''''''this is where i want to go back to my first "FOR LOOP"

Next

End Sub

A: If you are confident that your copied ranges will always fit within a 27 row x 10 column destination area, the following code has been refactored to just use a single loop:
Sub TrendTables()

    Dim rng As Range, dailyTrendrng As Long, c As Range
    Dim lastrow As Long
    Dim mappingRow As Long
    Dim aTrendRng As Variant

    aTrendRng = Array("A2", "K2", _
                      "A29", "K29", _
                      "A56", "K56", _
                      "A83", "K83", _
                      "A110", "K110", _
                      "A137", "K137", _
                      "A164", "K164", _
                      "A191", "K191")

    'clear ranges on Daily Trends tab
    Set rng = Worksheets("Daily Trends").Range("A2:S24, A29:S51, A56:S78, A83:S105, A110:S132, A137:S159, A164:S186, A191:S213")
    rng.ClearContents

    With Worksheets("daily dump")
        'turn off any previous filters
        If .AutoFilterMode Then
            .AutoFilter.Range.AutoFilter
        End If

        lastrow = .Cells(.Rows.Count, "A").End(xlUp).Row

        mappingRow = 1
        For dailyTrendrng = LBound(aTrendRng) To UBound(aTrendRng)
            'This line could be used if we wanted to get rid of "mappingRow", but
            'it's a bit harder to understand
            '.Range("A4:P" & lastrow).AutoFilter Field:=4, Criteria1:="=" & Worksheets("mapping").Range("BG" & (dailyTrendrng - LBound(aTrendRng) + 1)).Value
            'so we will use the following line instead
            .Range("A4:P" & lastrow).AutoFilter Field:=4, Criteria1:="=" & Worksheets("mapping").Range("BG" & mappingRow).Value
            .Range("A4:P" & lastrow).SpecialCells(xlCellTypeVisible).Copy
            Worksheets("Daily Trends").Range(aTrendRng(dailyTrendrng)).PasteSpecial xlValues

            mappingRow = mappingRow + 1
        Next
    End With

End Sub

Major changes were:

*

*I created an extra variable (mappingRow) to point to each cell in the "mapping" sheet.  (I included a commented out line which would achieve the same thing without the extra variable, but using the extra variable is probably easier to understand.)  This is the only change that was really necessary to achieve what you wanted.

*I just stored the 16 destination range addresses, rather than 16 different range objects.  It just seemed like it would be a bit easier to maintain this way.

*I changed Rows.Count to .Rows.Count so that it referred to the "daily_dump" sheet and not to the active sheet.

*I used Worksheets rather than Sheets everywhere - the Sheets collection includes Chart sheets, so it is usually better practice to refer specifically to Worksheets when you know that you are using a Worksheet, and only use Sheets when you are unsure whether it is a Worksheet or Chart that you are referencing.


text:
Q: Calling javascript modal inside another modal I am trying to integrate the modal i.e(javascript function given by janrain) inside the modal which is already existing. my site is running in MVC architechture.  There are many tabs in my screen, and  I am writing all the javascript function for all the tabs in the tabs.htm file.
Once A tab is clicked, it is calling javascript function in tabs.htm file then ajax request to the specific html file, then displaying all the contents of html in the clicked tab.
Say in A tab i am having one button and on onclick event i am calling the javascript function in tabs.htm file then calling the modal from specific tabs html file and then displaying the modal in the tab.
Now i need to add the modal given by janrain shown below, Below the other modal which is also below.
(function() {
    if (typeof window.janrain !== 'object') window.janrain = {};
    if (typeof window.janrain.settings !== 'object') window.janrain.settings = {};

    janrain.settings.tokenUrl = 'MY_URL';

    function isReady() { janrain.ready = true; };
    if (document.addEventListener) {
      document.addEventListener("DOMContentLoaded", isReady, false);
    } else {
      window.attachEvent('onload', isReady);
    }

    var e = document.createElement('script');
    e.type = 'text/javascript';
    e.id = 'janrainAuthWidget';

    if (document.location.protocol === 'https:') {
      e.src = 'https://rpxnow.com/js/lib/oauth/engage.js';
    } else {
      e.src = 'http://widget-cdn.rpxnow.com/js/lib/oauth/engage.js';
    }

    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(e, s);
})();

This is the modal i am already calling in the button click event in A's htm file.

Name

<input type="text" id="txtUserName" name="txtUserName" class="glow" style="width:150px;">

E-Mail ID

<input type="text" id="txtEmailQuest" name="txtEmailQuest" class="glow" style="width:150px;">

<input id="ask" type="image" src="/templates/default/images/askQuestion.jpg"  onClick="ValidateFormHere()"/>

Now i want to add the javascript modal to this form.  If i kept the javascript modal in the tabs.htm file how can i call that when this modal is called.  If i paste the javascript file in the modal pasted above, it is not working.  Hope my question is clear.
Thanks in Advance.

A: Vignesh. You'll want to do two things:
1 - Go to https://rpxnow.com/relying_parties/your_rp_here and go to Deployment > Sign In For Web. Set your widget type as embedded (NOT modal), then hit Save and Publish.
2 - In your form where you want the buttons to show up, add this line of code:

There's a possibility that your JavaScript that causes that tab to load won't actually load the widget. If that happens, call the janrain.engage.signin.widget.init() function in the same event that loads that tab. It should get the widget to load for you.


text:
Q: Web Speech API - use own service Reading this, and this. It seems clear that we can use Web Speech API without google speech recognizer engine. But in all of this information I can't found anything that supports this. And allow me to do that. Is it really possible?

A: Well, as per spec, sure its formally possible. Do you really want to use your own service? Check the api description . You should be able to set the 'serviceURI' property to your own speech recognition server for sure.
But as touffy mentioned, its really gonna be difficult to someone just create their own server very quickly as it requires a lot of machine learning/iterations and server resources to support this.


text:
Q: Set php variable depending on where page is loaded from I have two ways to get to my chat.php page.
One way is via profile page link and the other is via the menu.
My question is, how can I know in chat.php, where the page is loaded from?

A: I understand require this information using javascript, if it is the case use referrer
const referrer = document.referrer;

MDN

The Document.referrer property returns the URI of the page that linked
to this page.

Document.referrer


text:
Q: Lookup orientdb database version I have an OrientDB database created using a specific version of OrientDB. I do not know the specific version; this was done before my time. When I point orientDB version 2.1.2 the Studio UI says it cant log me in.
It throws this exception
com.orientechnologies.orient.core.exception.OSchemaException: Cannot add base class 'userAccount', because of parameter conflict: userID (type=STRING) vs userID (type=STRING)
at com.orientechnologies.orient.core.metadata.schema.OClassImpl.checkParametersConflict(OClassImpl.java:2388)
at com.orientechnologies.orient.core.metadata.schema.OClassImpl.addBaseClass(OClassImpl.java:2370)
at com.orientechnologies.orient.core.metadata.schema.OClassImpl.setSuperClassesInternal(OClassImpl.java:459)
at com.orientechnologies.orient.core.metadata.schema.OSchemaShared.fromStream(OSchemaShared.java:775)
at com.orientechnologies.orient.core.type.ODocumentWrapperNoClass.reload(ODocumentWrapperNoClass.java:74)
at com.orientechnologies.orient.core.metadata.schema.OSchemaShared.load(OSchemaShared.java:861)
at com.orientechnologies.orient.core.metadata.OMetadataDefault$1.call(OMetadataDefault.java:150)
at com.orientechnologies.orient.core.metadata.OMetadataDefault$1.call(OMetadataDefault.java:145)
at com.orientechnologies.common.concur.resource.OSharedContainerImpl.getResource(OSharedContainerImpl.java:64)
Caused: com.orientechnologies.common.exception.OException: Error on creation of shared resource
    at com.orientechnologies.common.concur.resource.OSharedContainerImpl.getResource(OSharedContainerImpl.java:66)
    at com.orientechnologies.orient.core.storage.OStorageAbstract.getResource(OStorageAbstract.java:143)
    at com.orientechnologies.orient.core.metadata.OMetadataDefault.init(OMetadataDefault.java:145)
    at com.orientechnologies.orient.core.metadata.OMetadataDefault.load(OMetadataDefault.java:76)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.initAtFirstOpen(ODatabaseDocumentTx.java:2871)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.open(ODatabaseDocumentTx.java:260)
    at com.orientechnologies.orient.core.db.OPartitionedDatabasePool$DatabaseDocumentTxPolled.internalOpen(OPartitionedDatabasePool.java:140)
    at com.orientechnologies.orient.core.db.OPartitionedDatabasePool.openDatabase(OPartitionedDatabasePool.java:343)
    at com.orientechnologies.orient.core.db.OPartitionedDatabasePool.acquire(OPartitionedDatabasePool.java:313)
    at
    at com.orientechnologies.orient.core.db.ODatabaseRecordThreadLocal.get(ODatabaseRecordThreadLocal.java:54)

I would like to figure out the db engine version used to create the database so that I can have a look at the data.
Ideally I would like to continue to use 2.1.2 - but I suppose getting the version on which the db was created is a good starting point.


text:
Q: How to rename multiple file name include subfolders? For example i have the following files:
./dirA/fileA.png
./dirA/fileB.png
./dirA/fileC.png
./dirB/fileD.png
./dirB/fileE.png
./dirB/dirC/fileF.png

Is there any one line command or script to rename the file name to be the following?
./dirA/fileA@2x.png
./dirA/fileB@2x.png
./dirA/fileC@2x.png
./dirB/fileD@2x.png
./dirB/fileE@2x.png
./dirB/dirC/fileF@2x.png

A: Try:
find . -type f -name '*.png' -execdir bash -c 'mv "$1" "${1%.png}@2x.png"' Move {} \;

*

*find .
This starts a file search with the current directory.

*-type f
This limits the search to regular files.

*-name '*.png'
This limits the search to files whose names end with .png.

*-execdir bash -c '...' Move {} \;
This runs the command in single quotes with $0 assigned to Move and $1 assigned to the name of the file that was found.  In our case, the command in single quotes is:

*mv "$1" "${1%.png}@2x.png"
This renames the file to end with @2x.png.  The construct ${1%.png} removes the .png from the end of the file name.  Thus, ${1%.png}@2x.png replaces the .png at the end of the file name with @2x.png.
Example
Let's start with directories with these files:
$ find .
.
./dirA
./dirA/fileA.png
./dirA/fileC.png
./dirA/fileB.png
./dirB
./dirB/fileE.png
./dirB/dirC
./dirB/dirC/fileF.png
./dirB/fileD.png

Now, let's run our command:
$ find . -type f -name '*.png' -execdir bash -c 'mv "$1" "${1%.png}@2x.png"' Move {} \;

After the command has executed, we now have these files:
$ find .
.
./dirA
./dirA/fileC@2x.png
./dirA/fileA@2x.png
./dirA/fileB@2x.png
./dirB
./dirB/dirC
./dirB/dirC/fileF@2x.png
./dirB/fileD@2x.png
./dirB/fileE@2x.png


text:
Q: Convert JSON from GitHub to NSArray How do I convert the JSON result from the GitHub API into an NSArray so I can populate a UITableView?
Here's the response I get:
[
    {
        "archive_url": "https://api.github.com/repos/JamesKTest/Repo1/{archive_format}{/ref}",
        "assignees_url": "https://api.github.com/repos/JamesKTest/Repo1/assignees{/user}",
        "blobs_url": "https://api.github.com/repos/JamesKTest/Repo1/git/blobs{/sha}",
        "branches_url": "https://api.github.com/repos/JamesKTest/Repo1/branches{/branch}",
        "clone_url": "https://github.com/JamesKTest/Repo1.git",
        "collaborators_url": "https://api.github.com/repos/JamesKTest/Repo1/collaborators{/collaborator}",
        "comments_url": "https://api.github.com/repos/JamesKTest/Repo1/comments{/number}",
        "commits_url": "https://api.github.com/repos/JamesKTest/Repo1/commits{/sha}",
        "compare_url": "https://api.github.com/repos/JamesKTest/Repo1/compare/{base}...{head}",
        "contents_url": "https://api.github.com/repos/JamesKTest/Repo1/contents/{+path}",
        "contributors_url": "https://api.github.com/repos/JamesKTest/Repo1/contributors",
        "created_at": "2013-05-12T14:16:14Z",
        "default_branch": "master",
        "description": "Testing Repo 1",
        "downloads_url": "https://api.github.com/repos/JamesKTest/Repo1/downloads",
        "events_url": "https://api.github.com/repos/JamesKTest/Repo1/events",
        "fork": 0,
        "forks": 0,
        "forks_count": 0,
        "forks_url": "https://api.github.com/repos/JamesKTest/Repo1/forks",
        "full_name": "JamesKTest/Repo1",
        "git_commits_url": "https://api.github.com/repos/JamesKTest/Repo1/git/commits{/sha}",
        "git_refs_url": "https://api.github.com/repos/JamesKTest/Repo1/git/refs{/sha}",
        "git_tags_url": "https://api.github.com/repos/JamesKTest/Repo1/git/tags{/sha}",
        "git_url": "git://github.com/JamesKTest/Repo1.git",
        "has_downloads": 1,
        "has_issues": 1,
        "has_wiki": 1,
        "homepage": "<null>",
        "hooks_url": "https://api.github.com/repos/JamesKTest/Repo1/hooks",
        "html_url": "https://github.com/JamesKTest/Repo1",
        "id": 10014504,
        "issue_comment_url": "https://api.github.com/repos/JamesKTest/Repo1/issues/comments/{number}",
        "issue_events_url": "https://api.github.com/repos/JamesKTest/Repo1/issues/events{/number}",
        "issues_url": "https://api.github.com/repos/JamesKTest/Repo1/issues{/number}",
        "keys_url": "https://api.github.com/repos/JamesKTest/Repo1/keys{/key_id}",
        "labels_url": "https://api.github.com/repos/JamesKTest/Repo1/labels{/name}",
        "language": "<null>",
        "languages_url": "https://api.github.com/repos/JamesKTest/Repo1/languages",
        "master_branch": "master",
        "merges_url": "https://api.github.com/repos/JamesKTest/Repo1/merges",
        "milestones_url": "https://api.github.com/repos/JamesKTest/Repo1/milestones{/number}",
        "mirror_url": "<null>",
        "name": "Repo1",
        "notifications_url": "https://api.github.com/repos/JamesKTest/Repo1/notifications{?since,all,participating}",
        "open_issues": 0,
        "open_issues_count": 0,
        "owner": {
            "avatar_url": "https://secure.gravatar.com/avatar/c0adbfe21e23cdb5165a212c412b6f30?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
            "events_url": "https://api.github.com/users/JamesKTest/events{/privacy}",
            "followers_url": "https://api.github.com/users/JamesKTest/followers",
            "following_url": "https://api.github.com/users/JamesKTest/following{/other_user}",
            "gists_url": "https://api.github.com/users/JamesKTest/gists{/gist_id}",
            "gravatar_id": "c0adbfe21e23cdb5165a212c412b6f30",
            "html_url": "https://github.com/JamesKTest",
            "id": 4395917,
            "login": "JamesKTest",
            "organizations_url": "https://api.github.com/users/JamesKTest/orgs",
            "received_events_url": "https://api.github.com/users/JamesKTest/received_events",
            "repos_url": "https://api.github.com/users/JamesKTest/repos",
            "starred_url": "https://api.github.com/users/JamesKTest/starred{/owner}{/repo}",
            "subscriptions_url": "https://api.github.com/users/JamesKTest/subscriptions",
            "type": "User",
            "url": "https://api.github.com/users/JamesKTest"
        },
        "permissions": {
            "admin": 1,
            "pull": 1,
            "push": 1
        },
        "private": 0,
        "pulls_url": "https://api.github.com/repos/JamesKTest/Repo1/pulls{/number}",
        "pushed_at": "2013-05-12T14:16:15Z",
        "size": 0,
        "ssh_url": "git@github.com:JamesKTest/Repo1.git",
        "stargazers_url": "https://api.github.com/repos/JamesKTest/Repo1/stargazers",
        "statuses_url": "https://api.github.com/repos/JamesKTest/Repo1/statuses/{sha}",
        "subscribers_url": "https://api.github.com/repos/JamesKTest/Repo1/subscribers",
        "subscription_url": "https://api.github.com/repos/JamesKTest/Repo1/subscription",
        "svn_url": "https://github.com/JamesKTest/Repo1",
        "tags_url": "https://api.github.com/repos/JamesKTest/Repo1/tags",
        "teams_url": "https://api.github.com/repos/JamesKTest/Repo1/teams",
        "trees_url": "https://api.github.com/repos/JamesKTest/Repo1/git/trees{/sha}",
        "updated_at": "2013-05-12T14:16:15Z",
        "url": "https://api.github.com/repos/JamesKTest/Repo1",
        "watchers": 0,
        "watchers_count": 0
    },
    {
        "archive_url": "https://api.github.com/repos/JamesKTest/Repo2/{archive_format}{/ref}",
        "assignees_url": "https://api.github.com/repos/JamesKTest/Repo2/assignees{/user}",
        "blobs_url": "https://api.github.com/repos/JamesKTest/Repo2/git/blobs{/sha}",
        "branches_url": "https://api.github.com/repos/JamesKTest/Repo2/branches{/branch}",
        "clone_url": "https://github.com/JamesKTest/Repo2.git",
        "collaborators_url": "https://api.github.com/repos/JamesKTest/Repo2/collaborators{/collaborator}",
        "comments_url": "https://api.github.com/repos/JamesKTest/Repo2/comments{/number}",
        "commits_url": "https://api.github.com/repos/JamesKTest/Repo2/commits{/sha}",
        "compare_url": "https://api.github.com/repos/JamesKTest/Repo2/compare/{base}...{head}",
        "contents_url": "https://api.github.com/repos/JamesKTest/Repo2/contents/{+path}",
        "contributors_url": "https://api.github.com/repos/JamesKTest/Repo2/contributors",
        "created_at": "2013-05-12T14:16:32Z",
        "default_branch": "master",
        "description": "Test Repo 2",
        "downloads_url": "https://api.github.com/repos/JamesKTest/Repo2/downloads",
        "events_url": "https://api.github.com/repos/JamesKTest/Repo2/events",
        "fork": 0,
        "forks": 0,
        "forks_count": 0,
        "forks_url": "https://api.github.com/repos/JamesKTest/Repo2/forks",
        "full_name": "JamesKTest/Repo2",
        "git_commits_url": "https://api.github.com/repos/JamesKTest/Repo2/git/commits{/sha}",
        "git_refs_url": "https://api.github.com/repos/JamesKTest/Repo2/git/refs{/sha}",
        "git_tags_url": "https://api.github.com/repos/JamesKTest/Repo2/git/tags{/sha}",
        "git_url": "git://github.com/JamesKTest/Repo2.git",
        "has_downloads": 1,
        "has_issues": 1,
        "has_wiki": 1,
        "homepage": "<null>",
        "hooks_url": "https://api.github.com/repos/JamesKTest/Repo2/hooks",
        "html_url": "https://github.com/JamesKTest/Repo2",
        "id": 10014510,
        "issue_comment_url": "https://api.github.com/repos/JamesKTest/Repo2/issues/comments/{number}",
        "issue_events_url": "https://api.github.com/repos/JamesKTest/Repo2/issues/events{/number}",
        "issues_url": "https://api.github.com/repos/JamesKTest/Repo2/issues{/number}",
        "keys_url": "https://api.github.com/repos/JamesKTest/Repo2/keys{/key_id}",
        "labels_url": "https://api.github.com/repos/JamesKTest/Repo2/labels{/name}",
        "language": "<null>",
        "languages_url": "https://api.github.com/repos/JamesKTest/Repo2/languages",
        "master_branch": "master",
        "merges_url": "https://api.github.com/repos/JamesKTest/Repo2/merges",
        "milestones_url": "https://api.github.com/repos/JamesKTest/Repo2/milestones{/number}",
        "mirror_url": "<null>",
        "name": "Repo2",
        "notifications_url": "https://api.github.com/repos/JamesKTest/Repo2/notifications{?since,all,participating}",
        "open_issues": 0,
        "open_issues_count": 0,
        "owner": {
            "avatar_url": "https://secure.gravatar.com/avatar/c0adbfe21e23cdb5165a212c412b6f30?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
            "events_url": "https://api.github.com/users/JamesKTest/events{/privacy}",
            "followers_url": "https://api.github.com/users/JamesKTest/followers",
            "following_url": "https://api.github.com/users/JamesKTest/following{/other_user}",
            "gists_url": "https://api.github.com/users/JamesKTest/gists{/gist_id}",
            "gravatar_id": "c0adbfe21e23cdb5165a212c412b6f30",
            "html_url": "https://github.com/JamesKTest",
            "id": 4395917,
            "login": "JamesKTest",
            "organizations_url": "https://api.github.com/users/JamesKTest/orgs",
            "received_events_url": "https://api.github.com/users/JamesKTest/received_events",
            "repos_url": "https://api.github.com/users/JamesKTest/repos",
            "starred_url": "https://api.github.com/users/JamesKTest/starred{/owner}{/repo}",
            "subscriptions_url": "https://api.github.com/users/JamesKTest/subscriptions",
            "type": "User",
            "url": "https://api.github.com/users/JamesKTest"
        },
        "permissions": {
            "admin": 1,
            "pull": 1,
            "push": 1
        },
        "private": 0,
        "pulls_url": "https://api.github.com/repos/JamesKTest/Repo2/pulls{/number}",
        "pushed_at": "2013-05-12T14:16:36Z",
        "size": 0,
        "ssh_url": "git@github.com:JamesKTest/Repo2.git",
        "stargazers_url": "https://api.github.com/repos/JamesKTest/Repo2/stargazers",
        "statuses_url": "https://api.github.com/repos/JamesKTest/Repo2/statuses/{sha}",
        "subscribers_url": "https://api.github.com/repos/JamesKTest/Repo2/subscribers",
        "subscription_url": "https://api.github.com/repos/JamesKTest/Repo2/subscription",
        "svn_url": "https://github.com/JamesKTest/Repo2",
        "tags_url": "https://api.github.com/repos/JamesKTest/Repo2/tags",
        "teams_url": "https://api.github.com/repos/JamesKTest/Repo2/teams",
        "trees_url": "https://api.github.com/repos/JamesKTest/Repo2/git/trees{/sha}",
        "updated_at": "2013-05-12T14:16:36Z",
        "url": "https://api.github.com/repos/JamesKTest/Repo2",
        "watchers": 0,
        "watchers_count": 0
    }
]

A: The JSON result you are getting back is essentially an NSDictionary.  In your
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

pull out the individual dictionary entries that you want and set the cell text to the NSString that is returned from the dictionary.  Your indexPath for the particular row could possibly map to the key for the dictionary, to make your life easier.

A: As your response contains array of dictionaries, after parsing your json you will get an NSArry of dictionary.
// handle it
NSError *e = nil;
NSArray *jsonArray = [NSJSONSerialization JSONObjectWithData: data options: NSJSONReadingMutableContainers error: &e];

if (!jsonArray) {
    NSLog(@"Error parsing JSON: %@", e);
} else {
    NSLog(@"parsing done and array contains data");
}

Inside your cellForRowAtIndexPath tableview delegate method take out the dictionary depending on indexpath.
[jsonArray objectAtIndex:indexpath.row];


text:
Q: How to turn off new popup for spell checking in Word for Mac on macOS 11.3 After the last macOS update, a popup started appearing when you click on a misspelled word in Word for Mac.

This is a very frustrating function when you work in several different languages not always wanting to spell-check even though the red underscoring is good as a reminder. Hence, I want to keep the previous functionality to get suggestions when right-clicking on an underscored word but would really want to turn this popup function off. Does anyone know how this could be done?
The only option I've found is to turn spell-checking as you write off completely, which also removes the red underscoring that I'd like to keep.

A: Go to preferences > View and untick comments on rollover

A: Just experienced this and I found the solution.
On Mac, goto
Word -> Preferences-> AutoCorrect (make sure you're on the AutoCorrect tab)

and at the bottom un-check Automatically use suggestions from the spelling checker and this will remove that annoying new pop-up bubble.
However, the red squiggly lines will still be there and you can still right-click and see your options to fix the red squiggly lines (just like how it used to be before this update).

A: Deselecting this worked for the spelling suggestions box, but not grammar (I still get those popups...)


text:
Q: How to show dgv2 right beneath the row in dgv1 being edited I am trying to show a dgv2 on dgv1 but right under the row in dgv1 being edited.
I tried with this code
  Private Sub Purchases_CellBeginEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellCancelEventArgs) Handles Purchases.CellBeginEdit

    Dim Y as integer = 0

   For i As Integer = 0 To dgv1.CurrentRow.Index
            If dgv1.Rows(i).Index < dgv1.CurrentRow.Index Then
                Y = dgv1.Rows.Count * dgv1.Rows(0).Height + dgv1.ColumnHeadersHeight + 12
            End If
        Next
        dgv2.Location = New Point(53, Y)

  End Sub

I shows alright but when i go back to row 1 on dgv1, it stays where it is. Lets say i start to edit from row 1 and i get to row 4, and i want to make a correction in row 1, i want dgv2 to move back under row1.
Any help would be greatly appreciated.

A: Just ran into this myself and found using the mouse y position (minus top of the form + 24) worked perfect.
Private Sub DataGridView1_CellEnter(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellEnter
    mouseY = Windows.Forms.Cursor.Position.Y - Me.Top + 24
End Sub

A: I removed the if condition and it works perfectly
this is the code
    Try
        For i As Integer = 0 To Purchases.CurrentRow.Index

       Y = i * Purchases.Rows(0).Height + Purchases.ColumnHeadersHeight + 34

        Next

        itemlist.Location = New Point(53, Y)

    Catch ex As Exception
        MsgBox(ex.Message)
    End Try


text:
Q: Characteristics emerging from subdividing an obtuse scalene triangle? I'm relying only on the geometry I learned in high school.
Given a scalene obtuse triangle $ABC$, where $AC$ is opposite the obtuse angle, and a point $D$ in $AC$ such that $AD = DC$ (a midpoint).
Then, construct line segment $BD$, subdividing the triangle. What I'm wondering about is whether the length of $BD$ is always, never, or only sometimes the same as the lengths $AD$? Are there any characteristics predictable about the subdivided triangles $ADB$ and $CDB$?

A: $BD$ is never the same as $AD$. In fact, if we drop the requirement of angle $B$ being obtuse, the condition $BD = AD$ is equivalent to the triangle being a right triangle at $B$.
The triangles $ADB$ and $CDB$ have the same base and height, hence the same area. Also, their angles at $D$ are supplementary.


text:
Q: Generate dynamic select lambda expressions I am somewhat new to expression trees and I just don't quite understand some things.
What I need to do is send in a list of values and select the columns for an entity from those values. So I would make a call something like this:
DATASTORE<Contact> dst = new DATASTORE<Contact>();//DATASTORE is implemented below.
List<string> lColumns = new List<string>() { "ID", "NAME" };//List of columns
dst.SelectColumns(lColumns);//Selection Command

I want that to be translated into code like this (Contact is an entity using the EF4):
Contact.Select(i => new Contact { ID = i.ID, NAME = i.NAME });

So let's say I have the following code:
public Class<t> DATASTORE where t : EntityObject
{
    public Expression<Func<t, t>> SelectColumns(List<string> columns)
    {
        ParameterExpression i = Expression.Parameter(typeof(t), "i");
        List<MemberBinding> bindings = new List<MemberBinding>();

        foreach (PropertyInfo propinfo in typeof(t).GetProperties(BindingFlags.Public | BindingFlags.Instance))
        {
            if (columns.Contains(propinfo.Name))
            {
                MemberBinding binding = Expression.Bind(propinfo, Expression.Property(i, propinfo.Name));
                bindings.Add(binding);
            }
        }

        Expression expMemberInit = Expression.MemberInit(Expression.New(typeof(t)), bindings);
        return Expression.Lambda<Func<t, t>>(expMemberInit, i);
    }

When I ran the above code I got the following error:

The entity or complex type 'Contact' cannot be constructed in a LINQ to Entities query.

I looked at the body of the query and it emitted the following code:
{i => new Contact() {ID = i.ID, NAME = i.NAME}}

I am pretty sure that I should be able to construct the a new entity because I wrote this line explicitly as a test to see if this could be done:
.Select(i => new Contact{ ID = i.ID, NAME = i.NAME })

This worked, but I need to construct the select dynamically.
I tried decompiling a straight query(first time I have looked at the low level code) and I can't quite translate it. The high level code that I entered is:
Expression<Func<Contact, Contact>> expression = z =>
                    new Contact { ID = z.ID, NAME = z.NAME };

Changing the framework used in the decompiler I get this code:
ParameterExpression expression2;
Expression<Func<Contact, Contact>> expression =
   Expression.Lambda<Func<Contact, Contact>>
      (Expression.MemberInit(Expression.New((ConstructorInfo) methodof(Contact..ctor),
         new Expression[0]), new MemberBinding[] { Expression.Bind((MethodInfo)
            methodof(Contact.set_ID), Expression.Property(expression2 = Expression.Parameter(typeof(Contact), "z"), (MethodInfo)
            methodof(Contact.get_ID))), Expression.Bind((MethodInfo)
            methodof(Contact.set_NAME), Expression.Property(expression2, (MethodInfo)
               methodof(Contact.get_NAME))) }), new ParameterExpression[] { expression2
        });

I have looked several places to try and understand this but I haven't quite gotten it yet. Can anyone help?
These are some places that I have looked:

*

*msdn blog -- This is exactly what I want to do but my decopiled code soes not have Expression.Call.

*msdn MemberInit

*msdn Expression Property

*stackoverflow EF only get specific columns -- This is close but this seems like it is doing the same thing as if i just use a select off of a query.

*stackoverflow lambda expressions to be used in select query -- The answer here is exactly what I want to do, I just don't understand how to translate the decompiled code to
C#.

A: When I did it last time I projected result to not mapped class (not entity) and it worked, everything else was the same as in your code. Are you sure that not dynamic query like .Select(i => new Contact{ ID = i.ID, NAME = i.NAME }) works?


text:
Q: Adding @Provider when using Spring with jersey We are working mainly with Spring application integrating jersey, we can add @Provider for Exception Providers and Filters (as ContainerRequestFilter)
Can adding @Provider cause problems while using Spring's initialization AnnotationConfigWebApplicationContext or it will be simply ignored?
I didn't find any @Provider in Spring with Jersey tutorial of @PaulSamsotha
I understand @Provider meaning, Currently we aren't using @Provider (and maybe have no reason to)

Marks an implementation of an extension interface that should be discoverable by JAX-RS runtime during a provider scanning phase.

Is @Provider redundant when using Spring managed beans?


text:
Q: How to Logout facebook and delete cookies I am using latest facebook SDK,I need to pop to root viewcontroller after successfully logout but when i login again its not actually logout from facebook.I need to delete cookies or need to do something else here is my code
in .m
- (void)viewDidLoad
 {

   self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]
                                          initWithTitle:@"Logout"
                                          style:UIBarButtonItemStyleBordered
                                          target:self
                                          action:@selector(logoutButtonWasPressed:)];

   [super viewDidLoad];

 }

 -(void)logoutButtonWasPressed:(id)sender
  {

    [FBSession.activeSession closeAndClearTokenInformation];

    [self.navigationController popViewControllerAnimated:YES];

  }

A: I think what you are wanting is the initial flow of Facebook popping up and asking for permission to do stuff etc...
This is not achieved by logging out.
You can only do this by logging in to FaceBook and going into App Settings and removing permissions from there.

A: If you want to delete cookie from UIWebView you may try this:
NSHTTPCookieStorage* cookies = [NSHTTPCookieStorage sharedHTTPCookieStorage];
        NSArray* facebookCookies = [cookies cookiesForURL:
                                    [NSURL URLWithString:@"http://login.facebook.com"]];
        for (NSHTTPCookie* cookie in facebookCookies) {
            [cookies deleteCookie:cookie];
        }

The cookie is saved in NSUserDefaults you can also clear cookie by clearing NSUserDefault data.
EDIT:
If you want to clear the cookie of safari from app then here is the answer:
"Mobile Safari's cookies are not accessible from SDK apps. And each SDK app is given its own WebKit cache and cookie stores, so while cookies will persist within the same app, they aren't accessible between apps".

A: Your code is correct. You log out using the closeAndClearTokenInformation method. If user used Safari to login with Facebook it may indeed keep the session cached. You can try removing the cookies in your logout method:
-(void)logoutButtonWasPressed:(id)sender
{
    [FBSession.activeSession closeAndClearTokenInformation];

    // Clear the cookies.
    for (NSHTTPCookie *cookie in [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies])
    {
        [storage deleteCookie:cookie];
    }

    [[NSUserDefaults standardUserDefaults] synchronize];

    [self.navigationController popViewControllerAnimated:YES];
}


text:
Q: How to get a specific value in Mongodb using Java? In command prompt I enter the following:
db.products.insert( { item: "card", qty: 15 } )

I wanted to know how would I be able to get the item value from java.
I want to create a variable called item and it would know the value of it which is "card".
I am currently using MongoOperations in java but I do not know how to get only one value from MongoDB.
Pojo
@Document(collection="products")
public class ValueServerModel{

    @Id
    private String id;

    String item;

    int qty;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getItem() {
        return item;
    }

    public void setItem(String item) {
        this.item = item;
    }

    public int getQty() {
        return qty;
    }

    public void setQty(int qty) {
        this.qty = qty;
    }

    public Product(String item, int qty) {
        //super();
        this.item = item;
        this.qty = qty;
    }

    @Override
    public String toString() {
        return "Product [id=" + id + ", item=" + item + ", qty=" + Integer.toString(qty) + "]";
    }

}

//provided by suwal

Long Shot Attempt
@Autowired
MongoOperations mongoOperations;

@PostConstruct
public List<SomeModel> getList() {
List<SomeModel> pmLst = mongoOperations.findAll(ServerModel.class);
//code above works I get a list of values based on mongo db

//attempting to retrieve one value, (stuck)
String value = mongoOperations.find("test", ValueServerModel.class);

With command prompt
I am able to get a value by using the following command:
db.products.find({}, {qty:0, _id:0})
//output ("item": "card")

I want to achieve the following:
db.products.find({}, {item})
//output should be "card".

is it possible to do what I just did above?

A: I get that you want to get the value, but you are not specifying based on what. That is "what is your query condition". Also not sure what ServerModel and ValueServerModel classes are, but let see if this general idea helps you.
Lets say you have following structure stored after your insert query in the collection products
{
    "_id" : ObjectId("5939d5a1d0ffa3f0209fd42f"),
    "item" : "card",
    "qty" : 15
}

You will need a model representing the collection,
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

@Document(collection="products") //this is what binds this class to your collection
public class Product {

    @Id
    private String id;

    String item;

    int qty;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getItem() {
        return item;
    }

    public void setItem(String item) {
        this.item = item;
    }

    public int getQty() {
        return qty;
    }

    public void setQty(int qty) {
        this.qty = qty;
    }

    public Product(String item, int qty) {
        //super();
        this.item = item;
        this.qty = qty;
    }

    @Override
    public String toString() {
        return "Product [id=" + id + ", item=" + item + ", qty=" + Integer.toString(qty) + "]";
    }

}

Now in your code you would have something like this,
// findOne returns you single instance of an object of the specified type
    Product product = mongoOperation.findOne(
            new Query(Criteria.where("item").is("card")), Product.class);

    System.out.println(product); //Output => Product [id=5939d5a1d0ffa3f0209fd42f, item=card, qty=15]

    String value = product.getItem();

    System.out.println("value is " + value);//Output => card

Lets say you want to get by id instead, so you would have something like this
Product product2 = mongoOperation.findOne(
            new Query(Criteria.where("_id").is("5939d5a1d0ffa3f0209fd42f")),
Product.class);

    System.out.println(product2);

A: You can use projection to request the fields.
Something like
Query query = new Query();
query.fields().include("item").exclude("_id");
Product product = mongoOperations.findOne(query, Product.class);

This will populate the product pojo with item field.
You can use native mongo java driver to request the fields directly.
Something like
MongoClient mongoClient = new MongoClient( "localhost" , 27017 );
MongoDatabase database = mongoClient.getDatabase(db_name);
MongoCollection<Document> collection = database.getCollection(collection_name);
String value  = collection.find().projection(Projections.include("item")).first().getString("item");


text:
Q: Bootstrap - Footer beng overlapped by main content Question background:
I'm pretty new to Bootstrap and have been developing a site as of late and have run into an issues with the content of my page 'overlapping' the footer at the bottom when the window is resized to a 'mobile' device resolution.
The issue:
The following picture shows a maximized screen with no overlap.

Re-sized screen, footer overlap:

HTML:
I have a 'master page' which holds the footer, each page implements this.

C#

Project1

                        @ViewBag.ProjectTwoInfo
                        Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.

Project1

                        @ViewBag.ProjectOneInfo
                        Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.

Project1

                        @ViewBag.ProjectOneInfo
                        Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.

EDIT:
Footer code:
<!DOCTYPE html>

<meta charset="utf-8" />
<meta name="author" content="Martin Bean" />
<link href="\Bootstrap\css\bootstrap.css" rel="stylesheet" />
<link href="\Bootstrap\css\bootstrap-responsive.css" rel="stylesheet" />
<link href="\Bootstrap\css\bootstrap-responsive.min.css" rel="stylesheet" />
<link href="\Bootstrap\css\bootstrap-social.css" rel="stylesheet" />
<link href="\CustomCSS\Footer.css" rel="stylesheet" />
<link href="\CustomCSS\HeroUnit.css" rel="stylesheet" />
<link href="\Bootstrap\FontAwesome\css\font-awesome.css" rel="stylesheet">
<link href="\Bootstrap\FontAwesome\css\font-awesome.min.css" rel="stylesheet">

<title>Twitter’s Bootstrap with Ryan Fait’s Sticky Footer</title>
<link rel="stylesheet" href="css/bootstrap.min.css" />

About

Contact

                        Projects

Proj1

Proj2

Proj3

@*
*@

            Software Developer@*
*@

        @RenderBody()

About Me

Projects

Contact Me

Any help resolving this issue would be great. Please note I would also want the 'grey' background div - that holds the 3 images to be responsive.

A: you have several HTML code issues, I did a clean-up and also simplified things a bit for demo purposes (you may adjust at will, of course).
The HTML part:

About

Contact

                        Projects

Proj1

Proj2

Proj3

Software Developer

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum imperdiet rutrum leo quis aliquam. Sed pretium efficitur enim at ultricies. Nullam ullamcorper porta risus, quis imperdiet eros rutrum sit amet. Nullam in nisl bibendum, dignissim arcu quis, consectetur turpis. Cras luctus egestas ligula. Suspendisse dignissim diam a augue egestas pharetra. Donec viverra eu velit ut pharetra. Nulla suscipit, ante eget venenatis cursus, nulla erat congue tellus, faucibus cursus orci lacus sit amet urna. Nulla facilisi. Duis commodo porttitor sem. In hac habitasse platea dictumst. Integer dui elit, rhoncus vitae tincidunt nec, scelerisque ac dolor. Integer at ligula eget ligula scelerisque volutpat eget quis lorem.

Praesent ac sapien sit amet magna sollicitudin vestibulum et nec erat. Quisque consectetur vel dui ac dapibus. Praesent at sapien tristique augue tincidunt auctor sed non justo. Fusce ac venenatis mauris. Quisque lobortis neque a eros hendrerit consectetur ac id magna. Mauris non velit ante. Nunc orci lorem, auctor a orci a, luctus sollicitudin turpis. Phasellus ornare tempus felis eu pharetra.

Integer eleifend, sapien eu molestie tristique, nunc felis varius tellus, at congue magna sapien ut tortor. Maecenas sodales ultricies ligula sollicitudin cursus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent laoreet odio ex, ut luctus tortor mollis sit amet. Aenean rutrum consequat lorem eget porta. Aliquam lacus enim, congue ac condimentum sit amet, consequat a diam. Duis eget mauris id nisi molestie vulputate sit amet vel nulla. Curabitur ac feugiat enim, eu rutrum magna.

Suspendisse sed lorem ac leo volutpat sodales. Pellentesque erat ex, tincidunt eu urna ac, gravida convallis eros. Phasellus nisl purus, egestas quis ipsum id, ornare pharetra tellus. Nullam congue leo ex, nec sagittis dolor tempor nec. Sed convallis sem risus, a congue leo feugiat non. Integer placerat dui eget lorem eleifend, a gravida tortor tempus. Vestibulum at est tempor sem sollicitudin hendrerit. Etiam vitae mauris eget sapien pharetra mattis a quis metus. Mauris facilisis sapien non fringilla scelerisque. Fusce a odio ultricies, rutrum nunc quis, faucibus quam.

Donec sed est vitae elit dignissim gravida. Vivamus blandit eros ex, vel placerat dui ornare in. Nullam feugiat risus lectus. Cras sagittis dolor vitae vulputate accumsan. Sed arcu massa, tempor vel massa nec, vehicula pellentesque tortor. Suspendisse fringilla eros risus, a scelerisque neque tempor ut. In et velit sapien. Etiam porttitor aliquam arcu, ut mollis augue rutrum feugiat.

 About Me
 Projects
 Contact Me

You had those
 elements before the footer's  and also an additional closing
 on all sections. With the HTML cleaned, CSS is as simple as this:
.links .floatLeft a {
    padding:30px;
    background:#fc0;
}
footer, .wrapper, .push {
    position:relative;
    clear:both;
    padding-top:20px;
}

See fiddle for complete code and preview


text:
Q: How to evaluate multiple OR'd conditions in COUNTIFS (or similar) row-by-row? Consider the following sample data.

A
B

1
2

8
4

2
1

3
7

4
8

Separately, the count of A that is less than 5 is =COUNTIF(A1:A5, "<5") -> 4, and that for B is =COUNTIF(B1:B5, "<5") -> 3.
I know if I want the count of rows where A and B are < 5, I can use COUNTIFS: =COUNTIFS(A1:A5, "<5", B1:B5, "<5") -> 2 because COUNTIFS evaluates conditions row-by-row. However, I can't figure out an elegant way to get the count of rows where A or B is < 5.
Using the sample data, the answer should be 5. So far I've tried:

*

*=COUNTIF(A1:A5, "<5") + COUNTIF(B1:B5, "<5") -> 7, because the cells aren't treated as rows. This just counts the number of cells <5.

*=SUM(IF(A1:A5 < 5, 1, 0), IF(B1:B5 < 5, 1, 0)) -> 7, does the same thing as the above.

*=SUM(IF(OR(A1:A5 < 5, B1:B5 < 5), 1, 0)) -> 1, because the cells are not treated as rows, and the OR returns just one value combining the results of each cell condition. Evaluates to 1 if any cell is <5, 0 if none are.

I have found one functioning solution which uses the addition theorem of probability (see my answer for that), but I'd like a way to do this that's easier to read and scale, if possible. How can I achieve this?

A: In Excel 365 you can use FILTER function:
=COUNT(FILTER(A1:A5,(A1:A5<5) + (B1:B5<5)))
separating conditions by * will act as AND, while separating them by + will work as OR.

A: Mathematically x OR y is equivalent to x + y >= 1 with x and y being boolean values. And in Excel to convert from bool to int we typically use --. So the either of the below will work
=SUM(--(IF(A1:A5 < 5, 1, 0) + IF(B1:B5 < 5, 1, 0) > 0))
=SUM(--(--(A1:A5 < 5) + --(B1:B5 < 5) > 0))

It can even be shortened to
=SUM(--(-(A1:A5 < 5) + -(B1:B5 < 5) < 0))
=SUM(--(-(A1:A5 < 5) - (B1:B5 < 5) < 0))

A: Not the prettiest solution and it gets very messy when you have more than two conditions, but one can use the addition theorem of probability P(A or B) = P(A) + P(B) - P(A and B) to calculate the requested count:

*

*=COUNTIF(A1:A5, "<5") + COUNTIF(B1:B5, "<5") - COUNTIFS(A1:A5, "<5", B1:B5, "<5") -> 5

A: If the columns in question are contiguous, then a more flexible and scalable solution is:
=SUMPRODUCT(N(MMULT(N(A1:B5<5),TRANSPOSE(COLUMN(A1:B5)))>0))

Or, for O365:
=SUM(N(MMULT(N(A1:B5<5),SEQUENCE(COLUMNS(A1:B5)))>0))


text:
Q: How to suppress shadow "index" warning? I maintain a cross-platform C codebase and on a few platforms (Xcode 4, Red Hat derived distros like Fedora and Mageia), I get the following compiler error:
warning: declaration of 'index' shadows a global declaration

Based on this answer, I understand that this is because some BSD-based C implementations define a non-standard index function in string.h which means that this warning shows up whenever I declare an index variable. I assure you that I do not have any global index variables.
I know I can avoid naming anything index but it's a semantically useful name so I end up using it all over the place. I know I can also suppress this warning, for example by using -Wno-shadow in GCC, but I'd rather not globally disable an otherwise useful compiler warning.
So how can I solve this problem? That is, is it somehow possible to detect if the platform has the index function and disable the warning there only, or how can I redefine it if it exists?

A: Check the header where index is declared, it may be wrapped in some #if or #ifdef that you may exploit to prevent it from being declared.
There may also be a compiler #pragma that you can use to disable the warning on the specific line it occurs. At least clang has this:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wshadow"
// code that produces warning
#pragma clang diagnostic pop

I think gcc has the same if you replace clang with GCC. Older versions may not support push, and I'm not sure if the switch for the warning is the same in both. If it works with #pragma GCC, clang should also recognise the #pragma so you don't need to duplicate.
For the record, I don't get this warning by including <string.h> and defining int index; on either Debian or OS X with clang or gcc using -Wshadow… Are you sure your index comes from <string.h>? On OS X with XCode 5 it is in <strings.h> (plural).

A: This was a GCC bug fixed in 4.8 branch

The option -Wshadow no longer warns if a declaration shadows a function declaration, unless the former declares a function or pointer to function, because this is a common and valid case in real-world code.

This is no longer a problem in Mageia 4 (GCC 4.8.2) or Fedora 19 (GCC 4.8.1) and 20 (GCC 4.8.2) but I don't know any clean solution to avoid the warning apart from changing the variable name, maybe to something more specific.


text:
Q: Integrate $\frac{x^2}{\sqrt{16-x^2}}$ using trig substitution During our integration of the following integral, using $x = 4 \sin \theta$
$$\int \frac{x^2}{\sqrt{16-x^2}} dx$$
We eventually come to the following point:
$$\int \frac{16 {\sin ^2 \theta} }{4 \sqrt{\cos ^2 \theta}} dx$$
At this point, we say that $\sqrt{\cos ^2 \theta} = \cos \theta$ and then complete the integral
But doesn't $\sqrt{\cos ^2 \theta} = |\cos \theta|$
What is going on?

A: I advise you to never forget dx in integration. Let us reconsider your calculations:
$$\int \frac{x^2}{\sqrt{16-x^2}}dx$$
You take $x=4\sin\theta$. By taking the substitution, you also have to rewrite $dx$. $dx=d(4\sin\theta)=4\cos \theta d\theta$. After substituting, you get:
$$\int\frac{16 \sin^2 \theta}{4 \sqrt{\cos^2 \theta}}4\cos\theta d\theta$$
After this, it is quite easy to finish the calculation

A: Let $$\displaystyle I = \int\frac{x^2}{\sqrt{16-x^2}}dx\;,$$ Let $x=4\sin \phi\;,$ Then $dx = 4\cos \phi d\phi$
So Integral $$\displaystyle I = \int\frac{16\sin^2 \phi}{4|\cos \phi|}\cdot 4\cos \phi d\phi = \pm 8\int 2\sin^2 \phi d \phi$$
Now Using $\bullet\; 2\sin^2 \phi = 1-\cos 2\phi$ and $\bullet\; \sin 2\phi = 2\sin \phi\cdot \cos \phi.$
so we get $$\displaystyle I = \pm 8\int (1-\cos 2\phi)d\phi = \pm 8\left[\phi-\frac{\sin 2\phi}{2}\right]+\mathcal{C} = \pm 8\left[\phi-\sin \phi \cdot \cos \phi\right]+\mathcal{C}$$
So we get $$\displaystyle I =\pm 8\left[\sin^{-1}\left(\frac{x}{4}\right)-\frac{x\sqrt{16-x^2}}{16}\right]+\mathcal{C} $$


text:
Q: MVC ASP.NET Share Controller Between Two Views I have two different views that share the functionality of a single controller. The only difference is that when an action is called from the view, the controller needs to return the proper view.
How should I go about implementing such a thing?
Thanks.

A: I think you need to use model property at returning time from controller to view within if statements....
 After Your Code Executed in controller..
Yourmodel modelObj= new Yourmodel ();
.// first condition for first view
.
.
modelObj.Message="1" //for first view code
.
if(modelObj.Message=="1")
{
return redirectToAction("yourView","Controller");
}
else
{
 return redirectToAction("yourView-2","Controller");
}


text:
Q: How can I delete both the user and their post at the same time in my Flask App In my head this is supposed to be easy but it's challenging me a little bit. I am trying to delete a user along with their post on a blog. However, I am not having much success with this.
Here is my deleted user route:

@views.route('/deleteuser/<id>')
@login_required
def deleteuser(id):
   user = User.query.get_or_404(id)
   try:
        db.session.delete(user)

   except:
        db.session.delete(user)
    db.session.commit()
    flash ('The user was successfully deleted', 'success')
    return redirect (url_for('views.users'))

Here is my delete post Id:
@views.route('/delete/<id>')
@login_required
def delete(id):
   post = Post.query.get_or_404(id)
   try:
        os.unlink(os.path.join(current_app.root_path,'static/assets/images/' + post.image))
        db.session.delete(post)
    except:
        db.session.delete(post)
db.session.commit()
flash ('Post deleted succesfully', 'success')
return redirect (url_for('views.dashboard'

Is there a way I can deleted the user along with the post?
Again, I am still new to this so please be kind.

A: What you would need, is a "one-to-many relationship".
When you want to delete the user, simply go ahead and do a cascade delete and voila! both the user and his/her related post(s) would be deleted.
I am assuming that you don't know about one-to-many realtionship. If you know and only want to know about the deletion process, take a look at STEP (4).
Anyways, Consider the following procedures to create a one-to-many relationship in flask-sqlalchemy and how to perform a cascade deletion:
To start off with, I have a User and Post model like so:
class User(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
            ...
            ...

class Post(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
            ...
            ...

Now, its time to decide a relationship. Logically, one user can create many posts, right? So the most apt relationship would be to use one-to-many relationship. Let's go ahead and implement that:
1) Declare the relation from the User Model : Since its the Users who write the Posts, we must begin declaring relations from the User's side (conveniently and logically correct). Just add this line inside the User model:
class User(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
            ...
            ...
    posts = db.relationship('Post', backref='written_by')

Let's break this down a little bit. posts here, is a pseudo-column, which means this column does not exist in the User model. Its only there to create a relationship. 'Post' is the name of the model we want to attach the relationship with. In our case, its the Post model. Finally, backref is used to refer back to the User model. We will take a look at this, shortly.
2) Create a user_id column in Post : To access the columns of User from Post, we must have a ForeignKey of id from User. Let's declare that.  Just add this line in the Post model:
class Post(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
            ...
            ...
    user_id = db.Column(db.Integer, db.ForeginKey('user.id'))

Lets see what this line does. This code simply creates a column called user_id which contains the id form User model. Please note that here, 'user.id' is actually referring to id from User model and writing 'User.id' instead will return error. Flask-Sqlalchemy has such syntactical irregularities. Stay frosty!
3) Insert the data : I am going to insert some data into User model. It is a straight-forward process and I believe you know this as well. I am going to add dummy data through my python shell (assume that I have a required column called username, for convenience):
>>> user1 = User(username='John', .., ...)
>>> user2 = User(username='Joe', .., ...)
>>> db.session.add_all([user1, user2])
>>> db.session.commit()

Now, let me add some posts. Lets imaging that user1 has written 2 posts while user2 has only written 1 post.
>>> post1 = Post(title='I like Python',.., .., written_by=user1)
>>> post2 = Post(title='I like C',.., .., written_by=user1)
>>> post3 = Post(title='Redis, Really?',.., .., written_by=user2)
>>> db.session.add_all([post1, post2, post3])
>>> db.session.commit()

Carefully observe couple of things here. While inserting the data into Post model, we pass in the required columns and then, finally we make use of the backref to assign this post to the respective user (since this is a one-to-many model). backref accepts object / instance. Now, remember that we have declared the backref as written_by and that we have already created the user1 instance. This is the justification of written_by=user1 in the above code.
[OPTIONAL]
Our relationship is crafted and the tables are ready! If you type in the following, you should get the following results:
>>> post1.written_by.username  # testing backref
'John'

>>> post3.written_by.username  # testing backref
'Joe'

>>> user1.posts   # should return us the list of post objects written by user1
[<Post object>, <Post object>]

>>> user1.posts[0].title
'I like Python'

4) Cascade Deletion : Now, in order to delete a user and its corresponding posts, all you have to do is add cascade='all, delete' in the User relationship:
class User(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
            ...
            ...
    posts = db.relationship('Post', backref='written_by', cascade='all, delete') # <--- edit here

Now, lets go ahead and delete the user John. This should delete all his written posts as well:
>>> delete_user = User.query.filter_by(username='John').first()
>>> db.session.delete(delete_user)
>>> db.session.commit()

NOTE: If you tried to delete any of the posts instead of the user, then only that post will be deleted and the user would still exist.
So, long story short: You need to use a one-to-many realtionship and then use a cascade deletion from the table where you have declared relationship.


text:
Q: Windows Server 2003 Hacked - Files Being Uploaded Blank directories are being created on my Windows Server 2003 virtual server with sub directories that are weird (for example: "88ÿ ÿ ÿÿþþ þþ13þ").  It looks like they are uploading bootlegged DVDs and pirated software.  All of my bandwidth and file space is being eaten up.
Could this be a shared permissions issue?  Where should I look to further investigate this?
My security permissions for the directory that is being hit are as followed:
Administrators - ALL GRANTED
IIS_WPG - Read & Execute, List Folder Contents, Read
Internet Guest - DENY
SYSTEM - ALL GRANTED
Users - Read & Execute, List Folder Contents, Read
My Event Viewer is showing many Logon/Logoff with NO IP?

A: Sounds bad, and unfortunately the only safe course of action is pretty drastic:

*

*take the server off the network, wipe it, and rebuild it.

Hopefully you have sufficient backups...  If you don't have everything you need backed up, you could add another step in there where you cautiously copy data files off - I wouldn't really trust anything except text files.

A: Please more info - where are those folders? C:\? Or in a subfolder of an isolated subsystem? I had a similar case once on a FTP folder (totally isolated) where I accidentally llowed everyone to upload files. Just closed the hole.
If that is, though, in a system / executable folder (website), take the server down, reinstall.

A: The C:\Inetpub\wwwroot\ is the directory that is being compromised.  All I did was create a website with IIS (no software installed).  I then enabled file permissions for the website to allow uploads for all of the websites on C:\Inetpub\wwwroot.  Permission details are showed in original question above.
As for FTP, Security Accounts are the following:
ALLOW ANONYMOUS CONNECTIONS IS CHECKED
Username: computer username
Passord: set pw
The ALLOW ONLY ANONYMOUS CONNECTIONS is not checked.
NOTE: If I uncheck 'ALLOW ANONYMOUS CONNECTIONS', I am prompted with a warning 'The authentication option you have selected results in passwords being transmitted over the network without data encryption.  Someone attempting to compromise your system security could use a protocol analyzer to examine user passwords during the autehntication process.  For more detail on user authentication...'  So, I did not continue with this setting.
Is this the problem?

A: I feel so stupid.... My FTP was allowing anonymous users to access and execute files!! Be sure to uncheck Allow anonymous connections.  When you uncheck it, it warns, 'The authentication option you have selected results in passwords being transmitted over the network without data encryption. Someone attempting to compromise your system security could use a protocol analyzer to examine user passwords during the autehntication process. For more detail on user authentication...'
I guess I need to setup a SSL for the FTP.


text:
Q: Underscore.js .filter() and .any() I have an array of event objects called events. Each event has markets, an array containing market objects. Inside here there is another array called outcomes, containing outcome objects.
In this question, I asked for a [Underscore.js] way to find all of the events which have markets which have outcomes which have a property named test. The answer was:
// filter where condition is true
_.filter(events, function(evt) {

    // return true where condition is true for any market
    return _.any(evt.markets, function(mkt) {

        // return true where any outcome has a "test" property defined
        return _.any(mkt.outcomes, function(outc) {
            return outc.test !== "undefined" && outc.test !== "bar";
        });
    });
});

This works great, but I'm wondering how I would alter it if I wanted to filter the outcomes for each market, so that market.outcomes only stored outcomes that were equal to bar. Currently, this is just giving me markets which have outcomes which have some set test properties. I want to strip out the ones that do not.

A: Make it a simple loop, using the splice method for the array removals:
var events = [{markets:[{outcomes:[{test:x},...]},...]},...];
for (var i=0; i<events.length; i++) {
    var mrks = events[i].markets;
    for (var j=0; j<mrks.length; j++) {
        var otcs = mrks[j].outcomes;
        for (var k=0; k<otcs.length; k++) {
            if (! ("test" in otcs[k]))
                 otcs.splice(k--, 1); // remove the outcome from the array
        }
        if (otcs.length == 0)
            mrks.splice(j--, 1); // remove the market from the array
    }
    if (mrks.length == 0)
        events.splice(i--, 1); // remove the event from the array
}

This code will remove all outcomes that have no test property, all empty markets and all empty events from the events array.
An Underscore version might look like that:
events = _.filter(events, function(evt) {
    evt.markets = _.filter(evt.markets, function(mkt) {
        mkt.outcomes = _.filter(mkt.outcomes, function(otc) {
            return "test" in otc;
        });
        return mkt.outcomes.length > 0;
    });
    return evt.markets.length > 0;
});


text:
Q: Migrate sharepoint contents without changing ID orders How to transfer sharepoint lists, contents between all versions of sharepoint without changing ID orders ?
I tried sharegate, avepoint, dell migration suite for sharepoint etc. but they couldnt work. I just preserved ID in another custom columns with these tools.
So any ideas would we welcome,
Best Regards,
Emre

A: Metalogix Content Matrix can preserve Item Ids.  They have a free trial so you can make sure it fits your needs.