mardi 28 février 2017

How to create a poll option with slider

I would like to conduct a quiz in my site. Have come across many jQuery plugins for that. Recently i have seen quiz in a tamil news website.

http://ift.tt/2m6fa9B

Want to build something like that. Is there any plugin used on this page? or any other plugins available similar to this?




Xamarin Android: How do i open add header and send post request in webview

I have made a webviewclient to intercept the request and adding the header and call loadUrl but unsure it works yet.

public override bool ShouldOverrideUrlLoading(Android.Webkit.WebView view, IWebResourceRequest request)
        { 
            var headers = new System.Collections.Generic.Dictionary<string, string>();
            headers.Add("Authorization", "bearer " + "s2vIKZd_P91MaaxaZ_XyeUpph6wQNrQ81pcQdUXjFTB3r48RaU9");
            view.LoadUrl(request.Url.ToString(), headers );
            return true;
        }

I can load the page with DefaultHttpClient but it was deprecated.




Modify Graylog2 Web interface

I am using Graylog2.2.1 in Ubuntu 14.04. I want to modify the Graylog web interface a bit, such as adding some link, some panel, images..., I tried to find the directory contain graylog web files. In /etc/graylog-server/ I can found only the server.conf, not any web files. I tried to use search in Ubuntu with keyword "graylog" but there is no folder which I can see the web files inside it. So, where is the Graylog's web UI files location?




How to use CSS combinators with webkit?

I'm trying to change vertical scrollbar thumb color on hovering the track part/piece.

The track is black and the thumb is green, I want to swap it when track is hovered.

See what I got:

html{
  overflow-x : hidden;
}
::-webkit-scrollbar {
    width: 6px;
     /*04ff00 background: #04ff00;    0B1B22*/
  }
  ::-webkit-scrollbar-track {
    background-color: #0B1B22;  
    }
  ::-webkit-scrollbar-thumb {
    background: #04ff00;
  } 
  ::-webkit-scrollbar-track:vertical:hover{
    background-color: #04ff00;  
  }
  ::-webkit-scrollbar-track:vertical:hover + ::-webkit-scrollbar-thumb{
    background-color: #0B1B22;
  } 
<body onLoad="window.scroll(0, 150)">    lorem<br>lorem<br>lorem<br>lorem<br>lorem<br>lorem<br>lorem<br>lorem<br>lorem<br>lorem<br>lorem<br>lorem<br>lorem<br>lorem<br>lorem<br>lorem<br>lorem<br>lorem<br>lorem<br>lorem<br>lorem<br>lorem<br>lorem<br>lorem<br>lorem<br>lorem<br>lorem<br>lorem<br>lorem<br>lorem<br>lorem<br>lorem<br>lorem<br>lorem<br>



How to redirect http://ift.tt/2mqcxAm to http://ift.tt/2llqx9J in blogger

I have set custom domain on my blogger account bow I need to change my blog domain again without losing seo. How can I redirect my http://ift.tt/2mqcxAm to http://ift.tt/2llqx9J. I can redirect my oldblog.com to newblog.com but can't redirect post URLs like http://ift.tt/2mqcxAm to http://ift.tt/2llqx9J. please help I stuck here




When to use random tokens to prevent XSS?

This isn't a language specific question, but I am using PHP5.

I am working on a project that has some amount of PII. Legally we are required to secure this data from hacking attempts, and because of that I have been researching best practices for defending common attack types. Obviously all database calls are using parameterized queries, and all data provided by the user is sanitized to prevent injection. I have also implemented sessions and methods to prevent session hijacking.

When it comes to defending against XSS attacks on forms, best practice seems to be to include a hidden input with a form token, then after the post to check the tokens match. There are further ways to make this more secure.

I have imagined one type of attack and haven't found a solution for it. What if a malicious site loads a hidden iframe pointed at my site (eg, view-member.php?id=1234) and because the victim user is logged into my site, their session continues in that iframe. What is stopping this malicious site from iterating through the IDs and ripping the data to get ahold of PII? Should I be creating a unique token for each page view, and checking that token when the page loads?

I am not 100% sure, but assuming my site is using HTTPS, the browser should warn the user and/or prevent the connection. Is that correct? Is that enough security?




How do python flask app.route() sections execute?

I'm new to flask and python. For example, if you have the following code...

@app.route('/')
def index():
 return "Hello world!"

@app.route('/accounts')
def accounts():
    return some_data

@app.route('/login')
def login():
    return render_template(login.html)

if __name__ == "__main__":
    app.run()

In what order will these execute? From what I understand if you are on the /accounts page of the website, that function will run. If you are on the /login page, that function will run. What role does the parameter for the route method play? Secondly, how many times will the last two lines of code be run (will the app.run() be called once or every time the app.route() is called)? Additionally, what folder should an app be put in within a filestructure for a website?




hosting a web service with a db

I have a Web Sevice Rest writted in JAVA connected in a postegreSQL database and I want hosting it, but I don't know how do this. Where I can hosting? Which kind of service I'll need buy?

ps: I'm from brazil.




What is Jquery and how to make animation for website

Looking for some good tutorials to learn JQuery. I want to learn animations used in websites some suggestions please. thank you!

My basic problem is animation on some sites they say use JS and on some they say JQ




How to send back as a response to a request an html file through this python code? I run this server on my raspberry pi

import socket
ms = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
ms.bind(('', 8080))
ms.listen(5)
conn, addr = ms.accept()
while True:
        data = conn.recv(1000)
        if not data:
                break
        print("Got Request")
conn.close()
ms.close()

What command should I add in order to send as a response to the request a file called hello.html. I have saved the file in the same location as the server.py file.




What is the most secure way to go from an web interface(HTML5 for example) to an sql database? Should there be a middle man? [on hold]

I want to create a simple inventory database with a web interface for my dad to use with his business. It will be over internet. Not looking for a specific answer, just looking to be pointed in the right direction.




Where can I find documentation on the OutlookServicesClient API?

Does any know where to look for documentation for the OutlookServicesClient API? I have found bits and pieces.




Public web hosting for Spring Boot application

Does anyone have advice regarding quality web hosting provider for deploying a Spring Boot web application? This site will not require nuclear powered machinery nor will there be high volume. I am migrating a static site for a friend and want to convert it to Spring Boot so I'll be able to add dynamic features later.




Cordova remote click to call app

I want to make an app for Android using Cordova which listens to an input from another machine (a click of a button on a php page on a laptop which sends a phone number to the app and auto dials it). The dialing part I figured it out. I am searching the web for a solution for the other problem and I got to the conclusion that I should use web servers. But I have no idea how. Can you give me some directions? Thanks,




Regex Expression simple rewrite

I am implementing a rewrite rule, that will be used when a user navigates to the following.

domain/distributor_search

or

domain/distributor_search/page-2, 3, 4 etc.

This is my RegEx

This expression is broken up by the or operator

find word distributor_search with no white space after

or

Find any word with page-num

\b\Wdistributor_search\b\s|\b(\/page-[0-9]*)\b

the page-num expression works fine but find word distributor_search does not




How website that built android app works?

I like to know how website that built android app works.I googled a lot but couldn't find answer.I like to something like that.




What are best practices for high traffic web application ? like tracking page loads of multiple sites

We have the following server resources :

16GB RAM Memory
Intel Xeon E5-2650 v2 @ 2.60GHz (8 Core)
240GB SSD (RAID 10)
1 IP Address (2 extra)
Unmetered Traffic / 1Gbit Port / 100Mbps guaranteed

We are using piece of javascript on around 30 websites untill now sends HTTP requests to PHP script located on our server to track the page loads and save the website information in our MySQL DB.

So the requests sometimes reach millions a day and the server becomes too slow, once I disable sending the requests to our server, everything works fine.

I was thinking that it might be issue with many transactions to db in the same time, so I stopped the storing to db part in the script and got the same issue.

Any suggestions regarding the above issue ?

Assume we have moved to cloud hosting with more resources, is it still fine to save such requests to db immediatly ? I was thinking of saving into file and dump it each 4 hours for ex.




A source of dangerous sites

Not entirely sure If this post belongs here , so if not please remove it .

Anyway , I'm looking for some ".txt" file or an source online that has a list of dangerous/unsafe sites so i can compare it with the crawled links from my crawler.

Thanks for your help :)




keep original selected values after form submit python/flask

I have a two pronged question and would appreciate any advice.

1) I have a flask template with multiple forms in it. Each form presents the user with a list that is dynamically generated from a mongodb query.

name_list = [p['name'] for p in posts.find({'type': "server"})]
name_list.insert(0, "select")

This is then refernced in my html template (thank you again to the person who helped me with this loop on a previous question)

      <select name="option" id="myselect" onchange="this.form.submit()">
      

This selection is then passed back to python to be used in another db query and then present the user with another dropdown select box. However when the first form is submitted, the new page render means that that value is now lost on the html and appears blank. Is there a way to keep this choice persistent so when after the new page render it still appears?

2) Secondly, I would like to keep a running list of what options the user makes, however given the if, elif structure I'm using that variable looses state and can no longer used. Eventually I would like to present the user with two sets of these dropdown menus to generate to final db querys that I can compare and return the difference, however I can only do this if I can keep state of these values generated in the loops.

Please see full code below:

python:

from flask import render_template
from flask import request
from flask import Response
from app import app
from pymongo import MongoClient

@app.route('/', methods=['POST','GET'])
@app.route('/index', methods=['POST','GET'])

def index():
    user = {'name': 'Bob'}

    client = MongoClient('mongodb://localhost:27017/')
    db = client['test-database']
collection = db.test_collection
name_list = []
posts = db.posts
name_list = [p['name'] for p in posts.find({'type': "server"})]
name_list.insert(0, "select")
select_list = []

#if request.form['submit'] == 'myselect':
if request.method == 'POST' and request.form.get('option'):
    choice = request.form.get('option')
    select_list.append(choice)
    sub_name_list = [q['type'] for q in posts.find({'name': choice})]
    return render_template("index.html",
                    sub_server_list=sub_name_list)


elif request.method == 'POST' and request.form.get('option1'):
    choice1 = request.form.get('option1')
    select_list.append(choice1)
    return render_template("index.html",
                    title='Database selector',
                    user='Person',
                    choiced=choice1,
                    total_choice=select_list)


return render_template("index.html",
                       title='Database selector',
                       user='Person',
                       server_list=name_list)

html/jinja:

<html>
  <head>
    <title> - Test</title>
  </head>
  <body>
    <h1>Hi, !</h1>


      <h2>Database selector</h2>
        <h3><table><form action="" method="post">
          <td>
          <label>Select1 :</label>
            <!--<select name="option" width="300px">-->
              <select name="option" id="myselect" onchange="this.form.submit()">
              

            </select>

          </td>

            </form></table></h3>

        <h3><table><form action="" method="post">
          <td>
            <label>Select2 :</label>
              <select name="option1" id="sub_myselect" onchange="this.form.submit()">
              
          </td>

        </form></table></h3>

  <h3>Here is the choice: </h3>
  <h3>Here is the choice: </h3>
  </body>
</html>

Any pointers or ideas would be greatly appreciated.




java client output Collection from WSDL

I have a web service in Java and Java client. Client can ask to display particular record based on ID specified. Web service returns the result ok. There is another method "allQuizes" in web services:

@WebMethod(operationName = "allQuizes")
public Collection allQuizes() {
    Collection<quizDB> allQuestions = new ArrayList<quizDB>();
     try {
        Connection con=quizRecords.getConnection();
        PreparedStatement ps=con.prepareStatement("SELECT * FROM question");
        ResultSet rs=ps.executeQuery();



        rs = ps.executeQuery();

        while (rs.next()) {

            quizDB q = new quizDB();
            q.setqId(rs.getInt("qId"));
            q.setStatement(rs.getString("statement"));            

            allQuestions .add(q);
        }
        rs.close();
        con.close();
        return allQuestions ;
    } catch (SQLException e) {
        System.out.println(e);
        return null;
    } 

}

What should i do on Java Client side to display the Collection result? So far I have:

package web;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.ws.WebServiceRef;
import mainpackage.QuizWS_Service;

public class showAllQuestions extends HttpServlet {

    @WebServiceRef(wsdlLocation = "WEB-INF/wsdl/localhost_8080/quizWebService/quizWS.wsdl")
    private QuizWS_Service service;


    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        try (PrintWriter out = response.getWriter()) {
            out.println("All questions");

        }
    }


    private java.util.List<java.lang.Object> allQuizes() {

        mainpackage.QuizWS port = service.getQuizWSPort();
        return port.allQuizes();
    }

}

Thank you




java.sql.SQLSyntaxErrorException: ORA-00984: column not allowed here

I am facing a problem while inserting data using a web form into my table. I am using a session attribute which when inserted into the table will also act as a foriegn key to another table. I have typed the same code into my sql command prompt and everything seems to work fine but the problem only persist when i use in the java web format. I have made sure that there are no typo's present.But still facing the same problem

<%@page import="storage.data"%>
<%
        String fn,un,ln,mb,em,sug;

         fn=request.getParameter("uname");
         //ln=request.getParameter("lname");
         mb=request.getParameter("mobno");
         em=request.getParameter("email");
         sug=request.getParameter("sugg");

         data dt=new data();

           out.println(fn+mb+em+sug);

           try{

                dt.st=dt.cn.createStatement();
                out.println("1");
                String insert="insert into feedback_user values(myseqfeed.nextval,'"+ session.getAttribute("regid").toString() +"','"+fn+"',"+em+","+Integer.parseInt(mb)+",'"+sug+"')";
                out.println("2");
                dt.st.executeUpdate(insert);
                out.println("3");
                    //response.sendRedirect("user_feedback.jsp?sub=1");
            }
            catch(Exception ex){
            out.println(ex);
            }
%>




Web devlopment flask and local (url_for)

I would like to develop web applications with flask which are also running on my local system without using flask.

I am searching for something like:

<link href="" rel="stylesheet" type=text/css>

if link above is not working, use: <link href="../static/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">

I also tried the code below and various other lines. However, it didn't work.

<link href="" onerror="this.onerror=null;this.href='../static/bootstrap/dist/css/bootstrap.min.css';"rel="stylesheet">

I would like to use this for 20 different css and around 30 diffrent js sources so I am searching for a simple solution which is easy to maintain. Do you have an idea? Can you help?

Thanks, Denis




Filling form with validation workflow and export to PDF

What is the best solution for filling a form with a validation workflow (with history) to then export it to PDF and send it by mail? It's kind of CMS with flexible form fields. How can I implement it (the simplest way, web application if possible)? Thank you.




How do I run an Angular 2 Page in a Spring MVC Application?

I want to have index.html from an angular 2 project to run as a welcome page of a Spring MVC application.
The way I run the angular 2 is via npm start. If I load the index.html without doing npm start, components do not load properly.
How will I be able to make index.html as the welcome page for my Spring MVC Project?




Python web scraper seems slow

I've just created my first python web scraper for use with Kodi and it seems to be slow. It is for a local TV vod website here in New Zealand. It fetches the show lists pretty quickly but when fetching the episodes it seems very slowly especially when compared to the shows fetching. Any help on how to improve my code so it runs quicker will be much appreciated.

Code can be found here: http://ift.tt/2ltuHNL

Hope someone can help me. I'm relatively new to python so I possibly haven't gone about things in the best way. Thanks all




lundi 27 février 2017

Element keeps going behind other element

The Slides is behind navigation element. I am just getting started with hmtl and css and I am wondering how to keep separated. What I am trying to achieve is no matter how wide the navigation is the body will adjust to the left but will not go behind it. Any advice will be appreciated Thanks! enter image description here

The css for the page

body {
    padding-top: 50px;
    padding-bottom: 20px;
}

.body-content {
    transition: margin-left .5s;
}

input,
select,
textarea {
    max-width: 280px;
}

.carousel-caption p {
    font-size: 20px;
    line-height: 1.4;
}

.carousel-inner .item img[src$=".svg"] {
}

Navigation css for page

.sidenav {
    margin-right: 20px;
    float: left;
    height: 100%; 
    width: 250px; 
    position: fixed;
    z-index:1;
    top: 0;
    left: 0;
    background-color: #111;
    overflow-x: hidden;
    padding-top: 60px; 
    transition: 0.5s;
}

    .sidenav a {
        padding: 8px 8px 8px 32px;
        text-decoration: none;
        font-size: 25px;
        color: #818181;
        display: block;
        transition: 0.3s
    }

        .sidenav a:hover, .offcanvas a:focus {
            color: #f1f1f1;
        }

    .sidenav .closebtn {
        position: absolute;
        top: 0;
        right: 25px;
        font-size: 36px;
        margin-left: 50px;
    }

@media screen and (max-height: 450px) {
    .sidenav {
        padding-top: 60px;
    }

        .sidenav a {
            font-size: 18px;
        }
}

@media screen and (max-width: 767px) {
    /* Hide captions */
    .carousel-caption {
        display: none;
    }
}

HTML for page

<body>
    <nav class="navbar navbar-inverse navbar-fixed-top">
        <a asp-area="" asp-controller="Home" asp-action="Index" class="navbar-brand">Computer Repair</a>
    </nav>
    <section id="sideNavigation" class="sidenav">
        <a asp-area="" asp-controller="Home" asp-action="Index">Home</a>
        <a asp-area="" asp-controller="Home" asp-action="Contact">Contact</a>
        <a asp-area="" asp-controller="Home" asp-action="About">About</a>
        <a id="btnShowHide">Close</a>
    </section>
    <section id="main" class="body-content">
            @RenderBody()
            <hr />
            <footer>
                <p>&copy; 2017 - Test</p>
            </footer>
    </section>

        <environment names="Development">
            <script src="~/lib/jquery/dist/jquery.js"></script>
            <script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
            <script src="~/js/site.js" asp-append-version="true"></script>
        </environment>
        <environment names="Staging,Production">
            <script src="http://ift.tt/1WV0d7h"
                    asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
                    asp-fallback-test="window.jQuery"
                    crossorigin="anonymous"
                    integrity="sha384-K+ctZQ+LL8q6tP7I94W+qzQsfRV2a+AfHIi9k8z8l9ggpc8X+Ytst4yBo/hH+8Fk">
            </script>
            <script src="http://ift.tt/2m61cFe"
                    asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
                    asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"
                    crossorigin="anonymous"
                    integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa">
            </script>
            <script src="~/js/site.min.js" asp-append-version="true"></script>
        </environment>
        @RenderSection("Scripts", required: false)
</body>




How to retrieve data on nested data firebase

My database looks like this

app
   -data
      -Kc2Um3N
        -profile
          -something
        -attribute
          -tfyRzLa3
             -**name**
       -Kc2Um3N
         -profile
           -something
         -attribute
           -tfyRzLa3
             -**name**
   -metadata
      -something

I want to access name in the app>data>atribute>name. How do i do this?




HTML set label width in css?

How does one set a label width for all labels?

CSS:

label {
    width: 180px;
}

HTML:

<label for = "customerName">Name:</label><input type = "text" name = "customerName" required><br>

but the label is "Name:" length. I expected that the label will be 180px wide. It's the same width whether the css code exists or not.




.htaccess url parameter rewrite for specific page

I have been battling for hours now and searched Google and StackOverflow, without a solution to my problem, hope you guys can help! :-)

I have a page with parameters as follows: profile?userid=123456789. I want it to rewrite to profile/123456789. This I have, but now everywhere on this page all links gets /profile/link. Is there any fixes to this? Thanks in advance, here comes my .htaccess code.

RewriteEngine on RewriteCond %{REQUEST_URI} !/profile.php

RewriteRule ^profile/([^/]*)$ /profile?userid=$1 [L,QSA]




Is worth learn java in 2017?

Thinking about job oportuniities, is still worth leanring java? I've made some searches on indeed and saw that there is a lot of jobs for java more than for other languages. But, is a future-proof language or is dying? I'm a front-end newbie developer and don't wanna get deep in back-end with javascript. But a lot of people recomend languages like ruby or python, but the number os jobs is disgusting. Is a good idea learn java for back-end web development?




How can I access this

I'm trying to access some JSON data that I got through an ajax call. I'm not sure how to access this data now though. I want to extract the "test" portion out of the json. Could someone please help me out with this

enter image description here

code sample:

$(".test").on("click", function() {
var dialogID = $(this).attr("id");
console.log(dialogID);
$.ajax({
  type: "GET",
  url: "test.php?id=" + dialogID,
  dataType: "json",
  success: function(data) {
    console.log(data);
  },
  error: function() {
    console.log("error");
  }
});




How to create efficient site navigation with pure html?

This seems like an obvious question here but I’m building a basic website with bootstrap and I need to create multiple pages. I’ve created multi-page sites in the past using various frameworks, but I’m actually not quite sure how to accomplish the same goal efficiently with html alone. I currently have my navigation setup similar to this example.

This is all good in terms of creating multiple pages, but I’m concerned about having to reload everything in my headers over and over again and how much this will slow things down. I’m also thinking that having the filename of each page displayed in the URL is likely not a best practice.




Where to include css and js files on a web application [on hold]

I am working on a web application, and tend to include javascript and CSS files on my base template if it is used by more than one page for the sake of convenience, so I won't run into 'missing dependency' issue on my commonly used external files. However, that kind of bloats my base template, and I worry about its performance on the first load. I have not deployed my application and thus have not tested in real life cases.

So, I wonder if there are common practices, whether to include such files in base template, or in individual pages?




How is Google using "Soften" add this effect to background images? [duplicate]

This question already has an answer here:

I stumbled across a blurring/softening effect that's being added to background images via CSS or Javascript. I'd like to replicate this effect on background images on my website, but when I look into the code on the Google My Business I cannot figure out how to duplicate this effect.

Any ideas on how to duplicate this? Blurred Image Background




Div tag inside td does not showing background color on mozilla.

My goal is to draw bar chart and everything looks fine on chrome but on mozilla(v 46.0.1) div's tag inside td element do not display background color at all.

Here's simplified code

          <table>
            <tbody>
              <tr>
                <td>
                  <p>Label</p>
                  <div></div>
                </td>
              </tr>
            </tbody>
          </table> 

Here's css

table {
  width: 100%;
  height: 100%;
  border-collapse: collapse;
  border-bottom: 1px solid #aaa;
  position: absolute;
  z-index: 2;
}

td {
  vertical-align: bottom;
  position: relative;
  margin: 0;
  padding: 0;
  width: initial;
  z-index: 3;

  > div {
    background: #72a822;
    height: 75%;
    margin: 0 20%;
  }
}




Vaadin spring boot extreme long startup

I am currently developing a little Vaadin Spring Boot application. All works fine. I have my Spring Boot Application, that is auto-configured to detect the Vaadin UI and all of its Views.

When I start the Application in my IDE, the start Process takes max up to 5 secs. But when I build my final JAR and run it from the Command Line, it takes extremely long. Note: I started the JAR with the command: java -jar at 11:50:00.

LogFile on Pastebin

The Startup process of Spring Boot finished at 12:02:19. Then After 4 minutes, I reloaded the Website where the Application should run on.

From 12:06:00 until 12:07:40 the Vaadin Application loaded and I finally could access my Application.

I am not that familiar with Spring Boot, but what I definitely know is, that the Startup should not take that long.

Does anyone have an Idea, what could be changed that the the Application starts faster?

Thanks in advance for your help.




Color of a pixel independently of the browser and resolution

I want to build a tool which can give back to the user the color of pixels of a image, for this I found how to do, with java.awt.Robot it's quite easy

But the problem is (it just came to me after one week coding ^^) that because it's from a web page, the position of each pixel i want to get back the values (there is about 5 pixel i want) will be dependant of the resolution of the screen and the browser (the image won't be exactly at the same height on Chrome than on Mozilla), if you have download someting recently you'll have a bar at the bottom ...

But apparently the picture has always a size of 330*422 so many I have to calculate the absolute position of a corner a the image from the corner of th screen and then apply relative positions from this corner to find the pixel I want ? I know a bit of JsoupParser and Dom but becase of how the page is made not sure i'll help

So not sure there is an issue, but I'm here to ask help to find a solution if there is one ;)

(In case you want to see : http://ift.tt/2l2xUrl, there is some items of the guy which can change and i want to look at it like every 5-10 minutes by )




Return value from select tag flask/jinja

I'm attempting to have a variable returned to my python code on clicking a select from a dropdown box - to generate the post I'm using javascript .submit(). The value would then be used create a mongodb query for which the result would be used to populate another dropdown menu on the same page.

python:

posts = db.posts
name_list = [p['name'] for p in posts.find({'type': "server"})]

if request.form['submit'] == 'myselect':
    choice = x
    sub_name_list = [q['sub_server'] for q in posts.find({'type': choice})]

return render_template("index.html",
                       title='Database selector',
                       user='Bob',
                       server_list=name_list,
                       sub_server_list=sub_name_list)

html/jinja:

  <label>Select1 :</label>
    <select name="option1" id="myselect" onchange="this.form.submit()">
      
    </select>
  </td>

  <td>
    <label>Select2 :</label>
      <select name="option2" id="sub_myselect" onchange="this.form.submit()">
      
  </td>

Thank you in advance for any pointers or advice.




Designing a Project

I want to start a project and need some help determine the technology / set of knowledge.

The project will be running on a raspberry-pi, which already has Mopidy up and running. I want to build chrome-cast like software, but way more simpler. What it should do on the server: open a website. When a client accesses the server using a browser, it'll receive the website that the server has opened and can access links and play music (for example if the server launched youtube). I want that every client will be able to access the very same site so that if 2 clients connect to the server they will see the very same site. Also, the music needs to be played on the server and not on the client.

What I've done so far: I created a basic HTML page with the tag 'iframe' but what it did was to open the site on the client (and all the music was played on the client), also two separate clients received not the same session.

I do know to program, mostly embedded systems and low level architecture, never done something with web (but i'm a quick learner). I'm asking for some tips and technologies you recommend for me to look for implementing the project.

Thank you in advance




Why We Need to Set Content Type of header request

I want to know that what is content type, why we need to set content type of header request and how many types of header content can be set? please provide documentation if possible.




Adaptive or Responsive

I am planning on making a website but now I am considering using adaptive or responsive for mobile experience. personally, I never create adaptive design before. I think that will possibly different layout and content to show, on my previous experience responsive layout is "hiding" the element to not show on some device size like bootstrap using "hidden-xs" or "visible-xs", but using that way actually Web Page also need to get data from server and maybe loop or process whatever function but in the end just only for desktop and hidden for mobile. is it best practice? or any other better way or best practice to solve this?




dimanche 26 février 2017

How to get date of a page(HTML,PHP... etc ) that uploaded in Server?

I am developing an Application that gets the " Date of Upload " of a Webpage. So, my doubt is How ?




Google OAuth2 callBack code endpoint to return personal parameter without changes

I have configured URL to get back OAuth2 code:

http://ift.tt/2lpvejA

More useful format (to check parameters): http://ift.tt/1Nvzg0y?

scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.metadata.readonly&

access_type=offline&

include_granted_scopes=true&

state=state_parameter_passthrough_value&

redirect_uri=http://localhost:3344/oauth2/google/callbackcode&

response_type=code&

client_id=676016849609-r53vpjccpr9kf5uvuul7h6kvek1id2oh.apps.googleusercontent.com&

login_hint=TEST_USER_ID&

prompt=consent

I need identify user in my application if I receive code at my callBackCode endpoint, but I do not have any parameters for that.

I would add userIdInMySystemToGetBackMyRequestDescription=TEST_USER_ID but it does not returns my additional parameter without changes.

Any suggestions how my web could transmit TEST_USER_ID to my server via google oauth?




how to make chat website using JavaScript?

Thanks for reading my Post. I want to Create a simple Web site ***** I need ***** 1. chat. 2. registration and login system. 3 System - Send correspondence requests. 4. chat face-to-face and group chat. 5. the possibility of modifying the user profile. ***** I have ***** I have a simple hosting in :www.000webhost.com


Please help me anyone who has experience in this field. Because I want to do my research

Thank you.




why cant I generate with gii in Yii2?

I want to ask you why I cant generate the view table with gii Here is my picture enter image description here

it was said that "Table associated with Rangkuman must have primary key", and I have made primary key with table that associated with Rangkuman. What should I do? Thankyou




Django. How to add an extra field in User model and have it displayed in the admin interface

I'm learning Django and need some help.

I need to include an extra boolean field in my User Model (auth_user table in the db I believe) and have it be displayed in the admin interface when managing users, like the staff status field in this image...

127:0.0.1:8000/admin/user : http://ift.tt/2lKQ53H

and...

127.0.0.1:8000/admin/auth/user/2/change/ : http://ift.tt/2lppdmU

I'm unsure on how to approach this. I understand I'll have to extend the AbstractUser model and then perhaps manually add the field into the db, but then how do I update the new field for the view, form and templates for the admin interface? Will I have to rewrite the django admin source code for all of these or is there an simpler way?




How to let the user customize view through settings page

I have a question regarding how to allow the user change how data is presented. Let's say I want to do a twitter-like feed where a string and a profile picture is shown. How should I do if I want the user to be able to visit a settings page and deactivate a "show profile pictures" checkbox to change the way the data is shown.

What is the best way to allow the user to customize it's feed to look different based on it's own personal settings? I am thinking about everything from storage to how to render the HTML based on these settings.




Grepping a word buried in a on a website

I am having trouble grepping a word on a website. This is the command I'm using

wget -q http://ift.tt/2louVpo | grep 'medical' which is returning nothing, when it should be returning

[name of the website]:Many recent developments in biological and medical .

.

.

.

.

. The overall goal of what I'm trying to do is find a certain word within all the links of the website

My script is written like this

#!/bin/bash

#$1 is the parent website
#This pipeline obtains all the links located on a website
wget -qO- $1 | grep -Eoi '<a [^>]+>' |  grep -Eo 'href="[^\"]+"' | cut -c 7- | rev | cut -c 2- | rev > .linksLocated

#$2 is the word being looked for
#This loop goes though every link and tries to locate a word
while IFS='' read -r line || [[ -n "$line" ]]; do
        wget -q $line | grep "$2"
done < .linksLocated

#rm .linksLocated




Making a popup when someone enters the site

So basically I would like to implement the feature that when someone enters the site it welcomes them with a popup with two options to choose (language) and I don't know how to make it so I'm asking for help.

Picture to better describe it




How can I update a Firebase element via Javascript?

I am programming a little app in which you have a score system (like 10 points a user) and I am doing this via the Firebase database.

My problem is, that I don't know how to update my database element which I have created on the beginning. I want to update my point via a Javascript script, which can be triggered.

So this is my current code:

var rootRef = firebase.database().ref();

var users = rootRef.child("users");

var log = document.getElementById('log');

    document.getElementById('registerBtn').addEventListener('click', function(event) {

        var empt1 = document.forms["form1"]["email"].value;
        var empt2 = document.forms["form1"]["password"].value;
        var empt3 = document.forms["form1"]["email"].value;

        if(empt1 == "" || empt2 == "" || empt3 == "" || !document.getElementById("txtemail").checkValidity()){
            alert("Something went wrong!");
        }
        else{
            $("#registerProgress").show();
            $("#registerBtn").hide();
            //Get email and pass
            const email = txtemail.value;
            const pass = txtpassword.value;
            const username = txtusername.value;
            const auth = firebase.auth();

            const promise = auth.createUserWithEmailAndPassword(email, pass);
            promise.catch(e => console.log(e.message));
            //users.child(username).set({ name: username });
            users.once('value', function(snapshot) {
                if (!snapshot.hasChild(username)) {
                    users.child(username).set({username: username, points: "100"});
                }
                else {
                    alert("That username is already registered");
                }
            });
        }
    });

Thanks in advance!




aligning images using HTML

I'm currently trying to design a web page. I don't have much experience with HTML and are therefore finding it difficult to get my page looking how i'd planned. I would like to have four square images, two top with two directly below but im struggling to align these. I've tried to research this but all i seem to be able to find are examples with text wrap. any help appreciated, thanks.




Web site theat blocks loading content from certain sites or domains

I am worried that my web may be hacked (apache + joomla 3). Most of hacks consist on placing spam on posts or sending information to other websites in other domains/IPs. I am thinking about a security protection, maybe done with .htaccess that blocks any request done from my web site to some blacklist of domains. Or the other way around, allow only to fetch content from a whitelist of domains (localhost and very few).

Any idea how this can be done? Ideally it eould require only to change the root .htaccess file and be compatible with joomla SEF.




What are the hex codes for the blue, green, and orange used as the border, padding, and margin in chrome?

The box model has a blue, green, and orange color associated with them, at least in chrome. I was wondering if anyone knew the hex color codes for these shades?




Hugo not generating index and 404 .html files.

I seem to be having an issue with Hugo.

I am following their get started guide: http://ift.tt/2lU09rx

I have followed this steps:

1) Created new site:

$ hugo new site my-site

2) In that folder I then typed the command for the new theme:

$ hugo new theme mysite-theme

Every worked fine, the files are there. The problem is them when I try to render the site. I type in the command:

$ hugo

Which creates the /public folder and two files:

  • index.xml
  • sitemap.xml

However, according to the guide it is supposed to create 4 files:

  • index.html
  • index.xml
  • sitemap.xml
  • 404.html

Now, even though there is nothing to put in these files, it should still create the index.html and 404.html files.

Has anyone else encountered this problem? Have I done something wrong or missed a step?

Thanks in advance for the help




Error on using .htaccess

I'm trying to use my .htaccess file but I still can't figure it out what am I doing wrong.

I only want my domain to be yescpol.com.br, and it always comes like this But I always have this problem

My .htaccess is inside the folder "porcelanato" and it has this code:

RewriteEngine on
RewriteBase /porcelanato/

I only want my index.php to turn into yescpol.com.br

What am I doing wrong?




Hibernate One Entity Multiple Tables per Country

I'm developing a web app, that becouse of legal issues, I have to divide the tables per country.

I will have to name the tables like TABLE_A_ES, TABLE_A_AR, TABLE_A_ZA, etc. For now there will be no difference in table columns so I want to reuse the entity.

Depending on the user who logs in he will be able to CRUD on specific tables. Can Hibernate/JPA do this ?

Thanks




how a flask-python script calls another flask-python script

I'm new in flask-py2neo-pyhon-neo4j so I need some help I have the following issue. My main .py that runs/executes is views.py I have another py script where I have the submission of some form_data.html>to be more clear views.py --calls-->app.py--calls--> form_action.html & form_submit.html how can i achieve this sequence?? the flask-python code: views.py

@app.route('/vital', methods=['GET','POST'])
def vital():
#    username = session.get('username')

    name=request.form['pname']
    sfx=request.form['psfx']
    midname=request.form['pmidname']
    bsurname=request.form['pbsurname']

#    if not name:
#        flash('You must give your post a name.')
#    elif not sfx:
#        flash('You must give your post a suffix.')
#    elif not midname:
#        flash('You must give your post a midname.')
#    elif not bsurname:
#        flash('You must give your post a bsurname.')
#    else:
#        User(session['username']).vital(name, sfx, midname, bsurname)

    return render_template('form_action.html', username=username, sfx=sfx, midname=midname, bsurname=bsurname)

app.py

from flask import Flask, render_template, request, url_for
app = Flask(__name__)

@app.route('/')
def form():
    return render_template('form_submit.html')

@app.route('/hello/', methods=['POST'])
def hello():
    name=request.form['pname']
    sfx=request.form['psfx']
    midname=request.form['pmidname']
    bsurname=request.form['pbsurname']
    return render_template('form_action.html', name=name, sfx=sfx, midname=midname, bsurname=bsurname)

if __name__ == '__main__':
    app.run()
    send_data()

form_action.html

 <html>
    <head>
        <title>Person</title>
    <link rel=stylesheet type=text/css href="">    
    </head>
    <body>
        <div id="container">
            <div class="title">
                <h1>Person's Vital Information</h1>
            </div>
            <div id="content">
                Tell us  about <strong></strong> !
            </div>
            <div class="title">
                <h1>Flask code</h1>
            </div>
                <code><pre>
@app.route('/hello/', methods=['POST'])
def hello():
    name=request.form['pname']
    sfx=request.form['psfx']
    midname=request.form['pmidname']
    bsurname=request.form['pbsurname']

    return render_template('form_action.html',  name=name, sfx=sfx,  midname=midname, bsurname=bsurname)
                </pre></code>   
            </div>
        </div>
    </body>
</html>

form_submit.html

<html>
    <head>
        <title>Person</title>
        <link rel=stylesheet type=text/css href="">    
    </head>
    <body>
        <div id="container">
            <div class="title">
                <h1>Person's Vital Information</h1>
            </div>
            <div id="content">
                <form method="post" action="">
        <label for="pname">Name:</label>
                <input type="text" name="pname" /><br />
                <label for="psfx">Suffix: </label>
        <input type="text" name="psfx" /><br />
        <label for="pmidname">Middle Name: </label>
        <input type="text" name="pmidname" /><br />
        <label for="pbsurname">Birth Surname: </label>
        <input type="text" name="pbsurname" /><br />

        <input type="submit" />
                </form>
            </div>
            <div class="title">
                <h1>Flask code</h1>
            </div>
                <code><pre> 
@app.route('/')
def form():
    return render_template('form_submit.html')
                </pre></code>   
            </div>
        </div>
    </body>
</html>




Google can't crawl my site because it is unable to access site's robot.txt

i am having this issue: “Google couldn’t crawl your site because we were unable to access your site’s robots.txt file.” My site: www.pufmag.com

I have already tried all the suggestions provided in the related problems but nothing seems to be working. I am using a plugin that has my site in maintenance mode. Could that be the issue?

I have made a robots.txt file and pushed it in the root directory but problem remains. Any kind of help is highly appreciated. Thank you!




Select from dropdown list in flask

I'm very new to Flask and web development and am having some trouble with generating a list from a mongdb query and passing that through to the html template to be in a dropdown menu in Flask.

Please see the current code below:

views.py

from flask import render_template
from app import app
from pymongo import MongoClient

@app.route('/')
@app.route('/index')

def index():

user = {'name': 'Bob'}

client = MongoClient()

client = MongoClient('mongodb://localhost:27017/')
db = client.test_database
db = client['test-database']

collection = db.test_collection
posts = db.posts
name_list = []

for post in posts.find({'type': "server"}):
    name_list.append(post['name'])

# Get selected option and save into variable?
#if:
#        choice = x.option

return render_template("index.html",
                       title='Database selector',
                       user = 'Bob',
                       server_list=name_list)

server_list contains: [u'server1', u'server2', u'server3']

index.html template

<html>
  <head>
    <title> - Test</title>
  </head>
  <body>
    <h1>Hi, !</h1>


      <h2>Option selector</h2>
        <h3><table><form action="" method="POST">
          <td>
          <label>Select :</label>
            <select name="option" width="300px">
            
            </select>
          </td>

        </form></table></h3>


  </body>
</html>

Firstly, the select list does not get populated and secondly, would anyone have a kind suggestions on how to capture the result of the selection so I can use this in another database query and generate a second dropdown list?

Any hints greatly appreciated.

Thank you




How to use JSOUP to parse HTML code that doesn't contain id's

I am trying to scrape timetable information off my universities webpage as part of a project where I am making a timetable android application, but all the examples I seem to find on the internet scrape by use of ids which do not appear in the HTML code.

<tr>
    <td style="border-bottom:3px solid #000000;" rowspan='1' >Mon </td>
    <td style="border-bottom:3px solid #000000;"> <img src="http://ift.tt/2lnxfg5" width="1" height="1"> </td>

This is how the code appears and I want to scrape the html code of each element. This code is consistent for the rest of the week ('Tue','Wed','Thu','Fri').

I would appreciate any help or advice to how to do this.




Can I get response headers from javascript?

var script = document.createElement('script');
script.src = "http://ift.tt/1hR1erU";
document.documentElement.appendChild(script);

I load it, But I wish to know response headers of loading script:

date: Sun, 26 Feb 2017 00:00:00 GMT
etag: "хххх"
status: 200

Do you know ways to get such data?




General advice: interactive webpage with lists to generate db querys [on hold]

I would like some general advice please on a small project I would like to develop. I'm quite new to web development and would like some general strawman pointers from the outset so I can best focus the solution.. It's looking a bit daunting at the moment :)

Basically, I have a mongodb with multiple entries in the same collection. I would like to create a webpage that generates a dropdown box with a list that is sourced from a database query - for example:

for post in db.find({'type': "server"}):
name_list.append(post['name'])

'print name_list' would give [server1, server2, server3]

Where the user can then select the 'name' and then this option is used in another db query to generate another dropdown box that would then in turn be the source for another database query and would eventually print out the final queried result to the webpage for the user to see.

I'm keen on perhaps using flask and putting in some nice css styling but I'm quite unsure how to have this kind of interactivity.

Again, please, I'm not looking for a coded solution but rather just some pointers on the next best steps.

Thank you.




Bootstrap panel fit to page height

I want the panel and image to be at a fixed height so that it is not larger than the page and there is no scrollbar. How would I archive this?

<div class="container">
            <div class="col-md-8">
            <div class="panel panel-primary">
                <div class="panel-heading">Panel</div>
                <div class="panel-body">
                    <img src="http://ift.tt/2lcX3KV" width="100%" height="100%">
                </div>
            </div>
        </div>
</div>

http://ift.tt/2mjqBvG




How to Force Asp.net To Handle User's Request respectively?

Is it possible to Handle simultaneous user requests respectively in Asp.net WebApi? I Don't want to ignore user request with throttling And I don't want to add user session cause I have User UUID. Due to multi-threading issue I want user request to be added inside a queue and whenever it's previous request finished next one happen.




mysql query erro

I am using php and mysqli for my web project but every thing seems to be fine but it gives me boolean error at mysqli_num_rows();

enter image description here

Note: the first line I echo so I can see whether the values I entered are being passed or not and it works fine still on the next line it gives me error Boolean.

<?php
include("Database/database.php");
session_start();
$uname = $_SESSION['un'];
$upassword = $_SESSION['up'];
$varch = $_SESSION['ch'];
$sql = "SELECT `username`, `userpwd`, `userid` FROM `useraccount` WHERE username = '$uname' AND userpwd = '$upassword'";
echo $sql;
$result = mysqli_query($link, $sql);
if($rowcount = mysqli_num_rows($result))
{
    if($varch == "on")
    {
        setcookie("name", $uname, time()+60*60*7);
        setcookie("password", $upassword, time()+60*60*7);
    }
    header('Location: useraccount.php');
}
?>




Q: Website HTACCESS Canonical 301 Redirect Code Assistance Needed

My Website is for Web Design purposes, so it is a Single-Page Site (just my Home page)..
However, by SEO standards, there are still multiple url's that land at the same homepage.

I have already set the rel="canonical" tag in the head, but still need to set 301 redirects
to point to my Canonical URL at http://www.example.com/
Keep in mind I want the www, as well as the trailing forward slash "/"..

My CPanel isnt capable, so I've concluded I need to add the code to my HTaccess file.

MY GOAL: Redirect traffic that lands on any of the following url's, to my Canonical URL..
example.com
example.com/
http://ift.tt/2lT3iYi
www.example.com
http://ift.tt/1s8YSqc

TO MY CANONICAL AT: http://www.example.com/

MY PREVIOUS ATTEMPTS:
I attempted in part using my cPanel, but it ended up looking like this:
RewriteEngine On RewriteCond %{HTTP_HOST} ^example\.com$ [OR] RewriteCond %{HTTP_HOST} ^www\.example\.com$ RewriteRule ^default\.html$ "http\:\/\/www\.example\.com\/" [R=301,L]

I also read a popular SEO Site's article, suggesting using:
RewriteEngine On RewriteCond %{HTTP_HOST} ^example\.com RewriteRule (.*) http://ift.tt/VAk5HC [R=301,L] NOTE: Some Versions of Apace require an extra line or two of code for SymLinks and a different structure of the rewrite rule as follows: RewriteEngine On Options +FollowSymlinks RewriteBase / RewriteCond %{HTTP_HOST} ^example\.com$ [NC] RewriteRule ^(.*)$ http://ift.tt/VAk5HC [R=301,L]

MY QUESTION:
For what I listed as my GOAL above, which is redirecting anybody landing on ANY of those URL's, to my preferred Canonical URL (also listed above), what EXACTLY would be the CORRECT code I should enter into my HTaccess file, to accomplish this?

HUGE Thank you to anybody who can assist me with this..
Thanks in advance, It's much appreciated..

-B

PS. I've checked the reccomended related links on this site, and the ones i've found are mostly related to forcing HTTPS and/or a separate goal than mine.
Thanks again in advance for any help provided!




samedi 25 février 2017

Add-Member - ForEach Item Get Value From Other Info

I have a PowerShell script, which contain this methods:
1. Invoke-WebRequest: to get my json file.
2. Invoke-RestMethod: to get all ip information from (1).
I want to Add-Member which from $gip.city to each r.users information

Here is My Wrong Syntax:

$r = Invoke-WebRequest -Uri http://ift.tt/2lcpwkf | ConvertFrom-Json
$expip = $r.users  | select -expand ipaddress


ForEach($ips in $expip){

    $infoService = "http://ift.tt/2mj4Yvn"
    $gip = Invoke-RestMethod -Method Get -URI $infoService

    $r.users| Add-Member -NotePropertyName city -NotePropertyValue $gip.city -Force
}

#Resilt:
$r.users

When I run it, the new member 'City' is not contain any value, it shows this result:
http://ift.tt/2lcuFJ4




Django server details

I have been working with django since 2 years, still confuse with some of the server related concepts of django as follows:-

  1. What web server does django use when I run python manage.py runserver?

  2. What is wsgi(I know it is web server gateway interface(sets of rules can say protocols) act as an middle-ware for the communication of web server and web application) then wsgi is the server django runs on?




What are some approaches to exchange data without using SSL/TLS

When creating any kind of application web,api etc; This days the best practices recommend to secure endpoints by using TLS, but what we can learn from the cloudbleed issue, is that it may not be enough.

Therefore I would like to know what could be done to keep a certain level of security even when TLS is compromised.

For web applications what I currently use is jsencrypt, basically encrypts all data on client browser side before it is sent, but in order to to this I need first to exchange a shared secret (token/cookie) between the server and client, but when dealing with API's that don't support javascript what could be used?

Regarding the exchange of tokens, by instinct it may be obvious to say use OAUTH, OpenID Connect, json tokens , but all of them require or delegate trust to TLS, and again when this is compromised it became useless.

If I am right OpenID could be used without SSL to share a "common secret" by doing Diffie–Hellman key exchange, is there something similar that could be implemented keeping in mind that if TLS gets compromised, easy measure could be taking like revoking tokens or changing "salts" ?

For now I think by following the gpg or rsa (private/public) keys is the way to go, in a way that probably everyone could have access to the public keys but will not be available to see the content of some data signed to a specific user.

But question remains in how to exchange that very first "known secret" between client and server avoiding a possible man in the middle attack considering TLS can't be trusted.




How to display all the values in auto drop down list using selenium web driver when it is developed using tag

How to display all the values in auto drop down list using selenium web driver when it is developed using tag.

My code

driver.get("https://www.yatra.com/");// URl of yatra
    String origin ="(//input[@name='flight_origin_city'])[1]";// text box for entering origin
    driver.findElement(By.xpath(origin)).sendKeys("Bangalore");
    String destination = "(//input[@name='flight_destination_city'])[1]";// text for entering destination
    driver.findElement(By.xpath(destination)).sendKeys("M");
    List<WebElement> lists= driver.findElements(By.xpath("(//div[@class='viewport'])[2]")); // this is the div where all the values are present .

    for (int i=0; i<lists.size();++i){

        System.out.println(lists.get(i).getText());// getting the text for all the values.
    }




Automatic rapid fire screenshots of website

There's an architect's website I absolutely adore. However it doesn't allow jpeg saving. I wanna take screenshots of the following links in full screen mode on Google Chrome. Any way to get this all automated and get all jpegs instantly? That is, the screenshots get taken like a machine gun da,da,da,da,da...?

http://big.dk




Downloading file from PHP not working when using AJAX

I am trying to download a file, say an image, to a client's computer in PHP.

download.php

<?php
   $file = "path_to_file";
   header('Content-Disposition: attachment; filename="'.basename($file).'"');
   readfile($file);
   exit;
?>

Using the code above works fine, as long as I open the PHP file "manually" in the browser. When using AJAX to execute the PHP code from a JS file (see below), however, it simply does nothing.

var request = $.ajax({
   url: "download.php",
   type: "post"
});

How could I fix this?
Thank you for your answers.




is there a fingerprint SDK to access a website?

I'm a college student working on my final project .. I need to develop a website and need to make the login access to it by fingerprint .. is there a JavaScript or PHP SDK I could use? thanks in advance




How do I move the elements of one div (side navigation bar) to the right of another div (main content)?

I have 3 divs containing elements for the top nav, side nav, and main content (appearing in that order in the source code). How do I place the main content to the right of the side nav?




Reload other PHP side by timer

I'm trying to "ping" stillalive.php site from another php site, every 10 seconds.

stillalive.php contains a sql query which updates a timestamp in a database.

Is it even possible to get that working with php? Or what should be able to handle that?




Use a certain font from a website

I want to use the font 'Semplicita Pro' from the site http://ift.tt/2abBGVa for my own website project but I can't seem to find the font file on the website. Even if I should be able to get my hands on the file, would it be legal to use the font?




Stick SVG to bottom right of screen using css

The CSS class called .svgImage is applied to a on the page. Everytime I resize the browser window, the svg image resizes correctly but it keeps moving around the page.

For example, making the browser window vertically smaller will move the svg image upwards. And horizontally smaller will move the svg leftwards.

The svg image needs to stay stuck to the bottom right. Imagine the svg file as a four corner square, the bottom right corner should stick to the bottom right corner of the page.

Here is the CSS for the div to stick:

#foo
{
     position: fixed;
     bottom: 0;
     right: 0;
}

Thanks in advance!




Domain and hosting - Beginner

I'm very new to this.

I'm making a Wordpress website for a friend of mine.

He purchased a domain name via google (with the parner goDaddy). He's using GSuite softs (Gmail, agenda ...). Google is not hosting websites like Wordpress.

How to host the wordpress and link it to the domain name he already has ? Redirection is not what I want, I want the URL to stay the same.

I've seen about transfers, but I want to keep Gsuite softs.

Thank you !




I need help making this project which involves recording mouse activities in an area on the webpage

Lets say there is a BOX inside which there is QUESTION. I need to record all mouse activities that takes place within that box. What technology can I use to create such a page? Do I just stick to PHP, JavaScript or is there some other better way to get it done?




CanvasJS Strange format of Time on x-Axis

I created this diagram with canvasJS. The X-axis is supposed to show the time of the day in hours. Right now, the time looks like 1:0, 3:0. But I would like to have it like 01:00, 03:00. How can I fix that? Furthermore, the Y-axis does not set automatically. I would like to have only the value area in which points are set. Thank you very much!

Chart JS Diagram




how can i resolve my this database issue?

when i upload my php website and want to access it the error i have changed the username and password which is on my domain Connection failed: Access denied for user 'root'@'localhost' (using password: NO) can any one help me out




Login Page error

Hello Guys! I am facing problem in the login page. When I press login button it takes me to userpanel only if Remember me checkbox is checked. if it is not checked then It stays on login page. I cannot figure out error.

<?php
    include("Database/database.php");
    session_start();

    if(isset($_COOKIE['username']) and isset($_COOKIE['passcode']))
    {
        $username = $_COOKIE['username'];
        $passcode = $_COOKIE['passcode'];

        $_SESSION['name'] = $username;
        $_SESSION['pwd'] = $passcode;

        header("Location: useraccount.php");   /*Checks if cookies are set then takes me directly to useraccount.php */

    }

     else if(isset($_POST['login']))
    {
        $username = $_POST['username'];
        $userpwd = $_POST['userpwd'];
        $rem = $_POST['remember'];

        $query = "SELECT * FROM login WHERE userName = '$username' AND Password = '$userpwd'";

        $result = mysqli_query($link, $query);
        $row = mysqli_num_rows($result);

        if($row > 0)
        {
            $_SESSION['name'] = $username;
            $_SESSION['pwd'] = $userpwd;

            if (isset($_POST['remember']))     /*if remember me checkbox is checked than it set cookies and it takes me to useraccount.php page. But if I donot check the check box (remember me) than I am where I am on login page. */
            {
                setcookie("username", $username, time()+60*60*7);
                setcookie("passcode", $userpwd, time()+60*60*7);
            }

            header("Location: useraccount.php");     /* It should procees to              useracocunt.php page but it stays on login.php*/
        }

        else
        {
            header("Location: login.php");      /*Used this for testing purpose if login fails it takes me to homepage which is working fine*/
        }
        mysqli_close($link);

    }

    ?>




vendredi 24 février 2017

How to make api using expressjs that can give input to other website?

I want to create a dynamic link of other website using input in their website form from my api(express server) so that i can scrape their website




How to deploy html to heroku?

so I have home.html file, basically it's the whole source code of html. and I also have index.php :<?php include_once("home.html"); ?>. but it keeps on saying language is not detected.

! No default language could be detected for this app. HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically. See http://ift.tt/JvAYiJ ! Push failed




Handling different types of user roles in laravel

I have got a web project which has 3 types of users, say root admin, a super admin and kitchen admin. each user or role has different functionalities say root admin will create super admin and other small functionalities, same way super admin would be creating kitchen admin and other functionalities and kitchen admin has its own functionalities say handling orders. I wanted to know whether would it be a good idea to make seperate laravel setup for each users or all this users can be developed in one laravel setup?. a small lead on this would be a great help since i am new at laravel. thank you guys.




Point domain to Phonegap port

Currently i've successfully pointed my website to my web-server on one subdomain. However; currently its being pointed to port 80 by default.

<VirtualHost *:80>
    ServerAdmin webmaster@localhost         
    ServerName coreapp.site.me
    ServerAlias www.coreapp.site.me
    DocumentRoot /var/www/coreapp/public
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    <Directory /var/www/coreapp/public>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

I'm looking to hookup the same domain with a different subdomain to :3000 for phonegap; where am I able to configure this?

I assume Phonegap has its own configuration and is not a part of Apache's configuration; i'm still quite unsure due to lack of documentation.

How am I to achieve this on an Ubuntu system?




How to Implement custom role management for users in laravel 5.4.6

Hello I am working on custom user role management ( not using laravel built in implementation ) , i have following tables

1- User 2- Role 3- User_Role

Problem I want to show different layouts according to logged in user on the behalf of current logged in user role.

Here is master layout code

<section id="container" class="" style="">

    @include('frontend.header.header')

        @include('frontend.sidebar.sidebar')

        <div class="admin_right_content">
        @section('content')
        @show
    </div>
</section>

This layout should be changed according to authenticated user, please guide me, thanks




write and read from firebase so that user cannot abuse that?

I have a web application. On the webpage user enter 2 IDs. I want to get those 2 IDs from my firebase database and then change some values of those objects with those IDs.

So I was wondering if there is a way to link my webpage with firebase (as in link them two together) and change data in firebase ONLY when the write is done from my web-app.

I am really noob on the back-end part, so all suggestions and tips are welcome, how to do the things I mentioned.




How to allow up/down arrows to show up on ipad

I have this code:

input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button {
opacity: 1;
}

It works fine on windows/Mac browsers. enter image description here

However, the up/down arrows disappear when I use my ipad to open the web. Could anyone give me a solution for this? Thanks!




Macro to pull data from web

I would like to create a macro in Excel to update a price from a web page. I have found several macro´s for this, but no one works for my page. The link is http://ift.tt/2lOw0tp

Any ideas? Thank you very much! Best regards, Martin.




Call .ashx handler from button click event

ashx handler to download some files when user clicks a button. My .aspx looks like this right now

<asp:Button OnClick:"Download" runat="server" />

And within the Download event I have to do some processing before the download starts. So I'm looking for a way to invoke the handler from my C# code and pass in some parameters that are required for the download process.

Thanks in advance.




Build a URL on varnish changing backend

Hi had deployed the 1st stage for the new version of an existing web site, I need to redirect some HTTP request from new site to old site, I'd declare a director_1 for new site and a director_2 for old site:

backend server1 {
    .host = "172.16.1.24";
}
backend server2 {
    .host = "172.16.1.25";
}

backend oldWeb1 {
    .host = "172.16.1.41";
}

backend oldWeb2 {
    .host = "172.16.1.42";
}


sub vcl_init {
    new director_1 = directors.round_robin();
    bar.add_backend(server1);
    bar.add_backend(server2);

    new director_2 = directors.round_robin();
    old.add_backend(oldWeb1);
    old.add_backend(oldWeb2);

sub vcl_recv {

I'd tried to build the New URL on vcl_recv subroutine from many ways like:

-Changing the req backend

if (req.url ~ "^/toredirect") {
        set req.backend_hint = director_2.backend();
}
else {
        set req.backend_hint = director_1.backend();
}   

-Rewriting the URL

if (req.url ~ "^/toredirect") {
        set req.backend_hint = director_2.backend() + "/toredirect";
}
else {
        set req.backend_hint = director_1.backend();
} 

But When I go to http://varnishServerIP/toredirect not do that i expect and redirect error 404 page, anybody can help me!




How can I make a div reshaped when clicked?

The property I want to implement is like the one Facebook's user posts have. When they are clicked they get bigger and the screen gets darker a bit.

I am open to any critic and help. Thank you!




JavaScript Generator Web based Application like HelloBar

I am a newbies developer. I want to create a web based application, user will be able to create pop-up massage using front-end building tools. Finally user will get a JavaScript code. They can use this code on their website body. so that they can get that pop up massage on their /www.hellobar.com script sample http://ift.tt/2lCdPGY

Regards Md.Razu Ahammed




How to make operation from JSON Data

I have json data like this

[{
    "timeinserted": "2017-02-10",
    "upsa_r": "10",
    "upsa_s": "20",
    "upsa_t": "30",
}, {
    "timeinserted": "2017-02-10",
    "upsa_r": "20",
    "upsa_s": "20",
    "upsa_t": "20",
}, {
    "timeinserted": "2017-02-11",
    "upsa_r": "15",
    "upsa_s": "20",
    "upsa_t": "25",
}, {
    "timeinserted": "2017-02-11",
    "upsa_r": "25",
    "upsa_s": "30",
    "upsa_t": "35",
}]

how i make operation (mean) all that data based timeinserted to data like this in javascript->

[{
    "timeinserted": "2017-02-10",
    "upsa_r": "15",
    "upsa_s": "20",
    "upsa_t": "25",
}, {
    "timeinserted": "2017-02-11",
    "upsa_r": "20",
    "upsa_s": "25",
    "upsa_t": "30",
}]

Thank you for your help ^_^




Web Page is showing not available though the execution is still in progress

I've a web project using Java and JSP, which gathers informations writes in an excel sheet. When the data count is much less, the web page is working fine and redirecting exactly where it is supposed to do but when the data count is high, the web page is showing that the "web page is not available" though the execution is still going on in background. I'm running my code in eclipse and I'm using tomcat 6. Any kind of help is appreciated. Thanks!




How to use PHP and Mysql to display different items with only one webpage

My e-business website is actually a search engine.

Step 1 : users can search the item they like by key words or other attributes.

Step 2: After that, user may find the items they like, and click on the title of a specific item (or picture,etc) to activate a hyperlink.

Step 3: Then a webpage that describes the detail of the item will appear.

I was stuck in Step 3.

I found that there are more than 10 thousand items in MySQL database. I wondered if I need to create more than 10 thousand webpages to describe the details for each items ?(Of course it is impractical, but I don't know how to build only one webpage to solve this problem).

p.s. An idea has once come into my mind that I can build a share webpage for describing the detail of items, and find a way to detect which hyperlink or item user have clicked on, but I haven't learn this skill. Is it possible, or there is a better way?




How can i delete an object in a array?

i have a problem for delete and Object in a array. I think the solution is very simple but i am not good in javascript.

This is my array

I want delete the value in this array but i have a problem because its something like that in js:

myArray = [Object1,Object2,...]

and in the object Object1 = {SUM: "-0.75" , mont: "1", name: "test", value: "{"25":"test"}, year: "2017"}

Thanks for your help.




Implement billing email reminders

I would like to implement automatic email notification system for recurring billing in Nodejs. E.g. when subscription is about to expire in 5 days or in 24 hours I want to send an email reminder for a user.

I am using Sendgrid as mailing service. Sending an email is a easy task. Question is what is the best practice for implementing such workflow.

I imagine that cronjob could be setup to run every hour or so. Script is executed that finds all the users with subscriptions which expires in 5 days or 24 hours. Doing so would lead to sending notification every time cronjob is run. I have to track which users are notified already to avoid duplicated emails.




my route do not work ,use express and ejs

i want to click link to solution page,but my route don't work,what's wrong?

  1. app.js

    var express = require('express'); var path = require('path'); var
    favicon = require('serve-favicon'); var logger=require('morgan');
    var cookieParser = require('cookie-parser'); var bodyParser =
    require('body-parser'); var expressLayouts =
    require('express-ejs-layouts');
    
    var index = require('./routes/index'); var users =
    require('./routes/users');
    
    var app = express();
    
    app.set('layout', 'layout/layout'); app.set('view engine', 'ejs');
    
    app.use(expressLayouts);
    app.use(logger('dev')); app.use(bodyParser.json());
    app.use(bodyParser.urlencoded({ extended: false }));
    app.use(cookieParser()); app.use(express.static(path.joindirname,
    'public')));
    
    app.use('/', index); app.use('/users', users); app.use('/solution',
    index);
    
    

    2.routes/index var express = require('express'); var router = express.Router();

    router.get('/', function(req, res) {
         res.render('pages/index'});
    });
    
    router.get('/solution', function(req, res) {
         res.render('pages/solution');
    });
    
    module.exports = router;
    
    



jeudi 23 février 2017

How do I control another tab using a tab I am currently on?

I have a ui that is built on php's built in server (running on localhost). How can I make a button, that when pressed, will open a page in a new tab and clear cookies and refresh that page every few minutes until it changes.

In short, I'd like to make a script that clears cookies and refreshes until a change on a page is detected, and I want to control it with a button on my php page that is running on localhost.




Why doesn't the image appear in this HTML5/Javascript program?

I have my html5 document that contains a JavaScript script. The script defines a constructor to create a car object along with methods to compute the position of the car as the mouse moves and draw it in canvas. I'm not getting any errors in the Chrome browser console and the log messages aren't showing any problems, but the car isn't showing. here's the code:

Thanks in advance!

<!DOCTYPE html>
<html>
<head> 
<style type="text/css">
body {
    overflow:hidden;
}
</style>

</head>
<body>

<canvas onmousemove=" load(event)" id="myCanvas" width="5000" height="5000">
</canvas>

<script> 
// canvas and context objects
var myCanvas = document.getElementById("myCanvas");
var ctx = myCanvas.getContext("2d");


// viewport or camera dimensions = available height and available width in browser windows
//these dimensin need to be verified ********************************************
//**********************************************************************************************
var vWidth = window.screen.availWidth;
var vHeight = window.screen.availHeight; 

//mouse position
var mousex;
var mousey;
var player = new car(300, 400, 2, 001, 1);

function carData(x, y, orientation, id, type){
    //x and y are the cooredinates of the center of a car object
    this.x = x;
    this.y = y;
    this.type = type;
    this.speed = 5; //default speed = 5
    this.isAlive = 1;
    this.stillExists = 1;
    this.id = id;
    this.orientation = orientation;

}


function car(x, y, orientation, id, type) {
    this.data = new carData(x, y, orientation, id, type);

    this.TO_RADIANS = Math.PI/180;

    this.image = new Image();
    this.image.source = 'car1.png';
    this.image.width = 150;
    this.image.height = 150;

    //You should check if the image is loaded. If not then listen to the load event - from stackoverflow
    // http://ift.tt/2lLG7zc


    this.updatePosAndOrien = function(){

        //caclcuate orientation using mousex and mousey and x y position of our car

        var targetX  = mousex - this.data.x;
        var targetY  = mousey - this.data.y;
            trgtOrien = Math.atan2(targetY, targetX);


        //orientation 
        /*
        if(this.data.orientation < trgtOrien) {
            this.data.orientation += 20 * this.TO_RADIANS; 
        }
        else{
            this.data.orientation -= 20 * this.TO_RADIANS; 
        }
        */
        this.data.orientation = trgtOrien;
        console.log("player orientation is: " +this.data.orientation);

        //now update position of our car
        //this.data.x= this.data.x+ this.data.speed * Math.cos(trgtOrien);
        //this.data.y= this.data.y + this.data.speed * Math.sin(trgtOrien);

        var dx = mousex -this.data.x ;
        var dy = mousey - this.data.y ;


        var distance = Math.sqrt(dx*dx + dy*dy);

        //Now we can compute xspeed and yspeed of character
        var factor = distance / this.data.speed;// 50 / 5 = 10
        var xspeed = dx / factor; // 40 / 10 = 4
        var yspeed = dy / factor ;// 30 / 10 = 3

        this.data.x += xspeed;
        this.data.y += yspeed;

        console.log("player position is: " +this.data.x+",  "+this.data.y);


    };


    this.draw = function() {
        //if the image is loaded - which it should be after first draw
        this.image.onload = function() {

        ctx.save();
        ctx.translate(this.data.x, this.data.y);  //translate or move context origin to center of image 
        ctx.rotate(this.data.orientation);
        ctx.drawImage(this.image, -(this.image.width/2), -(this.image.height/2), 
        this.image.width, this.image.height);
        //ctx.drawImage(this.image, this.x, this.y);
        ctx.restore();

        }

    };
}

/* Tthis function does all the drawing for each frame. It works */
function drawAll() {
    ctx.setTransform(1,0,0,1,0,0);//reset the transform matrix to identity = no transform applied to drawn objects
    ctx.clearRect(0, 0, myCanvas.width, myCanvas.height);//clear the viewport AFTER the matrix is reset

    //Clamp the camera position to the world bounds while centering the camera around the player                                             
    var camx = clamp(-player.data.x + vWidth/2, 0, 5000 - vWidth);   //5000 x 5000 is our who arena dimensions
    var camy = clamp(-player.data.y + vHeight/2, 0, 5000 - vHeight);

    ctx.translate( camx, camy );    

    //Draw everything - the lists of cars and power ups
    player.draw();
}


//clamp function
function clamp(value, min, max){

    if(value < min) return min;
    else if(value > max) return max;
    return value;
}


function updateMousePos(evt) {
    var rect = myCanvas.getBoundingClientRect();

    mousex = evt.clientX - rect.left;
    mousey = evt.clientY - rect.top;

    console.log("mouse postion: "+mousex+", "+mousey);

}



function load(event){
    updateMousePos(event);
    player.updatePosAndOrien();
    drawAll();
}

</script>



</body>
</html>




How to make an Image Grid that can be added to using react components along with HTML and CSS

I'm fairly new to react and I'm working on a little project to get myself familiar with the language. I'm trying to make a site with a grid of images in a way that when a url is entered, the image at said url will then be displayed in image grid. I think this can be done with an array of sorts but I'm having trouble figuring it out or finding help on it. Can anyone help me figure out how to go about this or point me to a useful article or site? Thank you




Url link not working to open document/ Pdf

Below is basic flask code snippet simulated from my project which will work as expected to view pdf document file from url http://localhost:5000/open_document, to this web app we required to have SSO(single sign on) authentication so that we have added 'before_request' function to this web app to authenticate user through SSO url which is enterprise specific, Its implemented as below shown after this code change web app working as expected.

from flask import Flask
import flask
app = Flask(__name__)

@app.route('/')
def home():
    return 'Hello, World!'

@app.route('/open_document')
def document():
        response = flask.make_response(data) // data is pdf  object
        response.headers['Content-Type'] = 'application/pdf'
        response.headers['Content-Disposition']='inline; filename=sample'
    return response

if __name__ == "__main__":
    app.run()
  # Running on http://localhost:5000/

here is the code snippet which is added for SSO

@app.before_request
def sso_auth():
  return flask.redirect('http://ift.tt/2miS5hD')

Here is prod issue which we facing right away:

when user click on url link 'http://localhost:5000/open_document' directly instead browsing from home page and to view the document.

as expected Its take through sso page after authentication it come back to its original page url. Its working as expected for 70% of user failing for 30%.

below is the error trace of it.

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/tornado/iostream.py", line 355, in _handle_read
    if self._read_to_buffer() == 0:
  File "/usr/local/lib/python2.7/dist-packages/tornado/iostream.py", line 422, in _read_to_buffer
    chunk = self._read_from_socket()
  File "/usr/local/lib/python2.7/dist-packages/tornado/iostream.py", line 403, in _read_from_socket
    chunk = self.socket.recv(self.read_chunk_size)
error: [Errno 104] Connection reset by peer

Probably its because of making a connection and then immediately closing(interrupting with SSO) it without making a request, or because of server is busy.How can I persist this connection, how to avoid this socket.error Please suggest the code changes to my code to view the report 100% of users with out any fail. Its prod issue which facing currently please suggest a quick fix to it.Thanks a lot in advance.




I'm trying to have this text fade out on the old text and fade in on the new text

I am trying to have the text fade out but then back in after the new text has changed. I was wondering what might be wrong in my code to where the text appears, then fades out, then back in in a sort of ugly fashion... How can I revise this code? Thank you.

You can view the website that I am working on at http://revolthub.com

<script type="text/javascript">
var text = ['Sometimes you just have to destroy everything in order to build something brand new<span class="period">.</span>', 'So, we decided to destroy the old way of doing things, and completely redesign Revolt<span class="period">.</span>'];
var counter = 0;
var elem = document.getElementById("changeText");
setInterval(change, 8000);
$(elem).fadeIn();
function change(){
$(elem).fadeOut();
 elem.innerHTML= text[counter];
    counter++;
    if(counter >= text.length) { counter = 0; }
    $(elem).fadeIn();
}
</script>




How do you do http performance test?

I want to test the performance of my API http://xxx/users/[id], and I have a complete list of ids, so I would like to test the performance of this API, using real ids, is there any tools help?

I tried ab come along with apache, but it cannot read id from file and request the url.




Disable press tab button to next input field in web form

For example below, user can press tab button on the keyboard to go to next field. Can I disable this function?

<form action="/action_page.php">
  First name:<br>
  <input type="text" name="firstname">
  <br>
  Last name:<br>
  <input type="text" name="lastname">
  <br><br>
      <select name="gender">
        <option value="M">M</option>
        <option value="F">F</option>
      </select>
  <br><br>
  <input type="submit" value="Submit">
</form> 




I need a page that randomizes the same list every time someone clicks the link

I want a page (any randomizing page or similar thing) to randomize the same list and give me a random name every time I click the link. Can anybody help ? I think no programming is necessary but just advice. Hope someone replys :)




Web servlet error by using html code in get method

I am new to web programming. I am using this simple code in my get method

        response.setContentType( "text/html" );
        PrintWriter out = response.getWriter();
        out.println( "<html><head><title>Guest Book</title></head><body>" );
        out.println(" </body></html> ");

I am getting the below error while clicking on run on server enter image description here

Note: When i removed the html code, the servlet is working fine.Is it my Html code problem or any tomcat sevrver issue. The servlet is in my package cs3220homework and servlet name is @WebServlet("/MainFolder").

I tried everywhere to look for the issue and i was not able to find it.If its duplicate please let me know.

Thanks for your reply Harminder




PHP & Unity - Moving Info back and forth

I posted not long ago and decided to make another thread.

In our application we ask the players to create a new account, when they do we add this information to our DB.

The next step is to now grab the account they created, so that we can add more data to it. So the player creates an account with us, after this is done we then login with Google Play Services, and we now need to add info from google to the account they created, locale, id, etc

My problem here being new to php is im not sure on the correct way to do this so im asking for some guidance on it and have a couple of questions that may or may not make any sense.

  1. When a user creates an account i now need to reference and keep a hold of this account they created so that we can easily access and edit/add info to it. How would you accomplish this?

  2. When i need information from the database to display in the application how would i grab this info specific to the player and read it directly into unity? I think i could use the JsonEncode but im not sure if this is the most efficient way to do this.

There is more but i don't want to ask to much all at once haha.

Thanks for any and all help.

John




Web development include header

Good night everyone. I would like to know how to ass header or footer on an html page: I have my index.html and then other html pages. I use the same navigation bar and header / footer in almost every page. I don't want to go on every .html file and change the header on each and everyone of them every time something changes. Therefore I want to have a header.html file and then include it on every page, so I just have to edit one single file and it updates the rest. I know someone told me I can do it on php but I wanted to do it on html first, because I would like to not need a server to see the page in the mean time. I searched and tried every thing I saw on the internet, for instance the href and other things and for me, it did not work. Thanks in advance!




PHP - How to get info from a newly created user

Im totally new to php but have been programming for around 5 years in C#.

Im struggling to get my head around some of the basics in this.

So i have an application that will take info from a user to create a new entry in my db for their new account. Once the account is created i then need to know their unique id.

Should all of this be done in one php file? Or should i create another php file to grab the id?

If i take the second approach how do i know what the email was they used in the first php file? In C# i get you can create references, and reference other variables but how do you do this in PHP? In my understanding if i use the include in any file it will execute all the code in that file?

Thanks

John




how to open excel or word file in my web application using any tool

I display some list of word and excel files with the help of icons from my cloud storage in my web application. when user click on word or excel file icon. it is possible to open in word or excel spread sheet like google drive? so please suggest me any third party tool or API with the help of that i can achieve this functionality. file not open in system desktop application. user stay on my site and open the file like in google drive. i have share the screen shot of my web application with list of file gives you better idea related to it. My application is build in node.js.list of files on my web application.file is open like this.




How can I click div button in Selenium Java

Does anyone know how I can click (in Java) the button with following HTML code?

<div role="button" id=":t5.ss" class="c-N-K a-b a-b-va KMD69e-bU2Jkc-b DF" tabindex="0" aria-label="Join as John" style="user-select: none;">Join</div>

I've tried many ways but element couldn't be find.




Unable to use OpenLayer

I'm very new with web language and I have to integrate a map in a page. I'm using cshtml with Visual Studio 2015

To do this I have take a code using ol.js. The map have to be displayed, and for each value in my table I localize the city/country from IP and I display for each countries, the number of item.

There is my Index.cshtml

<script type="text/javascript">

    var map;
    var countriesLayer;
    var citiesLayer;

    function newCountriesLayer(start, end, item, result) {
        return new ol.layer.Vector({
            minResolution: 2500,
            source: new ol.source.GeoJSON({
                projection: 'EPSG:3857',
                url: '@Url.Action("GetCountries")'
                    + '?StartDate=' + start
                    + '&EndDate=' + end
                    + '&Item=' + item
                    + '&Result=' + result
            }),
            style: function (f, r) {
                return [
                    new ol.style.Style({
                        text: new ol.style.Text({ text: f.get("title"), fill: new ol.style.Fill({ color: '#673B8F' }), scale: 1.2 }),
                        image: new ol.style.Circle({ radius: 10, fill: new ol.style.Fill({ color: 'white' }) }),
                    })
                ];
            }
        });
    }

    function newCitiesLayer(start, end, item, result) {
        return new ol.layer.Vector({
            maxResolution: 2500,
            source: new ol.source.GeoJSON({
                projection: 'EPSG:3857',
                url: '@Url.Action("GetCities")'
                    + '?StartDate=' + start
                    + '&EndDate=' + end
                    + '&Item=' + item
                    + '&Result=' + result
            }),
            style: function (f, r) {
                return [
                    new ol.style.Style({
                        text: new ol.style.Text({ text: f.get("title"), fill: new ol.style.Fill({ color: '#673B8F' }), scale: 1.2 }),
                        image: new ol.style.Circle({ radius: 10, fill: new ol.style.Fill({ color: 'white' }) }),
                    })
                ];
            }
        });
    }

    $(document).ready(function () {
        var start = $('#startDate').val();
        var end = $('#endDate').val();
        var item = $('#item').val();
        var result = $('#resultat').val();

        countriesLayer = newCountriesLayer(start, end, item, result);
        citiesLayer = newCitiesLayer(start, end, item, result);

        map = new ol.Map({
            target: 'map',
            renderer: 'canvas',
            layers:
            [
                new ol.layer.Tile({
                    //source: new ol.source.TileWMS({
                    //    url: 'http://ift.tt/1a1O7w2',
                    //    params: { LAYERS: 'openstreetmap', VERSION: '1.1.1' }
                    //})
                    source: new ol.source.OSM(),
                }),
                countriesLayer, citiesLayer
            ],
            view: new ol.View2D({
                center: ol.proj.transform([0, 0], 'EPSG:4326', 'EPSG:3857'),
                zoom: 1,
            })
        });
    });
</script>

In my Controller.cs I have 2 functions:

public ContentResult GetCities(string StartDate, string EndDate, string Item, string Result){...}

public ContentResult GetCountries(string StartDate, string EndDate, string Item, string Result){...}

both return :

return new ContentResult()
{
    Content = geoJson.ToString(),
    ContentEncoding = System.Text.Encoding.ASCII,
    ContentType = "text/json"
};

Value for geoJson is :

{
    "type": "FeatureCollection",
    "crs": { 
        "type": "name",
        "properties": { 
            "name": "urn:ogc:def:crs:OGC:1.3:CRS84" 
        } 
    },
    "features": [
    { 
        "type": "Feature",
        "properties": {
            "id":"CN-30-Guangzhou",
            "title":"2",
        }, 
        "geometry": { 
            "type": "Point",
            "coordinates": [113.25,23.1167]
        }
    },
    {
        "type": "Feature",
        "properties": { 
            "id":"CN-23-Shanghai", 
            "title":"1",
        },
        "geometry": { 
            "type": "Point",
            "coordinates": [121.3997,31.0456] 
        }
    },
]}

In the project that I took this code, it works. The map contain 2 points in china : a "1" is displayed in Shanghai and a "2" in Guangzhou.

In my project I have an error :

Uncaught TypeError: Cannot read property 'a' of null

at xl (ol.js:266)
at wl (ol.js:265)
at Bl (ol.js:268)
at Al (ol.js:269)
at nr (ol.js:471)
at pr.mr.f (ol.js:470)
at td (ol.js:38)
at N (ol.js:37)
at Xq.q (ol.js:467)

As I said, I'm very new to web and I lost with that error. If try to check ol.js but it is unreadable. Maybe I'm missing a library or a package but I don't know how to know.