samedi 30 avril 2016

Web Design Technologies

We have a requirement to Develop/Design a basic website that will have pages like home, aboutus, contact, , login/signup etc in the initial phase

Which methodology among the listed below ones, do you think as the best approach if the site is going to emerge into a full fledged web application with many higher functions in the later phases

  1. CMS approach and use required plugins as and when required like wordpress
  2. Traditional HTML/CSS along with any server side technologies like php, nodejs

Please provide the pros/cons of each approach if possible




Hiding the port when connecting to a website through dns

I have a website hosted at an IP address in Jboss EAP 6 on port 8080. I bought a domain name and mapped it to that certain address. When someone connects to the domain name, they are redirected to mydomainame:8080/home. How can I make it work without showing the port to the user?




Is Wiring Together Free Tiers Possible?

Several hosting platforms exist that offer a free tier and a back end features. Examples include Google App Engine, Heroku, and AWS.

Are there any technical reasons why one could not have one platform act as a load balancer and host while also directing "over-flow" traffic to other platforms, thus creating a larger free tier?




How can i create custom data control in ASP.NET?

I'm new in web development and i want to know how to build websites in real. I wonder how can i do like this website https://www.italki.com enter image description here

It retrieves data like in the picture.... What control that can be like?

I'm sorry for my English

Thanks for everyone can help me




Searching a mentor

I'm from Africa, I'm computer science engineer I develop for my business few application that are useful. Now I'm Business developper ( subject outsite IT/Web Dev) . how i can move to Web dev ? can I find mentor?

Thank you for your help Malix




Use of internet data in my app

How can I use data from internet in my app? like an online dictionary for example. I have tried the webview, but i don't like it, I would like to put the information automatically from the web

Sorry, I'm new on this




How to get picture extension when it's from my database

Hello everyone My project is to make a website where people can sign up and log in and then they are able to lend their car or borrow one from another user. I made a function to upload picture to the database and also one to show pictures from the database but it only work for the jpeg extension and I would like to not make ~15487521 conditions to make it work for any extension( more like ~5 but all these conditions dont make the code really clean...) So I would like to know if you guys could help me to find a solution to retrieve the extension of a picture from a database.

I'm using '<img src="data:image/jpg;base64,'.base64_encode($ticket['image']).'" />'; And my idea is to replace "jpg" by a string variable... I think I should use pathinfo(X,PATHINFO_EXTENSION) but I dont know what to put in "X"

Thank you

EDIT

Ok so I just figured out that I can change the extension in "data:image/jpg" for gif, png, etc. as I wish and it still works.( I really do not understand why ) So I think that my problem does not really exist. Lol. Thank you guys for your help and I hope that this post will help other people ! :)




Java script function error

I want the close and function to modify the variable gate, by making the padding bigger until it equals the variable open. I don't know why it won't work, please help.

function wait() {
    setTimeout(100);
}

function close() {
    var closed = 1;
    var opened = 19;
    var gate = opened;

    while (gate !== closed) {
        gate-=1;
        gate.style.paddingTop = open'%';
        wait();
    }
}




Auto-setuping server for player in CS:GO like ESEA or Faceit through WWW

i need to do this. Any ideas how? I was thinking about node.js and generating .json files. Now i think about SourceMod. What about you?




How can I pop up a window containing a star rating system, so a user can input his rating

I am building a project and I want to implement this:

  1. a user clicks on a button
  2. a pop up window appears showing star rating
  3. the user enters his rating in the pop up
  4. then I get the inputted value

anyone knows how can I implement this?thank you




Public IP showing Directive in public html

When ever i enter my Public IP, I go to one of Directories in var/www/html.

I have messed up the /etc/httpd/ files.




How to pip install lpthw.web

I want to pip install lpthw.web as in exercise 50 of 'learn python the hard way' but am receiving an error of insecure platform warning.How do i go about that?enter image description here




Autofaq Type access exception

So i'm trying to set up autofaq with mvc5 and webapi 2 but i keep getting this error on runtime:

http://ift.tt/1rporJi

I have no clue where to start looking for a potential fix

Thanks in advance !




Image preview for web sharing in Line chat

I make a website and I try to share it via Line chat. It seems that Line chat has a feature to display web preview like Facebook does. My question is, how to control which image and description that will be shown in Line chat? I know for Facebook but I never know in Line. I have tried googling around but I don't know the keyword for it. The google result is not what I expected.

Thank you for your help.




How to find source of a joomla page

Suppose I have a website , http://ift.tt/1TwoM8N . This site is made in joomla . Now if I navigate to another page it only show the arguments with name and I am unable to find the source who created this view.

My question is how can I find the source of a specific item and edit its style ?




How to upload a spring web app running on Tomcat into cPanel?

I made a java Spring web application running on a Tomcat server and I want to deploy it on cPanel in order to have an official website. How can I do that ? I tried to upload the .war extension of my app in public_html folder, but when I access the website the structure of the folders is shown. How to solve this problem , what are the steps should I take in order to upload my app into cPanel ?




Content-Security-Policy 'image-src *'

I set the Content-Security-Policy for the application with a wild-card for image-src

But, while uploading an image from browser, I see this error below:

Refused to load the image 'blob:http%3A//localhost.paypal.com%3A8000/6f5b1ad8-69fc-4e84-a58c-1a95cbba4900' because it violates the following Content Security Policy directive: "img-src *".

However, other images from the same domain are loading fine. Only problem is when you try to upload one!




vendredi 29 avril 2016

C# Read Webpage After Redirect

I am writing a script to read data from steam webpages to find out about sales on games.

It is pretty simple. I am using C# using

        WebClient web = new WebClient();


        String html = web.DownloadString("https:/http://store.steampowered.com/app/#####");

Unfortunately, some pages have an age verification before you can continue, such as this page.

Is there any way to have my code set the date to an older year, then proceed to get the following page?
Would it be easier for me to go through the age verification on my own once first, and somehow pass my cookies through the code?

Is this easier in another language? My code isn't that complex, so I'd be willing to move it to something else. I'd prefer to work in C#, Java, or Python.




How does one horizontally distribute a website

How can one horizontally spread the hits to a certain web app across multiple servers? It seems that domain names can only route to one IP address and as a result one server.

So is the only way to achieve horizontal distribution is by making that server a proxy? If not what are the different ways to horizontally distribute your app?




I unable to open my website in my system, its working fine in other system

All,

I unable to open a website in my system (yprinfotek.in), earlier its working fine, when I tried it (www.yprinfotek.in), it's not directing to site, it will same as in current page, I tried it multiple time, now I am unable to see even yprinfotek.in, I check the hosting/domain service centers they said nothing wrong from my side and it's not the problem with my code I have developed this site using HTML/CSS/js only without using any server coding. kindly share your answer/suggestion to fix this issue.

Thanks and Advance.




How to make computer guess a number and return number of guesses (Javascript)?

I'm currently working on a mini-project that I find interesting.

The basic idea is to have the user enter a number between 1 - 5, and have the computer guess that number, showing the number of guesses it took to guess it. Here is my code so far ...

<html>

<head>

    <title>Computer Guessing Game</title>


</head>


    <body>

        <p>How many fingers are you holding up?</p>

        <input type = "text" id= "myNumber">

        <button id="guess">Guess!</button>

        <script type="text/javascript">

            document.getElementById("guess").onclick = function() {

            var myNumber = document.getElementById("myNumber").value;

            var gotIt = false; 

            while (gotIt == false) { 

                var guess = Math.random();

                guess = guess * 6;

                guess = Math.floor(guess);

                if (guess == myNumber) {

                    gotIt = true; 

                    alert ("Got it! It was a " + guess + ". It took me " + /*number of guesses */ + " guesses.");

                } else {

                    //computer should keep randomly guessing until it guessed correctly
                }
            }   
        }

        </script>

    </body>

As you can see, I can not figure out how to make the computer keep guessing the numbers and then print out to the user the number of guesses it took. I think that it's some sort of loop, but then again, I'm not sure.

Any help is appreciated (excuse me if I'm not writing the question clearly enough, I'm quite new to SO and will get better with time!).




Java Files.exists() returns false even if the file exists

I'm doing a web server and it has to read a txt config file and to assign a port number, directory, the default index.html file, etc, but when it checks for the index.html it keeps saying it doesn't exist even though the file does exist.

The txt file contains this:

port=80
directory=c:\www
index=index.html
listing=true
connexions=5

I checked the files permissions and it doesn't seem to be blocked. Here is the code for when it reads the file: http://ift.tt/24quZFR

I tried both .exists() and getAbsoluteFile().Exists()and both return false




Java Web Maven Project on tomcat 8 root path. How?

I have tried to put my application on the root path of the tomcat, I mean..

This is what I have now: http://ift.tt/1N8mPxx

But I need to get this-> http://ift.tt/tv1JJF

I already tried a lot of things I found on the web, but nothing worked.

I found many ways to do this, but nothing works.

What should I do on tomcat 8 ? Should I do something on the project ? any setting on the pom.xml or web.xml ?

Tks guys!!




How to programmatically define

I need to define the below section from web.xml

<security-constraint>
  <web-resource-collection>
    <web-resource-name>restrict-all</web-resource-name>
    <url-pattern>/*</url-pattern>
  </web-resource-collection>
  <auth-constraint>
    <role-name>client-validated</role-name>
  </auth-constraint>
  <user-data-constraint>
    <transport-guarantee>CONFIDENTIAL</transport-guarantee>
  </user-data-constraint>
</security-constraint>
<login-config>
  <auth-method>CLIENT-CERT</auth-method>
</login-config>

How can I do this?

I found some part of this. But can't figure out the rest.

public void enableSecuritySSL(ServletRegistration.Dynamic servlet) {
        HttpConstraintElement forceHttpsConstraint = new HttpConstraintElement(
                ServletSecurity.TransportGuarantee.CONFIDENTIAL, new String[0]);
        ServletSecurityElement securityElement = new ServletSecurityElement(forceHttpsConstraint);
        servlet.setServletSecurity(securityElement);
    }
}




Crawling Wikipedia using phpCrawl

I'm trying to use the open source crawler PHPCrawl to crawl wikipedia pages, but unfortunalty it doesn't work. The example.php file works fine for any other site except for wikipedia. Wikipedia has the structer http://ift.tt/24q46S9 term] to get a result where [search term] a page that I'm intersted to crawl. Thanks in advance.




How to count the number of correct answers using Javascript?

I'm trying to create a simple website about counting the number of fingers I'm putting up (random number). However, I want to add something extra to the website. I'm trying to create a counter on the side of the container that counts the number of correct answers, and drops down to zero whenever the user get a question incorrectly. Here is my code for the site...

    <!doctype html>
<html>
    <head>  
        <title>Changing Website Content</title>

        <link href='http://ift.tt/OIiP2w' rel='stylesheet' type='text/css'>


        <style type="text/css">

            body {

            background-image: url(nyc.jpg);
            width:100%;
            font-family: 'Open Sans', sans-serif;


            }

            #main {

                margin: 100px;
                background-color: #ede1e1;
                padding: 50px;
                position: relative;
                top: 50px;

            }



        </style>



    </head>

    <body>




        <div id="main">

            <p>How many fingers am I holding up? Pick a number 1 - 5.</p>


            <input id="fingers" type="text">


            <button type="submit" id="fingerChecker">Guess?</button>



        </div>









        <script type="text/javascript">


           document.getElementById("fingerChecker").onclick = function() {

                var fingers = document.getElementById("fingers").value;

                var random1 = (Math.floor((Math.random() * 5) + 1))

                if (fingers == (random1)) {

                    alert("Yes, you are correct!")

                } else {

                    alert("Nope! I had " + random1);
                }

           }


        </script>


    </body>
</html>

Any help is welcomed. (This is my fist post so excuse any mistakes I may have made!)




Canvas API and Web worker

I know that canvas tags or any other tag can be created inside of a web worker, but the web worker can make ajax calls. Would it be more efficient when drawing images to create a web worker, have it do an ajax call to another file, that then generates a canvas and returns the data from "getImageData"?




SYNCING data from local system To SERVER with images

there is a syncing app[IOS] which collects data like customer name, mob etc of the customer and store it on the local system with the help of the Web services and then it sends all the data to the server, Now the challange is that app also save images now, that image i can store it on local system but how i will send it to the server, i am not using database to store the images on local system it get stored in DIR, but is it possible to send it on a server by the same time when rest of the data get sync?




Creating a web server for communication with Android apps

I want to create a web server at home and upgrade it to communicate with my Android app. Eventually I would like to store SQL data on it and collect data from it in my Android app. I have no idea where to start, and I am worried that I might start with one tutorial which will eventually not be able to give me the end result I want.(I am looking for tutorials at the moment since I have no knowledge on server side coding or anything similar)

So I was wondering if XAMPP is the thing I am looking for? I found many tutorials on that but I can't find anywhere if it is possible to eventually store my SQL data and communicate with android app. Also I read that XAMPP is for testing purposes and I would like to start learning something I might actually use as a web server later on for commercial apps.

If not, what else can I use? Many websites suggest JSON server communication but I am still not sure if that is the thing I am looking for.




What is the formula for calculating an average rating from ratings originated from different sources?

I want to build a website, where I will show ratings for movies. I want to show there an average rating for a movie and I want to calculate that average from ratings from different sources. The issue is that on some of the desired sources a few people have rated a movie and in other sources thousands of them. E.g. The movie "The Revenant". It has an average rating of 7.9 in IMDB (10000 users have voted) and it also has a 9.9 in "XYZ" website (10 users have voted). How would look like a formula in order to calculate that average?

Initially I thought of just simply assigning weights based on the number of users, but I have the feeling I am missing something. Any ideas?




How to download html content in separate files using Java

How can I download all content of all links (a href) from an HTML root in separate txts? I know how to do this in one txt but I don't know how can I have each link with its content in a file.

Thanks!




E-Commerce Price History

What are the ways to go about for scraping data about price history of a particular product on an e-commerce site.

I see so many websites performing this practice on sites like amazon , newegg. For ex : keepa.com , camelcamelcamel.com

How do these sites go about performing this task as amazon itself does not provide a proper api for the sake.

The maximum period amazon provides at best is 90 days however a few of these websites provide price history data upto 2 years like www.pcpartpicker.com

Should we keep scraping every single product every day to create our own price history or is there some method out there ?




jeudi 28 avril 2016

Port mapping and triggering - Web server based on OS X 10.11 and HG630b modem

I want to create a web server on my macbook. I have set up apache, and I can visit my site via 192.168.1.*/~username/. When I tried to use the public ip address to visit my site, I have tried something like

*.*.*.*:80/~username/
*.*.*.*/~username/
*.*.*.*:20
// A random port I set up
// when I tried to put something in the "port triggering" that might work

But none of them works properly :p It turned out things like "The site can't be reached" or just went to the set up page of my modem. So I wonder how can I set this up and make it working. There are something I need to fill in:

  1. Trigger start/end port;
  2. Open start/end port;
  3. Trigger protocol (TCP UDP TCP/UDP);
  4. External start/end port;
  5. Internal host (I put my local ip add here)
  6. Internal port

Open start/end port; I'm using: OS X10.11, Apache 2.4.18.




copyright for personal web portfolio, is there any copyright/disclaimer generator for photo galleries?

is there any generator with legal notice to use as Copyright informatin or disclaimer? Does anybody make such generators with options to chooese whether company or private person or Country residense ? thanks.

edit: i do not ask about copyright notice at the bottom of page, but question about pages of words saying which materials are legal which not, abuses against third party apps, safety of information sent over contact form, legal notices as freelancer or servise provider.

currently i am in Germany and there is Impressum rather then just Disclamer page and it has very stric rules but no info or no samples at all.




Location spoofing in an HTTP Web Request

When trying to access tripadvisor.com, TripAdvisor redirects you to the localized version of the website. In my case, it redirects to tripadvisor.com.ph since I am in the Philippines.

In sending raw HTTP web requests using curl or some tool, how does one spoof the current location to a different location? Is it possible to do this without spoofing the IP address?




How to use a $_POST Variable in another file and function

First set of code, on separate page than second

<?php
include 'HytecFunctions.php';

if((isset($_POST["name"]))  ) {
$name = $_POST["name"];
addName($name);
}

Second and Separate Page code

function updateScore() {

mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$conn = connectDB();

// Score Update
$name = "Test1";
// $name = getName();
$sql = $conn->prepare("SELECT Score FROM Names WHERE Name=?");
$sql->bind_param('s',$name);
$sql->execute();
$sql->bind_result($score);
$sql->fetch();
$sql->close();

The user enters a name and it is entered into a database as seen in the first code snippet. Then I need to use that $name in a separate code file so that it looks more like this, and stays dynamic with the user's name.

function updateScore() {

mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$conn = connectDB();

$sql = $conn->prepare("SELECT Score FROM Names WHERE Name=?");
$sql->bind_param('s',$name);

I need the name to be entered and then used here to bind the user's name to the prepare statement.

$sql->execute();
$sql->bind_result($score);
$sql->fetch();
$sql->close();

Any ideas or help would be greatly appreciated!!




Align 2 divs in same line without using float

I am a new learner in web designing and practicing websites. I want to align 2 divs in one line without using float. I have a parent div with width 1400px. I want 2 child divs of width 600px each to align next to each other and have equal margin from both sides. Below is my code. Please suggest.

Also, what changes does float make to DOM? I observed that if I use float I need to specify the height as well? Is it the case or I was making some mistake in understanding the role of float?

<html>
  <head>
    <title>
      My Page
    </title>
  </head>
  <body>
    <div class="main">
      <div class="child1">Child 1</div>
      <div class="child2">Child 2</div>
    </div>
  </body>
</html>

.main{
  width:1400px;
  background-color:#c3c3c3;
  position: relative;
  display: inline-block;
}
.child1{
  background-color:#666;
  width: 600px;
  margin:auto;
}
.child2{
  background-color:#888;
  width : 600px;
  margin:auto;
}




Rails table data shows as a hash under the real table data in Browser

I am trying to display all of the blog posts on the index page, but whenever I go to it, it displays what I want, and then below it, it puts the rest of the data as a hash. I want the first post and first description to be in the browser but I don't want the hash under it to be in there. Screenshot of how the data from the table shows up

This is my posts_controller.rb

class PostsController < ApplicationController

  def index
    @post = Post.all
  end

  def show
    @post = Post.find(params[:id])
  end

  def new
    @post = Post.new(params[:id])
  end

  def create
    @post = Post.new(post_params)

    @post.save
    redirect_to @post
  end
end

private
def post_params
  params.require(:post).permit(:title, :description)
end

This is my index.html.erb file

<h1>Blog Posts</h1>

    <table>
      <th>Title</th>
      <th>Description</th>
      <div><%= @post.each do |post| %></div>
      <tr>
        <td><%= post.title %></td>
        <td><%= post.description %></td>
      </tr>
    </table>
    <% end %>

Any help would be greatly appreciated!




How can i change another Div element on Hover [duplicate]

This question already has an answer here:

What I want to do is make box2 go to 50% and box1 to go to 16.666% when I hover over Box2. Its working on box1 but not box2.

After the mouse is off the div I want it to go back to normal.

Any help would be greatly appreciated. Thanks!

.W25 {
        height: 500px;
        width: 25%;
        margin: 0px;
        padding: 0px;
}
.W16 {
        height: 500px;
        width: 16.666%;
        margin: 0px;
        padding: 0px;
        
}
#bigbox {
        margin: 0px;
        padding: 0px;
        height: 650px;
        width: 100%;
        position: absolute;
}
#box1 {
        background-color: #0C3;
        -webkit-transition: all .25s ease-in-out;
        -moz-transition: all .25s ease-in-out;
        -ms-transition: all .25s ease-in-out;
        -o-transition: all .25s ease-in-out;
        transition: all .25s ease-in-out;
        float: left;
}
#box2:hover {
        width:50%;
        margin: 0px;
        padding: 0px;
}
#box2:hover ~ #box1 {
        width:16.666%;
        margin: 0px;
        padding: 0px;
}
#box1:hover {
        width: 50%;
        margin: 0px;
        padding: 0px;   
}
#box1:hover ~ #box2 {
        width: 16.66666%;
        margin: 0px;
        padding: 0px;   
}

#box2 {
        background-color: #F96;
        -webkit-transition: all .25s ease-in-out;
        -moz-transition: all .25s ease-in-out;
        -ms-transition: all .25s ease-in-out;
        -o-transition: all .25s ease-in-out;
        transition: all .25s ease-in-out;
        float: left;
        height:600px;
}
<body>
<div id="bigbox">
<div class="W25" id="box1"></div>
<div class="W25" id="box2"></div>
</div>

</body>



Array ( [faultcode] => S:Client [faultstring] => Cannot find dispatch method for {}parameters ) 1

Hello so i have a web service in java to be called by a php client, trying to call the bagi method

@WebService(serviceName = "CobainServer")
public class CobainServer {

    @WebMethod(operationName = "bagi")
    public double bagi(@WebParam(name = "angka1") int angka1, @WebParam(name = "angka2") int angka2) {
        //TODO write your implementation code here:
        return (angka1*1.0)/angka2;
    }
}

And I have a client in php using nusoap

<?php
ini_set('error_reporting', E_STRICT);
require_once "nusoap.php";

$client = new nusoapclient("http://localhost:8080/PBP2016SoapServerB/CobainServer?WSDL",true);
$error  = $client->getError();

if ($error) {
    echo "<h2>Constructor error</h2><pre>" . $error . "</pre>";
}   

$result = $client->call('bagi',array('angka1'=>'50','angka2'=>'5','http://CobainServer/'));
print_r($result);

?>

it shows error "Array ( [faultcode] => S:Client [faultstring] => Cannot find dispatch method for {}parameters )"

Please help




Web API + Client Architecture

We're building:

  1. A bunch of services exposed through a web API.
  2. A mobile app and a browser app.

Is it common practice for the apps to respond to their own conduit servers that end up talking to the API services? We're going to be setting up a reverse proxy - is it enough to directly hit our APIs (instead of setting up a conduit)? This is definitely a general architecture question.




Push current user status amongst friends

So I'm implementing a friendlist to a webservice, which requires the server to push online status out to subscribers (all online friends).

The whole project is being done in jsf, and I'd rly like to do this in jsf aswell.

The question I have is whether or not it's an effective solution to do this with sockets. Having ALL account logins, associated to the webservice, push their status on the same channel, and then on ALL online clients, filter with database if the given push is a friend of said client, and at last update the friendlist as result of filter.

If not having all accounts on the same channel, how would one go about structuring the channels according to one's friendlist?




android developer required skills?

Right know I'm a junior android developer and have a good knowledge of android studio and android SDK. For more improvement I want to know what else Languages,Skills,Technologies... I have to learn for developing android ? Also what for full communication with servers or web services etc. ?




What is the best way to build a Web Based EER diagram drawing tool?

I have to create a Web Based EER diagram designing tool for one of my projects. As a main feature I have to build a free object movable,re-sizable environment with drag and drop and drawing features. These features are somewhat similar to MySQL Workbench EER diagram drawing tool.

Is there any advanced JavaScript library other than JQuery UI to done this job easily?

or

Is there any other technology to done this easily by using another programming language?




How to use C++ OpenCV Project in asp.net web application

I trying to develop a web based image processing application. currently I have developed C++ OpenCV project. Is there a way I could use this C++ project in C# web application with OpenCV libraries and deploy in azure?




Convert a python module to work on a web

I have written a python module that performs classification via neural networks: once trained, it takes an example (an array of numerical values) and returns a class (A, B.)

Now, I would like to use it to classify users on a website, according to their behavior. It seems a quite standard task, but I have no idea on how to do it practically. Should I convert this module in another language? Create an api? Where should I put it in throe website?

I have zero knowledge about web programming and how it works, so any help (or tutorial) is more than appreciated.




Render method renders pdf byte array previously written to response

I have <g:actionSubmit action="print"/> and print action writes to response pdf byte array. After doing print action I do ajax call whose response is gsp template rendered by grails render method. But I receive in response pdf byte array previously written by print action. Is there any way to receive new response, not previously written?




Plugins for ASP.Net Webapplication

i'm working on a webapplication written in C# using the ASP.NET MVC framework.

I want to allow my clients to write their own plugins for the web application. Each client get it's own database.

I got some ideas how to do this:

  1. I will provide an interface which allows the user to upload his assembly dll. This will store the dll in a specific plugins-folder for the client.
  2. I will provide some C# Interfaces and Attributes for Class and Method annotations.
  3. The business logic of the server will check each plugin and search for classes and methods with these attributes or interface implementations to override or alter it's default behavior on certain points.
  4. For performance, I'll implement some form of caching that gets invalidated every time a new plugin is uploaded.

Now my question:

How can i allow the user to write a plugin? I mean how to provide some kind of SDK for this? The user primary needs the C# interfaces and Annotations but the developer also want's to test the plugin before uploading it to the production server. Can i pack my webapplication in some kind of DLL which could be loaded by the developer for testing purposes but not read the source code? Or is there any other way of doing this?

Thank you for any info on this!




WebApi Model binding w/ 2 different objects

I need to create an end point, but this endpoint can have multiple types of input, the form itself can change based on configs, so i was trying to create at least 2 objects as possible inputs.

Something like:

public class ParticipationsController : ApiController
{

 public HttpResponseMessage Post([FromBody]Models.SimpleParticipationModel sModel, [FromBody]Models.CompleteParticipationModel cModel)
    {
        if (!ModelState.IsValid) // this might not be this way here 
        {
            return Request.CreateResponse(HttpStatusCode.BadRequest);
        }

        return Request.CreateResponse(HttpStatusCode.OK, "Ok");
    }

My point is to avoid having multiple endpoints and change a lot of renderization in the page.

My objects contain DataAnotations to obey certain rules such as "Required" and "Range 0-X".

I also didn't what to have an object with all the properties, and only fulfill some of them.

Thanks in advance




Free currency rates conversion web service

We're going to programmatically get currency rates? Base currencies to be supported are USD and EUR. Could you please recommend some services?

I know about ECB (http://ift.tt/1kPjGPp) but it supported EUR only




Access a rectangular in svg using selenium java

I want to access a rectangular in a svg using.I should specify i have several svg on the same page. Here is what i want to access:

<svg id="raphael-paper-252" height="239" version="1.1" width="399" xmlns="http://ift.tt/nvqhV5" style="overflow: hidden; -moz-user-select: none; cursor: default; position: relative; left: -0.5px; top: -0.5px; background-color: rgb(255, 255, 255);">
<desc>Scrollable Dual Y-Axis Combination Chart</desc>
<defs>
<g class="raphael-group-253-background">
<g class="raphael-group-260-canvas">
<g class="raphael-group-266-axisbottom">
<g class="raphael-group-266-axisbottom">
<g class="raphael-group-254-dataset" style="" clip-path="url('#0EF0615E-B63E-4B86-BCB3-DA1B99BCD97A')" transform="matrix(1,0,0,1,0,0)">
<g class="raphael-group-267-axistop">
<g class="raphael-group-495-scroll">
<g class="raphael-group-259-datalabels" style="" clip-path="url('#32ADDEF9-19E1-4425-A700-753A4E192433')" transform="matrix(1,0,0,1,0,0)">
<g class="fusioncharts-legend" transform="matrix(1,0,0,1,95,181)" style="">
<g class="raphael-group-255-hot" style="" clip-path="url('#FF53AB95-4DD3-4307-A757-AEC8F0979452')" transform="matrix(1,0,0,1,0,0)">
<g class="raphael-group-316-col-hot">
<rect style="cursor: pointer; stroke: rgb(192, 192, 192); stroke-opacity: 0.000001; fill-opacity: 0.000001; fill: rgb(192, 192, 192);" x="90.5" y="118.5" width="25" height="5" rx="1" ry="1" stroke="#c0c0c0" stroke-opacity="0.000001" stroke-width="1" fill-opacity="0.000001" fill="#c0c0c0"/>

For a smaller path i used this

    WebElement svgElement = OpenBrowser.driver.findElement(By.cssSelector("svg"));  

                 // Get the Buttons with which we want to interact in a list  
                 List<WebElement> gElements = svgElement.findElements(By.cssSelector("g"));  


                 WebElement button = gElements.get(7);
                 Actions actionBuilder = new Actions(OpenBrowser.driver);
                 actionBuilder.click(button).build().perform();  

and it worked but when i try this

WebElement svgElement = svg.findElement(By.cssSelector("svg"));  

 // Get the Buttons with which we want to interact in a list  
 List<WebElement> gElements = svgElement.findElements(By.cssSelector("g"));  

 System.out.println(gElements.size());


List<WebElement> button1 =  gElements.get(9).findElements(By.cssSelector("g"));
System.out.println(button1.size());
List<WebElement> button2 = button1.get(1).findElements(By.cssSelector("rect"));
WebElement button = button2.get(4);

 Actions actionBuilder = new Actions(OpenBrowser.driver);
 actionBuilder.click(button).build().perform();  

for the path above it throws me index out of bounds. I think it takes the first svg not the one i want.i tried accessing the element the svg is in first but it dosent find it :

WebElement svg = OpenBrowser.driver.findElement(By.cssSelector("#box_w3 > div > div.widget-body > div > div"));

I also tried using xpath and absolute still nothing. Any help is appreciated. Thanks in advance :)




Socket.IO Qt implementation

I want to have QT working with Socket.io. Firstly, I want to know if it's possible to work with socket.io without a node.js server and do the server with Qt.

I need to pass data from my Qt application to a web page. So, socket.io looks good. The problem is with the C++ implementation (http://ift.tt/1PEVTmN) which use Boost librairie and I have some problems to add it to my project.

So I see the poco project (http://ift.tt/1rBuyuw) that don't use Boost librairie, and so, seems to be great and easier to add. But i have some problems to compile the lib with CMake and Visual Studio 2015. The CMake generation looks like to work great, I have a solution generated with multiples project.

As said :

Under Windows, you will need to open the main Poco solution, build the ALL project, and then build the INSTALL project.

I build the "ALL_BUILD" first. I have some error with Poco librairie... And then the same thing of boost libairie.

So anyone hasn't an implementation using just QWebSocket that works with Socket.IO ? Or any solution else...




Jsoup link selection

I am trying to get all the links inside the div class news column index here is the structure of the html:

enter image description here

And here what I have tried but actually it doesnt give me any result, I dont really know why :///

 Document doc = Jsoup.connect("http://ift.tt/pcJv1r").get();
            Elements els = doc.select("#body > div > div.news-column-index > ul");
            for(Element e : els)
            {
                System.out.println(e.attr("href"));
            }




Should I attach all js files from Foundation framework in gulp scripts function, and why I do this?

I'm a beginner for web development. Recently I have tried some tutorials for learning skills for it. by following the tutorial, I copied the basic code for ALERT from foundation docs and activated the foundation framework, so I could cancel the ALERT message on webpage. But the tutorial also set the path of ALERT of the foundation framework into gulp scripts function as you see from the picture I attached below. './bower_components/foundation/js/foundation/foudantion.alert.js' Why should we do this, I mean the ALERT Message still could be canceled without the alert.js file being concatenated here. what if I use all foundation components for the web development, should I set all paths in gulp scripts function i this case?

many thanks! love u guys!

code




Adding bullet points to multiple textareas with same Javascript

I found the below code online to add bullet points to a textarea, and it works quite well for a single textarea.

Script

var CRLF = 10;
var BULLET = String.fromCharCode(45);

function Init() {
    if (txt.addEventListener) txt.addEventListener("input", OnInput, false);
}

function OnInput(event) {
    char = event.target.value.substr(-1).charCodeAt(0);
    nowLen = txt.value.length;

    if (nowLen > prevLen.value) {
        if (char == CRLF) txt.value = txt.value + BULLET + " ";
        if (nowLen == 1) txt.value = BULLET + " " + txt.value;
    }
    prevLen.value = nowLen;
}

HTML

<body onload="Init ();">
    <h4>Automatic bullets in a text box</h4>
    <textarea id="txt" oninput="OnInput(this, 'prevLen');" rows="15" cols="40"></textarea>
    <input type="hidden" id="prevLen" value="0"/>
</body>

However, I can't figure out how to create a similar function such that I can use it on multiple textareas.

I would like something where I can pass through the id of the hidden input, so I can specify that way which input to add the bullet points to, but can't get a working solution.

Suggestions/solutions welcome.




mercredi 27 avril 2016

How are assets/public directories accessed in web servers?

Whenever you reference something in your public or assets directory via link/script tags, are you only downloading what you reference?

For example, say I have an enormous amount of images in my public directory. Only images that are referenced on that particular page are downloaded, right?

Taking this further, say your stylesheet references a lot of images, and it serves every single page on the your website. So are all of those images downloaded?

You see, I'm probably lacking some fundamental background on this as I'm pretty new to web dev, and I don't have much experience with nginx/apache or the like. Please explain!




Clickable website URL

I know writing print "website url" does not give me a clickable url so is it possible to get a clickable URL in python which would take you directly to that website?? And if so how would it be done?




What technologies should I Iearn for coding websites? [on hold]

I'm currently 13 years old and I am want to be a developer, coding things when I am older. I want to make a social media platform (like Facebook, Twitter, Instagram, and YouTube, all-in-one), and I don't know what language I should use.

I am heading into highschool next year and I am taking Business Tech, and I want to learn the basics of a programming language by then (in around six months).

Back to the website, I think I should learn JavaScript or HTML or CSS, right? But those are all client-side. I am confused relating to all of this though. Shouldn't I learn another language for server-side?




Fatal error: Call to a member function bind_param() on a non-object (have searched for answer on here for hours)

Before I ask my question I wanted to say I have looked at many other solutions and have tried tons of different ones but none work for me. I understand that to call the bind_param() the $sql variable cannot return false, and that's why I am getting the error. I have triple checked the table name, and column names but I will include a picture to help. I honestly have tried everything and googled for a good hour or two, any help would be greatly appreciated. And yes the database connection works, its been tested with 3 other functions. I will close this question as soon as it is answered because I know there are tons of these.

My database

function updateScore() {
$conn = connectDB();

// Score Update
$name = "happy";
// $name = getName();
$sql = $conn->prepare("SELECT Score FROM Names WHERE Name=?");
$sql->bind_param("s",$name);
$sql->execute();
$sql->bind_result($score);
$sql->fetch();

echo "This actually works";
echo "Score Before" .$score;
$score++;
echo "Score After" .$score;

Up to here works like a charm and prints out the updated score to the page, below is problem

$sql = $conn->prepare("UPDATE Names SET Score=? WHERE Name=?");
$sql->bind_param("is",$score, $name);
$sql->execute();
$sql->fetch();

$sql->close();
$conn->close();
} 




New to Web design

So i was thinking to myself about how profitable betting sites are and what a viable market video game items are and i was wondering the best routes to go about learning more than basic web design and how i would even begin to go into all of the account linking and complicated market and database building i would learn to do. I know enough python and java to get by and am in the process of learning Mysql and everything Linux. Any information would be appreciated greatly. Thank you.




WEBrick wont create a new web server on a fresh Application (Windows)

This is what happens when I try and start a new web server with WEBrick.

  • I've been playing around with Ruby on Rails for a few days now but have been having a lot of trouble installing it on Windows. Now that I am here I'm not sure what is going wrong

    C:\Websites\Project_one>rails s C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/railtie/configur ation.rb:95:in method_missing': undefined methodactive_record' for # (NoMethodError) from C:/Websites/Project_one/config/application.rb:24:in <class:Applica tion>' from C:/Websites/Project_one/config/application.rb:10:in' from C:/Websites/Project_one/config/application.rb:9:in `

    ' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/com mands/commands_tasks.rb:78:in require' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/com mands/commands_tasks.rb:78:inblock in server' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/com mands/commands_tasks.rb:75:in tap' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/com mands/commands_tasks.rb:75:inserver' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/com mands/commands_tasks.rb:39:in run_command!' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/com mands.rb:17:in' from bin/rails:4:in require' from bin/rails:4:in'




Simple Javascript file not working properly

I am trying to make a small game using HTML, CSS and Javascript.

The HTML and CSS and most of the Javascript code appear to be working fine. However, when launch the program in FireFox and try to click a square div whose background RGB value matches that of a RGB value stored in a variable I get the wrong answer. It is suppose to alert the user with "Correct" but instead all the alerts are outputting "Wrong".

Here is the HTML file

    <!DOCTYPE>  
 <html>
<head>
    <title>Color Game</title>
    <link rel="stylesheet" type="text/css" href="colorGame3.css">
</head>
    <body>

        <h1>
        RGB Color Game
        <span id = "colorDisplay">
        RGB
        </span>
        </h1>

        <div id="container">
            <div class="square"></div>
            <div class="square"></div>
            <div class="square"></div>
            <div class="square"></div>
            <div class="square"></div>
            <div class="square"></div>
        </div>

        <script type="text/javascript" src="colorGame3.js"></script>

    </body>
</html>

Here is the CSS file

    body{
    background-color: #232323;
    }

.square{
width:30%;
background:purple;
padding-bottom:30%;
float:left;
margin:1.66%;

 }

#container{

max-width:600px;
margin:20px auto;
}

Here is the JavaScript file

    var colors = [
    "rgb(255,0,0)",
    "rgb(255,255,0)",
    "rgb(0,255,0)",
    "rgb(0,255,255)",
    "rgb(0,0,255)",
    "rgb(255,0,255)"
    ]

    var squares = document.querySelectorAll(".square");

     var pickedColor = colors[2];

    var colorDisplay = document.getElementById("colorDisplay");

      colorDisplay.textContent =  pickedColor;

      for(var i = 0; i<squares.length;i++){

squares[i].style.background = colors[i];

squares[i].addEventListener("click",function(){

var clickedColor = this.style.background;

    if(clickedColor === pickedColor){

        alert("Correct");

    }
    else{

        alert("Wrong");
    }
});
}




How can I do if a user click a button then he can have bookmark of website in mobile home screen? Using Rails and Bootstrap

I have a strategy:

  1. If a user come to welcome page using his smartphone, he can click a button like Get Bookmark to my phone! then he can view the bookmark icon of my website on his smartphone home screen.

  2. And then the user can just click the bookmark from his mobile home screen.

Is it possible? I am using Rails 4 and Bootstrap.

I want to the Get Bookmark to my phone! appear only user using small devices.




How to copy *.json files from the scripts folder to www folder in a cordova project?

I am using Typescript in a cordova project. I have my tsconfig.json set up to compile my *.ts files and create the *.js files in the www folder. Now I want to load a local json file using $.getJSON() function and I am getting a FILE_NOT_FOUND error because my local json file from the scripts folder does not get transferred to the www directory. How do I solve this issue? Thanks!




Spring MVC global blocking queue

I have a web application and I encountered a problem while developing it. I am new to Spring MVC, this is my first application.

In my app, there is a problem regarding more users who are trying to modify the same database table row in the same time. I don't want to use Hibernate (pessimistic approach) to lock the table row.

I want to make a blocking queue on the web Server.The blocking queue should be shared between multiple user's connection. For example, in the @RequestMapping scope for a specific url request i want to have this queue.

Another problem would be the fact that there are multiple table rows and there should be multiple blocking queues (one for each shared data). I am wrong with something, and i am not able to find a proper method to control the users' access. I want the users who made the request (for the same data) to be put in a blocking queue in order. The queue should execute in order their updates on the data so that there won't be any consistency problems with the database.

Thank you!




Get path of a selected directory with javascript

I have a web page application I am writing that just needs to get the name of a directory and not send a directory on the webpage for the application, but by using a file browser and not having a user entering the text.

The input type of file only allows you to navigate to an individual file and not select a directory. I am using HTML5 as of note with javascript as the backend.

Is there any other type of input that would allow me to select a directory and only get that directories name and path and not only be able to select a file?




Tell me what's the best sites about web and programming. [on hold]

Please name me the best sites about IT news and about different tutorials.




Hosting Wt website

I have constructed a simple Wt website. I was curious as to how I could host it on the internet. Most of the hosting packages I find on the internet focus more on hosting php websites. Any help would be appreciated.




Java Web Project with Bootrstrap

I'm enrolled in a web project with Java, and I'm looking for a framework that allows me to use Java as backend and HTML with bootstrap as front.

What options do I have?




Parsing html [RSelenium] [on hold]

I want to scrape this website:address search. For example,"基隆市 義一路1號".




Login if new account username/password already exists

I have a request to change our new account creation to just log a customer into an existing account if the specified username/password already exists. I have already made the argument that this isn't standard behavior, but unless there's some sort of security flaw, they want to move forward with this feature.

I can't think of any security risks, but I'm certainly not a security expert. Does anyone know of a good reason not to implement this feature?

Edit: The customer who was attempting to register a new account would just be logged into an account silently instead of giving them an error message that they can't use that username.




VerifyCsrfToken.php line 67 in laravel [duplicate]

" TokenMismatchException in VerifyCsrfToken.php line 67: "

when submit value it give me that error ... when close composer artisan serve it work perfectly ?

what the reason behind that ?




Show Web App DLL Version Number in an AngularJS App

I have an AngularJS (v1) app and I'm trying to get the version of my web app's DLL in order to display it. How do I get that? The DLL is in the bin folder when the site is deployed to IIS.

The examples I've seen so far use something like this:

string version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

But since I'm using AngularJS and plain-old HTML pages, I don't have a code-behind to use. How can I get the version number to display on the client?




How can I create a simple web browser using the qt5.6?

The easiest way I found is to use a QWebView. But the first problem is that I can't find it at my Widget Box. I decided that I can create it in code, but it does not know webkit module and QWebView header.

After that I found QWebEngine and it is created instead of QWebView. And it seems it works. But I decided to build it using MinGW and I've got nearly the same result as with QWebView. I downloaded the source code and tried to compile it and it pointed me to the string in project file:

fatal("Qt WebEngine for Windows can only be built with the Microsoft Visual Studio C++ compiler").

I can try to edit pro file, but it cannot be all that difficult. What people do under Linux? It seems that I do something wrong. Should I use another class?




Content display on mobile, after created on web

I'm working for a marketing agency (freelance) and I got a very interesting task from my boss and honestly, I don't know where to start. I'm looking for some professional advice, hint for technologies to check, since I'm a native mobile developer I don't have any experience in web technologies.

The solution have to be work on Android,iOS too. (crossplatform solutions are welcome)

Website

So, we have a website where the user can upload his image, and add some text, buttons on the image (see link for details). http://ift.tt/1VSjYfb When he saving his interactive image, it's going to launch as a marketing campaign.

My first question: How should we save the interactive image, to make sure it's downloadable and displayable by a mobile device? Shall I use HTML5 to implement this website, or Javascript? React Native from Facebook?

On the mobile

Later on, this image going to appear on a mobile device, so the mobile users can tap on those buttons, we can register their vote, refreshing the image by increasing the number of clicks on the button. Later on, when the campaign ended, we deliver the results to our clients.

I would be more than delighted, if you can suggest some technologies and architecture solutions for me, so I can do my research by my own and start to implement the technology. Since it's not a pure native mobile solution, I'm a bit confused.




Hide Ionic Cordova www folder

There is any way to 'hide' or 'remove' the www folder from assets? But keep the app working the same way?

I know it exists Cordova-Uglify but i don't want that my source code is available for everyone. Any advices?




when user cancel

I have this code, everything works fine until users cancel during the UTL_HTTP.GET_RESPONSE than the connection stay in CLOSE_WAIT when the session reach to 5 of these connections I'm getting "too many open HTTP requests"

 resp := UTL_HTTP.GET_RESPONSE(req);
  DBMS_OUTPUT.PUT_LINE('HTTP response status code: ' || resp.status_code);
  DBMS_OUTPUT.PUT_LINE('HTTP response reason phrase: ' || resp.reason_phrase);
  FOR i IN 1..UTL_HTTP.GET_HEADER_COUNT(resp) LOOP
    UTL_HTTP.GET_HEADER(resp, i, name, value);
    DBMS_OUTPUT.PUT_LINE(name || ': ' || value);
  END LOOP;
  UTL_HTTP.END_RESPONSE(resp);

EXCEPTION
      WHEN OTHERS
      THEN
        IF v_utl_resp.private_hndl IS NOT NULL
         THEN
            UTL_HTTP.end_response (v_utl_resp);
         END IF;
        IF v_utl_req.private_hndl IS NOT NULL
        THEN
            UTL_HTTP.end_request(v_utl_req);
        END IF; 
      RAISE;
END;




Resize all website content on Window(width) resize

I'm trying to figure out a way to resize all content in a webpage based on the width of the browser window. The idea is based on the website newhive, which works in this way. Here is an example:

http://ift.tt/1NTaoAj

Using css vw alone seems to not be capable of achieving this, so i'm panning towards javascript or jquery, but with no idea where to start. Any help would be appreciated.




Images go corrupt in my website but work in general

Ive been trying to set some images for my portfolio page but Ive been having this problem http://ift.tt/1SrXTB7 . The code I try is <li><img src = "images/news.svg" id = "GithubImage"/> <a href = "https://github.com/x"> GitHub </a></li> , and after that height:64px; width: 64px; as they are supposed to be. What can have gone wrong? Thanks!




Powershell login script to web

I'm working on Powershell script. I want when I execute script to do: 1. Open webpage 2. Bypass warning screen on page 3. Click to Login button 4. Select first certificate & enter PIN & login

Code:

$pin = "666666"
$web = Get-Random -Input https://xxx.sk, https://yyy.sk, https://zzz.sk

$ie = New-Object -ComObject 'internetExplorer.Application'
$ie.Visible= $true
$ie.Navigate("$web")
while ($ie.Busy -eq $true){Start-Sleep -seconds 1;}   

#bypass warning 
$warning = $ie.Document.getElementByID("overridelink")
$warning.click()
while ($ie.Busy -eq $true){Start-Sleep -seconds 2;} 

$login=$ie.Document.getElementByID("LoginButton") 
$login.click()
while ($ie.Busy -eq $true){Start-Sleep -seconds 2;} 

if($(Get-Process | Where {$_.MainWindowTitle -match "https*" -AND $_.Name -match "iexplore"}))
{ 
    #Select first certificate and enter OK
    [void] [System.Reflection.Assembly]::LoadWithPartialName("'System.Windows.Forms")
    [System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
    Start-Sleep -seconds 5

    #Enter a PIN and enter OK
    [System.Windows.Forms.SendKeys]::SendWait("$pin")
    Start-Sleep -seconds 5
    [System.Windows.Forms.SendKeys]::SendWait("{ENTER}")#
}

else
{
    Write-Host "*** Internet Explorer is not running. ***"
}

Everything works fine until selecting certificate and enter pin. There is a problem. Script can't select certificate. I want execute script on background while I will do another things... Title of pop up window is Windows Security

Thanks for help.




Autofill is killing me

Been trawling the net for a while now for a solution to this but I can't find anything that works/isn't deprecated. The issue I have is that autofill in Chrome is applying its own styling to my input elements which is making them look awful (puke yellow background color). Anyone know how to get rid of this or at least change the color?




Asp.Net Web Api : json property names


I have LoginModel:

public class LoginModel : IData
    {
        public string Email { get; set; }
        public string Password { get; set; }
    }

and I have the Web api method

public IHttpActionResult Login([FromBody] LoginModel model)
        {
            return this.Ok(model);
        }

And it's return 200 and body:

{
 Email: "dfdf",
 Password: "dsfsdf"
}

But I want to get with lower first letter in property like

{
 email: "dfdf",
 password: "dsfsdf"
}

And I have Json contrast resolver for correcting

public class FirstLowerContractResolver : DefaultContractResolver
{
    protected override string ResolvePropertyName(string propertyName)
    {
        if (string.IsNullOrWhiteSpace(propertyName))
            return string.Empty;

        return $"{char.ToLower(propertyName[0])}{propertyName.Substring(1)}";
    }
}

How I can apply this?
Thank you!




How to call web service client in java eclipse

I am developing a android app which invoke cloud service. I add the web reference client by calling wsdl file cloudservice.wsdl in the server site. it will generate files called

(i)CloudServiceLocator(java file)

(ii)cloudservicesoap(interface)

(iii)CloudServiceSoapProxy(java file)

(iv)CloudServiceSoapStub(java file)

(iV)CloudService(interface)

how can i call the methods inside CloudServiceSoapStub class into my application.




I am not getting the Html which was in IFrame and generated by javascript

I am using selenium and Htmlaglity pack here is website : http://ift.tt/1YTbnpT

And here is my Code

 IWebDriver driver = new OpenQA.Selenium.PhantomJS.PhantomJSDriver("D:/Testing/");
        driver.Navigate().GoToUrl(suburl);
        Thread.Sleep(50000);
        var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(1000));
        driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(20));
        HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
         doc.LoadHtml(driver.PageSource);




mardi 26 avril 2016

setcookie() function in PHP

In php, I'm wondering how the setcookie() function can modify the client side cookie when I use a separated way between client and server to communicate(like only by ajax call and return json data). In this case, does a call to this function in server side automatically send back a new http header to client? otherwise how would the function call modify cookie data at client side?




How to build a website where people pay to watch videos

I want to create an online teaching website where I will upload videos on that website. When people access to those videos, they will have to pay with their phone credits.like they will enter their phone number and get a code and lose some money from their phone. when they type that code on the website they ll see the videos. Please help me!




there are three files:web.config ,web.config.default,web.config.comments

Can you tell me the difference of the three files:web.config ,web.config.default,web.config.commentsenter image description hereMy os is win 7




how to capture an un-cached, displayed on web browser image?

I have an image displayed when accessing a web page, which is set as no-cache by the server. I can not find it in browser's cache directory. How can I capture this image in my java code(whatever language)? Thanks a lot.




Can I place resources in the apache www folder?

I'm deploying my webapp on a remote server using apache tomcat and was wondering if I would place resources used for styling the html document in a folder within the www folder or a static resource folder within the jar file. As of now I have everything (including my html doc) inside of the jar file and it works fine. However, it's running on a different port. I know I could just change the port in the server.xml, but I figured using the www folder is convention (or is that just for war files)?




Navigating through your default web Browser on C#

So my question is: How can i navigate through a website getting elements by their id on the html, im not using windows forms, its a console application.

This is how im opening the website on my default browser(Chrome):

System.Diagnostics.Process.Start(url);

So i have the website opened, now i want to find an element by its id to navigate, fill boxes, etc.

Thanks in advance!




Controller function doesn't work in Angular.js

Hello to everyone reading this! I have a problem executing function in my Ctrl.

I tried to do some alerts, console.log and search here for answer but didn't find exect same problem, just similar. I'll be grateful to everyone helping me solve this problem)

HTML

// ctrls.js

var gameApp = angular.module('gameApp');

var AuthorizationCtrl = gameApp.controller('AuthorizationCtrl', function($scope) {
    $scope.email = email.value;
    $scope.password = password.value;
    $scope.signUp = function() { // this function isn't executed when I hope it to be
        console.log($scope.email, $scope.password);
        gameFactory.signUp(email, password).then(function() {

        });
    };
});


// services.js
function Factory(FBMSG, $firebaseArray, $firebaseAuth) {
    var events = {},
        ref = new Firebase(FBMSG),
        games = $firebaseArray(ref),
        auth = $firebaseAuth(ref);

    events.getAllGames = function() {
        return games.$loaded();
    };


    events.signUp = function(email, password) {
        return auth.createUser({
            email: email,
            password: password
        });
    };

    return events;

}
<script src="http://ift.tt/1mQ03rn"></script>
<!-- ng-view -->
<div ng-controller="AuthorizationCtrl" style="background-color: rgba(0, 0, 0, .5); width: 40%; margin:auto">
    <form>
        <div class="form-group">
            <label for="email">Email address</label>
            <input ng-model='email' type="email" class="form-control" id="email" placeholder="Email" required>
        </div>
        <div class="form-group">
            <label for="password">Password</label>
            <input ng-model="password" type="password" class="form-control" id="password" placeholder="Password" required>
        </div>
        <a href="">Forgot your password?</a>
        <div>
            <button ng-click="SignUp()">SignUp</button> <!-- Problem!!! -->
        </div>
    </form>
</div>



Does removing overqualified elements really improve performance?

I used some tools to validate my css for improving performance and i got feedback asking me to remove overqualified elements.

It does makes sense as it can improve selector performance, but was surprised to see this one as overqualified:

"div#container is overqualified, just use #container"

Does this really matter? I have lot of such occurrences in my css and was skeptical if this can do any good for improving performance.




Javascript: Find specific word on the webpage and read 4 characters after it

I'm helping my friend with his website and I created a search form to filter the cars that are available. The problem is that he will be the one adding the cars and the text with weebly, so I cannot give an id to every years and find it that way. Is there a way to read the word "Year:" and then save the next 4 characters after it in a variable using javascript?

Sorry if I'm not clear enough with my explaination. But here is the webpage in question if you want to see: http://ift.tt/1WRIE6o

Right now the filter works only with the "make". There's also a small issue when it filters, the divs are not distributed evenly. If anyone can help me it would be appreciated.

Thanks




Woocommerce product order checkout zero price

im have really strange problem and im truying to find help at google but im cannot find it anywhere :(

When im make order it's showing me price of product at checkout "0 DKK".

Im using woocommerce and gravity forms product and everythinks it's work but it's from once happen this problem, im hole day truying configure what's im do maybe it's my mistake, im truying disable all plugin except woocommerce and gravity form and gravity forms addon, but problem it's still there :(

Please can anyone help me




python web scraping gnp package

I came across the page. Based upon it i wrote the below code. The code runs. I want some additional results. Any suggestions or alternate package that you can suggest? I am creating word1 because i want to search for "eric bledsoe"/bigram and not ("eric","bledsoe")

import gnp
word= 'eric bledsoe'
word1='"' + word + '"'
c = gnp.get_google_news_query(word1)
#c = gnp.get_google_news_query("What's happening on earth")
print (c)

  1. How can i get a timestamp (6 hours back, Apr 25, 2016‎ etc) that is associated with each news?
  2. How can i restrict to news that were published in last 365 days?
  3. How can i take only top x entries? for example i want to see top 1000 results only? How can i navigate through 2,3,4....google news page?



How do charting sites overwrite the browser's zoom function?

On charting sites such as Bitcoin Wisdom, you can see that, if you try zooming on the chart (for example, by pinching on the trackpad, or in a touch screen) the chart zooms in instead of the whole page. How is that possible? Is there any event that can be listened to?




how to make the whole webpage look smaller (just like zoom out function of chrome) using CSS or JQuery?

Hi I am a beginner in web dev and I built a page on my ultra-wide 3k display without realizing everything looks so big on regular sized displays. But when I use zoom function in chrome to reduce it to 75% then it looks perfectly fine. Is there anyway to achieve this with css or js?




Java Jsoup no result from instagram.com

I try to get all divs from the website. If I try it with google.com or another webpage it works fine, just instagram gives an empty result. The metod looks like:

public static List<String> getPhotoPaths(String url) {
    List<String> paths = new ArrayList<>();

    try {
        Document doc = Jsoup.connect("http://ift.tt/1qQJ801")
                .userAgent("Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.120 Safari/535.2")
                .get();


        for (Element element : doc.select("div")) {
            System.out.println(element);
        }

    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return paths;

}

Has someone an idea whats wrong? This is the test website, it uses normaly divs like every other page. Or not?




"Uncaught TypeError: Illegal Invocation" in a javascript method

I have this input I want to use in another controller:

<li><input type="text" placeholder="Buscar" id="idnavBusqueda" name="navBusqueda"></li>
<li><a href="#" onclick="guardar()">Buscar</a></li>

And For that I use the method guardar():

function guardar() {
                console.log("HOLAAAAAAAAAAAAAAAA");
                var userAmigo= document.getElementById("idnavBusqueda");
                $('#idnavBusqueda').load("/perfilBusqueda",{navBusqueda:     userAmigo});
            }

But everytime I hit the "Buscar" button, Chrome sends the error and it just redirects to the href on "buscar". Also I'm using Spring, if that's relevant. What is wrong?




Simple Web File Manager with user permission

i'm searching for a simple web based standalone File Manager. It should allow me to import all Folders of a FTP directory and every user needs individual rights for every folder. (visibility)

I hope you can help me!!!




PHP error notice on radio button

I am validating a form using PHP (very very basic form) and im wondering if there is a solution to not get this error Notice: Undefined index: sendMethod in /directory/... on line 26 here is my code that i have for my form:

<form name="myForm" id="userDetails" action="formProcess.php" onSubmit="return validateForm()" method="post">
  <fieldset class="custInf">
    <h3> User Details </h3>
    <label class="inputArea" for="fName">Forename :</label>
    <input type="text" name="forename" id="fname" placeholder="Enter First Name" maxlength="20" size="15">
    </input>
    <label class="inputArea" for="sName">Surname :</label>
    <input type="text" name="surname" id="surname" placeholder="Enter Last Name" maxlength="20" size="15">
    </input>
    <label class="inputArea" for="email">Email :</label>
    <input type="email" name="email" id="email" placeholder="Enter Email Address" maxlength="40" size="15" />
    </input>
    <label class="inputArea" for="hmph">Landline number :</label>
    <input type="tel" name="landLineTelNo" id="hmphone" placeholder="Enter Landline no." maxlength="11" size="15">
    </input>
    <label class="inputArea" for="mobileTelNo">Mobile number :</label>
    <input type="tel" name="mobileTelNo" id="mobile" placeholder="Enter Mobile no." maxlength="11" size="15">
    </input>
    <label class="inputArea" for="address">Postal Address :</label>
    <input type="text" name="postalAddress" id="address" placeholder="Enter House no." maxlength="25" size="15">
    </input>
  </fieldset>
  <fieldset class="contactType">
    <h3> How would you like to be contacted? </h3>
    <label class="radioBt" for="sms">SMS</label>
    <input id="smsBut" type="radio" name="sendMethod" value="SMS">
    </input>
    <label class="radioBt" for="email">Email</label>
    <input type="radio" name="sendMethod" value="Email">
    </input>
    <label class="radioBt" for="post">Post</label>
    <input type="radio" name="sendMethod" value="Post">
    </input>
  </fieldset>
  <fieldset class="termsCon">
    <input type="checkbox" name="check" value="check" id="check" />I have read and agree to the Terms and Conditions and Privacy Policy
    </input>
  </fieldset>
  <input class="submitBut" type="submit" name="submitBut" value="Submit" </input>
</form>
$fname = $_REQUEST['forename'];
if (empty($fname)) {
die("<p>Enter a first name</p>\n");
}

$surname = $_REQUEST['surname'];
if (empty($surname)) {
die("<p>You must enter a surname</p>\n");
}

$email = $_REQUEST['email'];
if (empty($email)) {
die("<p>You need to enter an email</p>\n");
}
//Landline not required so wont give error 
$hmphone = isset($_REQUEST['hmph']) ? $_REQUEST['hmph'] : null ;

$mobile = $_REQUEST['mobileTelNo'];
if (empty($mobile)) {
die("<p>Enter a Mobile Number</p>\n");
}

$address = $_REQUEST['postalAddress'];
if (empty($address)) {
die("<p>Enter your postal address</p>\n");
}

$sendMethod = $_REQUEST['sendMethod'];
if (empty($sendMethod)) {
die("<p>Please choose a contact option</p>\n");
}

$check = $_REQUEST['check'];
if (empty($check)) {
die("<p>Please select the Terms and Conditions to continue</p>\n");
}   

its a very basic PHP validation, i just want it to not give me a error notice until all over fields have been checked for example, the error shows up once all the fields are filled in saying "Please choose a contact option" but if i fill out all of the fields bar the mobile, i get the error notice




How I convert aspx page to ascx page

CS.aspx page is working but uGrid.ascx page in default.aspx is not working. I didn't understand.

The project on http://ift.tt/1ujjhrB

Sayfa Resimler




How do you properly refresh a list using List.js

I have a reporting page that I don't want page refreshes on. On select list change, I call an API to generate the new report and spit it out to the DOM using List.js. The issue that I'm running into is: only the first report loaded works properly with the sorting functionality. I believe the core of the issue is how I'm 'refreshing' the list. Here is the code:

function initializeReport(videoName) {
    if (videoName) {
        toggleOverlay();
        $.ajax({
            url: '/api/report/' + videoName,
            type: "GET",
            dataType: "json",
            success: function (data) {
                var values = [];
                var countWatched = 0;
                data.forEach(function (entry) {
                    values.push({ name: entry.UserName, title: entry.Title, count: entry.Count, time_played: entry.TimePlayed })
                    if (entry.TimePlayed > 0) {
                        countWatched++;
                    }
                });
                toggleOverlay();
                var options = {
                    valueNames: ['name', 'title', 'time_played', 'count'],
                    item: '<li><div class="name"></div><div class="title"></div><div class="time_played"></div><div class="count"></div></li>'
                };
                var userList = new List('views', options);
                userList.remove();
                userList.add(values);

                animLoop(data.length, countWatched);
                document.querySelector(".watched").innerHTML = "Watched: " + countWatched;
                document.querySelector(".not_watched").innerHTML = "Not Watched: " + (data.length - countWatched);
            }
        });
    }
}




Cant access api rest mvc from server, yes in local host

I am doing an api rest with mvc, when I test it in localhost go well, I can call this api from code behing, or from js but when I upload the api to my hosting (myasp.net) without data connections, I can´t access it the by js, but yes from code behind. I have some js samples codes to access to a web api (Jquery and Ajax)...what I am doing bad?? Sample js works good: $.getJSON('http://localhost:22166/api/Persona') .done(function (data) {

                });
            });

or ajax: $.ajax({ url: "......localhost... api/Persona",

}).done(function(data) {

}); Sample js doesnot work: $.getJSON('http://ift.tt/1VzTI94') .done(function (data) {

                });
            });

PD: I´ve tried on Fiddler the two urls and all works

Thanks!!!




web based wysiwyg mail editor component

I'm working on a web based application that needs to send email. I want my users to be able to create html templates with an easy editor. I don't want to build this component myself. Are there any components available that can do this which I can integrate in my application?




open a web page from my app

I have an app with a pop-up window which shows a message for the user. Inside the message of this pop-up I would like to show a url which can be clicked and drives the user to that web page. Any suggestions? Thank you in advance




YAHOO API for complete company profile

I am developing a prototype for an idea I recently got and I need to get company profile as expressed at this link : http://ift.tt/1Tusvkn

In particular I need complete name, address, sector and description.

Does anybody know if Yahoo API has something that could help me in solving this problem with javascript? Thanks in advance




The date not convert to strtotime format in php

The date not convert to strtotime format

start date= 2016-04-26 10:53:10 
end date= 2050-04-29 01:00:00
$db_start_date=strtotime($future_product_result['startdate']);
$db_end_date=strtotime($future_product_result['enddate']);

The start date convert to strtotime format = 1461648190. But the enddate not convert.




Creating a basic "web portal" to monitor my home servers

I want to create a simple webpage that shows some stats for that server as well as some information about programs it's running (like is DNS up? disk utilization? simple weather widget etc.) and was looking for some tips to get started. I want to code it in python because I am trying to sharpen my py skills. Any recommendations on a framework or other tools that would be helpful?




Adding EntityClient into Connection String SqlClient

I am trying to add a Entity Framework project with object relational mapping (ORM) into my standard SQL Server Project (MVC ASP.Net).

I think the problem is in the Connection String in the Web.config file:

<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-Project2-20160209033141.mdf;Initial Catalog=aspnet-Project2-20160209033141;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="BlogEntities" connectionString="metadata=http://res*/Entities.BlogContext.csdl|res*/Entities.BlogContext.ssdl|res*/Entities.BlogContext.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=(LocalDB)\MSSQLLocalDB;attachdbfilename=|DataDirectory|\aspnet-Project2-20160209033141.mdf;integrated security=True;connect timeout=30;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

DefaultConnection is the main project im working with and BlogEntities is what i'm trying to add. When i run the project the BlogEntities it seems to work fine, but im having trouble running the Default Database, as It wont let me log into user accounts and other tasks that have worked before. Error Example->

Is there an easier way to add this into my project without disrupting the current database? Thanks in advance.




Device Enrollment System

I need suggest for system (Web-App is preferred ) that can help me to assign any device (PCs,Laptops, Printers, ...etc) to current & New coming Employees inside Corporate . It is easy to connect the system to Corporate AD & get information about employee account .

thanks




What's the cool URL?

When developing the web application, I have the URL like this: http://ift.tt/1MV674z.

I'm wondering if there's more elegant way to hide my URL like that?

I know that UrlRewriteFilter can do something alike. But if there are more parameters in my URL, say id, name, age, and if I have long ID generated randomly, then it looks not so good like this: http://ift.tt/1rwkWBe.

So, are there any better solutions for this? By the way, I'm using Java for development.

It's grateful if someone can shed light on it.




Bad Gateway 502 Error after waiting ~2min for the page to load

Hi, I try to make a little form for the school and everything was working fine since I made the function "reorganizeVector()". Now when I want to try my form(only this webpage) on a browser, it loads for 2~3min and I get a Bad Gateway 502 error. I'm almost sure my problem is in the "reorganizeVector()" function. I tried to find what's wrong in my function but I can't find what I've done wrong.

I will add some other file like "index.php" tomorrow because it's 3:18AM here and I have to wake up at 5AM for school so...

It would be appreciate if you could help me.
Please help me!

B.T.W. sorry for my bad english, I'm a french canadian and I tried to do my best.

<?php
if(version_compare(PHP_VERSION, '5.4.0') >= 0)
{
    if(session_status() == PHP_SESSION_NONE)
        session_start();
}
elseif(session_id() == '')
    session_start();

define('MIN_CAR', 3);
define('MAX_CAR', 30);
define('MIN_QTY', 1);
define('MAX_QTY', 1000);

if(isset($_POST['name']) AND isset($_POST['qty']) AND isset($_POST['category']))
{
    $nameValide = (strlen($_POST['name'])>=MIN_CAR AND strlen($_POST['name'])<=MAX_CAR);
    $qtyValide = ($_POST['qty']>=MIN_QTY AND $_POST['qty']<=MAX_QTY);
    if($nameValide AND $qtyValide)
    {
        filter_var($_POST['qty'], FILTER_SANITIZE_NUMBER_INT);
        if(!isset($_SESSION['vector']))
        {
            $_SESSION['vector'] = array(
                array('name'=>$_POST['name'],
                'qty'=>$_POST['qty'],
                'cat'=>$_POST['category']));
        }
        else
            array_push($_SESSION['vector'], array('name'=>$_POST['name'], 'qty'=>$_POST['qty'], 'cat'=>$_POST['category']));
    }
    else
    {
        if(!$nameValide)
            error('invalid name (between '.MIN_CAR.' and '.MAX_CAR.' caracters)');
        if(!$qtyValide)
            error('invalid quantity (between '.MIN_QTY.' and '.MAX_QTY.')');
    }
}

function error($text)
{
    if(isset($error))
        array_push($error, '<p class="error">'.$text.'</p>');
    else
        $error = array('<p class="error">'.$text.'</p>');
}


//THIS IS THE FUNCTION THAT CAUSE THIS ISSUE BUT I DONT KNOW WHAT IN THE FUNCTION CAUSE IT
function reorganizeVector()
{
    foreach($_SESSION['vector'] as $value)
    {
        if(isset($array))
            array_push($array, array($value['name'], $value['cat']));
        else
            $array = array(array($value['name'], $value['cat']));
    }
    
    $backup = $array;
    $x = 1;
    
    for($i=0; $i<sizeof($array); $i++)
    {
        //name qty cat
        $int = null;
        $index = null;
        do
        {
            $shifted = array_shift($array);
            $index = array_search($shifted, $array)+$x;
            if(!empty($index))
            {
                if(isset($temp))
                    array_push($int, $index);
                else
                    $int = array($index);
            }
            $x++;
        }
        while(!empty($index));
        
        if(isset($temp))
            array_push($temp[$x], $int);
        else
            $temp = array($x=>$int);
        
    }
    
    foreach($temp as $key => $secondary)
    {
        $primary = $_SESSION['vector'];
        $newQty = $primary[$key]['qty'];
        foreach($secondary as $index)
        {
            $newQty += $primary[$index]['qty'];
        }
        $primary[$key]['qty'] = $newQty;
        if(isset($newVec))
            array_push($newVec, $primary[$key]);
        else
            $newVec = array($primary[$key]);
    }
    
    $_SESSION['vector'] = $newVec;
}

//--------------------------------------------------------------------HTML--------------------------------------------------------------------
?>
<h2>Add an article</h2>
<?php 
if(isset($error))
    foreach($error as $value)
        echo $value;
?>
<form method="post" action="">
    <p>
        <label name="name">Name :</label>
        <input type="text" name="name" pattern="^.{3,30}$" title="Between <?php echo MIN_CAR.' and '.MAX_CAR; ?> caracters" required>
        <br>
        <label name="qty">Quantity : </label>
        <input type="text" name="qty" size="4" pattern="(^(0*[1-9]{1}[0-9]{0,2})$)|(^1000$)" title="Value between <?php echo MIN_QTY.' and '.MAX_QTY; ?>" required>
    </p>
    <p>
        <label name="category">Category :</label><br>
        <input name="category" type="radio" value="kitchen" checked> Kitchen<br>
        <input name="category" type="radio" value="electronic"> Electronic<br>
        <input name="category" type="radio" value="other"> Other<br>
        <input name="category" type="radio" value="hardware"> Hardware<br>
        <input name="category" type="radio" value="sport"> Sport<br>
        <br>
        <button type="submit">Validate</button>
    </p>
</form>

<?php
if(isset($_SESSION['vector']))
{
    reorganizeVector();//<---------------------------------------FUNCTION CALLED HERE
?>
<hr>
<table border="1" style="width:400px">
    <tr>
        <th style="width:50%">Name</th>
        <th>Quantity</th>
        <th>Category</th>
    </tr>
    <?php
    foreach($_SESSION['vector'] as $value)
    {
        echo '
        <tr>
            <td>'.$value['name'].'</td>
            <td>'.$value['qty'].'</td>
            <td>'.$value['cat'].'</td>
        </tr>
        ';
    }
    ?>
</table>
<?php
}
?>



lundi 25 avril 2016

Magento API integrate C# website

Can someone give me sample of projects or codes that use Magento web api to integrate in ASP.Net project. I don't know what to put in the web config for the connection similar to this one: <add key="VOLUSION_BASE_API" value="https://{DomainName}/net/WebService.aspx" /> I have already the Username, API Key and Consumer Key and Consumer Secret. But I really don't know how to start. How will I connect to the API and get the orders from magento website.

Please help me.




Website changes after upload or compression

All the img tags change size and position and all the text gets a little smaller for some reason. I know my code is probably bad but nothing i do fixes it. The domain is dombrowskicasemgmt.com.

on my computer

on server




How to scrape off a .jsp website?

I am looking to scrape a table into Excel from this website http://ift.tt/1SoSefd

it has about 5000 rows running into several pages (from 1 to 547), how do i get these rows into Excel without doing a copy paste every time?




list of html attributes and its allowed types

is there any list available that maps html attribute to its allowed types, similar to http://ift.tt/1RkrTPQ ?

Example :

wrap : Boolean

accept : String

value : Any

tabIndex : Int
...




How To Display the Array Response by without braces and commas in UI using Angularjs

I am getting the Array Response ["item1","item2"] from the server. but i want to display the data as item1 and item2 in one by one in UI using angularjs. So, Please give me the solution?




Is token based authentication suitable for traditional web application?

I understand that Token based authentication is very good for Web API Or Single Page Application (SPA).

But how about traditional web application? Should we apply Token based authentication for this kind of web app?

I did google for my question but I only found articles for Web API / SPA.

Anyone has any ideas? Or know any resources for my question?

Thank you!




Write a (Java) script to fill out this form

I'm trying to figure out how to write Java code to fill out this form on this website. I don't know what to do, anything helps!

Thank you!

The form I'm trying to fill out




Web Application displaying issues after HTTP put request & formatting date. Java

In the web application, logged in users are saved to the session via session.setAttribute("loggedIn");.

I take in various user data into a servlet, validate and then perform a HTTP PUT request and then reset the person object by overwriting the session attribute, "loggedIn".

The issue I am having is that once the user edits their date of birth (dd-mm-yyyy input which is then converted into "dd-MMM-yyyy" for database input) after returning to their profile page, the date of birth field displays nothing.

However, if the user logsout (session.removeAttribute("loggedIn")) and then logs back in, the date displays appropriately. I have tried to auto logout and then login the user upon HTTP put, but it doesnt seem to work.

Thank you for any attempts at answering my question.

Date formatting code:

public String getDobAsFormatted(String input) throws ParseException
{
        //take in yyyy-MM-dd'T'HH:mm:ss
        SimpleDateFormat sdfDate = new SimpleDateFormat("dd-MM-yyyy");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
        Date date = sdf.parse(input);
        String formattedDate = sdfDate.format(date);
        //output dd-mm-yyyy
        return formattedDate;
}

public String getDobForDbInput(String input) throws ParseException
{
    //take in dd-mm-yyyy
    SimpleDateFormat sdfDate = new SimpleDateFormat("dd-MM-yyyy");
    SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy");

    Date date = sdfDate.parse(input);
    String formattedDate = sdf.format(date);
    //returns dd-mmm-yyyy
    return formattedDate.toUpperCase();
}

profile.jsp:

                             <% 
                                 Person username = new Person();
    try {
        username = (Person)request.getSession().getAttribute("loggedIn");
        if(username != null)
        {
    %>  <div style=" width:1018px; float:left; padding:35px 50px 15px 50px; background-image:linear-gradient(to bottom,#46C746,#3FB33F); margin-top:20px;">
                    <div style="text-align:center;"><span style="color:white; font-size:35px;"><%= username.getUSERNAME()%>'s Profile</span></div>
        </div>
        <div class="contentContainer" style="height:auto; background-color:white;">
                    <div style="margin:auto; width:700px;">



                        <div class="latestEvents" onMouseOver="show('latestEventsOnHover')" onMouseOut="hide('latestEventsOnHover') " style="height:200px;background-image: url(../images/defaultusericon101.png);background-size: cover;width:205px;border-radius:100px;background-color: #57b8e5;">

                        </div>
                        <div class="eventInfoWrapper" style="float: left;height: 200px;margin: 5px; position:relative; width:400px;">
                                <div class="eventInfo-Name">
                                        <p style="margin:0px; color:black;">First Name: <%= username.getFORENAME()%></p>
                                    </div>
                                    <div class="eventInfo-Venue" style="width:100%; float:left;">
                                        <p style="margin:0px; color:black;">Last Name: <%= username.getSURNAME()%></p>
                                    </div><br>
                                    <div class="eventInfo-Venue" style="width:100%; float:left;">
                                        <p style="margin:0px; color:black;">Email: <%= username.getEMAIL()%></p>
                                    </div><br>
                                    <div class="eventInfo-Date">
                                        <p style="margin:0px; color:black;">Date of Birth: <%= username.getDobAsFormatted(username.getDOB()) %></p>
                                    </div>
                                    <div class="eventInfo-Venue" style="width:100%; float:left;">
                                        <p style="margin:0px;color:black;">Address: <%= username.getADDRESS_LINE()%></p>
                                    </div><br>
                                    <div class="eventInfo-Venue" style="width:100%; float:left;">
                                        <p style="margin:0px; color:black;">Town: <%= username.getTOWN() %></p>
                                    </div><br>
                                    <div class="eventInfo-Venue" style="width:100%; float:left;">
                                        <p style="margin:0px; color:black;">Postcode: <%= username.getPOST_CODE() %></p>
                                    </div><br>
                                    <div class="eventInfo-Venue" style="width:100%; float:left;">
                                        <p style="margin:0px; color:black;">Telephone Number: <%= username.getTELEPHONE_NUMBER()%></p>
                                    </div><br>


                                    <div class="eventInfo-Description">
                                        <p style="margin:0px; color:black;" style="position:absolute;">Username: <%= username.getUSERNAME()%></p>
                                    </div>

                                <%
                                }
                            }
                            catch(Exception e)
                            {

                            }
                            %>

                        </div>
                            <div class="eventBookNowBtn">

                                            <input type="submit" class="editAccountDetailsBtn" value="Edit Account Details" class="btn" style="margin:0px;margin-top: 15px;width: 100%;">


                            </div>
                            <% try{ %>
                            <div class="editAccountDetails" id="NewsAndOffersContent" style="background-color:white; height:auto;">
                                <div style="color:white; text-align:left; margin-left:50px; margin-bottom:40px;">
                                    <form method="post" style="margin:auto; width:300px;" action="/PRDCD_Web_Application/editUser">
                                        <br>
                                        <input type="text" value="<%= username.getFORENAME()%>"  placeholder="First Name" name="firstName" maxlength="20" style="opacity:0.7; color:white;">
                                        <input type="text" value="<%= username.getSURNAME()%>" placeholder="Last Name" name="lastName" maxlength="20" style="opacity:0.7; color:white;">
                                        <input type="text" value="<%= username.getEMAIL()%>" placeholder="Email" name="email" maxlength="50" style="opacity:0.7; color:white;">
                                        <input type="text" value="<%= username.getDobAsFormatted(username.getDOB()) %>" placeholder="Date of Birth" name="dob" maxlength="11" style="opacity:0.7; color:white;">
                                        <input type="text" value="<%= username.getADDRESS_LINE()%>" placeholder="Address" name="address" maxlength="50" style="opacity:0.7; color:white;">
                                        <input type="text" value="<%= username.getTOWN() %>" placeholder="Town" name="town" maxlength="50" style="opacity:0.7; color:white;">
                                        <input type="text" value="<%= username.getPOST_CODE()%>" placeholder="Postcode" name="postcode" maxlength="7" style="opacity:0.7; color:white;">
                                        <input type="text" value="<%= username.getTELEPHONE_NUMBER()%>" placeholder="Telephone Number" maxlength="11" name="telephone" style="opacity:0.7; color:white;">
                                        <br>
                                        <input type="hidden" value="<%= username.getUSER_ID() %>" name="id" class="btn" value="Update">
                                        <input type="hidden" value="<%= username.getUSERNAME()%>" name="username" class="btn" value="Update">
                                        <input type="hidden" value="<%= username.getPASSWORD() %>" name="password" class="btn" value="Update">
                                        <input type="submit" class="btn" value="Update">
                                        <input type="submit" class="editAccountDetailsBtnCancel" value="Cancel" class="btn" style="margin:0px;width: 100%;"> 
                                    </form>
                                </div>
                            </div>
                                        <%}
                                        catch(Exception e){

                                        }%>

editUser servlet:

HttpSession session = request.getSession(true);
             //get user values
             int err = 0;
             String error = "";
             Person accessor = new Person();
             String firstName = request.getParameter("firstName"); //id of event date id
             String lastName = request.getParameter("lastName"); // student, senior, etc
             String email = request.getParameter("email"); // seating, standing
             String dob = request.getParameter("dob");
             String address = request.getParameter("address");
             String telephone = request.getParameter("telephone");
             String town = request.getParameter("town");
             String postcode = request.getParameter("postcode");
             String id = request.getParameter("id");
             String username = request.getParameter("username");
             String password = request.getParameter("password");
             String formattedForDbInput = "";
             int idNumber = Integer.parseInt(id);


         try 
         {
              dob = accessor.getDobForDbInput(dob);
         }
         catch(Exception e) 
         {
             error += "Invalid date format. Did you enter dd-mm-yyyy?.<br>";
             err = 1;  
         }

         //validation


    if(lastName.equals(""))
    {
        error += " Empty last name. ";
        err = 1;  
    }
    else if(lastName.length() < 2) 
       {
           error += "Invalid Last Name, must be at least 2 characters long.<br>";
           err = 1;  
       }
       else if (lastName.matches(".*\\d.*"))
       {
           error += "Invalid Last Name, cannot contain numbers.<br>";
           err = 1;  
       }
       else if(lastName.contains(" ")) 
       {
           error += "Invalid Last Name. Cannot contain whitespace.<br>";
           err = 1;  
       }

    if(postcode.equals(""))
       {
           error += "Invalid Postcode<br>";
           err = 1;   
       }
       else if(postcode.length() < 6)
       {
           error += "Invalid Postcode, must be at least 6 characters long.<br>";
           err = 1;
       }
       //regex doesnt work
       else if(!postcode.matches("[a-zA-Z0-9]*$"))
       {
           error += "Invalid Postcode. Must contain letters & numbers.<br>";
           err = 1;
       }

    if(town.equals(""))
       {
           error += "Invalid Town<br>";
           err = 1; 
       }

    if(email.equals(""))
    {
        error += " Empty email. ";
        err = 1;
    }
    else if(!email.contains("@"))
       {
           error += "Invalid Email<br>";
           err = 1;
       }
       else if(!email.contains("."))
       {
           error += "Invalid Email<br>";
           err = 1;
       }
       else if(email.length() < 6)
       {
           error += "Invalid Email. Must be at least 6 characters long.<br>";
           err = 1;
       }
       else if(email.startsWith("@"))
       {
           error += "Invalid Email.<br>";
           err = 1;  
       }
       else if(email.startsWith("."))
       {
           error += "Invalid Email.<br>";
           err = 1;  
       }

     if(dob.equals(""))
       {
           error += "Invalid Date of Birth.<br>";
           err = 1;
       }
       else if(dob.length() < 10)
       {
           error += "Invalid Date of Birth<br>";
           err = 1;
       }

    if(address.equals(""))
       {
           error += "Invalid Address<br>";
           err = 1; 
       }

    if(firstName.equals(""))
    {
        error += " Empty First Name. ";
        err = 1;
    }
    else if(firstName.length() < 2) 
       {
           error += "Invalid First Name, must be at least 2 characters long.<br>";
           err = 1;  
       }
       else if (firstName.matches(".*\\d.*"))
       {
           error += "Invalid First Name, cannot contain numbers.<br>";
           err = 1;  
       }
       else if(firstName.contains(" ")) 
       {
           error += "Invalid First Name. Cannot contain whitespace.<br>";
           err = 1;  
       }

       if(telephone.equals(""))
       {
           error += "Invalid Telephone Number<br>";
           err = 1;  
       }
       else if(!telephone.startsWith("0"))
       {
           error += "Invalid Telephone Number, must start with 0.<br>";
           err = 1;  
       }
       else if (telephone.length() < 11)
       {
           error += "Invalid Telephone Number, must have a length of 11 digits.<br>";
           err = 1; 
       }

         if(err == 0)
         {
         //update person
         Person update = new Person();
         update.setFORENAME(firstName);
         update.setSURNAME(lastName);
         update.setEMAIL(email);
         update.setDOB(dob);
         update.setADDRESS_LINE(address);
         update.setTELEPHONE_NUMBER(telephone);
         update.setTOWN(town);
         update.setPOST_CODE(postcode);
         update.setUSER_ID(idNumber);
         update.setUSERNAME(username);
         update.setPASSWORD(password);
         update.updatePerson(update);

         session.setAttribute("loggedIn", update);
         response.sendRedirect("/PRDCD_Web_Application/web/html/profile.jsp?suc=" + URLEncoder.encode("Update Successful.", "UTF-8")); 
         }
         else {
             response.sendRedirect("/PRDCD_Web_Application/web/html/profile.jsp?invalid=" + URLEncoder.encode(error, "UTF-8")); 
         }