text:
Q: How to link only the content of one row of a table to a column of another table? I have a table named videos. It has three columns id, title, tags. Since the tags of a video may be many, I create another table named videos_tags, which has id, life, school and activity as its columns, and the id of videos_tags should match the id of videos.
The table videos_tags is like this:
  id    life    school    activity
  123    0        1          0

My objective is to be able to fetch corresponding tags of a video. What I did was I gave the tag column in the table videos a number which should be the id of the table videos_tags, as follows
  id    title    tags
  1     avideo    123

So, I would get the tag reference id by the following:
SELECT tags FROM videos WHERE id=1

And then I would run the SELECT statement again to fetch the corresponding tags of the video by the id of the tag fetched in the table videos, as follows
SELECT * FROM videos_tags WHERE id=123

There we go, we have the tags we need.
My question is: is there a way to fetch tags by some kind of relational tables which, for example, use foreign keys, and will it simplify the query code further?
My concern is the approach I used had a weak connection between the tags in the table videos and the id of the table videos_tags, since when you modify, say, the id of the video_tags, the tags in videos will not change, which may cause a really huge problem to the program at some point.

A: You are failing to understand that:

*

*a Tag exists independent (of any Video that tags it)

*the relation for your Video::Tag is multiple, 1-to-n

*

*you have set it up for 3, and it is fixed

*where there are less than three Tags, you have NULLs

*you cannot add a Tag in future ... if you do, it will be heartache, structural change, and code changes.

As a result of that, you have made things far more complex than they really are.  As well as fixing the table in concrete (hard to change in the future), and when it does, everything, all code, has to change.

Possible duplicate of Recommended SQL database design for tags or tagging

Yes.  But the Accepted solution there is not Relational, and therefore it has none of the Integrity; Power; or Speed, of Relational systems.  I will take you step-by-step from what you appear to understanod, to the best design.
1960's Record Filing System • Degenerate & Deranged
If you follow the "literature" or "textbooks" or "articles" that are purported to be "relational", you will come up with this:

*

*All my data models are rendered in IDEF1X, the Standard for modelling Relational databases since 1993

*My IDEF1X Introduction is essential reading.

1960's Record Filing System • Degenerate
If you elevate it in the direction of Codd's Relational Model, while remaining in the physical Record Id mindset, which is what Yaakov Ellis means by "proper indices, etc" (I am giving you much more than that) ... we get this:

*

*This prevents duplicate rows (fundamental requirement in the RM)

*It removes duplicate declarations, and eliminates circular references and the horrendous consequences that that particular madness ensures

*This still has one additional Record Id and one additional index, per table, that is required to support the physical-isation of data using primitive records, which is totally unnecessary (these crutches are essential for intellectual cripples such as Date & Darwen and their followers).

*Of course, you can make up anything between the Deranged and the Degenerate, it still remains in the 1960's Record Filing System category, devoid of Relational capability.

Relational Database
Since you have tagged SQL & Relational Database, you may wish to tune out the black noise and follow Codd's Relational Model.  If you do, you will get this:

*

*Human users will not use a VideoId number.  The FullTitle is awfully long and cumbersome.  They will use a short title, which is missing in the primitive system

*Neither will they use TagId.  They want the Tag

*I have given the more relevant Predicates, so that you can check them for yourself

*Adding or deleting a Tag is effortless

*no structural changes in the future, and therefore no code changes.

SQL

My concern is the approach I used had a weak connection between the tags in the table videos and the id of the table videos_tags, since when you modify, say, the id of the video_tags, the tags in videos will not change, which may cause a really huge problem to the program at some point.

*

*Yes, all those concerns have vaporised.

*Removal of the Id fields and Normalising the Tags properly, eliminates that problem

*And the horrible two-step method is eliminated.

*One of the hallmarks of a genuine Relational database is that any report can be produced from a single SELECT command.

My question is: is there a way to fetch tags by some kind of relational tables which, for example, use foreign keys, and will it simplify the query code further?

Another hallmark is simple, straight-forward SQL code.  Given a Video title (the short one that people will naturally use), find the videos that have any of its Tags:
SELECT   VT.VideoTitle
    FROM VideoTitle VT      -- outer query
    WHERE Tag IN
    (SELECT VT_IN.Tag
        FROM VideoTag VT_IN -- inner subquery
        WHERE VT_IN.VideoTitle = @VideoTitle
        )

If you want to include the full title in the report:
SELECT   VT.VideoTitle,
         V.FullTitle
    FROM VideoTitle VT      -- outer query
    JOIN Video V
         ON VT.VideoTitle = V.VideoTitle
    WHERE Tag IN
    (SELECT VT_IN.Tag
        FROM VideoTag VT_IN -- inner subquery
        WHERE VT_IN.VideoTitle = @VideoTitle
        )


text:
Q: how to refresh the model after updating the content of it? After adding an item to a Json, I'm listing those items by calling them to a model. But the item takes some time to process (and get added to the array). How do I refresh the model (or the View) so that I don't need to hit refresh to update the list and view the new item listed?
I apologize for the rookieness of my question, I'm fairly new to ember. Thanks in advance for any help.
 model: function (transition) {

    return Ember.$.getJSON(ENV.apiUrl + 'get_feeds').then(
        function(response) {
            return response;
        })
            });
}

A: Create an Ember.Object to represent this model in your models folder (assuming Ember-CLI). In the then function of your $.getJSON, create an instance of this Ember.Object.
import Ember from 'ember';
import SomeModel from 'app_name/models/some-model';

export default Ember.Route.extend({
    model: function (transition) {

        return Ember.$.getJSON(ENV.apiUrl + 'get_feeds').then(
            function(response) {
                return SomeModel.create(response);
            });
    }
});

The create function takes a javascript object as its lone parameter and assigns all its properties to the object it's constructing. The advantage of using an Ember.Object as oppsoed to just a POJO is that Ember.Object extends the Observable mixin and thus two-way binding can be achieved. Meaning, if in your associated template, you have {{model.someProp}} and then asynchronously update your model's someProp via an ajax call (triggered however), the DOM will automatically update due to two way binding. Take advantage of the power Ember offers. Ember Data isn't necessary for this btw

redpajama_set_name: RedPajamaStackExchange


text:
Q: Creating children objects of not saved model in Backbone using Backbone-relational I'm new to backbone. I have rails3 app. These are my backbone models:
class AppName.Models.Order extends Backbone.RelationalModel
  paramRoot: 'order'

  relations: [
    type: Backbone.HasMany
    key: 'order_services'
    relatedModel: 'AppName.Models.OrderService'
    collectionType: 'AppName.Collections.OrderServicesCollection'
    includeInJSON: false
    reverseRelation:
      key: 'order_id',
      includeInJSON: 'id'
  ]

class AppName.Models.OrderService extends Backbone.RelationalModel
  paramRoot: 'order_service'

I have new order model which is not saved at server yet. How can I create new order_service as a child of that order, so I could access order with order_service.get('order')?
I need to build order step by step: add order_services, add other models, and then save the order. Is that possible to store locally not saved order with its order_services (which also have not saved children of other models) and then save all this stuff at server?


text:
Q: positive iterator design given an integer iterator
given an IntegerIterator (which implements hasNext, next, remove),
  implement a PositiveIterator that has hasNext, next, remove

Can anyone give some ideas for this problem? It's not a homework!
For example:
int[] a = new int[]{1,-2,-3,4,5,-6,7,-8,9};
IntegerIterator it = new IntegerIterator(a);
PositiveIterator iter = new PositiveIterator(it);
Console.WriteLine(iter.HasNext()); //true
Console.WriteLine(iter.HasNext()); //true
Console.WriteLine(iter.HasNext()); //true
Console.WriteLine(iter.Next()); //1
Console.WriteLine(iter.Next()); //4
Console.WriteLine(iter.Next()); //5

A: PositiveIterator.Next shouldn't be a problem. Just call Iterator.Next until the value is positive. PositiveIterator.Remove just needs a call to Iterator.Remove. PositiveIterator.HasNext is the reason why the code will be a bit ugly, since the given methods only allow unidirectional iteration.
class PositiveIterator:
    int next = -1 //holds the next value to return
    IntegerIterator iter //the integeriterator wrapped by this object

    PositiveIterator(IntegerIterator it)
        iter = it

        //search for the first positive value for next
        while iter.HasNext() AND ((next = iter.Next()) < 1)
            NOOP

    HasNext()
        return next != -1

    Next()
        //the current value to return
        int tmp = next

        //search for the next positive value
        while iter.HasNext() AND ((next = iter.Next()) < 1)
            NOOP

        if NOT iter.HasNext()
            next = -1 //no next positive value available

        return tmp

     Remove()
         if next == -1
             return

         iter.Remove()

         //update the next value
         next = Next()

Basically PositiveInteger needs to predict the value for the value that will be returned next.

A: This is pretty straight forward - override the constructor, HashNext() and Next() methods, such you will always have "in hand" the next positive value, while skipping all negative values.
Pseudo code:
class PositiveIterator:
    private int next = -1;
    private final Integer i;
    PositiveIterator(Itertor i):
          while (i.HashNext() && (next = i.Next()) <= 0) ;
          //at this point next holds the next positive element, if such exists
          this.i = i;
    boolean HasNext():
         return (next > 0)
    int Next():
         int tempVal = -1;
         while (i.HashNext() && (tempVal = i.Next()) <= 0) ;
         int res = next;
         next = tempVal;
         return next;

Note that at any point, in any method - next > 0 if and only if there is some positive element left in the array, and it will hold the next element you need t produce.


text:
Q: Logstash Create and Access Array I want to create an array in the logstash config file that is for devices and then access the array value by for a new field that I am creating. example:
filter {
     array_devicetype => ["Cisco ASA", "Cisco 3750"]
     mutate {
            add_field => { "Device Type" => "%{array_devicetype[0]}"
     }
}

Yet, no luck. Can someone help me out with this? Thanks.

A: If there is no any filter plugin can help you, you can try to use ruby and then do it yourself.
For example
filter {
    ruby {
            code => "
                    event['array_devicetype'] = ['Cisco ASA', 'Cisco 3750']
                    event['Device Type'] = event['array_devicetype'][0]
            "
    }
}

Use this filter can do what you want. FYI.


text:
Q: Struts 2 datetimepicker defaults to 31/12/1969 I face 2 issues while using struts 2 datetimepicker.
1. The value in datetimepicker field does not persist when the page is refreshed or when we click the back button from the next page
2. When an invalid date is entered in the field, the value defaults to 31/12/1969 or the previously selected date when the field loses focus.
Is there a way to overcome these?

A: You need to show us the relevant parts of the code you're using, so we can see the problem.  Note that 31 December 1969 (actually midnight UTC on 1 January 1970) is time 0 in Java(Script) and many other systems influenced by UNIX.


text:
Q: jetty startup errors with signer information errors Since I've set some maven dependencies to "provided" instead of "compile" scope I got this error when starting up jetty:

*

*JEE5 application

*should run on WebSphere 7 and Jetty 7

*Spring 3

The error:
java.lang.SecurityException: class "javax.servlet.ServletRequestListener"'s signer information does not match signer information of other classes in the same package
    at java.lang.ClassLoader.checkCerts(ClassLoader.java:806)
    at java.lang.ClassLoader.preDefineClass(ClassLoader.java:487)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:625)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:386)
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
    at org.eclipse.jetty.server.handler.ContextHandler.setEventListeners(ContextHandler.java:554)
    at org.eclipse.jetty.webapp.WebAppContext.setEventListeners(WebAppContext.java:946)
    at org.eclipse.jetty.webapp.WebAppContext.addEventListener(WebAppContext.java:972)
    at org.eclipse.jetty.webapp.TagLibConfiguration.preConfigure(TagLibConfiguration.java:492)
    at org.eclipse.jetty.webapp.WebAppContext.preConfigure(WebAppContext.java:418)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:454)
    at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:256)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
    at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:167)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
    at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:90)
    at org.eclipse.jetty.server.Server.doStart(Server.java:260)
    at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:65)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
    at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:511)
    at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:364)
    at org.mortbay.jetty.plugin.JettyRunMojo.execute(JettyRunMojo.java:516)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)

The maven section is:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <packaging>war</packaging>
    <artifactId>myApp.war</artifactId>
    <!--name??-->

    <parent>
        <groupId>com.example</groupId>
        <artifactId>myApp</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </parent>

    <properties>
        <java-version>1.5</java-version>
        <org.springframework-version>3.0.5.RELEASE</org.springframework-version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <org.aspectj-version>1.6.9</org.aspectj-version>
        <org.slf4j-version>1.6.1</org.slf4j-version>
        <cxf.version>2.5.2</cxf.version>
        <jetty.version>7.6.3.v20120416</jetty.version>
        <skipTests>true</skipTests>
        <log4j.version>1.2.15</log4j.version>
    </properties>

    <!-- … -->
             <plugin>
                 <groupId>org.mortbay.jetty</groupId>
                 <artifactId>jetty-maven-plugin</artifactId>
                 <version>${jetty.version}</version>

                 <dependencies>
                     <dependency>
                         <groupId>commons-dbcp</groupId>
                         <artifactId>commons-dbcp</artifactId>
                         <version>1.4</version>
                     </dependency>
                     <dependency>
                         <groupId>commons-logging</groupId>
                         <artifactId>commons-logging</artifactId>
                         <version>1.1</version>
                         <type>jar</type>
                     </dependency>
                 </dependencies>

                 <configuration>
                     <scanIntervalSeconds>5</scanIntervalSeconds>
                     <webAppConfig>
                         <contextPath>/</contextPath>
                     </webAppConfig>
                     <connectors>
                         <connector implementation="org.eclipse.jetty.server.bio.SocketConnector">
                             <port>8080</port>
                             <!-- this connector defaults to 1300 for some reason -->
                         </connector>
                     </connectors>
                     <!--
                     <useProvided>true</useProvided>
                     -->
                 </configuration>
             </plugin>

Can't get the cause. Any hints welcome ;)

A: It looks as though you are including the servlet API as a provided dependency, and adding this to Jetty's classpath. This is colliding with Jetty's own bundled servlet API classes and causing the exception.
It is absolutely correct to include the servlet API as a provided dependency- the problem is in the <useProvided> parameter in the plugin configuration, which is adding the servlet API to the classpath. It would be better to exclude this, and, if you have any other dependencies with provided scope that aren't already in Jetty, then add them to the plugin dependencies, as you have done with commons-dbcp.
See also the comments in http://jira.codehaus.org/browse/JETTY-429, which discuss similar potential confusions.

A: I've had similar problem with javax.servlet because there were both 2.4 an 3.0.0 jar-versions in Eclipse Libraries/Maven Dependencies.
To fix it in Eclipse open project's pom.xml, Dependency hierarchy tab, filter by "servlet", choose (right mouse button) unnecessary 2.4(or 2.5) and "Exclude Maven Artifact ..." Thanks to Valery Gorbunov for the hint :)

A: I removed the
             <dependency>
                 <groupId>commons-logging</groupId>
                 <artifactId>commons-logging</artifactId>
                 <version>1.1</version>
                 <type>jar</type>
             </dependency>

in jetty and now it works...seems to another Logger implementation conflicts with commons-logging?! Didn't get the clue yet but for now...it works... Sometimes maven and java are not the best friends or I'm too stupid ;)


text:
Q: Angular custom cookie not sent in headers? I am using Angular and the package NGX Cookie Service to create custom cookie in the front end. And I want it to be attached in the HTTP Request when sending such to the backend.
This is how I set it in the browser:
 private SetCookieAfterLogin() {
        let cookie = this.loginOutput.Token;
        this.cookieService.set('authCookie', cookie, { sameSite: 'Lax'});
    }

And when I try to execute this http method which calls the API:
getAllUsers(): Observable<any> {
        return this.httpClient.get<IGetUserModel[]>(this.getAllUsersUrl, {withCredentials:true}).
        pipe(
            tap(data => console.log('All:',JSON.stringify(data))),
            catchError(this.handleError)
        );
    }

... while inspecting the HTTP Request headers, the cookie was not attached. Is this a normal behavior? If so - what are the rules: which cookies are attached and which are not? Should I  use HTTP Interceptor?
Both the APIs and the frontend client run on localhost for now, but different ports, if this matters for the cookie and its options.

A: The problem was actually in my code. No cookie was created, because of empty data in this.loginOutput.Token due to async. This is now fixed and my cookie is properly inside the headers. Thank you.


text:
Q: pass array of join to query in laravel I have issue with my query. My sample  query is as below
$answers = DB::table('IC2017_AY')
        ->join('IC2017', 'IC2017_AY.UNITID', '=', 'IC2017.UNITID')
        ->join('SFA1617_P1', 'IC2017_AY.UNITID', '=', 'SFA1617_P1.UNITID')
        ->join('cost', 'IC2017_AY.UNITID', '=', 'cost.UNITID')
        ->join('gpa', 'IC2017_AY.UNITID', '=', 'gpa.UNITID')
        ->join('enrollment', 'IC2017_AY.UNITID', '=', 'enrollment.UNITID')
        ->join('major', 'IC2017_AY.UNITID', '=', 'major.UNITID')
        ->join('preference', 'IC2017_AY.UNITID', '=', 'preference.UNITID')
        ->select('IC2017_AY.TUITION2 as in_state_tuition','IC2017_AY.FEE2 as in_state_fee','IC2017_AY.TUITION3 as out_state_tuition','IC2017_AY.FEE3 as out_state_fee','IC2017_AY.CHG4AY3 as books_supplies','IC2017_AY.CHG6AY3 as other_expenses','IC2017.ROOMAMT as room_charge','IC2017.BOARDAMT as board_charge','IC2017.RMBRDAMT as combined_charge','SFA1617_P1.SCUGRAD as total_receiving','SFA1617_P1.SCUGFFN as full_time_receiving','SFA1617_P1.UAGRNTN as total_receiving_grant')
        ->where($where_data);
        ->get();

but now I want to pass the array of join because joins will be decided at run time something like this
below code is just the example.
$joins = [
['country', 'user_master.country_id', '=', 'country.country_id'],
['city', 'user_master.city_id', '=', 'city.city_id'],
['login_master', 'user_master.user_id', '=',
'login_master.user_id'],
];

How  can I do this in laravel 5.8
thanks in advance.!

A: You can use foreach loop for example:
$joins = [
['country', 'user_master.country_id', '=', 'country.country_id'],
['city', 'user_master.city_id', '=', 'city.city_id'],
['login_master', 'user_master.user_id', '=',
'login_master.user_id'],
];

$answers = DB::table('IC2017_AY')
        ->join('IC2017', 'IC2017_AY.UNITID', '=', 'IC2017.UNITID')
        ->join('SFA1617_P1', 'IC2017_AY.UNITID', '=', 'SFA1617_P1.UNITID')
        ->join('cost', 'IC2017_AY.UNITID', '=', 'cost.UNITID')
        ->join('gpa', 'IC2017_AY.UNITID', '=', 'gpa.UNITID')
        ->join('enrollment', 'IC2017_AY.UNITID', '=', 'enrollment.UNITID')
        ->join('major', 'IC2017_AY.UNITID', '=', 'major.UNITID')
        ->join('preference', 'IC2017_AY.UNITID', '=', 'preference.UNITID');

foreach($joins as $key=>$value){
$answer = $answer->join(implode(",",$value));
}

return $answer->select('IC2017_AY.TUITION2 as in_state_tuition','IC2017_AY.FEE2 as in_state_fee','IC2017_AY.TUITION3 as out_state_tuition','IC2017_AY.FEE3 as out_state_fee','IC2017_AY.CHG4AY3 as books_supplies','IC2017_AY.CHG6AY3 as other_expenses','IC2017.ROOMAMT as room_charge','IC2017.BOARDAMT as board_charge','IC2017.RMBRDAMT as combined_charge','SFA1617_P1.SCUGRAD as total_receiving','SFA1617_P1.SCUGFFN as full_time_receiving','SFA1617_P1.UAGRNTN as total_receiving_grant')
        ->where($where_data);
        ->get();


text:
Q: How can I serialize std::vector (details is a struct.) I have a struct in c++11 , like:
struct objectv1 {
        matrix<float, 0, 1 > obj_descriptor;
        string person_name;
        matrix<rgb_pixel> p_obj_chip;
        string notes;

    };

and than:
std::vector<objectv1> object_deteails;

and pushing back to object_details data.
How can I serialize and deserialize the object_details  vector?
It could be helpfull for beginners like me
Thanks


text:
Q: How to display JSON array on UITableView JSON data is something like that...
{"order_list_1":[
{"name":"@SEVEN (7) OCLOCK BLADE PLATINUM","qty":1,"mrp":0.0},
{"name":"ACT 2 POPCORN BUTTER PEPPER","qty":2,"mrp":0.0},
{"name":"ACT 2 POPCORN CHILLY SURPRISE","qty":3,"mrp":0.0},
{"name":"@MAGGI SOUP HOT N SOUR(1 1)","qty":4,"mrp":0.0},
{"name":"ACT 2 POPCORN GOLDEN SIZZLE","qty":5,"mrp":0.0},
{"name":"AMCHUR AAKHA 1kg","qty":6,"mrp":0.0}]

}
json data is displaying on console but not on tableview..
Here my code snippet...
-(void)fetchData{

dispatch_async(bKQueue, ^{
    NSData *data = [NSData dataWithContentsOfURL:latestURL];

    NSLog(@"LatestURL:%@",latestURL);
    NSError* error=nil;

    //Creating JSON Object
    NSDictionary *jsonDict= [NSJSONSerialization JSONObjectWithData:data                                                      options:kNilOptions error:&error];

    NSLog(@"JSON = %@", [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]);

    //NSLog(@"dataaaa :%@",jsonDict);

    //[self performSelectorOnMainThread:@selector(fetchData:) withObject:data waitUntilDone:YES];

    dispatch_async(dispatch_get_main_queue(), ^{

     //[self fetchData:responseData];
     [self.tableView reloadData];
     //NSLog(@"Value :%@",data);
     });

    NSDictionary *statuses=[jsonDict objectForKey:@"order_list_1"];

    NSLog(@"SomeStatus :%@",statuses);

    if (!statuses)
     {
        NSLog(@"Error in Json :%@",error);
     }
    else
    {

        for(NSDictionary *newValu in statuses)
    {

            NSString *name=[newValu objectForKey:@"name"];

            NSString *qty=[newValu objectForKey:@"qty"];

            NSString *mrp=[newValu objectForKey:@"mrp"];

            NSLog(@"Name :%@    Quantity :%@    MRP :%@ ",name,qty,mrp);
        }
    }

});

}
And this is my Tableview code..

*

*(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {

 cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}

NSError *error=nil;
NSDictionary *jsonDict=[NSJSONSerialization JSONObjectWithData:responseData      options:kNilOptions error:&error];
NSArray *statuses=[jsonDict objectForKey:@"order_list_1"];
for (int i=0; i<jsonDict.count; i++) {
    NSDictionary *newDict=[statuses objectAtIndex:i];
NSLog(@"name :%@",[newDict valueForKey:@"name"]);
}
NSDictionary *text=[statuses objectAtIndex:indexPath.row];
cell.textLabel.text=[text objectForKey:@"name"];

[self.tableView reloadData];
return cell;

}

A: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        UITableViewCell *cell = [[UITableViewCell alloc]init];

        NSArray *geomery = [res objectForKey:@"results"];
        NSDictionary *item = [geomery objectAtIndex:indexPath.row];
        NSString *name = [item objectForKey:@"name"];
        //NSLog(name);
        //cell.textLabel.text =@"test" ;
        cell.textLabel.text= name;

        return cell;
    }

this worked for me , check out for dictionary index properly sent or not

A: -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil)
    {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
    }
    dictJson = [self.aryJson objectAtIndex:indexPath.row];
    cell.textLabel.text = [dictJson objectForKey:@"title"];
    cell.textLabel.text = [dictJson objectForKey:@""];

    return cell;

}

A: Try this.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
        static NSString *CellIdentifier = @"Cell";

        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        if (cell == nil) {

         cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
        }

        NSError *error=nil;
        NSDictionary *jsonDict=[NSJSONSerialization JSONObjectWithData:responseData      options:kNilOptions error:&error];
        NSArray *statuses=[jsonDict objectForKey:@"order_list_1"];
        NSDictionary *text=[statuses objectAtIndex:indexPath.row];
        cell.textLabel.text=[text objectForKey:@"name"];
        return cell;

}


text:
Q: IOS 7 AFNetworking 2.0 view refresh issue first I'd like to say that the issue I am having is in regards to how my own code is set, not IOS or AFNetworking.
I am going to show 1 example where a view is not refreshing immediately even though the updated JSON response object from the server is being recieved.
There are 2 views being used in the first view the button below takes the user to a second view where he can upload an image that will then be displayed in the first view.
- (IBAction)editImage:(id)sender {
UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"Main_iPhone" bundle:nil];
TDUserProfileViewController * vc = [storyboard instantiateViewControllerWithIdentifier:@"TDUserProfileImageEditViewController"];
[self.navigationController pushViewController:vc animated:YES];
}

Below is the code that uploads the new data to the server and then gets new data regarding the images's address on the server.
- (IBAction)dataSubmitToServer{

//    NSLog(@"photo: %@", self.photoData);
 NSString * userID = [[NSUserDefaults standardUserDefaults] objectForKey:USERID];
//make the call to the web API
NSString* command = @"setProfilePhoto";
self.params =[NSMutableDictionary dictionaryWithObjectsAndKeys:command, @"command", userID, @"userid", nil];

//////////////////
NSLog(@"%@", self.params);

self.photoName = @"newname.png";
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];

manager.responseSerializer = [AFHTTPResponseSerializer serializer];
[manager POST:BaseURLString parameters:self.params constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {

    [formData appendPartWithFileData:UIImageJPEGRepresentation(self.userPhoto.image, 1)
                                name:@"image"
                            fileName:self.photoName
                            mimeType:@"image/jpeg"];
} success:^(AFHTTPRequestOperation *operation, id responseObject) {

    NSLog(@"JSON: %@", responseObject);

       } failure:^(AFHTTPRequestOperation *operation, NSError *error) {

    NSLog(@"Error: %@", [error localizedDescription]);

    [TDPublicFunctions showDefaultAlert:@"Error" body:[error description]];
}];

[self getNewProfileData];

[[NSUserDefaults standardUserDefaults] synchronize];

}

-(void)getNewProfileData{
/*start getting new data for profile pic and status message*/

NSString* command = @"displayProfileData";

NSString * userID = [[NSUserDefaults standardUserDefaults]  objectForKey:USERID];

NSMutableDictionary* params =[NSMutableDictionary dictionaryWithObjectsAndKeys:command, @"command",  userID,@"userid", nil];

NSLog( @"%@", params);
[SVProgressHUD showWithStatus:@"Loading..." maskType:SVProgressHUDMaskTypeBlack];

AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
[manager POST:BaseURLString parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) {
    NSLog(@"JSON: %@", responseObject);
    [SVProgressHUD dismiss];
    if([responseObject objectForKey:@"error"])
    {
        [[[UIAlertView alloc] initWithTitle:@"Data Retrieval Error" message:[responseObject description] delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil] show];
    }
    else
    {
        NSString * profilePhoto = [[[responseObject objectForKey:@"result"] objectAtIndex:0] objectForKey:@"profile_picture"];
        NSString * status = [[[responseObject objectForKey:@"result"] objectAtIndex:0] objectForKey:@"status"];
        NSString * statusMsg = [[[responseObject objectForKey:@"result"] objectAtIndex:0] objectForKey:@"status_message"];

        if(profilePhoto && ![profilePhoto isKindOfClass:[NSNull class]])
            [[NSUserDefaults standardUserDefaults] setObject:profilePhoto forKey:PROFILE_PHOTO];
        if(status && ![status isKindOfClass:[NSNull class]])
            [[NSUserDefaults standardUserDefaults] setObject:status forKey:STATUS];
        if(statusMsg && ![statusMsg isKindOfClass:[NSNull class]])
            [[NSUserDefaults standardUserDefaults] setObject:statusMsg forKey:STATUS_MESSAGE];

    }

} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
    NSLog(@"Error: %@", error);
}];
//end of getting data for status message and profile pic
}

Now once this above process is over the HUD is supposed to stop and when the back button on the view is hit there should be a newly uploaded image in the first view. The code below is the last of many things that I have tried in order to get the view with the image to refresh:
    -(void) viewWillAppear:(BOOL)animated
{
NSString * profPic = [[NSUserDefaults standardUserDefaults] objectForKey:PROFILE_PHOTO];
NSLog(@"profilepic: %@", profPic);
//    NSString* status = [[NSUserDefaults standardUserDefaults] objectForKey:STATUS];
NSString * statusMsg = [[NSUserDefaults standardUserDefaults] objectForKey:STATUS_MESSAGE];
if(profPic)
    [photo loadIconForProduct:profPic];

if(statusMsg)
    statusMsgView.text = statusMsg;

//self.view=nil;
//[self viewDidLoad];
[self getFriendsList];
[photo setNeedsDisplay];
[self.view setNeedsDisplay];
}

After an image is uploaded it may work the first time an image is uploaded but it does not work if the user were to press the editImage button a second time and upload another image.
What is it that is being done wrong? Let me know if there is anything else that I can supply.
Thanks.

A: As I can see here, you are getting a URL back as the result of the profilePhoto. So you might as well use the AFNetworking function:
Im presuming photo is a UIImageView.
[photo setImageWithURL:[NSURL URLWithString:profPic] placeholderImage:[UIImage imageNamed:@"somePlaceholderImage"]];


text:
Q: How to list all downloaded Bower dependencies? After executing bower install, some dependencies (with ~ and ^) were resolved to some latest version.

e.g.

*

*angular#~1.3.5 which resolved to 1.3.20

*jquery-ui#~1.11.1 which resolved to 1.11.4

Is there a Bower command to list all downloaded dependencies with their respective version?
Updated:
So far I created a shell script.
#!/bin/sh
for filedir in "./bower_components/*"
do
  grep '"version": ' $filedir/.bower.json
done

A: You can use the following line :
bower list


text:
Q: How to pass variable value to gpg commands $importkey = system('gpg --import newkey.asc . $username');

need to pass the file name as a variable.so that file name with its contents can be import in gnupg keyring.
$gpg = system('gpg --recipient userid  --output filename --armor  --encrypt filename to encrypt', $retvalue);

how can i pass the recipient email id(userid) and the filename as variable to gpg commands
thanks!

A: Change the ' to " for example and then you can pass in variables:
$importkey = system("gpg --import newkey.asc . $username");


text:
Q: Where is the "Software Center"? Forgive me, I am a ubuntu-newb.
I was running UbuntuStudio 19.10, and upgraded to 20.04.  I want to look through the software repository, but can't find the "Software Center" discussed here: https://help.ubuntu.com/community/UbuntuStudio/FindingSoftware.  I think I used it once before, because I have Rosegarden running - but now I can't find it.
Any assistance will be greatly appreciated!

A: The package you are looking for is called gnome-software (formerly called ubuntu-software).
When you install it, it will automatically install snapd. But you can remove it afterwards if you don't need it.


text:
Q: Как сделать размер шрифта относительно его размера в pillow? PIL, Python Как сделать размер шрифта относительно его размера в pillow? PIL, Python
Я делаю программу, которая будет накладывать текст на изображение, но когда текст слишком большой, он
выходит за границы фото.


text:
Q: CSS 2.1 compliant HTML to Microsoft Word conversion? I've found a superb HTML to PDF converter in Prince XML. Now I'm looking for something of similar quality to produce Word documents from HTML + CSS. This is on PHP/Linux.

A: Three options depending on what you need to do:

*

*For simple cases, you can just write out the HTML to a .doc file. Sample here. That's limited, though, and prompts the user to save as HTML if they make updates.

*If you can require Word 2007, you can generate Office Open XML, which is basically a zip file which holds XML documents. I haven't found a library that can do that, but you can get started by renaming a sample .docx file to a .zip file and looking at what's included, then generate that from PHP. Some info on that in this SO question.

*If you need to support Word 2003, you need to work with Word 2003's XML format. It's different than the 2007 format, but is at least forward compatible (so it'll work on 2007 as well). The simplest way is to save as a Word 2003 XML document from Word, then open the document in a text editor, then get to work writing XSLT that will convert your HTML to the correct XML. I've done it, and it worked, but it was a lot of work. There's info on the format here.
None of those are all that easy, so it might be worth buying a software product that does the conversion for you.
More info on this question is available in this SO question, as well.

A: OpenOffice can be used in server/headless mode to produce documents in lots of formats.

A: It might be easier to look for a PDF -> DOC converter instead, if you already have one-half of the problem solved. That said, I don't know of any good PDF -> DOC converters either :(

A: You might want to try sending the HTML file as DOC (similar to how it's described link text, but with the proper Contet-Type header :-)) and let the end-user's system do the conversion (AFAIK you can do something similar with Excel too).

A: Here is one alternative for pdf => doc. Haven't tried it, good luck!

A: I had to do this a few years ago and ended up rolling my own custom solution. I created a Word document in the format I wanted, saved as HTML, and then added code where required to retrieve text from the database and format the way MS Word likes it. I forced a header to make the client think it was receiving a Word Document instead of an HTML file. Microsoft Word happily opened the file as if it were a regular Word Document.
If it were feasible to output a DOCX file instead, you could do an XSL tranform.


text:
Q: Galois Group of $x^n-2$ Let $n \in \mathbb{N}$, then the order of the Galois Group
of $x^n-2$ coincide with $n \phi(n)$ for $n\in \{ 1 , \dots , 36 \}$
except for $n=\{ 8, 16, 24, 32 \}$ where this order is $\frac{ n \phi (n)}{2}$
and is easy to prove that for $p$ prime we have that the order
of the Galois Group of $x^p-2$ is $p(p-1)$.
What is the order of the Galois Group of $x^n-2 : n\in \mathbb{N}$ is general?
Thanks in advance.

A: The splitting field of $x^n-2$ over $\mathbb{Q}$ is $K.L$ where
$K=\mathbb{Q}(\zeta_n)$ and $L=\mathbb{Q}(\sqrt[n]{2})$, so the order of the Galois group
is
$$
[K.L:\mathbb{Q}] = \frac{[K:\mathbb{Q}]\cdot[L:\mathbb{Q}]}{[K\cap L:\mathbb{Q}]}
= \frac{n \phi(n)}{[K\cap L:\mathbb{Q}]}.
$$
It remains to compute $m:=[K\cap L:\mathbb{Q}]$.
First show that $K\cap L = \mathbb{Q}(\sqrt[m]{2})$.  For this, note that the norm
$N_{L/(K\cap L)}(\sqrt[n]{2})$ is in $K\cap L$.  This norm is the product
of the $n/m$ conjugates of $\sqrt[n]{2}$ over $K$, so it is the product of $n/m$ of the conjugates of $\sqrt[n]{2}$ over $\mathbb{Q}$, and each of these conjugates has the form
$\zeta_n^i \sqrt[n]{2}$.  Hence the norm has the form $\zeta_n^i \sqrt[n]{2}^{n/m}
= \zeta_n^i \sqrt[m]{2}$.
Since this is in $K\cap L$, and $\zeta_n^i\in K$,
it follows that $\sqrt[m]{2}\in K$, so $\sqrt[m]{2}\in K\cap L$.
But $[\mathbb{Q}(\sqrt[m]{2}):\mathbb{Q}]=m=[K\cap L:\mathbb{Q}]$,
 so indeed $K\cap L=\mathbb{Q}(\sqrt[m]{2})$.
Next, since $\sqrt[m]{2}\in K$, and $K/\mathbb{Q}$ is abelian, it follows that $\mathbb{Q}(\sqrt[m]{2})/\mathbb{Q}$ is abelian and hence is Galois.  Since $\zeta_m\sqrt[m]{2}$ is a conjugate of $\sqrt[m]{2}$ over $\mathbb{Q}$, it follows that $\zeta_m\in\mathbb{Q}(\sqrt[m]{2})$, so in particular $\zeta_m\in\mathbb{R}$, whence $m\le 2$.
The final step is to determine when $\sqrt{2}\in\mathbb{Q}(\zeta_n)$.  For this, note
that $\sqrt{2}\in\mathbb{Q}(\zeta_8)$ but $\sqrt{2}\notin\mathbb{Q}(\zeta_4)$, and that
$\mathbb{Q}(\zeta_r)\cap\mathbb{Q}(\zeta_s)=\mathbb{Q}(\zeta_{(r,s)})$.  Thus
$\sqrt{2}\in\mathbb{Q}(\zeta_n)$ if and only if $8\mid n$.  So the conclusion is that
the splitting field of $x^n-2$ over $\mathbb{Q}$ has degree $n\phi(n)$ if $8\nmid n$,
and has degree $n\phi(n)/2$ if $8\mid n$.
Question: is there a way to do this without showing that $K\cap L=\mathbb{Q}(\sqrt[m]{2})$, by using from the start that $K\cap L$ is a subfield of $\mathbb{Q}(\sqrt[n]{2})$ which is Galois over $\mathbb{Q}$, and then somehow going directly to the final step?

A: See this stackexchange question., or this worked exercise.


text:
Q: github API check_runs returning 415, "Unsupported Media Type" really that simple, making a request with github api: https://docs.github.com/en/rest/reference/checks#list-check-runs-for-a-git-reference
I am trying to find the check runs for a particular branch I have. Below is the url I GET from:
url = ...api/v3/repos/{repo_fullname}/commits/{branch}/check-runs'

Here are my headers:
    headers = {
        'Authorization': 'token ' + token,
        "Accept": "application/vnd.github.v3+json"
    }

I get hit with the: 415 Client Error: Unsupported Media Type for url...
Please help, been banging my head for hours. Thanks!

A: Perhaps you could try a different accept? I work with octokit for node and this fixed my problem, maybe it would help in this case.
headers = {
    'Authorization': 'token ' + token,
    "Accept": "application/vnd.github.antiope-preview+json"
}


text:
Q: Display Time in input control type of time In C#, I have a DateTime field where I only want to display the Time in an input control of type 'time'.
Field Sample:
<asp:TextBox ID="txtStartTime" runat="server" MaxLength="10" CssClass="form-control" type="time"></asp:TextBox>

Neither of these will work:
txtStartTime.Text = ((System.DateTime)pDS.Tables[0].Rows[0]["StartTime"]).ToShortTimeString();

System.String strResult = System.String.Format("{0:hh:mm tt}", pDS.Tables[0].Rows[0]["StartTime"].ToString());
txtStartTime.Text = strResult;

A: Use ToString(format) method of the DateTime class itself:
DateTime dt = ((System.DateTime)pDS.Tables[0].Rows[0]["StartTime"]);
txtStartTime.Text = dt.ToString("hh:mm:ss");

A: String.Format needs an object to apply the format. The documentation tells us that the method:

Replaces one or more format items in a string with the string representation of a specified object.

The string representation of the string is the string itself. So your format string has no effect on the string that you pass to it.
But it can format a Datetime object, since the format you use has a valid string representation match.
So simply remove the ToString call and your approach will work.
System.String strResult = System.String.Format("{0:hh:mm tt}", pDS.Tables[0].Rows[0]["StartTime"]);
txtStartTime.Text = strResult;

A: Use Datetime.ToString(String)
To get hour format just use ToString("hh:mm:ss")
Example:
 <%

        var dt = DateTime.Now;//((System.DateTime)pDS.Tables[0].Rows[0]["StartTime"]);
        txtStartTime.Text = dt.ToString("hh:mm:ss");

    %>

    <!DOCTYPE html>

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
            <asp:TextBox ID="txtStartTime" runat="server" MaxLength="10" CssClass="form-control" type="time"></asp:TextBox>
        </form>
    </body>
    </html>


text:
Q: Change admin theme in a ongoing project I have developed a project in django as core technology and i need to change the admin theme but cant change it can any one specify an experienced steps for this process

A: If you want to create your own theme, you need to override admin 'static files' and 'templates'.
Otherwise, the best way is to use an already available theme like https://github.com/geex-arts/django-jet


text:
Q: Windows server security setup (firewalls, SQL server and other points) Firstly apologies for this being a non-specific question, I'm not really sure where to look for specifics so this is a general discussion of regular issues I'm faced with. I'm going round in circles trying to work with a number of different hosts and their enforced "best practices". I'd like to try and garner some knowledge for myself based around the following statements.
"Using the default SQL server port is less secure than using a random non-standard port"
 - this seems to me like security through obscurity which isn't particularly secure?
"Firewalls that offer packet inspection do not need to worry about having a totally open port"
 - is it okay to have a completely open inbound port (e.g. in this instance sql) as the security aspect is handled by packet inspection?
"Adding IP based firewall restrictions is not secure due to IP sniffing/spoofing - the correct/best way is to use a VPN between machines."
 - this obviously isn't always possible but on server<>server tasks should a VPN be used?
This is drawn from my confusion from having to deal with inheriting the following setups:
HOST A
- hardware firewall all outbound traffic open
- I can manage the inbound traffic by opening ports globally or by IP
- Currently no VPN
HOST B
- hardware firewall I have no control over
- 3 outbound ports open (very restrictive) not able to open any more
- SQL port inbound is completely open which I can restrict using windows firewall
- Currently no VPN
HOST C
- no hardware firewall
- Windows firewall I can manage if needed
- SQL setup to use non-default port
- Currently no VPN
I need these servers to be able to communicate on several different ports which server B does not allow for. To me a VPN between them all looks to be the right approach but am very unfamiliar with this so open to being corrected?

A: This is a broad question, but I will address the main issues

"Using the default SQL server port is
  less secure than using a random
  non-standard port"
  - this seems to me like security through obscurity which isn't
  particularly secure?

You are correct. having non default ports as a security measure is overrated. However, it does add some security against simple attacks.
If some one want to break into the system, this wouldn't stop him. but if someone (or some thousands) bored hackers run port scanners to look for a SQL server (or any other server) to practice or fool around, a non default port may stop them.

"Firewalls that offer packet
  inspection do not need to worry about
  having a totally open port"
  - is it okay to have a completely open inbound port (e.g. in this instance
  sql) as the security aspect is handled
  by packet inspection?

Packet inspection is higher level and more complex then port blocking - and therefor it's more susceptible for attacks, bus, or configuration errors.
Generally you should place security measures in the lowest level appropriate, so if port blocking is an option, it will be better then packet inspection

"Adding IP based firewall restrictions
  is not secure due to IP
  sniffing/spoofing - the correct/best
  way is to use a VPN between machines."
  - this obviously isn't always possible but on server<>server tasks should a
  VPN be used?

It's true that you can trust IP addresses outside you network as a strong security measure, and VPN will be a more suitable solution.
However, assuming the attacker doesn't have control over your ISP or network access equipment, spoofing an IP isn't very simple

A: SQL is very secure over the internet - if you use a certificate and transport encryption.  Not doing so is a security "worst practice", unless using a site-site VPN.  Enabling and using transport encryption is not difficult, and enables access without the need for a site-site VPN.

"Adding IP based firewall restrictions
  is not secure due to IP
  sniffing/spoofing - the correct/best
  way is to use a VPN between machines."

To be more specific, sending unencrypted data over that type of connection is insecure.  If the data and authentication are encrypted, there are legitimate scenarios for ip restrictions.


text:
Q: Multimeter shows OL or 0.00 or 1.00. What's wrong? I've got a UNI-T UT33D multimeter that's not working like I want it to, and I'm not sure how to find out what's wrong or if it's salvageable or not. The unit is new, but may possibly have had its battery inserted backwards at some point.
I've tried it with two three different batteries, two of which seem healthy when measured by another multimeter, and the third one being new from the store.
Resistance readings I can get are as follows:

*

*Setting | open | shorted

*200M | OL. | OL.

*20M | -0.00 | 1.00 -- battery indication for both

*200k | -00.0 | 10.0 -- batt. ind. for both

*20k | -0.00 | 1.00 -- batt. ind. for both

*2000 | -000 | OL -- batt. ind. for both

*200 | OL. | OL. and batt. ind.

There have been times when the shorted readings have been 243, 24.3 and 2.43 instead.
Voltage readings for 20V and 200V DC on a healthy 9V battery are OL and battery indicator.
All of the above readings are taken with black lead in COM and red lead in the fused connection.
I have checked the following:

*

*Battery appears healthy

*Battery is correctly inserted

*Test leads are not broken

*Fuses are okay

*Connection from test leads to inside fuses is okay

A:
You'll need to get a new meter


text:
Q: Google map div within an element not working I am using a google map and have it structured in side an element like this.

Now if i remove the element main the map displays perfectly, but as soon as i add the element it disapears.
This is the CSS
#map {
    height: 100%;
}

I have tried to re write the css thinking that the structure of the css is the problem, but whatever i try doesn't work. for example
main map {}

Here Is A  Link

A: Set height: 100%; on the main.panel element.
Explanation:
Your #map element is set to height: 100% which means it will take up completely (100%) the height of its parent element,  in this case.
Since there was only a min-height property and no height property on the , the #map had no height to inherit, hence it took 0 height.


text:
Q: Detect Drag'n'Drop file in WPF? Is it possible to have a WPF window/element detect the drag'n'dropping of a file from windows explorer in C# .Net 3.5? I've found solutions for WinForms, but none for WPF.

A: Try the following :
    private void MessageTextBox_Drop(object sender, DragEventArgs e)
    {
        if (e.Data is DataObject && ((DataObject)e.Data).ContainsFileDropList())
        {
            foreach (string filePath in ((DataObject)e.Data).GetFileDropList())
            {
                // Processing here
            }
        }
    }

    private void MessageTextBox_PreviewDragEnter(object sender, DragEventArgs e)
    {
        var dropPossible = e.Data != null && ((DataObject)e.Data).ContainsFileDropList();
        if (dropPossible)
        {
            e.Effects = DragDropEffects.Copy;
        }
    }

    private void MessageTextBox_PreviewDragOver(object sender, DragEventArgs e)
    {
        e.Handled = true;
    }

A: Unfortunately, TextBox, RichTextBox, and FlowDocument viewers always mark drag-and-drop events as handled, which prevents them from bubbling up to your handlers. You can restore drag-and-drop events being intercepted by these controls by force-handling the drag-and-drop events (use UIElement.AddHandler and set handledEventsToo to true) and setting e.Handled to false in your handler.

A: Turns out I couldn't drop onto my TextBox for some reason, but dropping onto buttons works fine. Got it working by adding 'AllowDrop="True"' to my window and adding drop event handler to button consisting of:
private void btnFindType_Drop(object sender, DragEventArgs e)
{
  if (e.Data is System.Windows.DataObject &&
    ((System.Windows.DataObject)e.Data).ContainsFileDropList())
  {
    foreach (string filePath in ((System.Windows.DataObject)e.Data).GetFileDropList())
    {
      // Processing here
    }
  }
}

A: I had similar Issue, The drop events and drag enter events were not fired. The issue was with the windows User Account Settings. Set it to least secure setting and try the same code it works.


text:
Q: Creating custom keyboard shortcuts in eclipse I'm using the eclipse c++ IDE and I want to create a key board shortcut that basically does two steps:
1. Saves all files
2. Builds project
Is there any way to do this ?

A: *

*To save all files the shortcut is CTRL+SHIFT+S. You can modify it
Window->preference->General->Editors->Keys

*You can select build automaticaly in file menu Project.
Now when you save the files the project will build automatically.


text:
Q: IB - Can't assign class for a View Controller I'm quite new to IOS developpement, and I'm facing a problem here that I haven't encountered before. Here's what I have :
I created a project, added some ViewControllers attached to their own classes. But now, I just added a new ViewController in the storyboard. Then I created a new Objective-C class (with is a subclass of UIViewController). The problem is that in IB, I can't link the ViewController to the newly created class, as I simply don't have the class in the list provided by IB (see the image below). My new class is called MapShownViewController, but as you can see on the image, it's not available.

It worked well for all my other classes but not for this one.
Here's the MapShownViewController.h :
#import <UIKit/UIKit.h>

@interface MapShownViewController : UIViewController

@end

And the MapShownViewController.m :
#import "MapShownViewController.h"

@interface MapShownViewController ()

@end

@implementation MapShownViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end

Can someone explain me what I made wrong please ?

A: Check your project settings. xcode->targets->build phases->compile sources
your viewcontroller's implemantation file must be added to this list.

A: For this to work you have to make sure of the following:
1) The element added to the storyboard is an UIViewController
2) The class you defined has the UIViewController as its superclass
@interface MapShownViewController : UIViewController

3) The Class is being correctly built in the project.

A: I had this exact problem and it drove me mad. I first noticed it after upgrading XCode to 4.4 from 4.1. I had an existing project that I had been working on in the older version of XCode, and I continued to work on it in 4.4. I did exactly what you did and created a new View in the story board and then created the sub-class files, but the class just was not avaiable in the Custom Class dropdown in IB. After much Googling and frustration I resorted to Quit Xcode (complete quit, not just close) and then re-start it. Then as if by magic it all started working and the new class was immediatley available in the IB custom class dropdown.

A: Ran into the same issue and restarting XCode was no help.  You can always right click the storyboard and select Open As > Source Code.  Find your view controller element in the XML file and add a customClass attribute:
<viewController title="Login" id="TJH-Bg-q4u" customClass="XYZLoginViewController" sceneMemberID="viewController">
   ...
</viewController>

Manual override FTW :).

A: I've been running into this issue and tried all other solutions posted here.
The thing that worked for me was to set the correct super class after creating a custom class. Then you should be able to find and select it from the class dropdown.
e.g.
class LabsViewController: UITableViewController {

A: Check if you did choose the correct super class in your new class. Sometimes you create a view controller inherited by a UITableVIewController. This one can't be applied to a ViewController pattern in the Storyboard.

A: I had to set my custom class which inherit from UIViewController and act as table view controller to UITableViewController. I made simple trick and just changed my custom class inheritance to ": UITableViewController" and then i can set this class freely to controller. Of course after it was set i changed inheritance back.

A: I had the same issue with Xcode 7.1.1 on a Mac OSX app. I tried all the suggestions from the other answers – no success.
Finally I deleted my view controller files and created brand new ones.
Then it suddenly worked...

A: Just adding another possible solution that helped solve my problem since the others didn't.
I noticed that searching for my custom View Controller file using Command+Shift+O it was being found, but I couldn't see in which folder the file was, so I noticed that for some reason my custom class was missing from the project but still being found in the search.
All I had to do was to move the files to the project again and Voila!
Hope this can help someone in the future.


text:
Q: "Bad audio format for WAV" when reading a wav file I have a set of wav files that I want to generate a spectrogram of. But when I use the tf.audio.decode_wav function, I get the following error:

InvalidArgumentError: Bad audio format for WAV: Expected 1 (PCM), but
got7 [Op:DecodeWav]

How do I circumvent this error? Are there any other ways to generate a log mel spectrogram for wav files using tensorflow?
I am aware of librosa package, but I would prefer tensorflow.
The code is:
def decode_audio(audio_binary):
  audio, _ = tf.audio.decode_wav(audio_binary)
  return tf.squeeze(audio, axis=-1)

def get_waveform_and_label(file_path):
  audio_binary = tf.io.read_file(file_path)
  waveform = decode_audio(audio_binary)
  return waveform

A: The error tells you that your files indicate that they have samples encoded as 8-bit mulaw.
As described in the TensorFlow documentation for tf.audio.decode_wav, only 16-bit PCM WAV is supported by this method.
You would need to re-encode your wave files prior to passing them to tensorflow. Something like ffmpeg could help here.


text:
Q: How can I convert all video file to FLV format in PHP?
Possible Duplicate:
How can we convert video files to .flv format in php

How to convert any video file to FLV using PHP? What are the system requirements? Currently I am using WAMP.

A: Use FFMPEG That is the standard software for dynamic video conversion from one format to another.
 Hope this helps.


text:
Q: Why can't i map this array of objects within an object Hi guy's i've been working with next.js, redux and sanity.io. It's been awful... Lol
Anyways here's the code i'm stuck with
ServiceCards.js

import React from 'react';
import { useSelector } from 'react-redux';
import { getNavItems } from '../redux/actions/navItems';

const ServicesCards = () => {
  const services = useSelector((state) => state.services.services);

console.log(services)

  return (
    <>
    {Object.keys(services).map((item) => {

return(

{item}

)

    })}

    </>
  );
};
export default ServicesCards;

as you can see i am connecting to the redux store perfectly and the data is been retuned like:
{0: {…}, 1: {…}, 2: {…}}
0:
body: (10) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
locations: [{…}]
mainImage: {_type: 'image', asset: {…}}
slug: {_type: 'slug', current: 'patios'}
title: "Patios"
_id: "70f4ad81-f8eb-414a-8e76-da8bf98cc4de"
[[Prototype]]: Object
1: {_id: 'cc9548aa-ccf5-4688-a6ac-3b1a41f9896d', body: Array(10), locations: Array(1), mainImage: {…}, slug: {…}, …}
2:
body: (12) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
locations: [{…}]
mainImage: {_type: 'image', asset: {…}}
slug:
current: "tree-removal"
_type: "slug"
[[Prototype]]: Object
title: "Tree Removal"
_id: "f63a0092-4b89-4ea9-9e49-f618d5f5f0b9"
[[Prototype]]: Object
[[Prototype]]: Object
constructor: ƒ Object()
hasOwnProperty: ƒ hasOwnProperty()
isPrototypeOf: ƒ isPrototypeOf()
propertyIsEnumerable: ƒ propertyIsEnumerable()
toLocaleString: ƒ toLocaleString()
toString: ƒ toString()
valueOf: ƒ valueOf()
__defineGetter__: ƒ __defineGetter__()
__defineSetter__: ƒ __defineSetter__()
__lookupGetter__: ƒ __lookupGetter__()
__lookupSetter__: ƒ __lookupSetter__()
__proto__: (...)
get __proto__: ƒ __proto__()
set __proto__: ƒ __proto__()

So the structure of the data i am getting back is
{
0:{...},
1: {...},
2:{...}

}

Usually i just use Object.keys to map objects and i have no issues using this, so why will it not work here?
Closer look at Object.keys
return (
    <>
      {Object.keys(services).map((item) => {
        return
{item}
;
      })}
    </>
  );

and this is what i get back from render
0
1
2

With no data at all.
store.js

import { createStore, applyMiddleware } from 'redux';
import rootReducer from './reducers';
import { composeWithDevTools } from 'redux-devtools-extension';
import thunkMiddleware from 'redux-thunk';
import { createWrapper } from 'next-redux-wrapper';
import reducer from './reducers/pages';

const middleware = [thunkMiddleware];

const initialState = {
  pages: {},
  navItems: {},
  services: []
};

const store = createStore(
  rootReducer,
  initialState,
  composeWithDevTools(applyMiddleware(...middleware))
);

const initStore = () => {
  return store;
};

const wrapper = createWrapper(initStore, { debug: true });

export default wrapper;

i Have had to set initialState in next-redux-wrapper to get it to work, don't ask me why... I wish i would have stayed with Gatsby.js.
I really help someone can help with this as it's driving me crazy, i bet it's so simple!!

A: You may use Object.values instead:
Object.values(services).map((item) => (

{item}

))

A: Object.keys returns an array of keys and not values.
It should be something like this
{Object.keys(services).map((key) => {
    const item = services[key];
    return
{item}
;
})}


text:
Q: Unable to update database with PHP MySQL where data is coming from AngularJS1.2 service I am new in AngularJS and as well as in PHP MySQL.
I am trying to update my PHP database.
For the first form I have inserted data for name, email, phone number and password. After that when I login I want to update the specific table with country, city, state, pincode and address.
But I am getting the error

UPDATE user_table SET (country = 'India', state = 'West Bengal', city = 'Kolkata', pincode = '700028', fulladdress = '4/6,Aswiny Dutta Road') WHERE email ='wri@gmail.com'Appointment NOT UpdatedErreur de syntaxe pr�s de '(country = 'India', state = 'West Bengal', city = 'Kolkata', pincode = '700028',' � la ligne 1

Here is my code below.
controller:
angular.module('cartApp.userprofile.controller', []).controller('UserprofileController', ['$scope','loginFactory','signupFactory',function($scope,loginFactory,signupFactory){

$scope.userListAry = [];

$scope.userListFn = function(){
    loginFactory.fetchSingleDatatoServerFn()
        .then(function(singleUser){
            console.log('singleUser',singleUser)
            $scope.userListAry = singleUser.data;
            console.log('user profile controller data: '+JSON.stringify($scope.userListAry));
        },function(){
            console.log('data cannot retrieved');
        })
}
$scope.userListFn();

$scope.submitAddress = function(country,city,state,pincode,address){
    console.log('country: '+country+' city: '+city+' state: '+state+' pincode: '+pincode+' address: '+address)
    var useremail = $scope.userListAry.email;
    signupFactory.loginAddressFn(country,city,state,pincode,address,useremail);
} }]);

service:
 'use strict';
angular.module('cartApp.signup.services', []).factory('signupFactory',['$http','$q',function($http,$q){

    var signupObj = {
        setSignupFormFn : setSignupFormFn,
        getSignupFormFn : getSignupFormFn,
        signupArray : [],
        fetchDatatoServerFn : fetchDatatoServerFn,
        loginAddressFn : loginAddressFn
    };

    function setSignupFormFn(username,userphno,useremail,userpass,userconfirmpass){
        var signupValueObj = {};

        signupValueObj.username = username;
        signupValueObj.userphno = userphno;
        signupValueObj.useremail = useremail;
        signupValueObj.userpass = userpass;
        signupValueObj.userconfirmpass = userconfirmpass;

        signupObj.signupArray.push(signupValueObj);

        $http({
            url : 'data/form.php',
            method : 'POST',
            data: {
                'username': username,
                'userphno': userphno,
                'useremail': useremail,
                'userpass': userpass,
                'userconfirmpass': userconfirmpass,
            },
        }).success(function(data, status, headers, config){
            alert(username);
            signupObj.fetchDatatoServerFn();
        }).error(function(){
            alert('no insert')
        });

    }

    function getSignupFormFn(){
        return signupObj.signupArray;
    }

function fetchDatatoServerFn(){

    var defer = $q.defer();

    $http({
        url : 'data/fetchformdata.php',
        method : 'GET',
    }).success(function(data){
        signupObj.fetchFormData = data;
        defer.resolve(data);
    }).error(function(){
        defer.reject('data can\'t be retained');
    });
    return defer.promise;
}
function loginAddressFn(country,city,state,pincode,address,useremail){
    var defer = $q.defer();
    $http({
        url : 'data/updateform.php',
        method : 'PUT',
        data :{
            'useremail' : useremail,
            'country' : country,
            'city' : city,
            'state' : state,
            'pincode' : pincode,
            'address' : address
        }
    }).success(function(data){
        defer.resolve(data);
        console.log('data: '+data);
    }).error(function(){
        defer.reject('data can\'t be retrieved');
    });
    return defer.promise;
}
return signupObj;
}]);

PHP code:
<?php

$connect = mysqli_connect('localhost','root','','signup_form');
$data = json_decode( file_get_contents('php://input') );

$email = mysqli_real_escape_string($connect, $data->useremail);
$country = mysqli_real_escape_string($connect, $data->country);
$state = mysqli_real_escape_string($connect, $data->state);
$city = mysqli_real_escape_string($connect, $data->city);
$pincode = mysqli_real_escape_string($connect, $data->pincode);
$address = mysqli_real_escape_string($connect, $data->address);

$abc = "UPDATE user_table SET (country = '".$country."', state = '".$state."', city = '".$city."', pincode = '".$pincode."', fulladdress = '".$address."') WHERE email ='".$email."'";

mysqli_query($connect, $abc);

if(mysqli_affected_rows($connect) > 0){
    echo "Appointment Updated";
}else{
    echo "Appointment NOT Updated";
    echo mysqli_error($connect);
}

?>

Thank you in advance

A: $abc = "UPDATE user_table SET (country = '".$country."', state = '".$state."', city = '".$city."', pincode = '".$pincode."', fulladdress = '".$address."') WHERE email ='".$email."'";

The bracket should not be here, due to which the problem was occurring. The correct code should be
$abc = "UPDATE user_table SET country = '".$country."', state = '".$state."', city = '".$city."', pincode = '".$pincode."', fulladdress = '".$address."' WHERE email ='".$emailid."'";


text:
Q: Spring: not-null property references a null or transient value when using @RepositoryRestController I am facing a strange issue. In my spring app, I have a controller which saves a record in the db.
@RepositoryRestController
@RequestMapping(WiseUrls.PEOPLE_URL)
public class PeopleController {

   private static final Logger log = LoggerFactory
         .getLogger(PeopleController.class.getName());

   @Autowired
   PeopleService peopleService;

   @RequestMapping(method = RequestMethod.POST)
   public ResponseEntity<PeopleResponse> create(
         @RequestBody PeopleRequest annotationRequest) {

      PeopleResponse resp = new PeopleResponse();

      resp.setAnnotation(peopleService.create(annotationRequest.getAnnotation()));

      return new ResponseEntity<PeopleResponse>(resp, HttpStatus.OK);
   }

}

The People class looks like
@Entity
public class People extends User  {

  /**
   *
   */
  private static final long serialVersionUID = 2385409579929134474L;

  @JsonProperty
  @ManyToOne(optional = false, cascade = CascadeType.ALL)
  @NotNull
  PeopleJob peopleJob;

  @JsonProperty
  @ManyToOne(cascade = CascadeType.ALL)
  PeopleAddress peopleAddress;

  public PeopleJob getPeopleJob() {
     return peopleJob;
  }

  public void setPeopleJob(PeopleJob peopleJob) {
     this.peopleJob = peopleJob;
  }

  public PeopleAddress getPeopleAddress() {
     return PeopleAddress;
  }

  public void setPeopleAddress(PeopleAddress peopleAddress) {
     this.peopleAddress = peopleAddress;
  }
}

And this is the service
@Service
public class PeopleService {

   @Autowired
   PeopleRepository repository;

   public People create(
         People peopleAPI) {

      People dao = repository.save(peopleAPI);
      return dao;
   }
}

If I use @RestController annotation in the controller class the object is saved fine. But if I use @RepositoryRestController which I need to use, I get this error
org.hibernate.PropertyValueException: not-null property references a null or transient value : my.app.DB.models.People.job
   at org.hibernate.engine.internal.Nullability.checkNullability(Nullability.java:92) ~[hibernate-core-5.1.4.Final.jar:5.1.4.Final]
   at org.hibernate.action.internal.AbstractEntityInsertAction.nullifyTransientReferencesIfNotAlready(AbstractEntityInsertAction.java:115) ~[hibernate-core-5.1.4.Final.jar:5.1.4.Final]
   at org.hibernate.action.internal.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:69) ~[hibernate-core-5.1.4.Final.jar:5.1.4.Final]
   at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:623) ~[hibernate-core-5.1.4.Final.jar:5.1.4.Final]
   at org.hibernate.engine.spi.ActionQueue.addResolvedEntityInsertAction(ActionQueue.java:277) ~[hibernate-core-5.1.4.Final.jar:5.1.4.Final]
   at org.hibernate.engine.spi.ActionQueue.addInsertAction(ActionQueue.java:258) ~[hibernate-core-5.1.4.Final.jar:5.1.4.Final]
   at org.hibernate.engine.spi.ActionQueue.addAction(ActionQueue.java:303) ~[hibernate-core-5.1.4.Final.jar:5.1.4.Final]
   at org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction(AbstractSaveEventListener.java:318) ~[hibernate-core-5.1.4.Final.jar:5.1.4.Final]
   at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:275) ~[hibernate-core-5.1.4.Final.jar:5.1.4.Final]
   at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:182) ~[hibernate-core-5.1.4.Final.jar:5.1.4.Final]
   at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:113) ~[hibernate-core-5.1.4.Final.jar:5.1.4.Final]
   at org.hibernate.jpa.event.internal.core.JpaPersistEventListener.saveWithGeneratedId(JpaPersistEventListener.java:67) ~[hibernate-entitymanager-5.1.4.Final.jar:5.1.4.Final]
   at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:189) ~[hibernate-core-5.1.4.Final.jar:5.1.4.Final]
   at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:132) ~[hibernate-core-5.1.4.Final.jar:5.1.4.Final]
   at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:58) ~[hibernate-core-5.1.4.Final.jar:5.1.4.Final]
   at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:778) ~[hibernate-core-5.1.4.Final.jar:5.1.4.Final]
   at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:751) ~[hibernate-core-5.1.4.Final.jar:5.1.4.Final]
   at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:756) ~[hibernate-core-5.1.4.Final.jar:5.1.4.Final]
   at org.hibernate.jpa.spi.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:1146) ~[hibernate-entitymanager-5.1.4.Final.jar:5.1.4.Final]
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_131]
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_131]
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_131]
   at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_131]
   at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:347) ~[spring-orm-4.3.6.RELEASE.jar:4.3.6.RELEASE]
   at com.sun.proxy.$Proxy119.persist(Unknown Source) ~[na:na]
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_131]
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_131]
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_131]
   at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_131]
   at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:298) ~[spring-orm-4.3.6.RELEASE.jar:4.3.6.RELEASE]
   at com.sun.proxy.$Proxy119.persist(Unknown Source) ~[na:na]
   at org.springframework.data.jpa.repository.support.SimpleJpaRepository.save(SimpleJpaRepository.java:508) ~[spring-data-jpa-1.11.0.RELEASE.jar:na]
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_131]
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_131]
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_131]
   at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_131]
   at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:504) ~[spring-data-commons-1.13.0.RELEASE.jar:na]
   at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:489) ~[spring-data-commons-1.13.0.RELEASE.jar:na]
   at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:461) ~[spring-data-commons-1.13.0.RELEASE.jar:na]
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
   at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61) ~[spring-data-commons-1.13.0.RELEASE.jar:na]
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
   at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) ~[spring-tx-4.3.6.RELEASE.jar:4.3.6.RELEASE]
   at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282) ~[spring-tx-4.3.6.RELEASE.jar:4.3.6.RELEASE]
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[spring-tx-4.3.6.RELEASE.jar:4.3.6.RELEASE]
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
   at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) ~[spring-tx-4.3.6.RELEASE.jar:4.3.6.RELEASE]
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
   at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:133) ~[spring-data-jpa-1.11.0.RELEASE.jar:na]
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
   at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
   at org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:57) ~[spring-data-commons-1.13.0.RELEASE.jar:na]
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
   at com.sun.proxy.$Proxy121.save(Unknown Source) ~[na:na]
   at my.app.Service.services.PeopleService.create(PeopleService.java:21) ~[classes/:na]
   at my.app.Service.controllers.PeopleController.create(PeopleController.java:34) ~[classes/:na]
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_131]
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_131]
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_131]
   at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_131]
   at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
   at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
   at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116) ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
   at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
   at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
   at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
   at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
   at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
   at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
   at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:648) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
   at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
   at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) ~[tomcat-embed-websocket-8.5.11.jar:8.5.11]
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
   at org.springframework.web.filter.AbstractRequestLoggingFilter.doFilterInternal(AbstractRequestLoggingFilter.java:244) ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
   at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
   at my.app.Service.filters.OptionsRequestFilter.doFilter(OptionsRequestFilter.java:52) ~[classes/:na]
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-8.5.11.jar:8.5.11]
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:474) [tomcat-embed-core-8.5.11.jar:8.5.11]
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.11.jar:8.5.11]
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [tomcat-embed-core-8.5.11.jar:8.5.11]
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.11.jar:8.5.11]
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349) [tomcat-embed-core-8.5.11.jar:8.5.11]
   at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:783) [tomcat-embed-core-8.5.11.jar:8.5.11]
   at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.11.jar:8.5.11]
   at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:798) [tomcat-embed-core-8.5.11.jar:8.5.11]
   at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1434) [tomcat-embed-core-8.5.11.jar:8.5.11]
   at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.11.jar:8.5.11]
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_131]
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_131]
   at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.11.jar:8.5.11]
   at java.lang.Thread.run(Thread.java:748) [na:1.8.0_131]

Can someone point me in the right direction. Thanks !!

A: from spring data rest : Adding custom (de)serializers to Jackson's ObjectMapper

Sometimes the behavior of the Spring Data REST's ObjectMapper, which
  has been specially configured to use intelligent serializers that can
  turn domain objects into links and back again, may not handle your
  domain model correctly. There are so many ways one can structure your
  data that you may find your own domain model isn't being translated to
  JSON correctly. It's also sometimes not practical in these cases to
  try and support a complex domain model in a generic way. Sometimes,
  depending on the complexity, it's not even possible to offer a generic
  solution.

If for rest controller object comes with correct fields  , check in debug what heppens during object mapping process.


text:
Q: Dismiss one modalView and one pushView successively How could i dismiss both tableView4 and tableView3 in tableView4's tableViewController?
rootView(tableView1, one tab of a tabView, embeded in an navigationController)-->pushView1(tableView2)-->pushView2(tableView3)-->ModalView1(tableView4, embeded in an navigationController);

A: call dismissViewControllerAnimated:completion: on your modal view and then call popViewControllerAnimated: on the view you want to.

A:    UINavigationController *myNavController = [myViewController navigationController];
   [myViewController dismissViewControllerAnimated:YES completion:^{
        [myNavController popToViewController:[myNavController.viewControllers objectAtIndex:1] animated:YES];
    }];

A: try this:
UINavigationController *myNavController = [myViewController navigationController];
[myNavController popToViewController:[myNavController.viewControllers objectAtIndex:1];
[myViewController dismissViewControllerAnimated:YES completion:nil];


text:
Q: Curved arrows on top of every node I'm a beginner of latex and tikz.  I want to have curved arrows on top of each node as in tikx example.
Following is my code.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\begin{document}

\begin{figure}[h]
\centering
\begin{tikzpicture}
  [scale=.8,auto=left,every node/.style={circle,fill=blue!20}]

  \node (n1) at (9,8) {1};
  \node (n2) at (6,7) {2};
  \node (n3) at (5,5)  {3};
  \node (n4) at (6,3) {4};
  \node (n5) at (9,2)  {5};
  \node (n6) at (12,3)  {6};
  \node (n7) at (13,5)  {7};
  \node (n8) at (12,7)  {8};

  \foreach \from/\to in {n1/n2,n2/n3,n3/n4,n4/n5,n5/n6,n6/n7,n7/n8,n8/n1,n1/n3,n1/n4,n1/n5,n1/n6,n1/n7,n2/n4,n2/n5,n2/n6,n2/n7,n2/n8,n3/n5,n3/n6,n3/n7,n3/n8,n4/n6,n4/n7,n4/n8,n5/n7,n5/n8,n6/n8}
    \draw (\from) -- (\to);

\end{tikzpicture}
\end{figure}

\end{document}

How to draw curved arrows on top of every node?

A: \documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\begin{document}

\begin{figure}[h]
\centering
\begin{tikzpicture}
  [scale=.8,auto=left,every node/.style={circle,fill=blue!20}]

  \node (n1) at (9,8) {1} edge [in=100,out=80,loop] ();
  \node (n2) at (6,7) {2} edge [in=150,out=130,loop] ();
  \node (n3) at (5,5)  {3} edge [in=190,out=170,loop] ();
  \node (n4) at (6,3) {4} edge [in=240,out=220,loop] ();
  \node (n5) at (9,2)  {5} edge [in=280,out=260,loop] ();
  \node (n6) at (12,3)  {6} edge [in=330,out=310,loop] ();
  \node (n7) at (13,5)  {7} edge [in=10,out=350,loop] ();
  \node (n8) at (12,7)  {8} edge [in=60,out=40,loop] ();

  \foreach \from/\to in {n1/n2,n2/n3,n3/n4,n4/n5,n5/n6,n6/n7,n7/n8,n8/n1,n1/n3,n1/n4,n1/n5,n1/n6,n1/n7,n2/n4,n2/n5,n2/n6,n2/n7,n2/n8,n3/n5,n3/n6,n3/n7,n3/n8,n4/n6,n4/n7,n4/n8,n5/n7,n5/n8,n6/n8}
    \draw (\from) -- (\to);

\end{tikzpicture}
\end{figure}

\end{document}

A: If you are happy with circular placement things get pretty simplified with foreach loops for n>4 nodes. Then you need to tweak the loop drawing which is also possible but I got a little bored :P
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}\def\myn{9}
\foreach \x in {1,...,\myn}{\node[circle,fill=blue!20,inner sep=1pt] (n\x) at ({(\x-1)*360/\myn+90}:2cm) {\x};}
\foreach \x[evaluate={\xi=(\x-1)*360/\myn+90+360/\myn;\xo=\xi-360/(0.5*\myn)}] in {1,...,\myn}{
\foreach \y in {\x,...,\myn}{\ifnum\x=\y\path (n\x)edge [in=\xi,out=\xo,loop] ();\else\draw[-](n\x) -- (n\y);\fi}}
\end{tikzpicture}
\end{document}

For n=9

For n=40.... (I really don't know why)

A: Maybe something like this?
\documentclass[tikz,border=5pt]{standalone}
\usetikzlibrary{arrows}
\begin{document}

\begin{tikzpicture}
  [scale=.8,auto=left,every node/.style={circle,fill=blue!20}]

  \node (n1) at (9,8) {1};
  \node (n2) at (6,7) {2};
  \node (n3) at (5,5)  {3};
  \node (n4) at (6,3) {4};
  \node (n5) at (9,2)  {5};
  \node (n6) at (12,3)  {6};
  \node (n7) at (13,5)  {7};
  \node (n8) at (12,7)  {8};

  \foreach \from/\to in {n1/n2,n2/n3,n3/n4,n4/n5,n5/n6,n6/n7,n7/n8,n8/n1,n1/n3,n1/n4,n1/n5,n1/n6,n1/n7,n2/n4,n2/n5,n2/n6,n2/n7,n2/n8,n3/n5,n3/n6,n3/n7,n3/n8,n4/n6,n4/n7,n4/n8,n5/n7,n5/n8,n6/n8}
    \draw (\from) -- (\to);

  \foreach \i in {1,...,8}
      \draw [->] (n\i.north west) [out=45, in=135] to (n\i.north east);

\end{tikzpicture}

\end{document}


text:
Q: How to use jquery plugins in Vue Component in Laravel Framework? I am using Laravel for developing my website. I have purchase a template from themeforest. I a login panel on my website. I am using vue js in that panel. I am using the template that I had purchased. The issue is the all the components of the template are in jquery, so I am not able to use them inside my vue components. For example I am having a custom datatable in the template. I want to use the same design in my component. Datatable is not getting initialized in the vue component. Please let me know how to do that. I don't want to use vue plugins, I just want the jquery plugins of the template to work in my vue components. Please help me. Below I have listed the Laravel blade file code and also the products vue component in which I want to use the custom datatable.
Laravel Blade File Code
@extends('frontend.shop.layouts.app')

@section('breadcrumb')

{{ $page_name }}

Home

{{ $parent_page }}

{{ $page_name }}

@endsection

@section('content')

      @if($original_page_name=='products')
        <product-page></product-page>
      @elseif($original_page_name=='commission')
        <commission-page></commission-page>
      @endif

@endsection

@section('pagecss')
  @if($original_page_name=='products')
  <link rel="stylesheet" type="text/css" href="{{ asset('public/frontend/shop/app-assets/vendors/css/tables/datatable/datatables.min.css') }}?v={{ time() }}">
  <link rel="stylesheet" type="text/css" href="{{ asset('public/frontend/shop/app-assets/css/pages/data-list-view.css') }}?v={{ time() }}">

  @endif
@endsection

@section('pagescripts')
  @if($original_page_name=='products')

  @elseif($original_page_name=='commission')

  @endif
@endsection

** Product Page Vue Component Code**
<template>

            <button type="button" class="btn btn-primary product_page_btn waves-effect waves-light" v-on:click="{ buttons_show = !buttons_show, search_product_show = !search_product_show, manage_products_show = !manage_products_show }"> Add Product</button>
            <button type="button" class="btn btn-primary product_page_btn waves-effect waves-light"> Import Product</button>
            <button type="button" class="btn btn-primary product_page_btn waves-effect waves-light"> Product SKU Wise Report</button>
            <button type="button" class="btn btn-primary product_page_btn waves-effect waves-light"> Download SKU Sheet</button>
            <button type="button" class="btn btn-primary product_page_btn waves-effect waves-light"> Download Product Format</button>

              <button type="button" class="btn btn-white px-1 py-1 dropdown-toggle waves-effect waves-light" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                Actions
              </button>

                Delete
                Archive
                Print
                Another Action

            <vue-good-table
              mode="remote"
              @on-page-change="onPageChange"
              @on-sort-change="onSortChange"
              @on-column-filter="onColumnFilter"
              @on-per-page-change="onPerPageChange"
              :totalRows="totalRecords"
              :isLoading.sync="isLoading"
              :line-numbers="true"
              :pagination-options="{
                enabled: true,
              }"
              :rows="rows"
              :columns="columns"
              :line-numbers="true">
            </vue-good-table>

Search Product

              <autocomplete></autocomplete>

OR

                Skip this Step. Move to <button type="button" class="btn btn-success product_page_btn"> Add New</button>

              <button type="button" class="btn btn-white px-1 py-1 dropdown-toggle waves-effect waves-light" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                Actions
              </button>

                Delete
                Archive
                Print
                Another Action

</template>


text:
Q: Making a navigation using arrays I know this is going to be voted as a bad question but I always have trouble with these.
I am making a php navigation using arrays and my code keeps falling short, mainly in foreach statements. Hopefully if you look you can see where I am trying to go

        <title>navigation</title>
        <?php
            $pages = array("index.html" => "Home");
        ?>

            <?php
                foreach($pages as $link => $page){
                    echo '
  $page
';
                }
            ?>

A: $link and $page aren't going to get parsed here, since they're within single quotes:
echo '
  $page
';

Do this instead:
echo '
  ' . $page . '
';

http://php.net/manual/en/language.types.string.php

A: Change this:
echo '
  $page
';

To this:
echo "
  $page
";

And you should be good to go.
Check up on strings, particular interpolation
http://php.net/manual/en/language.types.string.php


text:
Q: the kernel of surjective homomorphism between topological groups is closed Suppose $\varphi : G\to H$ is a surjective homomorphism of topological groups, then $K=ker\varphi$ is a closed normal subgroup of $G$. If $G$ is compact, then $\varphi' : G/K\to H$ is an open map.
It is straightforward to me that $K$ is a normal subgroup, could some tell me why $K$ is closed and why if $G$ is compact then $\varphi'$ is open?
Thanks!

A: Since $\ker\varphi=\varphi^{-1}\bigl(\{e_H\}\bigr)$, since $\varphi$ is continuous and since $\{e_H\}$ is a closed set, $\ker\varphi$ is a closed set.
If $G$ is compact, then $\varphi'$ is a continuous bijection with compact domain. Therefore, it is a homeomorphism (it maps closed sets into closed sets); in particular, it is an open map.