text:
Q: java.lang.IllegalArgumentException: invalid provider: null when openning MapsActivity I just copy-pasted part of code from a project
import android.Manifest;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationManager;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

import com.google.android.gms.location.LocationListener;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class MapsActivity extends Activity implements LocationListener {

private GoogleMap mMap;         // Null si les services Google Play APK ne sont pas disponible.

// Ma position par defaut pour test
private static final LatLng position_gps = new LatLng(43.701397, 1.838987);

// Positions pour test des trackers
private static final LatLng position_gps_track1 = new LatLng(43.602577, 1.362320);
private static final LatLng position_gps_track2 = new LatLng(43.602529, 1.362634);
private static final LatLng position_gps_track3 = new LatLng(43.602349, 1.362681);
private static final LatLng position_gps_track4 = new LatLng(43.602767, 1.362435);

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

    final ListView listview = (ListView) findViewById(R.id.listViewMap);
    String[] values = new String[]{"00:44 - Alert Area", "10:24 - Connect Lost", "10:35 - BLE true", "10:40 - Alert Area", "10:49 - Alert Area", "11:43 - Connect Lost", "11:57 - BLE true"};

    final ArrayList<String> list = new ArrayList<String>();
    for (int i = 0; i < values.length; ++i) {
        list.add(values[i]);
    }

    final StableArrayAdapter adapter = new StableArrayAdapter(this,
            R.layout.list_view_ligne, list);
    listview.setAdapter(adapter);
    listview.setScrollBarStyle(View.SCROLLBARS_INSIDE_INSET);

    LocationManager locationManager;

    locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);

    Criteria criteria = new Criteria();

    // Recupere le nom du meilleur fournisseur disponible
    String provider = locationManager.getBestProvider(criteria, true);

    // Recupere la derniere position connue

    Location location = locationManager.getLastKnownLocation(provider);
    LatLng pos_gps;
    if (location == null) {    // SI on arrive pas a recuperer la position GPS
        pos_gps = position_gps;     // Met la position GPS par defaut
    } else {                    // SINON recupere la position courante
        pos_gps = new LatLng(location.getLatitude(), location.getLongitude());
    }

    // Recupere la carte
    mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
    if (mMap != null) {
        // Ajout des trackers sur la carte
        mMap.addMarker(new MarkerOptions().position(position_gps_track1).title("T1 - Thomas"));
        mMap.addMarker(new MarkerOptions().position(position_gps_track2).title("T2 - Paul"));
        mMap.addMarker(new MarkerOptions().position(position_gps_track3).title("T3 - Sebastien"));
        mMap.addMarker(new MarkerOptions().position(position_gps_track4).title("T4 - Marc"));

        // Affiche la carte par rapport a la position courante
        mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(pos_gps, 15));
        mMap.animateCamera(CameraUpdateFactory.zoomTo(15), 2000, null);
        mMap.setMyLocationEnabled(true);                        // Affiche le bouton Ma Position
        mMap.getUiSettings().setCompassEnabled(true);           // Affiche la boussole
        mMap.getUiSettings().setZoomControlsEnabled(true);      // Affiche les boutons de Zoom
    } else {
        Toast.makeText(this, "Services GoogleMap indisponibles!", Toast.LENGTH_SHORT).show();
    }
}

@Override
public void onLocationChanged(Location location) {

    // Met a jour la position
    int latitude = (int) (location.getLatitude());
    int longitude = (int) (location.getLongitude());
    LatLng position_gps = new LatLng(location.getLatitude(), location.getLongitude());
    mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(position_gps, 15));
}

private class StableArrayAdapter extends ArrayAdapter<String> {

    HashMap<String, Integer> mIdMap = new HashMap<String, Integer>();

    public StableArrayAdapter(Context context, int textViewResourceId,
                              List<String> objects) {
        super(context, textViewResourceId, objects);
        for (int i = 0; i < objects.size(); ++i) {
            mIdMap.put(objects.get(i), i);
        }
    }

    @Override
    public long getItemId(int position) {
        String item = getItem(position);
        return mIdMap.get(item);
    }

    @Override
    public boolean hasStableIds() {
        return true;
    }
}
}

This activity is supposed to give some LOcationInformation, but, when i start the activity, my application crash with this error message :
FATAL EXCEPTION: main
   Process: package.connectivapp, PID: 7694
   java.lang.RuntimeException: Unable to start activity ComponentInfo{package.connectivapp/package.connectivapp.MapsActivity}: java.lang.IllegalArgumentException: invalid provider: null
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
    at android.app.ActivityThread.-wrap12(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6077)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
    Caused by: java.lang.IllegalArgumentException: invalid provider: null
    at android.location.LocationManager.checkProvider(LocationManager.java:2248)
    at android.location.LocationManager.getLastKnownLocation(LocationManager.java:1199)
    at package.connectivapp.MapsActivity.onCreate(MapsActivity.java:72)
    at android.app.Activity.performCreate(Activity.java:6662)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
    at android.app.ActivityThread.-wrap12(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6077)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
02-23 09:20:41.705 1589-2845/system_process W/ActivityManager:   Force finishing activity package.connectivapp/.MapsActivity
02-23 09:20:41.712 1589-2845/system_process W/ActivityManager:   Force finishing activity package.connectivapp/.MainActivity

I know that i didn't implement my Google API in a good way.
In the first time, I added meta data to my Manifest :
    <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="[A Big String]" />

and added "com.google.android.gms:play-services:7.5.0" in my Project Structure dependencies.
Know, i don't know why my application crashes, have you any idea ?

A: after
<meta-data
    android:name="com.google.android.maps.v2.API_KEY"
    android:value="[A Big String]" />

put this meta
<meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />

A: Do not use direct provider strings, as it is not guaranteed that it will exist at runtime.
Use only providers that you get from the LocationManager, like this:
LocationManager locationManager = (LocationManager)context.getSystemService( Context.LOCATION_SERVICE );

        Criteria criteria = new Criteria();
        criteria.setAccuracy( Criteria.ACCURACY_COARSE );
        String provider = locationManager.getBestProvider( criteria, true );

        if ( provider == null ) {
            Log.e( TAG, "No location provider found!" );
            return;
        }

        lastLocation = locationManager.getLastKnownLocation(provider);

And make sure to add android.permission.ACCESS_FINE_LOCATION or android.permission.ACCESS_COARSE_LOCATION to your Manifest file.
And if you are running your code greater then Andoird 5.0 check for premissions as well.
And also try to use Fused Location API...Location Manager is old way to get locations.


text:
Q: Error starting Elasticsearch I am getting following error while starting elasticsearch-1.4.1. Can anyone please help me in resolving this.
[2017-07-16 09:12:12,649][ERROR][plugins                  ] [atom-es] cannot start plugin due to incorrect Lucene version: plugin [4.10.4], node [4.10.2].
[2017-07-16 09:12:12,650][WARN ][plugins                  ] [atom-es] failed to load plugin from [jar:file:/Users/atom/asanoujam/elasticsearch-1.4.1/plugins/analysis-icu/elasticsearch-analysis-icu-2.4.3.jar!/es-plugin.properties]
org.elasticsearch.ElasticsearchException: Failed to load plugin class [org.elasticsearch.plugin.analysis.icu.AnalysisICUPlugin]
    at org.elasticsearch.plugins.PluginsService.loadPlugin(PluginsService.java:531)
    at org.elasticsearch.plugins.PluginsService.loadPluginsFromClasspath(PluginsService.java:406)
    at org.elasticsearch.plugins.PluginsService.(PluginsService.java:115)
    at org.elasticsearch.node.internal.InternalNode.(InternalNode.java:150)
    at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:159)
    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:70)
    at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:203)
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:32)
Caused by: org.elasticsearch.ElasticsearchException: Plugin is incompatible with the current node
    at org.elasticsearch.plugins.PluginsService.loadPlugin(PluginsService.java:524)
    ... 7 more
[2017-07-16 09:12:12,809][ERROR][plugins                  ] [atom-es] cannot start plugin due to incorrect Lucene version: plugin [4.10.4], node [4.10.2].
[2017-07-16 09:12:12,809][WARN ][plugins                  ] [atom-es] failed to load plugin from [jar:file:/Users/atom/asanoujam/elasticsearch-1.4.1/plugins/analysis-kuromoji/elasticsearch-analysis-kuromoji-2.7.0.jar!/es-plugin.properties]
org.elasticsearch.ElasticsearchException: Failed to load plugin class [org.elasticsearch.plugin.analysis.kuromoji.AnalysisKuromojiPlugin]
    at org.elasticsearch.plugins.PluginsService.loadPlugin(PluginsService.java:531)
    at org.elasticsearch.plugins.PluginsService.loadPluginsFromClasspath(PluginsService.java:406)
    at org.elasticsearch.plugins.PluginsService.(PluginsService.java:115)
    at org.elasticsearch.node.internal.InternalNode.(InternalNode.java:150)
    at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:159)
    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:70)
    at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:203)
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:32)
Caused by: org.elasticsearch.ElasticsearchException: Plugin is incompatible with the current node
    at org.elasticsearch.plugins.PluginsService.loadPlugin(PluginsService.java:524)
    ... 7 more
[2017-07-16 09:12:12,970][ERROR][plugins                  ] [atom-es] cannot start plugin due to incorrect Lucene version: plugin [4.10.4], node [4.10.2].
[2017-07-16 09:12:12,971][WARN ][plugins                  ] [atom-es] failed to load plugin from [jar:file:/Users/atom/asanoujam/elasticsearch-1.4.1/plugins/analysis-smartcn/elasticsearch-analysis-smartcn-2.7.0.jar!/es-plugin.properties]
org.elasticsearch.ElasticsearchException: Failed to load plugin class [org.elasticsearch.plugin.analysis.smartcn.AnalysisSmartChinesePlugin]
    at org.elasticsearch.plugins.PluginsService.loadPlugin(PluginsService.java:531)
    at org.elasticsearch.plugins.PluginsService.loadPluginsFromClasspath(PluginsService.java:406)
    at org.elasticsearch.plugins.PluginsService.(PluginsService.java:115)
    at org.elasticsearch.node.internal.InternalNode.(InternalNode.java:150)
    at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:159)
    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:70)
    at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:203)
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:32)
Caused by: org.elasticsearch.ElasticsearchException: Plugin is incompatible with the current node
    at org.elasticsearch.plugins.PluginsService.loadPlugin(PluginsService.java:524)
    ... 7 more
[2017-07-16 09:12:20,141][INFO ][plugins                  ] [atom-es] loaded [lang-mvel, cloud-aws, es-reporting-plugin, clustering-carrot2, analysis-kuromoji-neologd, analysis-vietnamese], sites [carrot2, head]
[2017-07-16 09:12:54,699][INFO ][org.codelibs.elasticsearch.kuromoji.neologd.index.analysis.KuromojiDictionarySyncRunnable] Kuromoji Neologd dictionary sync triggered
[2017-07-16 09:12:56,326][INFO ][com.spr.elasticsearch.plugin.LookupScriptFactory] Created LookupScriptFactory with cache size of [ 100000 ] and timeout of [ 120 ]
{1.4.1}: Initialization Failed ...
- NoClassDefFoundError[org/apache/http/nio/entity/NStringEntity]
    ClassNotFoundException[org.apache.http.nio.entity.NStringEntity]

A: Those plugins are not compatible with Elasticsearch 1.4.1. You have to downgrade your plugins to use in ES 1.4.1. For ElasticSearch 1.4.1 you need to install following versions of the plugins
elasticsearch-analysis-icu -> Version 2.4.1 for ES 1.4.1 (But you are trying to use 2.4.3)
elasticsearch-analysis-kuromoji -> Version 2.4.1 for ES 1.4.1 (But you are trying to use 2.7.0)
elasticsearch-analysis-smartcn -> Version 2.4.2 for ES 1.4.1 (But you are trying to use 2.7.0)

redpajama_set_name: RedPajamaStackExchange


text:
Q: Remove an element when button clicked I've been trying to make simple to-do list to learn javascript and I have been able to add and display a task but I can't find a way to delete it. I have created a remove button but I can't make work, nothing happens when clicked. So any help would be great, thanks !
function handleSubmit(event){

    event.preventDefault();

    let value = getInputValue();

    if(value !== false){

        addToDom(value);

        eraseInput();
    }
}

const form = document.querySelector("#todo-list-form");
form.addEventListener('submit', handleSubmit);

function getInputValue() {
    const input = document.querySelector("#todo-input");

    let value = input.value;

    value = value.trim();

    if (value === '') {
        alert("You can not submit an empty field");
        return false;
    }
    else {
        return value;
    }
}

function addToDom(value) {
    const list = document.querySelector("#list");
    const removeButton = document.createElement("button");
    removeButton.innerHTML = 'remove';
    removeButton.classList.add("complete-btn");
    list.appendChild(removeButton);
    list.innerHTML += "
" + value + "
";
    console.log(list);
    removeButton.addEventListener('click', removeItem)
}

function removeItem(event){
    event.parentElement.remove();

}

function eraseInput() {
    const input = document.querySelector("#todo-input");

    input.value = "";

    input.focus();
}

A: The issue is because you define and add the removeButton to the DOM, but immediately after that you overwrite the HTML of the parent element, which removes the button.
To fix the issue you need to be consistent in how you create and append the elements to the DOM.
In addition, as @Teemu pointed out in the comments, you need to use event.target.parentElement in your removeItem() function.
function addToDom(value) {
  const removeButton = document.createElement("button");
  removeButton.innerHTML = 'remove';
  removeButton.classList.add("complete-btn");
  removeButton.addEventListener('click', removeItem);

  const li = document.createElement('li');
  li.textContent = value;
  li.appendChild(removeButton);

  document.querySelector("#list").appendChild(li);
}

function removeItem(event){
  event.target.parentElement.remove();
}

Here's a full working example:

function handleSubmit(event) {
  event.preventDefault();

  let value = getInputValue();
  if (value !== false) {
    addToDom(value);
    eraseInput();
  }
}

const form = document.querySelector("#todo-list-form");
form.addEventListener('submit', handleSubmit);

function getInputValue() {
  const input = document.querySelector("#todo-input");

  let value = input.value;
  value = value.trim();

  if (value === '') {
    alert("You can not submit an empty field");
    return false;
  } else {
    return value;
  }
}

function addToDom(value) {
  const removeButton = document.createElement("button");
  removeButton.innerHTML = 'remove';
  removeButton.classList.add("complete-btn");
  removeButton.addEventListener('click', removeItem);

  const li = document.createElement('li');
  li.textContent = value;
  li.appendChild(removeButton);

  document.querySelector("#list").appendChild(li);
}

function removeItem(event) {
  event.target.parentElement.remove();
}

function eraseInput() {
  const input = document.querySelector("#todo-input");
  input.value = "";
  input.focus();
}
ul button { margin: 0 0 0 5px; }
<form id="todo-list-form">
  Item: <input type="text" id="todo-input" />
  <button type="submit">Add</button>

</form>


text:
Q: Changing SharePoint Database and File location! I create a SharePoint 2013 environment with SQL 2012.  Issue is that SQL is installed on the OS driver (C drive). Now we want to move the location of SQL database and Log File from OS drive to Other local drive of the same Virtual Machine!!!
But we don't know if there would be any impact on SharePoint, of this movement !!
Does any body had done this before !!
Need suggestions..

A: Turn off the SharePoint server(s)
Detach the database from SQL using SSMS
Move the MDF(s)/LDF(s) to the desired location
Attach the database using SSMS, pointing it to the new MDF location
Start SharePoint


text:
Q: Pulling objects from binary file and putting in List I've done this before, but can't figure out how I did it.  I have a binary file that I want to store objects in.  I've serialized the object class with [Serializable] and have successfully saved to the file individual objects to it.  However, problems start showing up when trying to read the objects out and placing in a List<> for further handling.
So when trying to just read the objects out of the file, I have the code:
List<myStuff> aListOfStuff = new List<myStuff>();
Stream fileStream = File.OpenRead("MyFile.DAT");
BinaryFormatter deserializer = new BinaryFormatter();
aListOfStuff = (List<myStuff>)deserializer.Deserialize(fileStream);
fileStream.Close();

When I first started testing, no errors were generated on the above code, but I would receive an exception when trying to write to the file that the file couldn't be accessed because it was being used by another process.  Upon trying to troubleshoot by commenting out all sections of code that would try to check the file for already-existing contents and only having the save & refresh code active, I would receive an error on the aListofStuff line of code above that stated "Unable to cast object of type 'myStuff' to type 'System.Collections.Generic.List'1.  Yes, the 1 is in the error and not a typo.  This tells me that the reason I was getting the 'file still open' message is because the .Close() wasn't being called but that still doesn't help me get to the bottom of the problem.
So I'm assuming I just don't know/remember how to pull a list of objects back out of a file.  I've searched the web for how to do this and can't find information regarding specifically to lists of objects.  Plenty of stuff for a single serialized object in a file, but not more than one and those articles that I've found for serializing don't seem to scale.
Here's the code I'm using to add an object to the file:
myStuff newThing = new myStuff(string1, string2, string3);
Stream fileStream = File.Open("MyFile.Dat", FileMode.Append);
BinaryFormatter serializer = new BinaryFormatter();
serializer.Serialize(fileStream, newThing);
fileStream.Close();

A: "Unable to cast object of type 'myStuff' to type 'System.Collections.Generic.List'1.
This means that you serialized into File one myStuff object, not a list of objects.  Check this.  Cna you also provide serialization code?
UPDATE2:
To serialize:
var list = new List<myStuff>();
var objectOne = new myStuff(string1, string2, string3);
// more object here
list.Add(objectOne);
// list.Add other objects there

using(Stream fileStream = File.Open("MyFile.Dat", FileMode.Create))
{
  BinaryFormatter serializer = new BinaryFormatter();
  serializer.Serialize(fileStream, list);
}

To deserialize:
List<myStuff> list;
using(Stream fileStream = File.OpenRead("MyFile.DAT"))
{
  BinaryFormatter deserializer = new BinaryFormatter();
  list = (myStuffList<myStuff>)deserializer.Deserialize(fileStream);
}


text:
Q: Is there any benefit in semantic HTML besides for the coders (ie: for users, for SEO, etc)? I haven't completely understand the concept of semantic HTML.
What benefits does the semantic HTML give, besides of readability/tag meaning/clean code? I've read the answers in What are the benefits of using semantic HTML? , but I haven't found any answer that says its usefulness to anyone besides coders/designers.
I've heard that semantic HTML is also useful for SEO, is it true? Also, is there any benefits for the users or for the browsers?
Sorry for my English, it is not my native language...

A:
besides of readability/tag meaning/clean code

Not good enough for you? Those are substantial benefits by themselves.
With the semantic web, you can write software that understands the semantics, the meaning of pieces of data.
With that, you get better results from search (yes, better SEO), more relevant information and better ways to organize information.

A: Accessibility!!
Like for blind people, they use software to read internet pages and to navigate.
A good semantic is a part of accessibility and a good help for them!
Plus all the stuff mentioned: SEO, clean code... Which are quite interesting also :)


text:
Q: Why is my on_message event printing logs twice? Here is the logging bit of my on_message command, whenever I send "ping" it checks to make sure it's in its list of commands then logs it, but its logging it twice and sending once (It should only send once)...
async def on_message(message):
    # Check if the message was from server
    if message.content != "":
        # Test if User/ Bot
        if message.author == bot.user:
            return
        # Report Comamnd used
        else:
            splitCommand = message.content.split(" ")
            join = " "
            join = join.join(splitCommand)
            time = "[UTC " + str(message.created_at) + "]"
            singleCommand = "\nCommand: \'" + splitCommand[0] + "\'"
            multiCommand = "\nCommand: \'" + join + "\'"
            user = "\nFrom User: \'<@" + str(message.author.id) + "> | (" + str(message.author) + ")\'"
            # Single word commands
            if splitCommand[0].lower() in commandList:
                print(time + singleCommand + user)
            # Multi-word commands
            if any(x.isalpha() or x.isspace() for x in join):
                if join.lower() in commandList:
                    print(time + multiCommand + user)
                elif regex.search(join) != None and join.lower() in commandList:
                    print(time + multiCommand + user)
            # Deletes Commands
            if message.content[0] == prefix:
                userMessage =  message
                await userMessage.delete()
                print("Deleted Command")
    else:
        pass

An example output would be:
[UTC 2020-11-24 08:21:42.587000]
Command: 'ping'
From User: '<@379355817700491264> | (24Kings#0001)'
[UTC 2020-11-24 08:21:42.587000]
Command: 'ping'
From User: '<@379355817700491264> | (24Kings#0001)'
Sent: 'pong'

But it should only be logging it once?
Any ideas as to why it is logging twice and a fix would be very much appreciated! :D

A: First of all it is better to use discord.ext.commands, After that you have three options.

*

*on_command_error(ctx,error) To check for error and tell the user (permissions, wrong argument, etc..)

*on_command(ctx)

*on_command_completion(ctx)
@bot.event
async def on_command_completion(ctx):
    print(f'{ctx.command} has been used by {ctx.author.display_name}')

For commands here is a ref


text:
Q: How is the default font size for a wpf window determined? I understand that in WPF the font size used by a control is determined by the parent control, unless an override is defined.
Given that I don't define a font-size anywhere in my application, I assume that the default font-size is that configured for the top-level Window.
Is this value determined by the system the application is running on (and if so where?); or is it determined by some built-in WPF default value (and if so what is it?)

A: The default font size is determined by the FontSize dependency property of the TextElement class: https://referencesource.microsoft.com/#PresentationFramework/src/Framework/System/Windows/Documents/TextElement.cs,e28640b48d79de57. It defaults to SystemFonts.MessageFontSize which has a default value of 12.
The Control base class them adds itself as an owner of this dependency property and defines its own FontSize property that can any control can set to a custom value.
Please refer to the following blog post for more information about this: https://blog.davidpadbury.com/2008/08/30/change-the-default-font-of-a-wpf-application/.


text:
Q: where to put the log4j.properties file in a spring boot application I have created a log4j.properties file, and I have put it in the resources folder as the application.properties file, in this file I have this line : logging.config=log4j.properties which indicated the name of my log4j properties file, but when I run my application I'm getting this error on my console :
Logging system failed to initialize using configuration from 'log4j.properties'
java.io.FileNotFoundException: C:\Users\***\Desktop\CapRecrute\log4j.properties (The system cannot find the file specified)

so I tried to change the logging.config property to src\\main\\resources\\log4j.properties, and then I got another error :
java.lang.IllegalStateException: Could not initialize Logback logging from src\main\resources\log4j.properties ... Caused by: ch.qos.logback.core.LogbackException: Unexpected filename extension of file [file:/C:/Users/Aimad%20MAJDOU/Desktop/CapRecrute/src/main/resources/log4j.properties]. Should be either .groovy or .xml

in my pom file I have this :
<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-log4j</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

How can I solve this ?

A: The simplest thing is to use Spring's Logback. You just need to add these 2 lines to application.properties
logging.level.org.springframework.web=DEBUG
logging.level.org.hibernate=ERROR

and make sure there are no other logging related lines.
If you instead want log4j, then configure so in your pom.xml:
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter</artifactId>
    <exclusions>
        <exclusion>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-logging</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>

And then in your paplication.properties:
logging.path=/tmp/logs/
logging.file=/tmp/logs/myapplog.log
logging.config=log4j.properties

Also make sure log4j is in the root of your project (not under resources).

A: Spring boot is expecting a logback file by default and you have provided log4j configuration.  If you add the log4j dependency you should find it works.  If you are using maven you can do so like this:
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>

A: Two issues:

*

*Is slf4j-log4j12 exclusion required?

*I think that exclusion of spring-boot-starter-logging should be applied to spring-boot-starter.

That's not complete POM. I assume that spring-boot-starter is included, right?
If you remove slf4j-log4j12 exclusion and move spring-boot-starter-logging to spring-boot-starter your file should look like example from documentation.
http://docs.spring.io/spring-boot/docs/current/reference/html/howto-logging.html
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter</artifactId>
    <exclusions>
        <exclusion>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-logging</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-log4j</artifactId>
</dependency>


text:
Q: Expressing 3SAT clause as a 2SAT formula I am wondering about expressing $3SAT$ clause (disjunction of 3 literals) as a $2SAT$ formula. If it would be possible then $P=NP$
Let's consider a clause of the form: $x_1 \vee x_2 \vee x_3$
The question is: is there a $2SAT-CNF$ encoding of the constraint that at least one of the $x1, x2, x3$ is $true$ ? (possibly such encoding can use a lot of additional variables and clauses...) I am curious if anybody has proven that such encoding simply does not exist.
More background: I recently went through following paper: SAT Encodings of the At-Most-k Constraint
Just wondering what can be encoded purely within $2SAT$

A: Suppose you have a representation of $x_1\lor x_2\lor x_3$ as 2CNF clauses, possibly involving with hidden variables. (This would "represent" the three-way disjunction in the sense that the 2CNF is satisfiable together with any consistent combination of $(\neg)x_i$ that contains at least one positive $x_i$, and is not satisfiable together with $\neg x_1 \land \neg x_2 \land \neg x_3$.
First any hidden variable $h$ can be eliminated by replacing all clauses involving $h$ or $\neg h$, by the result of applying resolution to every combination of such clauses that has $h$ in one and $\neg h$ in another. This does not change the satisfiability of the formula. (Here an important observation is that using resolution on two 2-clauses produces another 2-clause; the is not true for clauses of higher arity).
Thus, without loss of generality we can assume that there are no hidden variables -- and the question is then just whether any 2CNF in the variables $x_1, x_2, x_3$ is logically equivalent to $x_1\lor x_2\lor x_3$.
We can easily see that this is not the case. Any nontrivial 2-clause will be true for at most $6$ of the $8$ different truth valuations of $x_1, x_2, x_3$. Taking the conjunction of several such clauses cannot make more valuations come out true -- but $x_1\lor x_2\lor x_3$ is true in $7$ cases, so it is not equivalent to any 2CNF.

A: Suppose, toward a contradiction, that we had a 2-CNF formula $\phi$, using the variables $x_1,x_2,x_3$, and some auxiliary variables $y_1,\dots,y_n$ such that, whenever we assign truth values to the $x$'s, if at least one of the three is true then we can assign values to the $y$'s to make $\phi$ true, but if all three of the $x$'s are false, then, no matter what values we give the $y$'s, $\phi$ will be false.
Choose an assignment $v_1$ of truth values to the $y$'s that makes $\phi$ true when $x_1$ is true but $x_2$ and $x_3$ are false.  Similarly, choose assignments $v_2$ (resp. $v_3$) to the $y$'s that make $\phi$ true when only $x_2$ (resp. $x_3$) is true and the other two $x$'s are false.  Let $v$ be the assignment of truth values to the $y$'s obtained by the majority vote of $v_1,v_2,v_3$, i.e., $v$ makes $y_i$ true iff at least two of $v_1,v_2,v_3$ make $y_i$ true.
By our assumption, if we give all three $x$'s the value false and give the $y$'s values according to $v$, then $\phi$ is false.  So, as $\phi$ is a 2-CNF formula, one of the conjuncts in $\phi$ is false in this situation, and that conjunct is a disjunction of two literals (each of which is an $x$ or a $y$ or a negation of one of these.)  Each of those two literals has, in our current truth assignment ($v$ for the $y$'s and false for the $x$'s), the same truth value as in at least two of the three earlier truth assignments ($v_i$ for the $y$'s and only $x_i$ true among the $x$'s).  So at least one of  those three earlier assignments agrees with the current one on both of the literals in the conjunct under consideration.  Thus, at least one of the three earlier truth assignments falsified that conjunct and therefore falsified $\phi$.  That contradicts how we chose those earlier assignments.


text:
Q: Update records automatically between computers C # I need help. I am currently building data management applications using Winforms and C#. This application has been installed on 10 computers and are connected to one database on the server. Network only in the office.
These applications use the data grid view to display a list of employees.
The main problem now, if users on PC-A has entered a new record or update employee records, data grid view on PC-B is not updated automatically. So if I want to refresh the data grid view on PC-B, I need to press the "REFRESH" button to reload the record.
So the question is now, there are other ways to 'Data Grid View' can be updated automatically?
I do not know what it is named this method, so I hope there is anyone willing to help me in solving this problem.  If the my question is already exist, hope someone can give me a link.
Thanks for help :)

A: In order to achieve what you want, you will need to do some fairly complex architecture work.  There is no simple fix here, I am afraid.
The problem is that you want your data girds to update based on an EVENT, however that event occurs outside the application in the database.  In order to register that EVENT, you will need to have a class  or service which is responsible for handling all INSERTS/UPDATES/DELETES.
If you define all of your tables or views  as ARTICLES, you could then have a Publisher / Subscriber model.  The Data service would handle all the inserts updates and deletes for the application, and push notifications that an ARTICLE has changed to all the Subscribers for the article.  On each page you could have a Class which subscribes to an Article which relates to the data displayed on your data grid, and when it receives a message that the article has been updated, rebinds the data grid to the data source.
Try reading this WIKIPEDIA article on the Observer pattern to get an idea of what the architecture might look like.
http://en.wikipedia.org/wiki/Observer_pattern

A: You can add Version column to a data base table, then you should ask data base periodically (pooling) to get records with has a greater version than a last received


text:
Q: Working with inaccurate (incorrect) dataset This is my problem description:
"According to the Survey on Household Income and Wealth, we need to find out the top 10% households with the most income and expenditures. However, we know that these collected data is not reliable due to many misstatements. Despite these misstatements, we have some features in the dataset which are certainly reliable. But these certain features are just a little part of information for each household wealth."
Unreliable data means that households tell lies to government. These households misstate their income and wealth in order to unfairly get more governmental services. Therefore, these fraudulent statements in original data will lead to incorrect results and patterns.
Now, I have below questions:

*

*How should we deal with unreliable data in data science?

*Is there any way to figure out these misstatements and then report the top 10% rich people with better accuracy using Machine Learning algorithms?
-How can we evaluate our errors in this study? Since we have unlabeled dataset, should I look for labeling techniques? Or, should I use unsupervised methods? Or, should I work with semi-supervised learning methods?

*Is there any idea or application in Machine Learning which tries to improve the quality of collected data?

Please introduce me any ideas or references which can help me in this issue.
Thanks in advance.

A: Q: How should we deal with unreliable data in data science
A: Use feature engineering to fix unreliable data (make some transformations on unreliable data to make it reliable) or drop them out completely - bad features could significantly decrease the quality of the model
Q: Is there any way to figure out these misstatements and then report the top 10% rich people with better accuracy using Machine Learning algorithms?
A: ML algorithms are not magic sticks, they can't figure out anything unless you tell them what you are looking for. Can you describe what means 'unreliable'? If yes, you can, as I mentioned, use feature engineering or write a code which will fix the data. Otherwise no ML algorithm will be able to help you, without the description of what exactly you want to achieve
Q: Is there any idea or application in Machine Learning which tries to improve the quality of collected data?
A: I don't think so just because the question itself is too open-ended. What means 'the quality of the data'?
Generally, here are couple of things for you to consider:
1) Spend some time on googling feature engineering guides. They cover how to prepare your data for you ML algorithms, refine it, fix it. Good data with good features dramatically increase the results.
2) You don't need to use all of features from original data. Some of features of original dataset are meaningless and you don't need to use them. Try to run gradient boosting machine or random forest classifier from scikit-learn on your dataset to perform classification (or regression, if you do regression). These algorithms also evaluate importance of each feature of original dataset. Part of your features will have extremely low importance for classification, so you may wish to drop them out completely or try to combine unimportant features together somehow to produce something more important.


text:
Q: Undefined symbols Error when add robovm parse binding into libgdx I am trying to follow the guide at https://github.com/BlueRiverInteractive/robovm-ios-bindings to add parse into my libgdx ios project.
I have download parse-1.0.0-beta-03.jar and added it into gradle dependencies. However, when I run launchIOSDevice command, I got following error. Any help will be appreciated, thanks!
Undefined symbols for architecture armv7:
  "_SLServiceTypeTwitter", referenced from:
      -[PF_Twitter getAccessTokenForReverseAuthAsync:localTwitterAccount:] in Parse(PF_Twitter.o)
      -[PF_Twitter getLocalTwitterAccountAsync] in Parse(PF_Twitter.o)
  "_OBJC_CLASS_$_BFExecutor", referenced from:
      objc-class-ref in Parse(BFTask+Private.o)
      l_OBJC_$_CATEGORY_BFExecutor_$_Background in Parse(BFTask+Private.o)
  "_OBJC_CLASS_$_SLRequest", referenced from:
      objc-class-ref in Parse(PF_Twitter.o)
  "_OBJC_CLASS_$_ACAccountStore", referenced from:
      objc-class-ref in Parse(PF_Twitter.o)
  "_ACAccountTypeIdentifierTwitter", referenced from:
      -[PF_Twitter getLocalTwitterAccountAsync] in Parse(PF_Twitter.o)
  "_OBJC_CLASS_$_BFTask", referenced from:
      objc-class-ref in Parse(PFPush.o)
      objc-class-ref in Parse(PFObject.o)
      objc-class-ref in Parse(PFUser.o)
      objc-class-ref in Parse(PFConfig.o)
      objc-class-ref in Parse(PFBlockRetryer.o)
      objc-class-ref in Parse(PFRetryingCommandRunner.o)
      objc-class-ref in Parse(PFPurchase.o)
      ...
  "_OBJC_CLASS_$_BFTaskCompletionSource", referenced from:
      objc-class-ref in Parse(PFObject.o)
      objc-class-ref in Parse(PFCommandCache.o)
      objc-class-ref in Parse(PF_Twitter.o)
      objc-class-ref in Parse(PFTaskHTTPRequestOperation.o)
      objc-class-ref in Parse(PFNetworkCommandRunner.o)
      objc-class-ref in Parse(BFTask+Private.o)
  "_OBJC_CLASS_$_SLComposeViewController", referenced from:
      objc-class-ref in Parse(PF_Twitter.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

A: Looks like you haven't added all the required frameworks, more specifically probably Bolts. If your using parse 1.6.1 ensure these are linked libraries:

Or you can get a starter project HERE


text:
Q: Can I modify a dynamic property value from controller in .net MVC 5? I am using .Net MVC with Entity Framework.
In my Model Class I have these 2 properties:
public string Content { get; set; }

[NotMapped]
public dynamic DynamicContent { get { return Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(this.Content); } }

the "Content" contains a JSON string and the DynamicContent is a dynamic property based on the JSON string.
Can I modify the contents of the dynamic property?
For example: I can read a value like this

DynamicContent.title

but how can I set its value from the controller?
DynamicContent.title = "myvalue" does not work.

A: You should be able to just set the value of the Content property as that is the value the DynamicContent property retrieves when you call the get method.
So instead of:
DynamicContent.title = "myvalue"

You would call:
Content = *the json representation of the content*

This would however need to be in JSON format as the DynamicContent getter DeSerializes it from JSON.


text:
Q: If condition in @Html.DisplayFor I am trying to display different messages based on data from statusid table. Let say for example if my statusid is 1120 then i would like to display "PASS" but i am struggling with the correct syntax.
If statusid=1120 then "PASS".
Here is my code for displaying statusid:
@Html.DisplayFor(modelItem => item.statusid)

Any idea?

A: Make an object with all the properties you need
SomeObject.statusId
SomeObject.message

@Html.DisplayFor(modelItem => item.SomeObjectInstance)

Doing it this way let's you add the code and logic outside the view, which is generally recommended.

A: If you only have a few values from statusid then you can do this.
@if (@Model.statusid == 1120)
            {
                PASS
            }
            else
            {
                FAIL
            }


text:
Q: Can't establish SSLSession with self signed cert on Nougat only Attempting to establish an SSLSession using a self-signed certificate and the new-ish Network Security Configuration method as well as cwac-netsecurity library for backward compatibility works on all other versions of android (that I have tried) except Android 7.0.
I have an android app that connects to a device to provide a UI for that device.  The connection uses a TLSv1 SSLSocket and a self-signed server certificate on the device side.  Prior to Nougat, I had the server certs embedded as a BKS key store and loaded at run-time to create a custom TrustManager in order to intialize the SSL context and create the socket.  This no longer works under Android 7+. Following some other questions on SO (Cannot connect via SSL using self signed certificate on Android 7 and above), I was able to use the Network Security Configuration method to establish the SSLSocket connection on an Android 8 device (https://developer.android.com/training/articles/security-config#ConfigCustom). For backward compatibility, I am using the cwac-netsecurity library from CommonsWare (https://github.com/commonsguy/cwac-netsecurity).  I built a small test application and am testing against openssl s_server.  What I have written establishes an SSLSession successfully from android devices running 4.4, 6.0, and 8.0.  For some reason however, it does not do so on an android device running 7.0.  Here are code snippets that show the test.  Any help would be appreciated.
Test code in android app
{
    // createSocketFactory
    SSLSocketFactory factory = (SSLSocketFactory)SSLSocketFactory.getDefault(); //null;
    TrustManagerBuilder tmb = new TrustManagerBuilder();
    tmb.withManifestConfig(MainActivity.this);
    tmb.withCertChainListener(
            new CertChainListener()
            {
                @Override
                public void onChain(X509Certificate[] chain, String domain)
                {
                    if (domain == null)
                    {
                        Log.d(TAG, "onChain: Certificate chain for request to unknown domain");
                    }
                    else
                    {
                        Log.d(TAG, "onChain: Certificate chain for request to: " + domain);
                    }

                    for (X509Certificate cert : chain)
                    {
                        Log.d(TAG, "onChain: Subject: " + cert.getSubjectX500Principal().getName());
                        Log.d(TAG, "onChain: Issuer: " + cert.getIssuerX500Principal().getName());
                    }
                }
            });
    CompositeTrustManager ctm = tmb.build();
    try
    {
        SSLContext sc = SSLContext.getInstance("TLSv1");
        sc.init(null, new TrustManager[] { ctm }, new SecureRandom());
        factory = sc.getSocketFactory();
    }
    catch (NoSuchAlgorithmException e)
    {
        Log.e(TAG, "createSocketFactory: failed to get SSLContext", e);
    }
    catch (KeyManagementException e)
    {
        Log.e(TAG, "createSocketFactory: failed to init SSLContext from CompositeTrustManager");
    }

    // createSslSocket
    SSLSocket socket = null;
    String addr = "172.31.106.60";
    int port = 50001;

    if (factory != null)
    {
        Log.d(TAG, "createSocketFactory - SUCCESS");
        try
        {
            socket = (SSLSocket)factory.createSocket(addr, port);
            Log.d(TAG, "createAltSocket - SUCCESS");

            socket.setEnabledProtocols(new String[] { "TLSv1" });
            socket.setEnabledCipherSuites(new String[] { "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA" });
            socket.setTcpNoDelay(true);
            socket.setKeepAlive(true);
        }
        catch (IOException e)
        {
            Log.e(TAG, "createSslSocket - Couldn't create SSLSocket", e);
            try
            {
                socket.close();
            }
            catch (IOException e1)
            {
                e1.printStackTrace();
            }
            finally
            {
                socket = null;
            }
        }
    }
    else
    {
        Log.d(TAG, "createSocketFactory - FAILED");
    }

    // testSslSocket
    if (socket != null && socket.isConnected())
    {
        SSLSession session = socket.getSession();
        if (session != null && session.isValid())
            Log.d(TAG, "testSslSocket: SESSION SUCCESS");
        else
            Log.d(TAG, "testSslSocket: SESSION FAILED");

        try
        {
            socket.close();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
    }
}

network_securiity_config.xml
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config>
        <trust-anchors>
            <certificates src="@raw/test_cert_chain"/>
            <certificates src="system"/>
        </trust-anchors>
    </base-config>
</network-security-config>

AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.example.ssltesting">

    <uses-permission android:name="android.permission.INTERNET"/>

    <application
        android:networkSecurityConfig="@xml/network_security_config">
        <meta-data
            android:name="android.security.net.config"
            android:resource="@xml/network_security_config" />

test server
openssl s_server -tls1 -WWW -accept 50001 -cert test.crt -key mcv.key -state

In all working cases, the SSLSession is valid at the end of the test routine, and I get logging from the CertChainListener.  However, when running this on my Android 7.0 device, all is quiet.  I get no logging from the CertChainListener, the SSLSession is not valid, and I get the following on the server side:
Using default temp DH parameters
ACCEPT
SSL_accept:before/accept initialization
SSL3 alert write:fatal:handshake failure
SSL_accept:error in error
140386525526784:error:1408A0C1:SSL routines:ssl3_get_client_hello:no shared cipher:s3_srvr.c:1417:
ACCEPT


text:
Q: Neural Networks sigmoid activation with bias updates I am trying to figure out if I am creating an artificial neural network using the sigmoid activation function and using bias correctly. I want one bias node to input to all hidden nodes with static output -1 combined with its weight, and then one going to the output also static output -1 combined with its weight. I can then train these bias exactly like I would train the other neurons, correct?!

A: It is a correct reasoning, however it is rather uncommon to set "-1" value (why not +1?), I have never seen this before in literature. If you maintain the correct graph structure than there is no difference between updating weights for "real" nodes and "bias nodes". The only difference could arise if you don't store graph structure and so you do not "know" that bias (the one connected to the output node) has no "children" and so signal is not "back propagated" deeper into the net. I have seen such codes, which simply store layers as arrays and they place biases at index 0 so they can iterate from 1 during back propagation. Obviously, graph based implementation is much more readable (however much slower as you cannot vectorize your computations).


text:
Q: How to catch a unique constraint error for each Index? I have a data table with many columns unique indexed. When I update, there may be some columns duplicates. I am using the following way to catch errors
 EXCEPTION
     WHEN DUP_VAL_ON_INDEX
        THEN OPEN cur FOR SELECT 'DUP' result from dual;

But now i want catch exception on each index, like
 EXCEPTION
         WHEN DUP_VAL_ON_INDEX1
            THEN OPEN cur FOR SELECT 'DUP1' result from dual;
         WHEN DUP_VAL_ON_INDEX2
            THEN OPEN cur FOR SELECT 'DUP2' result from dual;

So how can i do that ?

A: You could get the index_name from user_constraints by parsing the error message SQLERRM
WHEN DUP_VAL_ON_INDEX
THEN
v_errm := SQLERRM;
SELECT INDEX_NAME into v_INDEX_NAME
FROM user_constraints WHERE INDEX_OWNER||'.'||constraint_name =
REGEXP_SUBSTR(v_errm,'unique constraint +\((.+)\) +violated',1,1,'i',1);

CASE  v_INDEX_NAME
     WHEN 'INDEX1' THEN OPEN cur FOR SELECT 'DUP1' result from dual;
     WHEN 'INDEX2' THEN OPEN cur FOR SELECT 'DUP2' result from dual;
     ELSE DBMS_OUTPUT.PUT_LINE(SQLERRM);
END CASE;

Do note that you may also have to handle NO_DATA_FOUND by putting the select statement inside another BEGIN..EXCEPTION..END or using other methods. But, this would not be required if your user_constraints has the correct details of the raised constraint.


text:
Q: Should it be 'is' or 'are' after a number with a unit? What would be the right form of to be in the examples below?

Five miles [is/are] a long way to walk.

Preliminary results [is/are] better than no results at all.

A: Use standard plural construction with "results are".  Use standard singular construction with "is a long ... walk". "A preliminary result is" also standard usage.  "The five miles are fraught with danger" uses plural, because the sentence does not cast the total distance into a single unit.


text:
Q: Schwartz book: Heisenberg equation of motion for quantum fields (equation 7.28) In his book "Quantum field theory and the standard model", section 7.2 "Hamiltonian derivation" (of the Feynman rules), Schwartz states that the equations of motion $i\partial_t\phi(x)=[\phi,H]$ have the formal solution (eq 7.27)
$$
\phi(\vec x, t) = S(t,t_0)^\dagger\phi(\vec x)S(t, t_0)\tag{7.27}
$$
where $S$ is the time evolution operator for the momentum eigenstates, and it satisfies
$$
i\partial_t S(t, t_0)=H(t)S(t,t_0).\tag{7.28}
$$
I tried to justify this expression, but I didn't manage. Here what I tried.
From $i\partial_t\phi(x)=[\phi(x),H(t)]$ I get
$$
i\partial_t\phi(x) = i\partial_t[S^\dagger(t,t_0) \phi(\vec x)S(t,t_0)] =
(i\partial_t S^\dagger(t,t_0)) \phi(\vec x)S(t,t_0) + S^\dagger(t,t_0)\phi(\vec x)(i\partial_t S(t,t_0)) =
[S^\dagger(t,t_0)\phi(\vec x)S(t,t_0), H(t)]
$$
Using the commutator identity, I expand the commutator on the rhs:
$$
(i\partial_t S^\dagger) \phi(\vec x)S + S^\dagger\phi(\vec x)(i\partial_t S)  = S^\dagger\phi(\vec x)[S,H] + [S^\dagger\phi(\vec x), H]S = S^\dagger\phi SH - S^\dagger\phi HS + S^\dagger\phi HS - HS^\dagger\phi S = S^\dagger\phi SH - HS^\dagger\phi S
$$
For the lhs to be equal to the rhs I have to require:
$$
i\partial_t S = SH
$$
$$
i\partial_t S^\dagger = -HS^\dagger
$$
But Schwartz claim is $i\partial_t S = HS$ and in general $S$ does not commute with $H$. Where am I wrong?

A: I found the source of the confusion.
In the derivation, I always assumed that the Hamiltonian is in the Heisenberg representation. If I now express my last equation, $i\partial_t S = SH_H$ (the $H$ subscript stands for Heisenberg), in the Schrödinger representation I get
$$
\partial_t S = SH_H = SS^\dagger H_S S = H_S S
$$
So the time evolution given by Schwartz is the time evolution of the S operator using the Hamiltonian in the Schrödinger representation.


text:
Q: Empty entry in the SWT combo I have a SWT combo which have one empty entry and some values. When I select the empty entry it does not fire any event. But I need to fire an update event. If I do call firePropertyChange() method, I always get the following Exception in the console.
In importMap , it has following values - { ,1,2,3,4} . The first value is an empty string.
I am binding the combo values in the Databindingscontext
IObservableValue observeSelectionCImportObserveWidget = WidgetProperties.selection().observe(cImport);
IObservableValue importModelObserveValue = BeanProperties.value("import").observe(model);
bindingContext.bindValue(observeSelectionCImportObserveWidget, importModelObserveValue, null, new UpdateValueStrategy(UpdateValueStrategy.POLICY_ON_REQUEST));

IObservableValue observeSingleSelectionIndexCImportObserveWidget = WidgetProperties.singleSelectionIndex().observe(cImport);
IObservableValue importIndexModelObserveValue = BeanProperties.value("importIndex").observe(model);
bindingContext.bindValue(observeSingleSelectionIndexCImportObserveWidget, importIndexModelObserveValue, null, null);

IObservableList itemsCImportObserveWidget = WidgetProperties.items().observe(cImport);
IObservableList importComboModelObserveList = BeanProperties.list("importCombo").observe(model);
bindingContext.bindList(itemsCImportObserveWidget, importComboModelObserveList, null, null);

public void setImport(String value){
        if(value.equals(""))
            return;
        long index = 0;

        for (Entry<Long, String> entry : importmap.entrySet()) {
            if (entry.getValue().equals(value)) {
                index = entry.getKey();
                break;
            }
        }
        if(ag.getImport() == index) return; // ag is a class which has getters and setters for Import.
        ag.setImport(index);
        setPriority(); // this method gets the value ag.getImport() and does some operation and updates the values in a text field

        IsDirty();
    }

    public String getImport(){
        if(ag.getImport() < 1)
            return "";
        return importMap.get(ag.getImport());

    }
    public int getImportIndex(){
        if(ag.getImport() < 1)
            return -1;
        long index = 0;
        for (Entry<Long, String> entry : importmap.entrySet()) {
            if (entry.getKey() == ag.getImport()) {
                return (int) index;
            }
            index++;
        }
        return -1;
    }
    public List<String> getImportCombo(){
        List<String> importValues = new ArrayList<String>();
        if(importMap != null && importmap.size() > 0)
            importtValues.addAll(importmap.values());
        return importValues;
    }

This is the following exception I get whenever I select an item in combo box
WARN : 16:12:49,983  - TcLogger$IC_PrintStream.log:?
java.lang.NullPointerException
    at org.eclipse.core.internal.databinding.beans.BeanPropertyHelper.writeProperty(BeanPropertyHelper.java:51)
    at org.eclipse.core.internal.databinding.beans.BeanValueProperty.doSetValue(BeanValueProperty.java:51)
    at org.eclipse.core.databinding.property.value.ValueProperty.setValue(ValueProperty.java:67)
    at org.eclipse.core.internal.databinding.property.value.SimplePropertyObservableValue.doSetValue(SimplePropertyObservableValue.java:104)
    at org.eclipse.core.databinding.observable.value.AbstractObservableValue.setValue(AbstractObservableValue.java:55)
    at org.eclipse.core.databinding.observable.value.DecoratingObservableValue.setValue(DecoratingObservableValue.java:103)
    at org.eclipse.core.databinding.observable.value.DecoratingObservableValue.setValue(DecoratingObservableValue.java:103)
    at org.eclipse.core.databinding.UpdateValueStrategy.doSet(UpdateValueStrategy.java:486)
    at org.eclipse.core.databinding.ValueBinding$4.run(ValueBinding.java:197)
    at org.eclipse.core.databinding.observable.Realm$1.run(Realm.java:148)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.databinding.observable.Realm.safeRun(Realm.java:152)
    at org.eclipse.core.databinding.observable.Realm.exec(Realm.java:170)
    at org.eclipse.core.databinding.ValueBinding$3.run(ValueBinding.java:188)
    at org.eclipse.core.databinding.observable.Realm$1.run(Realm.java:148)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.databinding.observable.Realm.safeRun(Realm.java:152)
    at org.eclipse.core.databinding.observable.Realm.exec(Realm.java:170)
    at org.eclipse.core.databinding.ValueBinding.doUpdate(ValueBinding.java:151)
    at org.eclipse.core.databinding.ValueBinding.access$4(ValueBinding.java:140)
    at org.eclipse.core.databinding.ValueBinding$1.handleValueChange(ValueBinding.java:45)
    at org.eclipse.core.databinding.observable.value.ValueChangeEvent.dispatch(ValueChangeEvent.java:62)
    at org.eclipse.core.databinding.observable.ChangeManager.fireEvent(ChangeManager.java:119)
    at org.eclipse.core.databinding.observable.value.DecoratingObservableValue.fireValueChange(DecoratingObservableValue.java:55)
    at org.eclipse.core.databinding.observable.value.DecoratingObservableValue.handleValueChange(DecoratingObservableValue.java:93)
    at org.eclipse.core.databinding.observable.value.DecoratingObservableValue$1.handleValueChange(DecoratingObservableValue.java:67)
    at org.eclipse.core.databinding.observable.value.ValueChangeEvent.dispatch(ValueChangeEvent.java:62)
    at org.eclipse.core.databinding.observable.ChangeManager.fireEvent(ChangeManager.java:119)
    at org.eclipse.core.databinding.observable.value.AbstractObservableValue.fireValueChange(AbstractObservableValue.java:71)
    at org.eclipse.core.internal.databinding.property.value.SimplePropertyObservableValue.notifyIfChanged(SimplePropertyObservableValue.java:120)
    at org.eclipse.core.internal.databinding.property.value.SimplePropertyObservableValue.access$1(SimplePropertyObservableValue.java:112)
    at org.eclipse.core.internal.databinding.property.value.SimplePropertyObservableValue$2.run(SimplePropertyObservableValue.java:66)
    at org.eclipse.core.databinding.observable.Realm$1.run(Realm.java:148)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.databinding.observable.Realm.safeRun(Realm.java:152)
    at org.eclipse.core.databinding.observable.Realm.exec(Realm.java:170)
    at org.eclipse.core.internal.databinding.property.value.SimplePropertyObservableValue$1.handleEvent(SimplePropertyObservableValue.java:63)
    at org.eclipse.core.databinding.property.NativePropertyListener.fireChange(NativePropertyListener.java:63)
    at org.eclipse.jface.internal.databinding.swt.WidgetListener.handleEvent(WidgetListener.java:55)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
    at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at com.teamcenter.rac.aifrcp.Application.runApplication(Unknown Source)
    at com.teamcenter.rac.aifrcp.Application.start(Unknown Source)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1383)

A: If you are using 'importIndex' you need to have a 'setImportIndex' method so that the changed value can be saved in the bean.


text:
Q: Passing html form values to php file Whether I enter the value for bug id or not ..in both conditions the code between php tags is displayed as output. Can someone help me to find out the reason.
Code is given below:
html file-------------------------------------------------------------
<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<title>Bug Report</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />

Bug Report

<form action="test.php"  method="post"  >

Bug ID:<input type="text" name="bugid" size="20" />

<input type="submit" value="Record Bug" />

</form>

php file--------------------------------------------------
<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<title>Record Bug</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />

<?php
                $bugid=$_POST["bugid"];
                echo $bugid;
if (empty($bugid))
    {
            echo "
You must enter the Bug ID to record the bug.
";
    }
else
    {
    echo"
good
";
                    }
?>

A: If you're getting PHP code in the output, then your webserver isn't running that page/script through the PHP interpreter. Generally, that's because you've put the code into a .html file, which is not treated as PHP by default.
Either rename the file to whatever.php, or reconfigure your webserver to treat .html files as PHP scripts.

A: Check whether php is running or not in your machine. Save the below code as test.php and run it through
<?php

   phpinfo();

?>

A: *

*check that php is working or not for that write the code <?php phpinfo(); ?> and if have manually installed php apache and getting problem  try wamp server

*your code is widely open for sql-injunction  to make it secure use

public function mysql_prep( $value ) {
        $magic_quotes_active = get_magic_quotes_gpc();
        $new_enough_php = function_exists( "mysql_real_escape_string" ); // i.e. PHP >= v4.3.0
        if( $new_enough_php ) { // PHP v4.3.0 or higher
            // undo any magic quote effects so mysql_real_escape_string can do the work
            if( $magic_quotes_active ) { $value = stripslashes( $value ); }
            $value = mysql_real_escape_string( $value );
        } else { // before PHP v4.3.0
            // if magic quotes aren't already on then add slashes manually
            if( !$magic_quotes_active ) { $value = addslashes( $value ); }
            // if magic quotes are active, then the slashes already exist
        }
        return $value;
    }

A: In that case you have to run on that Server which support PHP like Xampp or Wamp and also extension of the file should be .php


text:
Q: Symfony2 Twig and XSL I am developing an application using symfony2 and twig for templates. The problem comes when trying to use Twig in a XSL file. This is the XSL code with Twig:
    <?xml version='1.0' encoding='ISO-8859-1'?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    {# src/Anotatzailea/AnotatzaileaBundle/Resources/views/Page/testuaanotatu.html.twig #}
    {% extends 'AnotatzaileaAnotatzaileaBundle::layout.html.twig' %}

    {% block title %}Testua anotatu{% endblock%}

    {% block body %}

    <div class="box600_lower">
     <xsl:template match="word">
       <label>
        <xsl:attribute name="class">
           <xsl:text>annotation_checkbox</xsl:text>
        </xsl:attribute>
        <xsl:attribute name="id">
           <xsl:text>Ascripta</xsl:text>
        </xsl:attribute>
        <xsl:attribute name="name">
           <xsl:text>Bscripta</xsl:text>
        </xsl:attribute>
        <xsl:attribute name="value">
           <xsl:text>Cscripta</xsl:text>
        </xsl:attribute>
        <xsl:attribute name="type">
           <xsl:text>checkbox</xsl:text>
        </xsl:attribute>
       </label>
       <label>
        <xsl:attribute name="class">
           <xsl:text>altcheckboxoff</xsl:text>
        </xsl:attribute>
        <xsl:attribute name="for">
           <xsl:text>Ascripta</xsl:text>
        </xsl:attribute>
        <xsl:attribute name="id">
           <xsl:text>Bscripta</xsl:text>
        </xsl:attribute>
        <xsl:value-of select="text()"/>
        <xsl:text> </xsl:text>
        </label>
     </xsl:template>
    </div>
    {% endblock %}
</xsl:stylesheet>

The code fails and shows the next message:
Warning: XSLTProcessor::importStylesheet(): compilation error: file /var/www/Symfony/web/MyXSLFile.xsl line 12 element template

A: The reason for the compilation error is obvious: An <xsl:stylesheet> element cannot have any (non-whitespace only) text node children and in the above code you have:
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    {# src/Anotatzailea/AnotatzaileaBundle/Resources/views/Page/testuaanotatu.html.twig #}
    {% extends 'AnotatzaileaAnotatzaileaBundle::layout.html.twig' %}

    {% block title %}Testua anotatu{% endblock%}

    {% block body %}

Either this text must be removed by some preprocessor, or they need to be wrapped either in a special element, or in a comment.


text:
Q: Search a value in a comma separated value file Hi I have implemented the following method for searching a value in a csv file:
- (void)recordsForValue:(NSString*)searchedValue {

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];

NSError*  err;

    NSString *csvFilePath = //path of csv file
    NSString *csvString = nil;
    csvString = [[NSString alloc]initWithContentsOfFile:csvFilePath encoding:NSASCIIStringEncoding error:&err];
    csvFilePath = nil;
    NSRange searchRange = NSMakeRange(0,csvString.length);
    NSRange foundRange;
    int i=0;

    locationRecordsArray = [NSMutableArray array];

    while (searchRange.location <= csvString.length) {
        NSString *sFinalResult = nil;

        searchRange.length = csvString.length-searchRange.location;
        foundRange = [csvString rangeOfString:searchedValue options:NSCaseInsensitiveSearch range:searchRange];
        if (foundRange.location != NSNotFound) {
            i++;

            NSRange endDivRange;
            NSRange startRange;

            endDivRange.location = foundRange.length + foundRange.location;
            endDivRange.length   = [csvString length] - endDivRange.location;
            endDivRange = [csvString rangeOfString:@"\n" options:NSCaseInsensitiveSearch range:endDivRange];

            if (endDivRange.location != NSNotFound)
            {
                // Tags found: retrieve string between them
                foundRange.location += foundRange.length;
                foundRange.length = endDivRange.location - foundRange.location;
            }

            startRange.location = 0;
            startRange.length = foundRange.location;
            NSString* sTemp = nil;
            sTemp = [[NSString alloc]initWithString:[csvString substringWithRange:startRange]];

            startRange = [sTemp rangeOfString:@"\n" options:NSBackwardsSearch range:startRange];
            [sTemp release];
            if (startRange.location != NSNotFound)
            {
                // Tags found: retrieve string between them
                foundRange.location = startRange.location;
                foundRange.length =   endDivRange.location - foundRange.location;

                sFinalResult = nil;
                sFinalResult = [[NSString alloc]initWithString:[csvString substringWithRange:foundRange]];
                if(sFinalResult != nil)
                    [locationRecordsArray addObject:sFinalResult];
                [sFinalResult release];

            }

            // found an occurrence of the substring! do stuff here
            searchRange.location = foundRange.location+foundRange.length;
        } else {
            // no more substring to find
            break;
        }
    }
    [csvString release];

    [self insertLocationRecordsInDatabase]; // insert records of locationArray

[self performSelectorOnMainThread:@selector(showScanningView) withObject:nil waitUntilDone:NO];
[pool drain];
}

1.The above method is called in a separate thread, so we have to process it in a separate autorelease pool.
2. The 'searchedValue' is a value to be searched in the CSV file string.

3. Whenever we get a location for the value searched in the csvString, we add the complete line of string in an array.The line
is extracted by searching for newline (i.e \n) character.
4. This code is running fine if the length of csvString is small. But in case of a very large csvString, the app is crashing with low
memory warning. I checked in Instruments. The problem is with some
String variable which is reaching the size of 100s of MB and the app
is closing because of low memory.But I am not able to solve how to
optimise the memory of my string variables.Please give some
solution.

A: Finally my problem solved!!
I used the following code to optimise the memory:
- (void)recordsForLocationValue:(NSString*) searchedValue
 {

    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];

    NSError*  err;

         NSString *csvFilePath = //path of csv file
        NSMutableString *csvString = [NSMutableString stringWithContentsOfFile:csvFilePath encoding:NSASCIIStringEncoding error:&err];
        csvFilePath = nil;
        NSRange searchRange = NSMakeRange(0,csvString.length);
        NSRange foundRange;
        int i=0;
        NSString* sTemp = nil;

        locationRecordsArray = [[NSMutableArray alloc]init];

        while ([csvString length] > 1) {

            searchRange.length = csvString.length-searchRange.location;
            foundRange = [csvString rangeOfString: searchedValue
 options:NSCaseInsensitiveSearch range:searchRange];
            if (foundRange.location != NSNotFound) {
                i++;

                NSRange endDivRange;
                NSRange startRange;

                endDivRange.location = foundRange.length + foundRange.location;
                endDivRange.length   = [csvString length] - endDivRange.location;
                endDivRange = [csvString rangeOfString:@"\n" options:NSCaseInsensitiveSearch range:endDivRange];

                if (endDivRange.location != NSNotFound)
                {
                    // Tags found: retrieve string between them
                    foundRange.location += foundRange.length;
                    foundRange.length = endDivRange.location - foundRange.location;
                }

                startRange.location = 0;
                startRange.length = foundRange.location;
                sTemp = [csvString substringWithRange:startRange];
                startRange = [sTemp rangeOfString:@"\n" options:NSBackwardsSearch range:startRange];
                if (startRange.location != NSNotFound)
                {
                    // Tags found: retrieve string between them
                    foundRange.location = startRange.location;
                    foundRange.length =   endDivRange.location - foundRange.location;

                    sTemp = [csvString substringWithRange:foundRange];
                    if(sTemp != nil)
                        [locationRecordsArray addObject:sTemp];
                }

                // found an occurrence of the substring! do stuff here
                searchRange.location = foundRange.location+foundRange.length;

                [csvString deleteCharactersInRange:NSMakeRange(0, searchRange.location-1)];

                searchRange.location = 0;
            }
            else {
                NSLog(@"no more substring to find");

                // no more substring to find
                break;
            }
        }

        [self insertLocationRecordsInDatabase];

    [self performSelectorOnMainThread:@selector(showScanningView) withObject:nil waitUntilDone:NO];
    [pool drain];
    [NSThread exit];
}

A: use a memory mapping so you dont have to load everything at once.see: Substitute for NSData deprecated dataWithContentsOfMappedFile
OR
split the file into several smaller files


text:
Q: Get current action I have a wrapper div, in side that div i have a div, On click of that div i have to show a message. My problem is that i can rendering its id on runtime which is unique but all have common class.
Now my markup is inside a loop,Say if the html markup is rendering 10 times it means, I have 10 buttons.
When i click any one of theme it appears for all the 10dives.
How to solve this please help me.

A: I am not 100% certain of your question. I tried to extract the relevant information. Here is an example of using jQuery to handle the click event of a 'button' divs inside a parent div. If this is not quite what you are asking, please provide additional information.
http://jsbin.com/ahive3/9/edit
Hope this helps.
Bob


text:
Q: If I buy Garry's Mod, will I need other games to play it? I've never bought anything on Steam, but I wanted to buy Garry's Mod.
So, after buying it on Steam, do I have to buy any other game? If yes, then which ones?

A: You don't have to have any other games in order to actually play GMod.
But it is highly recommended to have HL2 + ep1/2 + CSS + TF2 in order to:

*

*use their maps and content

*use addons or mods requiring those games

GMod is more fun with having more stuff at your disposal. A basic installation with no other resources lacks of almost everything when it comes to maps, props, npcs, etc.

A: Technically - you do not need to purchase anymore games.  However, you will need to purchase and download (possibly) Counter Strike: Source and Team Fortress 2 for a lot of the textures and other game objects.
From the Steam page for Garry's Mod:

Please note: Some multiplayer servers and game-modes might require you to own other games - such as Counter-Strike: Source and Team Fortress 2.

This Reddit also provides some more details.
Counter Strike: Source is currently $19.99 at posting.  Team Fortress 2 has been free since June 23, 2011.  It's important to note that some others games that may be needed are basically any game that run on the Source Engine developed by Valve.  This includes games like:

*

*Left 4 Dead

*Left 4 Dead 2

*The Half Life 2 Series

*Counter Strike: Global Offensive
...and many more! But the majority of the textures are handled with just Counter Strike: Source.  I would say at the minimum, you will need that game (and you might as well get Team Fortress 2 since it's free).  A complete list of Source games can be found here.
By not having the correct games, you could potentially be missing the textures needed to play maps created by others. You will see a lot of checkered purple and black objects, and actual "ERROR" messages like this:

A: In addition to the previous answers, it is worth noting that some maps or mods have models/textures compiled with them. This means that when you download (for example) a map, even though it may have (for example) HL2 Episode 2 textures/models, you are still able to see them properly without the game installed because you have downloaded them with the map. Some addon/level creators have even used custom textures and models that you will not find in any other game.
Note that most maps do not use this method, as it increases file size and (possibly) decrease optimization of the map, making it run slower.
From my browsing of the workshop, I have found that usually maps require Counter Strike: Source or Half Life 2: Episode 2.
Without the proper textures/models installed, you will (as shown by Timmy Jim) Errors and purple/black checkered patterns, or textures with other "funky" texture issues, relating to a HDR skybox.
The other games are not required to download a map/addon, and upon joining a server with a map with these things that you do not have installed, you will still continue to download the map, however errors will still arise (and you may get script errors, but these usually aren't anything to worry about).
EDIT #1: Here is the "funky" texture thing I was talking about:

Also, there is a Trouble in Terrorist Town (TTT) map called ttt_forest_final. It has HL2 Ep2 models (and maybe textures and sounds) compiled with it. Even though I have Ep2 on my computer, when my friends play it they see the same things as me. A great map that I reccomend for TTT.


text:
Q: Generic of generic type inference (request of response) I am currently working on a generic request / response abstraction to send arbitrary class requests to a component while receiving a pre-defined response class based on the request.
I have two base classes:
abstract class RequestClass<T>
    where T : ResponseClass
{
}

abstract class ResponseClass
{
}

A request class therefore defines its response class.
To demonstrate the situation I have the following example classes:
class DoSomethingRequest : RequestClass<DoSomethingResponse>
{
}

class DoSomethingResponse : ResponseClass
{
}

Now to process a request I have the following method:
TResult SendRequest<T, TResult>( T Request )
    where T : RequestClass<TResult>
    where TResult : ResponseClass
{
}

So far so good; however, while I expect the following to work, the compiler is not able to infer the type parameters for the following request:
DoSomethingResponse Response = SendRequest( new DoSomethingRequest() );

Why doesn't this work? The compiler should have all the information required do infer that "DoSomethingRequest is a RequestClass of DoSomethingResponse" and compile without a problem.
Is there any other way to get my scenario to work?
Help is appreciated.
Thanks in advance and best regards!
-Simon


text:
Q: How does Vertx java handle Oracle's RETURNING BULK COLLECT INTO clause I was trying to implement RETURNING BULK COLLECT INTO clause feature in vertx java. I saw many example but was not able to figure out. Didn't find PreparedStatement or registerReturnParameter kind of thing. Can you please help. My Query looks like
DECLARE
    TYPE updatedId IS TABLE OF Table1.col2%TYPE;
    XupdatedId updatedId;
BEGIN
    UPDATE TABLE1
         SET col1 = 'OK' WHERE col2 IN ('abc','def')
   RETURNING col2
        BULK COLLECT INTO XupdatedId;
   FOR i IN 1..XupdatedId.LAST
   LOOP
        IF i > 1 THEN
            dbms_output.put_line (XupdatedId(i));
        END IF;
   END LOOP;
END;

I am using below vertx imports
import io.vertx.ext.sql.ResultSet;
import io.vertx.ext.sql.SQLClient;
import io.vertx.ext.sql.SQLConnection;
import io.vertx.ext.sql.UpdateResult;


text:
Q: How to fetch json data in Angular 2+ I'm trying to display a list with data fetched from a local json file. Here is how my service looks so far.
category.service.ts

import { Injectable } from '@angular/core';
import { Http, Response, Headers, RequestOptions } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/map';

@Injectable()
export class CategoryService {
  constructor(private _http: Http) { }

  getCategories() {
    return this._http.get('api/categories.json')
      .map((response: Response) => response.json())
      .do(data => console.log('All; ' + JSON.stringify(data)))
      .catch(this.handleError);
  }

  private handleError(error: Response) {
    console.log(error);
    return Observable.throw(error.json().error || 'Server error');
  }
}

here is how the Category Menu component where I inject it looks so far

import { Component, OnInit } from '@angular/core';
import { CategoryService } from '../category.service';

@Component({
  selector: 'app-category-menu',
  templateUrl: './category-menu.component.html',
  styleUrls: ['./category-menu.component.css']
})
export class CategoryMenuComponent implements OnInit {
  errorMessage: string;
  commerceName= `El baratón`;
  categoryName = `Bebidas`;
  categories: any = 'Not assigned yet';
  hasMenu?= true;

  constructor(private _categoryService: CategoryService) { }

  ngOnInit() {
    return this._categoryService.getCategories()
      .subscribe(
        categories => this.categories = categories,
        error => this.errorMessage = error
      );
  }

}

Now, the error I am getting in the console is a 404. For this project I have used the CLI version 1.0 and the categories.json file inside of the src/api/categories.json folder.
What am I doing wrong here?

A: move your api/categories.json to assets folder, then change url to
return this._http.get('/assets/api/categories.json')


text:
Q: ResultSetMetaData getTableName return empty I am trying to get TableName from ResultSetMetaData by following code:
 `Properties info = new java.util.Properties();
                    info.put ("user",this.username);
                    info.put ("password",this.password);
                    info.put ("ResultSetMetaDataOptions","1");
                    Connection conn = DriverManager.getConnection(this.url,info);

                    PreparedStatement preparedStatement = connection.prepareStatement(sql);
                                    ResultSet rs = preparedStatement.executeQuery();
                                    ResultSetMetaData metaData = rs.getMetaData();
                                    metaData.getTableName(0);
                                    for (int i = 1; i <= metaData.getColumnCount(); i++) {
                                        logger.info("Table Name : " + metaData.getTableName(i);)
                                    }`

I follow this link:         https://docs.oracle.com/cd/E13222_01/wls/docs91/jdbc_drivers/oracle.html#1075290
But,getTableName return  still empty.
How to set ResultSetMetaDataOptions?
How can I select tableName with other method ?

A: The documentation you link is for a very old driver. A recent version of the Oracle JDBC driver documentation explicitly states, in Using Result Set Metadata Extensions:

The oracle.jdbc.OracleResultSetMetaData interface is JDBC
  2.0-compliant but does not implement the getSchemaName and getTableName methods because Oracle Database does not make this
  feasible.

In other words, you can't get this data for Oracle.


text:
Q: New line if specific number with some string I' really don't know what to spell this problem... but I will explain the result and code.

I need after 4 yes, new line and after 8 new line and after 13 new line and soon..
i'm still confusing with looping here... this is my code:
<?php

$i = 0;

do{

    $i++;

    if($i == 5) {
        echo "new line \n";
    }

    echo "The number is " . $i . "\n";

}

while($i <= 16);

Hope someone can help and tell my newbie in programming.
Thanks

A: What about this one
<?php

$i = 0;

do{

   $i++;

   echo "The number is " . $i . "\n";
   // % operator returns the remaining after the division
   if($i % 4 == 0) {
     echo "new line \n";
   }

} while($i <= 16);

A: You are looking for a modulus operator.

do{

    $i++;
    $remainder = $i % 4;

    echo "The number is " . $i . "\n";

    if( $remainder == 0) {
        echo "new line \n";
    }

}

while($i <= 16);


text:
Q: How to get query string value once page is insert data and redirect t the older page Once I perform insert operation(insertProcess.php), page insert detail and then redirect to the same older (insertdetail.php) page.
I set a query string variable in insertdetail.php, after inserting data page is redirect to insertdetail.php but query string value is lost...
how can i retrive it
screenshot

A: As per your description the page you wan to redirect accepts a query string in url, so whenever you call that page just add a query string after that page's url...
insertdetail.php?variable=value

Hope this works :)

A: Exact answer:       header('location:../insertDetail.php?blk='.$block);
?blk = ; .$block);return the exact querystring


text:
Q: OctoberCMS: How to dynamically filter manage.list in relation configuration file I'm extending the rainlab.user plugin to allow each user to have friends via a simple intermediate table with the following fields:
user_id
friend_id
status

I've therefor extended the Rainlab.User Controller to have Friends tab where all friends of a user are listed:
use RainLab\User\Models\User as FrontUser;
use RainLab\User\Controllers\Users as UsersController;

FrontUser::extend(function($model) {
    $model->belongsToMany['friends']=[
        'RainLab\User\Models\User',
        'table'    => 'meysam_social_friends',
        'pivot' => ['status'],
        'key'      => 'user_id',
        'otherKey' => 'friend_id'
    ];
});

UsersController::extend(function($controller) {
    if(!isset($controller->implement['Backend.Behaviors.RelationController'])) {
        $controller->implement[] = 'Backend.Behaviors.RelationController';
    }
    $controller->relationConfig  =  '$/meysam/social/controllers/user/config_relations.yaml';
});

UsersController::extendFormFields(function($form, $model, $context) {
    if(!$model instanceof FrontUser or $context != 'preview'){
        // friends tab should not be displayed in update and create contexts
        return;
    }

    $form->addTabFields([
        'friends' => [
            'label' => '',
            'tab' => 'Friends',
            'type' => 'partial',
            'path' => '$/meysam/social/controllers/user/_friends.htm',
        ]
    ]);
});

And here is the config_relations.yaml file:
friends:
    label: 'new friend'
    view:
        list: ~/plugins/meysam/social/models/friendspivot/columns.yaml
        toolbarButtons: add|remove
        showSearch: true
    manage:
        showSearch: true
        recordsPerPage: 10
        list: ~/plugins/rainlab/user/models/user/columns.yaml
    pivot:
        form: ~/plugins/meysam/social/models/friendspivot/fields.yaml

Now in the friends tab, list of are friends of the currently selected user are shown and when I click on Add new friend button, the list of all users is shown (manage.list) so that one of the users could be selected as the new friend. My problem is that in this list, all users are shown, even the currently selected user, and therefor a user can be added as his own friend. How can I filter out the current user from this list? I thought of using scope property but then this scope should be dynamic and I don't know how to pass the user_id of the current User Model to this scope.

A: The current model is passed to the scope methods provided in the view and manage options as the first parameter. I've updated the documentation to reflect this fact.
To give you an example, your config_relation.yaml should look like
friends:
    label: 'new friend'
    view:
        list: ~/plugins/meysam/social/models/friendspivot/columns.yaml
        toolbarButtons: add|remove
        showSearch: true
    manage:
        showSearch: true
        recordsPerPage: 10
        list: ~/plugins/rainlab/user/models/user/columns.yaml
        scope: notThis
    pivot:
        form: ~/plugins/meysam/social/models/friendspivot/fields.yaml

and then the query scope method notThis should be added dynamically to the User Model:
FrontUser::extend(function($model) {
    $model->addDynamicMethod('scopeNotThis', function ($query, $user) {
        return $query->where('id', '!=', $user->id);
    });
});


text:
Q: eps format not showing in my TeXworks to pdf file I posting this question but once I posted in this topic ''LaTeX - Image not showing up'' I have bben told that to create new question that everyone can see.
I have a problem with .eps format when I want to convert my text form TeXworks to pdf file. I always get the blank rectangle with name of the image! I removed draft, and I am using IEEEconfran template. Here is the results:
Thanks a lot in advance!

A: Try adding something like this just after \documentclass.  This of course assumes you have xetex installed.
\ifCLASSINFOpdf
    \usepackage[pdftex]{graphicx}
    \DeclareGraphicsExtensions{.pdf,.jpeg,.png}
\else
    \usepackage[dvips,xetex]{graphicx}
    \DeclareGraphicsExtensions{.eps}
\fi


text:
Q: This prepared statement Update query isn't working ... why? $query="UPDATE `db`.`tb` SET `colA` = ?, `colB` = ?, `colC` = ?, `colD` = ?, `colE` = ?, `colF` = ?, `colG` = ? WHERE `tb`.`colA` = ? AND month(date)= ?;";
$stmt = $web_dbi->prepare($query);
$stmt->bind_param("sssssssss", $colA_PHPvar, $colB_PHPvar, $colC_PHPvar, $colD_PHPvar, $colE_PHPvar, $colF_PHPvar, $colG_PHPvar, $colA_PHPvar, $colB_PHPvar);
$stmt->execute();

Additional information:

*

*date is the name of a column in db.tb ...

*This query works when I remove the AND month(date)= ? from the Where clause and it's corresponding ? variable ...

A: figured it out ... I was passing a date variable via AJAX that was formatted as the numerical representation of the month (i.e. January=1 ...), and included the date column as a column to update (formatted as a date in MySQL)(m-1-yyyy), when really I only needed the date column in the Where clause (the numerical representation of month successfully matched month(date) in database and updated other fields, and correctly format errored while updating date (date in database is simply the first of the month (m-1-yyyy)) (which can stay the same here) ...
$query="UPDATE `db`.`tb` SET `colA` = ?, `colB` = ?, `colC` = ?, `colE` = ?, `colF` = ?, `colG` = ? WHERE `tb`.`colA` = ? AND month(date)= ?;";
$stmt = $web_dbi->prepare($query);
$stmt->bind_param("sssssssss", $colA_PHPvar, $colB_PHPvar, $colC_PHPvar, $colE_PHPvar, $colF_PHPvar, $colG_PHPvar, $colA_PHPvar, $colB_PHPvar);
$stmt->execute();

(colD and $colD_PHPvar were the date variable being passed via AJAX as a numerical representation of the month (i.e. January=1 ...) ...


text:
Q: jQuery animate scrollTop not working in firefox I have this simple jQuery autoscroll code on my website
    $('body[data-pagecontroller="profile"],body[data-pagecontroller="search"]').animate({
    scrollTop: $("#ipsLayout_body").offset().top -65
}, 1000);

Basically, a simple Auto scroll to ipsLayout_body if the selectors exists within the body, While it works fine on Microsoft Edge, Chrome, Opera but not on  IE9 and firefox?

A: I'm assuming Firefox has some issues with data- attributes and the animation, however I always use "html, body" to animate to the element I want, like this:
/* IF body[data-pagecontroller="profile"] OR
 body[data-pagecontroller="search"] Exists */
if($('body[data-pagecontroller="profile"]').length > 0 || $('body[data-pagecontroller="search"]').length > 0){
    $('html,body').animate({scrollTop: $('#ipsLayout_body').offset().top -65 },1000);
}

Hope this helps !
Leo.


text:
Q: Is there any way in HIVE to execute multiple scenarios based on the condition? I have a situation like,

*

*if I have multiple records exists on column X in the table TAB then I need to run "Query #1"

*if I have only one record exists on column X in the table TAB then I need to run "Query #2"
The selected columns are same but the condition is different.
I tried with case clause but it did not worked.
Is there any way to achieve in Hive ?
Can we use "Query #" in case clause? If yes please suggest an example.


text:
Q: Defining singleton-like container objects... and keeping tslint happy I have a large TypeScript project and have recently added tslint in order to enforce some basic code styling rules. This has largely been painless, but there is one things that I'm still questioning.
I have a few bits of code where I have a singleton-like object which wraps some properties and functions. Imagine something like:
function open(x) {...};
function close(x) {...};
let isOpen = false;

export const MainMenu {
    open,
    close,
    isOpen
};

But the problem is that tslint complains about the naming of MainMenu because I've told it to enforce camelCase variable names. In all circumstances but this, the convention holds true and in situations like this, I think it's right to be upper-case (Math, Reflect, etc. all follow this convention).
So what should I do here? I could either disable the rule whenever this occurs, or perhaps the namespace concept is more appropriate for this? But then I'm using external modules, so I don't know if I should. Plus, namespace-s make it more difficult to add property members.
Any advice welcome.

A: In general this seems more like an area where I'd use namespace (or perhaps a separate external module? Then in your current module you could re-export it.)
But let's say you do want to do things this way, and you want to make TSLint happy. Your easiest solution is to just temporarily disable variable-name:
/* tslint:disable:variable-name */
export const MainMenu {
    open,
    close,
    isOpen
};
/* tslint:enable:variable-name */

(Note that you could move the re-enabling comment up a few lines - I just prefer it where I have it for aesthetic purposes.)
There's also a current feature request for a way to exclude specific variables from this rule in your tslint.json file. So down the road that might be an option!