text:
Q: MyBatis MapperScannerConfigurer to scan base package from classpath I have configured MapperScannerConfigurer in spring application context as follow:
<bean name="mapperScannerConfigurer" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
    <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
    <property name="basePackage" value="path.to.package.from.classpath.dao" />
</bean>

Here basePackage is in a jar file that is set in classpath.
One of the mapper from the package is autowired in the one of the services I am using. Looks like MyBatis is failing here to scan package from classpath as I am getting error stating no such Bean found:
No qualifying bean of type 'path.to.package.from.classpath.dao.UserMapper' available: expected at least 1 bean which qualifies as autowire candidate.

I have searched online and found nothing which has similar scenario.

A: I am going to answer here my own question as it may help someone facing the similar issue.
The problem was in the way I created jar in the first place. iBatis might have a different way of scanning the packages as it was working and I thought the same could work with MyBatis. But MyBatis may have a different mechanism for scanning packages. It appears it is looking for directory entries in the jar and if it does not find it, it will throw this exception. So make sure you choose the option Add directory entries while creating the jar as shown below:


text:
Q: SQLite column error: table XXX has no column named YYY I've looked at the following, among others and have found nothing that matches my problem (as far as I can tell):
android.database.sqlite.SQLiteException: table X has no column named Y: , while compiling: INSERT INTO
Android : Table has no column named "variable name" MySql Database error
Error compiling insert into: No column named ID
Android SQLite issue - table ... has no column named
https://sqlite.org/foreignkeys.html
I'm getting the following SQLite error:
SQLiteDatabase: Error inserting zipCode=23456 address2= city=state address1=123 petName=qwerty phoneNumber=null vetName=zaw emailAddress=
                                             android.database.sqlite.SQLiteException: table vets has no column named petName (code 1): , while compiling: INSERT INTO vets (zipCode,address2,city,address1,petName,phoneNumber,vetName,emailAddress) VALUES (?,?,?,?,?,?,?,?)

I have a feeling that it has to do with the foreign key in VetTable but my research hasn't helped me with understanding what's going on.
VetTable is defined as follows:
public class VetTable {
    public static final String TABLE_VETS = "vets";
    public static final String VET_ID = "vetId";
    public static final String PET_ID = "petId";
    public static final String VET_NAME = "vetName";
    public static final String ADDRESS1 = "address1";
    public static final String ADDRESS2 = "address2";
    public static final String CITY = "city";
    public static final String STATE = "state";
    public static final String ZIP_CODE = "zipCode";
    public static final String PHONE_NUMBER = "phoneNumber";
    public static final String EMAIL_ADDRESS = "emailAddress";

public static final String SQL_CREATE =
        "CREATE TABLE " + TABLE_VETS + "(" +
                VET_ID + " INTEGER PRIMARY KEY UNIQUE, " +
                PET_ID + " INTEGER, " +
                VET_NAME + " TEXT, " +
                ADDRESS1 + " TEXT, " +
                ADDRESS2 + " TEXT, " +
                CITY + " TEXT, " +
                STATE + " TEXT, " +
                ZIP_CODE + " TEXT, " +
                PHONE_NUMBER + " TEXT, " +
                EMAIL_ADDRESS + " TEXT, " +
                "FOREIGN KEY(" + PET_ID + ") " +
                "REFERENCES pets(petId));";

    public static final String SQL_DELETE =
            "DROP TABLE" + TABLE_VETS;
}

The relevant code from DBHelper code is as follows:
public void addVetInfo(String name, String address1, String address2, String city, String state, String zip, String phone, String email){
    try {
        db = this.getWritableDatabase();
        values.put(VET_NAME, name);
        values.put(ADDRESS1, address1);
        values.put(ADDRESS2, address2);
        values.put(CITY, city);
        values.put(CITY, state);
        values.put(ZIP_CODE, zip);
        values.put(PHONE_NUMBER, phone);
        values.put(EMAIL_ADDRESS, email);
        db.insert(TABLE_VETS, null, values);
    } catch (SQLException e) {
        e.printStackTrace();
    }
}

As can be seen petName is not part of nor has ever been included in VetTable, nor is it part of the argument list in addVetInfo. So, what is SQLite doing that makes it think that petName should be a column in VetTable?

A: For others who are having problems with this SQLite error, it appears that it was due in my case to having duplicate column names as pointed out by CL to my post. When I corrected that and reran the code, it worked fine, no error.
So, make sure that your column names are correct for your insert statement.

A: This can happen when you are trying to insert the data into the table where the column name does not exist or maybe schema that you are trying to insert into has been changed with the latest sequelize.js code.
Possible issue Examples:

*

*Renamed column name (eg: earlier ID and now UUID)

*New schema design or complete table schema change

*Trying to insert the data with the wrong field name (eg: IDS: 1234) into the table with the column name (eg: ID: 1234)

A: Looks like your values variable already have that value inside the object, check this :
public void addVetInfo(String name, String address1, String address2, String city, String state, String zip, String phone, String email){
    try {
        db = this.getWritableDatabase();
        //INITIALIZE YOUR VARIABLE VALUES HERE
        ContentValues values = new ContentValues();

    //if(name == "Enter vet name") name = null;
    values.put(VET_NAME, name);
    //if(address1 == "Enter address 1" || address1 == " ") address1 = null;
    values.put(ADDRESS1, address1);
    //if(address2 == "Enter address 2") address2 = null;
    values.put(ADDRESS2, address2);
    //if(city == "Enter city") city = null;
    values.put(CITY, city);
    //if(state == "Enter state") state = null;
    values.put(CITY, state);
    //if(zip == "Enter zip") zip = null;
    values.put(ZIP_CODE, zip);
    //if(phone == "Enter phone number") phone = null;
    values.put(PHONE_NUMBER, phone);
    //if(email == "Enter email address") email = null;
    values.put(EMAIL_ADDRESS, email);
    db.insert(TABLE_VETS, null, values);
} catch (SQLException e) {
    e.printStackTrace();
}
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: How are Facebook events DELETED with php-sdk? Has anyone figured out how to delete an event using the Facebook php-sdk?  Not finding documentation on how to do this.

A: This works for me.
$tokenArray = array(
    'access_token' => $token
);
$facebook->api('/'.$fbEventId, "DELETE", $tokenArray);


text:
Q: How can I bind the selected text of a Select box to an object's attribute with Knockout JS, or anything else? I have a select box pull down that I'm populating with a JSON list returned from a stored procedure, but unfortunately when I update the linked object I need to return the selected text of the pulldown, not the selected index like one would think (poor database design, but I'm stuck with it for now and cannot change it).
Does anyone have any ideas what I can do to keep the selected text synced with the appropriate javascript object's attribute?

A: You could keep both, the value and the text, if you use subscribers.
For instance, if each of your javascript objects look like this:
    var optionObject = {
       text:"text1"
       value: 1
    }

Then your binding would look like:

Where 'OptionsObjects' is a collection of optionObject and selectedOption
has two observable properties: text and value.
Finally you subscribe to the value property of the selectedOption:
    viewModel.selectedOption.value.subscribe(function(newValue){
        var optionText = viewModel.OptionsObjects[newValue].text;
        viewModel.selectedOption.text(optionText);
    });

Then if you want to see the new selected option text when the value is changed,
you could have a binding as follows:
    <span data-bind:"text:selectedOption.text"></span>

In your particular case you would return selectedOption.text().

A: So yes, you got what I was getting at.  Use the text as the value for the select options rather than using an index.  The value really should be something useful, I can't think of any case where I've ever used an index.  A number sure, but a number that relates to the application's models in some way (like an id from a database), not to the number of items in the select box.
Well done.


text:
Q: Why is dirac delta in $H^{-1/2-\epsilon}$ and why is multiplication not well-defined in that space? I read on this Sobolev space with negative index question that the dirac delta distribution belongs to $H^{-1/2-\epsilon}(\mathbb{R})$. I was trying to figure out why that is the case but it wasn't clear to me.  I know that it acts on test functions by $\langle \delta, f\rangle = f(0)$ Although I don't see why the test functions necessarily need to be in $H^{1/2}$.
Finally, I also read that $\delta^2$ is not well defined as a distribution.  How would I see this? Is it simply because if we apply $\delta$ to a function once, we get a value in $\mathbb{R}$. But then why not treat $f(0)$ like a constant function that you can then apply $\delta$ to again?
I can see the issue with naively defining $\langle \delta^2,f\rangle = f(0)^2$, because here linearity breaks down. But is there a general proof for why there's no good way to define $\delta^2$?

A: For the first question, this is due to the fact that $H^{s}(\mathbb{R}^n)$ is continuously embedded in $C^0(\mathbb{R}^n)$ if and only if $s>n/2$ which for $n=1$ gives $s>1/2$.
For the second one, you cannot define consistently a multiplication between distribution, there were a lot of attempts for that in the eighties (see works of JF Colombeau for instance) but no general framework found as far as I know.
Moreover it seems that in your question you are messing between multiplication and composition. You cannot compose $\delta$ by itself obviously because its image space $\mathbb{R}$ is not its domain space (continuous functions).
The natural multiplications of distribution is rather convolution, and it turns out that $\delta$ is the neutral element for this operation, so that $\delta\star\delta=\delta$.

A: As a complement to Emmanuel nice answer, you can also compute directly the $H^s$ norm of the Dirac delta since $\mathcal F(\delta_0) = 1$, you get
$$
\|\delta_0\|_{H^{-s}}^2 = \int_{\Bbb R^d} |\mathcal F(\delta_0)|^2\left(1+|x|^2\right)^{-s}
\\= \int_{\Bbb R^d} \frac{\mathrm d x}{\left(1+|x|^2\right)^s}
$$
and this integral converges if and only if $s > d/2$ (so $s>1/2$ if $d=1$).


text:
Q: Moving user entry to another container entry in Active Directory: "there is a naming violation" I'm having trouble moving a user entry from one container entry to another
using (var newParent = GetEntry(destination, Configuration.ServerAddress, Configuration.UserName, Configuration.Password))
{
    _entry.MoveTo(newParent);
}

...
public static DirectoryEntry GetEntry(Guid guid, string serverAddress, string userName, string password)
{
    try
    {
        var id = guid.ToString().Replace("}", "").Replace("{", "");
        return new DirectoryEntry(String.Format("{0}<GUID={1}>", serverAddress, id), userName, password);
    }

    catch (Exception e)
    {
        if (e.HResult != Searcher.ENTRY_NOT_FOUND)
            throw new DirectoryServiceException(e);
    }
    return null;
}

The _entry ('user@****.com') has to be moved to its destination 'container@****.com'. Since I'm using the System.DirectoryServices namespace, both are of type DirectoryEntry.

But on calling the MoveTo() method there occurs a DirectoryServicesCOMException, which contains following information:
Message: There is a naming violation.
ExtendedErrorMessage: 00000057: LdapErr: DSID-0C090A8E, comment: Error in attribute conversion operation, data 0, v1db1
HResult -2147016649

Anyone any idea on what could cause this exception?

A: Turned out, that the Path property must not contain the entry's GUID. Since I used the GUID to retreive the entry from AD it looked like:
LDAP://<domain>/<GUID=9908d4c1-0438-4d23-8828-f5876166c84f>
To make it work, you have make sure, the path looks like this:
LDAP://<domain>/CN=container@blabla.com,CN=UnitTestContainer,DC=<domain>
I don't know why it behaves like that. Probably the path is needed for some internal processing... If anyone knows a way to make it work with GUIDs, please let me know.

A: I know this is an older thread, but thought I'd add my recent experience here as I just ran into this limitation.
Wodzu's assumption about "Probably the path is needed for some internal processing" is correct.
The following article mentions a hint:
Using objectGUID to Bind to an Object
Per the above link: "The following IADsContainer methods are not supported by objects obtained by binding using the object GUID:".
This includes "MoveHere".
The code example here is C++ so it may not be obvious "why" this is until we consider how System.DirectoryServices works.
This hint combined with an excellent directory services programming guide (cited below) gives us a better picture - this book mentions IADsContainer.MoveHere is used "under the hood" by MoveTo().
You can see this for yourself by viewing the source code for .NET.
Here's an example path of where to look if you clone the repo (any 4.x version will be very similar here):
corefx-master\src\System.DirectoryServices\src\System\DirectoryServices\DirectoryEntry.cs

Book:
Kaplan, Joe; Dunn, Ryan. The .NET Develper's Guide to Directory Services Programming (Kindle Location 1719). Pearson Education. Kindle Edition.


text:
Q: PlayFramework and SBT release plugin run with test play app configuration Play 2.5
Is there a way to automatically load a test configuration when running the release task in SBT-release https://github.com/sbt/sbt-release.
Currently, I have to run this command and explicitly specify the test config file.
sbt "release with-defaults" -Dconfig.resource=application-test.conf

runTest step is one of the releases steps  build.sbt Is it possible to make it pick up the test config automatically?
releaseProcess <<= thisProjectRef apply { ref =>
  import sbtrelease.ReleaseStateTransformations._
  Seq[ReleaseStep](
    loginToAwsEcr(ref),
    checkSnapshotDependencies,
    inquireVersions,
    runClean,
    runTest,
    setReleaseVersion,
    commitReleaseVersion,
    tagRelease,
    releaseStepTask(sbtdocker.DockerKeys.dockerBuildAndPush),
    uploadBeanstalkBundle(ref),
    setNextVersion,
    commitNextVersion,
    pushChanges
  )
}

project/plugins.sbt
addSbtPlugin("se.marcuslonnberg" % "sbt-docker" % "1.4.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.2.0-M9")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.4")

I tried to add
javaOptions in Test += "-Dconfig.file=conf/application-test.conf"

but it doesn't work.

A: I was missing one important thing. JVM needs to be forked for tests in order to pick up the -D params.
fork in Test := true

javaOptions in Test += "-Dconfig.file=conf/application-test.conf"

now when I run sbt test or sbt "release with-defaults" the test config file gets automatically loaded.


text:
Q: Trying to display entered values in same page Im trying to display entered values in same page,
When user enter the values in fields and submit, then the values should save database and should display in same jsp page.
I tried and the values are stored in database but not displaying on same page, but , it showing null values and then div disappears when submit action is performed
And im using stored procedure in database
this is jsp page:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Stored Procedure</title>

<form name="stp" action="STP" >

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

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

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

MobileNo:<input type="tel" name="Mobile">

<input type="button" value="Submit" onclick="show()">
</form>

Id:<%= request.getAttribute("id") %>

Name:<%= request.getAttribute("name") %>

Branch:<%= request.getAttribute("branch") %>

MobileNo:<%= request.getAttribute("mobile") %>

this is servlet code:
package task;

import java.io.IOException;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/STP")
public class STP extends HttpServlet {
    static {
        try {
            Class.forName("com.mysql.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        int ID = Integer.parseInt(request.getParameter("ID"));
        System.out.println(ID);
        String Name = request.getParameter("Name");
        String Branch = request.getParameter("Branch");
        long Mobile =Long.valueOf(request.getParameter("Mobile"));
        try {

            Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/vikas", "root", "root");

            CallableStatement cs = con.prepareCall("{call Procedure3(?,?,?,?)}");
            cs.setInt(1, ID);
            cs.setString(2, Name);
            cs.setString(3,Branch);
            cs.setLong(4,Mobile);

            cs.execute();
            int id=cs.getInt(1);
            String name=cs.getString(2);
            String branch=cs.getString(3);
            long mobile=cs.getLong(4);
            request.setAttribute("id",id);
            request.setAttribute("name",name);
            request.setAttribute("branch",branch);
            request.setAttribute("mobile",mobile);
            request.getRequestDispatcher("StoredProcedure.jsp").forward(request, response);
        System.out.println(id);
        } catch (SQLException e) {
            e.printStackTrace();
        }

    }
}

A: Your trying to forward the request and response by using RequestDispatcher also your using DOM on body load display:none. it will not display after loading, because whole page refreshed here.
Remove the function bodyLoad() instead of this, write in-line style on div. For eg:-

//your dom goes here

A: Kindly try below code it will run perfectly in your system.
JSP code:-
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page import="task.STP"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Stored Procedure</title>

    <form name="stp" action="STP">

        ID:<input type="text" name="ID">
 Name:<input
            type="text" name="Name">
 Branch:<input type="text"
            name="Branch">
 MobileNo:<input type="tel"
            name="Mobile">
 <input type="button" value="Submit"
            onclick="show()">
    </form>
    <%
        if (STP.display) {
    %>

        Id:<%=request.getAttribute("id")%>
 Name:<%=request.getAttribute("name")%>

        Branch:<%=request.getAttribute("branch")%>
 MobileNo:<%=request.getAttribute("mobile")%>

    <%
        }
    %>

servlet code:-
package task;

import java.io.IOException;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/STP")
public class STP extends HttpServlet {
    public static boolean display = false;
    static {
        try {
            Class.forName("com.mysql.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        int ID = Integer.parseInt(request.getParameter("ID"));
        System.out.println(ID);
        String Name = request.getParameter("Name");
        String Branch = request.getParameter("Branch");
        long Mobile = Long.valueOf(request.getParameter("Mobile"));
        try {

            Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/vikas", "root", "root");

            CallableStatement cs = con.prepareCall("{call Procedure3(?,?,?,?)}");
            cs.setInt(1, ID);
            cs.setString(2, Name);
            cs.setString(3, Branch);
            cs.setLong(4, Mobile);

            cs.execute();
            int id = cs.getInt(1);
            String name = cs.getString(2);
            String branch = cs.getString(3);
            long mobile = cs.getLong(4);
            request.setAttribute("id", ID);
            request.setAttribute("name", Name);
            request.setAttribute("branch", Branch);
            request.setAttribute("mobile", Mobile);
            display = true;
            request.getRequestDispatcher("index.jsp").forward(request, response);
            System.out.println(ID);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}


text:
Q: Removing many to many reference in Mongoose One of my mongoose schemas is a many to many relationship:
var UserSchema = new Schema({
   name       : String,
   groups  : [ {type : mongoose.Schema.ObjectId, ref : 'Group'} ]
});

var GroupSchema = new Schema({
   name       : String,
   users  : [ {type : mongoose.Schema.ObjectId, ref : 'User'} ]
});

If I remove a group, is there anyway to remove that group objectId from all the user's 'groups' array?
GroupSchema.pre('remove', function(next){
    //Remove group._id from all the users
})

A: You're on the right track to use 'remove' middleware for this.  In the middleware function, this is the group instance being removed and you can access the other models via its model method.  So you can do something like:
GroupSchema.pre('remove', function(next){
    this.model('User').update(
        {_id: {$in: this.users}},
        {$pull: {groups: this._id}},
        {multi: true},
        next
    );
});

Or if you want to support cases where the users field in your group instance may not be complete you could do:
GroupSchema.pre('remove', function(next){
    this.model('User').update(
        {groups: this._id},
        {$pull: {groups: this._id}},
        {multi: true},
        next
    );
});

But as WiredPrairie notes, for this option you'd want an index on groups for good performance.

A: I use my patched version of mongoose-relationship "plugin" to solve this: take a look on
https://github.com/begrossi/mongoose-relationship/tree/remove-from-parent-if-removed-from-child-set.
Bruno Grossi


text:
Q: Cocoa: How to remove invalid character from a string to create a directory I am new to mac os x and cocoa. I have a NSString and want to ensure that characters in it are not invalid, so that when I create a folder name with NSString it should be created and not fail because if invalid characters. or Is there a library function in cocoa to help this situation?

A: The only characters disallowed in filenames on unixy-systems are '/' and '\0'.  Macs usually have HFS+ filesystems, so I'd stay away from ':', too.
There are plenty of other characters that are perfectly allowable but will make you wail and cry and gnash your teeth, so whitelisting a set of "reasonable" characters might be a better way to go.


text:
Q: Difference between NVMe queuing interface and PCIe queuing interface Can any please let me know the difference between the two.
Please provoide relavent links if any .

A: I'm just learning this stuff but from what I am reading:
The maximum size of the Admin Completion Queue is 4096 entries. This is a 0's based value. The maximum size of the Admin Submission Queue is 4096 entries. This is a 0's based value. (NVM-Express 1.1)
however The maximum number of elements is 255 for administrator IQs and administrator OQs. http://www.t10.org/cgi-bin/ac.pl
so I am sure there are lots of other differences


text:
Q: Is there a way to get the mean of only certain values in a data frame rather than whole rows or columns?
I need to get the mean of specific values such as at coordniate points [1,1] [1,5] [1,9] so it would be absorbance_one_norm value at row 1 5 and 9
Would it make more sense to create a new data frame? Not sure how to grab specific values by doing that or just using a mean function. Any help is appreciated
An example of the output I want would be a new data frame with mean values
absorbance_1_mean,  absorbance_2_mean
.33333              .3333
.33333               .33333
.3333                .3333

Edit: I am new to r so please be kind

A: We can use row/column index to extract the elements and get the mean
mean(df1[cbind(c(1, 1, 1, 2, 2, 2), c(1, 5, 9, 1, 5, 9))])

A: If you want the mean for the same rows across columns, the following (using base R) will work by subsetting the rows and then taking the means of each row.
library(tibble)
# Make example data
df <- tibble(!!!lapply(1:10, function(x) runif(100)),
             .name_repair = ~paste0("absorbance", 1:10))
# Make vector containing desired rows
desired_rows <- c(1, 5, 9)
# Take the mean down each column
apply(df[desired_rows, ], 2, mean)


text:
Q: Отфильтровать объект JS Есть объект с вложениями, нужно отфильтровать его ветки по нужному значению в листе.
Дано:
let data = '[{"caption":"Настройки","commands":[{"caption":"Основные","commands":[{"caption":"Цены"},{"caption":"Типы цен"},{"caption":"Первичные документы"},{"caption":"Настройка отображения ТМЦ в первичных документах"},{"caption":"Настройка первичных документов"}]},{"caption":"Общие настройки","commands":[{"caption":"Глобальные настройки"},{"caption":"Типы процессов"},{"caption":"Тип процесса (функция)"},{"caption":"Нумераторы"},{"caption":"Тип нумератора"},{"caption":"Нумератор"},{"caption":"Календарь"},{"caption":"Тип календаря"},{"caption":"Рабочий календарь"},{"caption":"Сервисы"},{"caption":"Заполнение пустых кодов"},{"caption":"Заполнить RTClass"}]}]}]';

Ожидается
let dataRES = '[{"caption":"Настройки","commands":[{"caption":"Основные","commands":[{"caption":"Первичные документы"}]}]}]';

То, что набросал, но почему-то не получается

let data = '[{"caption":"Настройки","commands":[{"caption":"Основные","commands":[{"caption":"Цены"},{"caption":"Типы цен"},{"caption":"Первичные документы"},{"caption":"Настройка отображения ТМЦ в первичных документах"},{"caption":"Настройка первичных документов"}]},{"caption":"Общие настройки","commands":[{"caption":"Глобальные настройки"},{"caption":"Типы процессов"},{"caption":"Тип процесса (функция)"},{"caption":"Нумераторы"},{"caption":"Тип нумератора"},{"caption":"Нумератор"},{"caption":"Календарь"},{"caption":"Тип календаря"},{"caption":"Рабочий календарь"},{"caption":"Сервисы"},{"caption":"Заполнение пустых кодов"},{"caption":"Заполнить RTClass"}]}]}]';

function f(data, searchValue) {
  return data.filter((item) => {
    if (item.commands) {
      let res = f(item.commands, searchValue);
      if (res.length > 0) {
        return res
      }
    } else {
      if (item.caption.toLowerCase() === searchValue.toLowerCase()) {
        return item.caption;
      }
    }
  })
}

let dd = JSON.parse(data);
console.log('dd', dd);
let newArr = f(dd, 'Первичные документы');
console.log('>>>newArr', newArr);


text:
Q: Want to know C# .Dot net MVC Helper Class css file Location I have made a custom HTML CSS file and pasted in view of MVC. I had successfully replaced all the HTML tags with Helper classes like TextBoxfor, so that it could be tightly bonded with model. But after doing that it is also adding its CSS file, which inturn disturbing my custom HTML browser page. I am unable to trace the location of CSS file related to Helper Classes.
"Can any one tell me where the Helper Classes are taking its own CSS or in which folder does the CSS of Helper Classes are present."


text:
Q: Php's shell_exec() and apache I'm running a ZMQ 'push' interface via Ratche on an Apache server, which works very well on the command line, interacting with my server exactly the way I'd like. Here's the code
//script1.php
<?php
echo exec('php script2.php');
?>

//script2.php
<?php
        $entryData = array(
        'category' => 'modelLmdap'
      , 'job_id'    => '1234'
      , 'text'    => ''
      , 'status'    => ''
    );
    $context = new ZMQContext();
    $socket = $context->getSocket(ZMQ::SOCKET_PUSH, 'my pusher');
    $socket->connect("tcp://localhost:5555");
        $socket->send(json_encode($entryData));
?>

When I execute script1.php I see a popup in my server window saying 'request logged'. However, if I try to run it via a browser I get a blank page and no output on the server.
I looked around this may be due to Apache not being able to run at the command line and a solution is to add the following to my sudoers (using sudo visudo):
www-data ALL=NOPASSWD: ALL

Still nothing! A blank page. I switched the command to exec() and I get this error:

Fatal error: Class 'ZMQContext' not found in
  /home/username/server/qap/v2/tools/push.php on line 8

Any ideas?
EDIT: I've been asked why I want to do all this, which is a solid question.
TL;DR I can't think of a way to execute another php script as a service – curl isn't working locally and include doesn't cut it.
I'm performing a number of complex statistical calculations which require a lot of resources and take far too much time to produce any output, resulting in peculiar script execution problems including blank pages for no reason (even when I've extended the max script execution time) and AJAX errors despite timeouts being maxed. So I'm farming out the calculations on the server-side to a number of different background processes, all of which are php scripts. This also allows me to update the user as this long script executes. The call in question is to execute a 'controller' script which controls the calculation farm (is that the right terminology? Idk). The script then communicates with a Push server (via ZMQ) and pushes out the data to the clients. The original code was AJAX heavy and I really didn't fancy updating ALL of it to use websockets so I've settled for a 'push' type style using Ratchet as the socket server. This means I can make my original AJAX call to start the whole process and the page then receives updates from the server, one-way. This has a lot of advantages, my favourite is that the communication is inherently one-way which stops me having to implement lots of security features on the server's end. Unfortunately, in order for this all to work the Ajax-ed script needs to be able to shell_exec the 'farm' scripts as they need to run as background processes, which is how I ran into my problem. I've tried curl(), but it just grabs the bare text and include() will just result in the other scripts being run as part of the ajax-ed script which defeats the whole point. I guess long-term I could modify the 'push' server to be fully duplex, allowing the initial data to be transmitted from the web-page straight to an asynchronous 'farm server' (I know ReactPHP is capable of this, as is node.js), but as a n00b to socket server programming I thought it best to avoid it until I can complete a working model.
If there's anything I've missed then let me know, I hate insecure websites just as much as you!

A: Ok, I've solved it!
The problem was due to the fact that there are a number of different PHP versions installed on the system (I ported over the system from a shared hosting domain to the private server, carrying all the associated baggage). Apache was using php5.4 and ZMQ was installed on 5.6.
I renamed all the php 5.4 folders to php54_old and created a link to all the relevant php 5.6 folders (sudo ln -s /etc/php56 /etc/php54). I believe this in conjunction with its sudo permissions (above) allowed it to work, although I will test whether it works without sudo permissions when I deploy the site. I'm not comfortable, for many reasons, with Apache having sudo permissions - in the interim I've limited Apache's sudo permissions to only executing php.
EDIT: Oh, and I also uninstalled and re-installed both the ZMQ PEAR package and the zmq php wrapper.


text:
Q: Unable to call an interceptor before MultipartResolver in Spring In my spring-3 application I have an AuthenticationInterceptor (which is basically an interceptor) that checks for the privileges for a user. I am using a Spring's MultipartResolver to try an upload a file to the server.
The problem that I now face is that I wish to perform different actions based on user privileges, in case of a MaxUploadSizeExceededException.
However I see that this exception is occurring at the DispatcherServlet level and is caught by HandlerExceptionResolver
I want to be able to call my AuthenticationInterceptor before any of this happens?
Is there a straightforward way.

A: The problem is that the exception occurs BEFORE the request is dispatched to a controller and because of that, your interceptor also never fires.  I guess you have that part figured out already.
Want to get around that...
For starters, I would move the authentication mechanism out IN FRONT of the servlet by using servlet filters.  This being said, it makes little or no sense to roll your own solution in that space when a great product like Spring Security can do that for you.
Once you transition to Spring Security (or similar), the user's SecurityContext (roles, permissions, etc.) will have been resolved by the time the exception occurs and is caught.
Now, if I'm reading your question correctly, it seems you might like to respond to the exception differently based on the user's roles, permissions, etc.  That should be possible at this point.  You'd implement a custom HandlerExceptionResolver that inspects the SecurityContext to see if the user has a certain role or permission and then respond accordingly.
Hope that helps!

A: There are two basic ways to handle doing something in-stream before the Handler code gets called:

*

*Implement the HandlerInterceptor interface, and code the code you want to run in the preHandle method

*Create an Aspect using @Aspect and configure a pointcut to run @Before the method call

In either case, you could check the logged-in user's Roles using SecurityContextHolder.getContext().getAuthentication().getAuthorities() and then decide what to do based on Role membership.


text:
Q: Converting decision problems to optimization problems? (evolutionary algorithms) Decision problems are not suited for use in evolutionary algorithms since a simple right/wrong fitness measure cannot be optimized/evolved. So, what are some methods/techniques for converting decision problems to optimization problems?
For instance, I'm currently working on a problem where the fitness of an individual depends very heavily on the  output it produces. Depending on the ordering of genes, an individual either produces no output or perfect output - no "in between" (and therefore, no hills to climb). One small change in an individual's gene ordering can have a drastic effect on the fitness of an individual, so using an evolutionary algorithm essentially amounts to a random search.
Some literature references would be nice if you know of any.

A: Application to multiple inputs and examination of percentage of correct answers.
True, a right/wrong fitness measure cannot evolve towards more rightness, but an algorithm can nonetheless apply a mutable function to whatever input it takes to produce a decision which will be right or wrong. So, you keep mutating the algorithm, and for each mutated version of the algorithm you apply it to, say, 100 different inputs, and you check how many of them it got right. Then, you select those algorithms that gave more correct answers than others. Who knows, eventually you might see one which gets them all right.
There are no literature references, I just came up with it.

A: Well i think you must work on your fitness function.
When you say that some Individuals are more close to a perfect solution can you identify this solutions based on their genetic structure?
If you can do that a program could do that too and so you shouldn't rate the individual based on the output but on its structure.


text:
Q: Для чего нужен m4 макропроцессор? Прочитал все возможные статьи, но так и не понял. Зачем это нужно?
A: Что такое препроцессор в С и С++ понимаете? Что такое макросы понимаете? Так m4 - тот же препроцессор, только значительно более мощный.


text:
Q: my pagination laravel is weird( i dont know to tell in english my english is suck) so I recently learn how to use Laravel for my class project, and heres my problem
when I create pagination the result in my project is <
                                                      .1
                                                      >
like that, the pagination is not styled and the pagination like the picture I upload, I have done everything I could do , I browse the internet too, and the result is null , thanks  heres the picture of my problem
       $no = 1 {{-- buat nomor urut --}}
                )
            @if ($forms->count() > 0)
            @foreach ($forms as $angs)

    {{ $no++ }}

    {{ $angs->username }}

    {{ $angs->nama }}

    {{ $angs->nik}}

    {{ $angs->status_aktif}}

id }}">Detail | Edit | Hapus

@endforeach
 {{ $forms->links()}}

`
this is my code in blade
and this is my code in my controller
`
        $forms= login::paginate(3);
return view('crud.form.viewMember', compact('forms'));

`


text:
Q: Get posts on page by others on FB API v2 I'm really struggling with Facebook's new v2 API.
I want to write a cron job to fetch messages posted to my facebook page wall by others. This will be for competition entries, they post a message/link on the company wall and the cron job picks this up as an entry.
The documentation is all over the place, do I have to get an app token via manage_pages scope and hard code this into my app? What happens every x days when this expires, do I really have to manually generate it again and update my cron jobs every x days!? If so how is this sustainable?
I'm using
$request = new FacebookRequest( $session, 'GET', '/207072886058771/feed' );
But this only works if I manually click a "login" button every time I load this cron in my browser.

A: OK I was able to do a CURL request to:
https://graph.facebook.com/207072886058771/feed?access_token=APP_ID|APP_SECRET
This returns a list of all posts on the page, then a simple check to make sure from->id != PAGE_ID will give you posts by others.


text:
Q: How to make https work at nodejs and vue.js I have a site written in Laravel and Vue.js, nodejs is also used. When I try to enter the site using the http protocol, everything is fine, when I try to enter the https protocol, half of the site does not load and in the console I get an error:
Access to XMLHttpRequest at 'https://example.com:8443/socket.io/?EIO=3&transport=polling&t=NPIJFIo' from origin 'https://example.com' has been blocked by CORS policy: No 'Access- Control-Allow-Origin 'header is present on the requested resource.

Redirection to https is configured on nginx itself, but I cannot do it on nodejs. Also i can't understand, how to correct add ssl cert path to my app.js.
My app.js:
const app = require('express')(),
server = require('https').createServer(app),
Redis = require('redis'),
RedisClient = Redis.createClient(),
io = require('socket.io')(server),
cors = require('cors'),
axios = require('axios');

const myArgs = process.argv.slice(2);
const domain = myArgs[0];
const SECRET_KEY = 'cZN^ZH8)mu~9e,>6M>3qKV=Ar^fFF,7/';

axios.defaults.baseURL = 'https://example.com/api/bot/';

server.listen(8081);

app.use(cors({
    origin: true,
    credentials: true
}));

What am I doing wrong? I would be grateful for help.

A: It's the CORS issue, and you need to add cors option for the socket.io server.
Refer to Handling CORS for Socket.io.
io = require('socket.io')(server, {
  cors: {
    origin: '*'
  }
});


text:
Q: Django like middleware for Zope Is there something similar to Django Middleware in Zope? What I want is, to check and validate all the request coming to Zope server to put some constraints on them and show the response accordingly.
I have done this previously in Django using Middleware, so was hoping to get something similar for Zope as well, but could not find it.
Please suggest.

A: You can use zope.schema based libraries like formlib or z3c.form to model forms.
Widget/form generation and validation is basically kind of build-in and can be customized as needed.

A: No, Zope 2 does not support WSGI middleware, at least, not out of the box.
You could try and see if repoze.zope2 works for your use-case, as that bolts a WSGI pipeline on top of Zope 2. Note that development for that package stopped in 2009, and the last released version only supports Zope 2.10. YMMV.
I suspect that your use-cases may be satisfied in other ways though, but you don't provide enough detail for us to help you.


text:
Q: php using live server as oppose to local server despite virtual host settings I had planned on migrating a website to another server,
So having copied the code and database etc, and changed my hosts file on windows, everything worked almost as expected. I could load the site and use it away for testing prior to repointing the domain,
However there is one piece of functionality that uses a php library that finds image urls in html code. Because of this I must use external http urls to access the images, even though the images are on the same server.
My issue,
Even though everything else about the site is using the new local server, this piece of code is still looking at the live server as if no virtual host settings were set up for it.
In my /etc/sites-enabled/example.conf I have a virtual host set up...
<VirtualHost *:80>
ServerAdmin info@example.com
ServerName example.com
ServerAlias www.example.com

DirectoryIndex index.php
DocumentRoot /var/www/html/example

ScriptAlias /cgi-bin /var/www/html/example/cgi-bin/
<Location /cgi-bin>
Options +ExecCGI
</Location>

ErrorLog /var/www/html/example/error.log
CustomLog /var/www/html/example/access.log combined
</VirtualHost>

This is working as expected bar the one issue as described above, it seems to be ignoring it in that case.
I would be confident this would work if I changed the actual A records for that domain, but I need to test it first.
EDIT: Just to clarify more,
I am using Apache2 with Ubuntu.
My core question is,
When my php code is working with an image url, e.g. <img src="http://www.example.com/myimage.jpg" />, why only in one particular case is it loading this image from the REAL server that that domain is pointing to, and not the local server like everything else?

A: Because the PHP code is executing on the new server, not on your client.  Unless you make some change to the DNS configuration of that server (e.g. adding an entry to the hosts file), PHp will still believe (correctly) that www.example.com is on the live server.  PHP doesn't look into the apache configuration and has no knowledge that the server it's running on has an apache that will respond to www.example.com requests.


text:
Q: Admob ad not showing up in emulator or phone I am trying to place Admob ads in my app, and I followed all the instructions but it's not working.
AdView adView = new AdView(this, AdSize.BANNER, "My_ID");
    RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
    flashCardPage.addView(adView, lp);
    adView.loadAd(new AdRequest());

My manifest file contains the activty tag and the two permissions, just like the tutorial, but the banner does not show up on the screen. Interestingly, when I took out all the Admob stuff from my manifest file and ran the application, a banner shows up on the bottom of my screen saying I need to allow internet and network-state access. Does anyone know what I'm doing wrong? I know there are a lot of questions on this topic already, but none of them have helped. I tried changing my Admob account to test mode and adding the emulator as a test project, but that didn't work.
Should I try using another advertising method? It's been about a week and Admob ads still aren't showing up.
When I ran the app on my phone today (August 10), I got a forced close, so I'm thinking that if Admob causes that, even only 1%-5% of the time, I won't use it.

A: Ii might be the case that AdMob simply doesn't have ads to serve, you can try adding that piece of code after your adView declaration to see what it tells on fail to receive ad.
 // Set AdListener
        adView.setAdListener(new AdListener() {
            @Override
            public void onFailedToReceiveAd(Ad ad, ErrorCode error) {
                System.err.println("Ad failed: " + ad.toString() + error.toString());
            }

            @Override
            public void onReceiveAd(Ad ad) {
                System.out.println("Ad received: " + ad.toString());
            }
        });

A: Did you go back to your admob account to register your specific app for ads and get a new longer publisher number with the 'ca-app-pub-' preface instead of the 'pub-' preface?
Nowhere in the "banner ads 1" instructions on the Google Admob "Google Mobile Ads SDK" development site does it mention having to go back to your admob account to do this.
This stupid mistake held me up for days.

A: guys you also have to call this, for me this was the issue adding so that others can be helped.
mInterstitialAd.loadAd(new AdRequest.Builder().build());

without this it won't work, make sure to call this also.
full sample code
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.InterstitialAd;

public class MainActivity extends Activity {

    private InterstitialAd mInterstitialAd;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        MobileAds.initialize(this,
            "ca-app-pub-3940256099942544~3347511713");
        mInterstitialAd = new InterstitialAd(this);
        mInterstitialAd.setAdUnitId("ca-app-pub-3940256099942544/1033173712");
        mInterstitialAd.loadAd(new AdRequest.Builder().build());
    }
}

A: Check your log cat output for any debug messages from admob. It should say when a ad is requested or not loaded. Honestly, when I first started mine would hardly ever show an ad. Eventually they just started to show. No real explanation.

A: I would try just adding the ad xml first.  Also, make sure that you are set up to receive ads via admob.
See  Defining a com.google.ads.AdView.
Via admob, login, and go to Sites & Apps (here you can see if ads are really being sent to your app or not), scroll down to your app.  When you mouse over you app, you will see a button that says "Manage Settings".  Click it and then go to App Settings.  This will help you control how the ad appears and the refresh rate, etc.

A: This problem is solved by uninstalling the app manually and reinstalling again without making any changes!!


text:
Q: Cylinder shape image using Jhlabs image processing library I want to implement image processing in my project. I had used JLabs library. I want to do using this library following effects.
1) Deboss
2) Engrave
3) Satin etch
4) Custom shape like Cylinder.
This is sample image emboss code.
public class EmbossFilter
        extends WholeImageFilter {
    private static final float pixelScale = 255.9f;
    private float azimuth = 2.3561945f;
    private float elevation = 0.5235988f;
    private boolean emboss = false;
    private float width45 = 3.0f;

    public void setAzimuth(float azimuth) {
        this.azimuth = azimuth;
    }

    public float getAzimuth() {
        return this.azimuth;
    }

    public void setElevation(float elevation) {
        this.elevation = elevation;
    }

    public float getElevation() {
        return this.elevation;
    }

    public void setBumpHeight(float bumpHeight) {
        this.width45 = 3.0f * bumpHeight;
    }

    public float getBumpHeight() {
        return this.width45 / 3.0f;
    }

    public void setEmboss(boolean emboss) {
        this.emboss = emboss;
    }

    public boolean getEmboss() {
        return this.emboss;
    }

    @Override
    protected int[] filterPixels(int width, int height, int[] inPixels, Rect transformedSpace) {
        int index = 0;
        int[] outPixels = new int[width * height];
        int bumpMapWidth = width;
        int bumpMapHeight = height;
        int[] bumpPixels = new int[bumpMapWidth * bumpMapHeight];
        int i = 0;
        while (i < inPixels.length) {
            bumpPixels[i] = PixelUtils.brightness(inPixels[i]);
            ++i;
        }
        int Lx = (int) (Math.cos(this.azimuth) * Math.cos(this.elevation) * 255.89999389648438);
        int Ly = (int) (Math.sin(this.azimuth) * Math.cos(this.elevation) * 255.89999389648438);
        int Lz = (int) (Math.sin(this.elevation) * 255.89999389648438);
        int Nz = (int) (1530.0f / this.width45);
        int Nz2 = Nz * Nz;
        int NzLz = Nz * Lz;
        int background = Lz;
        int bumpIndex = 0;
        int y = 0;
        while (y < height) {
            int s1 = bumpIndex;
            int s2 = s1 + bumpMapWidth;
            int s3 = s2 + bumpMapWidth;
            int x = 0;
            while (x < width) {
                int shade;
                if (y != 0 && y < height - 2 && x != 0 && x < width - 2) {
                    int NdotL;
                    int Nx = bumpPixels[s1 - 1] + bumpPixels[s2 - 1] + bumpPixels[s3 - 1] - bumpPixels[s1 + 1] - bumpPixels[s2 + 1] - bumpPixels[s3 + 1];
                    int Ny = bumpPixels[s3 - 1] + bumpPixels[s3] + bumpPixels[s3 + 1] - bumpPixels[s1 - 1] - bumpPixels[s1] - bumpPixels[s1 + 1];
                    shade = Nx == 0 && Ny == 0 ? background : ((NdotL = Nx * Lx + Ny * Ly + NzLz) < 0 ? 0 : (int) ((double) NdotL / Math.sqrt(Nx * Nx + Ny * Ny + Nz2)));
                } else {
                    shade = background;
                }
                if (this.emboss) {
                    int rgb = inPixels[index];
                    int a = rgb & -16777216;
                    int r = rgb >> 16 & 255;
                    int g = rgb >> 8 & 255;
                    int b = rgb & 255;
                    r = r * shade >> 8;
                    g = g * shade >> 8;
                    b = b * shade >> 8;
                    outPixels[index++] = a | r << 16 | g << 8 | b;
                } else {
                    outPixels[index++] = -16777216 | shade << 16 | shade << 8 | shade;
                }
                ++x;
                ++s1;
                ++s2;
                ++s3;
            }
            ++y;
            bumpIndex += bumpMapWidth;
        }
        return outPixels;
    }

    public String toString() {
        return "Stylize/Emboss...";
    }
}

How to achieve image effects using Jhlabs library or any other way please share with me.


text:
Q: coalesce not working in this example This is my minimum data:
    PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
    PREFIX rs: <http://www.SemanticRecommender.com/rs#>
    PREFIX mo: <http://www.musicontology.com/mo#>
    PREFIX  : <http://www.musicsemanticontology.com/mso#>

    mo:5th_symphony_for_beethoven a mo:GermanSymphony .
    :symphonyFestival2016 a rs:TemporalContext ; rs:appliedOnItems mo:GermanSymphony ; rs:canBeRecommendedFrom "2016-07-01T00:00:00-00:00"^^xsd:dateTime ; rs:canBeRecommendedUntil "2016-09-01T00:00:00-00:00"^^xsd:dateTime .

This is my query:
   PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rs: <http://www.SemanticRecommender.com/rs#>
PREFIX mo: <http://www.musicontology.com/mo#>
PREFIX  : <http://www.musicsemanticontology.com/mso#>

   SELECT ?item  ?resultForMe  ?matchedWeight ?defaultMatchedTemporalContext
    WHERE
      {
    values ?item {mo:5th_symphony_for_beethoven}
          VALUES ( ?defaultMatchedTemporalContext ?defaultNotMatchedTemporalContext ?defaultNoTemporalContext ) {( 2 0.5 1 )}
            ?temporalContext
                      rdf:type           rs:TemporalContext ; rs:appliedOnItems  ?itemClass .
                       OPTIONAl {       ?item     rdf:type           ?itemClass
            OPTIONAL { ?temporalContext rs:canBeRecommendedFrom  ?fromLimit }
            OPTIONAL { ?temporalContext rs:canBeRecommendedUntil  ?untilLimit  }
            OPTIONAL { ?temporalContext rs:hasWeightIfContextMatched  ?matchedWeight }
            OPTIONAL { ?temporalContext rs:hasWeightIfContextDoesNotMatch  ?unmatchedWeight }
     BIND(if(( (?fromLimit <= now()) && (now() <= ?untilLimit ) )  , coalesce (?matchedWeight, ?defaultMatchedTemporalContext),2 ) as ?resultForMe)
    }
}

This is the results;

Look at the resultForMe, it doesn't have any values, why? this is my question though the defaultMatchedTemporalContext has a value.
I gave you the so minimum data required, you can upload the data on your SPARQL store if you want, it is just 4 lines of rdf

A: PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rs: <http://www.SemanticRecommender.com/rs#>
PREFIX mo: <http://www.musicontology.com/mo#>
PREFIX  : <http://www.musicsemanticontology.com/mso#>

   SELECT ?item  ?resultForMe  ?matchedWeight ?defaultMatchedTemporalContext
    WHERE

{
    VALUES ?item {mo:5th_symphony_for_beethoven}
    VALUES ?defaultNoTemporalContext  { 1 }
    VALUES ?defaultMatchedTemporalContext { 2 }
    VALUES ?defaultNotMatchedTemporalContext { 0.5 }
    ?temporalContext
                      rdf:type           rs:TemporalContext ; rs:appliedOnItems  ?itemClass .
                       OPTIONAl {       ?item     rdf:type           ?itemClass.
 VALUES ?defaultMatchedTemporalContext { 2 }

            OPTIONAL { ?temporalContext rs:canBeRecommendedFrom  ?fromLimit }
            OPTIONAL { ?temporalContext rs:canBeRecommendedUntil  ?untilLimit  }
            OPTIONAL { ?temporalContext rs:hasWeightIfContextMatched  ?matchedWeight }
            OPTIONAL { ?temporalContext rs:hasWeightIfContextDoesNotMatch  ?unmatchedWeight }
     BIND(if(( (?fromLimit <= now()) && (now() <= ?untilLimit ) )  , coalesce (?matchedWeight, ?defaultMatchedTemporalContext) ,2 ) as ?resultForMe)
    }
}

The problem was that the values clause was in above clause than the bind, putting them in the same clause solves my problem


text:
Q: End of proof appearing in the next line I don't know why the end of the proof is being displayed on the next line, I want it to appear at the end of (iii)
\documentclass[11pt, a4paper]{report}
% \usepackage{eurosym}% you probably don't need this (most fonts have euro)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% \usepackage{amsmath} % you load this below
%%\usepackage{amsfonts} % you load this below
\usepackage{bm}
\usepackage{amsfonts, graphicx, verbatim, amsmath,amssymb}
\usepackage{color}
% \usepackage{lipsum} % only for demos
\usepackage{array}
\usepackage{setspace}% if you must (for double spacing thesis)
\usepackage{fancyhdr}
\usepackage{enumitem}
\usepackage{tikz}

%\setcounter{MaxMatrixCols}{10} 10 is teh default anyway
%TCIDATA{OutputFilter=Latex.dll}
%TCIDATA{Version=5.50.0.2953}
%TCIDATA{<META NAME="SaveForMode" CONTENT="1">}
%TCIDATA{BibliographyScheme=Manual}
%TCIDATA{LastRevised=Sunday, November 26, 2017 16:01:29}
%TCIDATA{<META NAME="GraphicsSave" CONTENT="32">}

% These are sort of OK, but better to use geometry package
% to set a consistent set of page dimensions
\setlength{\textheight}{22cm}\setlength{\textwidth}{16cm}
\setlength{\topmargin}{-1.5cm}
\setlength{\oddsidemargin}{-0.5cm}\setlength{\evensidemargin}{-0.5cm}
\setlength{\textheight}{24cm}\setlength{\textwidth}{16.5cm}
\setlength{\topmargin}{-1.5cm}
\setlength{\oddsidemargin}{0.5cm}\setlength{\evensidemargin}{0.5cm}

% This discards its argument, is that intended?
% \U{wibble}  is same as \U{zzzzz}
\providecommand{\U}[1]{\protect\rule{.1in}{.1in}}

\newtheorem{theorem}{Theorem}[section]
\newtheorem{acknowledgement}[theorem]{Acknowledgement}
\newtheorem{algorithm}[theorem]{Algorithm}
\newtheorem{axiom}[theorem]{Axiom}
\newtheorem{case}[theorem]{Case}
\newtheorem{claim}[theorem]{Claim}
\newtheorem{Theorem}[theorem]{Theorem}
\newtheorem{conclusion}[theorem]{Conclusion}
\newtheorem{condition}[theorem]{Condition}
\newtheorem{conjecture}[theorem]{Conjecture}
\newtheorem{Fact}[theorem]{Fact}

% Why all these variant corollary forms?
\newtheorem{corollary}[theorem]{Corollary}
%\newtheorem{corol}[theorem]{Corollary}
%\newtheorem{Corollary}[theorem]{Corollary}

\newtheorem{criterion}[theorem]{Criterion}

% why variant definition forms?
\newtheorem{definition}[theorem]{Definition}
%\newtheorem{Definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\newtheorem{exercise}[theorem]{Exercise}
% as above
\newtheorem{lemma}[theorem]{Lemma}
%\newtheorem{Lemma}[theorem]{Lemma}
\newtheorem{fact}[theorem]{Fact}
\newtheorem{lma}[theorem]{Lemma}
\newtheorem{notation}[theorem]{Notation}
\newtheorem{problem}[theorem]{Problem}
% as above
\newtheorem{proposition}[theorem]{Proposition}
%\newtheorem{prop}[theorem]{Proposition}
%as above
\newtheorem{Property}[theorem]{Property}
%\newtheorem{property}[theorem]{Property}
\newtheorem{remark}[theorem]{Remark}
\newtheorem{Comment}[theorem]{Comment}
\newtheorem{solution}[theorem]{Solution}
\newtheorem{summary}[theorem]{Summary}

% it would be better to use amsthm package for the theorem definitions
% That defines a more extensive proof environment
\newenvironment{proof}[1][Proof]{\textbf{#1.} }{\ \rule{0.5em}{0.5em}}
\newcommand{\ve}{\varepsilon}

%Better to use \mathrm than \text so it uses the same font in all contexts
\newcommand{\cvgpr}{\xrightarrow{\text{\upshape\tiny P}}}
\newcommand{\cvgdist}{\xrightarrow{\mathrm{d}}}
\newcommand{\G}{{\mathcal{G}}}

% \mathcal{K} not {\cal K}  %\cal not defined by default since 1993
%\newcommand{\Kx}{{\cal K}}
%\newcommand{\tod}{\to^{\cal D}}
\newcommand{\ls}{\limsup_{n\to\infty}}
\newcommand{\rE}{\mathbb{E}}
\newcommand{\A}{{\mathcal{A}}}
\newcommand{\rP}{\mathbb{P}}
\newcommand{\p}{{\mathbb{P}}}
\newcommand{\Z}{{\mathbb{Z}}}

% \mathrm{Be} not {\rm BeK}  %\cal not defined by default since 1993
%\newcommand{\Be}{{\rm Be}}
\newcommand{\re}{\mathrm{e}}
\newcommand{\ep}{\varepsilon}
%\newcommand{\Bin}{{\rm Bin}}
\newcommand{\qand}{\quad\mbox{and}\quad}
\newcommand{\quso}{\quad\mbox{so}\quad}
%\newcommand{\Nn}{{\bf N}}
%\newcommand{\St}{\underline{\rm S}}
%\newcommand{\Rt}{\underline{\rm R}}
%\newcommand{\It}{\underline{\rm I}}
%\newcommand{\one}{{\bf 1}}
\newcommand{\Ups}{{\Upsilon}}
\newcommand{\iu}{{i\mkern1mu}}
\newcommand{\II}{{\mathcal{I}}}
%\newcommand{\Var}{{\rm Var}}
%\newcommand{\var}{{\rm Var}}
%\newcommand{\Cov}{{\rm cov}}
%\newcommand{\cov}{{\rm cov}}
%\newcommand{\corr}{{\rm corr}}
%\newcommand{\lhs}{{\rm lhs}}
%\newcommand{\rhs}{{\rm rhs}}
\newcommand{\ra}{\rightarrow}
\newcommand{\I}{{\mathbf 1}}
\newcommand{\R}{{\mathbb R}}
\newcommand{\N}{{\mathbb N}}
\newcommand{\LL}{{\mathbb L}}
\newcommand{\E}{{\mathbb{E}}}
%\newcommand{\bin}{{\rm Bin}}
%\newcommand{\Pois}{{\rm Pois}}
%\newcommand{\Po}{{\rm Pois}}
%\newcommand{\Bi}{{\cal B}}
\newcommand{\ri}{\mathrm{i}}
\newcommand{\rd}{\mathrm{d}}
\newcommand{\XXi}{\Xi_{k,m}^{(n)}}
\newcommand{\xxi}{\bar{\xi}}
\newcommand{\qedhere}{{\diamond}}
\newcommand{\eqdef}{\stackrel{\mathrm{def}}{=}}
\newcommand{\eqdist}{\stackrel{\mathrm{D}}{=}}
\newcommand{\braket}[2]{{\langle{#1|#2}\rangle}}
\newcommand{\independent}{\perp}

% use amsmath package (that you have loaded) align environment, not eqnarray
%\newcommand{\bb}{\begin{eqnarray*}}
%\newcommand{\ee}{\end{eqnarray*}}
%\newcommand{\bbb}{\begin{eqnarray}}
%\newcommand{\eee}{\end{eqnarray}}
\newcommand{\F}{{\mathcal{F}}}
\newcommand{\qed}{$\diamond$}
\newcommand{\cross}{\mathbin{\tikz [x=1.4ex,y=1.4ex,line width=.075ex] \draw (0,0) -- (1,1) (0,1) -- (1,0);}}%
% \parindent 0pt % this is just low level version of following line
% \setlength{\parindent}{0pt}%
% use parskip package (if you must) to stop indent and put vertical space betwen paragraphs
% although most documents lok better with traditional typesetting with indentation and no vertical space
\usepackage{parskip}

%\newcommand{\forceindent}{\leavevmode{\parindent=3em\indent}}%eek

%\input{tcilatex}

\begin{document}
\begin{proposition}
If $\chi$ is the character of a representation $\rho$ of degree $n$, then
\begin{enumerate}[label=(\roman*)]
\item $\chi(1) = n$
\item $\chi(s^{-1}) = \chi(s)^*\quad for s \in G$ \qquad (where $*$ denotes complex conjugation)
\item $\chi(tst^{-1})=\chi(s) \quad for s,t \in G$
\end{enumerate}

\end{proposition}

\begin{proof}
\begin{enumerate}[label=(\roman*)]
\item We have $\rho(1) = 1$, and $Tr(1)=n$ since $V$ has dimension $n$.
\item $\rho(s^\alpha)=I$ for $\alpha$ large enough. It follows that the eigenvalues $\lambda_i$ of $\rho_s$ are roots of unity. Now with $*$ complex conjugation we have:
\[
\chi(s)^* = Tr(\rho_s)^* = \sum \lambda_i^* = \sum \lambda^{-1} = Tr(\rho_s^{-1}) = Tr(\rho_{s^{-1}}) = \chi(s^{-1})
\]
\item Using the widely known formula, $Tr(ab)=Tr(ba)$ the result follows.
\end{enumerate}
\end{proof}

\end{document}

EDIT: using the amsthm package:
\documentclass[11pt, a4paper]{report}
% \usepackage{eurosym}% you probably don't need this (most fonts have euro)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% \usepackage{amsmath} % you load this below
%%\usepackage{amsfonts} % you load this below
\usepackage{bm}
\usepackage{amsfonts, graphicx, verbatim, amsmath,amssymb, amsthm}
\usepackage{color}
% \usepackage{lipsum} % only for demos
\usepackage{array}
\usepackage{setspace}% if you must (for double spacing thesis)
\usepackage{fancyhdr}
\usepackage{enumitem}
\usepackage{tikz}
\usepackage{parskip}

%\setcounter{MaxMatrixCols}{10} 10 is teh default anyway
%TCIDATA{OutputFilter=Latex.dll}
%TCIDATA{Version=5.50.0.2953}
%TCIDATA{<META NAME="SaveForMode" CONTENT="1">}
%TCIDATA{BibliographyScheme=Manual}
%TCIDATA{LastRevised=Sunday, November 26, 2017 16:01:29}
%TCIDATA{<META NAME="GraphicsSave" CONTENT="32">}

% These are sort of OK, but better to use geometry package
% to set a consistent set of page dimensions
\setlength{\textheight}{22cm}\setlength{\textwidth}{16cm}
\setlength{\topmargin}{-1.5cm}
\setlength{\oddsidemargin}{-0.5cm}\setlength{\evensidemargin}{-0.5cm}
\setlength{\textheight}{24cm}\setlength{\textwidth}{16.5cm}
\setlength{\topmargin}{-1.5cm}
\setlength{\oddsidemargin}{-0.1cm}\setlength{\evensidemargin}{-0.1cm}

% This discards its argument, is that intended?
% \U{wibble}  is same as \U{zzzzz}
\providecommand{\U}[1]{\protect\rule{.1in}{.1in}}

\newtheorem{theorem}{Theorem}[section]
\newtheorem{acknowledgement}[theorem]{Acknowledgement}
\newtheorem{algorithm}[theorem]{Algorithm}
\newtheorem{axiom}[theorem]{Axiom}
\newtheorem{case}[theorem]{Case}
\newtheorem{claim}[theorem]{Claim}
\newtheorem{Theorem}[theorem]{Theorem}
\newtheorem{conclusion}[theorem]{Conclusion}
\newtheorem{condition}[theorem]{Condition}
\newtheorem{conjecture}[theorem]{Conjecture}
\newtheorem{Fact}[theorem]{Fact}

% Why all these variant corollary forms?
\newtheorem{corollary}[theorem]{Corollary}
%\newtheorem{corol}[theorem]{Corollary}
%\newtheorem{Corollary}[theorem]{Corollary}

\newtheorem{criterion}[theorem]{Criterion}

% why variant definition forms?
\newtheorem{definition}[theorem]{Definition}
%\newtheorem{Definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\newtheorem{exercise}[theorem]{Exercise}
% as above
\newtheorem{lemma}[theorem]{Lemma}
%\newtheorem{Lemma}[theorem]{Lemma}
\newtheorem{fact}[theorem]{Fact}
\newtheorem{lma}[theorem]{Lemma}
\newtheorem{notation}[theorem]{Notation}
\newtheorem{problem}[theorem]{Problem}
% as above
\newtheorem{proposition}[theorem]{Proposition}
%\newtheorem{prop}[theorem]{Proposition}
%as above
\newtheorem{Property}[theorem]{Property}
%\newtheorem{property}[theorem]{Property}
\newtheorem{remark}[theorem]{Remark}
\newtheorem{Comment}[theorem]{Comment}
\newtheorem{solution}[theorem]{Solution}
\newtheorem{summary}[theorem]{Summary}

% it would be better to use amsthm package for the theorem definitions
% That defines a more extensive proof environment

\newcommand{\ve}{\varepsilon}

%Better to use \mathrm than \text so it uses the same font in all contexts
\newcommand{\cvgpr}{\xrightarrow{\text{\upshape\tiny P}}}
\newcommand{\cvgdist}{\xrightarrow{\mathrm{d}}}
\newcommand{\G}{{\mathcal{G}}}

% \mathcal{K} not {\cal K}  %\cal not defined by default since 1993
%\newcommand{\Kx}{{\cal K}}
%\newcommand{\tod}{\to^{\cal D}}
\newcommand{\ls}{\limsup_{n\to\infty}}
\newcommand{\rE}{\mathbb{E}}
\newcommand{\A}{{\mathcal{A}}}
\newcommand{\rP}{\mathbb{P}}
\newcommand{\p}{{\mathbb{P}}}
\newcommand{\Z}{{\mathbb{Z}}}

% \mathrm{Be} not {\rm BeK}  %\cal not defined by default since 1993
%\newcommand{\Be}{{\rm Be}}
\newcommand{\re}{\mathrm{e}}
\newcommand{\ep}{\varepsilon}
%\newcommand{\Bin}{{\rm Bin}}
\newcommand{\qand}{\quad\mbox{and}\quad}
\newcommand{\quso}{\quad\mbox{so}\quad}
%\newcommand{\Nn}{{\bf N}}
%\newcommand{\St}{\underline{\rm S}}
%\newcommand{\Rt}{\underline{\rm R}}
%\newcommand{\It}{\underline{\rm I}}
%\newcommand{\one}{{\bf 1}}
\newcommand{\Ups}{{\Upsilon}}
\newcommand{\iu}{{i\mkern1mu}}
\newcommand{\II}{{\mathcal{I}}}
%\newcommand{\Var}{{\rm Var}}
%\newcommand{\var}{{\rm Var}}
%\newcommand{\Cov}{{\rm cov}}
%\newcommand{\cov}{{\rm cov}}
%\newcommand{\corr}{{\rm corr}}
%\newcommand{\lhs}{{\rm lhs}}
%\newcommand{\rhs}{{\rm rhs}}
\newcommand{\ra}{\rightarrow}
\newcommand{\I}{{\mathbf 1}}
\newcommand{\R}{{\mathbb R}}
\newcommand{\N}{{\mathbb N}}
\newcommand{\LL}{{\mathbb L}}
\newcommand{\E}{{\mathbb{E}}}
%\newcommand{\bin}{{\rm Bin}}
%\newcommand{\Pois}{{\rm Pois}}
%\newcommand{\Po}{{\rm Pois}}
%\newcommand{\Bi}{{\cal B}}
\newcommand{\ri}{\mathrm{i}}
\newcommand{\rd}{\mathrm{d}}
\newcommand{\XXi}{\Xi_{k,m}^{(n)}}
\newcommand{\xxi}{\bar{\xi}}

\newcommand{\eqdef}{\stackrel{\mathrm{def}}{=}}
\newcommand{\eqdist}{\stackrel{\mathrm{D}}{=}}
\newcommand{\braket}[2]{{\langle{#1|#2}\rangle}}
\newcommand{\independent}{\perp}

% use amsmath package (that you have loaded) align environment, not eqnarray
%\newcommand{\bb}{\begin{eqnarray*}}
%\newcommand{\ee}{\end{eqnarray*}}
%\newcommand{\bbb}{\begin{eqnarray}}
%\newcommand{\eee}{\end{eqnarray}}
\newcommand{\F}{{\mathcal{F}}}

\newcommand{\cross}{\mathbin{\tikz [x=1.4ex,y=1.4ex,line width=.075ex] \draw (0,0) -- (1,1) (0,1) -- (1,0);}}%
% \parindent 0pt % this is just low level version of following line
% \setlength{\parindent}{0pt}%
% use parskip package (if you must) to stop indent and put vertical space betwen paragraphs
% although most documents lok better with traditional typesetting with indentation and no vertical space

%\newcommand{\forceindent}{\leavevmode{\parindent=3em\indent}}%eek

%\input{tcilatex}

\begin{document}
\newpage
\pagestyle{fancy}
\fancyhf{}
\fancyhead[EL]{\nouppercase\leftmark}
\fancyhead[OR]{\nouppercase\rightmark}
\fancyhead[ER,OL]{\thepage}

\maketitle
\chapter{Introduction}
%\bigskip
%\smallskip
\section{Definitions and prerequisites}
Let us recall some basic knowledge, we begin by giving some definitions.
%\medskip
\begin{definition}
A group is a set $G$ together with a binary operation $*$ on $G$ satisfying
the following properties:
\begin{enumerate}[label=(G\arabic*),series=group]
\item Closure: $\forall x,y \in G, x * y \in G$.
\item Associativity: $\forall x,y, z \in G, (x * y) * z = x * (y * z)$.
\item Identity: There is an element $e \in G$ such that $e * x = x * e = x$ for all $x \in G$.
\item Inverses: For any $x \in G$ there is an element $y \in G$ such that $x * y = y * x = e$.
\end{enumerate}
\end{definition}

\begin{definition}
A group $G$ is called an abelian group if the following axiom is satisfied:
\begin{enumerate}[label=(G\arabic*),resume=group]
\item Commutativity: $\forall x,y \in G, x * y = y * x$.
\end{enumerate}
\end{definition}
\end{document}

using amsthm, the spacing breaks down

A: Please remove your working example from all unnecessary clutter in order to get a MWE. To get things correct, do:

*

*load amsthm package

*remove \newcommand{\qed}{...}

*remove \newcommand{\qedhere}{...}

*remove \newcommand{\qed}{...}

*remove \newenvironment{proof}[1][Proof]{\textbf{#1.} }{\ \rule{0.5em}{0.5em}}
I felt free to remove some commands not used in the document, so the overall code looks like this:
\documentclass[11pt, a4paper]{report}
\usepackage{bm}
\usepackage{amsfonts, graphicx, verbatim, amsmath,amssymb, amsthm}
\usepackage{color}
\usepackage{array}
\usepackage{setspace}% if you must (for double spacing thesis)
\usepackage{fancyhdr}
\usepackage{enumitem}
\usepackage{tikz}

\newtheorem{theorem}{Theorem}[section]
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\newtheorem{exercise}[theorem]{Exercise}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}

\usepackage{parskip}

\setlength{\textheight}{22cm}\setlength{\textwidth}{16cm}
\setlength{\topmargin}{-1.5cm}
\setlength{\oddsidemargin}{-0.5cm}\setlength{\evensidemargin}{-0.5cm}
\setlength{\textheight}{24cm}\setlength{\textwidth}{16.5cm}
\setlength{\topmargin}{-1.5cm}
\setlength{\oddsidemargin}{0.5cm}\setlength{\evensidemargin}{0.5cm}

\begin{document}
\begin{proposition}
    If $\chi$ is the character of a representation $\rho$ of degree $n$, then
    \begin{enumerate}[label=(\roman*)]
        \item $\chi(1) = n$
        \item $\chi(s^{-1}) = \chi(s)^*\quad for s \in G$ \qquad (where $*$ denotes complex conjugation)
        \item $\chi(tst^{-1})=\chi(s) \quad for s,t \in G$
    \end{enumerate}
\end{proposition}

\begin{proof}
    \begin{enumerate}[label=(\roman*)]
        \item We have $\rho(1) = 1$, and $Tr(1)=n$ since $V$ has dimension $n$.
        \item $\rho(s^\alpha)=I$ for $\alpha$ large enough. It follows that the eigenvalues $\lambda_i$ of $\rho_s$ are roots of unity. Now with $*$ complex conjugation we have:
        \[
        \chi(s)^* = Tr(\rho_s)^* = \sum \lambda_i^* = \sum \lambda^{-1} = Tr(\rho_s^{-1}) = Tr(\rho_{s^{-1}}) = \chi(s^{-1})
        \]
        \item Using the widely known formula, $Tr(ab)=Tr(ba)$ the result follows.
    \qedhere
\end{enumerate}
\end{proof}
\end{document}

Note how to use \qedhere for what you asked.


text:
Q: How to convert text to Base58 on node.js? I want to convert a message like "Hello World" to base58 and then been able to decode it using node.js.Base-58 module has the below explanation but I can't exactly understand how to convert my message.
Base58.encode(a Buffer or Uint8Array) returns a String
Base58.decode(a String) returns a Buffer

I guess that I need to convert the message first to something else and then to base58.And to decode the base58 message, again, a conversion to something else is needed and from there to text, right?

A: To encode:
var message = "Hello World";
var codedString = Base58.encode(new Buffer(message));
console.log (codedString);

This encoded the message successfully
JxF12TrwUP45BMd

Then, to decode:
var decodedString = Base58.decode(codedString);
var buff = new Buffer(decodedString);
console.log(buff.toString('utf8'));

This decoded the message successfully
Hello World

A: var codedString = Base58.encode(new Buffer("Hello world"));

You will get it


text:
Q: How can i display a PDF file in an Android ImageView Is it possible to display huge pdf files in an Android view?
I just need to be able to display it, with pinch and zoom and other normal features that are implemented in ImageViews these days.

A: There are three open source libraries, which combined, will do what you want. All are licensed with Apache V2 (or the Beer-Ware License)!
Note that V21 or above is required. But you can use an if-statement and an Intent as fallback, if required.

*

*Subsampling-scale-image-view: "A custom image view for Android, designed for photo galleries and displaying huge images"

*Subsampling-pdf-decoder: "A pdf decoder library for the subsampling scale image view"

*VerticalViewPager: This is optional, but i think you want to scroll up and down and not left and right.

The example how to implement this, is given in the sample of the decoder library.
1.) Gradle dependencies
repositories {
  mavenCentral()
  jcenter()

  //decoder library, will soon be on jcenter
  maven { url 'https://dl.bintray.com/n42/maven'}
}

dependencies {
  compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.5.0'
  compile 'com.github.castorflex.verticalviewpager:library:19.0.1'
  compile 'de.number42:subsampling-pdf-decoder:0.1.0@aar'
}

2.) Implement a PagerAdapter, you can use this one
public class PDFPagerAdapter extends PagerAdapter {
  /**
   * context for the view
   */
  private Context context;

  /**
   * pdf file to show
   */
  private File file;

  /**
   * file descriptor of the PDF
   */
  private ParcelFileDescriptor mFileDescriptor;

  /**
   * this scale sets the size of the {@link PdfRenderer.Page} in the {@link
   * PDFRegionDecoder}.
   * Since it rescales the picture, it also sets the possible zoom level.
   */
  private float scale;

  /**
   * this renderer is only used to count the pages
   */
  private PdfRenderer renderer;

  /**
   * @param file the pdf file
   */
  public PDFPagerAdapter(Context context, File file) {
    super();
    this.context = context;
    this.file = file;
    this.scale = 8;
    try {
      mFileDescriptor = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);
      renderer = new PdfRenderer(mFileDescriptor);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }

  /**
   * Instantiate an item. Therefor a {@link SubsamplingScaleImageView} with special decoders is
   * initialized and rendered.
   *
   * @param container isn't used here
   * @param position the current pdf page position
   */
  public Object instantiateItem(ViewGroup container, int position) {

    SubsamplingScaleImageView imageView = new SubsamplingScaleImageView(context);

    // the smaller this number, the smaller the chance to get an "outOfMemoryException"
    // still, values lower than 100 really do affect the quality of the pdf picture
    int minimumTileDpi = 120;
    imageView.setMinimumTileDpi(minimumTileDpi);

    //sets the PDFDecoder for the imageView
    imageView.setBitmapDecoderFactory(() -> new PDFDecoder(position, file, scale));

    //sets the PDFRegionDecoder for the imageView
    imageView.setRegionDecoderFactory(() -> new PDFRegionDecoder(position, file, scale));

    ImageSource source = ImageSource.uri(file.getAbsolutePath());

    imageView.setImage(source);

    container.addView(imageView);
    return imageView;
  }

  /**
   * gets the pdf site count
   *
   * @return pdf site count
   */
  public int getCount() {
    return renderer.getPageCount();
  }

  @Override public void destroyItem(ViewGroup container, int position, Object view) {
    container.removeView((View) view);
  }

  @Override public boolean isViewFromObject(View view, Object object) {
    return view == object;
  }
}

3.) Initiate and set the adapter for the VerticalViewPager
VerticalViewPager pager = (VerticalViewPager) findViewById(R.id.pager);
File pdfFile = ....

PDFPagerAdapter pagerAdapter = new PDFPagerAdapter(this,pdfFile);
pager.setAdapter(pagerAdapter);

A: You can use webview for this and it is easy to implement. Do it like this
 @SuppressLint("NewApi")
    private void startWebView(String url) {

        // Create new webview Client to show progress dialog
        // When opening a url or click on link
        // Javascript inabled on webview
        web.getSettings().setJavaScriptEnabled(true);
        web.getSettings().setBuiltInZoomControls(true);
        web.getSettings().setDisplayZoomControls(false);
        web.getSettings().setLoadWithOverviewMode(true);
        web.getSettings().setUseWideViewPort(true);

        web.getSettings().setDomStorageEnabled(true);
        web.setWebChromeClient(new WebChromeClient());
//        web.getSettings().setPluginState(WebSettings.PluginState.ON);
        web.setWebViewClient(new WebViewClient() {
            ProgressDialog progressDialog;

            // If you will not use this method url links are opeen in new brower
            // not in webview
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                view.loadUrl(url);
                return true;
            }
            @SuppressWarnings("deprecation")
            @Override
            public void onReceivedError(WebView view, int errorCode, String description, final String failingUrl) {
                web.loadUrl("about:blank");

            }

            // Show loader on url load
            public void onLoadResource(WebView view, String url) {
               /* if (progressDialog == null) {
                    // in standard case YourActivity.this
                    if (getActivity() != null) {
                        progressDialog = new ProgressDialog(getActivity());
                        progressDialog.setMessage("Loading...");
                        progressDialog.show();
                    }

                }*/

            }

            public void onPageFinished(WebView view, String url) {
                try {
                    setProgressBar(false);
                } catch (Exception e) {

                }
            }

        });

        // Load url in webview
        web.loadUrl(url);

    }