text:
Q: onOptionsItemSelected is never called I'm following this tutorial, and I'm writing a simple Activity.
...
UPDATE: After your tips I've edited my app, but the method onOptionsItemSelected() is still not called when I select an item from the popup menu. The popup menu is inflated when the user click on an item from the action bar.
The activity:
public class Map extends AppCompatActivity implements
    GoogleMap.OnMapLongClickListener, GoogleMap.OnMarkerClickListener,
    GoogleMap.OnMapClickListener, OnMapReadyCallback,
    ResourceState.OnResourceStateChangeListener {

...

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    Map.menu = menu;
    getMenuInflater().inflate(R.menu.map_menu, menu);
    return super.onCreateOptionsMenu(menu);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {

        ...

        case R.id.menu_item_map_type:
            // Here I show the popup
            PopupMenu popup = new PopupMenu(this, findViewById(R.id.menu_item_map_type));
            popup.getMenuInflater().inflate(R.menu.map_popup, popup.getMenu());
            popup.show();
            break;

        case R.id.menu_item_satellite:
            // here the method onOptionsItemSelected is not directly called
            break;

        case R.id.menu_item_street:
            // here the method onOptionsItemSelected is not directly called
            break;
    }

    return super.onOptionsItemSelected(item);
}

public void callOnOptionsItemSelected(MenuItem item) {
    onOptionsItemSelected(item);
}

...

}
The primary menu:
<?xml version="1.0" encoding="utf-8"?>
<menu
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto" >

    <item android:id="@+id/menu_item_send"
          android:icon="@drawable/ic_send"
          android:title="send"
          app:showAsAction="ifRoom"/>

    <item android:id="@+id/menu_item_location"
          android:icon="@drawable/ic_location_on"
          android:title="my position"
          app:showAsAction="ifRoom"/>

    <item android:id="@+id/menu_item_map_type"
          android:icon="@drawable/ic_map"
          android:title="map view"
          app:showAsAction="ifRoom"/>

</menu>

The popup menu:
<?xml version="1.0" encoding="utf-8"?>
<menu
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" >

    <item
        android:id="@+id/menu_item_satellite"
        android:title="satellite"
        android:checkable="true"
        android:onClick="callOnOptionsItemSelected"/>

    <item
        android:id="@+id/menu_item_street"
        android:title="street"
        android:checkable="true"
        android:onClick="callOnOptionsItemSelected" />

</menu>

My temporary solution is defining the method callOnOptionsItemSelected(), wich calls the method onOptionsItemSelected(). By the way, I'd like to know what I'm missing.
(Another issue related to the popup is that the method setChecked() of the class MenuItem, is not working.)

A: I don't know why you add
android:id="@+id/layout_map_popup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"

in your  menu.xml file


text:
Q: Get current time javascript + 1 hour (minutes bug) Hi I currently have a script running that shows the current time + 1 hour, the issue i'm having is that every hour at the first 9 minutes the 0 is not showing up* and somehow I just can't find the solution.
*Example: 9:1am instead of 9:01am
I like Moments.js but in this case I can't use an external library

var now = new Date;
now.setHours(now.getHours() + 1);
var isPM = now.getHours() >= 12,
  isMidday = 12 == now.getHours(),
  result = document.querySelector("#result"),
  time = [now.getHours() - (isPM && !isMidday ? 12 : 0), now.getMinutes() || "00"].join(":") + (isPM ? " pm" : "am");

function addTime(t) {
  for (var s in t) {
    var e = s.substr(0, 1).toUpperCase() + s.substr(1);
    this["set" + e](this["get" + e]() + t[s])
  }
  return this
}

function showTime(t) {
  var s = function() {
    return this < 10 ? "0" + this : this
  };
  if (t) return [s.call(this.getHours()), s.call(this.getMinutes()), s.call(this.getSeconds())].join(":");
  var e = this.getHours() >= 12,
    i = 12 == this.getHours();
  return time = [s.call(this.getHours() - (e && !i ? 12 : 0)), s.call(this.getMinutes()), s.call(this.getSeconds())].join(":") + (e ? " pm" : " am")
}
result.innerHTML = time;

A: It looks like a lot of your code isn't actually getting called, it looks like only the lines that influence the output are these:
var now = new Date;
now.setHours(now.getHours() + 1);
var isPM = now.getHours() >= 12, isMidday = 12 == now.getHours(), result = document.querySelector("#result"),
time = [now.getHours() - (isPM && !isMidday ? 12 : 0), now.getMinutes() || "00"].join(":") + (isPM ? " pm" : "am");
result.innerHTML = time;

The most relevant chunk being:
now.getMinutes() || "00"

The reason you're getting the un-padded minute in your example is because you're only handling if now.getMinutes() is exactly 0, skipping the 1-9 case. In order to fix this you could simply do this instead:
(now.getMinutes() < 10) ? "0" + now.getMinutes() : "" + now.getMinutes()

As others have alluded to, formatting dates correctly and doing date arithmetic can be pretty tricky especially if you're handling things like time zones and different locales. Using a library like Moment.js is a really good idea.

A: Not an actual answer to solve the problem in your code, but why don't you use something like https://momentjs.com/ ?
var timeToShow = moment().add(1, 'hour').format('h:mma');  //9:02am

A: Your issue is in the assignment statement for time. The call to now.getMinutes() does not return minutes 1-9 as '01', '02', ..., it returns them as '1', '2', etc.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Android: client secret key is missing for OAuth 2.0 I am trying to upload videos to youtube using my Android application. But first of all, I must implement the OAuth authentication protocol. Luckily, I am able to access the redirect_uri and the auto generated code. Now, I want the exchange the authorization code for access tokens but for that I need to have the client_secret for making the POST request to the google server. Unlucky for me, there is no client_secret key in my google console account.
I have tried to download the JSON object from console but there isn't any client_secret key.

A: Android OAuth2 client doesn't have a client_secret since there is no way you can store a secret on client side securely. Instead, you should use GoogleAuthUtil from google-play-services to get an access token for your Android app and use the toke to upload videos. This blog post explains more on how to get an access token on Android.


text:
Q: What could be the possible HTML structure for this, using bootstrap I want to know that what could be possible HTML structure of the image(in link) below, if i use bootstrap.
https://www.dropbox.com/s/y7jcvuvehr9a4br/html.jpg?dl=0

A: Here, I found the solution and adjusted according to my needs.
[codepen](http://codepen.io/escapedcat/pen/eoka)


text:
Q: Can anyone identify this Visual Studio 2010 extension? I'm not sure what extension is painting the "Comment Bubbles" seen in this screenshot.

I've gone through the extensions that I knowingly installed and do not see an option to turn it off.  Either it's coming from an extension I don't know about, or it's an option in one of the ones I looked at but missed.  Any help would be appreciated.

A: It's devExpress.  Go to DevExpress-> Options
Expand Editor -> Painting and then go to Comment Painter.  Uncheck enabled.


text:
Q: Fuzzy Match of a column with respect to position of strings How do we find the Fuzzy Match of a column with itself in Python?
For example: ABC12340 and ABC12304 -> it shows a score of 90 (with fuzz.ratio)
ABC12340 and ABC12350 -> it shows a score of 90 (with fuzz.ratio)
fuzz.ratio('ABC12340', 'ABC12304') -\> 90
fuzz.ratio('ABC12340', 'ABC12350') -\>90

In the second case, the output of the function must have impact on the position of strings but it shows same score.
The reason why the position is important is that Company makes a small change in last few digits while renewing the contract.
Kindly suggest what function should I use.
Thanks in advance
I have tried :
fuzz.ratio('ABC12340', 'ABC12304') -\> 90
fuzz.ratio('ABC12340', 'ABC12350') -\>90

A: To solve this we can use a combination of fuzz.ratio and Jaccard similarity score. Jaccard Similarity score is simply the ratio of the intersection divided by the union. So for example, if 2 strings have the same characters but the position is different the 1-fuzz.ratio will give you the dissimilarity score between those 2 strings. And, if 2 strings have different characters 1-Jaccard score would give the dissimilarity score between those 2 strings. And if Both position and characters are different we will use the max of both scores to quantify the dissimilarity.
def dissimilar_score(s1, s2):
    a = set(s1)
    b = set(s2)
    jacccard_score =  1 - len(a.intersection(b)) / len(a.union(b))
    fuzz_ratio = (100 - fuzz.ratio(s1,s2))/100
    return max(jacccard_score, fuzz_ratio)

>>> print(dissimilar_score('ABC12340', 'ABC12304'), dissimilar_score('ABC12340', 'ABC12350'))
>>> (0.12, 0.2222222222222222)


text:
Q: Renders in python but not in kivy language This code:
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.label import Label
from kivy.uix.textinput import TextInput

class LoginScreen(GridLayout):

 def __init__(self, **kwargs):
     super(LoginScreen, self).__init__(**kwargs)
     self.cols = 2
     self.add_widget(Label(text='User Name'))
     self.username = TextInput(multiline=False)
     self.add_widget(self.username)
     self.add_widget(Label(text='password'))
     self.password = TextInput(password=True, multiline=False)
     self.add_widget(self.password)

class MyApp(App):

 def build(self):
     return LoginScreen()

if __name__ == '__main__':
 MyApp().run()

Works as expected and produces this window (window is a bit resized):

However when implementing the same example in the kivy language It fails:
Python file:
from kivy.app import App
from kivy.uix.gridlayout import GridLayout

class LoginScreen(GridLayout):
    pass

class MyApp(App):
    def build(self):
        return LoginScreen()

if __name__ == '__main__':
    MyApp().run()

my.kv file:
#:kivy 1.0

<LoginScreen>:
    GridLayout:
        cols: 2
        Label:
            text: "Username"
        TextInput:
            multiline: False

        Label:
            text: "Password"
        TextInput:
            multiline: False

Produces (A bit resized again):

Why is this and How can I possibly fix it?

A: You don't need create GridLayout in kivy file.
Remove GridLayout: from the my.kv file as follow:
#:kivy 1.0

<LoginScreen>:
    cols: 2
    Label:
        text: "Username"
    TextInput:
        multiline: False

    Label:
        text: "Password"
    TextInput:
        multiline: False

Otherwise, another GridLayout inside LoginScreen is created.


text:
Q: Rails production with puma and nginx puma.sock missing I'm setting up my rails production server on digital ocean with puma and nginx.
Following tutotials I have entered this in my /etc/nginx/sites-available/default
server unix:/home/deploy/appname/shared/sockets/puma.sock fail_timeout=0;

But on the server the folder home/deploy/appname/shared/sockets/ is empty.
I double checked the tutorials and none of them mentions creating such file.
If I run ps aux | grep pumaI get

root      2076  0.0  0.3  52992  3544 pts/0    T    05:51   0:00 sudo
  nano require capistrano/puma root      2077  0.0  0.3  23872  3888
  pts/0    T    05:51   0:00 nano require capistrano/puma rails     2407
  0.0  0.0  14484  1012 pts/0    S+   06:38   0:00 grep puma

which it doesn't really makes sense to me as I'm not using capistrano.
My question is. How is puma.sock created? During puma installation? What step have I missed if that directory is empty?

A: Without capistrano you need to start puma with -b option to create sock file:
puma -b unix:///__abs_path_to_your_app__/puma.sock

and in /etc/nginx/sites-available/default you need to change path to .sock file:
server unix:///__abs_path_to_your_app__/puma.sock fail_timeout=0;


text:
Q: iPhone's class equivalent in Mac I have to migrate a iPhone application to Mac OSx.
Anybody knows where I can find a equivalence between the iPhone class (lets say UITableViewController) and the Mac equivalent?
Tankes

A: Same language, different SDK. All the UI classes are different, though Foundation is mostly the same.
There is no equivalent to UITableViewController, for instance, as there is no UITableView, and NSTableView works very differently.
Cocoa With Love has some useful info on making something similar on the Mac.


text:
Q: C++ Outputting to an Excel file Is there a way to output to an excel file but to assign what you're outputting to a specific cell in the excel file?
For example have an array be cell x 1-50 or something like this.

A: There are some C++ libraries for that. An example of a free one is xlsstream  and a commercial one would be LibXL. Google is your friend to find more.

A: You can output an html formatted table to a file with an xls extension. When loading it, Excel will convert it to a spreadsheet. Sample:

row 1, cell 1
row 1, cell 2

row 2, cell 1
row 2, cell 2

A: You can output data in as CSV and excel will read it just fine:
row 1 cell 1, row 1 cell 2
row 2 cell 1, row 2 cell 2


text:
Q: How to read RTDB randomly generated node and it's value? Below is my typescript code and its already connected to telegram and managed to sent a message.
Currently I'm trying to tinker with it even more by reading the randomly generated node Arduino and MQ7 created and sending it as a message on telegram.
import * as functions from "firebase-functions";
import * as express from "express";
import * as cors from "cors";
import * as admin from "firebase-admin";

admin.initializeApp();
const bot = express();

bot.use(cors( {origin: true}));

bot.post("/", async function(req, res) {
  const telegramText = req.body;
  req.body.message &&
  req.body.message.chat &&
  req.body.message.chat.id &&
  req.body.message.from &&
  req.body.message.from.first_name;

  if (telegramText) {
    const chat_id = req.body.message.chat.id;
    const first_name = req.body.message.from.first_name;
    const receivedMessage = req.body.message.text;

    //  Define your RTDB Reference
    const rtdbReference = admin.database().ref("Sensor MQ7");
    const mq7ref = rtdbReference.child("-NHi7dBPMlVi6hXrnI03");
    const valref = mq7ref.child("MQ7");
    //  Fetch the data
    const snap = await valref.get();
    const snapValue = snap.val();
    //  Inject snapvalue in the response

    return res.status(200).send({
      method: "sendMessage",
      chat_id,
      text: `${first_name}\n${receivedMessage}\n${snapValue}`,
    });
  }
  return res.status(200).send({status: "An error occured"});
});

export const router = functions.https.onRequest(bot);

The typescript code works I figured out how to read entries from the database and write it into telegram as well as learning a little bit about the reference and functions. Right now I'm trying to figure out how to output the value whenever a new node is created. The new node are randomly generated @ Arduino and mq7 gas sensor. Basically whenever the sensor picks up dangerous amount of carbon monoxide, it'll send the input to firebase, and a new node is created with a new value. I've classified the Parent = Sensor MQ7, Middle child = "randomly generated node", Last child = MQ7. Any help, advice, or recommendation is greatly appreciated. Please explain like I'm 5 because I just started doing all of it this week and I'm really really new to cloud functions. Thank you!
RTDB

A:
The typescript code (for sending to Telegram) works and right now I'm
trying to figure out how to read entries from the database and write
it into telegram

In a Cloud Function you need to use the Node.js Admin SDK to interact with the Firebase services.
Here is how to read the data at a specific Reference in the Realtime Database:
import * as functions from "firebase-functions";
import * as express from "express";
import * as cors from "cors";

import * as admin from 'firebase-admin';   <== NEW
admin.initializeApp();                     <== NEW

const bot = express();

bot.use(cors( {origin: true}));

bot.post("/", async function(req, res) {
  const telegramText = req.body;
  req.body.message &&
  req.body.message.chat &&
  req.body.message.chat.id &&
  req.body.message.from &&
  req.body.message.from.first_name;

  if (telegramText) {
    const chat_id = req.body.message.chat.id;
    const first_name = req.body.message.from.first_name;
    const receivedMessage = req.body.message.text;

    //Define your RTDB Reference
    const rtdbReference = admin.admin.database().ref('foo/bar');
    // Fetch the date
    const snap = await rtdbReference.get();
    const snapValue = snap.val();
    // Do whatever you need with snapValue to inject it in your response...

    return res.status(200).send({
      method: "sendMessage",
      chat_id,
      text: `Hello ${first_name}, \n You sent us message: ${receivedMessage}`,
    });
  }

  return res.status(200).send({status: "An error occured"});

});

export const router = functions.https.onRequest(bot);


text:
Q: Android application output verbosity with Xamarin Forms Every time I deploy Xamarin Forms to Android I get approximately 1000 [mono-assembly] messages
In the Project / Build settings, I have set the requisite option to 'Quiet'
I have also implemented an environment.txt file with following
MONO_LOG_LEVEL=error
MONO_LOG_MASK=gc

In spite of this, I cannot get rid of these messages
 [monodroid-assembly]     ZIP: local header offset: 35499804; data offset: 35499912; file size: 1683384
 [monodroid-assembly] /data/app/Mono.Android.DebugRuntime-kjbSvJffIh6KuLyEXW4fQQ==/base.apk entry: assemblies/netstandard.dll
 [monodroid-assembly]     ZIP: local header offset: 37183296; data offset: 37183408; file size: 90624
 [monodroid-assembly] /data/app/Mono.Android.DebugRuntime-kjbSvJffIh6KuLyEXW4fQQ==/base.apk entry: typemap.jm
 [monodroid-assembly]     ZIP: local header offset: 37274032; data offset: 37274128; file size: 1304780
 [monodroid-assembly] /data/app/Mono.Android.DebugRuntime-kjbSvJffIh6KuLyEXW4fQQ==/base.apk entry: typemap.mj

Please can advise what am doing wrong?


text:
Q: Create Menu Button with a Sprite im currently programming on a Menu Screen for my Game. Im trying to create a Rectangle that checks if the Sprite Button is touched . Im using Abitrary World Coordinates public static int WIDTH = 1080 , HEIGHT = 720;
    public void create() {

    cam = new OrthoCamera();
    cam.resize();

    texture = new Texture("Button.png");

    texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
    TextureRegion region = new TextureRegion(texture, 59, 52, 300,250);

    sprite = new Sprite(region);
    sprite.setSize(sprite.getWidth()  , sprite.getHeight()  )
    sprite.setPosition(MyGdxGame.WIDTH / 2, MyGdxGame.HEIGHT / 2);

}

I'm using a special Orthographic Camera, if u want to see the both relevant classes klick here. (Not my Project)
    public void update(OrthoCamera cam) {

    if(Gdx.input.isTouched())
     {

       Vector3 tmp = new Vector3( Gdx.input.getX(), Gdx.input.getY(), 0);
       cam.unproject(tmp);

       Rectangle textureBounds = new Rectangle(0,0, 300, 250); //origin at center ?!

      if(textureBounds.contains(tmp.x,tmp.y))
          {

          //ScreenManager.setScreen(new GameScreen());
            System.out.println("Rectangle")
          }
     }

     }

Trough testing i regognized that somehow the origin of the Rectangle Coordinate System is at the center and the width and height is set far to high. Here you can see a picture of the area where i get printet out "Rectangle" by clicking. Normaly the the origin of the Rectangle shoud be at the bottom left, right?

A: I would highly recommony you to use for example Scene2d. It makes it easy to create a user interface for your app.
With that you could use the ImageButton and attach a ClickListener to it, to get a callback when to button is clicked.

A: To solve the issue of the not centered coordinate system, you have to set the camera to the right position.
You can do this by using the following code:
camera.setOrtho(false);
camera.position.set(Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight()/2);
camera.update();


text:
Q: How can I convert this arrow function to a standard function? I have an arrow function, offered graciously by Ele of the community here, but for the life of me, I can't understand it:
let isValid = function (arr, arr2) {
    let sum = (array, n) => array.reduce((a, an) => a + (an === n), 0);
     return !arr2.some(n => !arr.some(an => an === n && sum(arr, an) === sum(arr2, n)))
};

Would someone be so kind as to translate this into a standard function so that I can follow it on my skill level?
Thank you.
My assumption:
function isValid (arr, arr2) {
    ...this is where i'm lost
}

A: Your assumption is correct for the outer function. The first line inside it would become:
function sum(array, n) {
    return array.reduce(function(a, an) {
        return a + (an === n);
    }, 0);

Have a read about Arrow Functions and how they differ from conventional function declarations. Mostly (but not completely), they're just syntactical sugar vs. conventional functions.
They differ most markedly in terms of context, i.e. what this points to inside the function body. Arrow functions always run in the outer, prevailing context in which the function was declared. Conventional functions, e.g. via bind(), can be repointed to a different context.
let foo = function() {
    let bar = () => this;
    return bar();
}.bind('a');
foo(); //'a', because foo()'s context is 'a'

So how about that sugar? It can look confusing at first, especially when you have multiple arrow functions in one line. One key thing to remember is that they're just implicit shorthand for things you used to have to code manually.
let foo = a => a+1;

Is the same as
function foo2(a) { return a + 1; }

(The hoisting will be different, but that's a bit beyond the scope of this answer.)
One thing we can tell from the above is there is that, where the part after => is a single statement, it's interpreted as a return value, without us having to actually write return.
foo(1); //2

This is great for simple functions that do one job expressable in one line of code. If you need more verbose functions you enclose the code in {} as  usual.
let foo3 = a => {
    return a+1;
};

This again works identically to the foo and foo2 above.
And so, finally, breaking down that fearsome line:
    let sum = (array, n) => array.reduce((a, an) => a + (an === n), 0);

It says:

*

*assign a function to the local scope variable sum

*it accepts two arguments, array and n

*it has one job to do, expressable as one line of code and so no need for binding { and } for the function body. That job is to call reduce() and return (implicitly) the value

*The first argument to reduce, the callback, accepts two arguemnts, a and an

*This callback, like the one to reduce, also has just one job to do, and that job is to return the value of a + (an === n)
One final word on the sugar, which you may have spotted above, is that, with arrow functions, if only a single argument is accepted you don't need to wrap it in brackets. Multiple arguments are, though, and comma-separated as usual.
let foo = single_arg => alert(1);
let foo2 = (arg1, arg2) => alert(2);

Hope this helps.

A: That approach uses a lot of arrow functions, and can be translated to the following standard function declarations:
let isValid = function(arr, arr2) {
  let sum = function (array, n) {
    return array.reduce(function(a, an) {
      return a + (an === n); // coercion -> true = 1, false = 0
    }, 0);
  };

  return !arr2.some(function(n) {
    let sum2 = sum(arr2, n);
    return !arr.some(function(an) {
      return an === n && sum(arr, an) === sum2;
    });
  });
};

A: You can use https://babeljs.io/ to compile from this new javscript to "old" javascript. You can try it directly on its home page.
Here's the output it gives:
var isValid = function isValid(arr, arr2) {
  var sum = function sum(array, n) {
    return array.reduce(function (a, an) {
      return a + (an === n);
    }, 0);
  };

  return !arr2.some(function (n) {
    return !arr.some(function (an) {
      return an === n && sum(arr, an) === sum(arr2, n);
    });
  });
};


text: Q: cpp application to fetch Bluetooth devices informaton I want to create a c++ application that fetch information about paired and visible blue tooth devices to a system. I want to implement this using windows api. I don't want to use winsocket program, which already I have.Thanks in advance


text:
Q: .NET memory leak? I have an MDI which has a child form. The child form has a DataGridView in it. I load huge amount of data in the datagrid view. When I close the child form the disposing method is called in which I dispose the datagridview
    this.dataGrid.Dispose();
    this.dataGrid = null;

When I close the form the memory doesn't go down. I use the .NET memory profiler to track the memory usage. I see that the memory usage goes high when I initially load the data grid (as expected) and then becomes constant when the loading is complete.
When I close the form it still remains constant. However when I take a snapshot of the memory using the memory profiler, it goes down to what it was before loading the file. Taking memory snapshot causes it to forcefully run garbage collector.
What is going on? Is there a memory leak? Or do I need to run the garbage collector forcefully?
More information:
When I am closing the form I no longer need the information. That is why I am not holding a reference to the data.
Update
It is a requirement for me to load all the data at once. The memory usage goes really high when there is a lot of data so I am wondering if I am doing something wrong and the garbage collector is not being run but on the other hand when I look at the profiler it does show that when it takes a snapshot the memory usage decreases. So I am unable to understand what is going on.

A: Setting a variable to null doesn't magically force the garbage collector to be invoked. GC'ing is an expensive process and should be avoided unless absolutely necessary, hence the collector only runs as and when it's scheduled to or if there is a need.
If you really need to ensure that memory is freed, manually invoke the garbage collector after you've nulled out your DataGrid:
this.dataGrid.Dispose();
this.dataGrid = null;
GC.Collect();

However, as Matthew Scharley noted, does it really matter if the CLR holds onto that memory? If you force it to be freed, then next time your DataGrid is populated the CLR needs to re-allocate the same amount of memory - which is slow.
Unless your DataGrid is consuming close to or more than the physical memory on your computer, leave the CLR alone - it almost certainly knows best when it comes to memory management.

A: This is normal. The garbage collector runs on it's own time, as needed. The fact that it returns to normal when the garbage collector is forced means there's no leak or permanent references keeping things around.
The real question is: Does the garbage collector need to be run? Are you using more RAM than you have physically? If not, does it really matter if you're using a bunch of physical RAM that nothing else needs?
Another really good question is, do you really need to load all the data into your application at once? But there's no way of answering that without more information.

A: Garbage collection does not happen just because you null the reference. If you object is no longer reference it will be collected at some point. Just because it is still around for a little while does not mean you have a memory leak. Furthermore even if you do garbage collect the memory will not necessarily be release to the OS immediately, so you may not see a drop in memory usage for the application.

A: This is a useful tool for tracking down memory leaks:
SysInternals Process Explorer

A: GC.WaitForPendingFinalizers(); - that helped me.


text:
Q: Range of a function, with contradictory restriction I have this function:
$$f(x)=\frac{x}{x^2+1}$$
it's clear that the domain is all real numbers, because the denominator never become zero. I've done the following procedure to found the range of $f(x)$:
$\operatorname{Rec} f=\left \{{y\in \mathbb{R}:\exists x\in \operatorname{Dom} f,y=f(x)}  \right \} \\
\operatorname{Rec} f=\left \{{y\in \mathbb{R}:\exists x\in \mathbb{R},y=\dfrac{x}{x^2+1}}  \right \} \\
\operatorname{Rec} f=\left \{{y\in \mathbb{R}:\exists x\in \mathbb{R},x=\dfrac{1\pm \sqrt{1-4y}}{2y}}  \right \} \\
\operatorname{Rec} f=\left \{{y\in \mathbb{R}:\left (1-4y^2  \right )\geq 0\, \wedge\, y\neq 0 }  \right \}\\
\operatorname{Rec} f=[-\tfrac{1}{2},\tfrac{1}{2}]-\left \{ 0 \right \}$
But, the function is zero when $x=0$ $(f(0)=0)$, and the range of the function is $[-\tfrac{1}{2}, \tfrac{1}{2}]$. So I don't know where is my error in the procedure.

A: You have the equation $y = \frac{x}{x^2 + 1}$, which you then simplified to $x^2y + y - x = 0$. Then, solving this for $x$ gives you $\frac{1 \pm \sqrt{1-4y^2}}{2}$, which is all good, very good, until...
If $y = 0$, then the above is not even a quadratic equation, so you cannot approach it through the quadratic formula! Instead, you must deal with such a case separately, by setting $y = 0$, which gives $x = 0$.

Moral of the (real) story :  The quadratic formula applies only when the quadratic coefficient is non-zero. Otherwise, such a quadratic simplifies to a linear (possibly, even better) equation which can be solved.

A: Note that $f(0) = 0$ and $f(x)\to0$ as $x\to\infty$ and $f(x)>0$ when $x>0,$ and $f$ is everywhere continuous. That implies that as $x$ goes from $0$ to $\infty,$ then $f(x)$ must go up from $0$ and ultimately back down to $0.$ Thus $f$ has an absolute maximum somewhere to the right of $0.$ And $f(x)$ must assume all intermediate values between $0$ and that maximum.
Next:
$$
\frac x {x^2+1} = \overbrace{ \frac 1 {x + \frac 1 x} = \frac 1 {\left( x - 2 + \frac 1 x \right) + 2} }^\text{This is a sort of completion of the square} = \frac 1 {\left( \sqrt x - \frac 1 {\sqrt x} \right)^2 + 2}.
$$
This is equal to $1/2$ when the square is $0;$ otherwise it is less than $1/2.$
Thus $f$ maps $[0,\infty)$ to $[0,1/2].$
Since $f$ is an odd function, it therefore maps $(-\infty,0]$ to $[-1/2,0].$

A: You have that $\operatorname{Ran} f= \{0\}\cup\{y: y\neq 0\}$. What you did was to solve for the case $y \neq 0$. Every thing else is fine with your solution.

A: You lost the point $0$ from the range when you applied the quadratic formula. It implicitly assumes that you're dealing with a quadratic. The solution to
$$ax^2 + bx + c = 0$$
is
$$x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a},$$
provided $a \neq 0$. If $a = 0$, then this equation becomes linear, and the quadratic formula becomes nonsense.

A: $$f(x)=\frac{x}{x^2+1}$$
Since the function is an odd function $(f(x)=-f(-x))$,  then the minimum value is equal to the opposite of the maximum value. We see that $f(x) \ge 0$ when $x \ge 0$, so we need to find the maximum value of $f(x)$ when $x \ge 0$.
Note that
$\dfrac 12 - f(x) = \dfrac 12 - \dfrac{x}{x^2+1}
                  = \dfrac{x^2+1-2x}{2(x^2+1)}
                  = \dfrac{(x-1)^2}{2(x^2+1)}$
So, when $x \ge 0$, we see that $\dfrac 12 - f(x) \ge 0$ and, when $x=1$, we see that $\dfrac 12 - f(x) = 0$.
Since $\dfrac 12 - f(x) \ge 0 \iff f(x) \le \dfrac 12$ and $f(1)= \dfrac 12$, we see that $\displaystyle \max_{x \ge 0} f(x) = \dfrac 12$. Hence, because $f(x)$ is an odd function, $\operatorname{Range} f(x) = \left[ -\dfrac 12, \dfrac 12 \right]$


text:
Q: Search table based on 2 criteria and manipulate and add entries to a new column I have a list of data to which I would like to add comments based on older versions of the list which is another worksheet in the same workbook.

Now I tried an approach with two loops (the first one actually looking if there was a comment in a given row and then the second looking for the criterias in every row of the new sheet and adding a comment if necessary) but it turned out way too slow. There are around 15 000 entries in each sheet and around 6500 entries with comments in the older sheets.
I need a faster way for getting the comments from the old sheet to the new sheet. As you can see, certain combinations of criterias in the older sheets might have multiple corresponding combinations in a newer sheet. In that case, I need the comment in ALL rows that fit the criteria.

A: Use a Scripting.Dictionary object to identify the a unique list of the first two columns while collecting a list of the comments IDs.
Option Explicit

Sub copyCommentIDs()
    Dim a As Long, b As Long, aCOMs As Variant, k As Variant
    Dim d As Long, dCOMs As Object

    Set dCOMs = CreateObject("Scripting.Dictionary")
    dCOMs.comparemode = vbTextCompare

    With Worksheets("Sheet19")
        'collect data from Old Sheet into an array
        aCOMs = .Range(.Cells(3, "E"), .Cells(.Rows.Count, "G").End(xlUp)).Value2
    End With

    'build dictionary; collect comment IDs
    For a = LBound(aCOMs, 1) To UBound(aCOMs, 1)
        'if there a comment ID?
        If CBool(Len(Trim(aCOMs(a, 3)))) Then
            'concatenate/deliminate the first two columns
            k = Join(Array(aCOMs(a, 1), aCOMs(a, 2)), ChrW(8203))
            'does it exist in the dictionary?
            If dCOMs.exists(k) Then
                'it exists; concatenate the comment id onto the dict. key's item
                dCOMs.Item(k) = Join(Array(dCOMs.Item(k), aCOMs(a, 3)), ", ")
            Else
                'does not exist; add a new dict key/item pair
                dCOMs.Item(k) = aCOMs(a, 3)
            End If
        End If
    Next a

    With Worksheets("Sheet19")
        'return the dictionay items to the new sheet
        For b = 3 To .Cells(.Rows.Count, "A").End(xlUp).Row
            'concatenate/deliminate the first two columns
            k = Join(Array(.Cells(b, "A").Value2, .Cells(b, "B").Value2), ChrW(8203))
            'does it exist in the dictionary?
            If dCOMs.exists(k) Then
                'transfer the comment id
                .Cells(b, "C") = dCOMs.Item(k)
            End If
        Next b
    End With

    'clean up
    Erase aCOMs
    dCOMs.RemoveAll: Set dCOMs = Nothing
End Sub


text:
Q: Old or older people Which is grammatically correct?

Old people are often lonely.

Or

Older people are often lonely.

I understand context matters. I just want to know when it is right to use one or the other.

A: The phrase older people is a euphemism for old people.


text:
Q: Парсинг текста со страницы и передача в List C# Здравствуйте, такая вот проблема
Мне надо спарсить прокси со страницы, а затем передать их в List.
public static List<string> ProxyList = new List<string>();

Но у меня вот такая ошибка.
Сам код парсинга прокси:
 string URLProxy = client.DownloadString("http://awmproxy.com/freeproxy_2356428077.txt?");

Подскажите пожалуйста, как мне это нормально реализовать?
Заранее спасибо.

A: Нужно разбить полученные данные на строки (метод Split) и добавить их в список (метод AddRange):
ProxyList.AddRange(URLProxy.Split());


text:
Q: Can "just" and "already" be used with past tense and with a specific time? Can "just" and "already" be used with past tense and with a specific time?
Example 1

I just met her five hours ago.

Example 2

I already told her about the party five hours ago.

A: Yes, both of those sentences are correct and natural.
The general rule is that you cannot have more than one time expression referring to the same verb, so these are incorrect:

Earlier, I met her five hours ago.
Before I left home, I told her about the party five hours ago.

"Just" and "already" aren't time expressions, so it's OK to have them in a sentence with a time expression like "five hours ago".


text:
Q: Go HTML templates: defining array of array of strings to range over In Jinja2 (Python Flask) templates, I'm able to create a static navigation menu by defining a list of tuples with code similar to the following:
{% for item in [('', 'Home'), ('menu1', 'Menu1'), ('menu2', 'Menu2')] %}

{{ item[1] }}

{%- endfor %}

I'd like to create something similar in Go HTML templates. I assume the equivalent to a list of tuples would be an array/slice of arrays of strings, i.e., something like
{{ $items := { {"", "Home"}, {"menu1", "Menu1"}, {"menu2", "Menu2"} } }}
{{ range $items }}

{{ .[1] }}

{{end}}

However, at runtime, specifically when Go tries to parse the template files it panics with unexpected "{" in command (it used to panic with unexpected "{" in range when I used a range directly).
So, is it possible to declare an array of arrays of strings in a template?


text:
Q: email sending second mail not send When the text have value I send to email, and auto reply to user and I want send one for my self to get the content from txtcontent why the secound mail not send?
         if (txtMessagesubject.Text != "" && txtContent.Text != "")
           {

                   MailMessage msg = new MailMessage();
                   msg.To.Add(new MailAddress(txtEmail.Text));
                   msg.From = new MailAddress("TheDonkeySkin@gmail.com");

                   msg.Subject = txtMessagesubject.Text;
                   string body = "thx we are receive you contact";
                   msg.Body = body;
                   msg.IsBodyHtml = true;
                   msg.Priority = MailPriority.Normal;
                   SmtpClient smtp = new SmtpClient();
                   System.Net.NetworkCredential myCredential = new System.Net.NetworkCredential("TheDonkeySkin@gmail.com", "password");
                   smtp.Host = "smtp.gmail.com";
                   smtp.Port = 587;
                   smtp.UseDefaultCredentials = false;
                   smtp.Credentials = myCredential;
                   smtp.EnableSsl = true;

                   try
                   {
                       smtp.Send(msg);
                       contactsupport.Attributes.Add("style", "display:none;");
                       thankQ.Attributes.Add("style", "display:block;");

                       txtEmail.Text = "";
                       txtMessagesubject.Text = "";
                       txtContent.Text = "";

                   }
                   catch (Exception ex)
                   {
                       errorMsgReturn.Text = "Please try again";
                   }

                  /************************************/
                  MailMessage msgself = new MailMessage();
                  msgself.To.Add(new MailAddress("TheDonkeySkin@gmail.com"));
                  msgself.From = new MailAddress(txtEmail.Text);
                  msgself.Subject = txtMessagesubject.Text;
                  string body2 = txtContent.Text;
                  msgself.Body = body2;
                  msgself.IsBodyHtml = true;
                  msgself.Priority = MailPriority.Normal;
                  SmtpClient smtpself = new SmtpClient();
                  System.Net.NetworkCredential myCredentialself = new System.Net.NetworkCredential("TheDonkeySkin@gmail.com", "password");
                  smtpself.Host = "smtp.gmail.com";
                  smtpself.Port = 587;
                  smtpself.UseDefaultCredentials = false;
                  smtpself.Credentials = myCredentialself;
                  smtpself.EnableSsl = true;
                  try
                  {
                      smtpself.Send(msgself);
                  }
                  catch
                  {
                  }

A: When you send first email you have :
txtEmail.Text = "";

and second
msgself.From = new MailAddress(txtEmail.Text);

so
msgself.From = ""


text:
Q: How to keep tables' placement static when toggling between tables First post, so apologies for any no-nos...
I have two tables--one that records wood that I have in stock, and another that lists projects that will use that wood.
I set up a toggle for changing which one of the tables are displayed, but this causes the tables' positions to move around in their vertical position. One table is larger than the other, so I understand why it changes... but I'm not sure what the best way would be to control this change. I'd like to stop this motion if at all possible.
NOTE: I am new to HTML/CSS/JavaScript so there is probably a lot of mess in there. I tried to organize it, comments, etc.
JSFiddle:[https://jshttps://jsfiddle.net/L6sdgcrq/
/*
Start table styling block
*/
.tableStats {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 500px;
}

.tableContainer {
    width: 95%;
    display: flex;
    justify-content: center;
}

#woodTable {
    width: 1200px;
    max-height: 400px;
    display: table;
    justify-content: center;
    border-radius: 15px;
    border-collapse: unset;
    margin-top: 15px;
    margin-bottom: auto;
    padding: 10px !important;
    background-color: lightgray;
    border-bottom: none;
}

#projectTable {
    width: 1200px;
    max-height: 400px;
    display: none;
    justify-content: center;
    border-radius: 15px;
    border-collapse: unset;
    margin-top: 15px;
    margin-bottom: auto;
    padding: 10px !important;
    background-color: lightgray;
    border-bottom: none;
}

th {
    padding: 15px;
    margin: 10px;
    border-bottom: 2px solid black;
    border-radius: 2px;
}

td {
    text-align: center;
    padding: 5px;
}

tr {
    padding: 10px;
}

tr:last-child, td:last-child {
    border-bottom: none;
}

td:nth-child(n+1) {
    border-left: 2px solid black;
}

th:first-child, td:first-child {
    border-left: none;
}

.smaller {
    width: 50px;
}

/*
End table styling block
*/

You'll see what I'm talking about if you scroll to the top of the window in the executed portion.


text:
Q: Does Extending Multiple Nav_Menu_Walkers Allow Nested Menus? Essentially I'm trying to add multiple sub nav menus and I'm pretty close but I just can't seem to find the right tack to solve my problem ...
I'm using a variation of a Stu Nichols CSS Menu ...
Code explains better ;-)
The relationship required to build this menu would have the top level elements as list-items, child-containers as divs and children and siblings {nth child} as uls ... So the structure would be the following ...

parent

child-container

item

         ...

item

         ...

item

         ...

My current line of thought is to add an additional nav_menu_walker to build the sub-menu lists ... However, I'm not sure if I can pass multiple walker's as args to wp_nav_menu ... IE ... ASSERT
    $menu_params = array (

'theme_location'  => 'primary',
'menu'            => 'Main Menu',
'container'       => 'div',
'container_class' => 'nav',
'container_id'    => FALSE,
'menu_class'      => FALSE,
'menu_id'         => FALSE,
'echo'            => TRUE,
'fallback_cb'     => 'wp_page_menu',
'before'          => FALSE,
'after'           => FALSE,
'link_before'     => FALSE,
'link_after'      => FALSE,
'items_wrap'      => "\n\t" . '
%3$s
' . "\n",
'depth'           => 0,
'walker'          => new Top_Nav_Menu_Walker()

);

echo "\t\t
\n\t\t\t";

wp_nav_menu( $menu_params );

echo "\t\t
\n";

}

To obtain the parent -> child-container relationship I've simply added div and ul to the start_lvl function ... Here's where I'm having issues determining how I can create multiple siblings ...
function start_lvl( &$output, $depth = 0, $args = array()) {

    $indent = str_repeat("\t", $depth);
    $output .=  "\n$indent
\n";
    $output .=  "\n$indent
\n";
}

In order to add classes to the top level anchor elements I have a custom walker. In the start_el function I've injected classes for the anchor items based on the parent class.
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
    global $wp_query;
    $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';

    $class_names = $value = '';

    $classes = empty( $item->classes ) ? array() : (array) $item->classes;
    $classes[] = 'menu-item-' . $item->ID;

    $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
    $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';

    $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );
    $id = $id ? ' id="' . esc_attr( $id ) . '"' : '';

    /* inject some anchor classes */

    if(  $this->$depth == 0) {
        if ( in_array( 'two', $item->classes ) || in_array( 'three', $item->classes )) {
            $item->class = 'oneCol fly';
        }
        if ( in_array( 'four', $item->classes )) {
            $item->class = 'twoCol fly';
        }
    };

    $output .= $indent . '
';

  $output .= in_array( 'sub_nav_h4', $item->classes ) ? "\n" . $indent . "
\n" : '';

    $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';
    $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';
    $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';
    $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';

    /*  This 'should' always be true as WP doesn't support anchor classes    */

    $attributes .= ! empty( $item->class    )       ?   ' class="'  . esc_attr( $item->class            ) . '"' : '';

    $item_output = $args->before;
    $item_output .= '';
    $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
    $item_output .= '';
    $item_output .= $args->after;

    $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
}

Here's the navigation structure I'm trying to achieve ...

One

Two

Egestas Sed

Consequat Leo

Lacinia & Blandit

Interdum

Pellentesque Velit

Lacinia & Blandit

Interdum

Donec non Fringilla

Fusce Ullamcorper

Facilisis

Tristique

Donec

Sapien

Purus

Congue

Mattis

Integer nec Diam

Morbi Eget Pharetra

Nulla & Orci

Eget Sapien Sodales

Aenean

Velit Ligula

Maecenas

Three

Egestas Sed

Consequat Leo

Pellentesque Velit

Lacinia & Blandit

Interdum

Donec non Fringilla

Fusce Ullamcorper

Facilisis

Tristique

Donec

Sapien

Purus

Congue

Mattis

Integer nec Diam

Morbi Eget Pharetra

Nulla & Orci

Eget Sapien Sodales

Aenean

Velit Ligula

Maecenas

Four

Ut vel Cursus

Maecenas imperdiet

Congue Metus

Vitae Luctus

Purus Pellentesque

Pellentesque Sed

Felis Nunc

Morbi Placerat Luctus

Ut & Eleifend

Feugiat Euismod

Tempus Condi

Five

Six

Seven

A: Frankly, I'd just use a single menu and then apply a CSS class (in the backend) to the navigation element you want the  to be.
It's simple enough to add a CSS class in the Menu editing pane, and that solves a lot of your difficulties since you can just check for the presence of that string in your custom walker.

A: You can modify your menu by using walker.
include('subMenu.php');
$menu =  wp_nav_menu( array('menu' => 'YOUR-MENU-NAME','menu_class' => 'megamenu','walker' => new subMenu));

create a file subMenu.php in theme folder add below code.
<?php
class subMenu extends Walker_Nav_Menu {
    function end_el(&$output, $item, $depth=0, $args=array()) {

    if( 'parent' == $item->title ){
        $output .= '
 //child-container

Egestas Sed

Consequat Leo

Lacinia & Blandit

Interdum

Pellentesque Velit

Lacinia & Blandit

Interdum

Donec non Fringilla

Fusce Ullamcorper

Facilisis

Tristique

Donec

Sapien

Purus

Congue

Mattis

Integer nec Diam

Morbi Eget Pharetra

Nulla & Orci

Eget Sapien Sodales

Aenean

Velit Ligula

Maecenas

        ';
    }
    $output .= "
\n";
    }
}


text:
Q: SurfaceView colour differences between SurfaceView and View I got two different elements, placed side by side inside a linear layout. One of the elements extends SurfaceView, while the other extends View.
Now, filling each element with the same solid color, shows they are rendered differently, the element which is extending View renders the color slightly darker than the other element.
I tried this both using canvas.drawColor(int), and creating a paint and using drawRect() with the same paint in both elements.
Does anybody know whats causing this?

A: I guess the SurfaceView is not using 32bit color. Try  getHolder().setFormat(PixelFormat.RGBA_8888);


text:
Q: Let $G$ be a group. Prove that if $|G|=p^n$ with $p$ prime and $n \in \mathbb{N}$ then $C(G) \neq {1}$ The only thing I could think was to use the Cauchy Theorem. So I know that exists a $h \in G$ such that $o(h) = p$. Also I can consider the subgroup $H = <h>$ that all the elements have the same property and $|H|=p$.
I think that $h \in C(G)$. But if I take $g \in G$, I'm not being able to prove that $g*h*g^{-1} = h$. To take an example I thought of $\mathbb{D}_4$, where $|\mathbb{D}_4|=8=2^3$ and I can see there that $r^2 \in \mathbb{D}_4$ has order 2 and $r^2 \in C(\mathbb{D}_4)$


text:
Q: How to use a R-Tree in Cassandra as indexing As Here said: "In version 3.4 they introduced SASI indexes (SSTable Attached Secondary Indexes). Basically a portion of the index is associated to each SStable and hence distributed with it. This means you can actually use references to access data rather than pay for another read path. In terms of implementation, they are b-trees."
So I want to replace R-Tree instead of B-Tree for indexing is Cassandra. Cassandra is in java, I see all files about B-Tree there in a folder but there is no documentation about parameters and functions there. I have R-Tree source code in java but I don't know how replace it in Cassandra as it indexing method.
p.s. the language doesn't matter for me and can be anyone. no limits.

A: Your question is too broad and general.
My advice is that you first familiarise yourself with the implementation and inner-workings of secondary indexes in Cassandra before embarking on an ambitious goal of rewriting the code. Cheers!


text:
Q: How can I get codeigniter captcha image Library How can I get codeigniter captcha image library. configuration erquired to define 'img_path' => '', 'img_url' => '', but I don't have such folder or images,  I red soo many tutorials and codeigniter documentation as well .. but no one describe where that captcha library located..
Function
public function captcha() {
        /* Set a few basic form validation rules */
        $this->form_validation->set_rules('name', "Name", 'required');
        $this->form_validation->set_rules('captcha', "Captcha", 'required');

        /* Get the user's entered captcha value from the form */
        $userCaptcha = set_value('core/captcha');

        /* Get the actual captcha value that we stored in the session (see below) */
        $word = $this->session->userdata('captchaWord');

        /* Check if form (and captcha) passed validation */
        if ($this->form_validation->run() == TRUE &&
                strcmp(strtoupper($userCaptcha), strtoupper($word)) == 0) {
            /** Validation was successful; show the Success view * */
            /* Clear the session variable */
            $this->session->unset_userdata('captchaWord');

            /* Get the user's name from the form */
            $name = set_value('name');

            /* Pass in the user input to the success view for display */
            $data = array('name' => $name);
            $this->load->view('pages/captcha-success-view', $data);
        } else {

            /** Validation was not successful - Generate a captcha * */
            /* Setup vals to pass into the create_captcha function */
            $vals = array(
                'word' => 'Random word',
                'img_path' => '',
                'img_url' => '',
                'img_width' => '150',
                'img_height' => 30,
                'expiration' => 7200
            );

            print_r($vals);

            /* Generate the captcha */
            $captcha = create_captcha($vals);

            $data['captcha'] = $captcha;
            $data['image'] = $captcha['image'];

            /* Store the captcha value (or 'word') in a session to retrieve later */
            $this->session->set_userdata('captchaWord', $captcha['word']);

            /* Load the captcha view containing the form (located under the 'views' folder) */
            $this->load->view('pages/captcha-view', $data);
        }
    }

A: There are no captcha library in CodeIgniter but helper. All you have to do load this helper first to use captcha $this->load->helper('captcha');
And remember, you must need to create a folder in your project where CI will put captcha images. So if you create a folder name 'captcha' in your project root then your code will be (demo)
$this->load->helper('captcha');
$vals = array(
 'img_path' => 'captcha/',
 'img_url' => base_url('captcha'),
 'font_path' => 'assets/fonts/ALGER.TTF',
 'img_width' => '300',
 'img_height' => 80,
 'font_size' => 24,
 'colors' => array(
    'background' => array(255, 255, 255),
    'border' => array(0, 0, 0),
    'text' => array(0, 0, 0),
    'grid' => array(255, 40, 40)
  )
);

$cap = create_captcha($vals);

Now print your captcha wherever you want echo $cap['image']


text:
Q: Convert a closed google Doc to a PDF and attach it in an email I have a spreadsheet form that takes its information and places it into a document which then needs to be converted to a pdf and sent as an attachment.
I have the document 'Template' ready to go but don't know how to convert a document that is not open as a tab (aka I cant use DocumentApp).
Any ideas would be greatly appreciated.

A: You can use DocumentApp from another script, not just the script which is bound to a doc. Let's say your doc template is document ID abcdefghijklmnop...
// If you have a template, first make a copy
var docCopy = DriveApp.getFileById('abcdefghijklmnop').makeCopy();
var copyId = docCopy.getId();
var doc = DocumentApp.openById(copyId);

// Do whatever you need to modify the doc here.

// Now we're done, and `doc` needs to turn into a PDF
var pdfContent = doc.getAs('application/pdf');
var draftMail = GmailApp.createDraft('william@example.com',
                                     'Email title', 'Pls see attached',
                                     {
                                         attachments: [pdfContent.getAs(MimeType.PDF)],
                                         name: 'Converted doc content'
                                     });
// Now send the mail
draftMail.send();


text:
Q: How to do constructor for 2D vector in C++? I tried initializing a 2D vector with a constructor in 3 different ways but always get an
"error: no matching function to call"

Could you tell me where I am wrong?
class Node
{
public:
  int to;
  int length;
  Node(int to, int length) : to(to), length(length){}
};

class Graph
{
public:
  vector<vector<Node>> nodes_list;
  int n;
  Graph();
};

Graph::Graph(){
  nodes_list = vector<vector<Node> >(n, vector<Node>(n,0x3fffffff));
}

A: vector<Node>(n,0x3fffffff);

is (roughly) equivalent to:
vector<Node> v;
for ( size_t i = 0; i < n; i++ )
{
   v.push_back(Node(0x3fffffff));
}

As your Node class doesn't have a constructor taking a single integer this fails to compile. The correct code is:
vector<Node>(n,Node(0x3fffffff,0));

By the way I assume you have using namespace std; in your header for Graph, don't do that, it will cause you issues at some point.

A: Your code has two problems:

*

*At the following line, you should have provided the parameters for
constructing the Node, which are to and legth.
vector<vector<Node>>(n, vector<Node>(n,0x3fffffff));
//                                   ^^^^^^^^^^^--> here

*In Graph, the member n is un-initialized, at the
point, you call the default constructor. That would lead you to have
a garbage value in n and hence the size of the nodes_list would
be undefined.

The fixed code will look like:
struct Node
{
    int _to;
    int _length;
    Node(int to, int length) : _to{ to }, _length{ length } {}
};

class Graph
{
    using VecNode = std::vector<Node>; // type alias for convenience
private:
    int _n;
    std::vector<VecNode> _nodes_list;
public:
    Graph()
        : _n{ 2 } // initialize _n
        , _nodes_list{ _n, VecNode(_n, { 1, 3 }) }
                                      // ^^^^^^-> initialize with the default 'Node(1, 3)'
    {}
};

Also some suggestions:

*

*Use member initializer
lists
to initialize the vector, instead of creating and assign to it.

*It's not a good idea to name both constructor parameters and the
members with same in Node. At some point, that may lead to
confusions.


text:
Q: Tools to diagnose slow compile/build reasons In a number of situations as a programmer, I've found that my compile times are slower than I would like, and I want to understand the reason and fix them.  Particular language (yes, I'm using C/C++) tricks have already been discussed, and we apply many of them. I've also seen this question and realize it's related. What I'm more interested in is what tools people use to diagnose hardware/system bottlenecks in the build process.  Is there a standard way to prove "Disk read/writes are too slow for our builds - we need SSD's!" or "The anti-virus settings are killing our build times!", etc...?

Resources I've found, none directly related to compiling performance diagnosis:

*

*A TechNet article about using PerfMon (Quite good, close to what I'd like)

*This IBM link detailing some PerfMon information, but it's not specific to compiling and appears somewhat out of date.

*A webpage specifically describing diagnosis of avg disk queue length

Currently, diagnosing a slow build is very much an art, and my tools of choice are:

*

*PerfMon

*Process Explorer

*Process Monitor

*Push hard enough to get a machine to "just try it". (Basically, trial and error.)

What do others do to diagnose system-level build performance bottlenecks?
Can we come up with a list of PerfMon or Process Explorer statistics to watch for, with thresholds for whats "acceptable" on a modern machine?

PerfMon:

*

*CPU -> % of processor time

*MEMORY -> Page/sec

*DISK -> Avg. disk queue length

  Process Explorer:

*

*CPU -> CPU

*DISK -> I/O Delta Total

*MEMORY -> Page Faults

A: I resolved a "too slow build" time issue with Eclipse and Spring recently.  For me the solution was to use the Vista Resource Monitor (which identified CPU spiking but not consistently high) and quite a bit of disk activity.  I then used Procmon from Sysinternals to identify exactly which files were being heavily accessed.
Part of our build process also involves checking external Maven (binary file) repositories for updates every build.  I disabled that check (which also gives me perfect control over when I update those dependencies).  If you have resources external to the build machine, benchmark how long it takes to access them (source control, maven, etc.).
Since I'm stuck on 32-bit Vista for now, I decided to try creating a Ramdisk with the 700MB of non-addressable memory (PC has 4GB, Vista only exposes 3.3GB) and place the heavily accessed files as identified by Procmon on the Ramdisk using a nice trick of creating drive junctions to make that move transparent to my IDE.  For details see here.

A: I have used filemon to see the header files that a C++ build was most often opening then used:

*

*"#ifndef checks" so header files are only included once

*Precompiled headers

*Combined some small header files

*Reduce the number of header files included by other header files by tidying up the code.

However these days I would start with a RamDisk and or SSD, but opening lot of header files still uses lots of CPU time.


text:
Q: Log Collector returns partial data I am trying to get the logs from the android phone while not connected to the PC. I have downloaded the Log Collector but for some reason I get only partial data and cannot see the whole data I can see via logcat. Is there a way to get the complete data or just use the logcat -filters to get the logs and send them over e-mail?
By partial data I mean that I see only system info but not the info sent from my apps to the logger (even after a few secs - so I don't think it is lost after 64K buffer is full)
Thanks
  Simon


text:
Q: Claims to Windows Token Service Without Start Any ideas why there is no option to start the C2WTS from Central Administration?
I started the service on all servers in the farm and set it to automatic.  The set the service account in Security.

Edit: An image of the Min-Role setup was requested.
In case the image is not available it is 2 app servers, 1 search server, 1 wfe, & 1 wfe with distributed cache

A: Looks like you installed SharePoint 2016 in a MinRole-Deployment. MinRole automatically starts and stops service instances on each MinRole-managed server in your farm based on the server role.
Your screenshot doesn't tell us, which Role your server has. Maybe this article helps you to configure MinRole to your needs.
Please provide some Screenshots from Central-Administration -> Manage Servers in Farm of your MinRole-Deployment if you need further help.

A: The "Start" button is removed from "Services in Farm" in SharePoint Server 2016 MinRole environment. If you want to start services, please go to "Configuration Wizard" to select the Service Application which you want to enable.
See the screen below:

A: Thanks to MHeld's answer, I found what I needed.  This is my first MinRole farm.  I found an article on Managing a MinRole farm that showed how to start and stop services.  A simple Start-SPService worked.
Managing a MinRole Server Farm

A: Adding my two cents, In 2016 with MinRole topology there is little change.
Every role has a dedicated service attach to it. If you stop that service which required for the assigned role then overnight health analyzer role will start it again( this rule is controlling the compliant section of the services).
Same thing, if the service is not part of the selected role and you start it then over nightly run health rule will stop it again to make the server compliant again.
Like if you will start the C2WTS on search minrole server it will stop next day.
Check this technet for more info, which role has what services.

A: Executed below commands and started and shows active on servers in the farm.
$service=Get-SPService -all |where {$_.TypeName -like "Claims to Windows Token Service*"}
$service.AutoProvision=$true
$service.Update()
$service.Provision()


text:
Q: HealthCheck on ECS task without an ELB We have a Docker container(Spring Boot) that runs in an ECS cluster. We run it without Elastic Load Balancing.
We want to update the service without downtime, so when the new task is up and healthy, the old task stops. We have been trying to add a health check on the task definition, however it refuses to work. I have tried these basic healthcheck commands.
[ "CMD-SHELL","exit 0" ]
[ "CMD-SHELL","exit 1" ]

I would expect the former to result in a task with a HEALTHY health status, and the latter to fail the health checks..
In both cases, the new task starts fine, with an UNKNOWN health status.
Has this anything to do with us not using an ELB? The documentation is not very good, and my Google searches have not returned anything useful.

A: The answer by raja and edite by Andrew are slightly off for ECS/FARGATE. It's without the brackets and without the quotes:
CMD-SHELL, curl -f http://localhost/ || exit 1

That is the correct format if entering Health check information inside Task Definitions of ECS.
VALID DOCUMENTATION https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#container_definition_healthcheck
NOT VALID DOCUMENTATION for ECS/FARGATE
https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_HealthCheck.html

A: The Given command is syntatically invalid.
it should be
[ "CMD-SHELL", "curl -f http://localhost/ || exit 1" ]

*

*CMD or CMD-SHELL - to run the command with the container's default shell

*curl -f http://localhost/  -  actual command that need to be executed inside the container to validate the health check.

*exit 1  - if the curl command fail then it will exit the shell

so you should change your command like below.
[ "CMD-SHELL", "echo hi || exit 1" ]

echo hi  is the helath check command in my example you can execute any command instead of "echo hi " whihc should return exit status 0 if that runs successfully in your container.

A: If you use ecs-cli to deploy your fargate services, I found that you must upgrade to something that supports the healthcheck in the task definition.  I also found that using CMD-SHELL is not required -- in fact, it breaks when you add it, wrapping your CMD-SHELL with another CMD-SHELL in the resulting json of the generated task definition (as seen in the aws console).
So what worked for me was upgrading from 1.4.0 to 1.7.0 of ecs-cli and then adding healthcheck in the ecs-params.yml file under the service:
task_definition:
  ecs_network_mode: awsvpc
  task_role_arn: arn:aws:iam::........
  task_execution_role: arn:aws:iam::........
  task_size:
    cpu_limit: 2048
    mem_limit: 4GB
  services:
    foo:
      healthcheck:
        command: ps cax | grep "[p]ython"
        interval: 30s
        timeout: 10s
        retries: 2
      essential: true

A: For example, if your "Port mappings" is 8000:8000 for "ECS EC2" or 8000 tcp for "ECS Fargate", the "Command" of "HEALTHCHECK" is:
CMD-SHELL, curl -f http://localhost:8000/ || exit 1

Don't forget 8000 after http://localhost: in this case.


text:
Q: Proof of equality based on polynomial coefficients $a x^2 + bx + c = 0 \rightarrow$ roots are $\alpha$ and $\beta$.
$Ax^2 + Bx + C = 0 \rightarrow$ rootsa re $\alpha$ $+$ $\delta$ and $\beta$ $+$ $\delta$.
Prove that $\frac{b^2 - 4ac}{a^2}$ $=$$\frac{B^2 - 4AC}{A^2}$.
How to go about this problem?

A: HINT: if $\alpha$ and $\beta$ are roots of $ax^2+bx+c=0$, then the discriminant is given by
$$(\alpha-\beta)^2=\frac{b^2-4ac}{a^2}$$

A: In general if the roots of a quadratic equation are $r_1$ and $r_2$, then the quadratic can be written as
$$x^2 - (r_1+r_2) x+r_1r_2=0$$
In other words if you have a quadratic $ax^2 + bx+ c= 0$, with roots $\alpha, \beta$, then $\alpha + \beta = -b/a$ and $\alpha\beta = c/a$.
Can you finish the job now?

A: The roots of a quadratic are such that $\alpha+\beta={-b\over a}$ and $\alpha\beta={c\over a}$. One has $d^2=\left(\alpha-\beta\right)^2=\left(\alpha+\beta\right)^2-4\alpha\beta$. So
$$d^2=\left({b\over a}\right)^2-4{c\over a}={b^2-4ac\over a^2}$$
And we have $\alpha+\delta-\beta-\delta=\alpha-\beta$


text:
Q: Needs help setting up Spring/Hibernate Mysql settings Can't to get this correct. I've been a pest on the boards all day. I can't seem to get this to run. Thanks for any help in advance.
Main class:
@EnableAutoConfiguration
@ComponentScan
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class);

    }

}

My controller:
@Controller
@RequestMapping("/customer")
public class CustomerController {

    @Autowired
    private CustomerDao customerDao;

    @RequestMapping("/list")
    public String listCustomers(Model model){

        List<Customer> theCustomers = customerDao.getCustomers();

        model.addAttribute("customers", theCustomers);

        return "list-customers";

    }
}

Hibernate config:
<hibernate-configuration xmlns="http://www.hibernate.org/xsd/orm/cfg">
    <session-factory>
        <property name="dialect">org.hibernate.dialect.MySQL5Dialect</property>
        <property name="show_sql">true</property>
        <property name="hbm2ddl.auto">update</property>
    </session-factory>
</hibernate-configuration>

My Application.properties:
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/web_customer_tracker?useSSL=false
spring.datasource.username=springstudent
spring.datasource.password=springstudent
spring.datasource.jpa.generate-ddl=true

spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate4.SpringSessionContext

spring.jpa.hibernate.ddl-auto=update
spring.jpa.hibernate.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect

My DAO:
public interface CustomerDao {

    List<Customer> getCustomers();
}

Print Trace:
/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/bin/java -Didea.launcher.port=7534 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA CE.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/lib/tools.jar:/Users/ronald/IdeaProjects/springtutorial/target/classes:/Users/ronald/.m2/repository/org/springframework/boot/spring-boot-starter-thymeleaf/1.5.1.RELEASE/spring-boot-starter-thymeleaf-1.5.1.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/boot/spring-boot-starter/1.5.1.RELEASE/spring-boot-starter-1.5.1.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/boot/spring-boot/1.5.1.RELEASE/spring-boot-1.5.1.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.5.1.RELEASE/spring-boot-autoconfigure-1.5.1.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/boot/spring-boot-starter-logging/1.5.1.RELEASE/spring-boot-starter-logging-1.5.1.RELEASE.jar:/Users/ronald/.m2/repository/ch/qos/logback/logback-classic/1.1.9/logback-classic-1.1.9.jar:/Users/ronald/.m2/repository/ch/qos/logback/logback-core/1.1.9/logback-core-1.1.9.jar:/Users/ronald/.m2/repository/org/slf4j/jul-to-slf4j/1.7.22/jul-to-slf4j-1.7.22.jar:/Users/ronald/.m2/repository/org/slf4j/log4j-over-slf4j/1.7.22/log4j-over-slf4j-1.7.22.jar:/Users/ronald/.m2/repository/org/yaml/snakeyaml/1.17/snakeyaml-1.17.jar:/Users/ronald/.m2/repository/org/thymeleaf/thymeleaf-spring4/2.1.5.RELEASE/thymeleaf-spring4-2.1.5.RELEASE.jar:/Users/ronald/.m2/repository/nz/net/ultraq/thymeleaf/thymeleaf-layout-dialect/1.4.0/thymeleaf-layout-dialect-1.4.0.jar:/Users/ronald/.m2/repository/org/codehaus/groovy/groovy/2.4.7/groovy-2.4.7.jar:/Users/ronald/.m2/repository/org/springframework/boot/spring-boot-starter-web/1.5.1.RELEASE/spring-boot-starter-web-1.5.1.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/1.5.1.RELEASE/spring-boot-starter-tomcat-1.5.1.RELEASE.jar:/Users/ronald/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.11/tomcat-embed-core-8.5.11.jar:/Users/ronald/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/8.5.11/tomcat-embed-el-8.5.11.jar:/Users/ronald/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/8.5.11/tomcat-embed-websocket-8.5.11.jar:/Users/ronald/.m2/repository/org/hibernate/hibernate-validator/5.3.4.Final/hibernate-validator-5.3.4.Final.jar:/Users/ronald/.m2/repository/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar:/Users/ronald/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.8.6/jackson-databind-2.8.6.jar:/Users/ronald/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.8.0/jackson-annotations-2.8.0.jar:/Users/ronald/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.8.6/jackson-core-2.8.6.jar:/Users/ronald/.m2/repository/org/springframework/spring-web/4.3.6.RELEASE/spring-web-4.3.6.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/spring-aop/4.3.6.RELEASE/spring-aop-4.3.6.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/spring-context/4.3.6.RELEASE/spring-context-4.3.6.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/spring-webmvc/4.3.6.RELEASE/spring-webmvc-4.3.6.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/spring-expression/4.3.6.RELEASE/spring-expression-4.3.6.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/spring-core/4.3.6.RELEASE/spring-core-4.3.6.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/spring-orm/4.3.7.RELEASE/spring-orm-4.3.7.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/spring-beans/4.3.6.RELEASE/spring-beans-4.3.6.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/spring-jdbc/4.3.6.RELEASE/spring-jdbc-4.3.6.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/spring-tx/4.3.6.RELEASE/spring-tx-4.3.6.RELEASE.jar:/Users/ronald/.m2/repository/org/hibernate/hibernate-core/5.2.9.Final/hibernate-core-5.2.9.Final.jar:/Users/ronald/.m2/repository/org/jboss/logging/jboss-logging/3.3.0.Final/jboss-logging-3.3.0.Final.jar:/Users/ronald/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.1-api/1.0.0.Final/hibernate-jpa-2.1-api-1.0.0.Final.jar:/Users/ronald/.m2/repository/org/javassist/javassist/3.21.0-GA/javassist-3.21.0-GA.jar:/Users/ronald/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar:/Users/ronald/.m2/repository/org/jboss/spec/javax/transaction/jboss-transaction-api_1.2_spec/1.0.1.Final/jboss-transaction-api_1.2_spec-1.0.1.Final.jar:/Users/ronald/.m2/repository/org/jboss/jandex/2.0.3.Final/jandex-2.0.3.Final.jar:/Users/ronald/.m2/repository/com/fasterxml/classmate/1.3.3/classmate-1.3.3.jar:/Users/ronald/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar:/Users/ronald/.m2/repository/org/hibernate/common/hibernate-commons-annotations/5.0.1.Final/hibernate-commons-annotations-5.0.1.Final.jar:/Users/ronald/.m2/repository/mysql/mysql-connector-java/5.1.39/mysql-connector-java-5.1.39.jar:/Users/ronald/.m2/repository/c3p0/c3p0/0.9.1.2/c3p0-0.9.1.2.jar:/Users/ronald/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar:/Users/ronald/.m2/repository/org/springframework/boot/spring-boot-starter-data-jpa/1.5.1.RELEASE/spring-boot-starter-data-jpa-1.5.1.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/boot/spring-boot-starter-aop/1.5.1.RELEASE/spring-boot-starter-aop-1.5.1.RELEASE.jar:/Users/ronald/.m2/repository/org/aspectj/aspectjweaver/1.8.9/aspectjweaver-1.8.9.jar:/Users/ronald/.m2/repository/org/springframework/boot/spring-boot-starter-jdbc/1.5.1.RELEASE/spring-boot-starter-jdbc-1.5.1.RELEASE.jar:/Users/ronald/.m2/repository/org/apache/tomcat/tomcat-jdbc/8.5.11/tomcat-jdbc-8.5.11.jar:/Users/ronald/.m2/repository/org/apache/tomcat/tomcat-juli/8.5.11/tomcat-juli-8.5.11.jar:/Users/ronald/.m2/repository/org/hibernate/hibernate-entitymanager/5.0.11.Final/hibernate-entitymanager-5.0.11.Final.jar:/Users/ronald/.m2/repository/javax/transaction/javax.transaction-api/1.2/javax.transaction-api-1.2.jar:/Users/ronald/.m2/repository/org/springframework/data/spring-data-jpa/1.11.0.RELEASE/spring-data-jpa-1.11.0.RELEASE.jar:/Users/ronald/.m2/repository/org/springframework/data/spring-data-commons/1.13.0.RELEASE/spring-data-commons-1.13.0.RELEASE.jar:/Users/ronald/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.22/jcl-over-slf4j-1.7.22.jar:/Users/ronald/.m2/repository/org/springframework/spring-aspects/4.3.6.RELEASE/spring-aspects-4.3.6.RELEASE.jar:/Users/ronald/.m2/repository/org/thymeleaf/thymeleaf-spring3/3.0.3.RELEASE/thymeleaf-spring3-3.0.3.RELEASE.jar:/Users/ronald/.m2/repository/org/thymeleaf/thymeleaf/2.1.5.RELEASE/thymeleaf-2.1.5.RELEASE.jar:/Users/ronald/.m2/repository/org/unbescape/unbescape/1.1.0.RELEASE/unbescape-1.1.0.RELEASE.jar:/Users/ronald/.m2/repository/org/slf4j/slf4j-api/1.7.22/slf4j-api-1.7.22.jar:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar" com.intellij.rt.execution.application.AppMain com.luv2code.springtutorial.Application

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.5.1.RELEASE)

2017-04-09 18:38:10.301  INFO 4733 --- [           main] com.luv2code.springtutorial.Application  : Starting Application on Ronalds-MacBook-Pro.local with PID 4733 (/Users/ronald/IdeaProjects/springtutorial/target/classes started by ronald in /Users/ronald/IdeaProjects/springtutorial)
2017-04-09 18:38:10.305  INFO 4733 --- [           main] com.luv2code.springtutorial.Application  : No active profile set, falling back to default profiles: default
2017-04-09 18:38:10.596  INFO 4733 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1dd92fe2: startup date [Sun Apr 09 18:38:10 EDT 2017]; root of context hierarchy
2017-04-09 18:38:10.865  WARN 4733 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.luv2code.springtutorial.Application]; nested exception is java.util.InvalidPropertiesFormatException: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 71; Document root element "hibernate-configuration", must match DOCTYPE root "null".
2017-04-09 18:38:10.892 ERROR 4733 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Destroy method on bean with name 'org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory' threw an exception

java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1dd92fe2: startup date [Sun Apr 09 18:38:10 EDT 2017]; root of context hierarchy
    at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:404) [spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.context.support.ApplicationListenerDetector.postProcessBeforeDestruction(ApplicationListenerDetector.java:97) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:253) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578) [spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554) [spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:961) [spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523) [spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:968) [spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1033) [spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:555) [spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at com.luv2code.springtutorial.Application.main(Application.java:15) [classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) [idea_rt.jar:na]

2017-04-09 18:38:10.911 ERROR 4733 --- [           main] o.s.boot.SpringApplication               : Application startup failed

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.luv2code.springtutorial.Application]; nested exception is java.util.InvalidPropertiesFormatException: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 71; Document root element "hibernate-configuration", must match DOCTYPE root "null".
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:180) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:308) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:228) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:270) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:93) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:686) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:524) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at com.luv2code.springtutorial.Application.main(Application.java:15) [classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) [idea_rt.jar:na]
Caused by: java.util.InvalidPropertiesFormatException: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 71; Document root element "hibernate-configuration", must match DOCTYPE root "null".
    at sun.util.xml.PlatformXmlPropertiesProvider.load(PlatformXmlPropertiesProvider.java:80) ~[na:1.8.0_121]
    at java.util.Properties$XmlSupport.load(Properties.java:1201) ~[na:1.8.0_121]
    at java.util.Properties.loadFromXML(Properties.java:881) ~[na:1.8.0_121]
    at org.springframework.util.DefaultPropertiesPersister.loadFromXml(DefaultPropertiesPersister.java:78) ~[spring-core-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.core.io.support.PropertiesLoaderUtils.fillProperties(PropertiesLoaderUtils.java:91) ~[spring-core-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.core.io.support.PropertiesLoaderUtils.fillProperties(PropertiesLoaderUtils.java:72) ~[spring-core-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.core.io.support.PropertiesLoaderUtils.loadProperties(PropertiesLoaderUtils.java:58) ~[spring-core-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.core.io.support.ResourcePropertySource.<init>(ResourcePropertySource.java:65) ~[spring-core-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.core.io.support.DefaultPropertySourceFactory.createPropertySource(DefaultPropertySourceFactory.java:36) ~[spring-core-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.processPropertySource(ConfigurationClassParser.java:419) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:253) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:230) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:189) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:272) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:230) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:197) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:166) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
    ... 18 common frames omitted
Caused by: org.xml.sax.SAXParseException: Document root element "hibernate-configuration", must match DOCTYPE root "null".
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203) ~[na:1.8.0_121]
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134) ~[na:1.8.0_121]
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396) ~[na:1.8.0_121]
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327) ~[na:1.8.0_121]
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284) ~[na:1.8.0_121]
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.rootElementSpecified(XMLDTDValidator.java:1599) ~[na:1.8.0_121]
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDValidator.java:1877) ~[na:1.8.0_121]
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:742) ~[na:1.8.0_121]
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1359) ~[na:1.8.0_121]
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$ContentDriver.scanRootElementHook(XMLDocumentScannerImpl.java:1289) ~[na:1.8.0_121]
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3132) ~[na:1.8.0_121]
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:852) ~[na:1.8.0_121]
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602) ~[na:1.8.0_121]
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505) ~[na:1.8.0_121]
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841) ~[na:1.8.0_121]
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770) ~[na:1.8.0_121]
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) ~[na:1.8.0_121]
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243) ~[na:1.8.0_121]
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339) ~[na:1.8.0_121]
    at sun.util.xml.PlatformXmlPropertiesProvider.getLoadingDoc(PlatformXmlPropertiesProvider.java:106) ~[na:1.8.0_121]
    at sun.util.xml.PlatformXmlPropertiesProvider.load(PlatformXmlPropertiesProvider.java:78) ~[na:1.8.0_121]
    ... 34 common frames omitted

Process finished with exit code 1

A: Suppose you refer this example as it is a good example to getting started with Spring boot with JPA
I think you are missing few configurations on your application.properties.
Hope this helps.

A: Exception :
Caused by: java.util.InvalidPropertiesFormatException: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 71; Document root element "hibernate-configuration", must match DOCTYPE root "null"

In hibernate-configuration you have not defined DOCTYPE thats why exception is occurring.
You need to add it
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

Also you are using spring boot so you don't need to setup hibernate config file separately, you have already defined it on application.properties file
spring.jpa.hibernate.ddl-auto=update
spring.jpa.hibernate.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect

Spring boot auto configure it for you.


text:
Q: Question involving differeniable function and the gradient. Let $f:\mathbb{R}^n \to \mathbb{R} \in C^{1}$ , define $f^{+}(x) = \max \{0,f(x)\}$. Put $g(x) = (f^{+}(x))^2$, show that $g$ is differentiable and $\nabla g(x)= 2f^{+}(x) \nabla f(x)$.
It's very natural, I mean, It's easy to believe. However I couldn't show that, because  $f^{+}$ is not differentiable. Let me explain my attempt:
Take $a \in \mathbb{R}^n$, we have  $\nabla g(a) = (\frac{\partial g}{ \partial x_1}(a), \frac{\partial g}{ \partial x_2}(a), \dots, \frac{\partial g}{ \partial x_n}(a))$.
We wanna show that $\frac{\partial g}{ \partial x_i}(a) = 2 f^{+}(a) \frac{\partial f}{\partial x_i}(a)$, but it's kind of weird
$$\frac{\partial g}{ \partial x_i} (a) = \lim_{t \to 0} \frac{g(a+te_i) - g(a)} {t} = \lim_{t \to 0} \frac{(f^{+}(a+t e_i))^2 - f^{+}(a)} {t},$$
Here we can have $f^{+}(a+te_i) =0$ or $f^{+}(a+te_i) = f(a+te_i)$, the same way $f^{+}(a)$...So it's confusing. Could you help me to solve that?

A: Let $\varphi(u)=u|u|$ for $u\in\mathbb{R}$.
For $u_{0}>0$, $\varphi(u)=u^{2}$ for a neighborhood of $u_{0}$ and we have $\varphi'(u_{0})=2u_{0}$.
Similarly, for $u_{0}<0$, $\varphi'(u_{0})=-2u_{0}$.
For $u_{0}=0$, $\lim_{u\rightarrow 0}\dfrac{\varphi(u)-\varphi(0)}{u-0}=\lim_{u\rightarrow 0}|u|=0$, so $\varphi'(0)=0$.
In short, we have $\varphi'(u)=2|u|$ for $u\in\mathbb{R}$.
On the other hand,
\begin{align*}
g(x)=\left(\dfrac{f(x)+|f(x)|}{2}\right)^{2}=\dfrac{f(x)^{2}+f(x)|f(x)|}{2}=\dfrac{1}{2}(f(x)^{2}+\varphi(f(x))).
\end{align*}
Note that $\varphi\circ f$ is differentiable with $\varphi'(f(x))\nabla f(x)=2|f(x)|\nabla f(x)$, so
\begin{align*}
\nabla g(x)&=\dfrac{1}{2}(2f(x)\nabla f(x)+2|f(x)|\nabla f(x))\\
&=(f(x)+|f(x)|)\nabla f(x)\\
&=2f^{+}(x)\nabla f(x).
\end{align*}


text:
Q: Jquery 1.7 and IE 8 memory leakage I have a script which runs on every page on an intranet, which adds events, sets size, length for input fields based on a class (this allows for different configurations between comapnies).
However, I've noticed that I'm getting memory leakage.
My code for adding the events is :
        $("input.PartNo" ).addClass("font8_input").attr({maxlength: '20',size:'20'})
        .bind('focus',function(event){javascript:fncAjaxClear();$(this).addClass("input_focus");})
        .bind('blur',function(event){if (typeof fncPartBlur === "function") fncPartBlur(''+$(this).attr("id")+'');$(this).removeClass("input_focus input_error");})
        .bind('keyup',function(event){javascript:fncAjaxSearch('wsDatabase','..\\AjaxBrowses\\PartBrowse.asp',''+$(this).attr("id")+'',''+$(this).attr("id")+'List','fncPreAjaxPart','fncPostAjaxPart');})
        .each(function(){$(this).after('

');});

After reading the 'Learning Jquery' book, it says about binding events to variable.  Is this correct, and if so, what would be the best wat to alter my code above to dynamically create variable names and then bind the events to these.
Thanks.

A: After further investigation, it looks like the problem is a generic problem with IE and not being caused by jquery.


text:
Q: SAS - compare two variables in two datsets I have two datasets of patients and am trying to make one data;
my first data in inpatient admissions, and second is outpatient visits. I want to compare both data sets to see if outpatient visits data have a patient then I want to add a new variable to inpatient data let's say OP_var and label it as "Yes" and if an inpatient data patient is not present in outpatient data then i want to label OP_var as "No".
e.g.`
data inpatient;
input PID adm_dt dis_dt hsp_id @@;
cards;
1 01/01/2013 01/03/2013 10001
2 01/03/2013 01/04/2013 10110
3 01/10/2012 01/12/2012 10010
4 01/11/2013 01/17/2013 10000
;;

data outpatient;
input PID adm_dt_op dis_dt_op hsp_id_op @@;
cards;
1 01/05/2013 01/05/2013 10000
2 01/06/2013 01/06/2013 10111
4 01/19/2013 01/19/2013 10001
;;

data want;

PID  adm_dt     dis_dt     hsp_id adm_dt_op dis_dt_op   hs_id_op OP
1    01/01/2013 01/03/2013 10001  01/05/2013 01/05/2013 10000    Yes
2    01/03/2013 01/04/2013 10110  01/06/2013 01/06/2013 10111    Yes
3    01/10/2012 01/12/2012 10010  .          .           .       No
4    01/11/2013 01/17/2013 10000  01/19/2013 01/19/2013 10001    Yes`

A: Lots of solutions to this pretty basic problem.  Merge the two datasets:
data want;
merge inpatient(in=i) outpatient(in=o keep=PID);
if i;
if o then Outpatient='Yes';
else outpatient='No';
run;

Works even if you have multiple variables to merge on, does require a sort so can be slow for very large datasets.
Create a format:
data op_format;
start=pid;
label='Yes';
fmtname='Outpf';
output;
if _n_ = 1 then do;  *add a row that instructs it what to do with nonmatching records;
hlo='o';
label='No';
output;
end;
run;

proc format cntlin=op_format;
quit;

data want;
set inpatient;
outpatient=put(pid,outpf.);
run;

Only works with one merge variable (without silly tricks like catting values together).
If these two don't work for you, there are other solutions - SQL, hash table, etc., depending on your data, your familiarity with various things, etc.
SQL solution, roughly:
proc sql;
create table want as
  select I.*, case when missing(O.PID) then 'No' else 'Yes' end as OP
  from inpatient I left join outpatient O
  on I.pid=O.pid;
quit;

A: This should be helpful. Sorry I switched to R about a year ago and dont have SAS on my pc anymore to test.
    PROC SQL;
     CREATE TABLE Patient_Matches AS
     SELECT *
     FROM inpatient left join outpatient
     ON inpatient.PID = outpatient.PID
     ;
     QUIT;

     PROC SQL;
       ALTER TABLE Patient_Matches ADD OPchar(2);
       UPDATE Patient_MatchesSET myString='NO' where hs_id_op  = '';
       UPDATE Patient_MatchesSET myString='YES' where hs_id_op  <> '';
     quit;