text:
Q: org.quartz.JobPersistenceException: Couldn't acquire next trigger: Unknown column 'SCHED_TIME' in 'field list' when i am trying to create a simple job scheduler with quartz and persistence as mysql i am getting the following error.
org.quartz.JobPersistenceException: Couldn't acquire next trigger: Unknown column 'SCHED_TIME' in 'field list'
caused by
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'SCHED_TIME' in 'field list'
I checked thoroughly in the database schema provided by quartz official website. But i couldn't able to find any corresponding column.

A: Add the field SCHED_TIME of type NUMBER(28) on the table QRTZ_FIRED_TRIGGERS

A: Its all about Quartz Scheduler version in maven dependency.
For the quartz version 2.2.0 and 2.1.7 there are modifications in the database schema with added fields like SCHED_TIME .
So, use 2.1.7 version of quartz maven dependency or find the proper database schema script for 2.2.0.
Note: I hope the database schema script for mysql provided in the source file of Quartz team is not proper with respect to Quartz 2.2.0 version.

A: Add the field SCHED_TIME on the table QRTZ_FIRED_TRIGGERS
run the sql query -->> alter table QRTZ_FIRED_TRIGGERS add sched_time NUMBER(13);


text:
Q: vectorizing seq R I want to generate a sequence of time stamps in between two dates
So test frame is:
library(dplyr)
library(lubridate)
library(purrr)
library(tibble)

 test <- tibble(category = c('a', 'b', 'a'),
           start=c('2016-01-01 00:00:10',
                   '2016-02-01 00:00:20',
                   '2016-03-01 00:00:30'),
           end = c('2016-01-01 00:01:00',
                   '2016-02-01 00:02:00',
                   '2016-03-01 00:03:00')) %>%
       mutate(start = ymd_hms(start),
              end = ymd_hms(end) )

and I want to run:
seq(start, end, by=10)

for each row and have a sequences in one data frame so result is like:
category | timestamp
   a     | 2016-01-01 00:00:10
   a     | 2016-01-01 00:00:20
   a     | 2016-01-01 00:00:30

for each row and all of it rbind together
I have over 30000 rows so a for loop won't work that well.
I tried to use purrr using:
gg <- test %>%
  purrr::map( seq(start, end, by=10) )

but that doesn't seem to work?

A: We can do this with dplyr alone
library(dplyr)
test %>%
    group_by(category, n = row_number()) %>%
    do(data.frame(Seq = seq(.$start, .$end, by = 10))) %>%
    ungroup() %>%
    select(-n)

Or using map from purrr
test %>%
   split(., seq_len(nrow(test))) %>%
   map_df(~cbind(., Seq = seq(.$start, .$end, by = 10)))

redpajama_set_name: RedPajamaStackExchange


text:
Q: .NET 6 Web API with Bearer Authentication returns 401 when using the [Authorize] Attribute I am currently working on setting up an Duende IdentityServer to secure my web app and API. Originally My API was in the same application as my IdentityServer. I am working on separating the two from each other. Currently My IdentityServer is deployed in Azure. The current design I am working with is

*

*WebApp signs in using IdentityServer (Hosted in Azure)

*WebApp calls API and sends Bearer Token in request (LocalHost)

*API has Bearer authentication to validate against IdentityServer.(LocalHost)

The issue I have is even with a valid Bearer Token, I cannot get the basic [Authorize] attribute to work properly. It constantly returns a 401 - unauthorized.
What I have verified from my own hunting:

*

*I am correctly adding the scope for access to the API to the JWT.

*Made sure my app.UseAuthenticate() came before app.UseAuthorization()

*Enabled CORS to accept all Origins,Methods, and headers.

I am at a total loss, I can not seem to figure out what I have configured wrong. I am using entity framework in my API to develop a database as well. That database context inherits from IdentityDbContext. I do not think this would mess with authentication, as I am not adding Identity in the startup its self.
My IdentityServer does have call .AddDeveloperSigningCredential() when Adding the IdentityServer to the web app. Do I need to have the signed credentials in my API/Webapp?
Here is the Startup for my API.
//Initializing WebApp Adding Razor page support and controller support
var builder = WebApplication.CreateBuilder(args);

builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
  .AddJwtBearer(options =>
  {
    // base-address of your identityserver
    options.Authority = builder.Configuration["identity-server-url"];
    options.Audience = "LMS.API";
    // audience is optional, make sure you read the following paragraphs
    // to understand your options
    options.TokenValidationParameters = new TokenValidationParameters
    {
      RoleClaimType = ClaimsIdentity.DefaultRoleClaimType,
    };

  });

builder.Services.AddCors(confg =>
  confg.AddPolicy("AllowAll",
    p => p.AllowAnyOrigin()
    .AllowAnyMethod()
    .AllowAnyHeader()));

//Add Key Vault to configuration to be used in entire application
var secretClient = new SecretClient(new(builder.Configuration["KeyVault:Endpoint"]), new DefaultAzureCredential());

builder.Configuration.AddAzureKeyVault(secretClient, new KeyVaultSecretManager());
var migrationsAssembly = typeof (Program).Assembly.FullName;

//Grab connection string from key vault
string dbConnectionString = builder.Configuration["db-connection-string"];

// Repository registration

builder.Services.AddScoped<IUserRepository, UserRepository>();
builder.Services.AddScoped<IAssignmentRepository, AssignmentRepository>();
builder.Services.AddScoped<ICourseRepository, CourseRepository>();
builder.Services.AddScoped<ISchoolRepository, SchoolRepository>();

//Auto Generated shit
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

//add support for MediatR
builder.Services.AddMediatR(typeof(CreateAssignmentForCourse).Assembly);

builder.Services.AddMediatR(typeof(Program).Assembly);

//Injecting DB connection string into Master Context class,
builder.Services.AddDbContext<MasterContext>(options =>
{
  options.UseSqlServer(dbConnectionString, sqlServerOptionsAction: sqloptions =>
  {
    sqloptions.EnableRetryOnFailure();
  });
});

builder.Services.AddDatabaseDeveloperPageExceptionFilter();

builder.Services.AddControllers();

//Build webApp
var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
  app.UseSwagger();
  app.UseSwaggerUI();
}

app.UseRouting();

app.UseCors("AllowAll");
app.UseHttpsRedirection();
app.UseAuthentication();
app.UseAuthorization();

app.UseEndpoints(routes =>
{
  routes.MapControllers();
});

app.Run();

A: Sorry for the delayed response. I did figure out the issue here. I was trying to validate the audience to match the API scope I created for my API. However, I manually configured the API scope by manually changing the db tables. So, long story short, the Audience scope in my JWT was null and didn't match, therefore causing a Not Authorized HTTP response.
Hopefully this helps someone in the future!


text:
Q: Positioning rotated element on right side of page JSBin demo here.
How can I position a div rotated 90 degrees on the right edge of the page, centered vertically? Thanks in advance.

A: Try this:
div {
    font-family: sans-serif;
    background: red;
    -webkit-transform: rotate(270deg);
    -webkit-transform-origin: bottom left;
    position: absolute;
    width:200px;
    height:20px;
    top:50%;
    margin-top:-20px; /* height */
    right:-200px; /* width */
}

A:     div{
vertical-align:middle;
    float:right;
    /* FF Chrome Opera etc */
    -webkit-transform: rotate(90deg);
    -moz-transform: rotate(90deg);
    -o-transform: rotate(90deg);
    /* IE */
    filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
    }

Check this, may help you a bit.


text:
Q: How can I define the product of two ideals categorically? Given a commutative ring $R$, there is a category whose objects are epimorphisms surjective ring homomorphisms $R \to S$ and whose morphisms are commutative triangles making two such epimorphisms surjections compatible, and the skeleton of this category is a partial order that can be identified with the lattice of ideals of $R$.  Now, I have always been under the impression that anything one can say about ideals one can phrase in this purely arrow-theoretic language: most importantly, the intersection of ideals is the product in this category and the sum of ideals is the coproduct.  (Since we're working in a partial order, product and coproduct are fancy ways to say supremum and infimum.  The direction of the implied ordering on ideals may differ here from the one you're used to, but that's not important.)
However, Harry's made some comments recently that made me realize I don't know how to define the product of two ideals purely in terms of this category, that is, via a universal construction like the above.  It would be really surprising to me if this were not possible, so maybe I'm missing something obvious.  Does anyone know how to do this?

A: Nice question!  The answer is that it's not possible!  Let $R=\mathbb{F}_3[x,y]/(x^2,y^2)$.  The lattice of ideals consists of the eight ideals
$(1)$
$(x,y)$
$(x)$ $(y)$ $(x+y)$ $(x-y)$
$(xy)$
$(0)$,
in which each ideal contains all ideals at lower levels.  In the middle level, some of the ideals have square zero, and some don't, but you can't tell which ones just from looking at the (unlabeled) lattice.

A: Bjorn's answer shows that the product of two ideals cannot be defined by means of the partially ordered set of ideals. However, there is a category-theoretic definition of the product of two ideals if we allow us to use the category of modules. This works because of the Rosenberg reconstruction Theorem.
Explicitely, there is a bijection between ideals of $R$ and reflective, topologizing subcategories of $\text{Mod}(R)$, which is given by $I \to \{M \in \text{Mod}(R) : I M = 0\}$. If $T$ is such a subcategory with reflector $F : \text{Mod}(R) \to T$, then the corresponding ideal is $I=\ker(R \to F(R))$. Now, the multiplication of ideals corresponds to the so called Gabriel product: If $S,T$ are subcategories of an abelian category, then $S \bullet T$ is the subcategory which consists of those objects $M$ for which there is an exact sequence $0 \to M' \to M \to M'' \to 0$ with $M' \in T, M'' \in S$. The idea for the notation is $(S \bullet T)/T = S$.


text:
Q: SQLAlchemy Falcon Class error I am trying to set up an API using Falcon and SQLAlchemy using a postgresql database. Using gunicorn to start the API
I am getting the following error when trying to access /v1/users.
I tried to browse the SQLAlchemy documentation but could not find any working solution.
Thanks
[2017-03-15 10:20:26 +0100] [20516] [ERROR] Error handling request /v1/users
    Traceback (most recent call last):
      File "/Users/juliencourtes/Documents/projects/FalconAPI/venv/lib/python3.6/site-packages/gunicorn/workers/sync.py", line 135, in handle
        self.handle_request(listener, req, client, addr)
      File "/Users/juliencourtes/Documents/projects/FalconAPI/venv/lib/python3.6/site-packages/gunicorn/workers/sync.py", line 176, in handle_request
        respiter = self.wsgi(environ, resp.start_response)
      File "/Users/juliencourtes/Documents/projects/FalconAPI/venv/lib/python3.6/site-packages/falcon/api.py", line 209, in __call__
        responder(req, resp, **params)
      File "/Users/juliencourtes/Documents/projects/FalconAPI/app/api/v1/users.py", line 50, in on_get
        users = session.query(User).all()
      File "/Users/juliencourtes/Documents/projects/FalconAPI/venv/lib/python3.6/site-packages/sqlalchemy/orm/scoping.py", line 157, in do
        return getattr(self.registry(), name)(*args, **kwargs)
      File "/Users/juliencourtes/Documents/projects/FalconAPI/venv/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 1330, in query
        return self._query_cls(entities, self, **kwargs)
      File "/Users/juliencourtes/Documents/projects/FalconAPI/venv/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 139, in __init__
        self._set_entities(entities)
      File "/Users/juliencourtes/Documents/projects/FalconAPI/venv/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 148, in _set_entities
        entity_wrapper(self, ent)
      File "/Users/juliencourtes/Documents/projects/FalconAPI/venv/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 3947, in __init__
        "expected - got '%r'" % (column, )
    sqlalchemy.exc.InvalidRequestError: SQL expression, column, or mapped entity expected - got '<function User at 0x1040216a8>'

My projects files
main.py
import falcon
from app.api.v1 import users
from app.middleware import DatabaseSessionManager
from app.database import db_session, init_session
from app.api.common import base

class App(falcon.API):

    def __init__(self,*args, **kwargs):
        super(App, self).__init__(*args, **kwargs)
        self.add_route('/',base.BaseResource())
        self.add_route('/v1/users',users.Collection())

init_session()
mdlw = [DatabaseSessionManager(db_session)]
application = App(middleware=mdlw)

session.py
import sqlalchemy.orm.scoping as scoping
from sqlalchemy.exc import SQLAlchemyError

from app import config

class DatabaseSessionManager(object):
    def __init__(self, db_session):
        self._session_factory = db_session
        self._scoped = isinstance(db_session, scoping.ScopedSession)

    def process_request(self, req, res, resource=None):
        req.context['session'] = self._session_factory

    def process_response(self, req, res, resource=None):
        session = req.context['session']

        if config.DB_AUTOCOMMIT:
            try:
                session.commit()
            except SQLAlchemyError as ex:
                session.rollback()

        if self._scoped:
            session.remove()
        else:
            session.close()

database init.py
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, scoped_session
import psycopg2
from app import config

db_session = scoped_session(sessionmaker())
engine = create_engine('postgresql+psycopg2://xxxxx@localhost/falcon_api')

def init_session():
    db_session.configure(bind=engine)

user.py
from sqlalchemy import Column
from sqlalchemy import String, Integer,Text
from sqlalchemy.dialects.postgresql import UUID, JSONB
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()

def User(Base):
    __tablename__ = 'user'

    id = Column('id', UUID, primary_key=True)
    firstname = Column('firstname', String)
    lastname = Column('lastname', String)

    #It tells python how to print the class, used for debugging
    def __repr__(self):
        return "<User(id='%s', name='%s', lastname='%s')>"% \
            (self.id, self.firstname, self.lastname)

    def __init__(self, id , firstname, lastname):
        self.id = id
        self.firstname = firstname
        self.lastname = lastname

api/v1/users.py
import falcon
import json
from sqlalchemy.ext.declarative import declarative_base
try:
    from collections import OrderedDict
except ImportError:
    OrderedDict = dict
from app.models import User
class Collection():
    """
    Handle for endpoint: /v1/users
    """

    def to_json(self, body_dict):
        return json.dumps(body_dict)

    def on_error(self, resp, error=None):
        resp.status = error['status']
        meta = OrderedDict()
        meta['code'] = error['code']
        meta['message'] = error['message']

        obj = OrderedDict()
        obj['meta'] = meta
        resp.body = self.to_json(obj)

    def on_success(self, resp, data=None):
        resp.status = falcon.HTTP_200
        meta = OrderedDict()
        meta['code'] = 200
        meta['message'] = 'OK'

        obj = OrderedDict()
        obj['meta'] = meta
        obj['data'] = data
        resp.body = self.to_json(obj)

    def on_get(self, req, resp):
        session = req.context['session']

        #Bugging here
        users = session.query(User).all()

A: I have faced same problem..It got fixed in my case for the following changes..
instead session.remove() use the following code.
if self._scoped:
     self._session_factory.remove()

This will work.

A: We create models for SQL in python using Class which inherits built in class from ORM like SQLAlchemy. Here you are trying to create User model. But as it need to be a class to work properly instead you declared it as a function in user.py.
All you have to do to make it work is just change def User to class User.
So user.py will look something like:
...
class User(Base):
    __tablename__ = 'user'
...


text:
Q: State is not showing after changing order status - Woocomerce I have a store "WordPress - Woocommerce" ( i have also another store at the same cPanel and I'm not facing this issue so it is not hosting issue).
when I receive the order, I get all the address entries correctly
The Field "State" is a mandatory field with a dropdown list at the checkout page.
after I receive the order, (from the mobile browser only) if I change the order status to on-hold or any other status, the state gets deleted from the address, see images below.
BEFORE (no issues here):

*

*Address details after receiving an order from Woocommerce Dashboard
click to see the image

*Database entries in Wopa_postmeta for the order before change status
click to see image
AFTER I changed the order status from the mobile (here is the issue):

*

*address details changed and the state got deleted click here to see image

*then here from the database Wopa_postmeta after changing the status
click to see image
as you can see two entries got deleted
_Shipping_State and _billing_state
Please note that this issue is only when I use the dashboard from a mobile browser, but from the computer, I can change the status without any issues.
So anybody has any solutions for this?
I have disabled all plugins and the issue is the same, WP is updated to the latest version.
Thank you


text:
Q: Snakemake tabular config I'm using Snakemake with a tabular configuration. This table is a bunch of rows that I first take out of a very large sample overview. The resulting sample.tsv has a lot of columns. I read the samples file like this, somewhere in my Snakefile:
samples = pd.read_table('samples.tsv').set_index('samples', drop=False)

When I run snakemake:
snakemake --cluster-config cluster.json --cluster "qsub -l nodes={cluster.nodes}:ppn={cluster.ppn}" --jobs 256

I get the following error:

16:51 nlv24077@kiato ~/temp/test_snakemake > run_snakemake.sh
Building DAG of jobs...
MissingInputException in line 6 of /home/nlv24077/temp/test_snakemake/rseqc.smk:
Missing input files for rule bam_stat:
analyzed/I7_index.STAR.genome.sorted.bam

the strange thing is that I7_index is one of the column names in my samples table. Why is it using the column names as sample names?
Below I can show you part of the samples table (I can't show all data publicly):

Edit:
I was calling the samples like this:
rule bcl2fastq:
    input:
        config['bcl_dir']
    output:
        expand([os.path.join(fastq_dir, '{sample}_R1_001.fastq.gz'),
                os.path.join(fastq_dir, '{sample}_R2_001.fastq.gz')],
                sample=samples)
    threads: 6
    shell:
        '''
        # Run bcl2fastq
        ...

Whereas I should have used:
rule bcl2fastq:
    input:
        config['bcl_dir']
    output:
        expand([os.path.join(fastq_dir, '{sample}_R1_001.fastq.gz'),
                os.path.join(fastq_dir, '{sample}_R2_001.fastq.gz')],
                sample=samples['samples'])
    threads: 6
    shell:
        '''
        # Run bcl2fastq
        ...

Thanx JeeYem.


text:
Q: Ascending/descending ordering of Django QuerySet when one attribute is a model method I have a QuerySet of teams ordered by school name. One of the attributes is a model method that keeps track of the team's winning percentage. I want to order the teams from highest winning percentage to lowest. If teams have the same winning percentage, I want them to be ordered alphabetically by school. How do I get something like this:
team  pct
x    0.75
a    0.50
b    0.50
c    0.50
y    0.25

Because the winning percentage is a model method, I've been using Python to sort a QuerySet that is already in alphabetical order, but the alphabetical order of the schools is lost when I do this:
team_list = Team.objects.order_by('school')
sorted_team_list = sorted(team_list, key=lambda x: x.win_pct, reverse=True)

A: Do it in two steps, not bad since sorts are stable:
from operator import attrgetter

sorted_team_list = sorted(team_list, key=attrgetter('school'))
sorted_team_list = sorted(sorted_team_list, key=attrgetter('win_pct'), reverse=True)


text:
Q: Do synonyms have exactly the same meanings as each other in all contexts? I have a question about synonyms:
I'm wondering for quite a while if synonyms always stand exactly for the same thing. Is there sometimes a little difference in meaning?
Let's use clumsy and clunky for example. Can I always replace clunky with clumsy? Since I'm not a native speaker, as you may have noticed, I cannot tell them apart. According to my dictionary, they mean exactly the same. Is it always true?
If the question has already been ask, sorry I couldn't find it.
Edit: Thank you very much! Every answer has helped a lot and thank you so much for it. I really appreciate it. I've voted all your answer because every answer helped me in a different way. I've accepted Barrie England's answer because it was the best one in my case. But all of yours were really good and helpful :)

A: The best way to interpret synonyms is that they are words that are interchangeable in at least some nontrivial contexts. Almost none are 100% equivalent.
Thirty years ago, I led a software team that built one of the first online electronic thesaurus products, based on a Merriam-Webster thesaurus. The Webster editors at the time kept hammering at us that we could not get away with modeling synonyms as words that mean exactly the same thing--not even when we separated them by senses. That is a "word" wasn't just a string like "run"--it was an entry like "run 6" from the 9th New Collegiate dictionary. That means that even when we confined a pair of synonyms to specific dictionary definitions, there would still be differences between them in certain contexts. For example, "He rushed/ran/bolted to the door" all mean about the same thing, but rushed and bolted make implications about motive which ran does not.
In the entire thesaurus project (spanning two years, if I remember correctly), the only pair that we all agreed were completely identical was "flammable" and "inflammable."

A: I believe that while synonyms may be very close in meaning, they often differ subtly in meaning and contextual usage.
Taking your example, I would more likely describe a person or his actions as being clumsy and an inanimate object as being clunky. These descriptions come more from my personal experience than any formal definition. Unfortunately, you may find others who would disagree with my usage.

A: Oxford Dictionaries Online has two definitions for clunky. They are:

solid, heavy and old-fashioned

and

making a clunking sound

These two are clearly quite different from the following definitions of clumsy, from the same dictionary:

awkward in movement or in handling things
done awkwardly or without skill
difficult to handle or use; unwieldy
lacking social skills; tactless

On the broader question of synonyms, even where two words do seem to have more or less identical meanings, they will often be used in different contexts.

A: The late linguist Dwight Bolinger famously wrote in Aspects of Language (1968):

A difference in syntactic form always spells a difference in meaning.

To this day, many linguists take this as a basic assumption about language.  One linguist, Arnold Zwicky, refers to this rule as Bolinger's Dictum, and he presents his own revised (and hedged) version of the rule:

Lexical and syntactic variation is unfree; variants usually have (subtly) different meanings or discourse functions, which can be observed in certain contexts (though these differences might not be of consequence in many contexts).

What about the terms you've chosen to test this rule?  My intuition is that clumsy tends to apply to people, while clunky tends to apply to objects (physical and otherwise).  Is my intuition correct?  There are two ways I can find out:

*

*I can check dictionaries, which are attempts to summarize actual usage.

*I can look directly at usage by searching through corpora such as The Corpus of Contemporary American English (COCA).

Of course, dictionaries give different definitions from one another.  They attempt to describe the usage of a word by dividing it into multiple senses, but the dividing lines between them are often arbitrary, and actual usage often overlaps multiple senses or falls between the cracks.  For this reason, I urge you to cross-reference multiple dictionaries whenever possible, and to look at real examples when you need to get a more specific idea of how words are used.
I looked through results in COCA for both terms and checked several dictionaries using the multi-dictionary search tool OneLook.  The definitions that seemed to fit what I observed best were Collins' definition of clumsy:

*

*lacking in skill or physical coordination

*awkwardly constructed or contrived

And Merriam-Webster's definition of clunky:

*

*large and awkward in form or appearance

*old and not working well

*badly or awkwardly made or done

As you can see, there's some overlap, but they appear to have broadly different meanings.  Here's what I noticed when I looked through results in COCA:

*

*Clumsy is more common (1940 results) than clunky (491 results).

*As I expected, I couldn't find any results where clunky directly described people.  People (and other creatures) are often described as clumsy, though; this is sense one, "lacking in skill or physical coordination".  The word can describe them directly:

A. He was so clumsy and uncoordinated that he couldn't even ride a bicycle.

B. An early pterosaur, Dimorphodon was quite clumsy.  Its big head and four-and-a-half-foot wingspan meant that Dimorphodon had trouble balancing.

Or sometimes parts of the body are described as clumsy:

C. But my fingers were clumsy in my leather mitten, and when I stopped to pull it off, other kids rear-ended me, knocking me sideways.

And it often describes people (or objects) indirectly, by describing the manner in which they move or do things or by describing their actions:

D. And, in my own clumsy manner, I'd answered.

E. Finally, the two bolted, moving with their clumsy attempts at sneakiness out onto the street, and vanished from sight.

F. I hadn't made such a clumsy outburst since high school.

G. Their movements were clumsy.

*Sense two, "awkwardly constructed or contrived", was less common, but more common than I expected.

H. Dah'nok could not deny that the blade looked small and clumsy and poorly constructed, nothing like the great blade that used to hang over the window of his cottage.

I. It has a clumsy upside-down purge bulb.

J. But Henry had left a paper trail which exposed the hollowness of the army's case against Dreyfus. Although Picquart was fired by his military superiors from running the Statistical Section and was eventually jailed for his persistence in trying to reopen the case, Henry's clumsy forgeries were soon uncovered.

*As you can see from examples H-J, physical objects can be described as clumsy, but they were more likely to be described as clunky.  I found examples for all three senses that Merriam-Webster gives, but the examples didn't always fit neatly into one category:

K. The boots weren't too heavy or clunky for the former, nor too light or flexy for the latter.

L. They either don't have the tight grip needed to loosen a stubborn bolt or they're too clunky to turn in the allotted space.

M. People also give off heat signatures, so if a person's heat signature is higher than usual, this could be a clue that they are "wearing something big and clunky under their clothes - you know, wearing a bomb," adds Major Sawyer.

N. Swarm-bots, as they exist today, are fairly large and clunky.

O. Job seekers had long complained that the old system was clunky.

P. The stunted professor sat facing her class in a special armchair mounted on a raised dais that kept her feet in their clunky boots from reaching the floor.

Note how objects can be described as clumsy or clunky, but in H we have small and clumsy, while in K-N we have heavy or clunky, too clunky to turn in the allotted space, big and clunky, and large and clunky. We see that clumsy is more compatible with the "small" meaning, while clunky tends to be more compatible with "large", often "undesirably large".  (Though clumsy certainly doesn't imply "small", as we can see from B.)

*Technology in particular tends to be described as clunky, especially computer programs and user interfaces.  I think the core meaning here is sense 3, "badly or awkwardly made or done", but there seems to be some overlap with the other two senses as well:

Q. The cumbersome keypad was clunky to operate, and we wished we could customize the on-screen data.

R. And although the device might seem a little clunky at first, Boxtel says the exoskeleton feels natural now; she thinks it's the next best thing to being restored to a physically able state.

S. So take that as a lesson when you encounter a new technology: the first incarnations might be clunky, but that's no real indicator of its staying power.

T. A decade ago, the technology was clunky, unreliable and hard to operate, and broadband Internet wasn't widely available, Mattke said.

U. Navigation can be a little clunky - for instance, some prefer e-readers with the more intuitive setup of a button on the left for going back and a button on the right for going forward - and because it's not a touch screen, the menus can be cumbersome.

V. The Web interface feels clunky and is best suited to finding music you already want, not for making new discoveries.

But clumsy is occasionally used in roughly the same way:

W. But OpenOffice faces an uncertain future, and LibreOffice is bogged down by a clumsy, outdated interface and iffy file compatibility.

So there's a bit of overlap, but the two have distinct meanings and patterns of use.

A: I forget who said, "All words are infinitely polysemous," but it's probably also true that 'No words are truly synonymous.' Words will have some senses that largely overlap with those of other words, but not totally overlap. They will usually also have distinctly different senses. And when we get on to connotations, the same word will conjure up different nuances in different people. Probably, no two words are totally interchangeable (ignoring variants like artefact / artifact).
Coincidentally, I said to someone the other day, "I must be careful not to waltz off with the key." I then thought of possible substitutes for waltz in the pretty transparent idiom, and decided that I couldn't immediately think of any that are actually used. (Though apparently, the shuffle is a type of dance.) There are some amusing candidates - tango, foxtrot, conga, jive, passacaglia, slosh....
John Lawler has added:  Language doesn't have any use for two words that are exactly the same; there's always contexts where you use one and not the other for some particular effect.

A: It is a good question, and the answer is that there are often (but not always) subtle differences in meaning.
As a native speaker, I can see a clear difference between 'clumsy' and 'clunky', for example. A person can be 'clumsy', and many are. You would not describe a person as 'clunky' if you wanted to describe someone who was careless or accident-prone. Clunky would usually apply to something like a piece of machinery ('the car was clunky'). Likewise, a piece of machinery would usually not be described as 'clumsy', unless you meant that it was clumsily designed.
In other words, you either need access to a very good dictionary, such as the OED, or learn the differences through experience.

A: Synonyms are the similar words or related words that have nearly or exactly the same meaning.
For e.g . : Synonym of clever is intelligent . So, both have same meaning : Sharp mind.
Synonyms can be used keeping in mind the situation whether it is formal or informal. Context of the word.
Synonyms also vary as per the context where the word is used. For complete details , regarding to different types of synonyms of a single word. Use www.thesaurus.com
Here, in this dictionary, you can get various synonyms for a single word that differ as per length, complexity as well as context where the word is used..


text:
Q: youtube-api, v3, geolocation information Although the youtube-api, v3, allows you to make a request for videos that come from a particular area (for example, by specifying the location and the radius), it appears that the resulting information about the videos does not contain location information.  That is, you can't get the reported lat/long of the video itself.
A query for a specific location would look like this:
https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&key=[key]&location=37,5%2C-120.5&locationRadius=2km&maxResults=5
Here's the description of the information returned.
https://developers.google.com/youtube/v3/docs/search#top_of_page
So, is that correct?  Is there no longer any way to find out the lat/long information of a video that is returned in a query?

A: OK, I figured this out.  The location query will only return the various snippets of information about the videos, that is true.  However, you can then look at individual videos in more depth to find their locations.  For example:
https://www.googleapis.com/youtube/v3/videos?part=recordingDetails&key=[key]&id=HiFnDoUiaqg
will return recording information including:
   "recordingDetails": {
    "location": {
     "latitude": 37.50973,
     "longitude": -120.49805,
     "altitude": 0.0
    },
So it's a 2-step process.  You find the list of videos returned by the location query, and then you look at the detailed information for those videos.


text:
Q: Stuck on "Unpacking papirus-icon-theme" When I did sudo apt update and then sudo apt upgrade, everything went fine except it got stuck on Unpacking papirus-icon-theme (20210101-4888+pkg21~ubuntu20.04.1) over (20201201- 4800+pkg21~ubuntu20.04.1) ... for about 5-10 minutes, so I stopped it and tried it again but it still didn't work.
So then I tried installing an app from terminal but it still wants to update papirus, so I decided to remove it with sudo apt remove papirus-icon-theme, but then it said package is in a very bad inconsistent state; you should reinstall it before attempting a removal, so I tried reinstalling papirus with sudo apt --reinstall install papirus-icon-theme but it wanted to unpack it again.
How do I fix the unpacking problem or even just remove it completely?


text:
Q: Python - Unable to upload file to defined folder in AWS S3 bucket I am trying to upload a csv file from my local to aws s3 bucket. Given below is the code I am using but it doesn't seen to upload the file to the s3 folder defined. Could anyone assist.
import boto3
from botocore.client import Config

ACCESS_KEY_ID = 'accesskeyid'
ACCESS_SECRET_KEY = 'secretkeyid'
BUCKET_NAME = 'bucketname'

data = open('/desktop/file.csv', 'rb')

s3 = boto3.resource(
's3',
aws_access_key_id=ACCESS_KEY_ID,
aws_secret_access_key=ACCESS_SECRET_KEY,
config=Config(signature_version='s3v4')
)
s3.Bucket(BUCKET_NAME).put_object(Key='/sub-folder/sub-folder2/file.csv', Body=data)

print ("Uploaded successfully")

Could anyone help me in finding where I am going wrong. Thanks

A: You need to remove the / from the beginning of the Key argument.
Using your existing code, the file path will be: BUCKET_NAME//sub-folder/sub-folder2/file.csv.


text:
Q: What does the with() method of jMock do? I see with() method being used with assertThat() method in test driven development, but I don't understand what with() does. Could somebody explain with a clear example. I can't seem to find anything on it.
Thank you.

A: It allows you to specify a set of acceptable inputs.  I think it's intended to read like English, for example  "calling add with any integer."
Here's a sample from the cheat sheet linked below:
allowing (calculator).add(with(any(int.class)), with(any(int.class)));

http://jmock.org/cheat-sheet.html


text:
Q: Why heap corruption when returning an object Mat? I don't understand why I get a corrupted heap error with this program (I'm using OpenCV for the class Mat):
class A {
    private:
    Mat image;

    static UINT ThreadProc( LPVOID pParam ) {
        A* pThis= (ClientNetwork*)pParam;
        UINT nRet= pThis->DoThreadProc();     // get out of 'static mode'
        return( nRet );
    }
    UINT ClientNetwork::DoThreadProc() {
         vector<uchar> vect;
         while(1) {
             /**** initialize vect and get the image data to decode ****/

             decode(vect);
         }
    }

    public:
    void decode(const vector<uchar>& vectorData){image=imdecode(vectorData, CV_LOAD_IMAGE_COLOR);}
    Mat get_image(){return image;}
    void start() {m_pcThread= AfxBeginThread(ThreadProc, this );}
}

int main() {
    A* a = new A();
    a->start();
    while(1) {
        Mat image = a->get_image();
    }
    delete a;
    return 0;
}

It seems that the error come from Mat image = a->get_image(); because if I return a reference instead of a copy of the object, I don't have error anymore:
Mat* get_image(){return ℑ}

and
Mat* image = a->get_image();

I read that returning a copy of an object is more elegant in C++ than a reference. So I would like to know what is wrong.
EDIT: Visual studio breaks at a->decode(vect) but it happens only when I return an object and not a reference.
EDIT 2:
I edited the code to reflect the full program. I think the problem comes from the shared object a which is copy and modified at the same time. I will see if the problem still occur using a mutex.

A: You use a without initialising it.
int main() {
    A* a;
    vector<uchar> vect;
    while(1) {
        // get the vector of data
        a->decode(vect);

Welcome to undefined behaviour, population: you.
Initialise a for a better result.

A: Then that is the thread sync problem, as you yourself suggested. The image is being constantly filled in in that infinite while loop. And in the middle of it somewhere you try to make a copy of it. Recipe for disaster. You need to take a write lock inside that loop in DoThreadProc, in each iteration. And then you need to take a read lock inside your get_image. You need to use a read/write lock library that does not starve out readers.
Alternatively you could work with mutexes/critical sections. Both that write loop, and that read (get_image) just get exclusive access to image while they are doing their work.
I am curious though - your thread procedure is decoding things in an infinite loop. What are you trying to do in there? And while reading what image do you expect? Any image at that point of time in loop iteration?

A: The copy constructor of cv::Mat does not create a deep copy of the image. It just creates a reference to the original Mat and increases its reference count.
In the following function of the class, the return statement calls the copy constructor, returning a reference to the original image, which is the probable cause of heap corruption:
Mat get_image(){ return image; }

You should return a deep copy of the image as follows, so that the original image does not get modified accidentally.
Mat get_image(){ return image.clone(); }


text:
Q: How does gcc use ah, bh, ch, dh? I'm writing on a project where I need to read and process assembly instructions output by gcc. I have several questions regarding some rules of compilation:
1) What are the cases gcc uses ah, bh, ch, dh?
2) Will it still use them if I turn off optimizations?
3) Are there some 'rules' by which gcc transforms source code to assembly if I turn off optimizations? I mean, can I know all the possible scenarios how ah can be used by gcc?


text:
Q: std::map: is find(key)->second faster than the [] operator? std::map<long, double> x;
x[5] = 1.2;

double y = x[5];
double z = x.find(5)->second;

Will one of these 2 assignments execute faster than the other? (supposing that the requested key is always present in the map) Is there any overhead associated with the dereferencing of the iterator when doing x.find(5)->second ?
EDIT: Thanks for the replies. In my particular function, now that I know it is not slower, I will probably go with x.find(5)->second as I need to mark my function const (the map is a member variable) and the [] operator obviously does not allow that (as it potentially modifies the map is a key is missing).

A: Took this straight from <map>:
mapped_type& operator[](const key_type& _Keyval)
    {   // find element matching _Keyval or insert with default mapped
    iterator _Where = this->lower_bound(_Keyval);
    if (_Where == this->end()
        || this->comp(_Keyval, this->_Key(_Where._Mynode())))
        _Where = this->insert(_Where,
            value_type(_Keyval, mapped_type()));
    return ((*_Where).second);
    }

iterator find(const key_type& _Keyval)
    {   // find an element in mutable sequence that matches _Keyval
    iterator _Where = lower_bound(_Keyval);
    return (_Where == end()
        || _DEBUG_LT_PRED(this->comp,
            _Keyval, _Key(_Where._Mynode()))
                ? end() : _Where);
    }

It looks about the same. Should there be any difference between:
iterator _Where = this->lower_bound(_Keyval);
return ((*_Where).second);

and
iterator i = x.find(5);
double d = (*i).second;

I wouldn't think so.

A: The first assignment using operator[] will have to perform the same dereference to retrieve the value that is explicit in find()->second. You can profile to be sure but the performance should be close enough that you should use the form that is clearest in your code.

A: This doesn't answer your question, but I would point out some problem with the way you're using find.
double y = x[5];
double z = x.find(5)->second;

I cannot comment on which is faster. But I can surely say that the first approach is safe!
What if the map doesn't contain the given key?
In the first approach, it will create a new pair with the given key, and initialize the value with default value of double (which is zero), and return it.
But the second aproach? find will return map::end if the specified key is not found in the container, and you're dereferencing it. Program crash!
The correct way to use find is:
std::map<long, double>::iterator it;
if ( (it = x.find(key)) != x.end() )
{
    double value = it->second;
}


text:
Q: Why does AMPL not recognize degrees[j] as integer when 'degrees' is a set of integers? Or is there another problem?
It is my first time trying AMPL. I am trying to solve a nonlinear dynamic program. Here are parts of the first draft:
#defining degree
param degree >= 0 integer; # degree of polynomial approximation
param degrees {alpha in  0..degree}; # for storing degrees

...

# defining variables for optimization
var b {alpha in 0..degree}; # coefficient of polynomial

...

# defining constraints
subject to Upper_bound {i in M}: v[i] <=
sum {k in 0..n} (comb[n,k]*(p^k)*((1-p)^(n-k))*((k/n)*((ch[k,i])^d)/(1-d)) +
((n-k)/n)*(cl[k,i]^d)/(1-d)+(1/(1+r))*(sum {j in 0..degree}
(b[j]*cos(degrees[j]*acos((2*Anew[i]-Amax)/(Amax)))))));

I get a syntax error when I pass the mod file:
model DP.mod;

DP.mod, line 41 (offset 1658):
    syntax error
context:   >>> (b[j]*cos(degrees[j]*acos((2*Anew[i]-Amax)/(Amax))))))) <<< ;

Please help.

A: It has been solved, thanks! There was an extra ending bracket.


text:
Q: NPOI and setCellFormula(): decimal-separator is cutoff I've a serious problem copying this formula with NPOI 1.2.5 from one cell to another with C#:
The original cell contain this:
=IF(H21>(H23*0.9997);IF(H21<(H23*1.0003);"OK";"Errore");"Errore")

The resulting cell reports exactly this formula, but with the decimal separator stripped. So I get this:
=IF(H21>(H23*9997);IF(H21<(H23*10003);"OK";"Errore");"Errore")

This is my debugger view right after the setFormula():

Any help would be greatly appreciated.

A: This issue has been identified as a bug form the developer. We can't do much more than paying attention to it and wait for a fixed release.


text:
Q: Mockito : java.lang.ClassCastException: java.lang.Boolean cannot be cast to DataListListener I'm trying to perform an unit test using mockito, but the test failed I 'am getting this :

java.lang.ClassCastException: java.lang.Boolean cannot be cast to
  OnDataListListener

here in this line : mPresenter.getUsers(isLoad, forceUpdate);
The test :
 doAnswer(answerVoid(
        (OnDataListListener<List<User>> myCallback) -> myCallback.onSuccess(mList))).when(
        dataInteractor).getUsers(anyBoolean(), any(DataListener.class));

    mPresenter.getUsers(isLoad, forceUpdate);

Presenter
  @Override public void getUsers(boolean isLoad, boolean update) {
    this.isLoad = isLoad;
    this.forceUpdate = update;
    dataInteractor.performgetUsers(update, this);//this refer to the listener
  }

DataInteractor :
  public void performGetGetUsers(boolean update, OnDataListListener callback) {
    mDataHandler.getUsers(update, new Observer<List<User>>() {
....

The listener interface:
public interface DataListener<T> {
  void onSuccess(T data);

  void onFailure(Throwable e);
}

A: This is so weird, but switching the params solved the issue !
dataInteractor.performgetUsers(update, this);//this refer to the listener

to
dataInteractor.performgetUsers(this, update);//this refer to the listener


text:
Q: AngularJS creating a directive then uses another directive I'm trying to create a directive to cut down on the boilerplate code that I'd have to write.
I'm using the angular xeditable directive to allow for inline editing, but when I add the xeditable directive attributes from my directive, it doesn't work.
When I say it doesn't work, I mean usually when I click on the element there is an input box that appears, and right now nothing happens when I click on the element.
Glenn.directive('edit', function() {
    return {
        restrict: 'A',
        template: '{{ content.' + 'ParamData' + '.data }}',
        scope: {
            ParamData: '@edit'
        },
        link: function(scope, element, attrs) {
            element.attr('editable-text', 'content.' + attrs.edit + '.data');
            element.attr('onbeforesave', 'update($data, content.' + attrs.edit +'.id');
        }
    }
});

So, my first problem is that the xeditable directive doesn't work because it's inside of mine. I'm new to creating angularjs directives, but am wondering if it could have something to do with the way its being compiled?
My second problem is with the template. If my template just looks like this
template: '{{ ParamData }}'

Then it outputs the correct data, but I can't make it work without the other pieces to reference the scope data.
Also, here is what the view looks like using the directive

And here is what it would look like if I didn't use a directive to cut down on the boiler code

     {{ content.portrait_description_title.data }}

Thanks for any advice!

A: You have to recompile the element after adding those attributes, here is an example:
Example plunker: http://plnkr.co/edit/00Lb4A9rVSZuZjkNyn2o?p=preview
.directive('edit', function($compile) {
  return {
    restrict: 'A',
    priority: 1000,
    terminal: true, // only compile this directive at first, will compile others later in link function
    template: function (tElement, tAttrs) {
      return '{{ content.' + tAttrs.edit + '.data }}';
    },
    link: function(scope, element, attrs) {
      attrs.$set('editable-text', 'content.' + attrs.edit + '.data');
      attrs.$set('onbeforesave', 'update($data, content.' + attrs.edit + '.id)');
      attrs.$set('edit', null); // remove self to avoid recursion.
      $compile(element)(scope);
    }
  }
});

Things to consider:

*

*remove the isolated scope to simplify things as it seems you would like to do the binding directly to a scope in controller content.portrait_description_title.data in the first place.

*template: also accept function, this way you can get the edit attribute value to construct the template.

*mark as a terminal directive and raise priority, so that at first run, only this diective (out of others in the same element) will get compiled.

*attrs.$set() is useful for adding/removing attributes, use it to add the editable-text directive and onbeforesave.

*remove the directive itself, i.e. the edit attribute, to prevent a recursion after a next compilation.

*use $compile service to recompile the element, in order to make editable-text and onbeforesave works.

Hope this helps.

A: Just add another directive inside template of first directive and bind it to scope model that you get from attr. You can also add controller function, and create more models, or logic and bind to directive template.
Also maybe your attributes may not be available on template, than you need to add $watch to your isolated scope model and update another scope model inside controller. That second one model needs to be binded to template. More information about directives you can find on AngularJS docs, but also here is one good article, it can help you:
http://www.sitepoint.com/practical-guide-angularjs-directives-part-two/


text:
Q: Laravel: Invalid argument supplied for foreach() when sending values with multipart-form-data I'm trying to access an array on a multipart-form-data request.
On my js code I add to the formData the object that I need this way:
for (const key in property) {
    if (typeof property[key] !== 'undefined') {
        console.log(key, property[key]);
        formData.append(`property[${key}]`, property[key]);
    }
}

The property has the array images and the value is an array like this:

Also in the same forData I send all the data from the images that I want to handle, and in this case the property contains an array of objects that are images previously stored in the database.
So, in my controller I have to following
 // Images that are already in database
 $propertyData = $request->input('property');
 $images = isset($propertyData['images'])? $propertyData['images'] : []
 foreach($images as $i) {
    $image = Image::find((int)$i['id']);
    if ( !is_null($image) ) {
        $image->update($i);
    }
}

But I got the error: Invalid argument supplied for foreach()
I've tried to even convert each image on the javascript code to an array like the property, but i got the same error.

A: You cannot directly append objects or arrays to FormData. You must add the keys and values one by one.
A way to do that is like so:
var formData = new FormData;
var arr = ['this', 'is', 'an', 'array'];
for (var i = 0; i < arr.length; i++) {
    formData.append('arr[]', arr[i]);
}

I use a helper function (note that this is in ES6 syntax) to do this:
export function appendFormdata(formData, data, previousKey) {
    if (data instanceof Object) {
        Object.keys(data).forEach(key => {
            const value = data[key];
            if (previousKey) {
                key = `${previousKey}[${key}]`;
            }
            if (value instanceof Object && !Array.isArray(value) && !(value instanceof File)) {
                return appendFormdata(formData, value, key);
            }
            if (Array.isArray(value)) {
                value.forEach((val, i) => {
                    return appendFormdata(formData, val, `${key}[${i}]`);
                });
            } else {
                formData.append(key, value);
            }
        });
    }
}

For more details refer: appending array to FormData and send via AJAX and Convert JS Object to form data


text:
Q: Rails: OAuth2 gem returns 400 error when attempting to connect to facebook I'm attempting to add Facebook connect to our web app, and I'm running into a problem with.  Everything works fine locally (I can authenticate through Facebook), but when I push the code to our dev server (which lives in the wild), every time I try to authenticate it returns the following error code:
OAuth2::HTTPError: Received HTTP 400 during request

That's really the only explanation I'm getting.  Again, this works on my local machine, and the gems and such match between boxes, so I'm a bit confused.  Here's the code I'm executing.
def facebook_connect
  #Set the scope we want to pull from Facebook, along with the callback URL
  options = {
    :redirect_uri => facebook_callback_url,
    :scope => "email,publish_stream"
  }

  #Go out and fetch the url
  client = OAuth2::Client.new(FACEBOOK_API_KEY, FACEBOOK_SECRET, {:site => FACEBOOK_API_URL, :access_token_method => :post})
  #Redirect to the callback for processing
  redirect_to client.web_server.authorize_url(options)
end

def facebook_callback
  #Client URL
  client = OAuth2::Client.new(FACEBOOK_API_KEY, FACEBOOK_SECRET, {:site => FACEBOOK_API_URL, :access_token_method => :post})

  #Parse out the access token
  access_token = client.web_server.get_access_token(params[:code], :redirect_uri => facebook_callback_url)

  #Get the user
  fb_user = JSON.parse(access_token.get('/me'))

  #Do some authentication database stuff
end

def facebook_callback_url
  uri = URI.parse(request.url)
  uri.path = '/users/facebook_callback'
  uri.query = nil
  uri.to_s
end

I searched Google, but the solutions that show up aren't working.  Also, if anyone knows how to parse and display OAuth2 errors, I would appreciate that, as well.  Thanks

A: Assuming that Facebook OATH knows of your server's IP address(they are very strict about it), I would recommend that you use use 'rescue' to catch that exception, get the backtrace and then find where it is being raised and place a bunch of debug statements to check the state of both request and the response, as well as access tokens.
Or you can configure remote debugging with Rubymine or NetBeans which is not an easy task :)

A: The issue actually ended up being a problem with the "Faraday" gem.  Our dev server wasn't set up to handle SSL, which was returning an error code.  We patched it using the following answer:
OmniAuth & Facebook: certificate verify failed


text:
Q: Typesense 'OR' query mode Description
I have a case where I'd like to search for multiple query tokens in a single collection like:
let searchRequests = {
  'searches': [
    {
      'collection': 'products',
      'q': 'shoe hat dress perfume',
    }
  ]
}

each token contains results if I query them individually and also if I query two tokens like so:  'q': 'shoe hat',.
Is there a way to allow for more than two query items?
Expected Behavior
I expect to have results returned based on my query tokens 'shoe hat dress perfume', or in other words an OR query mode:
{
  "results": [
    {
      "facet_counts": [],
      "found": 100,
      "hits": [
        ...
    }
  ]
}

Actual Behavior
The actual behavior is that nothing is found:
{
  "results": [
    {
      "facet_counts": [],
      "found": 0,
      "hits": [
        ...
    }
  ]
}

Metadata
Typesense Version: 0.22.0

A: Typesense doesn't support strict ORs and currently have no plan to do so.
To solve my problem I used filter_by instead like so:
let searchRequests = {
  'searches': [
    {
      'collection': 'products',
      'q': '*',
      'filter_by': "category:["shoe", "hat", "dress", "perfume"]"
    }
  ]
}

This would return all products of category shoe/hat/dress/parfume.
More details on usage of filter_by here: https://typesense.org/docs/0.19.0/api/documents.html#index-a-document


text:
Q: Quantization of mobilenet-ssd I wanted to quantize (change all the floats into INT8) a ssd-mobilenet model and then want to deploy it onto my raspberry-pi. So far, I have not yet found any thing which can help me with it. Any help would be highly appreciated.
I saw tensorflow-lite but it seems it only supports android and iOS.
Any library/framweork is acceptable.
Thanks in advance.

A: Tensorflow Lite now has support for the Raspberry Pi via Makefiles. Here's the shell script. Regarding Mobilenet-SSD, you can get details on how to use it with TensorFlow Lite in this blog post (and here)

A: You can try using TensorRT library.
One of the features of the library is quantization.
In general mobilenets are difficult to quantize (see https://arxiv.org/pdf/2004.09602.pdf) but the library should do a good work


text:
Q: Haskell, Aeson - Is there a better way of getting the info I need from USDA database? I'm a Haskell beginner trying to learn JSON parsing by going through USDA database.
I want to get the value of "ndbno" key from this link
https://api.nal.usda.gov/ndb/search/?format=json&q=potato+salad&sort=n&max=25&offset=0&api_key=DEMO_KEY
The JSON file from that link looks like this:
{
    "list": {
        "q": "potato salad",
        "sr": "1",
        "ds": "any",
        "start": 0,
        "end": 25,
        "total": 251,
        "group": "",
        "sort": "n",
        "item": [
            {
                "offset": 0,
                "group": "Branded Food Products Database",
                "name": "AHOLD, DEVILED EGG POTATO SALAD, UPC: 688267141584",
                "ndbno": "45044170",
                "ds": "LI",
                "manu": "Ahold USA, Inc."
            },
            {
                "offset": 1,
                "group": "Branded Food Products Database",
                "name": "AHOLD, REDSKIN POTATO SALAD, UPC: 688267141591",
                "ndbno": "45044169",
                "ds": "LI",
                "manu": "Ahold USA, Inc."
                },
...

"nbdno" key is 4th in "item"
{-# LANGUAGE DeriveGeneric #-}

module Lib
    ( someFunc
    ) where

import           Data.Aeson
import           Data.HashMap.Strict  as HS
import           Data.List            as L
import           Data.Maybe
import           Data.Text
import           Data.Vector          as V
import           GHC.Generics
import           Network.HTTP.Conduit
import           Text.Pretty.Simple

data Food = Name (String, Text)
          | Stuff (String, Int)
    deriving (Eq, Read, Show, Generic)

someFunc :: IO ()
someFunc = putStrLn "Under Consruction!"

apiKey = "https://api.nal.usda.gov/ndb/search/?format=json&q=chana+dal&sort=n&max=25&offset=0&api_key=jJN9dsKFe507qjLVqbecijtrYB4AiojXVIt1EaEZ"

instance FromJSON Food

unString x = case x of
  String x -> x

unObject x = case x of
  Object x -> x

unArray x = case x of
  Array x -> x

getParsed :: IO ()
getParsed = do
  x <- simpleHttp apiKey
  let y = (unObject . snd . L.head . HS.toList . fromJust) (decode x :: Maybe Object)
      z = (unArray . snd . L.last . L.init) (HS.toList y)
      a = V.map (unpack . unString . snd . L.head . L.drop 5 . HS.toList . unObject) z
      b = V.map (\x -> read x :: Int) a
  pPrint b

The way I implemented it is quite messy, but it gets the job done.
It's just that the code looks really bad and almost impossible to read. So I was wondering if there's a better way of doing that.

A: Define the types you'd like to deserialise into, for example:
{-# LANGUAGE DeriveGeneric #-}
module Q53251928 where

import Data.Aeson
import GHC.Generics

data Item = Item { ndbno :: String } deriving (Eq, Show, Generic)
instance FromJSON Item

data FoodStuff = FoodStuff { item :: [Item] } deriving (Eq, Show, Generic)
instance FromJSON FoodStuff

data RootJSON = RootJSON { list :: FoodStuff } deriving (Eq, Show, Generic)
instance FromJSON RootJSON

These types are the minimal types you'll need to access all the ndbno values. You can add other labels to the types to capture other data, e.g. group, start, end, etc.
I downloaded the file in the link and attempted to decode it from GHCi, which worked fine:
*Q53251928 Q53251928> decodeFileStrict "download.json" :: IO (Maybe RootJSON)
Just (RootJSON {list = FoodStuff {item = [Item {ndbno = "45044170"},
Item {ndbno = "45044169"},Item {ndbno = "45287938"},Item {ndbno = "45314045"},
Item {ndbno = "45036851"},Item {ndbno = "45036824"},Item {ndbno = "45198766"},
Item {ndbno = "45270526"},Item {ndbno = "45270516"},Item {ndbno = "45374956"},
Item {ndbno = "45215370"},Item {ndbno = "45225694"},Item {ndbno = "45225696"},
Item {ndbno = "45217133"},Item {ndbno = "45053881"},Item {ndbno = "45270521"},
Item {ndbno = "45226407"},Item {ndbno = "45218344"},Item {ndbno = "45225703"},
Item {ndbno = "45335760"},Item {ndbno = "45221588"},Item {ndbno = "45193027"},
Item {ndbno = "45194338"},Item {ndbno = "45194331"},Item {ndbno = "45256801"}]}})


text:
Q: Geoserver shape-zip archive response - setting UTF-8 character encoding for .dbf file? I created a WPS request to Geoserver, that returns a shapefile as ZIP archive which contains several files, including .shp, .dbf and .cst files.
Data columns in .dbf file are encoded based on the encoding information from .cst file (which is ISO-8859-1).
How can i configure Geoserver, or format WPS xml request, so that response .dbf file is encoded in UTF-8 instad of ISO-8859-1?

A: If you are using GET request, you can add this to your URL:
format_options=CHARSET:UTF-8


text:
Q: Separting ListItems in next Activity I am passing ListItems in an ArrayList to another activity. On the next Activity the ListItems are all together on one row. The first activity can send 1 ListItem or many, many ListItems. I am going to send the ListItems in the second activity to a database. They all go into same column in the database but their values must be separated. How do I separate the ListItems so that when they go into the database EACH one (not the combined value of the list)can be retrieved later.
ACTIVITY A
adapter=new ArrayAdapter<String>(this,
    R.layout.salelistitems,R.id.saleNotes,listItems);
    setListAdapter(adapter);

This part is working fine, just showing that I sent
.putStringArrayListExtra("list", listItems);

ACTIVITY B
adapter=new ArrayAdapter<String>(this,
    R.layout.salelistitems,R.id.saleNotes,listItems);
    setListAdapter(adapter);

    ArrayList<String> al= new ArrayList<String>();
    al = getIntent().getExtras().getStringArrayList("listItems");
    if (al != null)
    {
    listItems.add(al+"");
    adapter.notifyDataSetChanged();

I am sending numbers and I don't want the value (1,2,3,4) entered into the database
I want the values
1 (to database column)
2 (to database column)
3 (to database column)
4 (to database column)
I hope that makes it clear. Thanks

A: String[] items = al.split(",");


text:
Q: Jquery click code being called multiple times I tried adding my code into a fiddle and it works fine in there so please, try to analyze it straight on my site.
Here is the page: http://cacharro.ole32.com/shopping/
if you go to groceries.js, at line 39 there is the code for the clic event on the #addNewSection image.
then in the page you click in the big gree + buton, a formulary will pop up, and click again in the big green + symbol. You'll notice that the code inside the .click() function is called more than once..
does anyone knows why ??
EDIT:
I found the source of my error. Y added the hooking to the event in a function called init, something like:
function init() {
     $("#addNewSection").click( function(e){
          newSectionButtonClicked();
     });
}

and added a call in the $(function() .... BUT I also call this init() from other sites so everytime I call it a new instance of the function is hooked to the click event!! Is there a way to hook on the event only if we are not hooked already????

A: You should call init() function only 1 time, or remove the assignment of click event inside this function and put in in a function that will be called only one time, for example:
$("#addNewSection").click( function(e){
  newSectionButtonClicked();
});

this function is called every time you call the init() function, so this event will be trigged one more time for every init() you call.
You should call this registration only one time

A: Is your code registering the click handler more than one time on the same element. If so try to check the code. This is the situation which i have also faced. for first time click called once, for second time twice and so on every click register an a click handler on the same handler.
Also if you can show us the code for review.

A: function drawMarket(){
    $("#market").html("
");
    $.each(sections, function(idx, obj){
        var name = htmlDecode(obj.Name);
        var listItem = $('
');
        listItem.append(name);
        var innerComponent = $("
");

            var ItemName = htmlDecode(ItemObj.Name);
            innerComponent.append("
"+ItemName+"
");

        listItem.append(innerComponent);
        listItem.append("
");
        $("#marketList").append(listItem);
    });
    init();
}

Please replace this function inside your groceries.js  it will help you
You don't need to each loop inside this function because it will always append inner text

A: You call function drawMarket() in the newSectionButtonClicked() each time when you click on the plus button, and call init() function in the drawMarket(), so you define click event many times
You can do something like this for make only one initial definithion:
jQuery(document).ready(function() {
    $("#addNewSection").click( function(e){
        newSectionButtonClicked();
    });
});

or
jQuery(document).ready(function() {
    init();
});


text:
Q: Finding the maximum value in a column using GQL How do I find the maximum value in a particular column of a table in the GAE datastore using GQL?

A: To get the max you using GQL, you could do this:
max_x = db.GqlQuery("SELECT * FROM MyModel ORDER BY x DESC").get().x

You could use this syntactically shorter but equivalent approach:
max_x = MyModel.all().order('-x').get().x


text:
Q: C++11 searching a vector of objects I have 2 vectors
std::vector<MyObj> v;
std::vector<MyObj2> z;

The objects in the vectors both contain an int that has an ID. I want to see if when looking through v it has a matching id in z
So I thought that I could use `std::find_if and a Lambda.
for (int i=0; i < _z.size(); i++)
{
     MyObj2 _g = _z.at(i);

     auto iter = std::find_if(v.begin(), v.end(), [this](MyObj o)
     {
        if (o.getID() == _g.getID())
        {
            std::cout << "we have a match" << std::endl;
        }
        else
        {
            std::cout << "we DO NOT have a match" << std::endl;
       }
    });
}

but I am getting an error that I dont understand.
43: Member function 'getID' not viable: 'this' argument has type 'const MyObj2', but function is not marked const
I dont understand what has to be marked const and why?
an I needing something like in my .hpp?:
MyObj2& operator= (const MyObj2&);
MyObj2& operator== (const MyObj2&);

A: You need to declare MyObj2::getID() as const: The compiler says so quite clearly:
struct MyObj2 {
    int getID() const { ... }
    ...
};

It seems, your got a member _g for which this is captured. The _g mentioned before in this example is not captured because the capture clause explicitly restricts the capture to this. If you used the _g from the scope, getID() wouldn't need to be const.

A: From cppreference about find_if:

UnaryPredicate must meet the requirements of Predicate.

wich liks to the concept of Predicate:

The Predicate concept describes a function object that takes a single iterator argument that is dereferenced and used to return a value testable as a bool.
  In other words, if an algorithm takes a Predicate pred and an iterator first, it should be able to test the iterator using the predicate via a construct like if (pred(*first)) {...}.
  The function object pred shall not apply any non-constant function through the dereferenced iterator. This function object may be a pointer to function or an object of a type with an appropriate function call operator.

There are two requirements stated in that text:

*

*Your predicate (i.e. the lambda) has to return something convertible to bool. Some output to cout is not sufficient.

*Your predicate is not allowed to call nonconst functions on the argument (i.e. the MyObj)

However, your code shows lots of compile errors but nothing that relates to the error you stated in your question. This is because you did not provide an SSCCE:

*

*You did not capture _g in the lambda expression

*You get compile errors if the predicate does not return something convertible to bool (see requirements for the predicate above)

*you mismatched z and _z
I do not get the errors you described, because in your example code you copy the values from the vectors instead of taking a const reference. Copying is fine of course, and you can apply any non-const functions to those copies. I have a compileable mini-example of your code here: http://ideone.com/o8tPED
However, this is not how it should be implemented:

*

*You should take references instead of copies of the vector elements (I am almost sure you do that in reality)

*To avoid the error you reported, you will then have to declare both getID functions const. You should do that regardless of the usage in the algorithm, because functions that don't change the object should always say so.


text:
Q: Reddit gives 403 when upvoting via API I've registered as the Web app as required by the Reddit API for the Oauth access with identity, edit, flair, history, modconfig, modflair, modlog, modposts, modwiki, mysubreddits, privatemessages, read, report, save, submit, subscribe, vote, wikiedit, wikiread scopes.
I'd authorized my app and have exchanged the generated code for the access_token with 3600 seconds validity.
'use strict';

let request = require('request');
const USER_AGENT = 'web:com.example.server:v0.0.1 (by /u/sridharrajs)';
const token = '<my access_token within 3600 seconds validity>';

request({
  method: 'POST',
  url: 'https://www.reddit.com/api/vote',
  headers: {
    'User-Agent': USER_AGENT,
    'Authorization': `bearer ${token}`,
    'Content-Type': 'application/x-www-form-urlencoded'
  },
  form: {
    id: "t1_9qy47p",
    dir: "1"
  },
  json: false
}, function (error, response, body) {
  if (error) {
    console.log('error', error);
  } else if (body.error) {
    console.log('body.error', body);
  }
  return console.log(body);
});

But when I try to upvote a reddit submission using API, I get an error.

{"message": "Forbidden", "error": 403}

The link that I'm trying to upvote is Tim Cook warns of 'data-industrial complex' in call for comprehensive US privacy laws
I tried switching both bearer and Bearer as per the answer in Reddit API returns HTTP 403, and tried using different User-Agent as suggested in 403 error when trying to get data from Reddit API. Nothing seem to work.
What am I missing?

A: Solved. I need to use https://oauth.reddit.com instead of www.reddit.com.

You may now make API requests to reddit's servers on behalf of that user, by including the following header in your HTTP requests:
Authorization: bearer TOKEN

API requests with a bearer token should be made to https://oauth.reddit.com, NOT www.reddit.com.


text:
Q: Is using implied data in a message to compute a CRC a good design strategy? We are sending UDP messages from one device to another. There is a timestamp in the message and transmitted in a 16 bit field. The receiver keeps track of the number of times the field "rolls over" so that time spans that require more than 16 bits can be tracked. The protocol designer has decided that we should use the entire 32 bit timestamp to compute the CRC for the message. Is this a good idea? Note that we have a message period that is much smaller than the "roll over" period.

A: Since you are apparently in control of the messages, you should just transmit the 32-bit timestamp in the message.
What is the size of the CRC? If it is a 16-bit CRC, you could forgo the error detection function completely and solve the equations to get the missing 16-bits of the timestamp from the transmitted message and the CRC. But if you're going to do that, why not just send the other 16-bits of the timestamp directly in the CRC field, instead of a CRC?
If it is a 32-bit CRC, you could again solve, and be left with 16-bits of "strength" in the error detection, instead of 32. Again, one would have to ask why you wouldn't just send the other 16-bits of the timestamp and put a 16-bit CRC in what remains.
Or if you can change the length of the message, just add the missing 16 bits of timestamp, leaving the CRC and its error-detection capability intact.


text:
Q: How to add DataAnnotations attributes to specific properties in a C# class I wanted to add different DataAnnotations attributes to different instances of My Answer class which is as follows:
 public class AnswerViewModel()
   {
   public String QuestionText {get;set;}
   public String AnswerText {get;set;}
   }

I want to assign different attributes to the QuestionText field in different instances of this class.
Like in
AnswerViewModel a1 = new AnswerViewModel();
AnswerViewModel a2 = new AnswerViewModel();

I want the QuestionText field in a1 to have the DateTimeAttribute applied and in a2 the QuestionText field should have the PasswordAttribute applied and so on.
I know this will be done via Reflection or the TypeDescriptor but I am completely lost as to how it will be done.

A: Not possible. A data annotation will apply to every instance. The only way you could accomplish what you're looking for is to use separate view models:
public abstract class BaseAnswerViewModel
{
    public abstract string QuestionText { get; set; }
    public string AnswerText { get; set; }
}

public class DateTimeAnswerViewModel : BaseAnswerViewModel
{
    [DataType(DataType.DateTime)]
    public override string QuestionText { get; set; }
}

public class PasswordAnswerViewModel : BaseAnswerViewModel
{
    [DataType(DataType.Password)]
    public override string QuestionText { get; set; }
}

Then:
var a1 = new DateTimeAnswerViewModel();
var a2 = new PasswordAnswerViewModel();


text:
Q: How can i loop this code in visual basic? im making a friend adder for teenspot and this is what i have. basically you click a button and it adds the person selected on the list, then you have to click it again to add the next one. the thing is i need to know how to loops this so it just keeps moving down the list adding people automatically
    WebBrowser1.Navigate("www.teenspot.com/profiles/" & ListBox.SelectedItem & "/add")
    ListBox.SelectedIndex = ListBox.SelectedIndex + 2
    ' This is the "sleep" function.
    ' This makes your webbrowser finish loading before new action.

    Do Until WebBrowser1.ReadyState = WebBrowserReadyState.Complete And WebBrowser1.IsBusy = False
        Application.DoEvents()
    Loop

    WebBrowser1.Document.GetElementById("confirm").InvokeMember("click")

ive tried multiple times with do...loop and for..next and all that kinda stuff, but i still havent figured it out. what it does is, it only runs through the add me pages and never clicks confirm which is the second part. im kinda new to vb so if someone can i help id really appreciate it

A: To answer this:

the thing is i need to know how to loops this so it just keeps moving down the list adding people automatically

To add all friends in the list with one button click:
Use For Each/ Next
For Each item As String In ListBox1.Items
    WebBrowser1.Navigate("www.teenspot.com/profiles/" & item & "/add")
    Do Until WebBrowser1.ReadyState = Complete And WebBrowser1.IsBusy=False
       Application.DoEvents()
    Loop
    WebBrowser1.Document.GetElementById("confirm").InvokeMember("click")
Next

To add only the selected friend and then move the selected listitem one step down to wait for a new button click, do this:
If Not ListBox1.SelectedItem Is Nothing Then
    WebBrowser1.Navigate("www.teenspot.com/profiles/" & ListBox1.SelectedItem.ToString & "/add")
    If Not ListBox1.SelectedIndex = ListBox1.Items.Count - 1 Then ListBox1.SelectedIndex += 1
    Do Until WebBrowser1.ReadyState = Complete And WebBrowser1.IsBusy=False
       Application.DoEvents()
    Loop
    WebBrowser1.Document.GetElementById("confirm").InvokeMember("click")
End If

And for this:

it only runs through the add me pages and never clicks confirm which is the second part.

We have to know how the HTML-document is made up to research this, has the element "confirm" a javascript-click-event or is it just a post-form-button? I cant check this out without be logged in to the site. (And Im not a teenager so I will not create an account there) ;-)
But, you should be able to perform the click without InvokeMember I think. Like this:
WebBrowser1.Document.GetElementById("confirm").click()

I'm not 100% sure, but I think I've done it like that before.
If the button has a javascript like click="AddFriend()" or something like that, maybe you could use the invokescript to call that function directly instead of clicking the button, like this:
WebBrowser1.Document.InvokeScript("AddFriend()")


text:
Q: One action for multiple routes in rails I am new user in creating web using rails. I get problems in routes rails. I have 3 models. Student, Teacher, and Class.
Student
  has_many class

Teacher
  has_many class

Class
  belongs_to student
  belongs_to teacher

In routes.rb:
resources: students do
  resources: classes
end

resources: teachers do
  resources: classes
end

My problem appears when I call
students/1/classes or teachers/1/classes

Both of them call

action index in class controller

My purpose is showing data class depends on teacher id and data classes depends on student id
How can I create a differences when it call

action index in class controller

?
Thanks

A: check on presence of params as the following:
def index
  if params[:student_id]
     @object = Student.find(params[:student_id])
  else
     @object = Teacher.find(params[:teacher_id])
  end
  @classes = @object.classes
end

A: The two options you have are:

*

*Identify the option in the routes itself

*Identify the data in your controller with conditional logic

In fact, both of these methods will use conidtional logic - it just depends on which method
you use as to how you'll determine how to determine the output:
#config/routes.rb
resources :students do
   resources :classes, model: "Student"
end

resources :teachers do
   resources :classes, model: "Teacher"
end

#app/controllers/classes_controller.rb
class ClassesController < ApplicationController
   before_action :set_parent, only: :index

   def index
      # @classes will already be set!
   end

   private

   def set_parent
      id = params[:student_id] || params[:teacher_id]
      if params[:model].exists?
         model = params[:model]
      else
         model = "Student" if params[:student_id]
         model = "Teacher" if params[:teacher_id]
      end
      @model = model.constantize
      @parent = @model.find id
      @classes = @parent.send model.lowercase.pluralize
   end
end


text:
Q: How can I snapshot a HTML DOM element in perl Using HTML::Parser (or whatever else would provide the same, preferably with some suck tolerance for document sources) how can I dump the contents of a particular element node to track changes in it?
For example, given a document:

What would I need to add to this code to be able to hash everything within bar?
use HTML::Parser;

sub foo {
    my $tag = shift;
    if ($tag ne "div") {
        return;
    }
    my $attrs = shift;
    my @ids = split(/ /, $attrs->{'id'});
    if (grep(/bar/, @ids)) {
        print "how do I sha256() the innerhtml here?";
    }
}

my $p = HTML::Parser->new(
    start_h => [\&foo, 'tagname, attr'],
);

$p->parse_file('index.html');

Reducing to interpreted source would suffice.

A: Perhaps module Mojo::DOM makes solution of this task extremely easy
use strict;
use warnings;
use feature 'say';

use Mojo::DOM;

my($page,$dom,$div_id_bar);

$page = do { local $/; <DATA> };
$dom  = Mojo::DOM->new($page);

$div_id_bar = $dom->at('div[id] > #bar');

say $div_id_bar;

exit;

__DATA__

    div block with id=bar

Output

        div block with id=bar


text:
Q: Conditional expectation with a given property Let $f$ and $F$ denote the probability density and distribution of a random variable $X$. Assume that $f$ is twice continuously differentiable. Letting $g(k) \equiv \mathbb{E}(X|_{X>k})$, I'm interested in finding distributions (or a class of distributions) for which $g^{\prime \prime}(k)>0$.
I've started by assuming that $X$ follows a distribution from the Pearson family (sufficiently general for my particular application). Letting $\lambda(k)\equiv \frac{f(k)}{\overline{F}(k)}$ denote the inverse Mills ratio,
$$\mathbb{E}(X|_{X>k})=\frac{ \left(-b_0-b_1 k-b_2 k^2\right)}{2
   b_2-a_1}\lambda(k)+\mathbb{E}(X)$$
(see Inverse Mills ratio for non normal distributions.)
Thus:
$$g^{\prime \prime}(k)=\frac{ -2b_2}{2
   b_2-a_1}\lambda(k)
+
\frac{ -2b_1 -4b_2 k}{2
   b_2-a_1}\lambda^{\prime}(k)
+\frac{ \left(-b_0-b_1 k-b_2 k^2\right)}{2
   b_2-a_1}\lambda^{\prime\prime}(k)
$$
I haven't been able to draw any conclusion. Restricting attention to the Pearson class, can you find a general characterization of the distributions with the property $g^{\prime \prime}(k)>0$?

A: An approach.  For an exponential distribution with parameter 1, $g(k)=k+1$ (for $k\ge 0$), so $g''(k)=0$.  To get $g''(k)\gt 0$, you need a density function decaying slower than exponential.


text:
Q: Searching a character in sql table and displaying all records in gridview that start with that character ASP.NET c# Good day I am working on an ASP.NET C# application that searches a sql table and brings back the results in a gridview. I got it to work using the like operator but I realise that if I search a character it brings back any record with that character in it, what I want is if I search with a character I want all records starting with that character. It should also allow me to search normally, Here is what I did previously
//I have a connection manager class in my app code folder

 SqlConnection connection = connectionManager.GetConnection();

        SqlCommand myCommand = new SqlCommand();
        myCommand.Connection = connection;

        String str = "select PR_NAME_GN, PR_NAME_SURN, EVENT_PARISH, EVENT_YEAR, EVENT_TYPE, FS_IMAGE_ID from Jam01 where (PR_NAME_GN like '%' + @deceasedFirstName + '%' AND PR_NAME_SURN like '%' + @deceasedLastName + '%' AND EVENT_PARISH like '%' + @ParishOfDeath+ '%' AND EVENT_YEAR like '%' + @YearOfDeath+ '%' AND EVENT_TYPE like '%' + @TypeDeath+ '%' AND FS_IMAGE_ID like '%' + @ImgLocation+ '%')";

        SqlCommand command = new SqlCommand(str, connection);

        command.Parameters.Add("@deceasedFirstName", SqlDbType.NVarChar).Value = DeathFirstNametbox.Text;
        command.Parameters.Add("@deceasedLastName", SqlDbType.NVarChar).Value = DeathLastNametbox.Text;
        command.Parameters.Add("@ParishOfDeath", SqlDbType.NVarChar).Value = ParishoDeathtbox.Text;
        command.Parameters.Add("@YearOfDeath", SqlDbType.NVarChar).Value = YearofDeathtbox.Text;
        command.Parameters.Add("@TypeDeath", SqlDbType.NVarChar).Value = type_Death.Text;
        command.Parameters.Add("@ImgLocation", SqlDbType.NVarChar).Value = "";

        command.ExecuteNonQuery();

        SqlDataAdapter sda = new SqlDataAdapter();

        sda.SelectCommand = command;

        DataSet ds = new DataSet();

        sda.Fill(ds, "PR_NAME_GN");
        sda.Fill(ds, "PR_NAME_SURN");
        sda.Fill(ds, "EVENT_PARISH");
        sda.Fill(ds, "EVENT_YEAR");
        sda.Fill(ds, "EVENT_TYPE");
        sda.Fill(ds, "FS_IMAGE_ID");

        GridView1.DataSource = ds;

        GridView1.DataBind();

        connection.Close();

I need recommendation on how to rework the sql statement. I am kinda new to this so please bear with me.

A: Remove the leading % wildcard after the LIKE keyword so that only values starting with the specified value will be returned:
String str = "SELECT PR_NAME_GN, PR_NAME_SURN, EVENT_PARISH, EVENT_YEAR, EVENT_TYPE, FS_IMAGE_ID FROM Jam01 WHERE (PR_NAME_GN LIKE @deceasedFirstName + '%' AND PR_NAME_SURN LIKE @deceasedLastName + '%' AND EVENT_PARISH like @ParishOfDeath + '%' AND EVENT_YEAR LIKE @YearOfDeath+ '%' AND EVENT_TYPE LIKE @TypeDeath+ '%' AND FS_IMAGE_ID LIKE @ImgLocation + '%');";


text:
Q: HTML navigation float with border PROBLEM Seriously, when I'm applying borders then use floats, this problem occurs! When I'm trying to zoom out, the display messes up. This topic is the best example of my problem, How to prevent the floating layout wrapping when firefox zoom is reduced. I search through the internet but all of the questions haven't been answered clearly, as if there's no official fix for this.
This is my navigation that when you zoom out, the last bar messes up and going at the bottom.
http://angelickp.byethost24.com/Church.php
Tried with IE and firefox.

A: When you zoom out, the border width values will change. This may help you.


text:
Q: npm command prompt Installing I'm new to nodejs, I tried typing npm install and it brought this error log:

npm warn saveerror ENOENT: no such file or directory,
  open C:\users\kiddy\package.json
  npm WARN kiddy no description
  npm WARN kiddy no repository field
  Npm WARN kiddy no README data

How do I overcome above error?

A: Before installing any packages with the npm install command, you have to have a package.json. Use this in the folder
npm init

Now, you can install packages.

A: and welcome to NodeJS. Hope this little issue hasn't deterred you, and hopefully by now you have overcome this challenge and moved on your NodeJS journey. But in spirit of sharing knowledge, here is what had happened.
As your npm install script indicated, you have not provided description and repository fields, and you don't have a README.md file.
The easiest way to create a new package.json is to run the npm init command.

npm init --yes

Here is a sample package.json file to get you started. Best of luck!!
  {
    "name": "my_package",
    "description": "Awesome NodeJS project.",
    "version": "1.0.0",
    "main": "index.js",
    "scripts": {
      "test": "echo \"Error: no test specified\" && exit 1"
    },
    "repository": {
      "type": "git",
      "url": "https://github.com/ashleygwilliams/my_package.git"
    },
    "keywords": [],
    "author": "",
    "license": "ISC",
    "bugs": {
      "url": "https://github.com/ashleygwilliams/my_package/issues"
    },
    "homepage": "https://github.com/ashleygwilliams/my_package"
  }


text:
Q: Making sense of this formula relating to polynomials : $ P(x+n+1) = \sum_{i=0}^n (-1)^{n-1} \binom {n+1} i P(x+i)$ $$ P(x+n+1) = \sum_{i=0}^n (-1)^{n-1} \binom {n+1} i P(x+i)$$
What does the above formula do ? I came across this formula in a set of lecture notes, so the explanation following was a tad short.
The following problems are to be solved using this formula, but I'm stuck:

*

*A polynomial $P$ of degree $n$ satisfies $P(i)= \binom {n+1} {i}^{-1} $ for $i=0,1,2,\ldots,n$. Find $P(n+1)$.

*A polynomial $P$ of degree $n$ which satisfies $P(i)= {1 \over i}$ for $i=1,2,\ldots,n+1$. Find $P(n+2)$.
The problems are routine exercise problems, but I just can't get around the above formula .

A: Try to use different values of $x$ to solve your exercices (for example $x=0$ for the first question and $x=1$ for the second one)

A: I assume you're having trouble understanding what the equation itself is. Perhaps I can help.
If you take the right side over to the left (correcting a minor typo - "n-1" should be "n-i" in the power of -1), the equation can also be written like this:
$$
\sum_{i=0}^{n+1} (-1)^{n+1-i} \binom {n+1} i P(x+i)=0
$$
What this is, is actually the iterated difference. That is, if $\Delta f(0) = f(1)-f(0)$, and $\Delta^2 f(0) = \Delta (f(1)-f(0)) = f(2)-2f(1)+f(0)$, and so on, then our equation says
$$
\Delta^{n+1} P(x) = 0
$$
And if our polynomial is of order $n$ or lower, then this must be true. To see this, consider that, for $P(x)=x^n$, we have
$$
\Delta x^n = (x+1)^n-x^n = \sum_{k=0}^{n-1}\binom{n}{k}x^k
$$
And
$$
\Delta C = 0
$$
for any constant $C$. So, iterating the $\Delta$ operation $n+1$ times, you end up with $\Delta^{n+1} x^n = 0$.


text:
Q: How to fast scope and fire in cs 1.6? I have been trying to improve my awp skills and found some cool tips on the internet already. I am much better with awp these days, but I still suck when compared to some of the guys who I play against daily. Of course in the pub games there are some hackers too, but I don't care about them.
This is what I did to improve my awp skills

*

*Set hud_fastswitch 1 command in the console to switch between weapons quickly

*Zoom and fire when I see an enemy in the center of my screen (I sometimes do it so fast that it appears like scope less fire which is part of the tip/trick)

*Switch to other weapons (I usually press 2 for pistol) and immediately press 1 to switch back to the mag and repeat 2 & 3
However, this does not seem to be enough. I know it takes a little time between each fire but I've seen people do it (killing two in a row) so fast in no time. Sometimes I suspect they are hacking but I am not sure how they do it (maybe using scripts).
Can some tell me legal way to do this?

A:

*

*Set hud_fastswitch 1 command in the console to switch between weapons quickly

This doesn't allow you to shoot faster any more. It used to in earlier versions of CS, but was removed prior to 1.6. You don't need to switch weapons unless you want to run away faster or think you'll need to use your pistol.

*

*Zoom and fire when I see an enemy in the center of my screen (I some time do it so fast that it appears like scope less fire which is part of the tip/trick)

This is called quickscoping. The timing is difficult at first, but you want to right click and then left click almost immediately. If you're aiming properly (which is hard without practice), it's a kill, the bullet will be accurate even though you're not scoped in.

I know it takes a little time to between each fire but I saw some do it (killing two in a row) so fast in no time.

The way they're doing this is to fire the first shot normally when scoped in, and then (without switching weapons) immediately aim and fire the next shot. That second shot will be accurate even though you're not zoomed in, but the aiming part is difficult, especially from longer ranges.
I suggest practicing in a Deatmatch server, there will be plenty of chances to work on quickscoping.
Note: There's a bug in CS where quickscoped shots won't put a bullet hole in the right place. Your shots are accurate if you're quickscoping right, so don't worry about that.

A: with AWM it helps to put a transparent sticker with a red dot in the center of the screen... so you know where the gun fires without a zoom :)
I also used Q for weapons switching ... that did the work...


text:
Q: Measure on the square with uniform marginals Today during a seminar I heard that a measure on the unit square with uniform marginals that gives no weight above the main diagonal is the uniform measure on the diagonal.
I have no precise idea how to prove the statement. Any hint?
Moreover, what does it exactly means to have uniform marginals?

A: Define $f:[0,1] \to [0,1] \times [0,1]$ by $f(x)=(x,x)$. Let $m$ be Lebesgue measure in $[0,1]$ and define $\mu$ on  $[0,1] \times [0,1]$ by $\mu (E)=m(f^{-1}(E))$. This is the uniform measure on the diagonal. The first marginal of $\mu$ is the measure $\nu$ given by $\nu (A)= \mu(A \times [0,1])=m(f^{-1} (A \times [0,1])=m(A)$ so the first marginal is the uniform measure on $[0,1]$. Similarly, the second marginal is also the uniform measure on $[0,1]$. Of course, $\mu$ gives no weight above (or below) the diagonal. Let us show that $\mu$ is the only measure on the square which has the given properties:
suppose $X ,Y$ are random variables with joint distribution  $\mu$. Then $Y \leq X$ almost surely and $E(X-Y)=EX-EY=0$ so $X=Y$ almost surely. Hence $\mu$ is concentrated on the diagonal. Can you now use the marginals to verify that it is the uniform measure on the diagonal?


text:
Q: biblatex: no linebreaks in name lists when typesetting ragged-right When typesetting a bibliography \raggedright, biblatex seems to have trouble breaking a line between an author's first/last/middle names (and, if multiple authors are present, between two authors). It's as if the entire name list had been put into an \mbox.
Consider this example.

\documentclass[11pt,DIV=6]{scrartcl}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[style=authoryear]{biblatex}
\usepackage{filecontents}
\usepackage{tgschola}

\begin{filecontents}{bibtest.bib}
@COLLECTION{Star95,
  editor = {Star, Susan Leigh},
  year = {1995},
  title = {Ecologies of Knowledge: Work and Politics in Science and Technology},
  address = {Albany},
  publisher = {SUNY}
}
@INCOLLECTION{Star95a,
  author = {Star, Susan Leigh},
  title = {The Politics of Formal Representations: Wizards, Gurus, and Organizational
    Complexity},
  year = {1995},
  pages = {88-118},
  crossref = {Star95}
}
\end{filecontents}

\renewcommand*{\bibsetup}{\raggedright}
\bibliography{bibtest.bib}
\listfiles

\begin{document}
\noindent\hrule
\nocite{Star95a}
\printbibliography
\noindent\hrule
\end{document}

»Susan Leigh« would easily fit into the fourth line, but instead her entire name is moved to the next one. It would seem odd to me that this should be biblatex's intended behavior, as it can have even worse results under certain circumstances. Can you reproduce this? What would be a way to change it? Should I contact the biblatex team?

A: Line breaks in names are controlled by the lownamepenalty and highnamepenalty counters. From biblatex.def the default values are:
\defcounter{lownamepenalty}{\hyphenpenalty/2}
\defcounter{highnamepenalty}{\hyphenpenalty}

where \hyphenpenalty defaults to 50.
To allow breaks between the first and last name parts (e.g. "Susan Leigh" and "Star"), you can set lownamepenalty to a small value in your preamble. For example:
\defcounter{lownamepenalty}{0}

Note that \bibsetup by default executes a variety of commands. So instead of
\renewcommand*{\bibsetup}{\raggedright}

you're better off with:
\appto{\bibsetup}{\raggedright}


text:
Q: Accessing table objects data from the JSON file Display JSON data in the table
I am having an issue to access my JSON data. It is inside the array of objects of objects. How can I do that?
I am using the map function to display it, but only the name and avatar. It is nested.
JSON data
[
  {
    "id": "1",
    "person": {
      "name": "Prerna Jha",
      "avatar": "profile.jpg"
    },
    "city": "Mumbai",
    "email": "prernajha@gmail.com",
    "joiningDate": "12/02/2018",
    "role": "UI Designer"
  },
]

{data.map((curElem) => {
          const { id, name, avatar, city, email, joiningDate, role } = curElem;
          return (

                {name}
                {avatar}
                {city}
                {email}
                {joiningDate}
                {role}

          );
        })}

I have got few data and nested objects, but I am not getting it.

A: Need to access person object first in main json
   const { id, person, city, email, joiningDate, role } = curElem;
   const {name, avatar} = person