text:
Q: Could not write request: no suitable HttpMessageConverter found for request type with Feign I want to implement request using Spring Cloud Feign client. I tried this:
Feign client:
@FeignClient(name = "mail-service", url = "mail-service")
public interface EmailClient {

    @RequestMapping(method = RequestMethod.POST, value = "/register")
    void setUserRegistration(RegisterUserDTO registerUserDTO);

    @RequestMapping(method = RequestMethod.POST, value = "/password_reset")
    void setUserPasswordReset(PasswordResetDTO passwordResetDTO);
}

Request DTO:
public class RegisterUserDTO {
    private int id;

    public RegisterUserDTO() {
    }
}

Controller:
@Autowire
EmailClient emailClient;

@PostMapping("/dummy")
public ResponseEntity<?> test() {

    RegisterUserDTO obj = new RegisterUserDTO();

    emailClient.setUserRegistration(obj);

    return ok().build();
}

Feign configuration:
feign:
    client:
        config:
            default:
                connectTimeout: 5000
                readTimeout: 5000
                loggerLevel: basic
eureka:
    client:
        serviceUrl:
            defaultZone: ${EUREKA_URI:http://localhost:8761/eureka}
    instance:
        preferIpAddress: true

But when I make a POST request I get exception:
22:50:05.325 [http-nio-8090-exec-1] DEBUG DispatcherServlet[logResult:1101] - Failed to complete request: feign.codec.EncodeException: Could not write request: no suitable HttpMessageConverter found for request type [org.engine.plugin.dto.RegisterUserDTO]
22:50:05.328 [http-nio-8090-exec-1] DEBUG HstsHeaderWriter[writeHeaders:169] - Not injecting HSTS header since it did not match the requestMatcher org.springframework.security.web.header.writers.HstsHeaderWriter$SecureRequestMatcher@461d6969
22:50:05.329 [http-nio-8090-exec-1] DEBUG SecurityContextPersistenceFilter[doFilter:119] - SecurityContextHolder now cleared, as request processing completed
22:50:05.334 [http-nio-8090-exec-1] ERROR [dispatcherServlet][log:175] - Servlet.service() for servlet [dispatcherServlet] in context with path [/engine] threw exception [Request processing failed; nested exception is feign.codec.EncodeException: Could not write request: no suitable HttpMessageConverter found for request type [org.engine.plugin.dto.RegisterUserDTO]] with root cause
feign.codec.EncodeException: Could not write request: no suitable HttpMessageConverter found for request type [org.engine.plugin.dto.RegisterUserDTO]

Do you know how I can solve this issue?

A: In my case, I was using openfeign dependency without spring-boot-starter-web. After adding this dependency the error disappears. Probably because it contains the json mapper needed.

A: Yes, you have not added getter methods in your DTOs.
public class RegisterUserDTO {

    private int id;
    public RegisterUserDTO() {
    }
    public int getId() {
     return id;
    }

}

See the CODE which I have added.


text:
Q: Whats the best approach (design pattern) to access database in C#? I am a newber in design pattern.
Currently I am developing a system where I have a releation DB. What would be the best approach to CRUD from my DB?
My current code looks like the follow (C# code):
I defined a inteface with commons functions to all classes.
namespace Model
{
    public interface ICommon
    {
        void insert();
        void update();
        void delete();
    }
}

The Common class (abstract one) implements ICommon interface and few orders methods and attributes.
namespace Model
{
    public abstract class Common : ICommon
    {
        public Guid RecId { set; get; }

        public abstract void insert();
        public abstract void update();
        public abstract void delete();
        public abstract List<Common> find();

        /// <summary>
        /// Insert or update the record
        /// </summary>
        public void save()
        {
            if (this.RecId == Guid.Empty)
            {
                this.insert();
            }
            else
            {
                this.update();
            }
        }
    }
}

Then, the proper class (UserTable class for example) extends the Common class and implements the abstracts methods and others particulars attributes.
The way that I am doing my CRUD its from StoresProcedures and SqlParameter, SqlCommand and SqlConnection. Here it is a example:
    class CustTableModel : Common
        {
            public string SerialNumber { set; get; }
            public string ApplicationVersion { set; get; }
            public string KernelVersion { set; get; }
            public string Name { set; get; }
            public bool Active { set; get; }

            public override void insert()
            {
                List<SqlParameter> parameters = new List<SqlParameter>();
                SqlParameter parameter;

                // SerialNumber
                parameter = new SqlParameter("@serialNumber", System.Data.SqlDbType.Int);
                parameter.Value = this.SerialNumber;
                parameters.Add(parameter);

                // ApplicationVersion
                parameter = new SqlParameter("@applicationVersion", System.Data.SqlDbType.Int);
                parameter.Value = this.ApplicationVersion;
                parameters.Add(parameter);

                // KernelVersion
                parameter = new SqlParameter("@kernelVersion", System.Data.SqlDbType.Int);
                parameter.Value = this.KernelVersion;
                parameters.Add(parameter);

                // Name
                parameter = new SqlParameter("@name", System.Data.SqlDbType.Int);
                parameter.Value = this.Name;
                parameters.Add(parameter);

                // Active
                parameter = new SqlParameter("@active", System.Data.SqlDbType.Bit);
                parameter.Value = this.Active;
                parameters.Add(parameter);

                DBConn.execute("CUSTTABLE_INSERT", parameters); // The code of DBConn is below.
}
}

Just to a better understanding, here it is the DBConn class:
public class DBConn
    {
        protected SqlConnection sqlConnection;
        protected string command { set; get; }
        protected List<SqlParameter> parameters { set; get; }

        protected void openConnection()
        {
            this.sqlConnection = new SqlConnection();
            this.sqlConnection.ConnectionString = "Data Source=.\\SQLEXPRESS;Initial Catalog=JYL_SOAWS_DB;Integrated Security=True";
            this.sqlConnection.Open();
        }

        protected void closeConnection()
        {
            if (this.sqlConnection.State == System.Data.ConnectionState.Open)
            {
                this.sqlConnection.Close();
            }
        }

        /// <summary>
        /// Executa o processo no banco.
        /// </summary>
        /// <returns>Quantidade de registros afetados.</returns>
        protected SqlDataReader run()
        {
            SqlCommand command = new SqlCommand();
            SqlDataReader ret;

            this.openConnection();

            command.CommandType = System.Data.CommandType.StoredProcedure;
            command.Connection = this.sqlConnection;
            command.CommandText = this.command;

            if (this.parameters != null)
            {
                foreach (SqlParameter parameter in this.parameters)
                {
                    command.Parameters.Add(parameter);
                }
            }

            ret = command.ExecuteReader();

            this.closeConnection();

            return ret;
        }

        /// <summary>
        /// Interface da classe à outros objetos.
        /// </summary>
        /// <param name="commandName">Nome da store procedure a ser executada.</param>
        /// <param name="parameters">A lista com os parâmetros e valores.</param>
        /// <returns>Numero de registros afetados.</returns>
        public static SqlDataReader execute(string commandName, List<SqlParameter> parameters = null)
        {
            DBConn conn = new DBConn();

            conn.command = commandName;
            conn.parameters = parameters;

            return conn.run();
        }
    }

I am pretty sure that there is a better way.
Could anyone help me? Thanks is advance.

A: You have hit upon two subtly different patterns here.
The first is the repository pattern - a way of abstracting away your business logic from your data access
The second is the Active Record pattern, whereby an entity is responsible for maintaining its own state in a database.
I would recommend you stay away from ActiveRecord in C# (you may or may not know about the Inversion of Control pattern right now, but it is very useful and fairly incompatible with AR).
I would suggest you look at something like dapper.net if you are starting out (I still use it in my smaller projects).  It is a Micro-ORM which takes lots of the boilerplate away from using a database, without being opinionated or difficult to learn (I use and like EntityFramework & NHibernate, but they aren't anywhere as easy to pick up for a beginner).
Along with this, I would create a repository (a class with Create(Foo entity), Read(Guid entityId), Update(Foo entity) & Delete(Guid entityId) methods).
As an aside, be careful when using Guids as a primary key, as they can cause an interesting situation:  Since most Guid implementations (almost always) have a non-sequential layout, and data is physically ordered by primary key, such inserts with can cause a lot of disk IO as the database reorders data pages on disk to accommodate new data inserted at some arbitrary position within the table.  A good strategy for Guid generation for use as a primary key is to use a Guid Comb generator
Good Luck!

A: This is the best pattern. I advise not using an ORM. especially EF.
public class MyModel
{
    public string Id {get;set;}
    //public valuetype PropertyA {get;set;}  //other properties
}

public interface IMyModelRepository
{
    List<MyModel> GetModels();

    MyModel GetModelById(string id);

    void AddMyModel(MyModel model);
    //other ways you want to get models etc
}

public class MyModelRepositorySql : IMyModelRepository
{
    public List<MyModel> GetModels()
    {
        //SqlConnection etc etc
        while (SqlDataReader.Read())
        {
           results.Add(this.populateModel(dr));
        }
        return results;
    }

    protected MyModel populateModel(SqlDataReader dr)
    {
        //map fields to datareader
    }

    public MyModel GetModelById(string id)
    {
        //sql conn etc
        this.populateModel(dr);
    }
}

Here's my reasoning:
Using the repository pattern allows you to inject ways of persisting your data which doesn't require a database. This is essential for unit testing, but also you will find it very useful if you can inject a mock repository into your project for integration testing.
Although ORMs might seem easy at first and save you a lot of typing, they cause problems in the long run. You only need to search stack overflow for entity framework questions to see the kind of knots people get themselves tied in when they hit a query that runs in a sub optimal way.
In any large project you will run across a data fetch requirement which requires some optimized way of retrieving data, which will muck up your carefully designed object graph/injectable generic repository or clever cutting edge ORM.
POCO objects are good. Complex objects (objects which have other objects as properties) are a pain in the arse when you attempt to serialise them or recursively add to the databases, etc. Keep your underlying data models POCO and only group them together in services or viewmodels using LINQ.
Well done for using GUID ids btw! Don't listen to those fools who think they will never run out of ints! (store as varchar(50) and let the DBA sort the indexing out) the problem with any DB generated id is you have to be able to create objects without connecting to the database.

A: For performing CRUD operations I would recommend Repository pattern with Entity framework.
Entity Framework is an ORM provided by microsoft. It deals with database using set of POCO Classes (Entity) to perform insert/update/delete/create operations.
To Execute queries against these entities, Language Integrated Query (LINQ) will be used. LINQ uses similar syntax of SQL and it returns database results as collection of Entities.
Here is a sample
Repository pattern with EF
Cheers!

redpajama_set_name: RedPajamaStackExchange


text:
Q: Upload files from web to Google Drive I want to make a form on a website using Google API where user fill in "name", "email" and the file to upload. I want the file to upload in my Google Drive, which is working (followed YT tutorial), but I need to create a new folder named as "name" + "email" from the form or named as "name" and create a file in this folder with content of "email"
I tried this but I've never done anything in .gs so I have no idea how to pass the name from .html
<!DOCTYPE html>

    <base target="_top">
    <title>Upload Files</title>

Nezávazná poptávka!

    <form>
        <input type="text" class="box" name="name" placeholder="Celé jméno*">

        <input type="text" class="box" name="mail" placeholder="E-mail*">

        <input type="file" name="myFile" mulitple>

        <input type="button" id="submitBtn" value="Nahrát soubor">

    </form>

function doGet() {
  var html = HtmlService.createHtmlOutputFromFile('index');
  return html.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);
}

function uploadFiles(data)
{
 var file = data.myFile;
 var name = data.name;
 var mail = data.mail;
 var folder = DriveApp.getFolderById('1lnLlX-zB8n4JZyEDdq242hiw2jX4qZWH');
 DriveApp.createFolder(name);
 DriveApp.createFile(mail, mail);

 var createFile = folder.createFile(file);
 return createFile.getUrl();
}

A: You can keep your index.html page the same and complete the task with a few minor edits to you code.gs:
function uploadFiles(data){

  var file = data.myFile;
  var name = data.name;
  var mail = data.mail;

  var folder = DriveApp.getFolderById('<your-folder-id>');
  folder.createFolder(name + " + " + mail);

  var createFile = folder.createFile(file);
  return createFile.getUrl();
}

Alternatively, if you want the file to be uploaded to the newly created folder, you can do this by replacing the last three lines:
  folder.createFolder(name + " + " + mail);

  var createFile = folder.createFile(file);
  return createFile.getUrl();

with:
  var folderID = folder.createFolder(name + " + " + mail).getId();

  var createFile = DriveApp.getFolderById(folderID).createFile(file);
  return createFile.getUrl();


text:
Q: Struct pointer to another struct in C Given these two structs:
typedef struct graph {
    int number_vertices;
    vertex *vertices;
} graph;

typedef struct vertex {
    int id;
    linked_list *out_neighbours;
    linked_list *in_neighbours;
} vertex;

How is it possible to add multiple vertices to a graph?

A: Like this:
graph g;
g.number_vertices = n;
g.vertices = malloc(n * sizeof(vertex)); // allocate dynamic memory for `n` vertices
                                         // and make g.vertices point to that memory
// fill g.vertices[0], g.vertices[1], …, g.vertices[n-1]

// …

// deallocate the memory when you're done:
free(g.vertices);

A: Allocate a buffer large enough to store the vertices, and store the pointer to it in the variable vertices in the struct graph.
struct graph g;
g.number_vertices = 10;  // If you want to store 10 vertices
g.vertices = (vertex*)malloc(g.number_vertices * sizeof(struct vertex));
g.vertices[0]... // To access the first.
g.vertices[1]... // To access the second.
g.vertices[2]... // To access the third, etc.


text:
Q: SQL count by type I would like to summarize in a table so that I have for each id in each round,
the number of tokens "red" and "blue". What would the SQL query for such table?
Here's the data.
id | round | color | ntokens
1  |   1   | blue  | 5
1  |   2   |  red  | 83
1  |   3   | blue  | 77
2  |   3   | blue  | 3
2  |   3   |  red  | 2
3  |   1   |  red  | 4
3  |   1   | blue  | 55
3  |   2   | blue  | 22

The result will display like below:
id | round | blue_count | red_count
 1 |   1   |      5     |    0
 1 |   2   |      0     |    83
 1 |   3   |     77     |    0
 2 |   3   |      3     |    2
 3 |   1   |     44     |    4
 3 |   2   |     22     |    0

I have been trying the following code:
  SELECT id, round,
  COUNT(color='red') as red_count,
  COUNT(color='blue') as blue_count
  FROM data
  GROUP BY id, round

A: count counts values that are not null. = returns either true or false, which are both not null. You could use a case expression to create the desired behavior though:
SELECT   id,
         round,
         COUNT(CASE color WHEN 'red' THEN 1 END) as red_count,
         COUNT(CASE color WHEN 'blue' THEN 1 END) as blue_count
FROM     data
GROUP BY id, round

A: You have to use a CASE in the COUNT.
SELECT id, round,
SUM(CASE WHEN color = 'red' THEN 1 END) as red_count,
SUM(CASE WHEN color = 'blue' THEN 1 END) as blue_count
FROM table_that_I_hope_is_not_actually_called_data
GROUP BY id, round

A: I would suggest this to get to the requested result table:
SELECT
    id, round,
    SUM(CASE WHEN color = 'red' THEN ntokens END) AS red_count,
    SUM(CASE WHEN color = 'blue' THEN ntokens END) AS blue_count
FROM data
GROUP BY id, round


text:
Q: Prevent against SQL Injection - mybatis and spring Is there exists a good way to prevent agains SQL injection in mybatis ?
I am using this in connection to spring-boot.   In reality, I am using string param given by user in queries.
Any ideas?

A: In general, you should consider using #{} for string substitution instead of ${}.
This is because #{} causes Mybatis to create a preparedStatement which prevents SQLInjection compared to ${} which would inject unmodified string into SQL.
Mybatis clearly explains the same in its documentation here. (String Substitution Section)
You can also refer to this blog which provides examples on String substitution with mybatis and how SQLInjection can be stopped.

A: @Bandi Kishore is absolutely right, to complement his response I think it's worth explaining the reason why prepared statements prevents SQLInjection by nature, as greatly explained in this article
Basically the SQL server engine will compile your query string and then substitute its parameters.
Query using string substitution:
If you pass a query string already with the parameters substituted then the compiled query code will include the malicious code compiled as valid SQL commands.
Query using placeholders:
On the other hand if the query string only has the placeholders the SQL server engine will compile the code first with the placeholders, then it will substitute the place holder with the values provided (at this point the malicious code is inserted), however, since the malicious code was not compiled it'll be treated as pure data by the SQL server engine thus having prevented the malicious attack.


text:
Q: ExtJs 4.2 Extend Custom Model using MVC problems Using ExtJs 4.2 with MVC pattern
I am trying to make a custom model, store, proxy, reader, writer but am having problems getting it to work in the MVC pattern. I followed this example to extend a model and I can see it working only if it is not used in the MVC way.
My store refers to a model such as Contacts defined in the model property, then Contacts refers to custom model WakandaModel using the model property. But when I create my store which refers to Contacts none of the model properties or proxy defined in the custom WakandaModel is brought over to the stores model.
Here is my code, I have left comments in so you can see what I have attempted to try.  Thanks for any help!
App Code
Ext.Loader.setConfig({
    enabled : true,
    paths   : {
        'Ext.ux'    : "lib/extux",
        'Wakanda'   : "lib/extux/wakanda"
    }
});
Ext.application({
    name : 'SimplyFundraising',
    autoCreateViewport : true,

    requires : ['Ext.ux.Router', // Require the UX
    'Ext.window.MessageBox'],

    controllers : ['Contacts'],
});

Custom Model
Ext.define('Wakanda.Model', {

    extend: 'Ext.data.Model',

    idProperty: '__KEY',

    stampProperty: '__STAMP',

    defaultProxyType: 'wakanda',

    onClassExtended: function(cls, data) {
          //    debugger;
       // cls.apply(this)
//        var parts = data.$className.split('.');
//        var entity = parts[2]
//        var catalog = this.prototype.getCatalog(entity),
//            attributes = catalog.attributes;
//        for (var i = 0, l = attributes.length; i < l; i++) {
//            if (attributes[i].name === 'ID') {
//                attributes[i].persist = false;
//            }
//        }
//        attributes.push({name: this.prototype.idProperty});
//        attributes.push({name: this.prototype.stampProperty});
//       // data.fields = attributes;
//      //  debugger;
//        //this.setFields(data.fields)
//      // var mymodel = Ext.ModelManager.getModel(data.$className);
     //   debugger;
       // Ext.appy(this);
//        //this.superclass.superclass.$onExtended.apply(this, arguments);
    },

    getCatalog: function(className) {
        var catalog;
        Ext.Ajax.request({
            async: false,
            url: 'http://127.0.0.1:8081/cors/$catalog/' + className,
            success: function(response) {
                catalog = Ext.decode(response.responseText);
            }
        });
        return catalog;
    }

});

Custom proxy
Ext.define('Wakanda.Proxy', {

    extend: 'Ext.data.proxy.Rest',

   // alternateClassName: 'SimplyFundraising.data.WakandaProxy',

    alias : 'proxy.wakanda',

    sortParam: '$orderby',

    filterParam: '$filter',

    startParam: '$skip',

    limitParam: '$top',

  //  groupersParam: '$group',

    reader: 'wakanda',

    writer: 'wakanda',

    actionMethods: {
        create : 'POST',
        read   : 'GET',
        update : 'POST',
        destroy: 'POST'
    },

    buildUrl: function(request) {
        debugger;
        var modelName = this.model.modelName,
            operation = request.operation,
            records = operation.records || [],
            record = records[0],
            id = record ? record.getId() : operation.id,
            url = '/cors/' + modelName,
            action  = request.action;

        if (this.appendId && id && (action === 'read' || action === 'destroy')) {
            url += '(' + id + ')';
        }

        request.url = url;

        // console.log("buildUrl", this, arguments, request.url);

        if (action !== 'read') {
            if (action === 'create') action = 'update';
            else if (action === 'destroy') action = 'delete';
            url = Ext.urlAppend(url, '$method=' + action);
        }

        if (this.noCache) {
            url = Ext.urlAppend(url, Ext.String.format("{0}={1}", this.cacheString, Ext.Date.now()));
        }

        return url;
    },

    encodeSorters: function(sorters) {
        var min = [],
            length = sorters.length,
            i = 0, sort = '';

        for (; i < length; i++) {
            sort += sorters[i].property + ' ' + sorters[i].direction + ' ';
        }

        return sort;
    },

    encodeFilters: function(filters) {
        var min = [],
            length = filters.length,
            i = 0, filter = '';

        for (; i < length; i++) {
            filter += filters[i].property + ' eq ' + filters[i].value + '@ ';
        }
        return filter;
    }

});

Custom reader
Ext.define('Wakanda.reader', {

    extend: 'Ext.data.reader.Json',

    //alternateClassName: 'SimplyFundraising.data.WakandaReader',

    alias : 'reader.wakanda',

    root: '__ENTITIES',

    totalProperty: '__COUNT',

    getData: function(data) {
        if (Ext.isObject(data) && !data[this.root]) {
            data = [data];
        }
        return data;
    }

});

Custom writer
Ext.define('Wakanda.writer', {

    extend: 'Ext.data.writer.Json',

   // alternateClassName: 'SimplyFundraising.data.WakandaWriter',

    alias: 'writer.wakanda',

    writeAllFields: false,

    getRecordData: function(record) {
        var isPhantom = record.phantom === true,
            writeAll = this.writeAllFields || isPhantom,
            nameProperty = this.nameProperty,
            fields = record.fields,
            data = {},
            changes,
            name,
            field,
            key;

        if (writeAll) {
            // console.log("getRecordData1", this, arguments);
            fields.each(function(field){
                if (field.persist) {
                    name = field[nameProperty] || field.name;
                    data[name] = record.get(field.name);
                } else {

                }
            });
        } else {
            changes = record.getChanges();
            // console.log("getRecordData2", this, arguments, changes);
            for (key in changes) {
                if (changes.hasOwnProperty(key)) {
                    field = fields.get(key);
                    name = field[nameProperty] || field.name;
                    data[name] = changes[key];
                }
            }
            if (!isPhantom) {
                data[record.idProperty] = record.getId();
                data[record.stampProperty] = record.get(record.stampProperty);
            }
        }
        return {'__ENTITIES': [data]};
    }

});

Contacts Model
Ext.define('SimplyFundraising.model.Contact', {
    extend : 'Wakanda.Model' ,
    //constructor: function() {
        //alert("Going to call parent's overriden constructor…");
     //   this.callParent(arguments);
       // return this;
   // }
});

Contacts Store
Ext.define('SimplyFundraising.store.Contacts', {
    extend : 'Ext.data.Store',
    model : 'SimplyFundraising.model.Contact',
    autoLoad : true,
    autoSync : true,
   // constructor: function() {
           // this.model = Ext.create('SimplyFundraising.model.Contact')

            //alert("Going to call parent's overriden constructor…");
       // this.callParent(arguments);
        return this;
   // }
});

Contacts Controller
Ext.define('SimplyFundraising.controller.Contacts', {
    extend : 'Ext.app.Controller',
    models : ['Contact'],

    views : ['contacts.List', 'contacts.Edit'],
    init : function() {
        this.control({
            'contactslist' : {
                itemdblclick : this.editContact,
                removeitem : this.removeContact
            },
            'contactslist > toolbar > button[action=create]' : {
                click : this.onCreateContact
            },
            // 'contactsadd button[action=save]': {
            // click: this.doCreateContact
            // },
            'contactsedit button[action=save]' : {
                click : this.updateContact
            }
        });
    },
    list : function() {
       // var mystore = Ext.StoreMgr.lookup('Contacts');
     //   var myContact = this.getModel('Contact')
     //   var User = this.getModel('User');

        //debugger;
      //  var mystore =  Ext.create('SimplyFundraising.store.Contacts')

      //  var myContact = this.getModel('Contact').create()
    //   var bb =  myContact.create()

       // var rr = Ext.create('SimplyFundraising.model.Contact')
        var mystore =  Ext.create('SimplyFundraising.store.Contacts')
        debugger;
          //  mystore.proxy.api.read = users.proxy.api.read + '(17)'
        //mystore.proxy.extraParams = { $expand: 'ContactType'};
        mystore.load();
      //var test = Ext.ModelManager.getModel('Contact');

      // //var User = this.getContactModel();
      // User.load(258, {
    // success: function(user) {
        // console.log("Loaded user 258: " + user.get('lastName'));
    // }
// });
    },
    editContact : function(grid, record) {
        var view = Ext.widget('contactsedit');
        view.down('form').loadRecord(record);
        this.addnew = false
    },
    removeContact : function(Contact) {
        Ext.Msg.confirm('Remove Contact ' + Contact.data.lastName, 'Are you sure?', function(button) {
            if (button == 'yes') {
                this.getContactsStore().remove(Contact);
            }
        }, this);
    },
    onCreateContact : function() {
        var view = Ext.widget('contactsedit');
        this.addnew = true
    },
    // doCreateContact: function (button) {
    // var win = button.up('window'),
    // form = win.down('form'),
    // values = form.getValues(),
    // store = this.getContactsStore();
    // if (form.getForm().isValid()) {
    // store.add(values);
    // win.close();
    // }
    // },
    updateContact : function(button) {
        var win = button.up('window'), form = win.down('form'), record = form.getRecord(), values = form.getValues(), store = this.getContactsStore();
        if (form.getForm().isValid()) {
            if (this.addnew == true) {
                store.add(values);
            } else {
                record.set(values);
            }
            win.close();
        }
    }
});

A: I got this working now:
It looks like my custom wakanda model,proxy,reader,writer where not loading.  Still a bit confused on how MVC references classes and loads files and instantiates classes, which I asked in other question.
Any way the fix was to add a requires to the custom wakanda model and proxy
For the Wakanda model add requires: ['Wakanda.proxy'],
For Wakanda proxy add requires: ['Wakanda.reader', 'Wakanda.writer'],
now the inheritance is working as expected.


text:
Q: Filter out the rows which contain the duplicate value only in the previous row I am using Python with pandas library. I have a dataframe df. I need to write a function to filter out duplicates, that is to say, to remove the rows which contain the same value as a row above
example :
df = pd.DataFrame({'A': {0: 1, 1: 2, 2: 2, 3: 3, 4: 4, 5: 5, 6: 5, 7: 5, 8: 6, 9: 7, 10: 7}, 'B': {0: 'a', 1: 'b', 2: 'c', 3: 'd', 4: 'e', 5: 'f', 6: 'g', 7: 'h', 8: 'i', 9: 'j', 10: 'k'}})

I wrote the code below.
total_len = len(df.index)
for i in range(total_len):
        if df['A'].loc[i] == df['A'].loc[i+1]:
            df['A'].drop(df['A'].index[i+1])
        else:
            df['A']

what am I doing wrong?

A: You can do it without the loop
df = df[ # filter df with a boolean array
    df.A.ne(df.A.shift()) # find out if elements are different from the row above
]

A: The issue with your code is that the range of this df is 0-10 (11 rows). But, when you use df['A'].loc[i+1] then when i = 10, it searches for the i+1 row to compare it with, which doesn't exist. Hence the KeyError 11
total_len = len(df.index)
for i in range(total_len):
        if df['A'].loc[i] == df['A'].loc[i+1]:
            df['A'].drop(df['A'].index[i+1])
        else:
            df['A']

#ERROR
KeyError: 11

Instead, a better way to solve this would be to simply iterate starting from the second row, comparing the one before, to get a list of flags True and False. Then you can use that to filter the df -
dup = [True]

total_len = len(df.index)
for i in range(1, total_len):
    if df.iloc[i]['A'] == df.iloc[i-1]['A']:
        dup.append(False)
    else:
        dup.append(True)

print(df[dup])

   A  B
0  1  a
1  2  b
3  3  d
4  4  e
5  5  f
8  6  i
9  7  j


text:
Q: Migrating an Application from SQL to NoSQL I am faced with taking a mvce's for SQL which happens to be the WideWorldImporters Database from Microsoft and migrating it to a NoSQL on mongodb.
The system in question may use certain fractions of the SQLDB lesser than the others, but certainly no clear approach has been formulated except that, we understand, denormalization, constructing views based on how the information is being consumed, central and paramount to our new application on NoSQL.
In this regard, we find it hard to determine from which angle to tackle this mammoth beast of a task in front of us and I am a key member in the taskforce.
Any advice on approach to be taken is kindly solicited. All that we have now is we plan on 25% views on the tables and re-use the view creation logic to form mongoose discriminators.

A:
I am faced with taking a mvce's for SQL which happens to be the WideWorldImporters Database from Microsoft and migrating it to a NoSQL on mongodb.

Question: Why?
You have a perfectly reasonable database running on a pretty solid DBMS.
Why do you feel the need to port this to a NoSQL solution?

... no clear approach has been formulated ...

What is the end result that you're trying to achieve?
If it's just to "build something in NoSQL" then porting from a relational DBMS will not give you a "Good" result (and will, therefore, discourage you and/or your Management from [ever] trying to repeat the exercise when, for another purpose, you may be looking at massive benefits).
Choose your battles.  Consider NoSQL for a project where it will give you [the most] benefit.

A: Having made the switch from SQL Server to ElasticSearch I can provide some insight as to what you can expect.  We chose ElasticSearch because we needed something with better (more efficient) faceted search capabilities than we had with SQL Server.  One of the killer features was the ability to get the counts of documents that matched our unselected facets within the subset of data we were already searching.  That and the full text search capabilities were easier to work with.
That said, we had to do the following:

*

*Split the data into documents we needed to search against (i.e. teachings, devotionals, books, events, etc.)

*Write our own tool to perform an ETL (Extract, Transform, Load)

*Write the complex transform logic that also cleaned up formatting sins from over a decade of maintenance

The first step is your planning step.  This is where you design what you put in your document.  If you have a hierarchical document that you want to search separately, you have to figure out how much summary information you want to keep in the parent document.
We opted for a reference object that had enough summary information that we did not have to do a second query to get the child objects when we displayed info on screen.  You may decide that doesn't work for your project.  There's trade-offs, particularly since updates have to be done in multiple locations.  In my situation, there are very few updates.
I highly recommend taking the opportunity to clean up your data.
The ETL process I chose worked well for backup from SQL:

*

*Create your Model objects, most document database APIs serialize them as JSON or BSON

*Perform your Extract/Transform to those model objects

*Serialize the model objects to a BSON file (using the Avro format)

The Restore was a simple upload of the model data to the document database

*

*Serialize model objects from BSON file

*Write them as is to your Document Database

The Backup was a simple download of the model data from the document database

*

*Read the records from the Document Database

*Serialize the model objects to the BSON file

At this point you can back up from the SQL Server and restore to the document database, as well as have a means of backing up and restoring data with the document database as well.


text:
Q: How to use in laravel 5.4 local scope in a relation call? I use in my project laravel 5.4 and have 2 models, first model is Group and second model ist Ticket.
In model Group I have following relation:
public function tickets() {
 return $this->hasMany('App\Models\Ticket', 'group_id');
}

In table tickets (model Ticket) I have a bool field called "open", and the local scope:
public function scopeOpen($query) {
   return $query->where('open', 1);
}

How can I filter now by using this relation like: $group->tickets->open, do I have

A: You can define a relation as such:
public function ticketsOpen()
{
   return $this->tickets()->open();
}

and then use it as follows:
$group->ticketsOpen;

A: A few ways you can do this.
Add this relation to the Group model
public function openTickets()
{
    return $this->tickets()->open();
}

Access the open tickets like so
$group->openTickets

Or filter the tickets when fetching the results.
$group = Group::with(['tickets' => function ($query) {
    $query->open();
}])->get();

Accessed tickets will have the open scope applied.
$group->tickets

A: try this :
Group::with('tickets')->open()->get();


text:
Q: "System" process suddenly using CPU a lot In win2k3sp2, I've never seen this before and have not installed anything recently, but seemingly out of nowhere, the System process (not the idle process) is taking a lot of CPU whenever anything else is.  That is, sitting idle, it's at 0.  If I go and start a program like Thunderbird, while loading, thunderbird.exe and System will be competing for CPU usage, sometimes with System getting more than 50% (it's a dual-core system).  I look at the total CPU time column, and System ranks sixth, just below SQL Server!  This has never been the case before.
1) This is bad, right?
2) What's causing it?
I thought it might be the RAID, but that's a separate process, and the config util isn't reporting anything wrong.
I'm tempted to reset the server, but it's in production, so I'd rather not at the moment unless I'm sure it will do more good than harm.  Also, I don't feel like it's "due for a reset," since it's only had thirteen days' uptime.

A: Download and run Process Explorer. When you launch it you should see quite a bit of information, but what you should look at are two processes just under the System Idle Process node.
You should see one called Interrupts and DPCs. If those are spiking along with the System process, the problem is being caused by drivers. Generally you'll see this caused by things like the hard drive running in PIO mode (for direct attached storage using the ATA interface) or network cards that are offloading their work to the CPU.
If you only see the System process node taking up the CPU you know that it's Windows taking up the resources and not a faulty driver/hardware.
Keep in mind that this won't tell you exactly what's happening but it'll give you a place to start looking.

A: One thing I'd be tempted to try are the tools in sysinternals like procmon and filemon and regmon. These might give a hint whether something in particular is being continually hit and by what particular process. Wouldn't hurt to try it.


text:
Q: Problem in code for Monte Carlo method for frustrated Ising model I'm studying Monte Carlo method (it's related to my school project). The code I'm using I got from a paper by Jacques Kotze (https://arxiv.org/abs/0803.0217). In his paper, he uses the Monte Carlo method for a non-frustrated Ising model. I've tried using his code (unchanged), and I can reproduce all the results of the paper (specific heat, magnetization, susceptibility, Binder cumulant). He has an error in the definition of the cumulant, that I fixed.
Now, when I try to use the same code, but for the frustrated Ising model, I am getting bad results. I'll try to explain as best as I can what I'm doing.
The frustrated Ising model is a model with a Hamiltonian $H=J_1\sum_{i,j}S_{i}S_{j}+J_2\sum_{i,j}S_{i}S_{j}$ (sometimes we use $p=\frac{J_2}{J_1}$). Now if I want to add the second part of the Hamiltonian in my code (that is, the code provided by Kotze), I tried changing the part of the code where energy is being calculated:
I changed the energy part from:
//energy for specific position
e =-1* lat[pos.x][pos.y] *
(lat[left][pos.y] + lat[right][pos.y] + lat[pos.x][up] + lat[pos.x][down]);

This can be seen in picture:

I tried changing this energy to:
e =1 * lat[pos.x][pos.y] *
    (lat[left][pos.y] + lat[right][pos.y] + lat[pos.x][up] + lat[pos.x][down])+
    0.1*lat[pos.x][pos.y]*(lat[left][down]+lat[left][up]+lat[right][down]+lat[right][up]);

This can be seen in picture:

1 and 0.1 represent $J_1$ and p respectively. I understood this part of the code to be: calculate energy using nearest neighbors and next nearest neighbors. lat[pos.x][pos.y] represents a point on a square lattice and up, down, left and right are defined with periodic boundary condition (in the code it's defined above the part with energy e=1*.....). I imagend it to be like:

I think that I'm making a mistake here, that is, I did not write next nearest neigbors properly. If I use this code now (with added next nearest neighbors) and for lattice size LxL where L=8 I get for specific heat

If I compare this specific heat with specific heat in paper by A K Murtazaev, M K Ramazanov and F A Kassan-Ogly (https://iopscience.iop.org/article/10.1088/1742-6596/510/1/012026) where they got

My specific heat has the right shape, has peak at approximately the same critical temperature but my values for specific heat are huge. If I were to use bigger lattice size the values for specific heat will get even bigger. Clearly, I'm making a mistake somewhere. Another mistake that I'm getting is that my values for specific heat for different temperatures are literaly the same for p=0.2,p=0.3,p=0.4. I get the same graph, peak at the same place, it's like I did not change p's.
I know that there are better Monte Carlo methods for frustrated models, but I need to do it with this MC method (that is, with this code).
Can someone spot where I'm making a mistake. It's been a long time since I did anything in C++, so maybe I'm missing something obvious.
I hope I explained properly my problem.
Thank you!!
I don't know if I need to, but I will add code by Kotze here:
#include <iostream>

#include <math.h>

#include <stdlib.h>

#include <fstream>
 //random number generator from "Numerical Recipes in C" (Ran1.c)
#include <random>
 //file to output data into

using namespace std;

// ran1 random number generator

#define IA 16807
#define IM 2147483647
#define AM (1.0 / IM)
#define IQ 127773
#define IR 2836
#define NTAB 32
#define NDIV (1 + (IM - 1) / NTAB)
#define EPS 1.2e-7
#define RNMX (1.0 - EPS)

float ran1(long * idum) {
  int j;
  long k;
  static long iy = 0;
  static long iv[NTAB];
  float temp;

  if ( * idum <= 0 || !iy) {
    if (-( * idum) < 1) * idum = 1;
    else *idum = -( * idum);
    for (j = NTAB + 7; j >= 0; j--) {
      k = ( * idum) / IQ;
      * idum = IA * ( * idum - k * IQ) - IR * k;
      if ( * idum < 0) * idum += IM;
      if (j < NTAB) iv[j] = * idum;
    }
    iy = iv[0];
  }
  k = ( * idum) / IQ;
  * idum = IA * ( * idum - k * IQ) - IR * k;
  if ( * idum < 0) * idum += IM;
  j = iy / NDIV;
  iy = iv[j];
  iv[j] = * idum;
  if ((temp = AM * iy) > RNMX) return RNMX;
  else return temp;
}

//structure for a 2d lattice with coordinates x and y

struct lat_type {
  int x;
  int y;
};
const int size = 8; //lattice size
const int lsize = size - 1; //array size for lattice
const int n = size * size; //number of spin points on lattice
float T = 5.0; //starting point for temperature
const float minT = 0.5; //minimum temperature
float change = 0.1; //size of steps for temperature loop
int lat[size + 1][size + 1]; //2d lattice for spins
long unsigned int mcs = 10000; //number of Monte Carlo steps
int transient = 1000; //number of transient steps
double norm = (1.0 / float(mcs * n)); //normalization for averaging
long int seed = 436675; //seed for random number generator
//function for random initialization of lattice
initialize(int lat[size + 1][size + 1]) {
  for (int y = size; y >= 1; y--) {
    for (int x = 1; x <= size; x++) {
      if (ran1( & seed) >= 0.5)
        lat[x][y] = 1;
      else
        lat[x][y] = -1;
    }
  }

  for (int i = 0; i <= size; i++) {
    for (int j = 0; j <= size; j++) {
      cout<<lat[i][j]<< " ";
    }
    cout<<endl;
  }
}
//output of lattice configuration to the screen
output(int lat[size + 1][size + 1]) {
  for (int y = size; y >= 1; y--) {
    for (int x = 1; x <= size; x++) {
      if (lat[x][y] < 0)
        cout << " − ";
      else
        cout << " + ";
    }
    cout << endl;
  }
}
//function for choosing random position on lattice
choose_random_pos_lat(lat_type & pos) {
  pos.x = (int) ceil(ran1( & seed) * (size));
  pos.y = (int) ceil(ran1( & seed) * (size));
  if (pos.x > size || pos.y > size) {
    cout << "error in array size allocation for random position on lattice!";
    exit;
  }
}
//function for calculating energy at a particular position on lattice
int energy_pos(lat_type & pos) {
  //periodic boundary conditions
  int up, down, left, right, e;
  if (pos.y == size)
    up = 1;
  else
    up = pos.y + 1;
  if (pos.y == 1)
    down = size;
  else
    down = pos.y - 1;

  if (pos.x == 1)
    left = size;
  else
    left = pos.x - 1;
  if (pos.x == size)
    right = 1;
  else
    right = pos.x + 1;
  //energy for specific position
  e =1 * lat[pos.x][pos.y] *
    (lat[left][pos.y] + lat[right][pos.y] + lat[pos.x][up] + lat[pos.x][down])+
    0.1*lat[pos.x][pos.y]*(lat[left][down]+lat[left][up]+lat[right][down]+lat[right][up]);
  return e;
}
//function for testing the validity of flipping a spin at a selected position
bool test_flip(lat_type pos, int & de) {
  de = -2 * energy_pos(pos); //change in energy for specific spin
  if (de < 0)
    return true; //flip due to lower energy
  else if (ran1( & seed) < exp(-de / T))
    return true; //flip due to heat bath
  else
    return false; //no flip
}
//flip spin at given position
flip(lat_type pos) {
  lat[pos.x][pos.y] = -lat[pos.x][pos.y];
}
//function for disregarding transient results
transient_results() {
  lat_type pos;
  int de = 0;
  for (int a = 1; a <= transient; a++) {
    for (int b = 1; b <= n; b++) {
      choose_random_pos_lat(pos);
      if (test_flip(pos, de)) {
        flip(pos);
      }
    }
  }
}
//function for calculating total magnetization of lattice
int total_magnetization() {
  int m = 0;
  for (int y = size; y >= 1; y--) {
    for (int x = 1; x <= size; x++) {
      m += lat[x][y];
    }
  }
  return m;
}

//function for calculating total energy of lattice
int total_energy() {
  lat_type pos;
  int e = 0;
  for (int y = size; y >= 1; y--) {
    pos.y = y;
    for (int x = 1; x <= size; x++) {
      pos.x = x;
      e += energy_pos(pos);
    }
  }
  return e;
}
//main program
int main() {

    ofstream DATA1("Mavg.dat",ios::out);
    ofstream DATA2("Mabsavg.dat",ios::out);
    ofstream DATA3("Msqavg.dat",ios::out);
    ofstream DATA4("X.dat",ios::out);
    ofstream DATA5("X'.dat",ios::out);
    ofstream DATA6("Eavg.dat",ios::out);
    ofstream DATA7("Esqavg.dat",ios::out);
    ofstream DATA8("C.dat",ios::out);
    ofstream DATA9("U.dat",ios::out);
    ofstream DATA10("Mqavg.dat",ios::out);

  //declaring variables to be used in calculating the observables
  double E = 0, Esq = 0, Esq_avg = 0, E_avg = 0, etot = 0, etotsq = 0;
  double M = 0, Msq = 0, Msq_avg = 0, M_avg = 0, mtot = 0, mtotsq = 0;
  double Mabs = 0, Mabs_avg = 0, Mq_avg = 0, mabstot = 0, mqtot = 0;
  int de = 0;
  lat_type pos;
  //initialize lattice to random configuration
  initialize(lat);
  //Temperature loop
  for (; T >= minT; T = T - change) {
    //transient function
    transient_results();
    //observables adopt equilibrated lattice configurations values
    M = total_magnetization();
    Mabs = abs(total_magnetization());
    E = total_energy();
    //initialize summation variables at each temperature step
    etot = 0;
    etotsq = 0;
    mtot = 0;
    mtotsq = 0;
    mabstot = 0;
    mqtot = 0;
    //Monte Carlo loop
    for (int a = 1; a <= mcs; a++) {
      //Metropolis loop
      for (int b = 1; b <= n; b++) {
        choose_random_pos_lat(pos);
        if (test_flip(pos, de)) {
          flip(pos);
          //adjust observables
          E += 2 * de;
          M += 2 * lat[pos.x][pos.y];
          Mabs += abs(lat[pos.x][pos.y]);
        }
      }
      //keep summation of observables
      etot += E / 2.0; //so as not to count the energy for each spin twice
      etotsq += E / 2.0 * E / 2.0;
      mtot += M;
      mtotsq += M * M;
      mqtot += M * M * M * M;
      mabstot += (sqrt(M * M));
    }
    //average observables
    E_avg = etot * norm;
    Esq_avg = etotsq * norm;
    M_avg = mtot * norm;
    Msq_avg = mtotsq * norm;
    Mabs_avg = mabstot * norm;
    Mq_avg = mqtot * norm;
    //output data to file
    DATA1<< T << "\t " << M_avg<<endl;

    DATA2 << T << "\t"<< Mabs_avg<<endl;

    DATA3<<T<<"\t" << Msq_avg << endl; //<M>;<|M|>;<M^2> per spin

    DATA4<<T<<"\t" << (Msq_avg - (M_avg * M_avg * n)) / (T) <<endl; //susceptibility per spin (X)

    DATA5<<T<<"\t" << (Msq_avg - (Mabs_avg * Mabs_avg * n)) / (T) <<endl; //susceptibility per spin (X')

    DATA6<<T<<"\t" << E_avg <<endl; //<E>;<E^2> per spin

    DATA7<<T<<"\t" << Esq_avg <<endl; //<E>;<E^2> per spin

    DATA8<<T<<"\t" << (Esq_avg - (E_avg * E_avg * n)) / (T * T) <<endl; //heat capacity (C) per spin

    DATA9<<T<<"\t" << 1 - ((Mq_avg/(n*n*n)) / (3 * (Msq_avg * Msq_avg/(n*n)))) << endl;

    DATA10<<T<<"\t" << Mq_avg << endl;

  }
  return 0;
}

A: The Hamiltonian seems reasonable to me, and I did not find significant errors in the variables defined in the code you post (there may still be, but so far I did not find any).
However, there are other quite common mistakes in your Monte-Carlo simulation:

*

*Thermalization Steps

The starting configuration of your simulation is randomly generated. Therefore, before you start to samples configurations, you need to perform thermalization steps to ensure the configurations you sample are thermalized at $T$.

*Autocorrelation Lengths

In Monte-Carlo simulation, you have to make sure the sampled configurations $\sigma_i$'s are uncorrelated with respect to the observable you want to measure. Take the energy as example. We want
$${1 \over m-1}\sum_{i=1}^{m-1}{E(\sigma_i)E(\sigma_{i+1})}-\bigg({1 \over m}\sum_{i=1}^{m}{E(\sigma_i)}\bigg)^2 \sim 0$$
To do this, you have to first measure the autocorrelation length of the observable. Let us assume it is $l$, and when sampling configurations, we can only take $\sigma_i$ every $al$ updates where $a$ is sufficiently larger than $1$ (in practice some may just average the Markov chain of the length $mal$). This concept is critical particularly when the sampling is near the phase transition. And the local update usually has much larger autocorrelation lengths than the global updates although it is much harder to construct some efficient global updates method.
I am not sure whether these are the problems which lead to strangely large heat capacity. My suggestion is you can print everything out and look for anomalies which can lead to this phenomenon.
I have also written the code myself according to the principles I have mentioned about Monte-Carlo simulation, and the results are good to me. These are the graphs for $L=8$ and $(J_1,J_2)=(1,0.4)$ and $(J_1,J_2)=(1,0.1)$. The plots agree with the literature you gave in terms of the location of the peaks and the confined values of heat capacities.


text:
Q: How come spatial objects can't be used in a VALUES statement? How come you can do,
SELECT *
FROM (VALUES
  ('foo')  -- or (1), etc.
) AS t(x);

But, not
SELECT *
FROM ( VALUES
  ( geography::Point(0,0,4326) )
) AS t(geog);

I was trying to answer this question, but had to create a temp table instead.

A: What result are you expecting? It seems to work OK for me:

SELECT *
FROM (VALUES
  ('foo')  -- or (1), etc.
) AS t(x);
GO

| x   |
| :-- |
| foo |

SELECT *
FROM ( VALUES
  ( geography::Point(0,0,4326) )
) AS t(geog);
GO

| geog        |
| :---------- |
| POINT (0 0) |

dbfiddle here


text:
Q: CSS same height blocks I have a jsfiddle here - http://jsfiddle.net/ktmzk3jk/
I'd like to make the red background on the blocks the same height.
I'm sure I could do it with Jquery but is there a standard CSS soultion.

65%

Some Text Some Text

20%

Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text

5%

Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text

A: Try like this DEMO
CSS:
.row-full-height {
  height: 100%;
}
.col-full-height {
  height: 100%;
  vertical-align: middle;
}
.row-same-height {
  display: table;
  width: 100%;
  /* fix overflow */
  table-layout: fixed;
}
.col-xs-height {
  display: table-cell;
  float: none !important;
}

HTML:

...

A: You shouldn't style  that inner
 , in fact you shouldn't even have it there;
directly style the .col selector,
here you have  a fiddle.

A: For equal size red blocks, you need to update value of height in .block, set height to height:150px instead of height:100% if you know the maximum height. Otherwise also include overflow:auto; so that a scroll appears if text goes beyond the boundary
Updated JS Fiddle: http://jsfiddle.net/ktmzk3jk/8/

A: Adding a min-height to would be the best approach but I would recommend a jQuery approach. Especially if the content changes to different lengths often.


text:
Q: What does the C++ error message "" mean? When compiling my code with the GNU C++ compiler I get something like
bla.cxx: In function `int main(int, const char**)':
bla.cxx:110: error: no matching function for call to `func(const classA*&, const classB<classC>*&) const'
someheader.h:321: note: candidates are: bool func(const classA*, const T*&, const std::string&, std::string&) [with T = classB<classC>] <near match>

What does <near match> indicate and how do I fix this error?
(I simplified the error message as much as possible without (hopefully) removing necessary information. Actually, I'd rather not put an explicit example here, but encourage general replies to the question!)

A: It is part of the overload resolution process.
The compiler lists all the overloads that were considered in this overload resolution so that you can check that the one you actually wanted to call is actually present (if not, you missed a header inclusion, a qualification etc...)
<near match> indicates that this is (according to the compiler) the possible overload you actually wanted to invoke since it is the best overload according to the criteria (const-ness, possible conversions, ...)
In other words, it is an indication that among all the overload considered, you probably wanted to call this and should check that your arguments actually match the signature.

A: I normally see <near match> when a possible method matches except for const. Maybe the strings are optional arguments in this case? In that case the problem is that you have a const object, and are trying to call a non-const method.
NB: I haven't ever looked at the compiler code, merely looked at error messages gcc has generated.
EDIT:
From your comment, the strings at the end are optional, so aren't the problem. Assuming that is the method you want to call, then the problem is that you have a const pointer/reference to the object, and are trying to call a non-const method. To fix this, either:

*

*Make the method const, if it doesn't modify the visible state of the object

*Or pass around a non-const reference/pointer

If neither of those options is at all possible, and as a last resort and you can't change either of these things you can const_cast the pointer/reference, but then you are leaving a very bad smell in the code.
We do have a few places that do const_casts in our code, but only when calls old C functions, that take a non-const pointer but don't modify it. In straight C++ code that you control you can avoid const_cast.

A: It means, most likely, that there's a mismatch between types at the calling site and at the function declaration. In particular, it means you've probably got one "const" too many or too few on one side or the other. The error message gave you the line numbers of the mismatched declaration/call.


text:
Q: getAssociatedProducts - override function but numeric field ordering alphabetically I am extending  Mage_Catalog_Model_Product_Type_Grouped  with a function similar to  getAssociatedProducts()  called
getAssociatedProductsWithSort($product = null,$sortField="name",$direction="ASC")
so to order the simple products under a grouped product.  The difference is this:
<?php
public function getAssociatedProductsWithSort($product = null,$sortField="name",$direction="ASC",$defaultSort="capacity_grams",$defaultDirection="ASC"){

        $associatedProducts = array();

        if (!Mage::app()->getStore()->isAdmin()) {
            $this->setSaleableStatus($product);
        }

        $collection = $this->getAssociatedProductCollection($product)
            ->addAttributeToSelect('*')
            ->addFilterByRequiredOptions()
            //->setPositionOrder()
            ->addStoreFilter($this->getStoreFilter($product))
            ->addAttributeToFilter('status', array('in' => $this->getStatusFilters($product)))
            ->addAttributeToSort($sortField,$direction)
            ->addAttributeToSort($defaultSort,$defaultDirection)
            ;

        foreach ($collection as $item) {
            $associatedProducts[] = $item;
        }

        $this->getProduct($product)->setData($this->_keyAssociatedProducts, $associatedProducts);

    return $this->getProduct($product)->getData($this->_keyAssociatedProducts);

} //end-o-func
?>

However, the problem is that the values in my chosen field (Created via the admin) are numbers but the ordering is happening alphabetically:  e.g.
1,10,2,3,4,5,6,7,8,9
Can I force addAttributeToSort() to do it numerically?  I have tinkered with using a CAST in the call but to no avail.  I have also tried doing but this didn't work either.
<?php
    $collection->reset("order")
        ->getSelect()->order(new Zend_Db_Expr("CAST( ".$sortField." AS SIGNED ) ".$direction))
                ;
?>

A: Having looked through the error logs I noticed that the attribute was not coming through in the select statement.  To resolve this "Used for Sorting in Product Listing" needed to be set to "Yes".
Also there is an error in the collection->reset code above.  The final function code is this:
<?php
public function getAssociatedProductsWithSort($product = null,$sortField="name",$direction="ASC",$numericField=false){

        $associatedProducts = array();

        if (!Mage::app()->getStore()->isAdmin()) {
            $this->setSaleableStatus($product);
        }

        $collection = $this->getAssociatedProductCollection($product)
            ->addAttributeToSelect('*')
             ->addAttributeToSelect($sortField)
            ->addFilterByRequiredOptions()
            //->setPositionOrder()
            ->addStoreFilter($this->getStoreFilter($product))
            ->addAttributeToFilter('status', array('in' => $this->getStatusFilters($product)))
            ->addAttributeToSort($sortField,$direction) //this sorts numbers alphabetically
            ;
       if($numericField){ //force number sort
            $collection->getSelect()->reset("order");
            $collection->getSelect()->order("CAST(`".$sortField."` AS SIGNED) ".$direction);
        }

        foreach ($collection as $item) {
            $associatedProducts[] = $item;
        }

        $this->getProduct($product)->setData($this->_keyAssociatedProducts, $associatedProducts);

    return $this->getProduct($product)->getData($this->_keyAssociatedProducts);

} //end-o-func

?>


text:
Q: Input type=file with Angular doesn't recognize when a file has been selected. The REQUIRED attribute stays all.
Whenever you select a file with input type=file...see below and then the plunker link:
  <form name="myForm">
  Enter your name:
  <input type="text"
     name="myName"
     ng-model="name"
     ng-minlength="5"
     ng-maxlength="20"
     required />

  <input type="file"
    name="myFile"
    ng-model="myFile"
    required />

myForm.myName.$error = {{ myForm.$error | json }}

You need to select a file

You did not enter a field

Your field is too short

Your field is too long

  </form>

Here's my Plunker:  http://plnkr.co/edit/K5LgAXCHLKl4yQ3m6zAs?p=preview
using Angular, and the required attribute doesn't go away and Angular still sees the field as REQUIRED and NOT filled.
Please help....  What am I missing here?
UPDATE:  Yes, this question has been asked before but what I'm running into is this:
When I'm testing with the vald-file directive in the "duplicate" question you posted, everything is fine when I select a FILE the "FIRST" time.  BUT, when I select a "different" type of file, or another file of the same type, like another RTF, the directive is NEVER FIRED!  Meaning, the form remains invalid, the input field DOES NOT clear out and the directive is in LIMBO!!!
I have to physically refresh the page, every time, and start over. This is very frustrating since this "supposed" solution DOES NOT work in real world testing.
So, hence, this is NOT a duplicate and DOES NOT solve my problem. NOTE: I am not yelling when I use CAPS. That is for EMPHASIS to get your attention to the fact that this duplicate is not working.
???? Why does the directive NOT fire every time even when I want to select another file or the same file "again". Yes, I'm a QA testing guru and I will test every conceivable possible thing the USER can and will do and BREAK the code.
UPDATE: 2 -
Sure enough, I went to the plunker example and it DOES NOT WORK.
The example I tried was this:

<input id="userUpload" ng-model="filename" valid-file name="userUpload" required type="file" **accept=".rtf"** />
<button ng-disabled="myForm.$invalid" type="submit" class="btn btn-primary"> Ok</button>

  Input is valid: {{myForm.userUpload.$valid}}

Selected file: {{filename}}

Notice the accept=".rtf" I also tried accept="application/rtf" and when I selected a file OTHER than RTF, I get "VALID FILE ACCEPTED". REALLY?
Why is that?
Here's the result of that selection:
Input is valid: true
Selected file: C:\fakepath\Quick Start.odt
So, please explain to me, how this VALID-FILE directive REALLY works when I insert an INVALID file, hmm?
Here's the PLUNKER I used for the test which was listed above as the so-called solution:
http://plnkr.co/edit/3TZCMUb9XXPGP5ifHf6x?p=preview


text:
Q: How to disable/enable checkboxes in dynamic table based on dropdown selection I have a html table that I am dynamically generating from a JSON file. This table contains rows with a dropdown list and a checkbox. If the default value in the dropdown list is selected the checkbox should be disabled otherwise it should be enabled. I believe the following code should do what I want.
$(function() {
$('td select').change(function () {
$(this).closest('tr').find('input[type="checkbox"]').prop('disabled', $( 'select option:selected' ).val()=='Default');
}).change();});

However, when I run it in my code only the first row of the table demonstrates the functionality I'm looking for. Because the table is dynamically generated from a JSON I don't believe a loop is an option. Similar questions have been asked here but they won't work for dynamically generated tables. The fiddle attached below is similar to what I am trying to implement and it seems as though my logic is the same. If anyone could point me in the right direction I would be grateful.
http://jsfiddle.net/3RRLP/2/

A: if the element doesn't exist in the DOM yet when the handler is attached, you can try:
 $(function() {
    $('body').on('change', 'td select', function() {
        console.log(this.id);
        $(this).closest('tr').find('input[type="checkbox"]').prop('disabled', $('select option:selected').val() == 'Default');
    }).change();
});


text:
Q: getting value from a class that instantiated current class I am really sorry if this is s dumb question and I'm having a brain fart, this just seems like something I should know.  If I have a structure similar to below, is there some way to get $fooVar in Class bar. Do I need to find some way to pass $fooVar as a parameter or is there some inheritance there that I can take advantage of? I'd like to avoid passing it as a parameter if at all possible. Class bar extends another class and if I passed t as a parameter I'd have to do some extra work.
Thanks so much for your help.
Class foo{
    $fooVar;
    $bar = new bar()
}//end foo{}
Class bar extends AnotherClass{
    echo $foo->fooVar;
}//end bar{}

A: First of all I want to say, I just know a bit about php but I think this problem can be adapted to any other OOP based language. So I tried to put some code for you up. Their are 4 different approaches I am aware of. (I want to consider that I didn't test the below code snippets.)

*

*
Declare a get-Function
in your superclass to access the value of $fooVar. This has the positiv effect to access the value from any other class which can call the get-function.
Like this:
    Class foo{
      private $fooVar;

      function __construct() {
        $bar = new bar();
      }

      function getFooVar() {
        return $fooVar;
      }
    }
    Class bar extends foo{
      function __construct() {
        private $foo = parent::getFooVar(); //init $foo on instantiation by get-function
      }
    }

2.
Declare $fooVar as protected
the make $fooVar only accessible by their subclasses.
    Class foo{
      protected $fooVar;

      function __construct() {
        $bar = new bar();
      }
    }
    Class bar extends foo{
      function __construct() {
        private $foo = parent::$fooVar; //init $foo on instantiation by parent
      }
    }

3. Add $fooVar as parameter
to your subclass constructor. (I am fully aware of that this is not what you want, but I state it here as another solution and for clarification.)
    Class foo{
      protected $fooVar;

      function __construct() {
        $bar = new bar($fooVar);
      }
    }
    Class bar extends foo{
      function __construct($var) {
        private $foo = $var; //init $foo on instantiation with parameter
      }
    }

4.
Make $fooVar global.
(another solution but not recommanded.)
I think you are going well with the get function. From the last two cases I would advice especially against the last one.
I really hope this is what you are looking for and it helps alot.


text:
Q: prove that an integer a is odd if and only if it can be written as a sum of two consecutive integers Can someone please revise my proof.
(->)
Let $a$ and $x$ be arbitrary integers.
Assume $a$ is odd so there exists an integer $k$ s.t $a = 2k + 1$.
$a = 2k + 1 = k + k + 1= k + (k+1)$ , evidently $a$ is the sum of two consecutive integers.
(<-)
Let $a$ be the sum of two consecutive integers.
$a = x + (x+ 1) = 2x + 1$. by def. of odd, $a$ must be odd.

A: It's logically fine, but stylistically, it doesn't look nice to define the term $x$ in your first direction, and then not use it until your second direction, and then use two different uses of $a$ among both directions.
If you want to redefine the terms within each direction, that's fine, they are separate proofs. If you want to define the terms once and refer to them within each direction, that's OK too, but don't do a mixture of both.
Furthermore, x is not really arbitrary, in that it is dependent on $a$. I would write "suppose that $a$ is the sum of two consecutive integers. Then there exists an integer $x$ such that $a = x + (x + 1)$


text:
Q: Using QGIS with R I'm using QGIS 3.0.1 on Windows 10 64 bit.
I'm using R-3.4.4.
I'm interested to call R within QGIS and vice versa.
Is it possible? If not alternative.

A: You can call R scripts using the processing toolbox but you have to activate R in your preferences before accessing this functionnality.
(Processing/Options/Providers/R Scripts/Activate in QGIS 2.18, i don't know for QGIS 3.0.1)


text:
Q: How to show Android ListView item in new layout with click I am working on app in which i want to show some quotes and sayings in a list view and also want to Display each Quote in new layout File when user clicks on list item.This my code for Main Activity with simple listview:-
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

/**
 * Created by Tauseef on 11/11/2015.
 */
public class MainActivity extends AppCompatActivity {

    private String[] loveArray = {
            "Jo Pyar Hamesha Sath Rahe Wo Sacha Hai Ji,\n" +
            "Jo Musibaton Mein Kaam Aaye Wo Acha Hai Ji,\n" +
            "Kabhi Kabhi Humse Bhi Ho Jati Hai Nadaniya,\n" +
            "Kyonki Dil To Baccha Hai Ji.", "Chor to sakta hu,\n" +
            "Magar Chor nahipate use,\n" +
            "Wo shaks meri bigri huyi,\n" +
            "Aadat ki trha hai.",

            "Ek shaam aati hai tumhari yaad lekar,\n" +
            "Ek shaam jaati hai tumhari yaad dekar,\n" +
            "Par hume intezaar hai us shaam ka,\n" +
            "Jo aaye sirf tumhe saath lekar"
};

    private ListView loveListView;
    private ArrayAdapter arrayAdapter;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_love);

        Intent intent = getIntent();

        loveListView = (ListView) findViewById(R.id.loveList);

        // this-The current activity context.
        // Second param is the resource Id for list layout row item
        // Third param is input array
        arrayAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, loveArray);
        loveListView.setAdapter(arrayAdapter);

        loveListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

                Intent newIntent = new Intent(LoveActivity.this, MainContent.class);
                newIntent.putExtra("loveArray", position);
                startActivity(newIntent);
            }
        });
    }
}

and here is the new activity having only textview in which i want to show the clicked list item as textView:-
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;

/**
 * Created by Tauseef on 11/11/2015.
 */
public class MainContent extends AppCompatActivity {

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

        TextView textView =(TextView)findViewById(R.id.mainContentTextView);
        Intent intent = getIntent();
        String data = "";
        if(intent!= null){
            Bundle extras = intent.getExtras();
            if(extras != null){
                data = extras.getString("loveArray");
            }
        }
            }
}

Each time when i run this app and tap on list item it's show null pointer excetion and some thing else. i didn't get what kind of error actually coming in this code.

A: Your loveArray should have more than one items. So when you start activity by clicking listview it should take array of position so change
newIntent.putExtra("loveArray", position);

to
newIntent.putExtra("loveArray", loveArray[position]);

so it takes data of perticular array of position

A: Bundle extras = intent.getExtras();
            if(extras != null){
                data = extras.getInt("loveArray");
            }

And use getInt("loveArray") instead of getString()
Bçoz you pass position i.e int
Intent newIntent = new Intent(LoveActivity.this, MainContent.class);
newIntent.putExtra("loveArray", position);//Int not string

Edit: Use below if you pass the quote message instead of position.
Intent newIntent = new Intent(LoveActivity.this, MainContent.class);
newIntent.putExtra("loveArray", loveArray [position]);// Pass the quote as string

Then
data = extras.getString("loveArray");will work

A: The problem is from your MainActivity activity you are passing a integer(position) value and from the MainContent activity you are receiving a string value . You need to write
data = extras.getInt("loveArray");

inkstand of
data = extras.getString("loveArray");

A: Follow the following steps
Instead of passing position only, just pass the String by doing
Intent intent = new Intent(LoveActivity.this, MainContent.class);
intent.putExtra("loveArray", loveArray[position]);// this will pass the string of this position`

Then in MainContent Activity, do
data= extras.getString("loveArray");
It must work`


text:
Q: Explode a line of text to multiple variables and an array I am trying to explode a line of texts in php. Such that, a line consists of
"[name]","[status]","[gender]","[date_of_birth]","[age]","[testing_date]","[answer_for_Test_V_nos._1_to_168]","[SAI_Raw_Score]","[RPM_Raw_Score]","[English_Raw_Score]","[Math_Test_I_Raw_Score]","[Math_Test_II_Raw_Score]","[Total_Score]"
The bold(which is 169 data all in all) is the one I'm trying to store in an array.
Here is the sample line:
"DELACRUZ JUAN H","F","M","101887","18","030105","3","0","1","2","3","3","0","2","1","0","2","1","1","3","3","3","1","2","3","3","2","1","1","2","1","2","1","3","1","0","1","3","0","2","1","0","1","3","1","1","1","1","0","2","1","1","1","2","0","3","0","3","3","1","0","2","3","3","0","2","0","2","0","0","1","2","3","3","1","2","1","3","2","2","0","3","2","2","1","1","0","0","2","3","2","0","0","2","3","3","0","1","0","3","0","1","1","3","2","0","3","1","1","0","1","2","1","0","1","3","2","0","3","0","2","2","2","2","1","1","0","3","3","3","2","3","2","1","2","3","2","1","2","0","0","1","1","2","0","0","2","3","1","2","2","3","3","1","0","0","0","0","3","2","2","1","1","3","1","1","0","2","0","2","2","1","3","2","060","055","083","015","042","0255"

Here is the code for exploding but the array here doesn't work:
list($name, $status, $gender, $bday, $age, $date, $answers[169], $SAI, $RPM, $english, $math1, $math2, $total) = explode(",", $line);

Please help, how can I explode these 169 values to each index of an array using "list() = explode()"? Or is there another way other than using list() = explode()?

A: Just extract the values you require using array_splice.
$line = '"DELACRUZ JUAN H","F","M","101887","18","030105","3","0","1","2","3","3","0","2","1","0","2","1","1","3","3","3","1","2","3","3","2","1","1","2","1","2","1","3","1","0","1","3","0","2","1","0","1","3","1","1","1","1","0","2","1","1","1","2","0","3","0","3","3","1","0","2","3","3","0","2","0","2","0","0","1","2","3","3","1","2","1","3","2","2","0","3","2","2","1","1","0","0","2","3","2","0","0","2","3","3","0","1","0","3","0","1","1","3","2","0","3","1","1","0","1","2","1","0","1","3","2","0","3","0","2","2","2","2","1","1","0","3","3","3","2","3","2","1","2","3","2","1","2","0","0","1","1","2","0","0","2","3","1","2","2","3","3","1","0","0","0","0","3","2","2","1","1","3","1","1","0","2","0","2","2","1","3","2","060","055","083","015","042","0255"';
$splitArray =  explode(",", $line);
$testAnswers = array_splice($splitArray, 6, 168); //Extract the values that you need. Leave the rest as they are.
list($name, $status, $gender, $bday, $age, $date, $SAI, $RPM, $english, $math1, $math2, $total) = $splitArray; //Put the remaining into the variables as required
var_dump($testAnswers); //All the answers
var_dump($name); //The name


text:
Q: How to create Siri shortcut for Animojis I want a Siri shortcut to open the Messages app showing the thread with myself.
So I have to use the Open App action, and open Messages. But is it possible to pass variables to the action so that Messages is opening the correct thread? I tried passing my contact to the App, text with my name and telephone number, but it didn't work.

A: It is not possible to pass variables to an App opened by Siri.
Since there is no predefined action available that opens a specific thread in the Messages App, it is not possible to create a shortcut that fits your request.


text:
Q: Am I forced to create my own Error type? I want to write a get_members function that returns members from a GitHub team.
pub fn get_members(group_id: &str) -> Result<Vec<User>, Error> {
    let client = Client::new();
    let query = format!("https://api.github.com/teams/{}/members?access_token={}",
                    group_id,
                    config::get_env(config::ENV_TOKEN));

    println!("{}", query);

    let mut res = try!(client
                    .get(&query)
                    .header(UserAgent("my/app".to_owned()))
                    .send());

    let mut body = String::new();
    try!(res.read_to_string(&mut body));
    try!(json::decode(&body));
}

There are two different types of errors into play. One is hyper::error::Error and the other is rustc_serialize::json::DecoderError.
I thought I could just use implement From<::hyper::error::Error> for Error and From<rustc_serialize::json::DecoderError>. But since neither io::Error nor one of the other two errors is in my crate I'm not allowed to follow that approach.
I wonder what's the way to go here. Do I need to come up with my own AppError Type and then implement the From<> trait for that? Is that the way to go?

A: Usually yes, using your own error type is the way to go. There are even several crates (of which I was able to find only this one now) which help you to remove the boilerplate. This approach should also be used when you're writing a library, as opposed to an application.
There is an option, however, of using Box<Error> trait object as your error type. Lots of error types in Rust and in third-party libraries implement this trait; therefore, using Result<..., Box<Error>> as a return type should work almost always.


text:
Q: SSL access to a js recently deployed APP on Heroku My Heroku node.js deployed APP on Sept7 suddently (as of from Sept 14th 00:00hrs on) doesn't work and instead I get a
SSL_ERROR_RX_RECORD_TOO_LONG
error message.
What has changed?
How can it be fixed?
Thanks in advance.
Regards

A: Check if you are really using the port 443 (https) instead of port 80 (http).


text:
Q: Lstlistoflistings empty even though .lol file contains content I am finally asking my own question here, since I really cannot find an answer to my problem after 5 days of searching the web:
For some reason my \lstlistoflistings command does not produce any output in the pdf. The .lol file does have contenc though.
Here is my minimal working example:
\documentclass[parskip=half,fontsize=11.5pt,a4wide,bibliography=totocnumbered,listof=totocnumbered]{scrartcl}
\usepackage{listings}
\usepackage[usenames,dvipsnames,table,xcdraw]{xcolor}

\definecolor{mGreen}{rgb}{0,0.6,0}
\definecolor{mGray}{rgb}{0.5,0.5,0.5}
\definecolor{mPurple}{rgb}{0.58,0,0.82}
\definecolor{backgroundColour}{rgb}{0.95,0.95,0.92}

\begin{document}

\lstdefinestyle{CStyle}{
    backgroundcolor=\color{backgroundColour},
    commentstyle=\color{mGreen},
    keywordstyle=\color{magenta},
    numberstyle=\tiny\color{mGray},
    stringstyle=\color{mPurple},
    basicstyle=\footnotesize,
    breakatwhitespace=false,
    breaklines=true,
    captionpos=b,
    keepspaces=true,
    numbers=left,
    numbersep=5pt,
    showspaces=false,
    showstringspaces=false,
    showtabs=false,
    tabsize=2,
    language=C,

\vspace{1em}
\begin{lstlisting}[caption=Java-GUI Automatisierung Pseudocode, language=C, escapeinside={(*}{*)}, style=CStyle]
...
\end{lstlisting}
\vspace{1em}

\vspace{1em}
\begin{lstlisting}[caption={Java-\ac{GUI}: Speicher Aufräumen Pseudocode},label=cleanpseudo, language=C, escapeinside={(*}{*)}, style=CStyle]
...
\end{lstlisting}
\vspace{1em}

\vspace{1em}
\begin{lstlisting}[caption={Java-\ac{GUI}: Speicher aktuelle Simulation abbrechen Pseudocode},label=cancelpseudo, language=C, escapeinside={(*}{*)}, style=CStyle]
modbusConnect()
modbusWriteCancelCommand()
modbusDisconnect()
\end{lstlisting}
\vspace{1em}

\vspace{1em}
\begin{lstlisting}[caption={Java-\ac{GUI}: Speicher aktuelle Logdatei herunterladen Pseudocode},label=latestpseudo, language=C, escapeinside={(*}{*)}, style=CStyle]
...
\end{lstlisting}
\vspace{1em}

\pagebreak
\rhead{LISTINGS}
\lstlistoflistings

This produces the following .lol file:
\contentsline {lstlisting}{\numberline {1}Java-GUI Automatisierung Pseudocode}{29}{lstlisting.1}%
\contentsline {lstlisting}{\numberline {2}Java-GUI Speicher Aufräumen Pseudocode}{30}{lstlisting.2}%
\contentsline {lstlisting}{\numberline {3}Java-GUI Speicher aktuelle Simulation abbrechen Pseudocode}{30}{lstlisting.3}%
\contentsline {lstlisting}{\numberline {4}Java-GUI Speicher aktuelle Logdatei herunterladen Pseudocode}{30}{lstlisting.4}%

My Listings page is empty though:

Thank you in advance!
Update:
I have created a new Overleaf project and in this one it works for me as well. I have noticed a difference in the .lol files, maybe this is the cause?
My original lol file in my main project ends with {lstlisting.x} while the new one looks like this:
\contentsline {lstlisting}{\numberline {2}Java-GUI: Speicher Aufräumen Pseudocode}{1}{}%
\contentsline {lstlisting}{\numberline {3}Java-GUI: Speicher aktuelle Simulation abbrechen Pseudocode}{1}{}%
\contentsline {lstlisting}{\numberline {4}Java-GUI: Speicher aktuelle Logdatei herunterladen Pseudocode}{1}{}%```


text:
Q: There an elegant way to pass two methods to a callback? In my Uploader for Carrierwave, I have this:
  after :store, :delete_tmp_dir
  after :store, :zencode

I initially tried doing after :store, :delete_tmp_dir, :zencode but that threw an error.
Even though my version is working, is there anyway to call both in 1 line?


text:
Q: Multiple files combined in one static library So I was wondering whether it's possible to have a static library with multiple files in it?  Right now I can use a static library attached to a specific .h and corresponding .cpp in other programs.  But when I try to add addional .h's and .cpps to the static library my other programs that try using them come back with error LNK2019.  Just want to know if its even possible before searching even more.

A:
I was wondering whether it's possible to have a static library with multiple files in it?

Yes. That's the whole point of a library — to be a single redistributable for a set of pre-built object files.


text:
Q: can't install hardly anything...winbind unstable Reading package lists... Done
Building dependency tree
Reading state information... Done
winbind is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/2,511 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
dpkg: error processing winbind (--configure):
 Package is in a very bad inconsistent state - you should
 reinstall it before attempting configuration.
Errors were encountered while processing:
 winbind
E: Sub-process /usr/bin/dpkg returned an error code (1)

This is the general idea anytime I try to do anything with winbind.

A: Try Running:
sudo apt-get --reinstall install winbind

Reference: AptGet manual


text:
Q: SocketIO manual installation for iOS app swift 4 xcode 9 I am having difficulty installing SocketIO for my Swift 4/Xcode 9 app.  I have tried Swift Package Manager and Carthage and both did not work.  Separate threads for those issues.  I do not want to use Cocoapods.
Is there a way to manually install the libraries?  I can drag and drop the Source files successfully however I don't know how to add the SocketIO and Starscream frameworks from the Git downloaded files.  I can figure out how to link the binaries and that stuff myself, just want to know where I can physically extract the two frameworks from in the downloaded file.

A: Did you check in your project folder, the Carthage folder then Build folder then iOS folder and same with the Checkout folder?


text:
Q: Stored proc running 30% slower through Java versus running directly on database I'm using Java 1.6, JTDS 1.2.2 (also just tried 1.2.4 to no avail) and SQL Server 2005 to create a CallableStatement to run a stored procedure (with no parameters).  I am seeing the Java wrapper running the same stored procedure 30% slower than using SQL Server Management Studio.  I've run the MS SQL profiler and there is little difference in I/O between the two processes, so I don't think it's related to query plan caching.
The stored proc takes no arguments and returns no data.  It uses a server-side cursor to calculate the values that are needed to populate a table.
I can't see how the calling a stored proc from Java should add a 30% overhead, surely it's just a pipe to the database that SQL is sent down and then the database executes it....Could the database be giving the Java app a different query plan??
I've posted to both the MSDN forums, and the sourceforge JTDS forums (topic: "stored proc slower in JTDS than direct in DB")  I was wondering if anyone has any suggestions as to why this might be happening?
Thanks in advance,
-James
(N.B. Fear not, I will collate any answers I get in other forums together here once I find the solution)
Java code snippet:
sLogger.info("Preparing call...");
stmt = mCon.prepareCall("SP_WB200_POPULATE_TABLE_limited_rows");
sLogger.info("Call prepared.  Executing procedure...");
stmt.executeQuery();
sLogger.info("Procedure complete.");

I have run sql profiler, and found the following:
Java app :
CPU: 466,514   Reads: 142,478,387  Writes: 284,078   Duration: 983,796
SSMS     :
CPU: 466,973   Reads: 142,440,401   Writes: 280,244   Duration: 769,851
(Both with DBCC DROPCLEANBUFFERS run prior to profiling, and both produce the correct number of rows)
So my conclusion is that they both execute the same reads and writes, it's just that the way they are doing it is different, what do you guys think?
It turns out that the query plans are significantly different for the different clients (the Java client is updating an index during an insert that isn't in the faster SQL client, also, the way it is executing joins is different (nested loops Vs. gather streams, nested loops Vs index scans, argh!)).  Quite why this is, I don't know yet (I'll re-post when I do get to the bottom of it)
Epilogue
I couldn't get this to work properly.  I tried homogenising the connection properties (arithabort, ansi_nulls etc) between the Java and Mgmt studio clients.  It ended up the two different clients had very similar query/execution plans (but still with different actual plan_ids).  I posted a summary of what I found to the MSDN SQL Server forums as I found differing performance not just between a JDBC client and management studio, but also between Microsoft's own command line client, SQLCMD, I also checked some more radical things like network traffic too, or wrapping the stored proc inside another stored proc, just for grins.
I have a feeling the problem lies somewhere in the way the cursor was being executed, and it was somehow giving rise to the Java process being suspended, but why a different client should give rise to this different locking/waiting behaviour when nothing else is running and the same execution plan is in operation is a little beyond my skills (I'm no DBA!).
As a result, I have decided that 4 days is enough of anyone's time to waste on something like this, so I will grudgingly code around it (if I'm honest, the stored procedure needed re-coding to be more incremental instead of re-calculating all data each week anyway), and chalk this one down to experience.  I'll leave the question open, big thanks to everyone who put their hat in the ring, it was all useful, and if anyone comes up with anything further, I'd love to hear some more options...and if anyone finds this post as a result of seeing this behaviour in their own environments, then hopefully there's some pointers here that you can try yourself, and hope fully see further than we did.
I'm ready for my weekend now!
-James

A: You can attach the Profiler and monitor for the events SQL:BatchCompleted and SP:Completed, with a filter on duration > 1000. Run the procedure from your Java client and from SSMS. Compare the Reads and the Writes of the two events (Java vs. SSMS). Are they significantly different? This would indicate considerably different execution paths or plans, with significant difference in I/O.
Also try to capture the Showplan XML event of the two and compare the plans (save the event as a .sqlplan file, open it in SSMS to easy analysis). Do they have similar plans? Are there wild differences in Estimate vs. Actual (rows, rewinds, rebinds)? Do they have same degree of parallelism? The plans can aso be retrieved from sys.dm_exec_requests view.
Are there any warning events raised, like Missing Column Statistics, Sort Warnings, Hash Warning, Execution Warnings, Blocked Process?
the point is that you have at your disposal a whole arsenal of investigation tools. Once you find the root cause of the difference, you can trace it down to what is different between your Java environment settings and the SSMS environment (ADO.Net SqlClient). Things like default transaction isolation level, ANSI settings etc etc.

A: Checking: Is your problem that two applications (SSMS, Java) are making the exact same identical call to SQL Server, and SQL Server is acting differently for each? If so, I hit things like this every year or two, and they hurt my brain for days.
Once, I ultimately isolated each process call and logging everything for the entire process in Profiler. I eventually noticed that the Login event (under TextData) showed a host of information, like so:
-- network protocol: TCP/IP
set quoted_identifier on
set arithabort off
set numeric_roundabort off
set ansi_warnings on
set ansi_padding on
set ansi_nulls on
set concat_null_yields_null on
set cursor_close_on_commit off
set implicit_transactions off
set language us_english
set dateformat mdy
set datefirst 7
set transaction isolation level read committed

The "Existing Connection" event will show this information as well--but, sometimes immediately subsequent calls (batches, RPCs, I disremember just now) are sent [ISQL or OSQL did this, I think] to immediately reset some of these -- Arithabort and Quoted_Identifier seem to be favorites, and other SET options also get modified depending on the settings or requirements of whatever connectivity protocols your application's database interface is using.
Another one: some settings are kept as attributes of a procedure at "create" time, and others are factored in at compile time. On the one hand, your connection's SET values may be being overwritten by the configuration saved at the time the procedure was created; on the other hand, your two connections may differ so much that two execution plans are generated for one procedure. (All of this information is, after sufficient research, available in the sys. tables and DMVs.)
In short, it seems to me that SQL obscurities are messing you up. To this day, I loathe all these goombah settings. Things below my notice keep messing around with them [I mean, really, what fool would set implicit_transaction for a connection pool on? But once they did...] and it's hard to build structures when the ground (rules) keep changing out from underneath you. After all, remember what the guy said about building castles in a swamp...

A: I recall having a similar issue a while ago, because JTDS was silently converting a string parameter to Unicode or something similar. As a result of that conversion, SQL Server was unable to use the index which is was using when we ran the stored proc from SSMS.
HIH

A: Does the Java case include transmission of the results to the Java server (network overhead) plus some Java processing? A 12 minute query might produce quite a large amount of data.

A: If you are looking at the profiler and there is no difference between the executions then the difference must be with the client systems.
4 mins does seem like to long just to prepare a statement to send so the 12 min wait must cause some other effect -- no idea what it is.

A: I am not sure if this post is still relevant. We faced a similar problem in our application.
One key difference between running a stored procedure in SQL Management studio and one running from JDBC is that of transaction context. If you are using an ORM in Java, by default the stored procedure runs in a transaction context. When you run a stored procedure directly in SQL management studio the transaction is off. There is a substantial performance difference.

A: Sorry, I've not found a correct answer to this, so I don't want to allocate any of these as correct, so I am going to mark this answer as correct, and wish anyone luck who comes across anything similar!

A: Did you know that Microsoft ship JDBC drivers for their databases?
These may be more performant.
Obviously.. you may have resolved the problem by now.


text:
Q: create a downloadable csv from a json string Target: write&download a csv file starting with a json string, for example data.csv containing
col1,col2,col3
"324","19-08-2014","13000"
"325","19-08-2014","5010"

What I have done until now:
1) iframe and button to call my conversion function
<iframe id="frame" style="display:none"></iframe>
<form><input type="submit" value="Export CSV" onclick="javascript:Download();"></form>

2) my Download() function which would want to download my csv file
<script type="text/javascript">
    function Download(){
        var csv=ConvertToCSV(<?php echo $json_string ?>);
        var url='data:application/csv,'+csv;
        var _iframe_dl = $('<iframe />')
        .attr('src', url)
        .hide()
        .appendTo('body');
    };
 </script>

3) my json to csv conversion function which tries to create a csv string
<script type="text/javascript">
function ConvertToCSV(json) {
    var array = typeof json != 'object' ? JSON.parse(json) : json;
    var str = '';
    for (var i = 0; i < array.length; i++) {
        var line = '';
        for (var index in array[i]) {
            if (line != '') line += ','
                line += '"'+array[i][index]+'"';
        }
        str += line + "\r\n";
    }
    return str;
}
</script>

Encountered problems :
i) it seems that it doesn't recognize \r\n, infact output is just one line
"324","19-08-2014","13000""325","19-08-2014","5010"

ii) I cannot set the filename and the extension, infact the downloaded file is "download" without extension containing the single line mentioned above

A: First of all, you will need to ensure your data is in this format, like the example below.
var array = [["col1","col2","col3"],["324","19-08-2014","13000"],["324","19-08-2014","13000"]]

then you need to create csv variable as shown below
var csv = "data:text/csv;charset=utf-8,";

after this you need to loop through your data array and append each line to the csv variable you just set.
array.forEach(function(arrayItem, index){

   arrayAsString = arrayItem.join(",");
   csv += index < array.length ? arrayAsString+ "\n" : arrayAsString;

});

now to give this file a name and create a download link you must create a hidden anchor node and set its download attribute.
var encUri = encodeURI(csv);
var link = document.createElement("a");
link.setAttribute("href", encUri);
link.setAttribute("download", "file_name.csv");
//add anchor element to body
document.body.appendChild(link);
link.click();

EDIT:
Tested on Chrome and is working, also on Safari. Does not work on Firefox for some reason which i will take a look at now
I found out that if you add the link into the body of the page only then will Firefox initiate the download, you can use a code like so. I have updated my code above
document.body.appendChild(link);


text:
Q: Unity PC version is totally different from Android I'm creating a racing game with Unity for PC and Android. However, after I have built an apk and played it on Android, many things had changed and it was totally different from PC version. For example, in PC version, when the car goes backward, there will be a message "wrong way" show and the message will disappear when the car falls from the track. But in Android version, the message will still show even the player falls from the track.
Besides, the car turn faster in PC version than in Android. All scripts are the same but only on different platform. What would the problem be? I'm really confused. Any reply would be appreciated.

A: In your questions there are 2 issues
1) Message not disappear after car fall back to original track on android device
  Answer : this is because of missing plugin. Please check all plugins import properly and also check your logs. There might be some error. I faced this type of issue and my issue was because I import ads SDK not in proper way.
2) Speed of the car is different.
 Answer: For resolving this type of issue you have to add device check. Like for turning different code on mobile devices and different on pc.

A: Your second Problem could be caused by not using deltaTime, or you are using it on some parts of your calculations and forgot it when calculating the turn rate.
As your game will run on a different FPS on PC/Android it is important to substract out that difference and make your game frame independend.
Further Reading on DeltaTime: http://answers.unity3d.com/questions/296336/timedeltatime.html


text:
Q: how to compile/run a netbeans project from command line? I have this netbeans project structure:
/my_project
|__/controllers
|   |__/factories
|      |__Factory.java
|   |__/integrator
|      |__Integrator.java
|
|__/models
|   |_Models.java
|
|__/main
    |_Main.java

But, how can I compile/run it from command line?
This post works for me to compile, but not for run it.
There is a way to run it without using tools like Ant?

A: If you do not use any external jar you can easily write an OS script (sh or bat) which calls javac for all those .java files and then (another one which) calls java on the .classfile containg the void main(String[] args) method and sets the classpath.
If you want to use other libraries (provided in jar files) and you want to keep your script the same; you can copy them at this location: JAVA_HOME/lib/ext, where JAVA_HOME is the environment variable pointing to where the JVM (jre) is installed


text:
Q: Fetch primary key generated by sequence using jdbctemplate / jdbc for Hana db We are trying to insert record in hana db so we are currently using jdbc template and key holder to save data and retrieve newly generated column id.This works fine for postgress but not for hana.
query ="SELECT CURRENT_IDENTITY_VALUE() FROM \"HALOSYS\".\"HaloTestDemo\"";
resultSet =  stmt.executeQuery(query);

Above statement gives current identity value but this doesn't fit into our context where we want to use jdbc template.
Please give me idea to fix this.
if we add preparedstatement generated keys i am getting follwing exception
com.sap.db.jdbc.exceptions.jdbc40.SQLFeatureNotSupportedException: Method prepareStatement( String, int )() of Connection is not supported.

A: Try from DUMMY instead of the table name, and do it in the same session as the insert. If you use connection pooling, that will be much harder.

A: Please prepare your query statement to include insert record and select CURRENT_IDENTITY_VALUE() from the same table into one query statement in an anonymous block as below :
DO BEGIN
    INSERT INTO <TABLE_NAME> .....;
    SELECT CURRENT_IDENTITY_VALUE() FROM <TABLE_NAME>;
END;