text:
Q: How to stream mp4 video from server using ExoPlayer? recently i come across google exoplayer which has some cool feture with lack of documentation and support and am new to it , my doubt is how to play mp4 video using server URL. Now let me explain what I have tried so far

*

*I have successfully implemented exoplayer in my project and make it works

*But my problem is using my server url first it completes full video buffer then only it starts playing so it takes time ? what i need is it need to play simultaneously after getting each response so that video can be play it fast how can i achieve this. Now let me post what i have tried so far:
    BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
    TrackSelection.Factory videoTrackSelectionFactory = new AdaptiveTrackSelection.Factory(bandwidthMeter);

    TrackSelector trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);
    LoadControl loadControl = new DefaultLoadControl();
    player = ExoPlayerFactory.newSimpleInstance(this, trackSelector, loadControl);
    simpleExoPlayerView = new SimpleExoPlayerView(this);
    simpleExoPlayerView = findViewById(R.id.player_view);
    simpleExoPlayerView.setUseController(true);
    simpleExoPlayerView.setVisibility(View.VISIBLE);
    simpleExoPlayerView.requestFocus();
    simpleExoPlayerView.setPlayer(player);

    Log.d("url", intent.getStringExtra("videopath") + "?api_key=" + getResources().getString(R.string.dream_factory_api_key) + "&session_token=" + PreferenceUtils.getInstance(this).getStrData(PreferenceUtils.SESSION_TOKEN));
    MediaSource mediaSource = new ExtractorMediaSource(Uri.parse(intent.getStringExtra("videopath") + "?api_key=" + getResources().getString(R.string.fs) + "&session_token=" + PreferenceUtils.getInstance(this).getStrData(PreferenceUtils.SESSION_TOKEN)),
            new CacheDataSourceFactory(this, 100 * 1024 * 1024, 5 * 1024 * 1024), new DefaultExtractorsFactory(), null, null);
    player.prepare(mediaSource);

Any help ? am i doing it in right way ? what i need is it needs buffer like youtube play and buffer not like buffer completely then play , Thanks in adavance

A: Instead of ExtractorMediaSource you should probably use DashMediaSource. That is for what you exactly want (buffering while playing).


text:
Q: Log what was just selected without temporary table? In a stored procedure I am selecting from a table using variables passed in. Then, I want to log what is selected. Is there any way to do this without using a temporary table or table variable?
The select statement:
Select userId, firstName, lastName, address
from myTable
where userName = @userName and password = @password

Then, I want to log the userId, firstName, lastName, and address that were selected. So:
Insert into loginLog...[results gotten above]

Note: I only want to log it if there is only one result returned. If more than one result is returned, I still want to select all the results, but I do not want to log it.

A: Use your select to populate local variables in the stored procedure. Log the results, then select the variable to return them to the caller:
declare
  @userID    int          ,
  @firstName varchar(255) ,
  @lastName  varchar(255) ,
  @address   varchar(255)   ,
  @rows      int

select @userID = userId ,
       @firstName = firstName ,
       @lastName  = lastName  ,
       @address   = address
from myTable
where ...

set @rows = @@rowcount

insert loginLog
select @userID , @firstName , @lastName , @address
where @rows > 0

select userID = @userID ,
       firstName  = @firstName ,
       lastName   = @lastName  ,
       address    = @address
where @rows > 0

redpajama_set_name: RedPajamaStackExchange


text:
Q: MPI blocking receive semantics I got confused when reading about blocking send and receives in MPI. As stated in the MPI Standard 2.2, section 3.4 Communication Modes:

... The receive operation described in the last section is blocking: it
  returns only after the receive buffer contains the newly received
  message. A receive can complete before the matching send has completed
  (of course, it can complete only after the matching send has started).

Can somebody explain to me how a blocking receive can complete before the corresponding send has completed? My understanding is that a blocking receive (MPI_recv) returns when data is ready to be used in the receive buffer (i.e. the data has been received fully). Is this not the case?

A: Your understanding is correct.
The described case (receive completes before send completes) in the standard is telling you not to rely on the ordering of the library calls. It does not necessary need to be the case on a specific machine / implementation.
If you think about a synchronous send and a blocking receive of a tiny message. The synchronous send may only complete after the matching receive has started, possibly indicated by 'confirmation message (ACK)'. The actual message transfer might completely transferred (receive may return) before the ACK arrives at the sender (send may return). Please keep in mind this is highly implementation / machine specific.

A:
Can somebody explain to me how a blocking receive can complete before
  the corresponding send has completed?

The definition of "send is complete" is that the user code can safely alter the contents of the send buffer.  There is no guarantee of the state of the corresponding recv.
In some cases, it is necessary for the recv to complete (and return) before the send buffer can be safely altered.  For instance, an ack must be sent from the recv side to the send side to indicate that it is safe to alter the send buffer (common in RDMA rendezvous protocol message transfers).

My understanding is that a
  blocking receive (MPI_recv) returns when data is ready to be used in
  the receive buffer (i.e. the data has been received fully). Is this
  not the case?

That is correct.


text: Q: send reminder alert using Microsoft Graph Calendar API When I created an event using Microsoft Graph Calendar API, I pushed the request body with "reminderMinutesBeforeStart": "1440", which is reminder alert 48 hrs before the event. I sent invitation to multiple people, people with Microsoft calendar gets reminder alert but people with gmail account/google calendar, they are not getting reminder alert in the day before the even as set in the body request. How can I resolve it?


text:
Q: Get latest files inside a folder i have a folder stucture like
var/
    testfolder1/
                myfile.rb
                data.rb
    testfolder2/
               home.rb
                sub.rb
    sample.rb
    rute.rb

inside var folder contains subfolders(testfolder1,testfolder2) and some files(sample.rb,rute.rb)
in the following code returing a josn object that contains folders and files inside the var folder
like
{
    '0': ['sample.rb', 'rute.rb'],
    testfolder1: ['myfile.rb',
        'data.rb',
    ],
    testfolder2: ['home.rb',
        'sub.rb',
    ]

}

code
 var scriptsWithGroup = {};
    fs.readdir('/home/var/', function(err, subfolder) {
      if(err) return context.sendJson({}, 200);
      var scripts = [];
      for (var j = 0; j < subfolder.length; j++) {
        var scriptsInFolder = [];
        if(fs.lstatSync(scriptPath + subfolder[j]).isDirectory()) {
          fs.readdirSync(scriptPath + subfolder[j]).forEach(function(file) {
            if (file.substr(file.length - 3) == '.rb')
            scriptsInFolder.push(file);
          });
          scriptsWithGroup[subfolder[j]] = scriptsInFolder;
        } else {
          if (subfolder[j].substr(subfolder[j].length - 3) == '.rb')
            scripts.push(subfolder[j]);
        }
      }
      scriptsWithGroup["0"] = scripts;

console.log(scriptsWithGroup)
      context.sendJson(scriptsWithGroup, 200);
    });

What i need is i want to return the latest modified or created files.here i only use 2 files inside folders it contains lots of files.so i want to return latest created ones

A: I'm going to assume here that you want only the most recent two files. If you actually want them all, just sorted, just remove the slice portion of this:
scriptsInFolder = scriptsInFolder.sort(function(a, b) {
  // or mtime, if you're only wanting file changes and not file attribute changes
  var time1 = fs.statSync(a).ctime;
  var time2 = fs.statSync(b).ctime;
  if (time1 < time2) return -1;
  if (time1 > time2) return 1;
  return 0;
}).slice(0, 2);

I'll add, however, that it's typically considered best practice not to use to the synchronize fs methods (e.g. fs.statSync). If you're able to install async, that would be a good alternative approach.

A: const fs = require('fs');
const path = require('path');

const getMostRecentFile = (dir) => {
    const files = orderReccentFiles(dir);
    return files.length ? files[0] : undefined;
};

const orderReccentFiles = (dir) => {
    return fs.readdirSync(dir)
        .filter(file => fs.lstatSync(path.join(dir, file)).isFile())
        .map(file => ({ file, mtime: fs.lstatSync(path.join(dir, file)).mtime }))
        .sort((a, b) => b.mtime.getTime() - a.mtime.getTime());
};

const dirPath = '<PATH>';
console.log(getMostRecentFile(dirPath));


text:
Q: Concat strings inside Array in SimpleAdapter I have following statement in Java (Android development):
ListAdapter adapter = new SimpleAdapter(
                MainActivity.this, list,
                R.layout.list_item, new String[] {JSON_ADDRESS,JSON_STATE}, new int[] { R.id.address,R.id.state});

Now I want to have on the r.id.address element JSON_ADDRESS + JSONNUMBER (another constant).
... new String[] {JSON_ADDRESS + " " + JSON_NUMBER, JSON_STATE}...

The above doesn't work. It displays nothing at all on the first element...
Anyone who can help concatenate the two variables?
Thanks in regard!

A: String result = String.format("%s %s %s",JSON_ADDRESS,JSON_NUMBER,JSON_STATE);
Example - address is "a"
          number is "b"
          state is "c"
result will be - "a b c"

$s - Strings
$d - Numbers.

A: You probably need to create your own custom list adapter. See here for an example on how to do that.


text:
Q: My app crashes when execute Intent statement I learn android studio programing and I have problem in my programs,
when I want to go to new activity using intent statement my app crashed,
this is my main activity;
public class MainActivity extends AppCompatActivity {

private FirebaseAuth mAuth;
private FirebaseAuth.AuthStateListener mAuthListener;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mAuth = FirebaseAuth.getInstance();
}

public void onStart(){
    super.onStart();
    FirebaseUser CurrentUser = mAuth.getCurrentUser();
    if(CurrentUser == null){
        Intent StartIntent = new Intent(MainActivity.this,
                                     StartActivity.class);
        startActivity(StartIntent);
        finish();
    }
  }

}

and this is manifest :
android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity"
        android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".StartActivity"
        android:label="@string/app_name">

    </activity>

there is no error message
but thit is what i have into android monitor :
08-23 21:50:33.507 11264-11264/? E/AndroidRuntime: FATAL EXCEPTION: main
                                               Process: com.ruse.ayse.areyousmartenough, PID: 11264
                                               java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ruse.ayse.areyousmartenough/com.ruse.ayse.areyousmartenough.StartActivity}: java.lang.NullPointerException
                                                   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2327)
                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2378)
                                                   at android.app.ActivityThread.access$800(ActivityThread.java:155)
                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)
                                                   at android.os.Handler.dispatchMessage(Handler.java:102)
                                                   at android.os.Looper.loop(Looper.java:136)
                                                   at android.app.ActivityThread.main(ActivityThread.java:5433)
                                                   at java.lang.reflect.Method.invokeNative(Native Method)
                                                   at java.lang.reflect.Method.invoke(Method.java:515)
                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
                                                   at dalvik.system.NativeStart.main(Native Method)
                                                Caused by: java.lang.NullPointerException
                                                   at com.ruse.ayse.areyousmartenough.StartActivity.onCreate(StartActivity.java:31)
                                                   at android.app.Activity.performCreate(Activity.java:5301)
                                                   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
                                                   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2291)
                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2378)
                                                   at android.app.ActivityThread.access$800(ActivityThread.java:155)
                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)
                                                   at android.os.Handler.dispatchMessage(Handler.java:102)
                                                   at android.os.Looper.loop(Looper.java:136)
                                                   at android.app.ActivityThread.main(ActivityThread.java:5433)
                                                   at java.lang.reflect.Method.invokeNative(Native Method)
                                                   at java.lang.reflect.Method.invoke(Method.java:515)
                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
                                                   at dalvik.system.NativeStart.main(Native Method)

I solved this problem into another project by adding "intent-filter" into manifest file but it does not work with this project,
this is StartActivity :
public class StartActivity extends AppCompatActivity {

private Button mRegBtn ;
private Button mLoginBtn;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_start);

    mRegBtn = (Button) findViewById(R.id.RegBtn);
    mLoginBtn = (Button) findViewById(R.id.LoginBtn);

    mRegBtn.setOnClickListener(new View.OnClickListener(){

        @Override
        public void onClick(View view) {
            Intent createAccount = new Intent(StartActivity.this, RegisterActivity.class);
            startActivity(createAccount);
        }
    });
    mLoginBtn.setOnClickListener(new View.OnClickListener(){  /////this is line 31
        @Override
        public void onClick(View view) {
            Intent loginAccount = new Intent(StartActivity.this, LoginActivity.class);
            startActivity(loginAccount);
        }
    });
}}

A: Your problem is at StartActivity.java:31 you are trying to read from a null reference.
By your comment, you look to miss getting the mLoginBtn from your Layout=
mLoginBtn = (Button) findViewById(R.id.btn_login);


text:
Q: Use object with jQuery selector I have this:

b

I need to be able to use the functions of the object place72, like .setAnimation.

A: As far as I understand, you want to access the setAnimation()-method of the object stored in the variable place72. Your approach was to store the variable name into a custom data attribute and use that name to access the variable.
This kind of doesn't work in JavaScript, but there are several easy solutions to your problem.

1. Use the data-place-id-attribute as a dictionary key
For this approach to work, you need a dictionary object where to store your created objects.
var dictionary = {
    place72 = map.addMarker({ lng: 10, lat: 20 })
};

Having this, you can easily access your markers as follows:
var key = $(this).data('place-id');
dictionary[key].setAnimation(...);

2. Access global variables via the window object
You don't neccessarily need to create dictionary object in approach one on yourself, as all globals variables can be accessed through the window-object. So access can be achieved as simple as follows:
var key = $(this).data('place-id');
window[key].setAnimation(...);

From a code-design-point-of-view, this is not the best approach for medium-sized or even larger projects though.

3. Attach the desired object directly to the DOM
It is also possible to store your object in the DOM-node itself. As you're apparently using jQuery, you can make use of its data()-method:
$('[data-place-id="place72"]').data('place', map.addMarker(...));

Accessing the object is just as easy:
$(this).data('place').setAnimation(...);

This is by far my favourite solution. (;

A: The returned value doesn't refer to your variable, it's just a string, since the place72 is a global variable you can access it by using bracket notation:
window[$(this).data('place-id')].setAnimation(null);

You can also use an object:
var places = {
    place72: map.addMarker({
        lng: 10,
        lat: 10,
    }),
    placeN: '...'
};

places[this.dataset.placeId].setAnimation(google.maps.Animation.BOUNCE);

A: If I understand you right, you want this...
var place72 = map.addMarker({
    lng: 10,
    lat: 10,
});
$('.place').mouseout(function(){
    place72.setAnimation(null);
});
$('.place').mouseover(function(){
    place72.setAnimation(google.maps.Animation.BOUNCE);
});

The explanation is that place72 is initialized with map.addMarker, and contains your object.
If setAnimation is an object public method of place72 , all you need is to request the method to place72.
To extend a bit this explanation, imagine an Object class called Foo. You initialized it (construct it, build it, instantiate it ) this way...
var foo = new Foo();

And now, the parameter foo its an instance of Foo.
So if Object class Foo has the public method Bar, you call it this way...
var foo = new Foo();
foo.Bar();

Notice that for static methods you would not request the method to the instance, but to the Object class itself. Like this;
var foo = new Foo();
foo.Bar();

Foo.staticBarExample();

And finally, let me tell you that this is JavaScript theory (Object Oriented), not JQuery :)

A: If you know your object is defined in which context you can simply get it like this:
var myOBJName= $(this).data('place-id');
var obj = mycontext[myOBJName];

know you can call the setAnimation function:
obj.setAnimation(/*...*/);

and it seems in your sample code window is the context object which your object is defined in it.
BUT what if your object is wrapped in another scope:
(function(){
    place72 = map.addMarker({
        lng: 10,
        lat: 10,
    });

    $('.place').mouseout(function(){
        //...
    });
    $('.place').mouseover(function(){
        //...
    });
})();

in these situations we usually are forced to use eval, whereas we know we better not use it:
(function(){
    place72 = map.addMarker({
        lng: 10,
        lat: 10,
    });

    $('.place').mouseout(function(){
        var myOBJName= $(this).data('place-id');
        //it would execute at the same context
        var obj = eval("_OBJ_="+myOBJName);
        obj.setAnimation(/*...*/);
    });
})();


text:
Q: How to filtering Doctrine ManytoOne relationship table by id? I have 3 entities:

*

*First one Seances

*Second lessons

*Last one SeanceLesson entities

I have a form in angular 2. First I will select seance, then select lesson. But this point difficult for me. Because 1 lesson just have a seance. Seance may have more lessons. Shortly when I selected a seance, must list this seance lesson(s). How can do it as simple way?


text:
Q: Where does this space come from? Using colored text inside a minipage results in less vertical space being
appended after the text compared to normal text.  Strangely, this only occurs when the minipage is top-aligned.  In the other cases, the space is consistent.
Also, in both cases there is more space compared to text that isn't inside a minipage.
\documentclass[a4paper]{article}
\usepackage{xcolor}

\renewcommand{\maketitle}[1]{%
  \noindent
  \begin{minipage}[t]{\textwidth}%
    #1
  \end{minipage}
}

\begin{document}
\hrule\relax
\maketitle{\color{blue} Bla.}
\hrule\relax

\vskip\bigskipamount

\hrule\relax
\maketitle{Bla.}
\hrule\relax

\vskip\bigskipamount

\hrule\relax
\noindent {\color{blue} Bla.}
\hrule\relax

\vskip\bigskipamount

\hrule\relax
\noindent Bla.
\hrule\relax
\end{document}

Result:

A: It's a case of the missing %, in this case after the \end{minipage} in the \maketitle definition.
In general, when there is a situation of unwanted space being introduced, the first place to look is always the missing %. See What is the use of percent signs (%) at the end of lines?.
I should note that a number of environments automatically remedy this issue by employing \ignorespaces at the end of their definition.  So, in your case, the following definition would also work (note the absence of the %):
\renewcommand{\maketitle}[1]{%
  \noindent
  \begin{minipage}[t]{\textwidth}%
    #1
  \end{minipage}
  \ignorespaces
}

Here is the MWE which instead adds a %.
\documentclass[a4paper]{article}
\usepackage{xcolor}

\renewcommand{\maketitle}[1]{%
  \noindent
  \begin{minipage}[t]{\textwidth}%
    #1
  \end{minipage}%
}

\begin{document}
\hrule\relax
\maketitle{\color{blue} Bla.}
\hrule\relax

\vskip\bigskipamount

\hrule\relax
\maketitle{Bla.}
\hrule\relax

\vskip\bigskipamount

\hrule\relax
\noindent {\color{blue} Bla.}
\hrule\relax

\vskip\bigskipamount

\hrule\relax
\noindent Bla.
\hrule\relax
\end{document}

A: The accepted answer doesn't include the detailed explanation why the vertical space is here and why it is different in the colored and uncolored version and why the removing of horizontal space (using %) influences the visual vertical space. I try to explain this.
So, the \maketitle macro above starts the horizontal mode (see \noindent) and first "letter" of this mode is the \vtop (the minipage in LaTeX terminology). Then two following spaces are in OP's code. First one after \vtop (in macro, it was corrected by Steven using %) and second one after right brace from the souce line where \maketitle macro is used. After such two spaces the \hrule primitive is read. This primitive invokes \par, because it is read in horizontal mode. So we have:
\vtop{Bla.}\space\space\par

The \par primitive does one \unskip, so we have
\vtop{Bla.}\space

and this material is assembled to the paragraph. The first "letter" \vtop has the width equal to \hsize, so this "letter" fills the whole first line. The space is the break point and the second empty line is created (the Underfull hbox is reported in log file). But if only one space exists after \vtop in horizontal mode, then this space is removed by \par and the whole paragraph has only one line with \vtop as a "letter".
Summary: the paragraph has two lines if there are two spaces at its end. If only one (or none) space is here then only one line paragraph is created.
The second question: why colored version generates different vertical space than uncolored. The uncolored version generates
\vtop{Bla}

and the baseline of this \vtop is equal to the baseline of the text Bla. But colored version generates
\vtop{\special{color setting}Bla}

and the baseline of \vtop goes through the \special. The text Bla is below the baseline and it consists the depth of the \vtop "letter". The second empty line from the two-line paragraph is closer to the text Bla, when this text is below the baseline. Schema:
Uncolored version:

    Bla
------------------ baseline of the first line of paragraph

------------------ baseline of the second line of paragraph
---------------------------- hrule

Colored version:

----special------- baseline of the first line of paragraph
    Bla
------------------ baseline of the second line of paragraph
---------------------------- hrule


text:
Q: hide a span without an id inside a specific ul I installed eshop plugin in wordpress and I've beed told I should hide the span to hide the title
this is the code

to 40 GR MIX

I want to hide the span inside that ul with that class (eshop rand)
remember I can't assign an id to that span
thank you

A: You could use this css class
.eshop.rand span
{
    display: none;
}

or
.eshop-product-127 span
{
    display: none;
}


text:
Q: Computing $\langle (13746) \rangle$ in $S_7$. How to list the elements of subgroup $\langle a \rangle$ in $S^7$ where $$a=\begin{pmatrix} 1 & 2 & 3 & 4 & 5 & 6 & 7 \\ 3 & 2 & 7 & 6 & 5 & 1 &4 \end{pmatrix}?$$  I got $a=(13746)(2)(5)$.
Any help is appreciated!

A: First $1$ goes to $3$, then it goes to $7$, then it goes to $4$, then it goes to $6$, then it goes to $1$.  In cycle notation that's $(13746)$.  $2$ and $5$ are fixed, so there's no need to think about them.
So, let's calculate $a^2$.  $1$ skips over $3$ and goes to $7$, which skips over $4$ to get to $6$, which skips over $1$ to get to $3$, which skips over $7$ to get to $4$, then back to $1$.  So $a^2=(17634)$.
In the same way, we get that $a^3=(14367)$.
Now you try for $a^4$.
Then, I claim that $a^5$ is the identity. Why?
That brings us to $\langle a \rangle = \{\operatorname{id},(13746),(17634),(14367),a^4\}$ (where you calculate $a^4$).

A: Your calculation of $a$ is correct, but (2) and (5) need not be written out. To find the elements of the subgroup, first calculate $a^2 = (1 7 6 3 4)$, then $a^3$, $a^4$, and so on until you get the identity element (1). There won't be very many calculations...

A: We have that
$
a=
\left(
\begin{array}{cccc}
1 & 2 & 3 & 4 & 5 & 6 & 7 \\ 3 & 2 & 7 & 6 & 5 & 1 & 4
\end{array}
\right)
$, which can be expressed as $a=(13746)\\$.
Then $a^2=(13746)(13746)=(17634)\\$.
Similarly, $a^3=(17634)(17634)=(16473)$. We see that the $n^{th}$ power of $a$ takes the entry in the $i^{th}$ position of $a$ to the entry in $i+1^{th}$ entry of $a$.
Since $a^5$ brings each entry of $a$ back to its original location, it is the identity, and $|a|=|⟨a⟩|=5$.


text:
Q: Will Azure Cloud Service in Suspended state with Stopped Web role incur cost? When the Azure Cloud Service is suspended and the Web Role associated with it has status Stopped VM, will this Cloud Service incur VM costs?
If not, how can I stop the Cloud Service so it will not incur cost but can be easily started when needed?

A: UPDATE: I looked into the wrong thing previously. This link may help:
Does Azure Worker Roles get charged $$ when they are Sleeping?
Either way: The short answer is yes. Everything I searched for within SO or Google says that you will still be charged. The only recommendation was to delete.
Azure web site offers a free online chatting tool that allows you to talk to Microsoft directly to know for 100%. If you do that route, then please come back and let us know for future users.
Original (may be useful for future)
I had recently asked Azure the same question. They recommended that I should either stop the server when not in use or move it to a free tier. They also said if the data is still on the VM or Web App, I will still be charged for that.
Your VM says Stopped rather than Stopped (Deallocated) so it may still cost you.
This link may help: https://blogs.technet.microsoft.com/gbanin/2015/04/22/difference-between-the-states-of-azure-virtual-machines-stopped-and-stopped-deallocated/
Try moving it to the free tier.
In addtion to here: https://azure.microsoft.com/en-gb/pricing/details/app-service/linux/
It says:

Am I charged for apps while they are in stopped state? Yes. Rates
  listed apply to apps in stopped state. Please delete apps that are not
  in use, or update the tier to Free to avoid charges.


text:
Q: Changes not reflecting on browser after deploying code on heroku node js app I have an app on Heroku. According to the Heroku App deploy guide I followed the below steps to modify the master.
Steps to make the push on Heroku
$ git add .
$ git commit -am "make it better"
$ git push Heroku master

The build of deploy was successful but the changes didn't reflect on the browser. I used hard refresh multiple times but didn't work.

A: If your app requires a build step to compress and combine assets and you are not seeing recent changes, then it's likely that you are forgetting to run that build step.
If you are using package such as parcel-bundler. you should run it before you deploy it. That would solve the issue.
You can read more on how to run it automatically whenever you deploy your app from here.
https://devcenter.heroku.com/articles/node-best-practices#hook-things-up


text:
Q: What is the functioning of fireevent() in HP QTP / UFT? I am learning HP UFT.
Recently I came across fireevent and I tried to implement it on the website of Flipkart. I was trying to use firevent("onmouseover") for the link Men on the homepage of the website.
I used ChildObjects to find out the Link and WebElement (in two different tests), first Highlighted it and then used object.fireevent("onmouseover") as well as object.fireevent("OnClick"). The OnClick is working and it is showing the link as selected (i.e. the dotted box covering the link when we press tab), but it is not showing the Menu Under Men Section.
I had googled and bingged a lot. But was unable to find the exact working of FireEvent in QTP/UFT.
Please Help me solving the above problem as well as some tutorials on FireEvent.
EDIT: I am using IE 11 for testing.

A: Motti has already answered the technical definition, but I shall attempt to give you a solution to your functional issue.
In my experience .FireEvent often doesn't work as you would expect. An alternative for something like onmouseover is to simulate user behaviour a bit more closely by actually moving the mouse to the desired location. In our framework we have a little extension function to do just that, a pared-down version of which is shown here:
Sub My_MouseOver(objSender)
    Dim absX : absX = objSender.GetROProperty("abs_x")
    Dim absY : absY = objSender.GetROProperty("abs_y")
    Dim width : width = objSender.GetROProperty("width")
    Dim height : height = objSender.GetROProperty("height")
    Dim x : x = (absX + (width / 2))
    Dim y : y = (absY + (height / 2))
    Dim deviceReplay : Set deviceReplay = CreateObject("Mercury.DeviceReplay")
    deviceReplay.MouseMove x, y

    Reporter.ReportEvent micDone, "A step name", "A useful step description"
End Sub
RegisterUserFunc "Link", "MouseOver", "My_MouseOver"
RegisterUserFunc "WebButton", "MouseOver", "My_MouseOver"
RegisterUserFunc "WebElement", "MouseOver", "My_MouseOver"

As an example you can then do as follows to bring up the "ELECTRONICS" menu overlay on flipkart.com (obviously substitute your own Browser and Page definitions):
Browser("Flipkart").Page("Main Nav").Link("xpath:=//a[@data-tracking-id='electronics']").MouseOver

In the original version there's various extra bits of error handling and custom reporting so it tells you what you clicked on, but the essence is the same. It locates the object on screen, calculates the centre and moves the mouse there. You might want to wait a small amount of time for the menu overlay to appear after doing so before calling .Click on one of the newly-displayed sub-elements.

A: I found a solution to my problem and it is working perfectly.
Setting.WebPackage("ReplayType") = 2
object.FireEvent "onmouseover"
Setting.WebPackage("ReplayType") = 1

In this case, the object will be:
Browser("name:=Online Shopping.*").Page("name:=Online Shopping.*").Link("innertext:=Men")

I have tried this and it is working fine. I guess, we do not need any alternatives. But I really don't know is, Ctrl+Space is not working for this in UFT. Don't know the reason.

A: This actually depends on what browser you're using.

Warning: There are exceptions to the information presented in this answer and it also may change in the future. The answer is meant to give a basic understanding but don't depend on it to be true without checking the behaviour for your specific version/use-case.

Originally QTP's FireEvent was supposed to call IE's non-standard fireEvent method.
On Firefox and Chrome this is implemented using the standard dispatchEvent. You should check which events the web site expects to get.
Things get complicated if you mix the event models (the standard DOM level 2 and Microsofts) as explained in this blog post.


text:
Q: Textwatcher not working I have a listview with edittext in each row using a textwatcher to show a toast of content input.
The textwatcher works fine for all the rows except the first row. The toast after input of text fires up consistently after you input text instead of showing only once.
The other rows respond well to the desired behaviour by displaying the toast once every time you change input. The default values for the inputs is 0.
Here is my code inside getView() of my adapter:
//tvItems is my edittext variable reference

TextWatcher tt = new TextWatcher() {

public void afterTextChanged(Editable s) {

                //tvItems.setSelection(s.length());
            }

            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            }

            public void onTextChanged(CharSequence s, int start, int before, int count) {
                tvItems.removeTextChangedListener(tt);

                if (tvItems.getText().toString().trim().length() == 1) {

                  //to check if input is greater than 0 so we can proceed

                    if (Integer.valueOf(tvItems.getText().toString().trim()) > 0) {
                      //displays toast
                         Toast.makeText(activity, s, Toast.LENGTH_SHORT).show();

                        tvItems.removeTextChangedListener(tt);
                    }
                }
                tvItems.addTextChangedListener(tt);
            }
        };
        tvItems.addTextChangedListener(tt);

Any suggestions will be welcomed.
As requested, my full adapter code:

public class ProductListAdapter extends BaseAdapter implements Filterable {
    List<ProductModel> mStringFilterList;
    ValueFilter valueFilter;
    int item_number = 0;
    TextWatcher tt = null;
    private Activity activity;
    private LayoutInflater inflater;
    private List<ProductModel> modelItems;
    private OnAddRemoveListener myaddInterface;
    TextView tvTitle;
    Button minusIcon, addIcon;

    public ProductListAdapter(Activity activity, List<ProductModel> modelItems, OnAddRemoveListener myaddInterface) {
        this.activity = activity;
        this.modelItems = modelItems;
        mStringFilterList = modelItems;
        this.myaddInterface = myaddInterface;
    }

    @Override
    public int getCount() {
        return modelItems.size();
    }

    @Override
    public Object getItem(int location) {
        return modelItems.get(location);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }/*
    @Override
    public boolean isEnabled(int position) {
        return false;
    }*/

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {

        if (inflater == null)
            inflater = (LayoutInflater) activity
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        if (convertView == null)
            convertView = inflater.inflate(R.layout.product_item_row, null);

        final ProductModel m = modelItems.get(position);

        tvTitle = (TextView) convertView.findViewById(R.id.tv2);
        TextView tprice = (TextView) convertView.findViewById(R.id.tv3);
        boolean ignoreNextTextChange = true;
        final EditText tvItems = (EditText) convertView.findViewById(R.id.num);
        tvItems.setText("0");
        minusIcon = (Button) convertView.findViewById(R.id.minus);
        addIcon = (Button) convertView.findViewById(R.id.add);

        //add items
        addIcon.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Log.d("add button", "clicked");
                int new_item_number = 1 + Integer.parseInt(tvItems.getText().toString());
                tvItems.setText("" + new_item_number);
                (myaddInterface).onItemadded(String.valueOf(m.getPrice()), new_item_number, position);
            }
        });

        minusIcon.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Log.d("minus button", "clicked");

                int new_item_number = Integer.parseInt(tvItems.getText().toString());
                if (new_item_number > 0) {
                    (myaddInterface).onItemremoved(String.valueOf(m.getPrice()), position);
                    tvItems.setText("" + (new_item_number - 1));
                } else if (tvItems.getText().toString().equals("0")) {

                    tvItems.setText("0");
                }

            }
        });

        tvTitle.setText(m.getname());
        tprice.setText("(" + m.getPrice() + ")");

    public void afterTextChanged(Editable s) {
        if (tvItems.getText().toString().trim().length() == 1) {

            //to check if input is greater than 0 so we can proceed
            if (Integer.valueOf(tvItems.getText().toString().trim()) > 0) {
               //displays toast
               Toast.makeText(activity, s, Toast.LENGTH_SHORT).show();
            }
         }
    }

    public void beforeTextChanged(CharSequence s, int start, int count, int after) {
    }

    public void onTextChanged(CharSequence s, int start, int before, int count) {
    }
};
        tvItems.addTextChangedListener(tt);
        return convertView;
    }

    //code for search filter, not associated with the question

    @Override
    public Filter getFilter() {
        if (valueFilter == null) {
            valueFilter = new ValueFilter();
        }
        return valueFilter;
    }

    private class ValueFilter extends Filter {
        @Override
        protected FilterResults performFiltering(CharSequence constraint) {
            FilterResults results = new FilterResults();
            if (constraint != null && constraint.length() > 0) {
                ArrayList<ProductModel> filterList = new ArrayList<>();
                for (int i = 0; i < mStringFilterList.size(); i++)
                    if ((mStringFilterList.get(i).getname().toUpperCase())
                            .contains(constraint.toString().toUpperCase()) || (mStringFilterList.get(i).getproductDesc().toUpperCase())
                            .contains(constraint.toString().toUpperCase())) {

                        ProductModel m = new ProductModel(mStringFilterList.get(i)
                                .getProduct_id(), mStringFilterList.get(i)
                                .getname(), mStringFilterList.get(i)
                                .getPrice(), mStringFilterList.get(i)
                                .getimage_url(), mStringFilterList.get(i)
                                .getproductDesc());

                        filterList.add(m);
                    }
                results.count = filterList.size();
                results.values = filterList;
            } else {
                results.count = mStringFilterList.size();
                results.values = mStringFilterList;
                //show no results
            }

           /* }else if((mStringFilterList.get(i).getproductDesc().toUpperCase())
                    .contains(constraint.toString().toUpperCase())){}*/

            return results;

        }

        @Override
        protected void publishResults(CharSequence constraint,
                                      FilterResults results) {
            modelItems = (List<ProductModel>) results.values;
            notifyDataSetChanged();
        }

    }

}

A: set the listener object to edittext,(i.e) tt  ,like this
editText.addTextChangedListener(tt);

A: Can you try this instead:
TextWatcher tt = new TextWatcher() {

    public void afterTextChanged(Editable s) {
        if (tvItems.getText().toString().trim().length() == 1) {

            //to check if input is greater than 0 so we can proceed
            if (Integer.valueOf(tvItems.getText().toString().trim()) > 0) {
               //displays toast
               Toast.makeText(activity, s, Toast.LENGTH_SHORT).show();
            }
         }
    }

    public void beforeTextChanged(CharSequence s, int start, int count, int after) {
    }

    public void onTextChanged(CharSequence s, int start, int before, int count) {
    }
};


text:
Q: How is the past tense of "error" spelt in British English? How is the past tense of "error" spelt in British English?
Wiktionary says that it's "errored", but its entry for errored doesn't explicitly say it's valid for British English, and I thought it'd get another "r" compared to American English.
This question is not a duplicate of Is "errored" correct usage? , because this is asking about spelling, and the other question is about whether using "error" as a verb is "correct" from a prescriptivist perspective.

A: According to oxford, error isn't a verb.
Err is, and here are its forms:

Not to knock wiktionary, but I wouldn't consider errored a verb form. Note that the entry doesn't cite any examples for this sense. Its examples as an adjective seem passable, though, especially in a technical sense.

The mean number of errored bits per errored symbol is therefore...

A: The entry for error (v) in OED has not been updated since 1891. As such, it's unlikely to include modern usages which arise from computing. Even the Oxford Dictionary of Computing is now six years old, which is rather a long time in the field.
Error is used as a verb. It's jargon, and means "produce an error message" or "fail with an error condition" or some such similar event.

*(verb) What a program does when it stops as result of a programming error.

FOLDOC

Because it's computing jargon, it would probably sound out of place when used in other circumstances. It would be incorrect to say that I had errored in constructing this answer.
Computing jargon is generally spelled with American spellings, even in British English. Program and its derivatives are the obvious examples; many languages' verbs are spelled with a -z- spelling (like Oracle's ANALYZE function). Consequently, even if British English doubled the consonant for errorred it would be unlikely to persist.
In fact, there are rules for the doubling of consonants in English [see another ELU question]. There may be exceptions to those rules, but

*

*error doesn't appear to be an exception (ends in schwa, so final consonant stays single);

*its usage comes directly from American English (AmE doubles consonants far more rarely);

*there is no separate entry in Wiktionary or FOLDOC indicating a transatlantic difference.


text:
Q: c# How to find if two objects are equal I want to know the best way to compare two objects and to find out if they're equal. I'm overriding both GethashCode and Equals. So a basic class looks like:
public class Test
{
    public int Value { get; set; }
    public string String1 { get; set; }
    public string String2 { get; set; }

    public override int GetHashCode()
    {
        return Value ^ String1.GetHashCode() ^ String2.GetHashCode();
    }

    public override bool Equals( object obj )
    {
        return GetHashCode() == obj.GetHashCode();
    }
}

So for testing purposes I created two objects:
Test t = new Test()
{
    Value = 1,
    String1 ="One",
    String2 = "One"
};

Test t2 = new Test()
{
    Value = 1,
    String1 = "Two",
    String2 = "Two"
};

bool areEqual = t.Equals( t2 );

In testing this areEqual returns true event though both objects are different. I realise this is because String1 and String2 are the same value in each object and thus cancels each other out when hashing.
Is there a better way off hashing object that the method I have that will resolve my issue?

A: simple
Object.Equals(obj1, obj2);

A: Your current equality method is broken - there are more values than possible hash codes. It's entirely reasonable (and expected) that you will occasionally have values which are unequal but give the same hash. Equals should check the actual values:
public override bool Equals(object obj)
{
    Test test = obj as Test;
    if (obj == null)
    {
        return false;
    }
    return Value == test.Value &&
        String1 == test.String1 &&
        String2 == test.String2;
}

A few things to note:

*

*Your way of generating the hashcode will give the same value for any fixed Value if String1 and String2 are the same; it will also blow up if String1 or String2 is null. This is an unfortunate aspect of using XOR for hashing. I prefer something like this:
// Put this extension method in a utility class somewhere
public static int SafeGetHashCode<T>(this T value) where T : class
{
    return value == null ? 0 : value.GetHashCode();
}

// and this in your actual class
public override int GetHashCode()
{
    int hash = 19;
    hash = hash * 31 + Value;
    hash = hash * 31 + String1.SafeGetHashCode();
    hash = hash * 31 + String2.SafeGetHashCode();
    return hash;
}

*Generally speaking, equality becomes tricky when inheritance gets involved. You may want to consider sealing your class.

*You may also want to implement IEquatable<Test>

A: For any two objects, object equality implies hash code equality, however, hash code equality does not imply object equality.  From Object.GetHashCode on MSDN:

A hash function must have the
  following properties:
If two objects compare as equal, the
  GetHashCode method for each object
  must return the same value. However,
  if two objects do not compare as
  equal, the GetHashCode methods for the
  two object do not have to return
  different values.

In other words, your Equals is written wrong.  It should be something like:
public override bool Equals(object obj)
{
    Test other = obj as Test;
    if (other == null)
        return false;

    return (Value == other.Value)
        && (String1 == other.String1)
        && (String2 == other.String2);
}

GetHashCode is good for collections (like Dictionary<K, V>) to quickly determine approximate equality.  Equals is for comparing if two objects really are the same.

A: You could serialise the two objects to JSON, then compare the two strings to see if they are the same.
For example
JavaSriptSerializer serialiser = new JavaScriptSerializer();

string t1String = serialiser.Serialize(t);
string t2String = serialiser.Serialize(t2);

if(t1String == t2String)
   return true; //they are equal
else
   return false;

A: Your Equals is incorrect - that should define what it means for two things to be equal - and having the same hash-code does not mean equality (however; a different hash-code does mean non-equality). If "equality" means "both strings are pairwise equal", then test that.
Re a better hash; xor is notorious for this, since it is trivial to get 0 by xor a value with itself. A better approach may be something like:
int i = 0x65407627;
i = (i * -1521134295) + Value.GetHashCode();
i = (i * -1521134295) + (String1 == null ? 0 : String1.GetHashCode());
i = (i * -1521134295) + (String2 == null ? 0 : String2.GetHashCode());
return i;

A: wouldn't a function Equals always test only against the same type, shouldn't it be:
//override
    public bool Equals(Test other)//(object obj)
    {
        //return GetHashCode() == obj.GetHashCode();
        return (Value == other.Value) &&
               (String1 == other.String1) &&
               (String2 == other.String2);
    }

regards
Oops


text:
Q: Webpack - Module not found: Error: Can't resolve 'PT' I hope that someone can help me to understand this error.
I have two typescript project:

*

*ProjectTemplate

*Game

They are two very simple projects because I am taking my first steps with typescript and webpack.
In my ProjectTemplate (is located in this path: "C:\personale\Typescript\ProjectTemplate") project i have three files .ts:
Reel.ts
export class Reel {
public id:number;
constructor(idReel:number){
    this.id=idReel;
}

changeReelId(value:number){
    this.id=value;
}

}
Reels.ts
import { Reel } from "./Reel";

export class Reels {
    private reels:Array<Reel>=new Array();
    constructor(numberReels:number){
        if(numberReels>0){
            for(let i:number=0;1<numberReels; i++){
                let reel=new Reel(i);
                this.reels.push(reel);
            }
        }
    }

    printReel(){
        if(this.reels.length>0){
            this.reels.forEach(function (reel:Reel) {
                reel.changeReelId(1);
                console.log(reel.id);
            });
        }
    }
}

Index.ts
import { Reels } from './Reels';

export class Index {
    constructor(){
        const reels:Reels= new Reels(6);
        reels.printReel();
    }

    callMirco(){
        console.log(this);
    }
}

this is my tsconfig.json for ProjectTemplate
{
  "compilerOptions": {
    "target": "es5",                          /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
    "module": "commonjs",                     /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
    "declaration": true,                      /* Generates corresponding '.d.ts' file. */
    "sourceMap": true,                        /* Generates corresponding '.map' file. */
    "outDir": "dist/compiled/",                         /* Redirect output structure to the directory. */
    "strict": true,                           /* Enable all strict type-checking options. */
    "esModuleInterop": true,                  /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
    "forceConsistentCasingInFileNames": true  /* Disallow inconsistently-cased references to the same file. */
  }
}

and this is my webpack.config.js for ProjectTemplate
const path = require('path');
const DtsBundleWebpack = require('dts-bundle-webpack')

module.exports = {
    entry: "./src/index.ts",
    output: {
        filename: "ProjectTemplate.js",
        path: path.resolve(__dirname, 'dist/build')
    },
    resolve: {
        extensions: [".webpack.js", ".web.js", ".ts", ".js"]
    },
    module: {
        rules: [{ test: /\.ts$/, loader: "ts-loader" }]
    },
    plugins: [
        new DtsBundleWebpack({
            name: 'ProjectTemplate',
            main: 'dist/compiled/**/*.d.ts',
            out: '../build/ProjectTemplate.d.ts',
            outputAsModuleFolder: true,
        })
    ]
}

In my Game (is located in this path: "C:\personale\Typescript\Game") project only one project Index.ts:
import {Reel} from "PT";
const r = new Reel(9);
console.log(r);

This is my tsconfig.json for Game project:
{
  "compilerOptions": {
    "target": "es5",                          /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
    "module": "commonjs",                     /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
    "declaration": true,                      /* Generates corresponding '.d.ts' file. */
    "sourceMap": true,                        /* Generates corresponding '.map' file. */
    "outDir": "build",                        /* Redirect output structure to the directory. */

    "strict": true,                           /* Enable all strict type-checking options. */
     "baseUrl": "./",                       /* Base directory to resolve non-absolute module names. */
     "paths": {
       "PT": ["../ProjectTemplate/dist/build/ProjectTemplate.d.ts"]
     },                                       /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
    "esModuleInterop": true,                  /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
    "forceConsistentCasingInFileNames": true  /* Disallow inconsistently-cased references to the same file. */
  }
}

This is my webpack.config.js for Game project
const path = require('path');
const DtsBundleWebpack = require('dts-bundle-webpack')

module.exports = {
    entry: "./src/index.ts",
    output: {
        filename: "main.js",
        path: path.resolve(__dirname, 'build')
    },
    resolve: {
        extensions: [".webpack.js", ".web.js", ".ts", ".js"],
    },
    module: {
        rules: [{ test: /\.ts$/, loader: "ts-loader" }]
    },
    plugins: [
        new DtsBundleWebpack({
            name: 'Game',
            main: 'build/@types/**/*.d.ts',
            outputAsModuleFolder: true,
        })
    ]
}

and this is my index.html in my Game Project
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Game</title>
</head>
<body>
<h1> Test game </h1>
<script type="application/javascript" src="../ProjectTemplate/dist/ProjectTemplate.js"></script>
<script type="application/javascript" src="./build/index.js"></script>
</body>
</html>

The problem is when I try to run webpack build on my Game project I get this error:
ERROR in ./src/index.js
Module not found: Error: Can't resolve 'PT' in 'C:\personale\Typescript\Game\src'
 @ ./src/index.js 3:11-24

I think that I'm missing something in my webpack.config or tsconfig.
Which is way to load PT (ProjectTemplate) module in my game project?

A: Webpack and typescript working separetely, webpack doesn't know about ts and ts doesn't know about webpack.
So in this sutuation you told to ts what 'PT' is (via paths), but you didn't do that for webpack.
Please add these lines to the webpack configuration at the root level
resolve: {
  alias: {
    PT: path.resolve(__dirname, '../ProjectTemplate')
  }
}

Also, you are not exporting Reel class directly, so when importing you should use
import {Reel} from 'PT/Reel'
import {Reels} from 'PT/Reels'
import {Index} from 'PT/Index'


text:
Q: Play mp4 fullscreen automatically when click play I have a webpage with a video link, when the user click on the link, the user will be directed to the mp4 file etc example.com/myvideo.mp4. Just wondering if is it possible when user click play, the video will automatically go full screen? I did some research, it seems like we need a button to trigger it to play fullscreen.

A: You can find information regarding FULLSCREEN API here : https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API


text:
Q: Can't get any results from this SPARQL query I've asked a question before here
Generate an incremental SPARQL query
and thank god I manage to solve it.
Here is my solution:
private String completeQuery(String coreQuery){
    String completeQuery = "";
    completeQuery += "SELECT * WHERE {"+ "\n";
    completeQuery += coreQuery + "\n";
    completeQuery =completeQuery + "}" + "\n" +"limit 5" ;
    return completeQuery;
}

public String link(String object1, String object2, int distance){
    if(distance == 1){
        String Quer = "<http://dbpedia.org/resource/"+object1+">" + " ?pre1 " +"<http://dbpedia.org/resource/"+object2+">";
        return completeQuery(Quer);
    }
    else {
        String query = "<http://dbpedia.org/resource/"+object1+">" + " ?pre1 ?obj1 " + ".\n";
        for(int i = 1; i < distance-1; i++){
            query += "?obj" + i + " ?pre" + (i+1) + " ?obj" + (i+1) + ".\n" ;

        }
        query  += "?obj" + (distance-1) + " ?pre" + distance + " " + "<http://dbpedia.org/resource/"+object2+">";
        return completeQuery(query);
    }
}

and from the main I just try to print the query string to figure out if it is right or not:
String queryString = "";

    int maxDistance =2;
    PathFinder pf = new PathFinder();

    for (int distance = 1; distance<=maxDistance ; distance ++)
    {
        System.out.println("\nQueries for distance: "+distance);
        queryString = pf.link("Lionel_Messi","Spanish_language",distance);
        System.out.println(queryString);}

and the result is good so far
Queries for distance1: SELECT * WHERE {<http://dbpedia.org/resource/Lionel_Messi> ?pre1 <http://dbpedia.org/resource/Spanish_language>}limit 5

Queries for distance2: SELECT * WHERE { <http://dbpedia.org/resource/Lionel_Messi> ?pre1 ?obj1 . ?obj1 ?pre2 <http://dbpedia.org/resource/Spanish_language> }limit 5

now, I'm trying to execute these queries but I don't know how to do it
if it was a simple query , something like (select ?abstract where ...) the execution will be for example:
QueryExecution qe = QueryExecutionFactory.sparqlService(service, query);

                ResultSet results = qe.execSelect();
                for (; results.hasNext();){
                    QuerySolution sol = (QuerySolution) results.next();
                    System.out.println(sol.get("?abstract"));
                }

but if the query is like (select * where) how can I get the results without knowing the specific elements I want to print? it's all depend on my distance and what queries it will return ....

A: This is not something you can solve just by means of SPARQL alone - you will need to use the capabilities of the API toolkit you're using to handle queries and results. Since you are using Jena, you should have a look at the documentation for Jena's ResultSet object. It has a method getResultVars() which gives you a list with all variable names in the result. You can then use this to iterate over the result and get the variable-bindings in each solution, e.g. to simply print them:
 List<String> varNames = results.getResultVars();

 while(results.hasNext()) {
       QuerySolution sol = (QuerySolution) results.next();
       for (String var: varNames) {
              System.out.println("value of " + var + ": " + sol.get(var));
       }
 }


text:
Q: displaying the output in Ouput windows in visual studio 2015 I'm debugging the c++ console application in visual studio 2015 but output is not displaying in debug output window.
    std::ostringstream buffer;
    std::cout << "\n result: \n";
    for (int i = 0; i < size; i++)
    {
        buffer << array[i] << ",";
    }
    buffer << "\n";

In the output there are some warnings Cannot find or open the PDB file but it may not be reason.
What is the problem ?

A: To display in MSVC debug output you need to use ::OutputDebugString().
eg ::OutputDebugString( buffer.str() );


text:
Q: Non-authoratative Nameservers Lets say that example.com is a domain hosted on only one machine with primary nameserver ns1.example.com hosted on a seperate machine. Additionally, the machine hosting example.com is running a BIND9 DNS server. Would ns1.example.com function as an authoratative nameserver while the BIND9 server would function as a non-authoratative nameserver? Thanks.

A: Probably. It depents how you configure them. There are many misconfigured authoritive nameservers around that also do resolve. Even TLD operators do that bad practise: http://tinyurl.com/co4r59m
It's better to keep those strictly seperated.
I cannot tell how your nameservers are configured without know them, or without seeing the configuration.


text:
Q: Segmentation fault and dynamic memory handling Ok, two questions.
first of all
Q1. I allocated sufficient memory at run time, still after running case 6 two times in a row, the s1 prints garbage, and on running case 6 for a third time the value of s1 disappeared
the first image shows the garbage value at the end of string
[the second image shows the string 1 has disappeared][2]
Q2. the STCPY( COPY FUCTION) is not working properly, its showing segmentation fault, but again, I reallocated sufficient memory.( I need to copy s2 to s1, so I reallocated L2(string 2's length) to s1 so that there won't be memory wastage)
segmentation fault
here's the code:
#include<iostream>
#include<string>
#include<cstring>

using namespace std;

int STRLEN(char* S){
int i=0;
while(S[i] != '\0'){
    i++;
}
return i;
}

int SUBSTR(char* str1, char* str2){
    //string str1;
    //string str2;
    int L1=0,L2=0;
int i,j,flag=0;
int count=0;
            /*cout<<"\nEnter main string greater characters(str1) : ";
            cin>>str1;

            cout<<"\nEnter phrase to find (str2) : ";
            cin>>str2;
            */
            L1 = STRLEN(str1); //calculate legth of strings
            L2 = STRLEN(str2);
            for(i=0;i<L1;i++){
                count = 0;
                flag = 0;
                for(j=0;j<L2;j+=1){
                    if(str1[i]==str2[j])
                    {
                        //good
                        if(j==L2) //successful phrase's each character
traversed
                        {
                            break;
                        }
                        i++;
                        count++;
                        //j++;
                    }
                    else
                    {
                        break;
                    }
                } //terminate inner for loops
                {
                    i -= count; //i was incremented explicitly in
inner loop. for normal operation,
                }               // i has to be decremented by equal
no. of increments in inner loop
                if(j==L2) //flag for successful traversing of phrase 2
in string 1
                {
                    flag = 1;
                    break;
                }

            }

            if(flag == 1)
            {
                cout<<"\nSUBTRING PRESENT AT "<<(i+1);
            }
return 0;
}

int STREQL(char* str1, char* str2){
    int flag = 0;
    int L1=0,L2=0;
int i,j;
int count=0;
                      /*  cout<<"\nEnter first word  : ";
            cin>>str1;

            cout<<"\nEnter second word : ";
            cin>>str2;*/
        char* p1;
        char* p2;

    p1 = str1;
        p2 = str2;
        while(*(p1) != '\0')
        {
            if(*(p1) == *(p2))
            {
             //good
             p1++;
             p2++;
            }
            else{
                flag = 1;
                break;
            }
        }
        if(flag == 1 )
        {
            cout<<"\n STRINGS ARE NOT EQUAL";
        }
        else{
            cout<<"\n STRINGS ARE EQUAL";
        }

return 0;
}

int STCPY(char* s1, char* s2){

    int L2 = STRLEN(s2);
    int L1 = STRLEN(s1);
cout<<"\nPASS 1";
        char* s3 = (char*)realloc(s1,L2); //Note :- s3 and s1 point to
same memory location
cout<<"\nPASS 2";
        while(s2 != '\0')
        {
        *s3 = *s2;
        s3++;
        s2++;
        }
cout<<"\nPASS 3";
s3 -= L2;
s2 -= L2;

cout<<"\n STRING 1 = "<<s1;
cout<<"\n STRING 2 = "<<s2;
return 0;
}

int STRREV(){
return 0;
}

int STRLEN(char* str1, char* str2){
    int L1=0,L2=0;

    L1=STRLEN(str1);
    L2=STRLEN(str2);
    cout<<"\nSTRING 1 LENGTH = "<<L1;
    cout<<"\nSTRING 2 LENGTH = "<<L2;
return 0;
}

int STRCAT(char* s1, char* s2)
{
    int L1=0,L2=0;
    int i,j;

    L1=STRLEN(s1);
    L2=STRLEN(s2);
    //cout<<"\nSTRING 1 LENGTH = "<<L1;
    //cout<<"\nSTRING 2 LENGTH = "<<L2;

    char* s3 = (char*)realloc(s1,(L1+L2));

int cnt=0;
for(i=L1,s3 = s3+L1; *s2 != '\0'; i++)
{
*s3 = *s2;
s2++;
s3++;
 cnt++;
}
s3 = s3-cnt-L1;
s2 = s2-cnt;
//cout<<"\nConcatenated string s3 =  "<<s3;
//cout<<"\nConcatenated string s1 =  "<<s1;

    cout<<"\nSTRING 1 = "<<s1;
    cout<<"\nSTRING 2 = "<<s2;
return 0;
}

int main(){

int i,j,choice;
char* s1;
char* s2;
cout<<"\nEnter string : ";
s1 = (char*)malloc(50);// ok i made this 50 bytes instead of 10
cin.getline(s1,50);    // cause u guys arguing, but still that doesn't change the output
//cout<<s1;

cout<<"\nEnter string : ";
s2 = (char*)malloc(50);
cin.getline(s2,50);
//cout<<s2;

cout<<"\n------------MENU------------";
cout<<"\n1.SUBSTRING FIND";
cout<<"\n2.EQUAL CHECK";
cout<<"\n3.COPY STRING";
cout<<"\n4.REVERSE";
cout<<"\n5.STRING LENGTH";
cout<<"\n6.STRING CONCATENATION";
cout<<"\n7.EXIT";
cout<<"\n----------------------------";
do{
cout<<"\n\nEnter your choice : ";
cin>>choice;

    switch(choice)
    {
    case 1:
        SUBSTR(s1, s2);
        break;
    case 2:
            STREQL(s1, s2);
        break;
    case 3:
        STCPY(s1, s2);
        break;
    case 4:
        STRREV();
        break;
    case 5:
        STRLEN(s1, s2);
        break;
    case 6:
        STRCAT(s1, s2);
        break;
    case 7:
        break;
    }
}while(choice != 7);
return 0;
}

A: Replace everything under "PASS 2" log to this:
    while(*s2 != '\0')
        {
          *s3 = *s2;
          s3++;
          s2++;
        }

Observe that s2 != '\0' means basically: s2 != nullptr which is never true. That's why you get segmentation fault.

A: A C string is ended with a final \0. So the memory footprint is strlen(str) + 1 byte.
The problem with your STRCAT function is that you forgot to add space for the final \0 (s3 = realloc(s1, L1+L2 +1), and you also forgot to add the final \0 (s3[L1+L2] = 0).
idem for your STCPY function, + s2 != 0 to replace with *s2 != 0


text:
Q: Get value from  tag on external page using Javascript/jQuery I have an internal webpage for my team which currently has an iframe which shows a small section of our ticketing site to show how many unassigned tickets are in our queues.
I find this iframe to be quite an eyesore and I would like to simply have text that gets the number from our ticketing site and outputs that as plain text on my page.
I know that, on the external page, the value I want is in:
html > body.view.views-show > div#page > div > div#container.clearfix > div#contentwrapper > div#contentcolumn > div#content.content-grey > h2 > span.item-count
From my schooling days I would use something like GetElementById for this, but that only applies to the page the script is on.  How would I do something like this for an external site?

A: In that case you have to request the page by:
$.get(url, function (html) {
  var $html = $(html);
  console.log($html.find('span.item_count').text());
});


text:
Q: How to set JVM XMX parameter for SQL Workbench? (increase available memory) I'm running Sql Workbench/J and keep running out of memory on a heavy query. (on MAC osx)
I just need to fetch this data once in a blue moon and would like to increase the available memory.
The exact error I get is:

I found a solution when running from terminal which is to use the command below, but I would like to have one from the Sql Workbench application itself:
java -Xmx4g -jar sqlworkbench.jar

A: Disclaimer: I am not a Mac user.
The memory setting that is used for the MacOS launcher is stored in the file Info.plist which should be inside the sub-folder Contents of the SQL Workbench/J "app" folder (not sure how this is called).
There is already an entry with -Xmx2048m present that you can change.


text:
Q: php preg_split split string to array from square brackets I want to split the string from square brackets without removing any character. I tried the below code but it's not working for me.
$value = "
 Lorem ipsum dolor [State] sit amet, consectetur [City] adipisicing [TopJob7] elit, sed do eiusmod [JobType]
";

$tagsReplace = preg_split('/[\[]*[\][]/U', $value, -1);

echo '
';
print_r( $tagsReplace );
exit;

When I run the above code I got the output like
Array
(
    [0] =>
 Lorem ipsum dolor
    [1] => State
    [2] =>  sit amet, consectetur
    [3] => City
    [4] =>  adipisicing
    [5] => TopJob7
    [6] =>  elit, sed do eiusmod
    [7] => JobType
    [8] =>

)

I want output like below.
Array
(
    [0] =>
 Lorem ipsum dolor
    [1] => [State]
    [2] =>  sit amet, consectetur
    [3] => [City]
    [4] =>  adipisicing
    [5] => [TopJob7]
    [6] =>  elit, sed do eiusmod
    [7] => [JobType]
    [8] =>

)

Please help me where I did a mistake.

A: Your pattern [\[]*[\][] matches 0+ times an opening bracket and then either a opening or closing bracket giving you either a [ or n ]
To keep the delimiters you could capture in a group matching from [ to ] and match what is in between using a negated character class  matching not a closing bracket.
Use the PREG_SPLIT_DELIM_CAPTURE flag to keep the delimiter.
Note that you don't need the /U flag.
(\[[^]]+\])

Explanation

*

*( Capturing group

*

*\[ Match [

*[^]]+ Match 1+ times not a ]

*\] Match ]

*) Close group

Regex demo | Php demo
For example:
$value = "
 Lorem ipsum dolor [State] sit amet, consectetur [City] adipisicing [TopJob7] elit, sed do eiusmod [JobType]
";
$tagsReplace = preg_split('/(\[[^]]+\])/', $value, -1, PREG_SPLIT_DELIM_CAPTURE);
print_r( $tagsReplace );


text:
Q: XSL - how to set max length of whole output text file <xsl:output method="text" xmlns:saxon="http://saxon.sf.net/" saxon:line-length="1000"/>

I have tried something like that but its not working
eXAMPLE :)
let say I have xml
<?xml version="1.0" encoding="UTF-8"?>
<LeveL Plan="1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema">

<space2000>
<values>
<value jak="77" rak="12"</value>
<value jak="66" rak="345"></value>
<value jak="-50" rak="67"></value>
<value jak="But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?" rak="Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?">1</value>
</values>

</space2000>

</LeveL>

I would like to do some operations like
<xsl:stylesheet version="2.0"
xmlns:fn ="http://www.w3.org/2005/xpath-functions"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<xsl:output method="text" xmlns:saxon="http://saxon.sf.net/" saxon:line-length="1000"/>

<xsl:template match="/">
<xsl:for-each select="(LeveL/space2000/values)">
<xsl:variable name="JJJ"  select="(value/@jak"/>
<xsl:variable name="RRR"  select="(value/@rak)"/>
<xsl:text>
O
</xsl:text>
<xsl:text>LA</xsl:text>
<xsl:value-of select="$JJJ"></xsl:value-of>
<xsl:text> </xsl:text><xsl:text>LO</xsl:text>
<xsl:value-of select="$RRR"></xsl:value-of>
<xsl:text>
O
</xsl:text>

<xsl:choose>
     <xsl:when test="( $JJJ gt 0)">
        <xsl:value-of select="$JJJ"/>
     </xsl:when>
     <xsl:when test="( $JJJ lt 0)">
        <xsl:value-of select="$RRR"/>
     </xsl:when>
       <xsl:when test="( $RRR gt 0)">
        <xsl:value-of select="fn:concat($JJJ,$RRR)"/>
     </xsl:when>
     <xsl:when test="( $RRR lt 0)">
        <xsl:value-of select="00000000000000"/>
     </xsl:when>

</xsl:choose>

</xsl:for-each>

</xsl:template>

</xsl:stylesheet>

and I would like to have otput text not longer than 1000 signs
  including spaces and it should be just cuted after 1000 signs

A: Your question is not clear and the example is especially confusing.
If I am guessing correctly, you want to progressively concatenate the string-values of some nodes, until you reach a string of some predefined length. The following example shows a method do this:
XML
<root>
    <item>Not responsible for direct, indirect, incidental or consequential damages resulting from any defect, error or failure to perform.</item>
    <item>This news release contains forward-looking statements that involve risks, uncertainties and assumptions.</item>
    <item>If such risks or uncertainties materialize or such assumptions prove incorrect, the results of this organization and its consolidated subsidiaries could differ materially from those expressed or implied by such forward-looking statements and assumptions.</item>
    <item>All statements other than statements of historical fact are statements that could be deemed forward-looking statements, including but not limited to statements of the plans, strategies and objectives of management for future operations;</item>
    <item>any statements concerning expected development, performance or market share relating to products and services;</item>
    <item>anticipated operational and financial results; any statements of expectation or belief; and any statements of assumptions underlying any of the foregoing.</item>
    <item>Risks, uncertainties and assumptions include the achievement of expected results and other risks that are described from time to time in quarterly reports.</item>
    <item>This organization assumes no obligation and does not intend to update these forward-looking statements.</item>
</root>

XSLT 1.0
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="utf-8" />

<xsl:template match="/root">
    <xsl:call-template name="get-text">
        <xsl:with-param name="items" select="item"/>
    </xsl:call-template>
</xsl:template>

<xsl:template name="get-text">
    <xsl:param name="items" select="/.."/>
    <xsl:param name="text"/>
    <xsl:param name="max-length" select="300"/>
    <xsl:param name="prefix">BEGIN ITEM:
</xsl:param>
    <xsl:param name="suffix">
END ITEM

</xsl:param>
    <xsl:variable name="next-text">
        <xsl:value-of select="$text"/>
        <xsl:value-of select="$prefix"/>
        <xsl:value-of select="$items[1]"/>
        <xsl:value-of select="$suffix"/>
    </xsl:variable>
    <xsl:choose>
        <xsl:when test="string-length($next-text) < $max-length">
            <!-- recursive call -->
            <xsl:call-template name="get-text">
                <xsl:with-param name="items" select="$items[position() > 1]"/>
                <xsl:with-param name="text" select="$next-text"/>
            </xsl:call-template>
        </xsl:when>
        <xsl:otherwise>
            <xsl:value-of select="substring($next-text, 1, $max-length)"/>
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>

</xsl:stylesheet>

Result
BEGIN ITEM:
Not responsible for direct, indirect, incidental or consequential damages resulting from any defect, error or failure to perform.
END ITEM

BEGIN ITEM:
This news release contains forward-looking statements that involve risks, uncertainties and assumptions.
END ITEM

BEGIN ITEM:
If such r

In this example, the result contains exactly 300 characters.
If using XSLT 2.0, you could replace the recursive named template with a function.


text:
Q: Search MySQL database with regex substitutions I want to make a product search engine where the user types in a product code and it will bring back the result, this is easy.
But, I want to be able to compensate for numbers that look like letters and vice versa.
E.g a user types 6O12l, but the product code is actually 60121.
What do I need to put in the SQL query to bring back all products with 6O12l and/or 60121?

So far I have this which isn't working, it keeps bringing back the same result everytime no matter what I type in:
$searchString = $_POST['query'] ;
$searchString = preg_replace('#\W#', '', $searchString);

$firstLetter = substr($searchString, 0, 1) ;

include("db.php") ;

$result = $dbh->prepare("SELECT productCode
                     FROM products
                     WHERE productCodeREGEXP '6[O0]12[1l]'
                     AND productCode LIKE '$firstLetter%'") ;
$result->execute() ;

while($row = $result->fetch(PDO::FETCH_ASSOC)) {
echo $row['productCode'].'<br />' ;
}

I have managed to get it working, but I have encountered a new problem.
I'm using str_replace to substitute the letters for numbers and viceversa in the users query string, but it will only work for one or the other, not both:
$qString = str_replace(array('o', 'l', '0', '1'), array('[O0]', '[1l]', '[O0]', '[1l]'), $searchString) ;

Which gives me a mangled output of e.g. A[[1l]l]BC
Instead of A[1l]BC

A: Use this:
SELECT * from products
where code REGEXP '6[O0]12[1l]'

A: Do you have product codes with letters?  You can translate the query string to all numbers before you run the query.  That's the easiest thing to do, and will be much faster than testing for both.

A: You can't search the database efficiently with regular expressions. However, you can transform your data for storage in a normalised form, and search using a normalised query string e.g. all O's to zeros, I and l's to ones and so on.

A: I solved it :D
For reference, I found this function on PHP.net:
function search_replace($s,$r,$sql)
{ $e = '/('.implode('|',array_map('preg_quote', $s)).')/';
$r = array_combine($s,$r);
return preg_replace_callback($e, function($v) use ($s,$r) { return $r[$v[1]]; },$sql);
}

A: Another option
// regex expresssion
// str_replace goes in order, first change letters to numbers, then change to the regex
// 6012ol becomes 6[0O][1l]2[0O][1l]
$regexString = str_replace(array('o', 'l', '0', '1'), array('0', '1', '[0O]', '[1l]'), $searchString);

// like expression, allows the database to make the initial filter, _ is the single character match
// 6012ol becomes 6__2__
$likeString = str_replace(array('o', 'l', '0', '1'), '_'), $searchString);

$filt1 = "(productCode LIKE '$likeString%')"; // last % allows for partial matches
$filt2 = "(productCode REGEXP '$regexString')";

// now query, with the like filter first
$dbh->prepare("SELECT productCode
                      FROM products
                      WHERE $filt1 AND $filt2
              ") ;


text:
Q: Add ACF Field to WooCommerce order list column I Have tried this code, it added column and add data is displaying only "Acknowledge Not Updated" I want to display this metadata "acknowledge_noo", This is "acknowledge_noo" ACF Field
add_filter( 'yith_wcfm_print_shortcode_template_args', 'yith_wcfm_print_shortcode_template_args', 20 );
if ( ! function_exists( 'yith_wcfm_print_shortcode_template_args' ) ) {
function yith_wcfm_print_shortcode_template_args( $cols ) {
$columns = $cols['columns'];
    $keys            = array_keys( $columns );
    $first           = array_slice( $columns, 0, $ship_to_pos );
    $last            = array_slice( $columns, $ship_to_pos + 1 );
$billing_to_col = array( 'acknowledge' => __( 'Acknowledge', 'yith-frontend-manager-for-woocommerce') );
$cols['columns'] = array_merge( $first,$billing_to_col, $last );
    return $cols;
}
}
add_action( 'yith_wcfm_order_cols', 'yith_wcfm_order_biloing_to_coll', 10, 2 );
if ( ! function_exists( 'yith_wcfm_order_biloing_to_coll' ) ) {
function yith_wcfm_order_biloing_to_coll( $column, $post) {
    if ( 'acknowledge' == $column ) {
        global $post;
    if ( $address = $order = wc_get_order( $post->ID ) ) {
     $address = wc_get_order_item_meta( $item_id, 'acknowledge_noo', true );
        $tooltip = __('Print details', 'textdomain');
        echo ''.$address.'';
        }
        else {
            echo 'Acknowledge Not Updated';
        }
    }
}
}


text:
Q: distinct + rank over join lets say we have a table BNK_ACCT_GRP_ST with these columns:
Column Name                          ID   Pk    Null? Data Type
BNK_ACCT_GRP_ST_ID1                  1          N     NUMBER (15)
BNK_ACCT_ID                          2          N     NUMBER (15)
BNK_ACCT_GRP_ID                      3          N     NUMBER (15)
BNK_ACCT_GRP_ST_CD                   4          N     NUMBER (4)
BNK_ACGRP_ST_SRC_EVNT_TYP_CD         8          N     NUMBER (4)
BNK_ACGRP_ST_SRC_TRAN_ID             9          N     NUMBER (15)
FNCL_GRP_ID                          10         N     NUMBER (15)
CREN_DT                              12         N     DATE
LAST_UPD_DT                          13         N     DATE
PCSG_DT                              14         N     DATE
BNK_ACCT_GRP_ST_SEQ_NO               15         N     NUMBER (15)

its populated with bnk_accts data :
example#1:
BNK_ACCT_GRP_ST_ID  BNK_ACCT_ID BNK_ACCT_GRP_ID BNK_ACCT_GRP_ST_CD BNK_ACGRP_ST_SRC_EVNT_TYP_CD FNCL_GRP_ID BNK_ACCT_GRP_ST_SEQ_NO
2282                150627009   1724            4                  150                          111111111   2
2283                150627009   1440            2                  149                          111111112   1
1908                150627009   1725            2                  134                          111111111   1
1906                150627009   1441            2                  135                          111111111   7

and example #2:
BNK_ACCT_GRP_ST_ID  BNK_ACCT_ID BNK_ACCT_GRP_ID BNK_ACCT_GRP_ST_CD BNK_ACGRP_ST_SRC_EVNT_TYP_CD FNCL_GRP_ID BNK_ACCT_GRP_ST_SEQ_NO
2364                150275031   1435            2                  114                          133333333   3
2365                150275031   1436            7                  116                          133333333   2
1902                150275031   1435            1                  72                           133333333   2
1903                150275031   1435            2                  36                           133333333   1
1904                150275031   1436            5                  74                           133333333   1

where:

*

*BNK_ACCT_GRP_ST_ID is autoincrement field,

*BNK_ACCT_ID is actualy bank account # id,

*BNK_ACCT_GRP_ID is grp id (which always increasing),

*BNK_ACCT_GRP_ST_CD, BNK_ACGRP_ST_SRC_EVNT_TYP_CD and BNK_ACGRP_ST_SRC_TRAN_ID are some id's for trans purposes,

*FNCL_GRP_ID - id of the bankiing insitution where this bank acc belongs to

what i need : to create a query to pull latest BNK_ACCT_GRP_ID for each BNK_ACCT_ID based on FNCL_GRP_ID. here one bank acc can belongs to one or more then one fncl instituion, so the query should return this output:
for example#1:
FNCL_GRP_ID  BNK_ACCT_ID  BNK_ACCT_GRP_ID
111111111    150627009    1725
111111112    150627009    1440

for example#2:
FNCL_GRP_ID  BNK_ACCT_ID  BNK_ACCT_GRP_ID
133333333    150275031    1436

I have tried a lot of the things lately, such as a combo of
(select distinct BNK_ACCT_ID,FNCL_GRP_ID) join to rank() over (partiton  by )

but with no luck.

A: Try this:
WITH BankData AS
(
    SELECT  a.*,
            ROW_NUMBER()
              OVER(PARTITION BY fncl_grp_id, bnk_acct_id ORDER BY bnk_acct_grp_id DESC) AS Position
      FROM bnk_acct_grp_st a
)
SELECT  *
  FROM  BankData
 WHERE  Position = 1

A: @Chandu's is a rather universal solution allowing you to pull arbitrary columns along with the maximum values. But if you only need those three columns (FNCL_GRP_ID, BNK_ACCT_ID, BNK_ACCT_GRP_ID) in the output, you could also use a good old GROUP BY clause:
SELECT
  FNCL_GRP_ID,
  BNK_ACCT_ID,
  MAX(BNK_ACCT_GRP_ID) AS BNK_ACCT_GRP_ID
FROM BNK_ACCT_GRP_ST
GROUP BY
  FNCL_GRP_ID,
  BNK_ACCT_ID


text:
Q: Implementation of SVM for classification without library in c++ I'm studying Support Vector Machine last few weeks. I understand the theoretical concept how I can classify a data into two classes. But its unclear to me how to select support vector and generate separating line to classify new data using C++.
Suppose, I have two training data set for two classes

After plotting data, I get the following feature space with vector and here, separating line is also clear.

How to implement this in C++ without library functions. It will help me to clear my implementation concept about SVM. I need to be clear about implementation as I'm going to apply SVM in opinion mining for my native language.

A: I will join to most people's advice and say that you should really consider using a library. SVM algorithm is tricky enough to add the noise if something is not working because of a bug in your implementation. Not even talking about how hard is to make an scalable implementation in both memory size and time.
That said and if you want to explore this just as a learning experience, then SMO is probably your best bet. Here are some resources you could use:
The Simplified SMO Algorithm - Stanford material PDF
Fast Training of Support Vector Machines - PDF
The implementation of Support Vector Machines using the sequential minimal optimization algorithm - PDF
Probably the most practical explanation that I have found is the one on the chapter 6 of the book Machine Learning in action by Peter Harrington. The code itself is on Python but you should be able to port it to C++. I don't think it is the best implementation but it might be good enough to have an idea of what is going on.
The code is freely available:
https://github.com/pbharrin/machinelearninginaction/tree/master/Ch06
Unfortunately there is not sample for that chapter but a lot of local libraries tend to have this book available.

A: Most cases SVM is trained with SMO algorithm -- a variation of coordinate descent that especially suits the Lagrangian of the problem.
It is a bit complicated, but if a simplified version will be ok for your purposes, I can provide a Python implementation.
Probably, You will be able to translate it to C++
class SVM:
  def __init__(self, kernel='linear', C=10000.0, max_iter=100000, degree=3, gamma=1):
    self.kernel = {'poly'  : lambda x,y: np.dot(x, y.T)**degree,
                   'rbf'   : lambda x,y: np.exp(-gamma*np.sum((y - x[:,np.newaxis])**2, axis=-1)),
                   'linear': lambda x,y: np.dot(x, y.T)}[kernel]
    self.C = C
    self.max_iter = max_iter

  def restrict_to_square(self, t, v0, u):
    t = (np.clip(v0 + t*u, 0, self.C) - v0)[1]/u[1]
    return (np.clip(v0 + t*u, 0, self.C) - v0)[0]/u[0]

  def fit(self, X, y):
    self.X = X.copy()
    self.y = y * 2 - 1
    self.lambdas = np.zeros_like(self.y, dtype=float)
    self.K = self.kernel(self.X, self.X) * self.y[:,np.newaxis] * self.y

    for _ in range(self.max_iter):
      for idxM in range(len(self.lambdas)):
        idxL = np.random.randint(0, len(self.lambdas))
        Q = self.K[[[idxM, idxM], [idxL, idxL]], [[idxM, idxL], [idxM, idxL]]]
        v0 = self.lambdas[[idxM, idxL]]
        k0 = 1 - np.sum(self.lambdas * self.K[[idxM, idxL]], axis=1)
        u = np.array([-self.y[idxL], self.y[idxM]])
        t_max = np.dot(k0, u) / (np.dot(np.dot(Q, u), u) + 1E-15)
        self.lambdas[[idxM, idxL]] = v0 + u * self.restrict_to_square(t_max, v0, u)

    idx, = np.nonzero(self.lambdas > 1E-15)
    self.b = np.sum((1.0 - np.sum(self.K[idx] * self.lambdas, axis=1)) * self.y[idx]) / len(idx)

  def decision_function(self, X):
    return np.sum(self.kernel(X, self.X) * self.y * self.lambdas, axis=1) + self.b

In simple cases it works not much worth than sklearn.svm.SVC, comparison shown below

For more elaborate explanation with formulas you may want to refer to this ResearchGate preprint.
Code for generating images can be found on GitHub.


text:
Q: File Upload Not Working Form Tag PHP MongoDB I am trying to get pics uploaded and stored into my database.  Problem is, I am not that great with HTML and have just been Copy/Pasting tags to get forms I like and editing where I think things should go.  I am pretty sure it has something to do with the html tags I am using, because by itself it works fine, but when I Copy/Paste that code to where, I think, it should be on my registration form, the if statement that checks for type and size regulations always returns false.  It must have something to do with the form/post/submit button combo being pasted into, the working, registration form page.
This is my working upload test code

<form   method  = "post" enctype = "multipart/form-data">
Filename:
<input  type    = "file"   name = "file"   id = "file" />
<input  type    = "submit" name = "Submit" value ="Submit">
</form>

<?php
if (!empty($_FILES['file']))
{
    if ((( $_FILES["file"]["type"] == "image/gif")
        || ($_FILES["file"]["type"] == "image/jpeg")
        || ($_FILES["file"]["type"] == "image/pjpeg"))
        && ($_FILES["file"]["size"] < 5000000))
    {
        if ($_FILES["file"]["error"] > 0)
        {
            header("Location: http://www.drink-social.com/error.php?upload=".$_FILES["file"]["error"]);
            exit();
        }

        else if (file_exists("/var/www/pics/".$_FILES["file"]["name"]))
        {
            header("Location: http://www.drink-social.com/error.php?upload=exists");
            exit();
        }

        move_uploaded_file($_FILES["file"]["tmp_name"], "/var/www/pics/".$_FILES["file"]["name"]);
    }
}
?>

Now, this is what my registration page, after I Copy/Paste the sections together, looks like:

Please enter your details below:

<form   name = "Details" method = "post">

Username:   <input type = "text" name = "Username">

Password:   <input type = "text" name = "Password">

Name:       <input type = "text" name = "Name">

Address:    <input type = "text" name = "Line1">

Line 2:     <input type = "text" name = "Line2">

City:       <input type = "text" name = "City">

State:      <input type = "text" name = "State">

Zip:        <input type = "text" name = "Zip">

Now let's get those daily deals...

Monday:     <input type = "text" name = "Monday">

Tuesday:    <input type = "text" name = "Tuesday">

Wednesday:  <input type = "text" name = "Wednesday">

Thursday:   <input type = "text" name = "Thursday">

Friday:     <input type = "text" name = "Friday">

Saturday:   <input type = "text" name = "Saturday">

Sunday:     <input type = "text" name = "Sunday">

<form   method  = "post" enctype = "multipart/form-data">
Filename:
<input  type    = "file"   name = "file"   id = "file" />
<input  type    = "submit" name = "Submit" value ="Submit">
</form>

<?php
include_once("host_class.php");
include_once("event_class.php");

if (!empty($_POST['Username']))
{
    $host  = new Host();
    $event = new Event();

    if ($host->i_exist($_POST['Username']))
    {
        header("Location: http://www.drink-social.com/error.php?login=duplicate");
        exit();
    }

    else if ((( $_FILES["file"]["type"] == "image/gif")
        || ($_FILES["file"]["type"] == "image/jpeg")
        || ($_FILES["file"]["type"] == "image/pjpeg"))
        && ($_FILES["file"]["size"] < 5000000))
    {
        if ($_FILES["file"]["error"] > 0)
            {
                header("Location: http://www.drink-social.com/error.php?upload=".$_FILES["file"]["error"]);
            exit();
            }

        else if (file_exists("/var/www/pics/".$_FILES["file"]["name"]))
        {
            header("Location: http://www.drink-social.com/error.php?upload=exists");
            exit();
        }

        move_uploaded_file($_FILES["file"]["tmp_name"], "/var/www/pics/".$_FILES["file"]["name"]);
        $host->set_username($_POST['Username']);
        $host->set_password($_POST['Password']);
        $host->set_name($_POST['Name']);
        $host->set_address($_POST['Line1'], $_POST['Line2'], $_POST['City'],
                   $_POST['State'], $_POST['Zip']);
        $host->set_pic($_FILES['file']['name']);

        $id = new MongoID($host->add_me());
        $host->build_me($id);

        $host->set_mondayID($event->add_me($_POST['Monday'], $host->get_id()));
        $host->set_tuesdayID($event->add_me($_POST['Tuesday'], $host->get_id()));
        $host->set_wednesdayID($event->add_me($_POST['Wednesday'], $host->get_id()));
        $host->set_thursdayID($event->add_me($_POST['Thursday'], $host->get_id()));
        $host->set_fridayID($event->add_me($_POST['Friday'], $host->get_id()));
        $host->set_saturdayID($event->add_me($_POST['Saturday'], $host->get_id()));
        $host->set_sundayID($event->add_me($_POST['Sunday'], $host->get_id()));

        $host->update_me();
        header("Location: http://www.drink-social.com/member.php?ID=".$id);
        exit();
    }

    else
    {
        header("Location: http://www.drink-social.com/error?upload=empty");
        exit();
    }

}
?>

It gets past checking to see if post is empty, but when it gets to see if there is a file, it returns false and brings me to my error page and says there was no file selected...?
I am clueless, please advise
Thanks in advance, and sorry so long!

A: For uploading files i am using this code
Suppose i am having input field in form as
<input type="file" value=""  name="file" />

Now on click on submit i will receive file as
if($_FILES['file']['name']){
    if($_FILES['file']['error']==0){
        $target = "/images/";
        $target_path = $target.time().getExtension($_FILES['file']['name']);
        move_uploaded_file($_FILES['file']['tmp_name'], $target_path);
    }
}

Here i am saving file with current-timestamp as name & getting Extension using
function getExtension($str) {
    $i = strrpos($str,".");
    if (!$i) { return ""; }
    $l = strlen($str) - $i;
    $ext = substr($str,$i+1,$l);
    return $ext;
}

Now i am not sure about MongoDB but from your code it should be as
$host->set_pic($target_path);

to store the path of that image. Rest of the conditions for checking filetype & size you can put in respective places in this code.
Thanks