text:
Q: SQL Query Codeigniter Query Builder PHP I need to query the database where the total_pago must equal the valor in the table contas_pagar
class Phpexcel_model extends CI_Model {

function get_users() {

    $query = $this->db->get_where("contas_pagar", array('total_pago' == 'valor'));

    return $query->result_array();

}

Database image
As the image the result should bring only the data that match the query, but it is bringing all the data from the table

A: According to the docs (https://codeigniter.com/userguide3/database/query_builder.html#selecting-data) you want the following (note == vs =>):
->get_where('contas_pagar', array('total_pago' => 'valor'))

What you have now is evaluating to
->get_where('contas_pagar', array(false))

because in PHP the string 'total_pago' is not equal to 'valor'.

A: Assuming the total_pago is a numeric field and valor is a variable that contains a number, your get_where statement should be:
->get_where('contas_pagar', array('total_pago' => $valor))

A: you can use this to inspect your query. so that we can see the whole query that is executed by the mysq/sql and so that we can check where the error occur
echo $this->db->last_query()

also alternatively you can use the custom query
$this->db->query('SELECT * FROM contas_pagar WERE total_pago=? ',[$valor])->result_array()

A: function get_users() {

    $query = $this->db->get_where("contas_pagar", array('total_pago' => 'valor'));

    return $query->result_array();

}


text:
Q: JSF managed property across multiple beans I have one bean called LoadSelectItemsBean which is @ApplicationScoped and holds various select item lists which I want to be shared amongst all users of the system.
I would like this LoadSelectItemsBean bean to be a @ManagedProperty in two other beans. When I added the select item bean into another bean as a managed property it works fine (shown in following code snippet):
@RequestScoped
@ManagedBean
public class GeneralCarrierDataViewBean implements Serializable {

    private static final long serialVersionUID = 1L;
    @ManagedProperty(value = "#{loadSelectItemsBean}")
    private LoadSelectItemsBean selectItems;

However, when I try to add the select items bean as managed property in another bean, I start to experience problems. I use the same code in my AllianceViewBean:
@RequestScoped
@ManagedBean
public class AllianceViewBean implements Serializable {

    private static final long serialVersionUID = 1L;
    @ManagedProperty(value = "#{loadSelectItemsBean}")
    private LoadSelectItemsBean selectItems;

But when trying to load the application I receive the exception
com.sun.faces.mgbean.ManagedBeanPreProcessingException: Unexpected error processing managed property selectItems

My question is, can you declare one bean as a managed property in more than one other bean?
Thanks.
EDIT: My error has been solved, but I am still no closer to identifying why it could have originally occurred

redpajama_set_name: RedPajamaStackExchange


text:
Q: Reason for red curly brackets in editor? I am writing a script, and I get an error (red curly brackets)
Making the slight change in the code which as far as I know, shouldn't result in an error.
I am checking it over and over for hours and I can't figure it out.
the error appears on the last brackets (The one that ends the function)
And sometimes with the brackets before that too.
Here's the code:
function detectTraining() {

  logs.getRange(1,2,20).clear();
// Loop through Trainees
  for (a = 0; a < TraineesResultsData.length; a++){
    Logger.log("Trainee num " + (a+1))
    /////////////////////////////////
    // Results Declatations
    let mailR = TraineesResultsData[a][0]
    let NameR = TraineesResultsData[a][1]
    let Mass_FitR = TraineesResultsData[a][2]
    let TrainingPlanR = TraineesResultsData[a][3]
    let ExperienceR = TraineesResultsData[a][5]
    let GymR = TraineesResultsData[a][6]
    let BodyWeightOnlyR = TraineesResultsData[a][7]
    let PullUpR = TraineesResultsData[a][8]
    let MakbilimR = TraineesResultsData[a][9]
    let StrapsR = TraineesResultsData[a][10]
    let RubberBandsR = TraineesResultsData[a][11]
    let WeightsR = TraineesResultsData[a][12]
    let ParkR = TraineesResultsData[a][13]
    let TimesAweekR = String(TraineesResultsData[a][14])
    let PhysicalProblem = TraineesResultsData[a][15]

    // If trainee don't have training
    if (TrainingPlanR) {
      logs.getRange(a+1,2).setValue("Trainee Do have a training");
    }
    else {
      // if trainee have a physical problem
      if(PhysicalProblem) {
        logs.getRange(a+1,2).setValue("Physical Problem - Loop Stopped ");
      }
      else {
        // if trainee is a begineer
        if (ExperienceR){
          logs.getRange(a+1,2).setValue("Trainee is a beginner ");
          // if trains in a gym
          if(GymR) {
            logs.getRange(a+1,3).setValue("Trains in Gym " + TimesAweekR + " a week");

            // search results in trainingKeys
            for(t = 0; t < TrainingKeysData.length; t++) {
              /////////////////////////////////
              // Keys Declatations
              let experienceK = TrainingKeysData[t][0];
              let Mass_FitK = TrainingKeysData[t][1];
              let BodyWeightOnlyK = TrainingKeysData[t][2];
              let PullUpsK = TrainingKeysData[t][3];
              let MakbilimK = TrainingKeysData[t][4];
              let StrapsK = TrainingKeysData[t][5];
              let RubberBandsK = TrainingKeysData[t][6];
              let WeightsK = TrainingKeysData[t][7];
              let ParkK = TrainingKeysData[t][8];
              let GymK = TrainingKeysData[t][9];
              let TimesAweekK = String(TrainingKeysData[t][10]);
              let TrainingResultsCt = TrainingKeysData[t][16];

              if(experienceK && GymK && TimesAweekK.includes(TimesAweekR)) {
                // If there's more than 1 option of training
                Logger.log("Found row");
                if(TrainingResultsCt > 1){
                  Logger.log("More than 1 results")
                  let Rand = Math.floor(Math.random()*TrainingResultsCt);
                  Logger.log("Rand: "+Rand)
                  let resultsArea = TrainingKeys.getRange(t+2, 13, 1,TrainingResultsCt).getValues();
                  Logger.log(resultsArea)
                  let TrainingNum = resultsArea[0][Rand]
                  logs.getRange(a+1,4).setValue(TrainingNum)

                }
                // if there's only 1 training option.
                else {
                  Logger.log("1 result")
                  TrainingNum = TrainingKeysData[t][12];
                  logs.getRange(a+1,4).setValue(TrainingNum)
                }
                ////////////////////////
                //Done Beginner in Gym//
                ////////////////////////
              }
            }
          }
          // if not in Gym
          else if (!GymR) {
            logs.getRange(a+1,3).setValue("Do not Trains in Gym " + TimesAweekR + " a week");
            if (TraineesResultsData[a][12]) {

              if (PullUpsK || MakbilimK || StrapsK || RubberBandsK) {
                Logger.log("We can combinate Weights");
              }
              else {Logger.log("He has only weights")} // The line in question
            }
          }
        }
      }
    }
  }
}

And here's the one with the error:
The only change is in the end when I added another row for the "else" curly brackets.
There was other if's and for's I tried to do, but every time I am adding anything to the code, it results in an error.

A: It's a bug
It has already been reported on Google's  Public Issue Tracker - see here and here.
It seems to occur when the code is longer than 100 lines (hence the line break makes a difference!).
It seems like it is already being worked on. Also, keep in mind that the new Apps Script IDE is coming out soon, the bug should not appear there.


text:
Q: Error here TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type object Hi I am trying to upload a base 64 file from NodeJs to firebase storage(google cloud storage) using the below given code. But I am getting an error stating

Error here TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must
be of type string. Received type object at validateString
(internal/validators.js:125:11)

the code is:
const key = require('../key.json');
const {Storage} = require('@google-cloud/storage');
//var gcs = require('@google-cloud/storage');
exports.uploadVideo = functions.https.onRequest((req, res) => {

    const gcs =new Storage({
        projectId: "<my-project-id>",
        keyFilename: key
      });

      const bucket = gcs.bucket("example.appspot.com");
      const gcsname = 'test.pdf';
      const file = bucket.file(gcsname);
      var pdfdata = "xNC9YUmVmU3RtIDE1NzQ+Pg0Kc3RhcnR4cmVmDQoyMTY5DQolJUVPRg==";
      var buff = Buffer.from(pdfdata, 'binary').toString('utf-8');
      const stream = file.createWriteStream({
        metadata: {
          contentType: 'application/pdf'
        }
      });

      stream.on('error', (err) => {
        console.log("Error here",err);
      });
      stream.on('finish', () => {
        console.log(gcsname);
      });
      stream.end(new Buffer.from(buff, 'base64'));})

Can someone suggest me a way out? I can't understand the problem.
Thanks

A: It means that the program is expecting the path argument to of be type string, example: "path/to/whatever". And you're giving it an object - example: { path: "path/to/whatever" }

A: As the error said "TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined"
It trying to grab from path, which you should add those variables into your .env file to the root when looking for path ..it will grab the right variables. Let me know if you still have difficulties..
You can refer to Express Routing with Google Cloud Functions for more details informations.

A: This will be fixed if you are using "react-scripts" "^3.x.x" replace it to "^3.4.1" version or latest one.
Please make sure you deleted the node_modules folder before npm/yarn install


text:
Q: i want to increase cart quantity php every time add to cart is clicked. I checked few provided solutions but none of them worked <?php
session_start();
if (isset($_GET) & !empty($_GET)) {
    $id = $_GET['id'];
    $url = $_GET['sourceurl'];
if (isset($_GET['quant']) & !empty($_GET['quant'])) {
    $quant = $_GET['quant'];
} else {
    $quant = 1;
}
$_SESSION['cart'][$id] = array("quantity" => $quant);
//header('location:' . $url);
//header('location:index.php?message=1');
} else {
//header('location:' . $url);
}
echo "<pre>";
print_r($_SESSION['cart']);
echo "</pre>";

I have common php page addtocart.php to add product directly to cart from homepage and also from single.php where user can add quantity. If quantity is not given(i.e adding to cart from index page) quantity is directly set to 1. Here I want to increase quanity every time user clicks on addtocart. Above is the code of addtocart.php

A: Replace $_SESSION['cart'][$id] = array("quantity" => $quant); for this oneliner.
$_SESSION['cart'][$id]['quantity'] = ((isset($_SESSION['cart'][$id]['quantity'])) && ($_SESSION['cart'][$id]['quantity'] > 0)) ? ++$_SESSION['cart'][$id]['quantity'] : $quant;


text:
Q: Webpage is more than 100% width i'ven been search in stackoverflow about this problem, but still stuck. I don't get it how it works, because i'm still very beginner in HTML and CSS language. I couldn't find how to fix this, and its still more than 100% width...
Any solutions or advices is very apreciated :))) Thank youu.
Here's my HTML Code :

@import url('https://fonts.googleapis.com/css?family=Playfair+Display&display=swap');

* {
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-font-feature-settings: auto;
    font-feature-settings: auto;
    -webkit-font-kerning: auto;
    font-kerning: auto;
    line-height: 40.677px;
    line-height: 2.54237rem;

}
html, body{
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;

}
body{
    display: flex; /* or css grid for more intricate layouts */
    flex-direction: column;
    margin: 0;
    padding: 0;
    min-width: fit-content;
}

.content1 {
    width: 100vw;
    height: 900px;
    min-height: fit-content;
    max-height: 100%;
    padding: 0%;
    position: absolute;
    top: 0;
    left: 0;
    margin: 0 auto;
    background: #255F63;

}
.content2{

position: absolute;
height: 1000px;
left: 0px;
top: 900px;

background: #DB7B65;
}
.content3{

    position: absolute;
    height: 1942px;
    left: 0px;
    top: 1900px;

    background: #ECB865;
}
.container1-content3{

position: absolute;
height: 1063px;
left: 0px;
top: 1px;

background: #ECB865;
}
.container1-content3>.headline{

    position: absolute;
    width: 434.89px;
    height: 72.61px;
    left: 205.93px;
    top: 167.52px;

    font-family: Playfair Display;
    font-style: normal;
    font-weight: bold;
    font-size: 48px;
    line-height: 64px;
    text-align: center;

    color: #DB7B65;

}
.container1-content3>h2{
    position: absolute;
width: 1233px;
height: 143px;
left: 107px;
top: 863px;

font-family: Playfair Display;
font-style: normal;
font-weight: bold;
font-size: 36px;
line-height: 48px;
text-align: justify;

color: #E5E5E5;

}
.container2-content3{

position: absolute;
height: 878px;
left: 0px;
top: 1064px;
}
.content4{

    position: absolute;
    height: 1038px;
    left: 0px;
    top: 3842px;

    background: #695356;
}
.headline1> h1{
    position: absolute;
width: 708px;
height: 192px;
left: 154px;
top: 190px;

font-family: Playfair Display;
font-style: normal;
font-weight: bold;
font-size: 72px;
line-height: 96px;

color: #ECB865;
}
.headline1>h2{

position: absolute;
width: 489px;
height: 128px;
left: 154px;
top: 382px;

font-family: Playfair Display;
font-style: normal;
font-weight: normal;
font-size: 48px;
line-height: 64px;

color: #FBC9BE;

}

.headline2>h1{

    position: absolute;
    width: 387px;
    height: 96px;
    left: 137px;
    top: 207px;

    font-family: Playfair Display;
    font-style: normal;
    font-weight: bold;
    font-size: 72px;
    line-height: 96px;
    /* identical to box height */

    color: #FBC9BE;

    }
    .headline2>h2{
        position: absolute;
    width: 531px;
    height: 64px;
    left: 137px;
    top: 303px;

    font-family: Playfair Display;
    font-style: normal;
    font-weight: normal;
    font-size: 48px;
    line-height: 64px;
    /* identical to box height */

    color: #ECB865;

    }
    .headline2>h3{

    position: absolute;
    width: 657px;
    height: 192px;
    left: 137px;
    top: 441px;

    font-family: Playfair Display;
    font-style: normal;
    font-weight: normal;
    font-size: 36px;
    line-height: 48px;
    text-align: justify;

    color: #E5E5E5;
    }
    .headline2>h4{
        position: absolute;
    width: 340px;
    height: 24px;
    left: 137px;
    top: 697px;

    font-family: Playfair Display;
    font-style: normal;
    font-weight: bold;
    font-size: 18px;
    line-height: 24px;
    /* identical to box height */

    font-variant: small-caps;

    color: #E5E5E5;
    }
    .headline3{

position: absolute;
width: 1248px;
height: 210px;
left: 95px;
top: 56px;

    }
    .headline3>h1{
        position: absolute;
        width: 489px;
        height: 96px;
        left: 475px;
        top: 56px;

        font-family: Playfair Display;
        font-style: normal;
        font-weight: bold;
        font-size: 72px;
        line-height: 96px;
        /* identical to box height */

        color: #ECB865;

    }
    .headline3>h2{

position: absolute;
width: 1248px;
height: 95px;
left: 95px;
top: 171px;

font-family: Playfair Display;
font-style: normal;
font-weight: normal;
font-size: 36px;
line-height: 48px;
text-align: center;

color: #E5E5E5;

    }
    .headline3b{

position: absolute;
width: 460px;
height: 48px;
left: 474px;
top: 305px;

    }
    .headline3b>.btn-learn{
        position: absolute;
width: 194px;
height: 48px;
left: 474px;
top: 305px;

font-family: Playfair Display;
font-style: normal;
font-weight: bold;
font-size: 36px;
line-height: 48px;
/* identical to box height */

text-align: justify;

color: #ECB865;

    }
    .headline3b>.btn-shop{

position: absolute;
width: 164px;
height: 48px;
left: 770px;
top: 305px;

font-family: Playfair Display;
font-style: normal;
font-weight: bold;
font-size: 36px;
line-height: 48px;
/* identical to box height */

text-align: justify;

color: #ECB865;

    }
    /*# sourceMappingURL=styles.css.map */
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Welcome</title>
    <link rel="stylesheet" href="styles.css">

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/uikit@3.3.7/dist/css/uikit.min.css" />

Let's see,
                What fucking happen

in the world that never
                    we see before

Seventeen -

wear something you love

                Jadi gini gais, kita adalah faishionistha yang kecebadai dan terkenal gile banget anjir. Bisa nih jadi referensi buat kamu yang lagi bosen sama lo pada anjay!

                a girl sitting on chair - 24-03-2020

                Simple yet pretty.

                Jadi gini gais, kita adalah faishionistha yang kecebadai dan terkenal gile banget anjir. Bisa nih jadi referensi buat kamu yang lagi bosen sama lo pada anjay!

pre-order now

Jadi gini gais, kita adalah faishionistha yang kecebadai dan terkenal gile banget anjir.

                Learn More
                Shop Now

A: You need to add the following to your body tag css:
overflow-x: hidden;


text:
Q: Spring Integration with Eclipse Luna
I just started Spring tutorial.I am using eclipse luna 4.4.2
I have successfully integrated STS suite with my eclipse.My Problem is I cant see Spring tab in perspective ...It may sounds silly...bear me plz

A: I think these links can help:
Spring perspective is not showing in eclipse
https://dzone.com/articles/springide-using-spring-eclipse


text:
Q: Cannot Load fontFamily:FontAwesome in reactnative I'm build app running in react native metro builder but not running because font family font awesome not sync can help me
problem load is : console error : "fontFamily:FontAwesome" is not a system font in reactnative

A: i am using the fontawesome 5.7.0
just add on your package dependencies:
"react-native-fontawesome": "^5.7.0",

re-install using yarn
yarn install

put the font files on folder
android > app > src > main > assets > fonts

files:
fontawesome-webfont.ttf
FontAwesome.otf

and you can use it on your project:
example:
import FontAwesome, { Icons } from 'react-native-fontawesome';
...
render() {
   return (
       <FontAwesome>{Icons.close}</FontAwesome>
   );
}


text:
Q: Add event listener to all document children by tag name I need to translate this jquery to vanilla js:
$(document).on('click', 'a', function(){
    //do something
});

I've tried with
document.addEventListener('click', function(e) {
    if(e.target.tagName === 'A')
    {
        //do something
    }
});

But it's not working if the element clicked is a child of an a, for example

I can't use document.getElementsByTagName('a'), because It should work even with those created dynamically.
Also, I'd need to access the href property of the a.
What is the simplest way to do this?

A: In modern browsers you can use Element.closest() - Not supported in IE

document.addEventListener('click', function(e) {
  e.preventDefault();
  if (Element.prototype.closest) {
    if (e.target.closest('a')) {
      console.log('found')
    }
  } else {
    //else the long way
    var el = e.target;
    while (el && el.tagName != 'A') {
      el = el.parentNode;
    }
    if (el) {
      console.log('found')
    }
  }
});

  This and image

Not here

A: Take the DOM for a Walk
You have a anchor tag that contains an image and you want catch click events.
The currentTarget property (as suggested in a comment) is not useful since the handler is attached to document, i.e., currentTarget = document.
The solution is to catch clicks on the image and then walk up the DOM tree to check if the parent element is an anchor tag.
The code below illustrates how you might accomplish this check using a while loop.  It also displays target, currentTarget, and parentElement. As you can see, clicking on the text within the link produces different output than clicking on the image.
Run the snippet to try

document.addEventListener('click', function(e) {
  var t = e.target;
  while (t) {
    if (t.tagName === 'A') {

      // do something ...

      debug.innerHTML += (
        'target = ' + e.target +
        '\ncurrentTarget = ' + e.currentTarget +
        '\nparentElement.tagName = ' + t.tagName + '\n'
      );

      break;
    }
    t = t.parentElement;
  }

});

// dynamically add link with image
var a = document.createElement('A');
a.href = 'javascript:void(0)';
a.innerHTML = 'Click Me!
';
document.getElementById('content').appendChild(a);
img {width:100px;height:50px;background-color:aliceblue;}

<xmp id="debug"></xmp>


text:
Q: jQuery mobile get data from remote server with PHP My problem is:
I have mobile application using jquery+jquery mobile+phonegap. In this app I have several pages with forms. I want to submit this forms to remote server where is php file for handling variables and it return simple text as output. My big problem is that I don't know how get this data in my application without redirecting to Android browser. I search over internet and I can't find how figure it out

A: This sounds like you should be making an ajax request from jquery to the php file that handles the request and will return the appropriate response. Take a look at the jquery documentation to see how to make an ajax request, where the url field is the url of the php file and the data field is the variables you want to pass to the php file.
http://api.jquery.com/jQuery.ajax/


text:
Q: How do I get the Block Header Size in Oracle? I'm trying to calculate the size of a few tables as stated here, but I can't find the block header size variable
How do I get it? Is it some kind of formula?
I'm using Oracle 10g

A: This site has a good discussion on the format of the block header: http://www.adp-gmbh.ch/ora/concepts/db_block.html.  Basically the block header = fixed header + transaction header + table directory + row directory.  Here are the individual pieces:
fixed header = 57 bytes
transaction header = between 23*inittrans and 23*maxtrans
table directory = 4*number of tables (usually 1 unless you're using clusters)
row directory = 2*stored rows
In short while you can come up with a rough estimate, it's not a fixed size for each data block.

A: This page (for 10g) says it's 57 bytes.


text:
Q: SignalR start pending I'm working on chat plugn within my ASP.NET MVC application.
Everything works as expected when there are only two users (different browsers). When third user logs in, his SignalR start request is pending, and other users can not use application anymore.
It seems that SignalR allows only two users to connect.
OnConnected method in hub is never called for third user.

Can someone help me?


text:
Q: Every compact manifold is geodesically complete An $n$-dimensional Riemannian manifold $(M,g)$ is said to be geodesically complete if every geodesic $\gamma:(-\varepsilon,\varepsilon) \to M$ can be extended to a geodesic $\widetilde{\gamma}:\mathbb{R}\to M$ defined on the whole real line. There is a theorem stating that every compact manifold is geodesically complete. Can anyone provide me with a material about this theorem so that I can prove it ?.
Is the metric $g$ related to the proof?.

A: This is just a sketch of how you could prove this directly:
Let $\gamma:I\to M$ be a geodesic. Assume, for the sake of contradiction, that the maximal domain of existence is not all of $\mathbf{R}$. Say $I=(a,b)$ for some $a,b\in\mathbf{R}$. Now consider what happens to $\gamma(t)$ in the limit as $t\to b$. If $\gamma(t)$ stays in some compact set $K$ as $t\to b$, take a sequence $t_n\to b$ as $n\to\infty$. Since geodesics are constant speed, we see that $\{(t_n,\dot\gamma(t_n)\}_{n\in\mathbf{N}}$ is a compact set in the tangent bundle.  So you can find some $\varepsilon > 0$ such that for every point $(p,v)$ in the compact set that there is a geodesic $\alpha:(-\varepsilon,\varepsilon)\to M$ with $\alpha(0)=p$ and $\dot\alpha(0)=v$. Now use this to extend $\gamma$ past $I=(a,b)$. Since we assume that $I$ was the maximal domain of existence for $\gamma$, we deduce that $\gamma(t)$ must leave every compact set at $t\to b$.
You now conclude by noting that if $M$ is compact, that it is impossible for any geodesic to escape every compact set. Hence, every geodesic extends for all time, and so $M$ is geodesically complete.
So in some sense the metric $g$ doesn't have much to do with the proof. The metric shows up in the geodesic differential equations, but the heart of the proof is just simple ODE theory. This result also is an immediate corollary of the Hopf-Rinow theorem.

A: I believe you are asking for the Hopf-Rinow theorem. A proof can be found in Do Carmo, "Riemannian geometry".


text:
Q: Make dataframe with user input and even if user directly press "Enter" without input consider no condition check for particulr column I'm trying to make a data frame considering user input if user press "Enter" without entering anything. It should not check for condition in particular column
as well user can input one or more than one option separated by comma(',')
Cate = list(input('Please enter Category?GKL, MKL, UKL =').split(','))
Age =  [int(s) for s in input('Please enter VIN_Age?(In Months From 62-72) =').split(',')]

New = Final_Data.loc[[ if Cate != "":
                           Final_Data['Category']==Cate
                        Final_Data['Category'] &
                        if Age != "":
                           Final_Data['VIN_Age']==Age
                        Final_Data['VIN_Age']]]


text:
Q: Android - Getting selected value of spinner returns android.content.ContentResolver$CursorWrapperInner My question is like this SO question (and other, similar questions), but none of the proposed solutions are working for me. All these...
String selectedShelf = spinner.getItemAtPosition(spinner.getSelectedItemPosition()).toString();
String selectedShelf = spinner.getSelectedItem().toString();
String selectedShelf = spinner.getItemAtPosition(position).toString();
String selectedShelf = parentView.getItemAtPosition(position).toString();

...result in the content of selectedShelf being "android.content.ContentResolver$CursorWrapperInner@43bb89b0".
How can I retrieve the value of the selected string?
Here is my code:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
    Bundle savedInstanceState) {

    // Inflate the layout for this fragment
    View fragmentView =  inflater.inflate(R.layout.fragment_browse_spinner, container, false);

    Spinner spinner = (Spinner)fragmentView.findViewById(R.id.browseSpinner);
    spinner.setOnItemSelectedListener(new OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
            if (id != -1L) {
                String selectedShelf = ...;
                Log.d(LOG_TAG, "selectedShelf: " + selectedShelf);
            }
        }

        @Override
        public void onNothingSelected(AdapterView<?> parentView) {
        }

    });

    adapter = new SimpleCursorAdapter(getActivity(),
            android.R.layout.simple_spinner_item, // This is the layout that will be used for the standard/static part of the spinner. (You can use android.R.layout.simple_list_item_2 if you want two lines to be shown here.)
            null,
            new String[] {DbContentProvider.KEY_SHELF_NAME, DbContentProvider.KEY_EXTRA_SHELF_INFO},
            new int[]{android.R.id.text1, android.R.id.text2},
            0
    );

    // This sets the layout that will be used when the dropdown views are shown. I'm using android.R.layout.simple_list_item_2 so the subtext will also be shown.
    adapter.setDropDownViewResource(android.R.layout.simple_list_item_2);

    spinner.setAdapter(new NothingSelectedSpinnerAdapter(
            adapter,
            R.layout.browse_spinner_row_nothing_selected,
            getActivity()));

    getLoaderManager().initLoader(0, null, this);

    return fragmentView;
}

A: I have worked out the solution:
    spinner.setOnItemSelectedListener(new OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {

            TextView selectedShelfTextView = (TextView)selectedItemView.findViewById(android.R.id.text1); // You may need to replace android.R.id.text1 whatever your TextView label id is
            String selectedShelf = selectedShelfTextView.getText().toString();


text:
Q: Is there any way to get the Uri string of a youtube video? I'm trying to send a video to a reciever. So far I have sent files like 'myfile.mp4' but now I'm trying to send a youtube video. So, I need to send the URI of it.

A: Can you clarify 'send a youtube video' ?
If you have the VIDEOID and you want to send the URI just use
https://www.youtube.com/watch?v=VIDEOID


text:
Q: Getting only the contacts whose checkbox is true in salesforce1 lightning I am displaying a list of contacts through "aura:iteration" with a checkbox inside it. I want to get the contact ids for the selected contacts.
For example
<aura:attribute name ="someContacts" type="Contact[]"/>

<aura:Iteration name="{!v.somContacts}" var="con">
   <ui:inputCheckbox>
   {!con.Name}
</aura:iteration>

The above code displays a check box each contact . I want to get the checked contact ids.

A: You'll need to set the value on each checkbox to be the Id of the contact, like this:
<aura:attribute name="contacts" type="Contact[]" />
<aura:attribute name="checkedContacts" type="String[]" />

<aura:iteration var="con" items="{!v.contacts}">
  <ui:inputcheckbox text="{!con.Id}" label="{!con.Name}" change="{!c.updateCheckboxes}"/>
</aura:iteration>

Then use a client-side handler either on each checkbox or on a button to check whether each checkbox is checked and add its value (the contact Id) to an array. For example, here's my updateCheckboxes handler:
updateCheckboxes : function(component, event) {
  var id = event.source.get("v.text");
  if (event.source.get("v.value")) {
    // Checkbox is checked - add id to checkedContacts
    if (component.get("v.checkedContacts").indexOf(id) < 0) {
      component.get("v.checkedContacts").push(id);
    }
  } else {
    // Checkbox is unchecked - remove id from checkedContacts
    var index = component.get("v.checkedContacts").indexOf(id);
    if (index > -1) {
      component.get("v.checkedContacts").splice(index, 1);
    }
  }
}

(PS: It's important to use the ui:inputcheckbox label attribute to set the label, and not just stick it next to the checkbox in the component markup. ui:inputcheckbox will programmatically associate the label with the checkbox properly, making the label accessible to assistive technologies like screen readers. All the basic components have been carefully built to be accessible like this, so you get it for free as long as you use them correctly.)


text: Q: How to log (audit) events when a USB drive has been written to or modified Within windows, there is a setting within GPO to Audit Removable Storage. This will provide logging information to the Event Viewer within Windows. I am looking to recreate this same process on the Linux side. I have been able to monitor when devices are plugged in (mounted) and that info is sent to syslog but the other task has been much harder to find an answer.  Checking to see if anyone has had any luck with this. Trying to get this information to a log file.


text:
Q: In handleSubmit method, setState is not updating my details I have a basic Form. While submitting the form in my handleSubmit method, I'm callling a setState method which has the details object I am trying to update. However, the details object is not getting updated.
Kindly help me to understand the problem and resolve it. Thanks in advance...
constructor(props) {
  super(props);

  this.state = {
    array: [],

    details: {
      name: '',
      phonenumber: '',
      company: '',
      email: '',
    }
  };
}

handleSubmit = (e) => {
  e.preventDefault();
  console.log(this.state.details);
  this.setState({
    array: [...this.state.array,this.state.details],
    details: {
      name: '',
      phonenumber: '',
      company: '',
      email: '',
    }
  });
}

handleDetails = (e) => {
  this.setState({
    details: {
      ...this.state.details,
      [e.target.name]: e.target.value,
    }
  });
}


text:
Q: Ajax function returning echo instead of value I need to update a span element with a value from an update PHP function (that performs mySQL queries), triggered after a button click. I used jQuery/Ajax to achieve this, via a function in another file.
Apparently PHP logs in this case require the following form:
echo '<script> console.log("My message"); </script>';

So I put these in my PHP function file, which looks like the following:
if(isset($_POST['myAction'])) {
    if ($_POST['myAction'] == "right_action") {
        echo '<script> console.log("ENTERED"); </script>';
        update(...)
        ...
    }
}

function init()
{
    ...
    echo '<script> console.log("Successfully connected to database"); </script>';
    return ...;
}

function fetch(...) {
    init();
    ...
    echo '<script> console.log("Database fetch successful"); </script>';
    echo '<script> console.log(' . result . '); </script>'; // equals 49
    return ...;
}

function update(...) {
    init();
    ...
    echo '<script> console.log("Database update successful"); </script>';
    return fetch(...);
}

On the one hand, the logs appear properly while the PHP is executing.
However it seems that the return value of the update PHP function, from the perspective of the Ajax function, contains all the logs. Here is the Ajax function:
$.ajax({
            method: "POST",
            url: "my_php_file.php",
            data: { myAction: 'myAction',
                    (params) },
            success: function(result) {
                console.log("Success at Ajax transfer-to-PHP");
                console.log("RESULT: " + result);
                spanElement.load(result);
            },
            error: function(error) {
                console.log("Error at Ajax transfer-to-PHP: " + error);
            }
        });

And the Ajax log:
RESULT
<script> console.log("ENTERED"); </script><script> console.log("Successfully connected to database"); </script><script> console.log("Database update successful"); </script><script> console.log("Successfully connected to database"); </script><script> console.log("Database fetch successful"); </script><script> console.log(49); </script>

The same behavior happens when I print in Ajax the content of the span element, initially filled with the result from the fetch PHP function. It prints all the logs; but then it does print the value (while the update mechanic above doesn't even).

A: I think you are approaching this very unusually, and making things quite hard for yourself.  I've never seen PHP returning Javascript to do console.log() before.  I'm sure it works, and maybe it really suits what you need, but it seems very Rube Goldberg-ish to me.
If you want to generate logs of what your PHP is doing, just do it in PHP on the server.  You can then monitor your application log on the server.
If you want a response from your PHP that your browser can handle and use to update your page, just return the response as text, or better yet as JSON, so you can include eg a status as well as a message.  If you really want to pass log messages back to the browser, you could structure the response to include a log element which will be logged to the console, along with a message element to display to the user.  You might want to include a status or success element, which is true or false.
There are thousands of examples here on SO, here's a highly ranked one, here's a simpler one, but searching for anything like "php ajax example" will turn up plenty more for inspiration.
As to why your result includes multiple msgs, just trace through what your PHP is doing - each step echoes a message, one after the other.  They're all part of the content returned to your Javascript.
I see one bug in your Javascript - .load() loads content from the specified URL.  You've already loaded content with your .ajax(), and result is not a URL, so that isn't doing what you expect and won't work.
Here's some clunky pseudo-code which skips over some specifics but gives you a general idea.  If you want to keep a running log of each step as you are currently, you'll have to pass your $response array around to/from your functions, or if this is a PHP class make it a class property to avoid that.  If you just log to the server you can avoid that, since you only need the final result of your update().
$response = [];

if(isset($_POST['myAction'])) {
    if ($_POST['myAction'] == "right_action") {

        // If you really want to return log msgs to the browser
        $response['log'][] = 'ENTERED';

        // More appropriate might be to just log them in PHP.  How you do that is
        // up to you, eg if you are using a library or just your own simple fopen(),
        // fwrite() etc.  Though you might not want this level of detail after initial
        // development.
        // myLogger('Entered');

        // In this pseudo-code you'll have to include $response as parameter passed
        // to your functions so they can update it, and they'll have to return it
        update(...)
        ...
    }
}

// Return your response as JSON which is easy for JS to work with
header('Content-Type: application/json');
echo json_encode($response);

function init()
{
    ...
    $response['log'][] = 'Successfully connected to database';
    // myLogger('Successfully connected to database')
    return ...;
}

function fetch(...) {
    init();
    ...
    $response['log'][] = 'Database fetch successful';
    $response['message'] = $result;
    // myLogger('Database fetch successful')
    return ...;
}

function update(...) {
    init();
    ...
    $response['log'][] = 'Database update successful';
    // myLogger('Database update successful')
    return fetch(...);
}

Then your Javascrtipt can do something like:
$.ajax({
    method: "POST",
    url: "my_php_file.php",
    data: {
        myAction: 'myAction',
        (params)
    },
    success: function(result) {
        console.log("Success at Ajax transfer-to-PHP");

        // Log your log msgs
        console.log("RESULT:");
        console.dir(result.log);

        // .load() will load the specified remote content, similar to .ajax()
        // spanElement.load(result);

        // You can use .html() or .text() to update your span
        // https://api.jquery.com/html/
        spanElement.html(result.message);
    },
    error: function(error) {
        console.log("Error at Ajax transfer-to-PHP: " + error);
    }
});


text:
Q: how to retrieve facebook user name and notifications in android? Hello I neeed to retrieve User Name and notifications from a facebook profile, this is my facebook conector code:
import com.FeedPass.SessionEvents.AuthListener;
import com.FeedPass.SessionEvents.LogoutListener;

public class FacebookConnector {
private Facebook facebook = null;
private Context context;
private String[] permissions;
private Handler mHandler;
private Activity activity;
private SessionListener mSessionListener = new SessionListener();
private String _accessToken;

public FacebookConnector(String appId,Activity activity,Context context,String[] permissions){
    this.facebook = new Facebook(appId);

    SessionStore.restore(facebook, context);

    SessionEvents.addAuthListener(mSessionListener);
    SessionEvents.addLogoutListener(mSessionListener);
    this.context=context;
    this.permissions=permissions;
    this.mHandler = new Handler();
    this.activity=activity;
}

public void login() {
    if (!facebook.isSessionValid()) {
        facebook.authorize(this.activity, this.permissions,new LoginDialogListener());
    }
}

public void logout() {
    SessionEvents.onLogoutBegin();
    AsyncFacebookRunner asyncRunner = new AsyncFacebookRunner(this.facebook);
    asyncRunner.logout(this.context, new LogoutRequestListener());
}

public void postMessageOnWall(String msg) {
    if (facebook.isSessionValid()) {
        Bundle parameters = new Bundle();
        parameters.putString("message", msg);
        try {
            String response = facebook.request("me/feed", parameters,"POST");
            System.out.println(response);
        } catch (IOException e) {
            e.printStackTrace();
        }
    } else {
        login();
    }
}

public String getNotifications(){
    String result = null;
    if(facebook.isSessionValid()){
        Bundle bundle = new Bundle();
        bundle.putString(Facebook.TOKEN, _accessToken);
        try{
            result = facebook.request("me/notifications", bundle, "GET");
        }
        catch(IOException e){
            e.printStackTrace();
        }
    }
    else{
        login();
    }
    return result;
}

private final class LoginDialogListener implements DialogListener {
    public void onComplete(Bundle values) {
        SessionEvents.onLoginSuccess();
    }

    public void onFacebookError(FacebookError error) {
        SessionEvents.onLoginError(error.getMessage());
    }

    public void onError(DialogError error) {
        SessionEvents.onLoginError(error.getMessage());
    }

    public void onCancel() {
        SessionEvents.onLoginError("Action Canceled");
    }
}

public class LogoutRequestListener extends BaseRequestListener {
    public void onComplete(String response, final Object state) {
        // callback should be run in the original thread,
        // not the background thread
        mHandler.post(new Runnable() {
            public void run() {
                SessionEvents.onLogoutFinish();
            }
        });
    }
}

private class SessionListener implements AuthListener, LogoutListener {

    public void onAuthSucceed() {
        SessionStore.save(facebook, context);
    }

    public void onAuthFail(String error) {
    }

    public void onLogoutBegin() {
    }

    public void onLogoutFinish() {
        SessionStore.clear(context);
    }
}

public Facebook getFacebook() {
    return this.facebook;
}
}

as you can see I have a method to retrieve user notifications but I'm not sure it is working, anyone know how to do this is in a simple manner?

A: The following code you can use to retrieve the name of the facebook user:
public static String getName() {
        String response;
        String name = "";
        try {
            response = ParseFacebookUtils.getFacebook().request("me");
            JSONObject json = Util.parseJson(response);
            name = json.getString("first_name");
        }
        catch (MalformedURLException e) {
            e.printStackTrace();
        }
        catch (IOException e) {
            e.printStackTrace();
        }
        catch (FacebookError e) {
            e.printStackTrace();
        }
        catch (JSONException e) {
            e.printStackTrace();
        }

        return name;
    }

A: You can get facebook user name from this
String User_name = null;
try {
    User_name = new JSONObject(facebook.request("username"));

} catch (MalformedURLException e) {
    e.printStackTrace();
} catch (JSONException e) {
    e.printStackTrace();
} catch (IOException e) {
    e.printStackTrace();
}

A: This is how you retrieve notifications.Even this is an old question. I will post it in case somebody finds it helpful
private void onSessionStateChange(Session session, SessionState state, Exception exception) {
if (state.isOpened()) {
    InboxMessage.setVisibility(View.VISIBLE);

    new Request(session,"/me/notifications", null,HttpMethod.GET,new Request.Callback() {

                public void onCompleted(Response response) {
                    GraphObject object = response.getGraphObject();
                        if (object != null) {
                            InboxMessage.setText(object.getProperty("data").toString());
                        } else {
                            InboxMessage.setText("Notifications returns null");
                        }
                }
            }
        ).executeAsync();
} else {
    InboxMessage.setVisibility(View.INVISIBLE);
    Log.i(TAG, "Logged out...");
}
}


text:
Q: Expandable div along with it's content My code is here on jsfiddle
What I can't accomplish is: if you narow the screen size by axis x, my boxes containing the image of santa will "fall" out of the container box below the first container, which is OK (it's ok that the go below), but I would also like the that the div which contains these images "streches" down as well.
I bet I'm missing something in my css part of the code - can you please advise?

A: Whenever you float some elements the parent of those elements will not take the actual height
so for this you apply a clear fix class for container div of floated elements.
In Css
.clearfix:after {
    clear:both;
    content:".";
    display: block;
    height:0;
    visibility:hidden;
}

.clearfix {display:inline-block;}
* html .clearfix {height:1%;}
.clearfix {display:block;}

In Html

CTA 2

CTA 2

CTA 2

A: Here is a css only solution: http://jsfiddle.net/surendraVsingh/Prjd8/6/
CSS
.accContent{
    background-color: #F5F5F5;
    padding: 5px;
    min-height: 160px;
     border-bottom-left-radius: 5px;
    border-bottom-right-radius: 5px;

    -moz-border-bottom-right-radius:5px;
    -moz-border-bottom-left-radius:5px;

    -webkit-border-bottom-right-radius:5px;
    -webkit-border-bottom-left-radius:5px;

    -khtml-border-bottom-right-radius:5px;
    -khtml-border-bottom-left-radius:5px;
    overflow:hidden; /* Add This */
}

.okvir{
    width: 210px;
    height: 150px;
    text-align: center;
    background-color: #CCC;
    margin:0 0 20px 20px;/* Modify this to make it look good when resized */
    float: left;
    border-radius: 5px;
}


text:
Q: how to access aws parameter store value from Nodejs and use it later I have a requirement where I want to access parameter store value and then use that later. This is how I am doing:
var options = {
    Name: 'SecretAccessKey_temp',
    WithDecryption: true
};

var secreretAccesKeyParam = ssm.getParameter(options).promise();

secreretAccesKeyParam.then(function (data, err) {
    if (err) console.log(err, err.stack);
    else {
        const secretAccessKey = data.Parameter.Value
        console.log(secretAccessKey)

    }
});

This is giving me value but if I want to access secretAccessKey variable outside of this it's giving me 'undefined'. Can anyone please help me out to access this secretAccessKey variable outside of this function?

A: As your variable secreretAccesKeyParamis a promise, you won't be able to access the context (e.g. secretAccessKey) of your promise handler (e.g. function (data, err) {...}). By definition of promise doing so :
const myPromise = new Promise((resolve, reject) => {
  setTimeout(() => {
    resolve('foo');
  }, 300);
});
var myRes = 'bar';
myPromise.then(dunction (data, err) {
  myRes = data;
  console.log(myRes); // executed asynchronously
});
console.log(data); // executed sychronously so printed first. myRes value is still 'bar'.

Would give you the output :
'bar'
'foo'

What you might want to do could be using an async function if you want to handle things as if they were synchronous.
var options = {
    Name: 'SecretAccessKey_temp',
    WithDecryption: true
};

var secreretAccesKeyParam = ssm.getParameter(options).promise();

(async () => {
  try {
    const data = await secreretAccesKeyParam;
  } catch (err) {
    console.log(err, err.stack);
  }

  const secretAccessKey = data.Parameter.Value;
  console.log(secretAccessKey);
  ... // any action with your secret access key
})();

Or if you are already using handler function later :
let _secretAccessKey;
const getSecretAccessKey = async () => {
  if (!_secretAccessKey) {
    try {
      const data = await secreretAccesKeyParam;
    } catch (err) {
      console.log(err, err.stack);
      return null;
    }
    _secretAccessKey = data.Parameter.Value;
  }
  return Promise.resolve(_secretAccessKey);
}

...

async function mySuperHandler() {
  const secretAccessKey = await getSecretAccessKey();
  // do something with the secret
}

A: How about set it as env ?
Im currently use this method, but you have to make sure env is set before use it.
secreretAccesKeyParam.then(function (data, err) {
  if (err) console.log(err, err.stack);
  else {
    process.env.secretAccessKey = data.Parameter.Value;
    const secretAccessKey = process.env.secretAccessKey;
    console.log(secretAccessKey);
  }
});


text:
Q: Get image from server and preview it on client So i'm trying to get an image from a server and previewing it on the client, i can retrieve the image for now, but i don't know how to preview it on a web page asynchronously.
axios.get(link,{responseType:'stream'}).then(img=>{
// What i have to do here ?
});

Thank you.

A: First, you need to fetch your image with the response type arraybuffer. Then you can convert the result to a base64 string and assign it as src of an image tag. Here is a small example with React.
import React, { Component } from 'react';
import axios from 'axios';

class Image extends Component {
  state = { source: null };

  componentDidMount() {
    axios
      .get(
        'https://www.example.com/image.png',
        { responseType: 'arraybuffer' },
      )
      .then(response => {
        const base64 = btoa(
          new Uint8Array(response.data).reduce(
            (data, byte) => data + String.fromCharCode(byte),
            '',
          ),
        );
        this.setState({ source: "data:;base64," + base64 });
      });
  }

  render() {
    return <img src={this.state.source} />;
  }
}

export default Image;


text:
Q: Assigning JobObject to process with non-zero session id launched from a SYSTEM service I have a Windows SYSTEM service which needs to launch a new process in the context of the logged-in user. Along with this, I need to create a Job for the new process with certain limits.
I am extracting the process token of explorer.exe and duplicating it to create a primary token. I use this token in CreateProcessAsUser to create the new process running in the context of the user with a session id which is non-zero. When I assign the Job to this process, AssignProcessToJobObject function fails with Access denied error. Specifically, I am not able to set JOBOBJECT_BASIC_UI_RESTRICTIONS limits (JOBOBJECT_EXTENDED_LIMIT_INFORMATION works though).
The process is created as suspended and after assigning the job, I am resuming the thread.
When I use the token of the current process (i.e. SYSTEM service with session id 0) instead of explorer.exe, everything works fine.
I am testing this on Windows 10


text:
Q: GlobalMemoryStatusEx/GetPerformanceInfo - Getting Actual Page File size, used page file and available page file Based on the following link: MSDN Docu
I am trying to get the size of the page file that is currently being used.
Here's how I am getting the values:
ActualPageFileSize = ullAvailPageFile - ullTotalPageFile
AvailablePageFileSize = ullAvailPageFile - ullAvailPhys
UsedPageFile = ActualPageFileSize - AvailablePageFileSize

Above computation is based on another post:
Another post
The issue that I am having right now is that sometimes the value of AvailablePageFileSize is greater than the value of ActualPageFileSize, hence returning a negative value for the UsedPageFile.
Have any of you encountered this? Any idea will be greatly appreciated.
Thank you in advance!
P.S.
Sample code:
#define DIV 1024

void _tmain()
{
  MEMORYSTATUSEX statex;

  statex.dwLength = sizeof (statex);

  GlobalMemoryStatusEx (&statex);

    double committedBytes = 1;

    _tprintf (TEXT("==================================================\n"));
    _tprintf (TEXT("GlobalMemoryStatusEx\n"));
    _tprintf (TEXT("==================================================\n"));
    _tprintf (TEXT("           %PhysUsed : %ld\n"), statex.dwMemoryLoad);
    _tprintf (TEXT("        ullTotalPhys : %I64d (%I64d MB)\n"), statex.ullTotalPhys, statex.ullTotalPhys / (DIV*DIV));
    _tprintf (TEXT("        ullAvailPhys : %I64d (%I64d MB)\n"), statex.ullAvailPhys, statex.ullAvailPhys / (DIV*DIV));
    _tprintf (TEXT("         ullUsedPhys : %I64d (%I64d MB)\n"), statex.ullTotalPhys - statex.ullAvailPhys, (statex.ullTotalPhys - statex.ullAvailPhys) / (DIV*DIV));
    _tprintf (TEXT("                       --------------------------\n"));
    _tprintf (TEXT("   Phys Avail + Used = %I64d (%I64d MB)\n"), statex.ullAvailPhys + (statex.ullTotalPhys - statex.ullAvailPhys), (statex.ullAvailPhys + (statex.ullTotalPhys - statex.ullAvailPhys)) / (DIV*DIV));

    _tprintf (TEXT("==================================================\n"));
    _tprintf (TEXT("    ullTotalPageFile : %I64d (%I64d MB)\n"), statex.ullTotalPageFile, statex.ullTotalPageFile / (DIV*DIV));
    _tprintf (TEXT("    ullAvailPageFile : %I64d (%I64d MB)\n"), statex.ullAvailPageFile, statex.ullAvailPageFile / (DIV*DIV));
    _tprintf (TEXT("     ullUsedPageFile : %I64d (%I64d MB)\n"), statex.ullTotalPageFile - statex.ullAvailPageFile, (statex.ullTotalPageFile - statex.ullAvailPageFile) / (DIV*DIV));
    _tprintf (TEXT("                       --------------------------\n"));
    _tprintf (TEXT("   Page Avail + Used = %I64d (%I64d MB)\n"), statex.ullAvailPageFile + (statex.ullTotalPageFile - statex.ullAvailPageFile), (statex.ullAvailPageFile + (statex.ullTotalPageFile - statex.ullAvailPageFile)) / (DIV*DIV));

    _tprintf (TEXT("==================================================\n"));
    _tprintf (TEXT(" ActualTotalPageFile : %I64d (%I64d MB)\n"), statex.ullTotalPageFile - statex.ullTotalPhys, (statex.ullTotalPageFile - statex.ullTotalPhys) / (DIV*DIV));
    _tprintf (TEXT(" ActualAvailPageFile : %I64d (%I64d MB)\n"), statex.ullAvailPageFile - statex.ullAvailPhys, (statex.ullAvailPageFile - statex.ullAvailPhys) / (DIV*DIV));
    _tprintf (TEXT("  ActualPageFileUsed : %I64d (%I64d MB)\n"), (statex.ullTotalPageFile - statex.ullTotalPhys) - (statex.ullAvailPageFile - statex.ullAvailPhys), ((statex.ullTotalPageFile - statex.ullTotalPhys) - (statex.ullAvailPageFile - statex.ullAvailPhys)) / (DIV*DIV));
    _tprintf (TEXT("            Variance : %I64d (%I64d MB)\n"), (statex.ullAvailPageFile - statex.ullAvailPhys) - (statex.ullTotalPageFile - statex.ullTotalPhys), ((statex.ullAvailPageFile - statex.ullAvailPhys) - (statex.ullTotalPageFile - statex.ullTotalPhys)) / (DIV*DIV));
    _tprintf (TEXT("                       --------------------------\n"));
    _tprintf (TEXT("ActPage Avail + Used = %I64d (%I64d MB)\n"), (statex.ullAvailPageFile - statex.ullAvailPhys) + ((statex.ullTotalPageFile - statex.ullTotalPhys) - (statex.ullAvailPageFile - statex.ullAvailPhys)), ((statex.ullAvailPageFile - statex.ullAvailPhys) + ((statex.ullTotalPageFile - statex.ullTotalPhys) - (statex.ullAvailPageFile - statex.ullAvailPhys))) / (DIV*DIV));
    _tprintf (TEXT("==================================================\n"));
    _tprintf (TEXT("     ullTotalVirtual : %I64d (%I64d MB)\n"), statex.ullTotalVirtual, statex.ullTotalVirtual / (DIV*DIV));
    _tprintf (TEXT("     ullAvailVirtual : %I64d (%I64d MB)\n"), statex.ullAvailVirtual, statex.ullAvailVirtual / (DIV*DIV));
    _tprintf (TEXT(" ullAvailVirtualUsed : %I64d (%I64d MB)\n"), statex.ullTotalVirtual - statex.ullAvailVirtual, (statex.ullTotalVirtual - statex.ullAvailVirtual) / (DIV*DIV));

    PERFORMACE_INFORMATION perfInfo;
    int ret;

    ret = GetPerformanceInfo (&perfInfo,sizeof(perfInfo));

    _tprintf (TEXT("==================================================\n"));
    _tprintf (TEXT("GetPerformanceInfo\n"));
    _tprintf (TEXT("==================================================\n"));

    _tprintf (TEXT("       PageSize : %d (%d MB) \n"), perfInfo.PageSize, perfInfo.PageSize / DIV);
    _tprintf (TEXT("    CommitTotal : %d (%d MB) X %d = %I64d (%I64d MB)\n"), perfInfo.CommitTotal, perfInfo.CommitTotal / DIV, perfInfo.PageSize, (DWORDLONG)perfInfo.CommitTotal * perfInfo.PageSize, (DWORDLONG)(perfInfo.CommitTotal * perfInfo.PageSize)  / (DIV*DIV));
    _tprintf (TEXT("    CommitLimit : %d (%d MB) X %d = %I64d (%I64d MB)\n"), perfInfo.CommitLimit, perfInfo.CommitLimit / DIV, perfInfo.PageSize, (DWORDLONG)perfInfo.CommitLimit * perfInfo.PageSize, (DWORDLONG)(perfInfo.CommitLimit * perfInfo.PageSize) / (DIV*DIV));
    _tprintf (TEXT("    CommitAvail : %d (%d MB) X %d = %I64d (%I64d MB)\n"), perfInfo.CommitLimit - perfInfo.CommitTotal, (perfInfo.CommitLimit - perfInfo.CommitTotal) / DIV, perfInfo.PageSize, (DWORDLONG)(perfInfo.CommitLimit - perfInfo.CommitTotal) * perfInfo.PageSize, (DWORDLONG)((perfInfo.CommitLimit - perfInfo.CommitTotal) * perfInfo.PageSize) / (DIV*DIV));
    _tprintf (TEXT("  PhysicalTotal : %d (%d MB) X %d = %I64d (%I64d MB)\n"), perfInfo.PhysicalTotal, perfInfo.PhysicalTotal / DIV, perfInfo.PageSize, (DWORDLONG)perfInfo.PhysicalTotal * perfInfo.PageSize, (DWORDLONG)(perfInfo.PhysicalTotal * perfInfo.PageSize) / (DIV*DIV));
    _tprintf (TEXT("  PhysicalAvail : %d (%d MB) X %d = %I64d (%I64d MB)\n"), perfInfo.PhysicalAvailable, perfInfo.PhysicalAvailable / DIV, perfInfo.PageSize, (DWORDLONG)(perfInfo.PhysicalAvailable * perfInfo.PageSize), (DWORDLONG)(perfInfo.PhysicalAvailable * perfInfo.PageSize) / (DIV*DIV));

    DWORDLONG ptotal = (DWORDLONG)(perfInfo.CommitLimit - perfInfo.PhysicalTotal) * perfInfo.PageSize;
    DWORDLONG pavail = (DWORDLONG)((perfInfo.CommitLimit - perfInfo.CommitTotal) - perfInfo.PhysicalAvailable) * perfInfo.PageSize;
    _tprintf (TEXT("\nCommitLimit - PhysicalTotal = %I64d (%I64d MB) \n"), ptotal, (DWORDLONG)ptotal / (DIV*DIV));
    _tprintf (TEXT("CommitAvail - PhysicalAvail = %I64d (%I64d MB) \n"), pavail, (DWORDLONG)pavail / (DIV*DIV));
    _tprintf (TEXT("CommitUsed  - %I64d (%I64d MB) \n"), (DWORDLONG)(ptotal - pavail), (DWORDLONG)(ptotal - pavail) / (DIV*DIV));
}

Sample Good Output:
R:\>memtest.exe
==================================================
GlobalMemoryStatusEx
==================================================
           PhysUsed : 24
        ullTotalPhys : 4294430720 (4095 MB)
        ullAvailPhys : 3231776768 (3082 MB)
         ullUsedPhys : 1062653952 (1013 MB)
                       --------------------------
   Phys Avail + Used = 4294430720 (4095 MB)
==================================================
    ullTotalPageFile : 5032628224 (4799 MB)
    ullAvailPageFile : 3932905472 (3750 MB)
     ullUsedPageFile : 1099722752 (1048 MB)
                       --------------------------
   Page Avail + Used = 5032628224 (4799 MB)
==================================================
 ActualTotalPageFile : 738197504 (704 MB)
 ActualAvailPageFile : 701128704 (668 MB)
  ActualPageFileUsed : 37068800 (35 MB)
            Variance : -37068800 (17592186044380 MB)
                       --------------------------
ActPage Avail + Used = 738197504 (704 MB)
==================================================
     ullTotalVirtual : 2147352576 (2047 MB)
     ullAvailVirtual : 2072608768 (1976 MB)
 ullAvailVirtualUsed : 74743808 (71 MB)
==================================================
GetPerformanceInfo
==================================================
       PageSize : 4096 (4 MB)
    CommitTotal : 268487 (262 MB) X 4096 = 1099722752 (1048 MB)
    CommitLimit : 1228669 (1199 MB) X 4096 = 5032628224 (703 MB)
    CommitAvail : 960182 (937 MB) X 4096 = 3932905472 (3750 MB)
  PhysicalTotal : 1048445 (1023 MB) X 4096 = 4294430720 (4095 MB)
  PhysicalAvail : 789000 (770 MB) X 4096 = 3231744000 (3082 MB)

CommitLimit - PhysicalTotal = 738197504 (704 MB)
CommitAvail - PhysicalAvail = 701161472 (668 MB)
CommitUsed  - 37036032 (35 MB)

R:\>

Sample Bad Output:
U:\>memtest.exe
==================================================
GlobalMemoryStatusEx
==================================================
           PhysUsed : 35
        ullTotalPhys : 3220688896 (3071 MB)
        ullAvailPhys : 2087751680 (1991 MB) <--- Should be less than ullAvailPageFile
         ullUsedPhys : 1132937216 (1080 MB)
                       --------------------------
   Phys Avail + Used = 3220688896 (3071 MB)
==================================================
    ullTotalPageFile : 3757559808 (3583 MB)
    ullAvailPageFile : 1925316608 (1836 MB) <-- Shouldbe greater than ullAvailPhys
     ullUsedPageFile : 1832243200 (1747 MB)
                       --------------------------
   Page Avail + Used = 3757559808 (3583 MB)
==================================================
 ActualTotalPageFile : 536870912 (512 MB)
 ActualAvailPageFile : -162435072 (17592186044261 MB) <-- This is ullAvailPageFile - ullAvailPhys
  ActualPageFileUsed : 699305984 (666 MB)
            Variance : -699305984 (17592186043749 MB)
                       --------------------------
ActPage Avail + Used = 536870912 (512 MB)
==================================================
     ullTotalVirtual : 2147352576 (2047 MB)
     ullAvailVirtual : 2139230208 (2040 MB)
 ullAvailVirtualUsed : 8122368 (7 MB)
==================================================
GetPerformanceInfo
==================================================
       PageSize : 4096 (4 MB)
    CommitTotal : 447325 (436 MB) X 4096 = 1832243200 (1747 MB)
    CommitLimit : 917373 (895 MB) X 4096 = 3757559808 (3583 MB)
    CommitAvail : 470048 (459 MB) X 4096 = 1925316608 (1836 MB)
  PhysicalTotal : 786301 (767 MB) X 4096 = 3220688896 (3071 MB)
  PhysicalAvail : 509698 (497 MB) X 4096 = 2087723008 (1991 MB)

CommitLimit - PhysicalTotal = 536870912 (512 MB)
CommitAvail - PhysicalAvail = 17592023638016 (16777061 MB)
CommitUsed  - -17591486767104 (17592169267866 MB)

U:\>

A: the next code worked how minimum from win2000 up to the latest win10 x64. about deprecated, undocumented, etc:

NtQuerySystemInformation may be altered or unavailable in future
  versions of Windows.

i read this already ~15 years. are ntdll api will be/can be removed in future - my personal option that no. never. this is base native api and all so called win32 api based on this. but this is only my option. how minimum just now this is fine worked on all existing windows versions. as is (i sure that will be worked and on new builds too)
typedef struct SYSTEM_PAGEFILE_INFORMATION
{
    ULONG NextEntryOffset;
    ULONG TotalSize;
    ULONG TotalInUse;
    ULONG PeakUsage;
    UNICODE_STRING PageFileName;
} *PSYSTEM_PAGEFILE_INFORMATION;

NTSTATUS GetPageFilesInfo()
{
    static volatile UCHAR guz;
    PVOID stack = alloca(guz);
    ULONG cb = 0, rcb = 2*sizeof(SYSTEM_PAGEFILE_INFORMATION) + 64* sizeof(WCHAR);

    union {
        PVOID buf;
        PSYSTEM_PAGEFILE_INFORMATION pspfi;
        PBYTE pb;
    };
    NTSTATUS status;
    do
    {
        if (cb < rcb)
        {
            cb = RtlPointerToOffset(buf = alloca(rcb - cb), stack);
        }

        if (0 <= (status = NtQuerySystemInformation(SystemPageFileInformation, buf, cb, &rcb)))
        {
            ULONG NextEntryOffset = 0;
            do
            {
                pb += NextEntryOffset;

                DbgPrint("%ukb %ukb %ukb %wZ\n", pspfi->TotalInUse, pspfi->PeakUsage, pspfi->TotalSize, &pspfi->PageFileName);

            } while (NextEntryOffset = pspfi->NextEntryOffset);

            break;
        }

    } while (status == STATUS_INFO_LENGTH_MISMATCH);

    return status;
}

funny that if open page for ZwQuerySystemInformation

[ZwQuerySystemInformation is no longer available for use as of
  Windows 8. Instead, use the alternate functions listed in this
  topic.]

but this is direct lie - ZwQuerySystemInformation available and in win 8, win 8.1, win 10.. and in user mode Zw and Nt functions - this is aliases - it always point to same address (this is single function with 2 names)


text:
Q: Can't boot Ubuntu 12.10 I've just made a bootable USB stick following this official how-to:
http://www.ubuntu.com/download/help/create-a-usb-stick-on-mac-osx
But unfortunately, my Mac doesn't seem to recognise the USB stick. Oddly, the same live USB stick works on my Samsung Netbook...
Thanks in advance for any help.

A: look here
solution booting and installing on mac

A: I assume by "doesn't recognize", you mean that the USB stick doesn't show up on the list of options to boot from?  Some Macs of a certain age and make cannot boot from USB, or may not do it via the "option-startup" method.  What type and model of Mac are you using?


text:
Q: How to resolve Kubernetes API from minikube? I can't seem to be able to find the Kubernetes API IP address from within the minikube machine, using minikube ssh.
nslookup kubernetes.default.svc.cluster.local 10.0.0.1
Server:    10.0.0.1
Address 1: 10.0.0.1

nslookup: can't resolve 'kubernetes.default.svc.cluster.local'

Same thing happens with just kubernetes. This happens even though it seems that the kube-dns pods are up-and-running just fine:
# kubectl -n kube-system get pods
NAME                          READY     STATUS    RESTARTS   AGE
kube-addon-manager-minikube   1/1       Running   0          9m
kube-dns-910330662-16bvw      3/3       Running   0          8m
kubernetes-dashboard-vbn9m    1/1       Running   0          8m

There is no KubeDNS info in cluster-info (but nothing major in the dump):
# kubectl cluster-info
Kubernetes master is running at https://192.168.64.26:8443

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

Version for kubectl:
# kubectl version
Client Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.5", GitCommit:"17d7182a7ccbb167074be7a87f0a68bd00d58d97", GitTreeState:"clean", BuildDate:"2017-08-31T09:14:02Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.0", GitCommit:"d3ada0119e776222f11ec7945e6d860061339aad", GitTreeState:"clean", BuildDate:"2017-07-26T00:12:31Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}

and minikube:
# minikube version
minikube version: v0.21.0

This happens on OSX and both with xhyve and virtualbox as drivers.
There are quite a few minikube/dns issues in the minikube issue tracker, but none of them quite like this. What should the kubectl cluster-info output look like for minikube that has kube-dns working? What about the nslookup, shouldn't that work?
EDIT. It seems like kubectl cluster-info for minikube is returning what it should, but I can't even resolve kubernetes from inside the kube-dns pod either:
# kubectl -n kube-system exec -it kube-dns-910330662-1n64f -c kubedns -- nslookup kubernetes.default.svc.cluster.local localhost
Server:    127.0.0.1
Address 1: 127.0.0.1 localhost

nslookup: can't resolve 'kubernetes.default.svc.cluster.local': Name does not resolve

which really should work?


text:
Q: Burn In component testing For pre and post electrical testing of burn in components under test: what is the best way to measure current and voltage through said burn in components before and after burn in to verify if the components are still in range of its parameters on its data sheet. Basically making sure the component is still in operational condition. I need some type of a circuit to test current and voltage on these components. These components are SMC and D^2 Diodes that are placed into a socket during the burn in process. These components will be on a PCB and put into an oven. Thanks

A: The manufacturer should provide a schematic of the circuit(s) used to measure the datasheet parameters, along with any necessary footnotes. If you want to compare your measurements to the datasheet you will need to use the same test configuration.


text:
Q: GNU Make : Why makefile.head and makefile.tail I'm reading live555 RTSP/RTP Server source code. in this library, i see that author breaks makefile into two part : makefile.head and makefile.tail. and in script to build this library, there is a line :
cat Makefile.head ../config.$1 Makefile.tail > Makefile

If I understand true, this line means : append content of makefile.tail into makefile.head and become makefile. nothing special.
Do I understand true ? If true, why author do this instead of write only one makefile ?
Thanks :)

A: cat Makefile.head ../config.$1 Makefile.tail concatenates three files - Makefile.head, ../config.$1 ($1 is variable, likely taken from arguments) and Makefile.tail. Reason is that you can have many different config.* files, but current configuration wants to use only one (and very specific one) of them - e.g. one config for each operating system, compiler, or whatever.


text:
Q: MySQL How data is queried from the same different columns in the row? This is image : http://oi60.tinypic.com/118iq7r.jpg
I have a similar database structure to that shown in the table above. However, I have additional columns for the login times. I would like to take the data from the columns and display them on a page.
ID | txtName | txtEmail        | txtPasswd
-------------------------------------------
1  | Ahmet   | ahmet@gmail.com | 123123
2  | Ali     | ali@gmail.com   | 312 321

<?php
session_start();
ob_start();

include 'connect.php';

$email = $_POST['txtEmail'];
$password = $_POST['txtPasswd'];
$cryptpass = md5($password);

$login = mysql_query("select * from users where txtEmail='".$email."' and txtPasswd='".$cryptpass."' ") or die(mysql_error());
if(mysql_num_rows($login))  {
    $_SESSION["login"] = true;
    $_SESSION["user"] = $password;
    $_SESSION["pass"] = $password;
    $_SESSION["email"] = $emailadress;
    header("location:index.php");
}
else
{
    if($email=="" or $password=="") {
        echo "";
    } else {
        header('Location:index.php?error=1');
        exit;
    }
}

ob_end_flush();
?>

This is my profile page.
<?php
if (empty($_SESSION["fullname"])) {
    $fullnamequery = "";
}

                    if(!empty($_SESSION['login'])) {
                                           echo '

                                            '.$_SESSION['fullname'].'

Bilgilerim

Petlerim

Adreslerim

Siparişlerim

Çıkış

';
}else{echo '
Giriş Yap
';};
                    ?>

A: You have created the login page. I assume it has no errors. Now, to retrieve data you should do another page profile.php
<?php

session_start();

print_r ($_SESSION);

?>

A: Despite the people who question the negative points I give the solution to the problem. You can do it this way:
$userquery = mysql_query("select * from users where txtEmail='".$email."' and txtPasswd='".$cryptpass."' ");
if(mysql_num_rows($userquery)>0)
{
    header('Location:index.php?error=2');
    exit;
} else {
    $register = "INSERT INTO users (txtName,txtEmail,txtPasswd,txtGsm) VALUES ('$fullname','$email','$cryptpass','$gsm')";
    mysql_query("$register") or die(mysql_error());
    $_SESSION['login'] = true;
    $_SESSION['fullname'] = $fullname;
    $_SESSION["email"] = $email;
    $_SESSION["gsm"] = $gsm;
    header('location:index.php');}
}


text:
Q: Progressing Alfresco workflows through web script I have an Alfresco document reference; what I'm looking for is a way to access workflow attached to that document and finish it (or progress it to the next transition) through Javascript.
Almost every example on the web shows how to start workflow, and from the dashlet I could call task command processor (/alfresco/command/task/end/[/transition]) if I knew the task ID, but how do I do the same thing from server-side web script starting only from the document reference?
There must be a way to access workflows from document and manage them programatically.

A: From a document nodeRef you can signal the current task like this:
var docNodeRef = "workspace://SpacesStore/<GUID HERE>";
var transitionId = "some action";
var theDocument = search.findNode(docNodeRef);
foreach  (currWorkflow in theDocument.activeWorkflows)
{
    var path = currWorkflow.paths[currWorkflow.paths.length-1];
    var task = path.tasks[0];
    for (var transitionKey in task.transitions)
    {
        if (task.transitions[transitionKey] == transitionId)
        {
            path.signal(transitionId);
            break;
        }
    }
}

If you want to signal the default transition you can skip the inner loop and just do this:
var docNodeRef = "workspace://SpacesStore/<GUID HERE>";
var transitionId = "some action";
var theDocument = search.findNode(docNodeRef);
foreach  (currWorkflow in theDocument.activeWorkflows)
{
    var path = currWorkflow.paths[currWorkflow.paths.length-1];
    var task = path.tasks[0];
    // Signal default transition
    path.signal(null);
}

A: Well, I still don't know how to transition, but there are a couple of things I found out.
First, I can access workflows document participates in and cancel it:
for each (workflow in document.activeWorkflows) {
    workflow.cancel();
}

However, I'm still not quite sure how to progress tasks. I can get to the task and do something with it:
var task = workflow.getTask(taskId);
task.endTask(transitionId);

...but I still have no idea how to get to taskId or transitionId, either programmatically or through Alfresco.
EDIT: figured it out, transitionId is actually transition name as defined in workflow processdefinition XML:
<transition name="SomeTransitionId" to="end">

Also, to get list of tasks from the workflow you can iterate through paths (workflow.getPaths()) and then through tasks with path.getTasks().


text:
Q: Is it possible to translate protocol in wso2 I am new in WSO2 and I want to know is it possible to translate protocols in wso2.
For example, translating HTTP/REST into MQTT or CoAP and vice versa.
Regard

A: Yes this is possible. Please refer this sample. It showcases both scenarios you are requesting.
Tishan


text:
Q: java: Bad Time with methods, not returning what it´s supposed too. I´ve been debugging this for hours now. Detecting collision. this code bellow works fine.
while (numberOfTurns >= 0)
            {
        GObject collision = getElementAt(ball.getX(),ball.getY());
        }

It will get any graphical object the ball collides with on screen and return it. However, this is not how I want to design the program. But instead make a seperate method for collision detection, like bellow:
    while (numberOfTurns >= 0)
        {
        getCollidingObject();
        }

Here is the method, it just returns itself
private GObject getCollidingObject()
{
    return getElementAt (ball.getX(),ball.getY());
}

then I assign it to this private instance variable
private GObject collider = getCollidingObject();

But!!! it does not work, it just returns null. the first code snippet i posted works fine... anyone knows what is happening here?

A: You say that you're assigning the return value of getCollidingObject() to a private instance variable. With the code you posted, that call is being made once on construction of your object, not every time you want the result. Try:
while (numberOfTurns >= 0)
    {
    GObject collision = getCollidingObject();
    }


text:
Q: UITabBar on top or any other? I'm new to swift, going to create an UI in that a tabor is being shown in it , As i gone through the apple's human interface guidelines , they said not use UITabBar on top. We can use it by custom , but many of them said while submitting in App Store it will get rejected.
So instead of UITabar what should use for the tab on top?

A: You should use a segmented control in the navigation bar, as in this example form the iOS Human Interface Guidelines:
https://developer.apple.com/ios/human-interface-guidelines/ui-controls/segmented-controls/

A: Is it possible? Sure, but it violates the human interface guidelines.
Swift Version
import UIKit

class TabViewController: UITabBarController, UITabBarControllerDelegate {

override func viewDidLoad() {
  super.viewDidLoad()
  self.delegate = self
  // Do any additional setup after loading the view.
}
override func viewWillLayoutSubviews() {
 super.viewWillLayoutSubviews()
 self.tabBar.invalidateIntrinsicContentSize()
 var tabSize: CGFloat = 44.0
 let orientation = UIApplication.sharedApplication().statusBarOrientation
 if UIInterfaceOrientationIsLandscape(orientation)
 {
    tabSize = 32.0;
 }
 var tabFrame = self.tabBar.frame
 tabFrame.size.height = tabSize
 tabFrame.origin.y = self.view.frame.origin.y
 self.tabBar.frame = tabFrame
 self.tabBar.translucent = false
 self.tabBar.translucent = true
}
  override func didReceiveMemoryWarning() {
  super.didReceiveMemoryWarning()
  // Dispose of any resources that can be recreated.
}
 /*
 // MARK: - Navigation

 // In a storyboard-based application, you will often want to do a little preparation before navigation
  override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
 }
 */
}


text:
Q: Selecting all except one element with Javascript i am making a javascript effect which goes like:
it will have a couple of images. when the user hovers over the current image all the other images fadeout but the image that the mouse is over stays the same.
kinda like opposite to "this" keyword.
like: suppose the following are three images

if the user takes his mouse over the '2' img then all the other (1 and 3) should fadeout but '2' should remain the same.
http://74.53.198.125/~elven/ameer/csstemplate/

A: $('a:not(:hover)')

If I get the question right. This if your framework is supporting :hover in selector engine (jQuery does, for example). Otherwise, you can bind on hover event and mimic it.

A: <script src="http//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js"></script>
<script>
$('img').hover(function(){
    $('img:not(:hover)').fadeOut();
});
</script>

A: You could give all the images the same class and use .each() function to fade all of them and unfade just the one that has the mouse over
$('.imgClass').mouseover(function(){

        $(".imgClass").each(function(){

            $(this).fadeOut();

        })

        $(this).fadeIn();
});

When the mouse is out
     $(".abcd").mouseout(function(){

            $(".abcd").each(function(){

                $(this).fadeIn();

            })

          })

A: I'm leaving the fading part ;)
var foo = function(a,where){
  var length = where.getElementsByTagName('img').length;
  for(var i=0; i<length;i++){
    var img = where.getElementsByTagName('img')[i];
    if(img != a){ // all images except the hovered image
      img.style.display = 'none';
    }
    else{ // the hovered one
      img.style.display = 'block';
    }
  }
}

style.display.. is no fading.. that part is up to you ;)
use it like this
<img src="...." onmouseover="foo(this,document.getElementById('divContainerForAllMyImages'));" />


text:
Q: Finding N contiguous zero bits in an integer to the left of the MSB position of another integer The problem is: given an integer val1 find the position of the highest bit set (Most Significant Bit) then, given a second integer val2 find a contiguous region of unset bits to the left of the position yielded from the first integer. width specifies the minimum number of unset bits that must be found in contiguity (ie width zeros without ones within them).
Here is the C code for my solution:
#include <limits.h> /* for CHAR_BIT - number of bits in a char */

typedef unsigned int t;
unsigned const t_bits = sizeof(t) * CHAR_BIT;

_Bool test_fit_within_left_of_msb(  unsigned width,
                                    t val1, /* integer to find MSB of */
                                    t val2, /* integer to find width zero bits in */
                                    unsigned* offset_result)
{
    unsigned offbit = 0; /* 0 starts at high bit */
    unsigned msb = 0;
    t mask;
    t b;

    while(val1 >>= 1) /* find MSB! */
        ++msb;

    while(offbit + width < t_bits - msb)
    {
        /* mask width bits starting at offbit */
        mask = (((t)1 << width) - 1) << (t_bits - width - offbit);
        b = val2 & mask;

        if (!b) /* result! no bits set, we can use this */
        {
            *offset_result = offbit;
            return true;
        }

        if (offbit++) /* this conditional bothers me! */
            b <<= offbit - 1;

        while(b <<= 1)
            offbit++; /* increment offbit past all bits set */
    }
    return false; /* no region of width zero bits found, bummer. */
}

Aside from faster ways of finding the MSB of the first integer, the commented test for a zero offbit seems a bit extraneous, but necessary to skip the highest bit of type t if it is set. Unconditionally left shifting b by offbit - 1 bits will result in an infinite loop and the mask never gets past the 1 in the high bit of val2 (otherwise, if the high bit is zero no problem).
I have also implemented similar algorithms but working to the right of the MSB of the first number, so they don't require this seemingly extra condition.
How can I get rid of this extra condition, or even, are there far more optimal solutions?
Edit: Some background not strictly required. The offset result is a count of bits from the high bit, not from the low bit as maybe expected. This will be part of a wider algorithm which scans a 2D array for a 2D area of zero bits.
Here, for testing, the algorithm has been simplified. val1 represents the first integer which does not have all bits set found in a row of the 2D array. From this the 2D version would scan down which is what val2 represents.
Here's some output showing success and failure:
t_bits:32
     t_high: 10000000000000000000000000000000 ( 2147483648 )
---------

-----------------------------------
*** fit within left of msb test ***
-----------------------------------
      val1:  00000000000000000000000010000000 ( 128 )
      val2:  01000001000100000000100100001001 ( 1091569929 )
msb:   7
offbit:0 + width: 8 = 8
      mask:  11111111000000000000000000000000 ( 4278190080 )
      b:     01000001000000000000000000000000 ( 1090519040 )
offbit:8 + width: 8 = 16
      mask:  00000000111111110000000000000000 ( 16711680 )
      b:     00000000000100000000000000000000 ( 1048576 )
offbit:12 + width: 8 = 20
      mask:  00000000000011111111000000000000 ( 1044480 )
      b:     00000000000000000000000000000000 ( 0 )
offbit:12
iters:10

***** found room for width:8 at offset: 12 *****

-----------------------------------
*** fit within left of msb test ***
-----------------------------------
      val1:  00000000000000000000000001000000 ( 64 )
      val2:  00010000000000001000010001000001 ( 268469313 )
msb:   6
offbit:0 + width: 13 = 13
      mask:  11111111111110000000000000000000 ( 4294443008 )
      b:     00010000000000000000000000000000 ( 268435456 )
offbit:4 + width: 13 = 17
      mask:  00001111111111111000000000000000 ( 268402688 )
      b:     00000000000000001000000000000000 ( 32768 )
 ***** mask: 00001111111111111000000000000000 ( 268402688 )
offbit:17
iters:15

***** no room found for width:13 *****

(iters is the count of iterations of the inner while loop, b is result val2 & mask)

A: This http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogObvious has several ways to calcuate the unsigned integer log base 2 of an unsigned integer (which is also the position of the highest bit set).
I think that this is part of what you want.  I suspect that if I really knew what you want I could suggest a better way of calculating it or something that served the same purpose.

A: count_leading_zero_bits is often a single instruction that the compiler will provide an inline function for.  otherwise put it in a loop.
count_trailing_zero_bits can use count_leading_zero_bits(x&-x) or a debruijn lookup if the former is a loop.
for simplicity I assume 32 bit values.
int offset_of_zero_bits_over_msb_of_other_value( unsigned width , unsigned value , unsigned other ) {
  int count = 0;
  int offset = -1;
  int last = 1;
  int lz = count_leading_zero_bits( other );
  other |= ((1<<(32-lz2))-1); // set all bits below msb
  if ( value & ~other ) {
    value |= other; // set all bits below msb of other
    value = ~value; // invert so zeros are ones
    while ( value && count < width ) {
      count += 1; // the widest run of zeros
      last = value; // for counting trailing zeros
      value &= value >> 1; // clear leading ones from groups
    }
    offset = count_trailing_zero_bits( last );
  } else {
    count = lz2;
    offset = 32 - lz2;
  }
  return ( count < width ) ? -1 : offset;
}

The idea behind the code is this:
  val1:  00000000000000000000000010000000 ( 128 )
  val2:  01000001000100000000100100001001 ( 1091569929 )
  lz1:   24
  lz2:   1
  val2:  01000001000100000000100011111111 // |= ((1<<(32-lz1))-1);
  val2:  10111110111011111111011100000000 // = ~val2
  val2:  00011110011001111111001100000000 // &= val2>>1 , count = 1
  val2:  00001110001000111111000100000000 // &= val2>>1 , count = 2
  val2:  00000110000000011111000000000000 // &= val2>>1 , count = 3
  val2:  00000010000000001111000000000000 // &= val2>>1 , count = 4
  val2:  00000000000000000111000000000000 // &= val2>>1 , count = 5
  val2:  00000000000000000011000000000000 // &= val2>>1 , count = 6
  val2:  00000000000000000001000000000000 // &= val2>>1 , count = 7
  val2:  00000000000000000000000000000000 // &= val2>>1 , count = 8

So at each step, all ranges of zeros, now ones, are shrunken from the right.  When the value is zero, the number of steps taken is the width of the widest run.  At any point, counting the number of trailing zeros will give the offset to the nearest range of at least count zeros.
If at any point count exceeds width, you can stop iterating.  The maximum number of iteration is thus width, not the word size.  You could make this O(log n) of width, because you can double the shift amount at each iteration as long as you do not exceed width.
Here is a DeBruijn lookup for counting trailing zero bits for 32 bit values.
static const int MultiplyDeBruijnBitPosition[32] = {
  0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,
  31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9
};
r = MultiplyDeBruijnBitPosition[((uint32_t)((v & -v) * 0x077CB531U)) >> 27];

I noticed that in both your examples, val1 had only a single bit set.  If that is the case, you can use the DeBruijn trick to find the MSB.

A: Here is my new and improved algorithm:
int test_fit_within_left_of_msb(  unsigned width,
                                  unsigned val1,
                                  unsigned val2 )
{
    int offset = 32;
    int msb = 0;
    unsigned mask;
    unsigned b;

    msb = 32 - __builtin_clz(val1); /* GCC builtin to count Leading Zeros */

    while(offset - width > msb)
    {
        mask = (((unsigned)1 << width) - 1) << (offset - width);
        b = val2 & mask;

        if (!b)
            return 32 - offset;

        offset = __builtin_ctz(b); /* GCC builtin to Count Trailing Zeros */
    }

    return -1;
}

This code has a lot of improvements over my initial implementation. Primarily, the removal of the inner while loop by simply counting the trailing zero bits. Secondly, I have also made the algorithm work with an offset that uses the natural bit position values and thus removed some of the addition and subtraction operations my original used, until the successful return statement. You could nit pick over subtracting the offset from 32.
The important point here in the code, is the algorithm - I realize there are portability concerns and assumptions made about types and there sizes. Looking back up the page to the output where width 8 can be found at position 12 performed in 10 iterations, the new alogirthm does the same in 2 iterations of the loop.
I've used the GCC builtins for convenience here, the MultiplyDeBruijnBitPosition code that drawonward provided ( from: http://graphics.stanford.edu/~seander/bithacks.html#ZerosOnRightMultLookup ) can be used to replace __builtin_ctz, while  __bultin_clz could be replaced with one of the integer log base 2 codes from the same page.
One concern here though, is the data (with sparsely set bits) I've used to test this with makes this algorithm perform better, this will maybe not be so great looking at integers with more densely set bits. (Not correct - by counting the trailing zeros it avoids this bad case).

A: After implementing my previous answer but to work for the right of the MSB, I saw that aside from a very minor difference, the left and right versions were exactly the same. This lead to the realization there is no real requirement for the algorithm to be working with an MSB from some prior value at all.
So although this answer does not meet the specifications of the question, it is the correct answer because the specification was incorrect.
#include<stdint.h>

/* returns bit position within a 32bit integer, where
   a region of contiguous zero bits can be found whose
   count is equal to or greater than width. it returns
   -1 on failure.
*/

int binary_width_fit( unsigned width, uint32_t val )
{
    int offset = 32;
    uint32_t mask;
    uint32_t b;

    while(offset >= width)
    {
        mask = (((uint32_t)1 << width) - 1) << (offset - width);
        b = val & mask;
        if (!b)
            return offset;
        offset = __builtin_ctz(b); /* GCC builtin to Count Trailing Zeros */
    }
    return -1;
}

A: 1 (fast) method is to use precalculated LOOKUP TABLES (LUTs) for each 8bit byte:
PosOfFirst1, PosOfLast1, PosOfFirst0, PosOfLast0   -- all arrays of 256 bytes
Precalculate the tables using: (soz for poor, pascalish pseudocode)
PosOfLast1:
FOR EACH ByteVal (0..255):

if byteVal>127 return 8
elseif byteVal>63 return 7
...
elseif byteVal>0 return 1
else return 0

PosOfFirst1:

c:=0;
while c<8 do
begin
bv = byteVal and 1;
if bv=1 then return c
else byteval shr 1;
inc (c);
end;

I use simple assembler procs for these algs. PosOfFirst0 and PosOfLast0 LUTs can be pre-calced using these 2 tables also - as can TRAILING & LEADING 0 (or 1) count. It's useful to pre-calc 'minus 1' versions of these tables too....
You can then use (for 8bit bytes)
var InputByte: Byte;
FirstBit:=PosOfFirst1[InputByte] // v.fast
For larger sizes (0, 16, 24, 32 +++++) use procs and loops that check each constituent 8bit byte. Memory access to the LUT may be needed but this method is still faster:
a) Can be used easily without needing a procedure call.
b) scanning a 32 bit number takes 1 shift & comparison to 0 per byte with 1 lookup needed (if a non-zero byte is found) instead of n (0..32) shifts, ands and comparisons...
c) if programmed well will halt after finding 1st/last 1
The LUT principle applies to 'population count' + other bit manip. routines...
Cheers, PrivateSi
FASTER IS BETTER?!