mercredi 31 mai 2017

On scroll transition css in web designing

I have some sections in my website.I need that when i scroll down each section occur from bottom to top transition.I need transition same as https://www.redbus.in/ Thank you :)




password_verify($_POST['password'], $hash) always return false password

My question is, when I try to log in with correct password, it still display the error message "You have entered wrong password, try again!".(Register works fine, the part checking if user already exist works fine) Here is the code:

register.php (works):
<?php 
include('db_conn.php'); //db connection
session_start();

/* Registration process, inserts user info into the database 
   and sends account confirmation email message
 */

$_SESSION['email'] = $_POST['email'];
$_SESSION['full_name'] = $_POST['name'];

// Escape all $_POST variables to protect against SQL injections
$full_name = $mysqli->escape_string($_POST['name']);
$email = $mysqli->escape_string($_POST['email']);
$password = $mysqli->escape_string(password_hash($_POST['password'], PASSWORD_BCRYPT));
$usertype = $mysqli->escape_string("A");
$hash = $mysqli->escape_string( md5( rand(0,1000) ) );

// Check if user with that email already exists
$result = $mysqli->query("SELECT * FROM user WHERE Email='$email'") or die($mysqli->error());

if (isset($_POST["submit"])){
// We know user email exists if the rows returned are more than 0
    if ( $result->num_rows > 0 ) {

        $_SESSION['message'] = 'User with this email already exists!';
        // header("location: error.php");

    }
    else { // Email doesn't already exist in a database, proceed...

        $sql = "INSERT INTO user (Email, Password, UserType, FullName, Hash) " 
            . "VALUES ('$email','$password', '$usertype','$full_name', '$hash')";

        // Add user to the database
        if ( $mysqli->query($sql) ){


            $_SESSION['logged_in'] = true; // So we know the user has logged in
            $_SESSION['message'] =

                    "You are registered";

            header("location: home.php"); 
        }

        else {
            $_SESSION['message'] = 'Registration failed!';
            // header("location: error.php");
        }

    }
}

?>




sign_in.php (not working properly):
<?php 
include('db_conn.php'); //db connection
session_start();

$email = $mysqli->escape_string($_POST['email']);
$result = $mysqli->query("SELECT * FROM user WHERE Email='$email'");


if (isset($_POST["submit"])){
    if ( $result->num_rows == 0 ){ // User doesn't exist
        $_SESSION['message'] = "User with that email doesn't exist!";
        // header("location: error.php");
    }
    else { // User exists
        $user = $result->fetch_assoc();
        echo $_POST['password'].$user['Password'];
        if ( password_verify($_POST['password'], $user['Password']) ) {

            $_SESSION['email'] = $user['Email'];
            $_SESSION['full_name'] = $user['Name'];
            $_SESSION['user_type'] = $user['UserType'];


            // This is how we'll know the user is logged in
            $_SESSION['logged_in'] = true;

            header("location: home.php");
        }
        else {
            $_SESSION['message'] = "You have entered wrong password, try again!";
            // header("location: error.php");
        }
    }
}

?>




I'm trying to use mouse-over event in jquery but having some trouble

I have an image of 10 people that i want to add on a web page. but i want to use a mouse event jquery so that when i move my mouse to the persons face it will show me a small text box beside his face with his name in it. Is there any possible way to do this ??




Django split String from database

I try to split a String from a database (SQLite). The String has a linebreak \n and I want split it there in 2 parts. It works with a normal String for example text = "Hello \n World". But if I use the string from my database it doesn't work (the text is saved correctly with \n in the database!!)

My Code for getting the first part of the string:

from django import template
from products.models import News

register = template.Library()

@register.simple_tag
def get_first_title(id):
    search_value = "\n"
    news = News.objects.values('title')
   title = news.filter(pk=id)
   number = str(title).find(search_value)
   first_title = str(title)[0:number]
   return first_title




Acces a href link with excel and VBA

I want to click a href link that is dynamic, but what i know it is it's position. So i want to click either the first link presented or the third or another depending if it meets the given criteria.I have really very little clue as to what am i doing, as i have little knowledge of programing(still doing VBA tutorials). A point in the right direction would be great.

This is where i am stuck:

Sub useClassnames()
Dim lists As IHTMLElementCollection
Dim anchorElements As IHTMLElementCollection
Dim ulElement As HTMLUListElement
Dim liElement As HTMLLIElement
Dim row As Long
Dim link As IHTMLElement
Dim ie As InternetExplorer

Set ie = New InternetExplorer

With ie
    .navigate "http://ift.tt/2rM7ZqB"
    .Visible = True

    Do While ie.readyState <> READYSTATE_COMPLETE
        DoEvents
    Loop
End With
    Do Until ie.document.getElementsByClassName("KambiBC-event-item__participants-container").Length > 0
        DoEvents
    Loop
row = 1
If Cells(row, 1).Value = 0 And Cells(row, 2).Value = 0 And Cells(row, 3) > 38 Then
Set link = ie.document.getElementsByTagName("a")
For Each l In link
    If link.className = "KambiBC-event-item__link KambiBC-js-event-item-link" Then
        link.Click
        Exit For
    End If
Next l

row = row + 1 End If End Sub




Java read CSV file from the web

I'm trying to read a CSV file from the web. Here's the Java code I have written:

String st = "http://ift.tt/2qBCVG7";
URL stockURL = new URL(st);
BufferedReader in = new BufferedReader(new InputStreamReader(stockURL.openStream()));
String s = null;
while ((s=in.readLine())!=null) {
    System.out.println(s);
}

However, the BufferedReader appears to be empty. When I put the URL in my browser, a CSV file is downloaded which is not an empty file. Any ideas? enter image description here




isset($_POST) not working but isset($_GET) working... why?

When i write - if(isset($_POST['submit'])) ,it always evaluates to false.. whereas if i simply change $_POST to $_GET, it works properly.

My HTML code-

<html>
    <body>
        <form action="welcome.php" action="post">
            <input type="text" name="username"> <br>
            <input type="submit" name="send">Click me </input>
        </form>
    </body>
</html>

My PHP code-

<?php
$name="default";
if(isset($_POST['send'])){
    $name = $_POST['username'];
}
echo $name;
?>

The output i get is "default" and not what i type in input field in the html form.. Can you tell why? Thanks in advance.




TypeError: Failed to construct 'PasswordCredential': 'id' must not be empty

I want to implement credential management API in my angular app

my login.html looks like this

<div id="login-form" data-ng-form="loginForm" data-ng-controller="LoginFormController">
    <div>
        <input type="text" name="username" placeholder="username" data-ng-model="loginCredentials.username" id="uid" autocomplete="username">
        <input type="password" name="password" placeholder="password" data-ng-model="loginCredentials.password" id="pwd" autocomplete="new-password">
    </div>
    <div>
        <button id="loginButton" data-ng-click="login()">label.button.login</button>
    </div>
    <div data-ng-show="authenticationFailed">
        <p></p>
    </div>
</div>

I have LoginFormController as my Controller. Inside the function i created new object called PasswordCredential like this

            var form = angular.element('#login-form');
            //console.log(form);
            var cred  = new PasswordCredential(form);
            //store the credentials
            navigator.credentials.store(cred)
            .then(function(){

            });
            

But i am getting the error PasswordCredential : id must not be empty

Help please




is html5 input 'required' a secure validation technique?

i have a lot of trouble asking questions properly on this site, so here goes: I am concerned about web security and the use of the HTML5 required word on input tags. I am trying to use it as part of 'form input validation'. Is the use of the HTML5 'required' on input tags something that is reliable for validation or is it easily manipulated by a user trying to bypass the input field requirement. please be nice if you try to answer. I did search for information on html security on this and found little on this word. thanks




Why is there a slash through the https in my site's address bar sometimes?

Bassically it is what the question says, It is like my website it is not save for the clients. (I do not have online payments or somethig like that)

The thing is that this only happen sometimes, and it is not always in the same device, for example it could happen in my pc once a week and the rest of the time works just fine.

I have beeing reading and it could be a lot of causes, but in this way that it is sometime I thing it is really weird, my ssl expires in four day, but this problem has been happen for about two months (the site has been 1 year online).

When I call to external links (for javascript or css) I checked and it is always https.

I also read that could be the browser or the OS but this has happened in chrome, mozilla and IE as browser and Windows 10, windows 8, ubuntu (last version at this time), android 5.0.1 as SO and my web server is linux.

I do not know what other information it is relevant, I try to give all I read could be relevant in this case.




multiple overlays in javascript on website

http://ift.tt/2qAUU3C

in this example u can make simple overlays on your html site, the problem is i would like to use more than 1 overlay but it doesn't work with copying stuff. Can any1 help me?

i even found css overlay but it doesn't hide on click ( the demo ) javascript text overlay HTML5 so it doesn't help me




How to include JS objects in HTML

I have this code from my JS File:

var formStr = "<h5>How many books?:</h5><input type='number' id='bookinput'
value='' /><input type='button' value='submit' onclick='addbook();' />"
infowindow = new google.maps.InfoWindow();
infowindow.setContent(formStr);
infowindow.setPosition(location);
infowindow.open(map);

JS variable formStr has html code as you can see above. I want to be able to put JS variables into this without moving the HTML out of my JS file. Something like:

var objectType='book';
var formStr = "<h5>How many *objectType*?:</h5><input type='number' id='bookinput' value='' /><input type='button' value='submit' onclick='addbook();' />"




Pagination in JSP without using third party libraries

I have been looking around to find out a good resource for pagination in JSP without using any third party libraries. I have a list in my jsp and I want to perform pagination over it. Is there a simple way to achieve this? I've used Display Tag but it seems like this library is a little old now and now I want to do it solely using JSP without using any third party library. Please let me know if there is a good resource out there since I couldn't find any.

Thanks.




Index page not opening while using cookies in PHP , FORCE REDIRECT TO THE PAGE which should appear while logging in

I am making a simple sign up and log in page and I am stuck as i am opening index.php it opens the page which should be loaded after the person has logged in. I am using cookie to keep the user logged in.

i am using the following code so that it does not happen but it continues to happen:

if( (array_key_exists("id", $_SESSION) AND $_SESSION['id']) OR (array_key_exists("id", $_COOKIE) AND $_COOKIE['id']) ){

        header("Location: loggedIn.php");

    }

Id is my primary key. I am not seeing any errors just that the index page does not load.




Web Application - Need feasible solution

As a web developer, I am thinking of getting solution for the below problem. Is it possible to get the nearest mobile number from the list of mobile phones using GPS tracker?

If Yes, It will be great if there are procedures to do that. It will be so useful for me.

I am thinking of using PHP or JAVA. Other language suggestions are most welcome.




Can a WebAssembly program leak memory?

WebAssembly programs start with a fixed amount of virtual memory, and can request additional memory at runtime. They are also encouraged to discard unused physical pages. Can long running, badly behaved WebAssembly programs leak memory? Will this eventually cause the WebAssembly program to crash?




How to share Dynamic Web Project in eclipse

I have a Dynamic Web Project in which I make use of JSF with some htmls pages and some java classes.

I tried to share this project via github, but when I open it in Eclipse of another computer it's completely messy. Then I tried exporting it to .war, but when I import into eclipse, my java classes aren't there.




JWT example websites

I was wondering if anyone here knows some popular website actually using JWT for authentication. If so, could you please share the URL?

More generally, do you know any good heuristic to automatically find such websites?

Thanks!




Tool to analyse files using in a website

A web site project was given to me. There is many CSS and JS files, but I'm not sure that everything is useful.

Do you know if there is a tool able to analyze what and for what are used this type of files, or directly a tool which optimize this files in a web project?

Thank you.




how to recover a word(.doc/.docx) file content in a text area

I'm developping a website using expressjs/nodejs.I'm trying to recover a word file content uploaded by the user ,to display it on a textarea or on word reader or others.. so that content can be modified(on the website) and then the user can download this word file again. I hope you can help me and thank you




Which web language can read and write to local text files?

I know SO is going to ding me for this one, but I really need help! I have an html-based app and I'm just trying to read and write to a text file (ultimately to import data into Excel). Both the html and text file are on my local machine; I am the only user. I thought this would be simple Javascript, but apparently not. After ~2 hours of research, I'm more confused then when I started. I have these ideas of how it might be done, such as:

-maybe it actually is possible with simple javascript?

-maybe I need to host the files on a server and use something like PHP or AJAX?

-maybe I need some special libraries and use something like JSON or JQuery?

but I don't know which if any of those ideas will work.

Any advice is greatly appreciated. Thanks.




get every url of specific domain like travel,restraunt in specified area web crawler

I want to fetch every restaurant URLs in specified place. It is possible by web crawler or other. I searched in internet but not found any exact solution




Eclipse merge two java projects

I am using Eclipse to develop a Java project to run on a server. I have two projects:

1) jbosswildfly: one with Java code made up of a number of RESTful Services.

2) theWhoZoo-web: the other is a web project containing a few html files.

enter image description here

I would like to merge these projects and just have one project. I have tried copying the WebContent folder from theWhoZoo-web to jbosswildfly, starting the server, but I cannot access the index.html.

Question

What is the best way to merge these two projects, so that the RESTful Services as well as the index.html are accessible on the same server?

Thanks




how can i select one row from table in MySQL database alone in anthor page with php?

i create questions and answers system with php and i created page have all questions that recorded in table named questions and make beside every question reply link which directed to answer page, so i need to select this question that i want to comment on it from table and show it single in the answer page to make comments on it , how can i make this with php?

this is my questions page code

<?php  session_start();  $connection = new mysqli('localhost','root','','questionssystem') or die ("Database connection failed"); /*start questions*/$sql = "SELECT question_text FROM question"; $result = $connection->query($sql); echo'<h2>Questions page</h2>'; if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
    echo '<form action="answers.php" method="post">';
    echo '<div class ="container">';
    echo "<p>question: " . $row["question_text"];
    echo '<span class="psw">If You want to reply this Question , please <a href="http://localhost:8080/questionssystem/answers.php" target="_self">Reply</a></span>';
    echo '</div>';
    echo '</form>'; } }else { echo "0 results";} /*end questions*/ $connection->close(); ?>

<html>
<head>
<link rel="stylesheet" type="text/css" href="css_file.css">
</head>
<body></body></html>




How to design structure of the constant table for intranet web applications

My definition

constant table - Db table that use to keep value and description or running number for something e.g. Table_Constant

   System    Key    Subkey        Descript
     A     status     01          Waiting 
     A     status     02          Reserved 
     A     running1   no_current    99
     B      ...

My question is Is there any concept support for this below approach.
the company has many intranet systems(website) for different department which each has the constant value like status that used in its system , the current implement is for all system to use the Table_Constant as the only table to keep each system 's constants (which usually not relate to the different systems)

In my opinion I think each different systems should have the different constant table to keep its own constant. But the use of only one table has an advantage when debug/ maintenance the system.




Can web applications send intent to a specific device's broadcast receiver?

I'm fairly new to android and i'm tasked to create a listener for on-demand location updater and am deciding between an implementation of broadcast receiver or a Firebase Messaging Service.




How can I build array dynamically for 21 fields per element?

I want to build an array dynamically for 21 fields per element. Everything must be done in the view.

How can I do that?

Every element must have 21 fields and I have to access it later like

@xyz.each do |element|
  puts element["fieldA"]
end




How to insert Unix timestamp by using Nginx SSI (server side includes)?

I was reading the instructions, yet there is no example for me to understand how to insert a timestamp. I require Unix timestamp or any type of a date that I can format myself.

http://ift.tt/2riYtbu

The final goal is to have timestamp inserted in a manner how I like it, to prevent the contact form abuse. And in case that spammers adopt to it, I would change the format.




Firebase and Cordova

can you please help me, right now I'm developing an Android apps using Cordova. I want to give user notification, from where i read the forum, firebase cloud messaging would help me to do that.

I've seen this github http://ift.tt/291qUEo, unfortunately I can't understand

can you please give me some basic example to make my apps got notification? Right now I'm making new project only to make notifiacation runs wells, but still no result. Please help me !




Tizen OS installation and debugging

I need To build an Web Application that can run on Smart TV with Tizen OS. This is what I've done: http://ift.tt/2rDyPRI. It works fine on Chrome and Tizen Emulator but not a real smart tv and I don't know why. The worse thing is I don't have a smart TV for debugging. But I have an Intel Computer Stick. So can you tell me how to install Tizen OS on an Intel computer stick (or something I can do to debug my site) ? I've been searching on google but nothing works for me so far.




User upload files in website how can i check security scanning?

User upload files into websites how we can check the security scanning for the uploading files




mardi 30 mai 2017

no display ng-include app java spring mvc

These are my files when loading index and cabecera does it well, but when running the ng-include does not load anything. Thank you

index.jsp

<body ng-controller="index">
    <ng-include src="'cabecera'"></ng-include>
    <div ng-view=""></div>
    <ng-include src="'pie'"></ng-include>
</body>

PreguntasController.java

@RequestMapping(value = "/index")
public ModelAndView index() {
    ModelAndView mv = new ModelAndView();
    mv.setViewName("index");

    return mv;
}

@RequestMapping(value = "/cabecera")
public ModelAndView cabecera() {
    ModelAndView mv = new ModelAndView();
    mv.setViewName("cabecera");

    return mv;
}

@RequestMapping(value = "/pie")
public ModelAndView pie() {
    ModelAndView mv = new ModelAndView();
    mv.setViewName("pie");

    return mv;
}

Navigator (localhost:8080/preguntas/index):

<!DOCTYPE html>
<html>
    <head>
        <title>Preguntas</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="shortcut icon" href="recursos/imagenes/ico/favicon.png">
        <link rel="stylesheet" href="recursos/css/bootstrap.min.css">
        <link rel="stylesheet" href="recursos/css/styles.css">
        <!--[if lt IE 9]>
        <script src="http://ift.tt/1fK4qT1"></script>
        <script src="http://ift.tt/19158cF"></script>
        <![endif]-->
        <script src="recursos/js/jquery.min.js"></script>
        <script src="recursos/js/bootstrap.min.js"></script>
        <script src="recursos/js/custom.js"></script>
        <script src="recursos/js/angular.min.js"></script>
        <script src="recursos/js/angular-route.min.js"></script>
        <script src="recursos/js/script.js"></script>
    </head>
    <body ng-controller="index">
        <ng-include src="'cabecera'"></ng-include>
        <div ng-view=""></div>
        <ng-include src="'pie'"></ng-include>
    </body>
</html>

index

Navigator (localhost:8080/preguntas/cabecera):

    <div class="header navbar-fixed-top">
        <div class="container">
            <div class="row">
                <div class="col-md-12">
                    <!-- Logo -->
                    <div class="logo">
                        <h1><a href="index.html">Preguntas</a></h1>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="page-content">
        <div class="row">
            <div class="col-md-2">
                <div class="sidebar content-box" style="display: block;">
                    <ul class="nav">
                        <li class="current"><a href="index"><i class="glyphicon glyphicon-home"></i> Inicio</a></li>
                        <li><a href="logout"><i class="glyphicon glyphicon-list"></i> Salir</a></li>
                    </ul>
                </div>
            </div>

cabecera




Warning: require_once(http://ift.tt/2qzG5tO) DOMPDF

This was my first time trying to play around with dompdf. I had everything set up and uploaded to my site. However when I test it, it has problems loading the dompdf files. These are the 2 errors I get.

Warning: require_once(http://ift.tt/2rTfL1D): failed to open stream: No such file or directory in /home/u263223815/public_html/form/cetak.php on line 169

Fatal error: require_once(): Failed opening required 'http://ift.tt/2rTfL1D' (include_path='.:/opt/php-5.6/pear') in /home/u263223815/public_html/form/cetak.php on line 169

I looked in the classes folder and there were no such files. Where are these files? Am I doing something wrong?

Thanks!




Simple passing of input to a button onClick

So i'm creating a taxi booking app ( mock-up project ) and am implementing a search bar for searching through a database via sql. I've got everything working, but now i want to check if a code is valid in the table, before assigning a taxi driver to it.

$sql = "UPDATE cabBookings SET _status = 'assigned' WHERE _booking_code = '$code'";
$sqlTwo = "SELECT * FROM cabBookings WHERE _booking_code = '$code'";

if($result = @mysqli_query($connection, $sqlTwo)){
        if($result->fetchColumn() > 0){
            if (@mysqli_query($connection, $sql)) {
                echo "<p style = 'padding: 10px; background-color: #8ae57b; border: 1px solid black; max-width: 400px;'>Great! Thankyou
                    for taking up your time. You have been assigned the duty of picking up this passenger :-)</p>
                    <button style = 'margin-top: 10px;' type = 'button' onClick = 'location.reload()'>Reload Page</button>";
            } else {
                echo "Error: " . $sql . "<br>" . $connection->error;
            }
        }else{
            echo "<p style = 'padding: 10px; background-color: #ed6c63; border: 1px solid black; max-width: 400px;'>Sorry, the code
                    you have entered is not a current booking</p>"
        }
    }

obviously the code isn't working, and i was just wondering what i am doing wrong




Aligning span and buttons inside div

I have a div in which I have some 3 buttons and a span that is generated. My questions are:

Can I align my buttons with the squares without using margins? (The first button would be where the first square starts and the last button would be where the last square ends)

How do I align my span inside the two buttons?

http://ift.tt/2sclqx7




How to auto fill input form with JavaScript

i have some problem, in my case, i have 2 form

<form>
<input type="text" name="a" id="fill" />
<select name="b" id="status">
<option value="success">Success</option>
<option value="fail">fail</option>
</select>
</form>

If the content of word A is more than 150, select B is success. If the content of word a is less than 150, select B is fail.

i don't know script java script for my problem, please help me




PHP Delete Confirmation Won't Appear

I have a script for deleting a row in table where it needs an id to specify which row to delete:`

function hapus(delid) {
    var r = confirm("Are you sure you want to delete " +delid+ "?");
    if (r == true) {
        window.location.href='hapus_jeniskompetensi.php?del_id=' +delid+'';
    }
}`

and I called it in:

<input type="button" onClick="hapus(<?php echo $row['id_jeniskompetensi'];?>)" name="Delete" value="Delete">

It doesn't work. The confirmation box won't appear. If I called it without passing the parameter (just onClick="hapus()") the confirmation box will appear, but of course the delete function will fail. Am I missing something here?

Here's my full code: admin.php

And the delete code: hapus_jeniskompetensi.php

Thanks in advance!!




How To Give Div Height And Width Within Another Div

Relevant pug code:

 body
    .jackpot#jackpot-wrapper
        canvas#jackpot-chart(width='900', height='900')
        #jackpot-center-data
            span#text 1/50

Relevant Css:

#jackpot-wrapper{
    width: 600px;
    height: 2000px;
}

#jackpot-center-data {
    border-color: coral;
    height: 100px;
    width: 100px;
}

#text {
    font-family: adamina;
    display: table-cell;
    text-align: center;
    vertical-align: middle;
}

So I have a div with id of jackpot-wrapper holding another div with an id of jackpot-center-data, finally I have a span inside of the jackpot-center-data with id of text. I wanted to resize the jackpot-center-data div with height and width but it doesn't change size whenever I set it. I also can't change the position once I set it to absolute. Any ideas on how I could resize the jackpot-center-data div and change it's position.




Going from static webpage design to dynamic webdev

I have been making static webpages all my life up to now. HTML, CSS, Javascript, maybe a little Bootstrap or jQuery here and there; all quite basic. Good ol' Github Pages is used for deployment.

I'm interested in creating dynamic webpages (for example's sake: a blogging site requiring users to login). However, creating dynamic stuff seems to be a whole other world. Googling tutorials on dynamic webpages and things like node.js show me how to create webapps, but don't answer natural questions: why don't we write directly in index.html anymore? How does one style?

The fundamental conceptual differences between static and dynamic pages is comprehensible, but I'd appreciate it if someone could explain what the difference looks like when practically applied.




Is Display Tag Library secure?

I know this is not a programming question but I would like to know if Display Tag is safe and secure to use. I couldn't find anything in the documentation regarding security. Please let me know if it is fully secured and reliable to use.




Sending JSON data as body element using HTTP POST method

I am bit confused on a task which involves backend web developement: I have to make simple contact us form backend solution 1st task involved form-data post method, but i am not really sure what to do on the 2nd task

Sending JSON data as body element using HTTP POST method

How should i understand this? Is it meant as sending data in json format, through ajax post method?

Full Task instructions

Create a simple “Contact us” form backend solution

Create a backend solution where data can be sent using two different approaches

  1. form-data POST method using simple HTML form
  2. Sending JSON data as body element using HTTP POST method

Backend endpoint requirements

  1. Backend has to retrieve following data a. email i. Email field validation ii. Field is required b. text i. Max 400 symbols ii. Field is required c. first_name i. Max 255 symbols ii. Field is not required d. last_name i. Max 255 symbols ii. Field is not required
  2. Backend has to respond with error messages in case of incorrect data
  3. Correct HTTP response status codes has to be used in case of sending data as JSON
  4. Preferably data has to be stored in database (free choice)
  5. Data has to be sent to following endpoints (URL) a. HTML form - /contact/html i. This has to have a simple HTML web form as well

    b. JSON data - /contact/json




Redirect handling Python 3

I am writing a program to open and read webpages and do stuff with the stuff on the page. I am using urllib.request package for that. This is Python 3.4.3. I want to make sure my code can operate with redirect requests. Right now my code just catches redirects and prints out that there was an HTTPError and does nothing. I would want it to actually redirect to the new page in case of a redirect request and read that page instead. My code currently is this:

try:
        text = str(urllib.request.urlopen(url, timeout=10).read())
except ValueError as error:
        print(error)
except urllib.error.HTTPError as error:
        print(error)
except urllib.error.URLError as error:
        print(error)
except timeout as error:
        print(error)

Please help me I am new to this. Thanks!




3D woman body resizable via morphing technology and clothing option imported to a website

I just want to ask you guys, if someone can just give me an advice or tutorial or to show me a technology, which will help me, to create a human body model. The idea is that, this model should be re-sizable.For example you can change the chest size, the breast size and the butt size with different values. Its because some girls have big size of the chest, but small size of the breasts (for example B,C). So when they type the sizes , the model will change his structure with a dress/swimming-suit on it via morphing. I already read about it and I found, that I should use ThreeJS or maybe Unity3d(which has export for web). I'm not quiet sure how i can change the sizes dynamically in real time with these two technologies. If you have something in mind, i will be very thankful.

Thanks to all in advance!




ASP.NET (VB) Trying set DB connection from web.config

I have a web form project to update columns in an Microsoft SQL 2012 database table. When I "hard code" the connection info for my SqlConnection everything works fine. However if I try going the ConfigurationManager.ConnectionStrings route I get a keyword 'id' not supported. I have included the Imports.System.Configuration code into my project. Below is the Sub where I am running into the issue

 Protected Sub BtnSubmit_Click(sender As Object, e As EventArgs) Handles BtnSubmit.Click
    Dim myConn As SqlConnection
    Dim cmd As SqlCommand
    Dim sqlstring, RqType, RqLast, RqFirst, RqOrg, RqEmail, RqNeedDate, SubFirst, SubLast, RqDetails, RqGenDate, RqOperator As String
    RqType = cbxRequestType.SelectedValue
    RqLast = txtReqLastName.Text
    RqFirst = txtReqFirstname.Text
    RqOrg = txtOrganization.Text
    RqEmail = txtEmail.Text
    RqNeedDate = txtReqDate.Text
    SubFirst = txtSubFirst.Text
    SubLast = txtSubLast.Text
    RqDetails = txtReqDetails.Text
    RqGenDate = txtGenDate.Text
    RqOperator = txtOperator.Text
    If Agree.Checked = False Then
        MsgBox("You must agree to the terms before proceeding")
    Else
        myConn = New SqlConnection(ConfigurationManager.ConnectionStrings("PRRWeb").ConnectionString)
        myConn.Open()
            sqlstring = "INSERT INTO Requests (LastName, FirstName, Organization, DateRequested, DateNeeded, OperatorID, SubjectLastName, SubjectFirstName, Notes, TypeID, Email) VALUES ('" + RqLast + "','" + RqFirst + "', '" + RqOrg + "','" + RqGenDate + "', '" + RqNeedDate + "','" + RqOperator + "','" + SubLast + "','" + SubFirst + "','" + RqDetails + "','" + RqType + "','" + RqEmail + "')"
            cmd = New SqlCommand(sqlstring, myConn)
            cmd.ExecuteNonQuery()
        myConn.Close()
        MsgBox("Your request has been submitted.", MsgBoxStyle.Information)
        Response.Redirect(Request.RawUrl)
    End If




How can I check some arbitrary regular expression and then its length?

I would like it all to be in one regular expression, because the (to me) black box tool validating the input accepts only one regex, and I would rather not introduce my own external logic to double-check.

Specifically, I am trying to modify dperini's URL regex to make sure the input is a valid URL and then make sure its length is no greater than a certain number of characters, so it fits in the database column.

i.e., I want to combine regex_check('<insert dperini's magic>); and regex_check('^.{0,250}'); into one regular expression.




How to open Multiple webpage one after another in python?

Let us consider the following example:

import webbrowser
Cn=('Acharya Girish Chandra Bose College','AJC Bose College','Ananda Mohan College','Asutosh College','Bangabasi College','Barrackpore Rastraguru Surendranath College','Basanti Devi College')

Cnw={'Acharya Girish Chandra Bose College':'http://ift.tt/2rBq0rS','AJC Bose College':'http://ift.tt/2saWW7p','Ananda Mohan College':'http://ift.tt/2rB3NKp','Asutosh College':'http://ift.tt/2sat1fA','Bangabasi College':'http://ift.tt/2rBbpwv','Barrackpore Rastraguru Surendranath College':'http://www.brsnc.org/','Basanti Devi College':'http://ift.tt/2saAhYU'}

yy=['Y','Yes','YES','y']
nn=['N','NO','no','No','n']
i=0
while i<=range(len(Cn)):
    print 'College Name : ',Cn[i]
    a=raw_input('Do u want to visit the website ? (Y/N) :')
    if a in yy:
        webbrowser.open(Cnw[Cn[i]])
    elif a in nn:
        break
    i=i+1

This program works fine, but I want to open next webpage after opening a webpage. This program open only one page and shows the message :
Image link here.

After opening one webpage from list it will increase i by i=i+1 and again ask to me to open the next website. Please suggest to do this




How to create a transparent border using CSS in a subclass?

I am trying to create a transparent border around the page number 1 shown below in the image. I've created a subclass span tag so that I could target only that element but it seems not be working. I found some similar question saying to create a space in the CSS but still it is not working.enter image description here

Like the one below.

enter image description here

HTML (Please ignore jsp tags)

<display:setProperty name="paging.banner.full" value='<span class="pagelinks"> <a href="{1}"> <img src="../images/integration/FastLeft.jpg"/> </a> <a href="{2}"> <img src="../images/integration/SlowLeft.jpg"/> </a> | Page {5} of {6} | <a href="{3}">  <img src="../images/integration/SlowRight.jpg"/> </a> <a href="{4}"> <img src="../images/integration/FastRight.jpg"/> </a></span>'/>
<display:setProperty name="paging.banner.first" value='<span class="pagelinks"> <img src="../images/integration/FastLeft.jpg"/> <img src="../images/integration/SlowLeft.jpg"/> | Page <span class="pageNumberBorder">{5}</span> of {6} | <a href="{3}"> <img src="../images/integration/SlowRight.jpg"/> </a> <a href="{4}"> <img src="../images/integration/FastRight.jpg"/> </a></span>'/>
<display:setProperty name="paging.banner.last" value='<span class="pagelinks"> <a href="{1}"> <img src="../images/integration/FastLeft.jpg"/> </a> <a href="{2}"> <img src="../images/integration/SlowLeft.jpg"/> </a> | Page {5} of {6} | <img src="../images/integration/SlowRight.jpg"/> <img src="../images/integration/FastRight.jpg"/> </span>'/>

CSS

.pagelinks .pageNumberBorder {
 border: 1px solid transparent;
}

JS Fiddle




How to make java web start app to work only online

I downloaded one JNLP file form tutorial site, I could launches a java app without internet. whereas, I downloaded an other JNLP file from software vendor, I couldn't launch the app but with internet connection. I also enabled app. caching in java config. panel. So, my question is, what made the second one not working offline.?




Firebase realtime database chatting

http://ift.tt/2rASMZK

I followed the instructions on the homepage, and Chatting alone has been a success. Also data was successfully put in my database that in my firebase project.

But I want to Chatting other person. Should I share my firebase project with other person for chatting, or what should I do?enter image description here




Route static page with vue-router

I'm fairly new to web development and I was wondering if there was a way to route a static web page with its own stylesheets and javascripts, using vue-router.

Let's say I have a directory called staticWebPage that contains:

  • an index.html file
  • a javascripts directory containing .js files
  • and a stylesheets directory containing .css files

Now, I'd like to map /mystaticwebpage to this index.html file so it displays that particular static web page.

I'd like to do something like this:

import VueRouter from 'vue-router'
import AComponent from './components/AComponent.vue'
import MyHtmlFile from './references/index.html'

router.map({
   '/acomponent': {
      component: AComponent
   },
   'mystaticwebpage': {
       component: MyHtmlFile
   }
})

Of course, this doesn't work as I can only reference Vue components in router.map.

Is there a way to route to that ./staticWebPage/index.html file using all the .js and .css file contained in the /staticWebPage directory?




Save .CSS changes to a website on the client side

I have made some changes of the .CSS for a website, is it possible for me to save those changes, so that when I start the website the next time, it is kept? I do understand that I can't change the server code. I am asking if I am able to change this on the client side.

I have access to the following browsers:

  • Internet Explorer 10
  • Firefox
  • Chrome



"Google is not defined" error - Trying to create infowindow Google Maps

In Google Maps API, I want to create an infowindow everytime I place a marker (markers all stored in an array).
When declaring the infowindow:

var infowindow = new google.maps.InfoWindow();

I get the error 'google is not defined'.

This only stops if I move this line of code inside the function that creates markers, but then I would be creating the variable infowindow everytime I placed a marker which I understand is bad practice?

I would prefer to declare infowindow at the start of my JS, and then just use it everytime a marker is placed.
I couldn't find anything that helped from the other answers on SO, I've tried reordering the JS files but nothing as worked so far.

Any tips would be welcome




WebDeploy.mxe deploying to wrong location

We are using Jenkins for CI and is and use it for automatic deploy. First, we create the package file as a zip using the following command using msbuild.exe

  msbuild.exe /T:Package /p:Configuration=Release;PackageLocation="D:\Deploy\${BUILD_NUMBER}\PrintCloud.zip";VisualStudioVersion=11.0

After creating the package we try to deploy it to Default Web Site using msdeploy.exe using the following command.

"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:package="D:\Deploy\%BUILD_NUMBER%\PrintCloud.zip" -dest:auto,computerName=localhost

Here the package is deploying in to a wrong directory. Rather than deploying it to inetpub/DefaultWebSite it creates a new folder inside the this folder and deploy to it. (inetpub/DefaultWebSite/Web_deploy/). What I want is to deploy to the DefaultWebSite.




Difference between client-server web apps and websites

I am wondering: why we use to split a web app into a client (javascript, CSS or even a framework like React or angular) and a server (php)? Why It is prefereable to do so instead of simply going on a website that includes php and html all together?




Web scraping information from the site in PHP

I do PHP script, the script must copy the list of publications (from the homepage) and copy the information that is inside these publications.

I need to copy content from my previous site and add the content to the new site!

I have some success, my PHP script copies the list of publications on the home page. I need to make a script that pulled information inside each publication (title, photo, full text)!

For this, I wrote a function that extracts a link to each post. Help me write a function that will copy information on a given link!

    <?php
header('Content-type: text/html; charset=utf-8');
require 'phpQuery.php';

function print_arr($arr){
    echo '<pre>' . print_r($arr, true) . '</pre>';
}

$url = 'http://ift.tt/2pR319Y';
$file = file_get_contents($url);

$doc = phpQuery::newDocument($file);

foreach($doc->find('.blog-posts .post-outer .post') as $article){
    $article = pq($article);
    $text = $article->find('.entry-title a')->html();
    print_arr($text);
    $texturl = $article->find('.entry-title a')->attr('href');
    echo $texturl;
    $text = $article->find('.date-header')->html();
    print_arr($text);
    $img = $article->find('.thumb a')->attr('style');

     $img."<br>"; if (preg_match('!background:url.(.+). no!',$img,$match)) { 
$imgurl = $match[1]; 
} else 

{echo "<img src = http://ift.tt/2pR319Y".$item.">";}

        echo "<img src='$imgurl'>";
}
?>




IE browser HTTP request aborted

I am facing HTTP request aborted in IE browser only, other browser same request served with 200 status code.

Can anyone help me to fix this issue.




How to use chrome to save data to a specific location in local drive silently "without prompt"?

The web application that I work on right now require a feature that can save txt file to specific folder in local drive without prompting the user for action. I've research on applet but chrome does not support NPAPI which is require for applet. Are there any other solution that I can use?




Upload file to WWW directory from WordPress theme

I am trying to upload a PHP file to WordPress root folder (www or public_html).

How can I do it ?

I want to implement it on my theme. I tried with move_uploaded_file , but it's not uploading anywhere.




Hammers.js swipe not triggering video autoplay on IOS

I'm working on web app using hammer.js for gesture detection. Main content of the app is mainly video and image slides with texts. My issue is when I trigger video initializing with autoplay on swipe (going from one slide to the other, video is initialized (I use video.js) but is not automatically played.

I tried with a regular mousedown event listenner and it worked. I know IOS block autoplay behaviour when init is not triggered from user action.

Is there any way that hammer.js swipe event is recognized as user action ? Is anyone had the issue.

cheers




Changing view or route after the request has been started in Pyramid

I have a situation where if the user visits any route on my Pyramid application I would like to serve them one particular view. Basically "force" them to a single page. A redirect would be fine too.

Is there something in Pyramid to achieve this?




lundi 29 mai 2017

Fetch data from URL in r

i want to fetch details from this URL (lines containing "exon") "http://ift.tt/2qB0E8m".

i tried using the following commands:-

url <- "http://ift.tt/2qB0E8m"
resp <- GET(url)
content(resp)

however, i am not able to access the data.




CREATE TABLE not working

I am trying to create a mysql table, and i have tried the following code: ( please excuse some of the varchar(255)'s )

    $connection = @mysqli_connect($host, $user, $pswd);

    if($connection->connect_error){
        die("Connection failed: " . $connection->connect-error);
    }else{
        echo "Connected <br>";
    }

    $createTable = "CREATE TABLE IF NOT EXISTS cabBookings (
                _booking_code VARCHAR(10) NOT NULL PRIMARY KEY,
                _customer_name VARCHAR(100) NOT NULL,
                _customer_phone VARCHAR(255) NOT NULL,
                _customer_address_unit VARCHAR(255) NOT NULL,
                _customer_address_num VARCHAR(255) NOT NULL,
                _customer_address_name VARCHAR(255) NOT NULL,
                _customer_suburb VARCHAR(255) NOT NULL,
                _destination_suburb VARCHAR(255) NOT NULL,
                _pickup_date VARCHAR(255) NOT NULL,
                _pickup_time VARCHAR(255) NOT NULL
                ) ENGINE=InnoDB DEFAULT CHARSET=utf8";


    $queryResult = @mysqli_query($connection, $tester)
        or die ("error". mysqli_error($connection));


    @mysqli_select_db($connection, $dbnm)
    or die('Database not Available');

But this is not working. It prints out "error" but doesn't actually create the table, nor print out the error it is receiving. I have input my code into various checkers- all to no avail, and have run out of ideas.

NOTE: The connection to the database IS working.

NOTE2: this code is in a php file.

Thanks in advance




OneSignal web notifications is shown event when application tab is in focus

i'm working on chat application, and using onesignal for web push notifications in chrome.

But issue is that use continue to receive web push notifications event when tab with application is active.

Is there any way to mute onesignal push notifications during application tab is in focus?




Dealing with user holding key down in JavaScript EventListener

So I am making a simple javascript game and I am using the spacebar to shoot missles.

Here is where I have problems:

        document.addEventListener("keydown", keyDownHandler, false);
        document.addEventListener("keyup", keyUpHandler, false);

        function keyDownHandler(e){
            if(e.keyCode == 39){
                rightPressed = true;
            }
            else if(e.keyCode == 37){
                leftPressed =true;
            }
            else if(e.keyCode == 32){  //Keycode for space bar
                missleFired = true;
            }
        }

        function keyUpHandler(e){
            if(e.keyCode == 39){
                rightPressed = false;
            }
            else if(e.keyCode == 37){
                leftPressed = false;
            }
        }

In my keyDownHandler, I am using it to catch when the user is moving the spaceship left and right, or when the user presses spacebar to shoot. Problem is, I only want the "missleFired" variable to be set to true once, initially when the bar is pressed. The way it is right now, the user can hold the spacebar down and shoot loads of missles, but I want only one missle to be shot from the time the spacebar is held down until it is released. How can I do this?




Hybrid app, wich API and Web or not?

In my first app, I want to use google maps/earth to allow each client to inform his global position once, store this information and show it in a map for everybody else...

**For a Hybrid phonegap app, I need to know what is the best API to do this, and if it has to be a web (because its a html5+javascript app?) or non-web API!




redirect is only possible to ip adress by dns hosting settings

I needed to bind hosting/vps IP to domain on domain provider side. Tutorials say I need to copy those lines and enter on domain provider website somewhere.

ns1.digitalocean.com.
ns2.digitalocean.com.
ns3.digitalocean.com.

I open my domain provider settings. There are default NS servers

nsb4.srv53.com nsb3.srv53.com .....

, which are told not be touched and that all settings must be done on other website here https://dnshosting.org/

At this website opposite to my domain in my account there only the following options

  1. Default parking page(wrong for sure)
  2. Redirect through frames (not our case)
  3. Custom parking page(wrong also)
  4. Switch off redirect(><)
  5. Direct redirect (what I need)

But redirect is only possible to ip adress, not ns2.digitalocean.com. which means that ip adress will be shown in url, not domain - so I guess that's all wrong.

Help, please. Any ideas how to handle this?




Visual studio web api linq problems

i have a little problem with my controller. I have a database filled with players from fifa (Playersk as key,name and rating). In my playercontroller.cs i can use

// GET: api/Player
        public IEnumerable<Player> Get( )
        {
            DataClasses1DataContext db = new DataClasses1DataContext();
            return db.Players;
        }

and

 //GET: api/Player/3
        public Player Get(int id)
        {
            DataClasses1DataContext db = new DataClasses1DataContext();
            return db.Players.Where(x => x.Playersk == id).FirstOrDefault();
        }

just fine by using http://localhost:63991/xyz. However,i need to use their name and not their id. I'm stuck with this:

//GET: api/Player/Beckenbauer
        public Player Get(string playername)
        {
            DataClasses1DataContext db = new DataClasses1DataContext();
            return db.Players.Where(x => x.Name.Contains(playername)).FirstOrDefault();
        }

This gives me the same result as the first one,a json/xml(depends on my browser) with the complete table and not a filtered one.

What am i missing?




Parsing a certain webpage in python

I'm trying to split on every instance of "href" in a between two certain tags. to be specific here's what I'm working with: `

req = urllib2.Request('http://tv1.alarab.com/')
response = urllib2.urlopen(req)
link = response.read()
target = re.findall(r'<div id="nav">(.*?)</div>', link, re.DOTALL)
for items in target:
    mypath = items.split(' href="/')[1].split('/')[0]
    print mypath

Here's what it prints out:

view-5553

It's only printing the first instance. On another website, I'm using the exact same approach and it prints all the instances on when it meets an "href"

Here's what I have for another website:

req = urllib2.Request('http://ift.tt/2rhdmx1')
response = urllib2.urlopen(req)
link = response.read()
target = re.findall(r'<ul class="hidden-xs">(.*?)</ul>', link, re.DOTALL)
for items in target:
    mypath = items.split('href="')[1].split('">')[0]
    print mypath

Here's what this one prints out, which is basically what I want the first piece of code to print out:

/Album-1104708-1/
/Cat-134-1
/Cat-100-1
/Album-1104855-1/
/Cat-121-1

I tried running the debugger and it seems like the for loop is only executing once for the first one. I'm not sure why or what's going on. Any help would be appreciated.




Error: Cannot find module './formats' on deplying to herkou or digitalocean

I have a nodejs + mongodb app and it works properly on my local machine but I'm facing a problem in deployment here are the logs from heroku

2017-05-29T22:14:21.706635+00:00 heroku[web.1]: Starting process with command `node server.js`
    2017-05-29T22:14:23.859502+00:00 app[web.1]: module.js:471
    2017-05-29T22:14:23.859516+00:00 app[web.1]:     throw err;
    2017-05-29T22:14:23.859517+00:00 app[web.1]:     ^
    2017-05-29T22:14:23.859517+00:00 app[web.1]: 
    2017-05-29T22:14:23.859518+00:00 app[web.1]: Error: Cannot find module './formats'
    2017-05-29T22:14:23.859519+00:00 app[web.1]:     at Function.Module._resolveFilename (module.js:469:15)
    2017-05-29T22:14:23.859520+00:00 app[web.1]:     at Function.Module._load (module.js:417:25)
    2017-05-29T22:14:23.859521+00:00 app[web.1]:     at Module.require (module.js:497:17)
    2017-05-29T22:14:23.859521+00:00 app[web.1]:     at require (internal/module.js:20:19)
    2017-05-29T22:14:23.859522+00:00 app[web.1]:     at Object.<anonymous> (/app/node_modules/qs/lib/stringify.js:4:15)
    2017-05-29T22:14:23.859523+00:00 app[web.1]:     at Module._compile (module.js:570:32)
    2017-05-29T22:14:23.859524+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:579:10)
    2017-05-29T22:14:23.859524+00:00 app[web.1]:     at Module.load (module.js:487:32)
    2017-05-29T22:14:23.859525+00:00 app[web.1]:     at tryModuleLoad (module.js:446:12)
    2017-05-29T22:14:23.859526+00:00 app[web.1]:     at Function.Module._load (module.js:438:3)
    2017-05-29T22:14:23.924630+00:00 heroku[web.1]: Process exited with status 1
    2017-05-29T22:14:23.941072+00:00 heroku[web.1]: State changed from starting to crashed
    2017-05-29T22:15:19.924922+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=dry-river-85545.herokuapp.com request_id=a28024a6-676e-4f33-88fe-37475038373f fwd="197.166.171.187" dyno= connect= service= status=503 bytes= protocol=https
    2017-05-29T22:15:23.327025+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=dry-river-85545.herokuapp.com request_id=2b86cf88-9f46-4f6f-95d7-8462ce2c8230 fwd="197.166.171.187" dyno= connect= service= status=503 bytes= protocol=https




how to design One among tag One among at left and right

first sorry my bad english.

i need something like this

enter image description here

as you can see one of major is right and on left , years same

i wrote this HTML & CSS code

HTML

<div class="row">
        <div class="full">
            <div class="d1">university 1</div>
            <div class="d2">year 1</div><br>
            <div class="d1">university 2</div>
            <div class="d2">year 2</div><br>
            <div class="d1">university 3</div>
            <div class="d2">year 3</div><br>
            <div class="d1">university 4</div>
            <div class="d2">year 4</div><br>
        </div>
    </div>

CSS

.full div{
  display: inline-block;
  width: 130px;
  height: 50px;
 }

.full div:nth-child(odd){
  float: left;
 }

and here my result:

enter image description here

at first sight yes,it's work fine as i excepted but it's not.

problem is:

1:i can't align center no mater what i do

2: at extra small size div goes down not side by side

3: if i give class like col-xs-6 it's not work as i except

here online code enter link description here

just resize window to understand what i'm saying




Visual Studio URL doesn't change

i have a webBrowser in my application, and when i go from www.google.com to http://ift.tt/2r4IcbM, my code still says im on www.google.com. Why?

Code:

public Form1()
        {
            InitializeComponent();
            webBrowser1.Navigate("http://www.google.com/");
        }


private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show(webBrowser1.Url.ToString());
        }



It shows always www.google.com




What is/are the standard python packages for HTML generation

I'm looking for a package for writing HTML files (so that I don't just do everything in strings). Specifically I want to use a well-developed and maintained package, so I'm interested in what the standard(s) (if one/any exist) for people who typically use python for web-dev are as apposed to what package has the optimal features for particular use cases (which for me are likely to change). (I'm also hoping that keeps this question more objective and narrowly focused).

One package that seems nice is Knio/dominate, is this something people have success with?




How can I make .html file from a html.erb?

i have a little Rails App and I want to implement a export function.

The whole .html.erb file should saved as .html and the content should be the same.

How can I do that? I wanted do ask at beginning, so I dont code for nothing.




HTML, JS Logic not working

I am trying to create a js logic function to solve the variables in an equation like this: 2x+3x=16. The problem is that it is supposed to output x=3 y=2, but instead, it outputs x=-10 y=2. enter image description here I am using 2x+3y=16 for this result.

function solver(){
  //Get c1, c2, and the answer
  var c1=parseInt(prompt("Enter the coefficient of x:", "Example: 2 if you have 2x"));
  var c2=parseInt(prompt("Enter the coefficient of y:", "Example: 3 if you have 3y"));
  var answer=parseInt(prompt("Enter the answer:", "Example: 2x=4 it would be 4"));
  //set other variables
  var x;
  var y;
  var m;
  //setup
  x=answer/c1;
  m=answer%c1;
  //loop
  while(true){
    //if it is not an integer or it is 0
    if (isInt(m/c2) === false || m/c2 == 0){
      x=x-1;
      m=answer%x;
    }else if (isInt(m/c2)===true && m/c2 != 0){
      x=x;
      y=m/c2;
      break;
    }
  }
  alert("x="+x+" y="+y);
}
function isInt(n) {
   return n % 1 === 0;
}
<h1>EXAMPLE: 2x+5y=16</h1>
<button onclick="solver()">Solve!</button>



Facebook Web data connector is not working on local server

I want to get new page(next fields of data) of a same Facebook page. I am using Facebook Web data connector. I have checked out the same code provided on github..But it is not working for me.. I am just trying to get all the data from pages belonging to particular user. I have used previous-reponse.paging.next to get next set of info but is not providing valid URI... instead it is showing "cursor" field containing two subfield "before" and "after"... Thank you in advance... Note : I am running the facebook WDC on local server..can say localhost:8888




Node - connect-flash not working

I'm trying to display an error message with connect-flash but it seems not working. I've tried several ways to do this work but any of that worked. I gotta an web app with a similar config code and worked without any problem.

here is my code:

const express = require('express')
const moment = require('moment')
const morgan = require('morgan')
const bodyParser = require('body-parser')
const db = require('./configs/db')
const flash = require('connect-flash')
const session = require('express-session')
const cookieParser = require('cookie-parser')
const app = express()

app.set('view engine', 'ejs')
app.set('views', 'views')
app.set(db)
app.use(bodyParser.urlencoded({extended:true}))
app.use(bodyParser.json())
app.use(morgan('dev'))
app.use(cookieParser())
app.use(session({
  secret: 'keyboard cat',
  resave: false,
  saveUninitialized: true,
  cookie: { secure: true }
}))
app.use(flash());
var sessionFlash = function(req, res, next) {
    res.locals.currentUser = req.user;
    res.locals.error = req.flash('error');
    res.locals.success = req.flash('success');
    next();

}
app.use(sessionFlash)




app.get('/', function (req, res) {
  req.flash('error', 'Welcome');
  res.render('test', {
    title: 'Home',
  })
});
app.get('/addFlash', function (req, res) {
  req.flash('error', 'Flash Message Added');
  res.redirect('/');
});

my EJS file:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Test</title>
  </head>
  <body>
  <%  if(error){ %>
      <div class="">
          <h1><%=error%></h1>
      </div>
    <% } %>
  </body>
</html>




How can I change colors of table rows with css?

i have a Problem.

Here is my CSS:

.tabelle {
    width: 90%; border-collapse: collapse;
        margin-left:auto;
        margin-right:auto;
}


.separate {
    border-radius: 10px;
    border-spacing: 0;
    border-collapse: separate;
}
.separate td, table.separate th {
    border-bottom: 1px solid Gray;
    border-right: 1px solid Gray;
}
.separate tr:last-child td:first-child {
    border-bottom-left-radius: 10px;
}
.separate tr:last-child td:last-child {
    border-bottom-right-radius: 10px;
}
.separate tr th:first-child, table.separate tr td:first-child {
    border-left: 1px solid Gray;
}
.separate tr:first-child th, table.separate tr:first-child td {
    border-top: 1px solid Gray;
}
.separate tr:first-child th:first-child, table.separate tr:first-child td:first-child {
    border-top-left-radius: 10px
}
.separate tr:first-child th:last-child, table.separate tr:first-child td:last-child {
    border-top-right-radius: 10px;
}

.zelle{
    padding: 10px;
    background-color: White;
    font-family: Verdana;
    font-size: 12px;
    text-align: center;
    color: Black;
}
th {
    background-color: #A58AB4;
    padding: 8px;
    color: White;
    font-size: 12px;
    font-family: Verdana;
}

I tried it with:

.tabelle tr:nth-child(even){
        background: #dae5f4;
    }

.tabelle tr:nth-child(odd){ 
        background: #b8d1f3;
    }

But it doesn't work. I have googled to solve my problem, but i cannot find a working solution.

I want to have one color for one row and another color for the second row. But not more than 2 colors.

Can anybody help me?




Recommendations for Python web GUI

I am a Python newbie and currently I am writing a script in Python which is analyzing different streams and it is returning some of their audio/video parameters. It is based on ffmpeg and more specifically ffprobe. Since the script is running on a Linux server and it is only CLI based, I would like to create a simple user interface. For example NGINX server and a simple webGUI, where I can define the URL path or upload the file and then see these audio/video parameters in the same page with the option to export the results in different file formats. It should also support file upload functionality and selection of which parameters I want to see.

So I am looking for recommendations about the webGUI. I was looking on the web, and I think Flask could do something similar, but it looks a bit too complicated to me. And I suppose I will need to write the HTML and CSS. So ultimately I am looking for something like Wordpress, where I can define the names of the fields etc. without writing the CSS and HTML part. Is there something like this? If not what are you recommendations?




How to open URL in new window/tab without leaving the current one?

The following <a> element would open www.example.com in a different tab/window than the current one:

<a href="//www.example.com" target="TabOne">Link</a>

However, users would be brought to the newly opened tab/window. How can I open URL in new window/tab without leaving the current one?




Muted video doesnt show volume controls on Android internet browser

I have a simple video on a home page and it works perfect across chrome, safari, etc. It is muted but user can unmute or increase volume themselves.

However issue arrises when trying to play video in Android internet browser. The volume controls are nowhere to be found. Is there a way to have those controls come up without affecting other browsers.

This is the code used:

<video width="100%"  controls autoplay loop onclick="this.play()">
  <source src="http://ift.tt/2reV3bN">
  Your browser does not support the video tag.
</video>

I had to add CSS to remove Download button as not needed at all (dont think it affects the volume but to complete all code used here it is):

video::-internal-media-controls-download-button {
 display:none;
}

video::-webkit-media-controls-enclosure {
 overflow:hidden;
}

video::-webkit-media-controls-panel {
 width: calc(100% + 30px); /* Adjust as needed */
}

The only controll i get on android is video location and full screen: ScreenshotfAndroidPlayer




Sending data to web using arduino GSM module using GPRS

#include <SoftwareSerial.h>
SoftwareSerial GSM(9, 10); // RX, TX
int sensor=5;

enum _parseState {
PS_DETECT_MSG_TYPE,

PS_IGNORING_COMMAND_ECHO,

PS_HTTPACTION_TYPE,
PS_HTTPACTION_RESULT,
PS_HTTPACTION_LENGTH,

PS_HTTPREAD_LENGTH,
PS_HTTPREAD_CONTENT
};

byte parseState = PS_DETECT_MSG_TYPE;
char buffer[80];
 byte pos = 0;

 int contentLength = 0;

 void resetBuffer() {
  memset(buffer, 0, sizeof(buffer));
  pos = 0;
 }

  void sendGSM(const char* msg, int waitMs = 500) {
  GSM.println(msg);
 delay(waitMs);
 while(GSM.available()) {
  parseATText(GSM.read());
   }
   }

 void setup()
 {
   GSM.begin(9600);
  Serial.begin(9600);

  sendGSM("AT+SAPBR=3,1,\"APN\",\"zongwap\"");  
 sendGSM("AT+SAPBR=1,1",300);
sendGSM("AT+HTTPINIT");  
sendGSM("AT+HTTPPARA=\"CID\",1");
sendGSM("AT+HTTPPARA=\"URL\",\"http://ift.tt/2rNiZnn?
sensor1="" + sensor + ""\"""");
  sendGSM("AT+HTTPACTION=0"); 
  }

void loop()
   {  
   while(GSM.available()) {
    parseATText(GSM.read());
    }
   }

  void parseATText(byte b) {

 buffer[pos++] = b;

    if ( pos >= sizeof(buffer) )
    resetBuffer(); // just to be safe

   /*
  // Detailed debugging
    Serial.println();
   Serial.print("state = ");
   Serial.println(state);
   Serial.print("b = ");
   Serial.println(b);
  Serial.print("pos = ");
  Serial.println(pos);
  Serial.print("buffer = ");
  Serial.println(buffer);*/

  switch (parseState) {
  case PS_DETECT_MSG_TYPE: 
    {
  if ( b == '\n' )
    resetBuffer();
  else {        
    if ( pos == 3 && strcmp(buffer, "AT+") == 0 ) {
      parseState = PS_IGNORING_COMMAND_ECHO;
    }
    else if ( b == ':' ) {
      //Serial.print("Checking message type: ");
      //Serial.println(buffer);

      if ( strcmp(buffer, "+HTTPACTION:") == 0 ) {
        Serial.println("Received HTTPACTION");
        parseState = PS_HTTPACTION_TYPE;
      }
      else if ( strcmp(buffer, "+HTTPREAD:") == 0 ) {
        Serial.println("Received HTTPREAD");            
        parseState = PS_HTTPREAD_LENGTH;
      }
      resetBuffer();
    }
  }
}
break;

   case PS_IGNORING_COMMAND_ECHO:
     {
     if ( b == '\n' ) {
    Serial.print("Ignoring echo: ");
    Serial.println(buffer);
    parseState = PS_DETECT_MSG_TYPE;
    resetBuffer();
  }
}
break;

  case PS_HTTPACTION_TYPE:
   {
  if ( b == ',' ) {
    Serial.print("HTTPACTION type is ");
    Serial.println(buffer);
    parseState = PS_HTTPACTION_RESULT;
    resetBuffer();
  }
}
break;

 case PS_HTTPACTION_RESULT:
   {
  if ( b == ',' ) {
    Serial.print("HTTPACTION result is ");
    Serial.println(buffer);
    parseState = PS_HTTPACTION_LENGTH;
    resetBuffer();
  }
}
break;

  case PS_HTTPACTION_LENGTH:
  {
  if ( b == '\n' ) {
    Serial.print("HTTPACTION length is ");
    Serial.println(buffer);

    // now request content
    GSM.print("AT+HTTPREAD=0,");
    GSM.println(buffer);

    parseState = PS_DETECT_MSG_TYPE;
    resetBuffer();
  }
}
break;

  case PS_HTTPREAD_LENGTH:
    {
  if ( b == '\n' ) {
    contentLength = atoi(buffer);
    Serial.print("HTTPREAD length is ");
    Serial.println(contentLength);

    Serial.print("HTTPREAD content: ");

    parseState = PS_HTTPREAD_CONTENT;
    resetBuffer();
  }
}
break;

   case PS_HTTPREAD_CONTENT:
    {
  // for this demo I'm just showing the content bytes in the serial monitor
  Serial.write(b);

  contentLength--;

  if ( contentLength <= 0 ) {

    // all content bytes have now been read

    parseState = PS_DETECT_MSG_TYPE;
    resetBuffer();
  }
}
break;
 }
}

i even don't understand the code but i get the idea and when i am trying to post the data to web its not working i don't know what's wrong with it i am getting web content back but i can't post data to the web i tried both get and post method non of them brought luck to me




Testing the quality, format and sizing of an image

For a website I am building, I need a solution to test that a given Image (upload by an user) meet certain specification :

  • It can be a Scanned image, Smart phone pictur, Digital upload or Web Camera picture
  • at least 8MP
  • Scanned images should be over 300 dpi in resolution and the size of scan reduced to the size of the document. Passport 130mm x 90mm, Driving Licence 90mm x 55mm and Euro ID 130mm x 90mm.
  • Not blurred
  • Colour Image
  • PDF, JPG or PNG file type
  • Clear edges
  • 90 degree angle (bird’s eye view)
  • Size of the document between 102 k and 3 M

Do you know how I can test all this specification ? Java will be the preferred language, but I am open to others languages.




I want to build a web application offline which run on Android, read .PDF files with some security option. Is that possible?

Aim is an application that can run on mobile smart device (android, ios, …) to read a book in pdf format. We want to add security option that will en-descrypt pdf after download.Problem that we are encounter is that browser on android, ios device cannot view pdf file directly.




dimanche 28 mai 2017

vertical Scrollbar is not working

Here is my problem i want to use scrollbar but it is only showing scrollbar but that scrollbar is not working. I am using CSS to style the scrollbar and other layouts and Html to use that styling. here is my Styling Code

  #sub_menu, #content{
    display: inline-block;
}

#sub_menu{
    width:23%;
    height: 10%;
    background-color: #999999;
    padding: 1%;
    vertical-align: top;
    border: 1px solid;
}
#content{
    width: 73%;
    margin-right: 1%;
}
@media screen and (max-width: 600px), sreen\0{
 #sub_menu{
        height: initial;
        font-size: 15px;
        margin-bottom: 2%;
    }
    #content, #sub_menu{
        display: block;
        width: 95%
    } }
 .contentt {



  height: 100%;
  overflow-y: scroll;
  margin-bottom: 1%;
}

.contentt::-webkit-scrollbar { 

  display: none;
}

And Here is my HTML CODE

 <div id="sub_menu">
                      <h3  style="border-bottom: 3px solid rgb(135, 31, 139);">Related Videos</h3>


    <div class="contentt" style="width:100%;height:40%; margin-bottom:3%;padding:2%" >

     <?php

    $con = new mysqli('localhost','','','');


    $sql = "SELECT ID, Title, Link FROM that where Category like 'this'";
    $result = $con->query($sql);

    if ($result->num_rows > 0) {

    while($row = $result->fetch_assoc()) {

        $url = $row["Link"];


        $title = $row["Title"];
        $id = $row["ID"];
        $path="http://domain/Song.php";

        echo "<h5>$title'</h5>";
        echo '<a href="' . $path . '?Title=' . $title .'&id=' . $id .'"><img src="http://domain/images/' . $id .'.jpg"  alt="HTML tutorial" style="width:75%;height:95%;border:0;"class="btnn songpicc"></a>';

       echo '<hr>';
    }
    } else {
    echo "0 results";
    }

    $con->close();

    ?>
    </div>
    </div>

Thanks in Advance




Unable to create xpath for dynamic elements in a web table?

For example get the element highlighted in the picture.

I have tried "//div[@class='x-grid-item-container']/table/tbody/tr[@class='x-grid-row']/td" but after td i'm not sure what to use.




List 8 latest/recent values in Jinja2 based on their created date

I'm just new to Python with Jinja2 templating in HTML. I need to display the top 8 recent registered users on front-end, but it doesn't display the most recent users based on their created_date, and shows 12 users. Here's my code:

<ul class="users-list clearfix">
   
 </ul>




How to get a web page to listen to changes in a remote DB and update the page automatically?

Say I am now viewing a webpage. Between now and eternity, some other users may do something, which causes changes to a database.

I want the webpage that I am viewing to automatically update the relevant sections of the webpage without having me to refresh the page.

What technology is available to achieve this?




How to turn my opencv python project into web service?

My project is face expression recognition, using opencv and Support Vector Machine. My code's in python 3.x I'm looking for the way to create a web service for my project. But i didn't have any experience with PHP neither web working. I want to detect face in web browser though my camera using opencv, then send that face image to my back-end to recognize its emotion. Any idea how can i do it?? Thanks!




How can I put the loading while waiting on render Reactjs

I just made a animated "loading.." using css but i want it to only exist when it's waiting for data to load/render.. any idea how I really dont know how im so new to this?...

this is the loading...

  <span className="Loader">
          <div className="Loader-indicator" >
            <h1>
              <span>Loading</span>
              <span className="Loader-ellipsis" >
                <span className="Loader-ellipsisDot">.</span>
                <span className="Loader-ellipsisDot">.</span>
                <span className="Loader-ellipsisDot">.</span>
              </span>
            </h1>
          </div>
        </span>




How I can add user reviews in my website like stars in play store?

I want to add stars in my website that users can use to add reviews in my website. Like Play store shows stars for users to give rating. Have anyone have a way to do this.




JSON and Web API - how do I receive a simple JSON object into a Web API using built in types (without JQuery)?

I'm working on a system that sends a simple JSON object to a C# .NET Web API in the form:

{property1: "string1", property2: "string2"}

I want to receive this JSON into the web api. I can't initially use a custom object when I receive the JSON into the web API (because the system I'm working writes stuff into the DB automagically, and for this to work, only the built-in C# types can be used at the point that data reaches the web api).

The system doesn't utilise JQuery, so that's not an option. How can I accept this JSON into the Web API?




Apple Touch Id on Web

I'd like to create a web page that displays a message and a button. If pressed, it asks for touch id verification. If the user verifies, it submits a form or redirects to another url.

The idea is to create an experience which is very similar to apple pay on web.

I will deploy this on my internal network, and all my users will have an iphone, so it can work only in specific conditions, e.g. only with mobile safari.

Any creative idea on how to achieve this experience?




Coding a dynamic PHP Calendar with MySQL

I am trying to code from scratch (for a class assignment) a single month calendar that will show events (stored in a database) and will allow the user to switch between a grid view and a list view display (similar to Google Calendar). I was thinking for the grid mode I would create a table for displaying the calendar and just a simple box model for the list mode. Both would loop through the database and output any events that correspond to the date. Does anyone have any suggestions or pointers I can use on making my calendar more effective?




How to enable SSL in docker with nginx hosted in Ubuntu

I have a web application that's running inside a docker container. It's written in Play Framework. My host is an Ubuntu 16.04 server with apache. Docker application use the nginx server. The port 443 is directed to that container. SSL in my Apache server is turned off. Now when i try visiting my domain with https the browser give the warning which is annoying.

So i got some free certificates from sslforfree.com and used it with the docker application but still the warnings come up. Do i need to use those certificates in the apache server too?




How would I go about converting this code to .htaccess?

I've been googling for the last hour on how to do this but no luck, can anyone help?

<rule name="Rule 1">
  <match url="^habbo-imaging/badge/([^/]+)" ignoreCase="false" />
  <action type="Rewrite" url="/habbo-imaging/badge.php?badge={R:1}" appendQueryString="false" />
</rule>
<rule name="Rule 5">
  <match url="^gamedata/habbopages/chat/commands" ignoreCase="false" />
  <action type="Rewrite" url="gamedata/habbopages/chat/commands.txt" appendQueryString="false" />
</rule>
<rule name="API - Default">
  <match url="^api/([a-zA-Z0-9_-]+)(|/)$" ignoreCase="false" />
  <action type="Rewrite" url="api.php?request={R:1}" appendQueryString="false" />
</rule> 
<rule name="API - Rooms">
  <match url="^api/room/([0-9_-]+)(|/)$" ignoreCase="false" />
  <action type="Rewrite" url="api.php?request=room&amp;room_id={R:1}" appendQueryString="false" />
</rule> 




Under-qualified Inter

So I received a web development internship despite telling them I didn't have much coding experience. I recently started and they're treating me like I know a bunch when in all honesty I barely know the basics. I do not know what frameworks are, know the basics of HTML and Javascript, and they want me to use Knockout JS and Metro bootstrap; I don't know any of the technical terms they're throwing at me. How can I learn stuff like Front End and Back End development? BTW, the project is that they have a webpage that takes a list of listings which are updated and pulled from the database every 5 minutes and the page that I am creating is what they are redirected to when they click on one of the listings and it basically has a table that has the filing number, filing date, etc and I need to be able to retrieve that information from the database and put it in the correct cells. (sorry for the long drawn out first post).




col-xs not working for media screen less than 768px

I am using Bootstrap v3. The divs are not taking 100% width in mobile devices with col-xs-12. Code is working fine for medium and small screens but retaining the 50% width for screens less than 768. Here is the link to the screenshot of the behaviour. Image

Gone through all other available solutions but none worked for me.




How do I find the source of this webapplet?

I am fairly new to web development. I want to appropriate this applet from the following link.

http://ift.tt/2s42Uap

into my site, however, I do not know how to search its original source, do you have some hint for me? also, what kind of books I should read in order to learn more about this area of technology?




Editing a html file in c#

I want to edit a html file from a site (confluence). I used WebClient to download the html form, edited it and finally uploaded it back to the site using WebClient.UploadString. It seems like the upload doesn't work. Can someone help?

Thanks!




Does MapKit in iOS supports WMS(Web Map Service), WFS(Web Feature Service) and GeoJSON Geometry

I am building an iOS application and it requires the following features

I am using MapKit. Does it support the following functionalities or should we go for the third party SDKs?

WMS(Web Map Service) WFS(Web Feature Service) GeoJSON Geometry support.

When I search I found that for WMS and WFS ArcGIS Runtime SDK for iOS is aviable. http://ift.tt/2s4nE1M

and for GeoJSON Geometry support GEOSwift is available. http://ift.tt/1BhH7OV

Mapbox iOS SDK is also there http://ift.tt/2fGX3ov

So for GeoJSON Geometry support should I go with MapBox.

Thanks in advance.




What programming language to use to create data visualization on website and to push the data in a downloadable report?

I work with a team that need to create a online tool that would allow people to take some kind of survey and then to instantly get their results in a visual way (spider charts, pie charts, etc...), and to download a pdf with those results.

And we have no idea what language should be used to create such a system on a webplatform. Anyone could put us on the right tracks ?

Thank you for your time!




JSP can't find request(inner object)'s method

enter image description here

I am making simple sign up web using TomCat. My Tomcat Version is 8.5.15. I have problem on submit data

Here is Post Source

signup.jsp

        <form id="login_form" method="post" action="../controller/c_signup.jsp">
            <a>Sign Up</a><br>
            <label for="uid">ID</label>
            <input class="input_border" type="text" name="uid" id="uid"><br>
            <label for="pw">Password</label>
            <input class="input_border" type="password" name="pw" id="pw"><br>
            <label for="name">Name</label>
            <input class="input_border" type="text" name="name" id="name"><br><br>
            <input class="btn btn-blue" type="submit" value="Sign Up">
        </form>

and I want to use request.setCharacterEncoding("UTF-8"); but my IDE can't find Method

Here is error code

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
**request.(Here is error)**
%>

What shoud I do. D:




Hosting a website on our own from our PC

I was trying to host a web page from my laptop. I followed the steps as mentioned below:

  1. I used Apache Tomcat as Web Server; I have placed the webpage, which I wanted to host inside 'webapps' folder.

  2. I tried to start the apache server manually by clicking the "startup" batch file.

  3. Then, when I tried to access the webpage from browser using the URL "localhost:8086/JK/JK.html", I was able to see the web page content successfully.

[ #Note: 8086 is the port, where the apache server is hosted JK is the folder inside the 'webapps' folder of Apache software JK.html is the web page name.]

  1. Now, I tried replacing 'localhost' with the local IP(i.e., 192.168.1.105) & I was able to access the same successfully.
  2. Also, I was able to access the same from all the computers/devices, which are connected to the same network.
  3. However, my intention to access that web page from a device, which doesn't belong to the same network from which the webpage is hosted.
  4. When I browsed about this, I found the concept of "port forwarding". So, I tried to access my router's homepage by visiting the default gateway page(i.e., 192.168.1.1) & I tried to do the port forwarding to the port-8086. Even after doing the port forwarding, I was not able to access the web page from a device, which is connected to another network. I tried using the following URLs: "103.66.79.147:8086/JK/JK.html" where, 103.66.79.147 - Public IP, obtained from whatismyip.com "100.71.18.106:8086/JK/JK.html" where, 100.71.18.106 - WAN IP address, obtained from Router's home page

Note: The WAN IP address(which is present in the router's home page) and public IP (obtained from whatismyip.com) are different. From this, it is simply evident that there is another router, which is present between my router and Internet.

As per my understanding, 'port forwarding' simply means that the router will forward the requests that it receives to a particular port(say, 8086) to a local computer in the network [say, 192.168.1.105(local IP) ; 8086(local port)].

If I'm correct, the connection is not complete, because the public IP and WAN IP address present in router's home page are different.

What could be the solution?

I'm just a beginner, who is curious in learning new stuffs.

Any help would be greatly appreciated.

Thanks in advance.




Python | How fill website form and submit clicking a button

I am new into coding in Python and I can't find a good resource for the project I have in mind:

What the program should do, is select a reply from a drop down menu, fill a blank form with a phrase I have in a .txt file (there are multiple line, so choose randomly from them) and submit it (there is a button to click). Everything in a web page.

I don't know which module to work with; I thought it could be done with urllib2, but I don't know.

Can you suggest me where to look at, please?

Thanks!




C++ Webserver does not answer after non-receiving requests

I wrote a small Webserver in C++. The Sockets are Non-Blocking and Keep-Alive is set to true as you can see here:

`/* Set socket to non-blocking */
unsigned long s_mode = 0;
ioctlsocket(server_socket, FIONBIO, &s_mode);
int optval = 1;
setsockopt(server_socket, SOL_SOCKET, SO_KEEPALIVE, reinterpret_cast<char*>(&optval), sizeof(int));
int optvalt = 1;
setsockopt(Client::client_machine_socket, SOL_SOCKET, SO_KEEPALIVE, reinterpret_cast<char*>(&optvalt), sizeof(int));`

I use select() while waiting for requests. After a while of inactivity the server stops answering my requests and i don't know what i did wrong... I hope you can help me!




Why do we need cross platform for web

I am a web developer. I am thinking about why we need cross platform for web development?

For me, cross platform for computer applications, games is clearly necessary cause we can run the applications, games on multiple computing platforms (Windows, Mac OS, Linux,...). But I have no idea why we need cross platform for web. We can just deploy our website in IIS and it will be accessible on all operating systems with a browser :)




Third level domain name for internal VM

Is it possible to use a third level domain name for an internal server?

I am working on a web project with an external prod server (a VPS hosted on Linode running Ubuntu) which uses it own domain (eg accessible as www.mydomain.com and mydomain.com).

And I have setup an internal VM running Ubuntu as my test server (on my home network). This has the same setup as prod except the domain and machine names. They are running Nginx as the web server (actually setup as a reverse proxy).

I would like to setup the internal VM so the web app can be accessed via test.mydomain.com - just not sure if it's possible (as the second level domain name is externally defined)... and if so, how? Ie do I need to spin up a DNS server or can I use a hosts file and do I need to do any config on Nginx etc?

Thanks




Having a website with many images

I am trying to build a forum like website that is going to relay mostly on people posting images. I don't have any experience in web development, I'm just starting, and I would like to know if there is a way of handling all those images using outside servers like google drive because it is too much for my server, i use shared hosting. Thanks.




Spring Web Application - The requested resource is not available

I would like to ask you for an advice what could be wrong with my easy tutorial example of spring web applications.

I am trying to reach website on this URL:

http://localhost:8084/SpringTutorial/hello

As a response to this URL I get HTTP 404 - Resource not available - from apache tomcat server.

Here is the code:

web.xml

<?xml version="1.0" encoding="UTF-8"?>
    <web-app version="3.1" xmlns="http://ift.tt/19L2NlC" xmlns:xsi="http://ift.tt/ra1lAU" xsi:schemaLocation="http://ift.tt/19L2NlC http://ift.tt/1drxgYl">
        <display-name>SpringTutorial</display-name>
        <servlet>
            <servlet-name>spring-dispatcher</servlet-name>
            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            <init-param>
                <param-name>contextConfigLocation</param-name>
                <param-value>/WEB-INF/spring-dispatcher-servlet.xml</param-value>
            </init-param>

            <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet-mapping>
            <servlet-name>spring-dispatcher</servlet-name>
            <url-pattern>/</url-pattern>
        </servlet-mapping>
    </web-app>

spring-dispatcher-servlet.xml

<?xml version='1.0' encoding='UTF-8' ?>
<!-- was: <?xml version="1.0" encoding="UTF-8"?> -->
<beans xmlns = "http://ift.tt/GArMu6"
   xmlns:context = "http://ift.tt/GArMu7"
   xmlns:xsi = "http://ift.tt/ra1lAU"
   xsi:schemaLocation = "http://ift.tt/GArMu6     
   http://ift.tt/QEDs1e
   http://ift.tt/GArMu7 
   http://ift.tt/QEDs1k">

    <!-- Scanning for anotation base classes (controllers) -->
    <context:component-scan base-package="com.controllers" /> 
    <!-- Using anotation based classes (controllers) -->
    <mvc:annotation-driven/>

    <bean id="viewResolver"
          class="org.springframeúwork.web.servlet.view.InternalResourceViewResolver"
          p:prefix="/WEB-INF/jsp/"
          p:suffix=".jsp" />

</beans>

HelloController.java

package com.controllers;

import java.util.Map;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.portlet.ModelAndView;

@Controller
public class HelloController {

    @RequestMapping(value="/hello", method = RequestMethod.POST)
    public ModelAndView sayHello(){
        ModelAndView hello = new ModelAndView("HelloPage");
        hello.addObject("message", "Welcome at first Spring web application");
        return hello;
    }        
}

HelloPage.jsp
Displaying message attribute.

Here is the image of project folder hierarchy




How can I call a python's local function from an HTML doc?

I have written a python file with several functions. Now I'm writting a web page where I want to call a function of the file that I mentioned before, by pressing a button but I don't know how.

Can someone help me, or telling me where can I look for some example where python and html are connected.




cannot test non-standard drop down lists

dear all:

I am testing dropdown lists in webpage. I encountered the following page that does not use the standard "dropdown" class.

http://ift.tt/2rL8yAD

The programmers seem to use a class called btnGa or something alike. I cannot google that.
I have no clue how a browser would know the dropdown tags.
The html source is too big. So I only copied a small part in the following.
The html source contains a ul of navlist class. Then an li tag in this ul contains another ul which is actually a dropdown list at hovering.
But I really cannot see how the browser would know that this is a dropdown list. Thus I don't know how to write a test case to click the buttons in this dropdown list.

Can any one help me out in recognizing the dropdown lists and click the dropdown list items ?

Thanks

Farn

                <ul class="navList">
                    <li class="mobileDisable">
                        <a data-ga-label="小說" data-ga-action="click" data-ga-category="header" onclick="app.navLiClick(this)" class="hasSub btnGa open" href="http://ift.tt/2qrDH8i">
                            <span class="text novel">小說</span>
                        </a>
                        <ul>
                            <li>
                                <a data-ga-label="小說-仙俠" data-ga-action="click" data-ga-category="header" class="btnGa" href="http://ift.tt/2rKysoi">
                                        <span class="text">仙俠</span>
                                        <span class="num">/ 16</span>
                                    </a>
                                </li>
                                                            <li>
                                    <a data-ga-label="小說-玄幻" data-ga-action="click" data-ga-category="header" class="btnGa" href="http://ift.tt/2qrBLwQ">
                                        <span class="text">玄幻</span>
                                        <span class="num">/ 24</span>
                                    </a>
                                </li>
                                                            <li>
                                    <a data-ga-label="小說-奇幻" data-ga-action="click" data-ga-category="header" class="btnGa" href="http://ift.tt/2rL2uYQ">
                                        <span class="text">奇幻</span>
                                        <span class="num">/ 56</span>
                                    </a>
                                </li>
                                                            <li>
                                    <a data-ga-label="小說-武俠" data-ga-action="click" data-ga-category="header" class="btnGa" href="http://ift.tt/2qrDgem">
                                        <span class="text">武俠</span>
                                        <span class="num">/ 11</span>
                                    </a>
                                </li>
                                                            <li>
                                    <a data-ga-label="小說-科幻" data-ga-action="click" data-ga-category="header" class="btnGa" href="http://ift.tt/2rLbT2R">
                                        <span class="text">科幻</span>
                                        <span class="num">/ 17</span>
                                    </a>
                                </li>
                                                            <li>
                                    <a data-ga-label="小說-恐怖" data-ga-action="click" data-ga-category="header" class="btnGa" href="http://ift.tt/2qrDIcm">
                                        <span class="text">恐怖</span>
                                        <span class="num">/ 11</span>
                                    </a>
                                </li>
                                                            <li>
                                    <a data-ga-label="小說-校園" data-ga-action="click" data-ga-category="header" class="btnGa" href="http://ift.tt/2rKqJqs">
                                        <span class="text">校園</span>
                                        <span class="num">/ 16</span>
                                    </a>
                                </li>
                                                            <li>
                                    <a data-ga-label="小說-愛情" data-ga-action="click" data-ga-category="header" class="btnGa" href="http://ift.tt/2qrIPt8">
                                        <span class="text">愛情</span>
                                        <span class="num">/ 78</span>
                                    </a>
                                </li>
                                                            <li>
                                    <a data-ga-label="小說-寫實" data-ga-action="click" data-ga-category="header" class="btnGa" href="http://ift.tt/2rKXV0L">
                                        <span class="text">寫實</span>
                                        <span class="num">/ 48</span>
                                    </a>
                                </li>
                                                            <li>
                                    <a data-ga-label="小說-歷史" data-ga-action="click" data-ga-category="header" class="btnGa" href="http://ift.tt/2qrjTSO">
                                        <span class="text">歷史</span>
                                        <span class="num">/ 13</span>
                                    </a>
                                </li>
                                                            <li>
                                    <a data-ga-label="小說-驚悚" data-ga-action="click" data-ga-category="header" class="btnGa" href="http://ift.tt/2rKOoa0">
                                        <span class="text">驚悚</span>
                                        <span class="num">/ 24</span>
                                    </a>
                                </li>
                                                            <li>
                                    <a data-ga-label="小說-其它" data-ga-action="click" data-ga-category="header" class="btnGa" href="http://ift.tt/2qrDKku">
                                        <span class="text">其它</span>
                                        <span class="num">/ 40</span>
                                    </a>
                                </li>
                                                    </ul>
                    </li>