vendredi 30 juin 2017

How to write a web api which will call third party url for lookup

i've given a task to create the api which will give a call to third party url for look up

sample get reqest two parameters employee number and some id

response request in json format

can anyone give me such implementation for refrence or link which help me complete my task




How to add slot in repeat dom in polymer 2

i want to create a layout element, so i write the template like this

    <template>
        <div class="row">
            <template is="dom-repeat" items="[[cols]]">
                <div class$="col-[[item]]">
                    <slot id="id[[index]]" name="id[[index]]">no value</slot>
                </div>
            </template>
        </div>
    </template>

and in the html page file, i use this component like this:

    <tcpc-row>
      <span slot="id0">cc id-tcpc-col-0 </span>
      <span slot="id1">cc id-tcpc-col-1 </span>
      <span slot="id1">cc id-tcpc-col-3 </span>
    </tcpc-row>

but i result is not correctly, when i write the template without repeat is ok, like this:

<template>
    <div class="row">
        <div class="col-3">
            <slot name="id0"></slot>
        </div>
        <div class="col-3">
            <slot name="id1"></slot>
        </div>
        <div class="col-3">
            <slot name="id2"></slot>
        </div>
        <!--<template is="dom-repeat" items="[[cols]]">
            <div class$="col-[[item]]">
                <slot id="id[[index]]" name="id[[index]]">no value</slot>
            </div>
        </template>-->
    </div>
</template>

is there have some way to add slot in repeat?




What cool projects can be build with firebase?

I know firebase offers a lot of stuff like Real Time database etc.

I know that using Firebase some projects that can be built are Chat apps, Voting System, Railway reservation etc.

Can I get more thoughts of building some cool thing with Firebase?




SQLite on web host

Is it a good idea to use SQLite database instead of MySQL on a web server ?




.htaccess rewrite help needed

RewriteRule ^([^/.]+)/([^/.]+)$ //root/pages/$1.php?parameter=$2 [L]

RewriteRule ^admin/([^/.]+)$ //root/pages/admin/$1.php [L] RewriteRule ^admin/([^/.]+)=([^/.]+)$ //root/pages/admin/$2/$1.php [L]

I am getting a page not found error for the last rewrite rule. The first two rewrite rules work fine but I am having trouble with the last one. I already made sure that the file was in the correct folder.

Edit: Posted on mobile so I don't know how to format code on my phone.




Child of a flex-item not taking parent's height when parent has flex-basis set in a flex container of direction column

Boy that title was a mouthful. Let me explain my confusion:

I have a flex-container and 2 flex items.

<!-- HTML -->

<div class="container">
    <div class="item-1">
        <div class="child-of-item-1"></div>
    </div>
    <div class="item-2></div>
</div>


/* CSS */

.container {
    display: flex;
}

.item-1 {
    flex: 0 0 255px;
}

.item-2 {
   /* negligible css */
}

.child-of-item-1 {
    height: 100%; // shouldn't this always receive the height of its parent?
}

item-1 is set with a flex-basis of 255px using the shorthand flex property. Since I didn't specify a flex-direction on .container, it's defaulting to row. Simple. Great.

Now at a certain screen width, let's say 992px, I switch the flex-direction to column.

@media (max-width: 992px) {
    .container {
        flex-direction: column;
    }
}

Here's where my question comes in. Once <992px, .item-1 still has a height of 255px but .child-of-item-1 loses its height completely. Where have I gone wrong? What am I missing?

It may be important to note that .child-of-item-1 has no content inside of it, but it does have a background-image. I am not seeing the background-image because .child-of-item-1 loses its height, hence my confusion.

I would really appreciate some insight, and thanks again! :)




Connect the several computers via local host

I want to made a simple website using wordpress that can be displayed on several stationary computers in one building. The content of the website can be modified via CMS. I dont have many experience in that projects but I think, that I can connect it via localhost server.

My idea:

  • On all PCs I want to make a script that will be check if the serwer is on and whenever is not it will run the server.
  • The script will be run on whenever the system is booting up. When the connection is established it will open the web browser and set it to the full screen mode.

Is that good pratice ? I want to make it as reliability as I can and avoid using internet connection.




How To Remove Div Background Color

I have set the background of my site to an image by doing this:

html {
    font-family: adamina;
    background: url("../images/beach2.jpg") no-repeat center center fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}

Then I created a div and as soon as I give the div a border it has this white background that I don't want to see. I tried setting background color to transparent but it's still there. Is there anyway I can remove this white background from the div?




what is the difference between web service and website

look at this scenario : in my app I get the form in html of a website that form displays customer info now I can parse the form and get customer info Or I can use a web service (SOAP or whatever) and get the same information What is the difference?




Vue-Request not sending Authorization Header

I'm using VueJS with vue-request for http requests. I'm trying to subscribe an user to a Mailchimp list but Mailchimp uses BasicAuth, so I'm doing as such:

   scope.$http.post('http://ift.tt/2sZS3AI',
{...mydata...}, {headers: {Authorization: 'Basic myencodedAPIkey'}})

But I get an error from the API: 401 Unauthorized - Your request did not include an API key.

So I check the Network log on Chrome and the Authorization is on my headers like this: Access-Control-Request-Headers: authorization but it should be like Authorization: myencodedAPIkey

On the Console the error appears as:

XMLHttpRequest cannot load http://ift.tt/2sZS3AI. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. The response had HTTP status code 401.

When I use Postman it works just fine as the header is correctly sent.




How to make JSP project live on Internet?

I have made a project in eclipse in HTML and JSP . I want to make it online or live . I have tried hostinger.in , 000webhost.com and also wordpress.com . But no one is supporting to host JSP pages . I don't want to purchase any domain name as it is just made for fun and my knowledge .




How do I rename an uploaded file and send it as an email attachment (PHP)?

I have a php code(example.php) which extracts the email id(sender@example.com) from the following form, gets the uploaded file and sends an email to a recipient@example.com with the uploaded file as attachment and the extracted email id as the sender id. Then it redirects the user to a success.html page.

The html form is as below:

<form action="http://ift.tt/19WJzYb" enctype="multipart/form-data" method="POST">
<label>Your Email <input name="sender_email" type="email" /> </label></p>
                                <label>Attachment <input name="my_file" type="file" /></label> <label><input name="button" type="submit" value="Submit" /></label></p>
                </form>
                <p>
                        &nbsp;</p>

The php for the form is:

<?php
if($_POST && isset($_FILES['my_file']))
{
$recipient_email    = 'recipient@example.com';
//Capture POST data from HTML form and Sanitize them, 
$from_email = filter_var($_POST["sender_email"], 
FILTER_SANITIZE_STRING); //sender email used in "reply-to" header
$subject        = SUBMISSION_PG;
$message        = filter_var($_POST["message"], 
FILTER_SANITIZE_STRING); //message
//Get uploaded file data
$file_tmp_name    = $_FILES['my_file']['tmp_name'];
$file_name        = $_FILES['my_file']['name'];
$file_size        = $_FILES['my_file']['size'];
$file_type        = $_FILES['my_file']['type'];
$file_error       = $_FILES['my_file']['error'];
if($file_error > 0)
{
die('Upload error or No files uploaded');
}
//read from the uploaded file & base64_encode content for the mail
$handle = fopen($file_tmp_name, "r");
$content = fread($handle, $file_size);
fclose($handle);
$encoded_content = chunk_split(base64_encode($content));
$boundary = md5("sanwebe");
//header
$headers = "MIME-Version: 1.0\r\n"; 
$headers .= "From:".$from_email."\r\n"; 
$headers .= "Reply-To: ".$from_email."" . "\r\n";
$headers .= "Content-Type: multipart/mixed; boundary = 
$boundary\r\n\r\n"; 
//plain text 
$body = "--$boundary\r\n";
$body .= "Content-Type: text/plain; charset=ISO-8859-1\r\n";
$body .= "Content-Transfer-Encoding: base64\r\n\r\n"; 
$body .= chunk_split(base64_encode($message));
//attachment
$body .= "--$boundary\r\n";
$body .="Content-Type: $file_type; name=".$file_name."\r\n";
$body .="Content-Disposition: attachment; 
filename=".$file_name."\r\n";
$body .="Content-Transfer-Encoding: base64\r\n";
$body .="X-Attachment-Id: ".rand(1000,99999)."\r\n\r\n"; 
$body .= $encoded_content;
$sentMail = @mail($recipient_email, $subject, $body, $headers);
if($sentMail) //output success or failure messages
{       
header("Location:http://ift.tt/2uslppk");
}else{
die('Could not send mail! Please check your PHP mail 
configuration.');  
}
}
?>

I need to rename the uploaded filename to sender@example.com.extension then send the uploaded file as attachment.

I'd be thankful to anyone who can solve me this issue.




How to setup Live Preview environment for web development

I m using sublime text and I want live preview my web pages locally for web development like Brackets have but I don't want use brackets is there some way I can create local server that refreshes on every modification of file




vba ie web scraper button click only works for some users on the site

I am having an issue which has been driving me crazy trying to figure out. We have a site at work that we have to pull large amounts of data from every day. I created a web scraper which works perfectly fine for me, but for some reason others have issues using the same site. I have ruled out it being a computer issue, because I have gone on their computer, logged in under my name on the site and it works perfectly fine.

The problem is, the "Next Page" click event doesn't work with some users. It finds the button, fires the click event and nothing happens. When I log in, it fires the event with no issue. I have tried everything to get it to work. I tried to use:

inputElement.FireEvent("onclick")
inputElement.click

I am unsure how a click event can work or not work via code based on who the user is. Physically clicking on the button still works, just not firing the onclick event via code for some users(it works for me, most importantly).

Here are the relevant parts:

Dim inputElement As HTMLInputElement
For Each inputElement In Document.getElementsByTagName("button")
    If inputElement.Value = "Next Page" Then
       Set inputElement = inputElement 'we set the next page button
       Exit For
    End If
Next inputElement
inputElement.Click

I have checked and the button is always the right button, no matter the user, so that isn't an issue. I have to loop through the buttons to find the right one because it has no id, name or class.

Any ideas? This one is really baffling to me.




Authorization doesn't work.

2 weeks ago an authorization on all my sites stopped working. There is no record on log file. Looks like a page is just refreshing, but there is no access. Previously, everything worked fine. There alco a console message:

This page includes a password or credit card input in a non-secure context. A warning has been added to the URL bar.

In this time there is an access to CMS site's administration application




Searching Frontend and Backend package Manager for Web Development

in the past i developed web projects that are using the same modules like the database connection class. Now I want to develop these Moduls centralized and then push them to the projects. The Moduls are developed in git repositories and mostly written in php and JavaScript.

In addition to this I want to get some other things like the newest bootstrap or jquery version.

Now I am looking for a package manager for the frontend and the backend where I can get everytime the newest version of the official projects( bootstrap e.g.) and my personal projects.




Cannot find a differ supporting object '[object Object]' of type 'object' , Error in meteor Collections

I am new to angular. I am following Course for angular2. I am trying to make a web application with angular and meteor js.

My browser reporting the error Cannot find a differ supporting object '[object Object]' of type 'object'

I have a mongo collection defined:

import {Mongo} from 'meteor/mongo';
export let Bookmarks = new Mongo.Collection('bookmarks');

And I am using fetching records from the collection in my component.ts file

import { Component } from '@angular/core';
import template from './bookmarklist.html';
import {Bookmarks} from '../../../../collections/bookmarks';
import {Mongo} from 'meteor/mongo';


@Component({
  selector: 'bookmark-list',
  template: template
})
export class BookmarkList {
bookmarks : Mongo.Cursor<Object>;

constructor(){
    this.bookmarks = Bookmarks.find();
    console.log(this.bookmarks);
   }
}

Not sure where is the problem. I can retrieve record from the meteor mongo console...

Meteor Mongo Console




Java - Reading web page after authentication

I've written a code in Java that parses some information from my university's Moodle site. To read the html page i'm using java.net.URL:

URL url = new URL(link);
URLConnection connection = url.openConnection();
InputStream is = connection.getInputStream();

The thing is, the site has an authentication system (using SSL) and even though I've logged in before running the code, it reads the main page (before authentication).

Any ideas how can I fix this thing? Thanks!




What CMS would be best to use to "auto generate" a website?

We've developed a SaaS that allows users to upload content from a dashboard and then make it available in an iOS and Android app.

We would like to extend that to websites to make it easy to get a website up and running.

Now, putting aside any sort of template/CSS etc, what would the best option be for this?

Perhaps creating scripts that installs Wordpress with and developing custom plugins to get content from our SaaS?

We don't want to create our own CMS, since there are so many out there with much better support and security updates etc, which is why I am leaning towards Wordpress.




jeudi 29 juin 2017

Error accessing a Web API which works well using POSTMAN

I'm trying to call a WEB API and get a JSON output using the following code.

I have tested this using POSTMAN, and it works fine. There are two values in the header and some more in the body for the POST Request.

But when I tried using the Apache HTTP Client to access the same WEB API I get the following output and error:

Response Code : 200
Result:{"errorCode":3000,"errorMessage":"Invalid request parameters"}

Code:

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.message.BasicNameValuePair;


public class WhiteSourceAPI {

public static void main(String[] args) {

    try {
        String url = "http://ift.tt/2uqlh9E";

        HttpClient client = HttpClientBuilder.create().build();
        HttpPost post = new HttpPost(url);

        //header
        post.setHeader("Content-Type", "application/json");
        post.setHeader("Accept-Charset", "UTF-8");

        List<NameValuePair> urlParameters = new ArrayList<>();
        urlParameters.add(new BasicNameValuePair("requestType", "getProjectLibraryLocations"));
        urlParameters.add(new BasicNameValuePair("projectToken", "8d7670d9-a872-4799-bdaf-0be814f56003"));

        post.setEntity(new UrlEncodedFormEntity(urlParameters));

        HttpResponse response = client.execute(post);
        System.out.println("Response Code : " + response.getStatusLine().getStatusCode());

        BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));

        StringBuilder result = new StringBuilder();
        String line = "";
        while ((line = rd.readLine()) != null) {
            result.append(line);
        }
        System.out.println("Result:" +result);
    } catch (IOException ex) {
        Logger.getLogger(WhiteSourceAPI.class.getName()).log(Level.SEVERE, null, ex);
    }
}
}




c# - autofill program, how can i autofill select tag in browser? select box?

I recentely want to make auto-typing, auto-fill exploer browser, using windows program with c#.net programming.

I can autytype in text type but i cannot autotype the 'select tag'.

I searched and i thinki i can use 'setAttribute("value","selectIndexnumber")' but, i didn't work well. Explorer does not perceive the 'onchange' state.

So first, I used IHTMLElement3.FireEvent("onchange",null); to invoke 'onchange'

but it didn't work, too.

and Secondely, I used SendKeys.Send("{TAB}");

but it didn't work, too.

how can i autofill the 'select tag' well with no problem like user changed the select tag?

please help me.. thanks in advance!

below is the code that i wrote.

private void button3_Click(object sender, EventArgs e) {

        SHDocVw.InternetExplorer browser;            

        SHDocVw.ShellWindows shellWindows = new SHDocVw.ShellWindows();
        string filename;
        MessageBox.Show("shellWindows number is " + shellWindows.Count);
        foreach (SHDocVw.InternetExplorer ie in shellWindows)
        {
            filename = System.IO.Path.GetFileNameWithoutExtension(ie.FullName).ToLower();
            if ((filename == "iexplore"))
            {
                browser = ie;

                String myDocURL = browser.Document.url;
                MessageBox.Show("this is url" + myDocURL);
                if (myDocURL == "http://ift.tt/2twfu5U")
                {
                    IHTMLDocument3 ihtml3doc = (IHTMLDocument3)browser.Document;
                    IHTMLElement3 ihtml3ele = ihtml3doc.getElementById("jobnoticeSn") as IHTMLElement3;
                    IHTMLElement ihtmlele = ihtml3doc.getElementById("jobnoticeSn");
                    ihtmlele.setAttribute("value", "4");
                    IHTMLSelectElement selEle = ihtml3ele as IHTMLSelectElement;


                    //selEle.selectedIndex=4;


                    SendKeys.Send("{TAB}");
                    ihtml3ele.FireEvent("onchange", null);
                    //SendKeys.Send("{TAB}");
                    ihtml3doc.getElementById("jobnoticeSn").children(4).setAttribute("selected", "true");
                    SendKeys.Send("{TAB}");
                    //ihtml3doc.getElementById("jobnoticeSn").children(4).setAttribute("checked", "true");
                    //ihtml3doc.getElementById("jobnoticeSn").children(4).setAttribute("selectedIndex", "true");


                    //ihtml3doc.getElementById("jobnoticeSn").setAttribute("selected", "selected");

                    //ihtml3doc.getElementById("jobnoticeSn").setAttribute("value", "8130");
                    ihtml3doc.getElementById("name").setAttribute("value", "김준혁");
                    ihtml3doc.getElementById("birthday").setAttribute("value", "1989-11-18");
                    ihtml3doc.getElementById("man").setAttribute("checked", "true");
                    ihtml3doc.getElementById("email").setAttribute("value", "jjunest@gmail.com");
                    ihtml3doc.getElementById("password").setAttribute("value", "emfla248248");


                    //ihtml3doc.getElementById("password").scrollIntoView();


                }                    
            }
        }
    }




Bet365 website is not working

I'm trying to add bet365.com UI to my desktop application, but the site is not show up!

I tried:

  • IE,
  • Chrome,
  • Firefox

Im running Windows Server 2012. I tried HMA VPN to change my IP location, changed DNS, nothing works.

Any help please!

Browsers screenshots below.

IE

And Chrome




How to configure log4j?

I have a following project structure:

project structure

XML file log4j.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <Configuration>
        <Appenders>
            <Console name="STDOUT" target="SYSTEM_OUT">
                <PatternLayout pattern="%-5p | %d{yyyy-MM-dd HH:mm:ss} | [%t] %C{2} (%F:%L) - %m%n"/>
            </Console>

            <File name="FILE" fileName="C:/Users/...bla-bla-bla.../WebProject/logs/error.log">
                <PatternLayout pattern="%-5p | %d{yyyy-MM-dd HH:mm:ss} | [%t] %C{2} (%F:%L) - %m%n"/>
            </File>

            <File name="INFO" fileName="C:/Users/...bla-bla-bla.../WebProject/logs/info.log">
                <PatternLayout pattern="%-5p | %d{yyyy-MM-dd HH:mm:ss} | [%t] %C{2} (%F:%L) - %m%n"/>
                <Filters>
                    <ThresholdFilter level="error" onMatch="DENY" onMismatch="NEUTRAL"/>
                    <ThresholdFilter level="warn" onMatch="DENY" onMismatch="NEUTRAL"/>
                    <ThresholdFilter level="fatal" onMatch="DENY" onMismatch="NEUTRAL"/>
                    <ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
                </Filters>
            </File>
        </Appenders>

        <Loggers>
            <Root level="info">
                <AppenderRef ref="FILE" level="error"/>
                <AppenderRef ref="INFO" level="info"/>
            </Root>
        </Loggers>
    </Configuration>

In build path I have added log4j 1.2 jre

In code, when I try to write info

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

        log.info("User successfully logged in");

Default log:

        INFO: User logged in

Why does not this message appear in file or in pattern view in console?

Are additional settings required in Eclipse?




Submit Password Not In Clear Text

I have this login webpage where I am using primeface to develop.

So when I entered my password and submit over the network, my firebug (Firefox extension) can actually capture my password in clear text. Which means to say that my password is transmitted over the network in clear text.

Correct me if I am wrong. So how to I not make password not transmit in clear when I click on the submit button?




H5 page in IE browser display problems

H5 page in IE browser display, at the edge of the page will display gray box.How to get rid of the black border at the edge of the page?

h5 page in ie browser display problems




How to add parameters in a function on a AddEventListener

Im trying to create a Web mapping application with some layers, the idea its that i have some checkboxes and when i click them the layer is added or removed (i have already done that) but there are a lot of layers and of course a lot of code, i realize that with a function i can do the work, but after hours and hours of work it still doesnt work an im ready to give up:

function turnon(idlayer, layer) {
  var local = document.getElementById(layer);//verify whick checkbox is the one for the layer
  if (local.checked == true) {
    map.addOverlay(layer);//an OpenLayers method to add the layer to the map
  } else {
    map.removeOverlay(layer);
  }
}
var wmsSector=document.getElementById('sector')//This is the checkbox
wmsSector.addEventListener("click", turnon);

The thing its that i dont know how to add the parameter on the addEventListener Handler i have tried this:

wmsSector.addEventListener("click",turnon('wmsSector',sector))

i appreciate any help u can give me, cause right know the application works but i believe it can be more elegant.

Thanks




Perform actions on a website in background

So I want to know how I can automate things like this on a specific website:

  • Login
  • Get Website Data
  • Check Login Status

Which program language used is not important, but it would be neat if it was C#, Java or JavaScript.

I don't exactly search for a solution for everything - I just want to know the basics, so that I know where to start.

Ty for every answer :)




How to host a website on a web server for clients to connect to the site

I am trying to host my website for streaming some videos on my website for clients to connect to it. I need to know as to how I can enable clients to access the website. What constraints do I need to take into consideration?

Thanks in advance!




What is wrong with my code?

I have this exercise about writing a javascript code which takes as input 2 numbers from a form. The first number should have only one digit. It has to show how many times is the first number repeated in the second one.

I have written this code and it doesn't work. Can someone please help me find what is wrong here?

<html>
<head>
<title>Vektor</title>
<script type = "text/javascript">

function validate(num){
if(num>1){
if(num<9){
return true;
}
}
return false;
}

function calculate(){
var n1, n2;
n1 = numra.nr1.value;
n2 = numra.nr2.value;
nr = parseInt(n1)
if(validate(nr)){
var count = 0;
for (int i = 0; i<n2.length; i++){
var n = n2.charAt(i);
if(n1==n){
count++;
}
}
numra.heret.value = count;
}
else{
alert("Gabim");
}
}

</script>
</head>
<body>
<form name = "numra" onsubmit = "calculate()">
<input type = "text" name = "nr1"><br>
<input type = "text" name = "nr2"><br>
<input type = "submit" name="llogarit" value = "llogarit"><br>
<input type = "text" name = "heret">
</body>
</html>




What's the best language to create a scalable Application (Desktop, Web and Restful Api)

I want to start a project and thinking in advance which language is the best in order to create an Website, Desktop Application and also a RestFul API.

Let's say I want to code everything in the same language.




Pass a variable from child Page_Load to base Page_Load in ASP.net

I'm trying to do something similar to below. I have to web pages that inherit from a base class. I want to know which child page was loaded in the base Load_Page function.

public partial class MyClass : MyClassCore
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string someVar = "whatever";
        Base.Page_Load();
    }
}

public partial class MyClass : MyClassCore
{
protected void Page_Load(object sender, EventArgs e)
    {
        if (someVar == "whatever")
            doStuff();
    }
}




Which P Language should I learn if: Prio1. Easy 2. scripts/automate for mac 3.Gather web info and compile it.

As a semi-moron I would like to draw on your vast experience in deciding what language/ program to learn with the following priorities: 1. Easy and no bullshit (not something that is so simplified it makes no sense, ex powerpoint, mac numbers) 2. Can create scripts or automate complex actions involving different programs on mac 3. Can a. gather and b. compile open information from the web, sometimes for use in 2. Kind Regards Mr 123 Asdf




Show/hide elements based on a selected option

I'm currently working on a website (I'm new to HTML, CSS, JavaScript and I haven't worked with JQuery) and I made a form in which users can select the type of candy they want from a list:

<form class="form-horizontal" method="POST" enctype="multipart/form-data">
        <div class="form-group">
            <label for="selectCandy" class="control-label col-sm-0"></label>
            <div class="col-sm-4">
                <select class="form-control" id="selectC">
                    <option id="candy1" onclick="document.getElementById('noCandy1').style.display='block'; return false;">Lollipop</option>
                    <option id="candy2" onclick="document.getElementById('noCandy2').style.display='block'; return false;">Haribo Gummies</option>
                    <option id="candy3" onclick="document.getElementById('noCandy3').style.display='block'; return false;">Gum</option>
                </select>
            </div>

The idea is that when they select the type of candy, a new form will appear, allowing them to choose the amount of candy they want. The amount of candy they can select is different depending on the product. For instance, if the choose 'Lollipop' they can select from 1 to 6; if they choose Haribo, they can only select from 1 to 2. Here's the code for that:

<div id="noCandy1">
        <select class="form-control">
            <option>1</option>
            <option>2</option>
            <option>3</option>
            <option>4</option>
            <option>5</option>
            <option>6</option>
            </select>
        </div>
<div id="noCandy2">
        <select class="form-control">
            <option>1</option>
            <option>2</option>
            </select>
        </div>
<div id="noCandy3">
        <select class="form-control">
            <option>1</option>
            <option>2</option>
            <option>3</option>
            <option>4</option>
            </select>
        </div>

As I stated before, I'm new to all of this, and I'm not sure if I should add some JavaScript or if it would be possible to do this by using CSS. My problem is that the divs that are supposed to appear when an option is chosen are displayed all the time. What can I do for a div to appear only when one of the options of the previous form is selected? Thank you very much!




cannot import name 'Flask'

Im using window 10, I did the command pip install flask but I kept getting a ImportError: cannot import name 'Flask'. When I worked with flask couple months back it was running fine. Came back to run my old programs today and i get this error? I was just trying to run a simple html website.

from flask import Flask, render_template
from flask import request

app = Flask(__name__)

app.static_folder = 'static'

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

return render_template('index.html')


if __name__=='__main__':
app.run(debug = True)

Also before this error I had No module named 'Flask' so I did(found this in other stackoverflow post): 1. virtualenv 2. pip install flask (getting output that requirements are already satisfied) 3. Then I just try to run my flask which is called i.py and I get cannot import name 'Flask'. Went through many solutions on here still no idea how to fix it.




JSF, PrimeFaces: bind user input to a field without using a button

I have an input text field in my web app where the user can type in some words. I want to be able to save that input into a variable in my bean without using an action command from a button. Ideally it would be a field that keeps a running track of what the user is entering and saving it in a variable.




Firebase Web - Updating Multiple Fields?

I have the following code where I want to update some simple values in my Firebase database using the Javascript, Web SDK.

However, it doesn't run/update my database. Whats wrong here? Thanks.

    var dbRef = firebase.database().ref().child('feeds').child(selectedFeed).child('audio');
    var uid = dbRef.push().key;

    var data = {
      "downloadURL": uploadTask.snapshot.downloadURL,
      "fileName": file.name,
      "timeStamp": selectedDateUnix
    };

    var updates = {};
    updates["mostRecentKey"] = uid;
    updates[uid] = data;

    dbRef.update(updates).then(function(){
      //success
      alert("Successfully Uploaded. This is now available to be listened to by your users.");

    }).catch(function(error){
      //failure
      alert(error.message);

    });




How to create editable pdf to be filled by user?

I have a pdf which is editable. I need to show this in my website and let the user edit it and save the edited version so that it can be used again for editing more fields and saving again. Any help would be appreciated.




On Clicking a textbox in webpage text on page hide and then show ( flickers)

I am working on a website: http://ift.tt/2sqX3e4

I have created a textbox, in which if I enter something, character count will be calculated via Jquery and get displayed in place of default character count.

I as soon as I click inside textbox everything on page kind of flickrs, No Idea why this is happening.

Any pointer will be really appreciated.




The operation has timed out ~ System.Net.WebException: The operation has timed out

The operation has timed out ~ System.Net.WebException: The operation has timed out at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context) at System.Net.HttpWebRequest.GetRequestStream()

doing a load testing of http server with multiple requests per second. after few hundred successful requests and responses, new request get stuck and after the timeout value is achieved(timeout = 30 second) request timeout exception is thrown. all the solutions i found was regarding closing the stream properly which I hope I am doing. Any help on resolving the timeout problem would be appreciated. thanks.

  using (System.IO.Stream requestStream = client.GetRequestStream())
  {
                    requestStream.Write(content, 0, content.Length);

                    requestStream.Close();

                }




What methods are there for authenticating Internet users to INTRANET resources?

I've inherited an Apache server housing a Wordpress instance. On the wordpress instance we have the typical 'we are/we do/we awesome/contact us' content. I've been asked to setup another area on the website for an Intranet site with the typical employee forms, CEO blog, etc, type content.

Normally I'd just setup an internal webserver on the LAN for this, however I've been told that employees need to be able to login and view this content from the Internet as well (because everyone wants to think about work things from the comfort of their own home).

My first thought is just redirect based on the incoming IP address; if it's from the LAN, straight to the content. If it's from the Internet, redirect to a login page first. Then I got to thinking about sessions and cookies and browser cache and realized this problem must have been solved already. No, VPN is not going to fly as it's "too hard"

What's the best way to authenticate a user to access Intranet content from the internet?




Python URL TypeError: 'str' object is not callable

I am trying to write a small web request program to get some of the popular Instagram users (this is python 3).

final_list = [];
for idx in range(1, 5, 1):
    url = "http://ift.tt/2fpFTHU" + str(idx) + "f"; # idx is for page number
    print(url);
    headers = {...omitted header details...};
    req = urllib.request.Request(url, None, headers);
    with urllib.request.urlopen(req) as f:
        str = f.read().decode('utf-8');
    initial_list = re.findall(r'target=\"_blank\">([^<]+?)</a>,', str);
    for item in initial_list:
        final_list.append(item);

The first iteration works well (and I am able to get the users on the first page), however on the second iteration, I am encounting the following error:

Traceback (most recent call last):
  File ".\web_search.py", line 8, in <module>
    url = "http://ift.tt/2fpFTHU" + str(idx) + "f";
TypeError: 'str' object is not callable

Could you please let me know what might caused the problem, tried to debug but couldn't resolved it. Thanks!




Python: search for html tag starting with characters

I am using the following code to find a tag with class "product-category".

soup0.findAll("a",{"class":"product-category"})

How do i write if I need to find a tag whose class starts with product-category. I tried using

soup0.findAll("a",{"class":%"product-category"}) ##This doesnt work.

Is there any way?

Thanks,




Get username from ActiveXObject("WScript.Network") not working?

I need a way to get a User's name from a web application that will be used in FireFox, Chrome, and IE. I have a javascript function in my code that is the onclick function for a button. The button is supposed to show an alert with the user's name. For some reason this is not working in my code. I am debugging in Visual Studio 2015, and I have opened VS as an administrator. I am attempting to run this code in Firefox and IE and nothing shows up. Is there another way to do this? Am I doing this wrong?

My HTML Code

<button onclick="getUser()">GET USER</button>
<script>
function getUser() {
    var net = new ActiveXObject("WScript.Network");
    alert(net.username);
}
</script>




C# Open a web link and wait for a generate file to download

I try to download a PDF file from a Tech File Web Generator in C#. If I use WebCLient, I download the source of the page and not the PDF that will be generated.How I can wait for the generate file and download it?

This is the link




Web Api routing issue when getting a special character

I have some issue with my code.

my api server How do I make a get specific request on the last items?

Do you have any ideas?




preserve unlimited pagination after entering it's item

I'm looking for solution to keep previously loaded items (a lot of items) in pagination which is like "LOAD MORE ELEMENTS" (accumulated feed). Entering some item in this list will not return me back to this big bunch of items back.

I've seen a lot of sites, which implement this, but can't reverse engineer it ( due to lack of frontend skills.

What is the key feature of solving this problem? (angular or jquery way).




Deploying JAR application with JNLP when JAR contains dependencies(Jars)

I have an in house Java application that we need to distribute through a web page. So I compressed the app in a .jar file and included all the dependencies (like miglayout15-swing.jar). I have about 15 dependencies.

Now I'm wondering if this is the right approach. Cause when I create my JNLP file and include the resources, it seems to be looking for the jar files outside my main jar file and not inside.

Should the right approach be to put the dependencies in a /lib folder next to where my main app jar is locates? And the users would be downloading my main jar and all the dependencies separately ? Here's my JNLP

    <resources>
    <java version="1.6+"/>
    <jar href="../jsps/Applet/ACFUtility.jar" main="true" />
    <jar href="org.eclipse.ui.workbench_3.105.1.v20130821-1411.jar"/>
    <jar href="swingx-1.6.1.jar"/>
    <jar href="org.eclipse.ui.forms_3.6.1.v20130822-1117.jar"/>
    <jar href="org.eclipse.text_3.5.300.v20130515-1451.jar"/>
    <jar href="org.eclipse.swt.win32.win32.x86_3.102.1.v20130827-2048.jar"/>
    <jar href="org.eclipse.osgi_3.9.1.v20130814-1242.jar"/>
    <jar href="org.eclipse.jface_3.9.1.v20130725-1141.jar"/>
    <jar href="org.eclipse.jface.text_3.8.101.v20130802-1147.jar"/>
    <jar href="org.eclipse.equinox.registry_3.5.301.v20130717-1549.jar"/>
    <jar href="org.eclipse.equinox.common_3.6.200.v20130402-1505.jar"/>
    <jar href="org.eclipse.core.runtime_3.9.0.v20130326-1255.jar"/>
    <jar href="org.eclipse.core.commands_3.6.100.v20130515-1857.jar"/>
    <jar href="forms-1.3.0.jar"/>
    <jar href="miglayout15-swing.jar"/>
    <jar href="com.ibm.icu_50.1.1.v201304230130.jar"/>

</resources>

App Jar Content




Matching function using PHP

So here is the deal:

I got this school project, a dating site. I just can't figure out a way to match users to each other. The users have a favourite music genre stored in the database and they need to be matched with each other

Example: user1 clicks matching button, php matches him to another user with the same favourite music genre and writes that somehow to the database.

My best guess is for both users a row named "match" wich has both their user id's stored.

I'm not quite sure.

Does someone know a way?




web.py: static files load slow & ajax post in pending state: provisional headers are shown.

I use web.py as my sever. I encountered a problem , if i refresh the page using 'ctrl+F5' for severl times(disable cache), the css & js static files will load so slow. What's more, the request will result in

Request Headers
Provisional headers are shown
Referer:http://10.1.1.56:8081/
User-Agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.109 Safari/537.36

Many posts will be in a pending state, the page will become really solw. After long time, the page will be ready(almost 8 minutes). The chrome://net-internals events shows in the following.

t= 0 [st= 0] +REQUEST_ALIVE [dt=30144]
--> has_upload = false
--> is_pending = true
--> load_flags = 33026 (BYPASS_CACHE | MAYBE_USER_GESTURE | VERIFY_EV_CERT)
--> load_state = 15 (WAITING_FOR_RESPONSE)
--> method = "GET"
--> net_error = -1 (ERR_IO_PENDING)
--> status = "IO_PENDING"
--> url = "http://ift.tt/2u1Yfq8"
t=30143 [st=30143] -HTTP_STREAM_PARSER_READ_HEADERS
t=30143 [st=30143] HTTP_TRANSACTION_READ_RESPONSE_HEADERS
--> HTTP/1.1 200
ETag: "1498156243.54"
Content-type: application/javascript
Content-Length: 3081
Last-Modified: Thu, 22 Jun 2017 18:30:43 GMT
Date: Wed, 28 Jun 2017 22:58:20 GMT
Server: localhost
t=30143 [st=30143] -HTTP_TRANSACTION_READ_HEADERS
t=30143 [st=30143] HTTP_CACHE_WRITE_INFO [dt=1]
t=30144 [st=30144] HTTP_CACHE_WRITE_DATA [dt=0]
t=30144 [st=30144] HTTP_CACHE_WRITE_INFO [dt=0]
t=30144 [st=30144] URL_REQUEST_DELEGATE [dt=0]
t=30144 [st=30144] -URL_REQUEST_START_JOB
t=30144 [st=30144] URL_REQUEST_DELEGATE [dt=0]
t=30144 [st=30144] HTTP_TRANSACTION_READ_BODY [dt=0]
t=30144 [st=30144] HTTP_CACHE_WRITE_DATA [dt=0]
t=30144 [st=30144] URL_REQUEST_JOB_FILTERED_BYTES_READ
--> byte_count = 2920
t=30144 [st=30144] HTTP_TRANSACTION_READ_BODY [dt=0]
t=30144 [st=30144] HTTP_CACHE_WRITE_DATA [dt=0]
t=30144 [st=30144] URL_REQUEST_JOB_FILTERED_BYTES_READ
--> byte_count = 161
t=30144 [st=30144] HTTP_TRANSACTION_READ_BODY [dt=0]
t=30144 [st=30144] HTTP_CACHE_WRITE_DATA [dt=0]
t=30144 [st=30144] -REQUEST_ALIVE

What's wrong with web.py?

I have tried different computers. Some even cannot send the ajax post. All the posts were in a pending state. And it shows in F12: provisional headers are shown.




Html Css change Date input highlight color

I have an input of type date in my page and I want to change the color of the highlight inside of it and I don't know if there are css selector for that.

Here's an image of what i'm talking about :

enter image description here

Thank you for your concerned! :)




Suggestions for improving Keyword ranking for the site

please help me to optimize the website Dream flower. We are actually getting backlinks but there is no improvement in Keyword ranking please tell me if there any website errors or any other issues. Suggestion please




Get all available values of @RequestMapping from controller in filter

Hello to everybody.
I am writing an application using java and Spring MVC. My scope is that my URL would contain language smth like http://localhost:8080/School/en/xxx/... . In my application I use next code:

controller-servlet.xml

<bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver"/>

web.xml

<filter>
    <filter-name>URLFilter</filter-name>
    <filter-class>filter.URLFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>URLFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

Filter

public void doFilter(ServletRequest hsRequest, ServletResponse hsResponse, FilterChain filterChain) throws IOException, ServletException {
    final HttpServletRequest request = (HttpServletRequest) hsRequest;
    final HttpServletResponse response = (HttpServletResponse) hsResponse;

    String servletPath = request.getRequestURI().substring(request.getContextPath().length());
    List<String> langList = new ArrayList<String>();
    langList.add("/it/");
    langList.add("/en/");
    for (String lang : langList) {
        if (StringUtils.startsWithIgnoreCase(servletPath, lang)) {
            filterChain.doFilter(hsRequest, hsResponse);
            return;
        }
    }
    String string = request.getContextPath() + "/en".concat(servletPath);
    response.sendRedirect(string);
}

Interceptor: public class LangInterceptor extends HandlerInterceptorAdapter {

@Autowired
SessionLocaleResolver sessionLocaleResolver;

@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
    String language = request.getServletPath().substring(1, 3);
    Locale locale = new Locale(language);
    sessionLocaleResolver.setLocale(request, response, locale);
    return true;
}

I suppose next behavior:
1. User introduces URL like: "httр://localhost:8080/School/" - filter doesn't find any "/it/" or "/en/" and add by default "/en/" than redirect to httр://localhost:8080/School/en/ where next time will find that is OK.
2. User introduces URL like: httр://localhost:8080/School/add - filter doesn't find any "/it/" or "/en/" and add by default "/en/" after redirect to httр://localhost:8080/School/en/add where find such URL that is OK.
3. User introduces URL like: httр://localhost:8080/School/en1/add - filter doesn't find any "/it/" or "/en/" and add by default "/en/" after redirect to httр://localhost:8080/School/en/en1/add where doesn't find such URL and redirect to 404.jsp that is NOT OK.
So before redirect I need to verify what follows in url after "/en"/, so I need a list of values of @RequestMapping of @Controller. I tried to use "RequestMappingHandlerMapping" but it is impossible because at filter level beans are not initialized.
Can anybody recommend how can solve this problem ?




Are try-catch meant to prevent or handle errors? (in javascript)

Recently I had a discussion with my coworker, about using try and catch to notify errors or avoid them.

This is my coworker's approach:

import Config from 'config';

export const getUserFromLocalStorage = () => {
  const key = Object.keys(localStorage).find(value => value === `${Config.applicationId}/currentUser`);

  try {
    return key ? JSON.parse(localStorage[key]) : {};
  } catch (e) {
    return {};
  }
};

Wich means, he doesn't care about the given error and he is just carrying of returning an object in order to continue the process

and mine is:

import Config from 'config';

export const getUserFromLocalStorage = () => {
  const key = Object.keys(localStorage).find(value => value === `${Config.applicationId}/currentUser`);

  try {
    return key ? JSON.parse(localStorage[key]) : {};
  } catch (e) {
    alert('something went wrong!'); // Just simple notifier for this example
    console.log('the given error', e); // Just simple notifier for this example
  }
}; 

but my approach, still has a problem which is that it will return undefined (which can crash internaly my app), that can easily fix it using finally and returning a default value but it doesn't sound a good practice to me.


THE QUESTION

So what will the balance using try catch and finally if needed, to make my application stable.
Is there something wrong with our approach?
In particular, we can't trust the data that is comming from the localStorage, so what will be the best approach for this implementation?




How can we implement PWA (Progressive Web Apps) in a Wix site?

I have this wix site and want to implement PWA in it. I'm not sure if we can implement PWA in a wix site.




How to create file transfer web app

I am new in programming, how i can create web application for securer file transfer protocol? I am using visual studio or Dreamweaver, i didn't try any idea, any one can help me to start?




mercredi 28 juin 2017

Python Flask Varying session life time

So I know what sessions are. I know how to make them permanent and how to edit their lifetime. But im making a website that has users. I want to make a remember me button, but I don't know how to proceed. The problem is that I want to make it so that only the
session['loggedin'] is affected. BUT i dont know how to affect the lifetime of only certain sessions. here are 2 ways i know to make ALL sessions permanent. app.config['PERMANENT_SESSION_LIFETIME'] = 1200 and

@app.before_request def make_session_permanent(): session.permanent = True

ps I CANNOT USE FLASK LOGIN. I am using a web hosting service that does come pre installed with flask but does not take (pip) installing modules well.




jwt key is invalid

I am following this example https://www.youtube.com/watch?v=eVlxuST7dCA to make a jwt auth. When I run the code below I get "Key is invalid" error. WHen I try printing tokenString it is empty. The github to this sample is http://ift.tt/2ukAvwZ Why am I getting invalid error?

var privateKey []byte
privateKey, err := ioutil.ReadFile("demo.rsa")

token := jwt.New(jwt.GetSigningMethod("RS256"))
tokenString, err := token.SignedString(privateKey)

fmt.Println("TOKEN:", tokenString)




index.html file for all request in jboss

How to tell Jboss to serve index.html file for all URL patterns? for example domain.com/ => index.html, domain.com/queries => index.html, http://ift.tt/2tmiQbo => index.html.

The application is single page application and the routing is handled in the UI but there are cases when user click on refresh button while their are in different page than home page (root) they get JBWEB000065: HTTP Status 404.

What I'm trying to achieve is domain.com/* => index.html

Any help here?




Domino web service provider limitation

I'm implementing a domino web service provider, whose purpose is to stream from the base64 format, which in the client that consumes the web service is an attachment file, transform it back into a file. In the web service provider that is developed in java, I use the Stream class and the Mime classes to, to convert the stream and file. The web service provider works well for files up to 5 MB, for larger files the error as technote is displayed. Has anyone had this problem yet? Is there any way around it?

Here is the code for the web service provider

public class criaAnexo {
private Vector itemsToRecycle;
public void attachDocument( byte[] is) {

    // creating the output stream used to create the MIME attachments
    try
    {
        System.out.println("OK 0");
        itemsToRecycle = new Vector(); 
        Session session = NotesFactory.createSession();
        Database db = session.getDatabase("Snmb04/Mercantil do Brasil", "MB_Web_Services_NTS_AgendamentoParceiro.nsf");
        if (!db.isOpen())
            System.out.println("names2.nsf does not exist on snapper");
        else
        {
            Stream outStream = session.createStream();
            System.out.println("OK 1");
            outStream.write(is);
            System.out.println("OK 2");


            session.setConvertMIME(false);

            // create the MIME body
            Document doc = db.createDocument();
            doc.replaceItemValue("Form", "formAttachment");
            MIMEEntity body = doc.createMIMEEntity();


            // create a child for each attachment<br/>
            MIMEEntity child = body.createChildEntity();

            // find the fileSuffix<br/>
            //String fileSuffix = files[i].substring(files[i].lastIndexOf(".")+1);
            String fileSuffix = "pdf";


            // set the child to the outstream using a mapped MIME type<br/>
            // MIME type mapping see: http://ift.tt/1mOwCIh

            //child.setContentFromBytes(outStream, mapMIMEType(fileSuffix), MIMEEntity.ENC_IDENTITY_BINARY);

            child.setContentFromBytes(outStream, "application/pdf", MIMEEntity.ENC_IDENTITY_BINARY);

            System.out.println("OK 3");
            // set name for file attachment<br/>
            MIMEHeader header = child.createHeader("Content-Disposition");
            header.setHeaderVal("attachment; filename=\"teste.pdf\"");

            System.out.println("OK 4");
            // set unique id for file attachment to be able to refer to it<br/>
            header = child.createHeader("Content-ID");
            header.setHeaderVal("teste.pdf");

            //outStream.truncate();
            //outStream.close();
            outStream.close();
            Runtime rt = Runtime.getRuntime(); 
            long total_mem = rt.totalMemory(); 
            long free_mem = rt.freeMemory(); 
            long used_mem = total_mem - free_mem; 
            System.out.println("Total de Memória:"+total_mem); 
            System.out.println("Total de Memória livre:"+free_mem);
            System.out.println("Total de memoria usada pelo agente: " + used_mem/1048576);  


            doc.save( true, true );
            itemsToRecycle.add(doc);
            session.recycle(itemsToRecycle); //recycle all items added to vector 
            session.recycle();

        }



    }
    catch(Exception e)
    {
    }
}

}




please help me, how to analyze this response message body?

HTTP/1.1 200 OK Cache-Control: private Content-Type: text/plain; charset=utf-8 Vary: Accept-Encoding Server: Microsoft-IIS/7.5 X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET Date: Wed, 28 Jun 2017 08:51:55 GMT Content-Length: 48

AAABAAAAAQAAAAEAAAABAAAABQcAOTQ3NzE4OajJOxYAAAAA

access http://ift.tt/2uk5Rns, get this response message,next acess http://ift.tt/2tmUXjI. I don't know how to analyze 'AAABAAAAAQAAAAEAAAABAAAABQcAOTQ3NzE4OajJOxYAAAAA'




When should you create a new directory, rather than a file?

Suppose, for example, you have a website which has a user log in functionality. With respect to the root directory, would you host this page as login.php or /login?

What about a "Contact Us" page? Would you host this as contact.php or /contact?

Is there a general rule of thumb as to when to host a page directly in the root directory, and when to host it in its own sub-directory?




How to make website able to handle N javascript games at the “same time”?

I am creating very simple web page for chess game written on Javascript. My instructor wants me to have 3 groups that could visit my site and play my online game. I am absolutely nub and actually thought that webpage can handle it by default but apparently it can not. Please advice me some tutorials that would help me understand how to achieve that.




selenium, webdriver.page_source not refreshing after click

I am trying to copy a web page's list of addresses for a given community service to a new document so i can geocode all of the locations in a map. Instead of being able to get a list of all the parcels I can only download one at a time and there are 25 parcel numbers limited to a page. As such, this would be extremely time consuming.

I want to develop a script that will look at the page source (everything including the 25 addresses which are contained in a table tag) click the next page button, copy the next page, and so on until the max page is reached. Afterwards, I can format the text to be geocoding compatible.

The code below does all of this except it only copies the first page over and over again even though I can clearly see that the program has successfully navigated to the next page:

# Open chrome
br = webdriver.Chrome()

pg_src = br.page_source.encode("utf") 
soup = BeautifulSoup(pg_src)

max_page = 122 #int(max_page)

#open a text doc to write the results to

f = open(r'C:\Geocoding\results.txt', 'w')

# write results page by page until max page number is reached

pg_cnt = 1 # start on 1 as we should already have the first page
while pg_cnt < max_page:
    tble_elems = soup.findAll('table')
    soup = BeautifulSoup(str(tble_elems))
    f.write(str(soup))
    time.sleep(5)
    pg_cnt +=1
    # clicks the next button
    br.find_element_by_xpath("//div[@class='next button']").click()
    # give some time for the page to load
    time.sleep(5)
    # get the new page source (THIS IS THE PART THAT DOESN'T SEEM TO BE WORKING)
    page_src = br.page_source.encode("utf")
    soup = BeautifulSoup(pg_src)

f.close()




What beginner Cloud/Web Application platform should I deploy on?

This is my first dynamic web project. In an eclipse project I currently have:

  • a HTML and CSS file.
  • a JS file which sends ajax request.
  • a Java servlet which receives the requests and queries a local MySQL DB.
  • a local MySQL DB which stores user info and important tables.
  • a Tomcat server for testing.

Everything works well on my local Tomcat server and MySQL DB, and I want to deploy it to a cloud platform, but I'm stuck. After messing around with Google Apps and Microsoft Azure and watching lots of tutorials, I can't figure out how to get everything up and running.

What cloud/web platform should I be using as a beginner? Are there any useful resources that people can point me to? Should I be using a web framework like Node.JS?

Also I have a domain name and am a student for student licences.




Redirect subdomain with subdirectory

I apologize if this has been asked before, but I couldn't find any relevant info (I found one post that was redirecting all subdomains, but I only need the one).

I need to setup a redirect for http://ift.tt/2tm4Gam to http://ift.tt/Yngarb

How should I go about setting this up using apache? Thanks for any help in advance.




When should e use flexible web design and when not

CSS allows one to define many attributes related to the presentation of a web application, such as background color, font families used and so on.

But these same elements may as well not be defined at all and, then, the web browser chooses defaults for them, defaults which are flexible and easily changeable by each individual user.

This allows for a flexible approach as, then, any user can easily change the background color, text color, font family and even font size for the website and configure them manually to their liking.

As such, would it be considered a good design choice to allow the user to customize a website to their liking instead of forcing one onto them. For example, if a user is visually impaired, wouldn't it be preferable if he/she could change the color schemes to increase the contrast, maybe even increase the font size too?

I heard that there already are many people who believe using "em" units to define font sizes is better than "px" units, just because the user can then increase the size of the text as they wish.

Would this flexibility be considered user-friendly or too ambiguous as it obviously creates discrepancies between the look between different browsers? Is focusing on a concrete design to ensure a proper consistent look more important than flexibility?




How can I hide some elements from a select list?

I am new to programming and I would like to know how to hide some options from a select control I have... I am going to explain the thing: So, i have two select controls.. according to the option from the select number 1, I want to hide some items from the second select, but I don't know how to do it, I was trying with some jQuery .hide but it is not working... Hope you can help me... Thank you




GET rest api fails at client side

Suppose client call server using GET API, is it possible that server send a response but client misses that response??

If yes how to handle such situation, as I want to make sure that client receives the data. Is sending second REST call by client as ack of first call works??




Looking for a SaaS task scheduler

I am looking for a cloud-based SaaS task scheduler. One that I can access via an API to create scheduled jobs, perhaps by specifying a cron expression or similar. The task scheduler would only need to call an http endpoint at the scheduled time.

Does such a thing exist? I see Azure has it (Azure Scheduler), but the pricing seems pretty high: c. $0.04 per scheduled job, which would rack up costs if we are looking at tens of thousands of jobs...

Cheers SO!




How to point the website to a particular Folder in IIS

I am a beginner in web development. I am not sure how to tell the website to point to a particular folder in IIS. I have ASP.Net MVC - 5 Web Application.

Step 1. Bought a domain/url.

Step 2. Bought a server with IP Address (Windows Server).

Step 3. Pointed the url to the Server's IP Address..

Step 4. Have locally published my webapp code from visual studio. And now I need to paste this code on the server.

Question 1. Now where do I need to put the code in server so that the IIS will host it and anyone visiting that website will hit that folder which has all my website code. I am a beginner please guide me.

Question 2. In future I will put another web site code too on that same server, let's say the URL for new web app is xyz.com. How to tell xyz.com to go to the other folder dedicated for it, and not the older one. Basically, How multiple web site hosting will work?

PS: using remote desktop client. I am able to log in to my windows server.




How to convert java web code (class controller) to angular?

I use Class SongController to display the required list via Jsp

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.tma.model.Song;
import com.tma.service.SongService;


@Controller
@RequestMapping("/song")
public class SongController {
        
        @Autowired
        private SongService songService;
        
        @RequestMapping(value = { "/" , "/listSongs" })
        public String listSongs(Map<String, Object> map){
                
                map.put("song", new Song());
                map.put("songList", songService.listSongs());
                
                return "/song/listSongs";
                
        }
        
        @RequestMapping("/get/{songId}")
        public String getSong(@PathVariable Integer songId,Map<String, Object> map){
                Song song = songService.getSong(songId);
                map.put("song", song);
                return "/song/songForm";
        }
        
        @RequestMapping(value = "/save", method = RequestMethod.POST)
        public String saveSong(@ModelAttribute("song") Song song,
                        BindingResult result) {

                songService.saveSong(song);
                return "redirect:listSongs";
        }

        @RequestMapping("/delete/{songId}")
        public String deleteSong(@PathVariable("songId") Integer id) {

                songService.deleteSong(id);
                return "redirect:/song/listSongs";
        }
}
**This is file songForm.jsp**



<%@ taglib uri="http://ift.tt/IED0jK" prefix="form"%>
<%@ taglib uri="http://ift.tt/QfKAz6" prefix="c"%>


<c:url var="actionUrl" value="save" />

<form:form id="songForm" commandName="song" method="post"
        action="${actionUrl }" class="form-horizontal">



        <div class="form-group">
                <label for="name" class="col-xs-4 control-label">Name</label>
                <div class="col-xs-8">
                        <form:input path="name" placeholder="Name" class="form-control" />
                </div>
        </div>

        <div class="form-group">
                <label for="genre" class="col-xs-4 control-label">Genre</label>
                <div class="col-xs-8">
                        <form:input path="Genre" placeholder="Genre" class="form-control" />
                </div>
        </div>

        <div class="form-group">
                <label for="file" class="col-xs-4 control-label">File</label>
                <div class="col-xs-8">
                        <form:input path="file"
                                type="file" aria-required="true" />
                </div>
        </div>
        <form:input path="id" type="hidden" />
</form:form>
**This is file listSongs.jsp**


<%@ taglib uri="http://ift.tt/QfKAz6" prefix="c"%>

<html>
<head>
<title>MusicManager</title>

<link rel="stylesheet"
        href='<c:url value="/web-resources/lib/bootstrap-3.3.6/css/bootstrap.min.css"/>'>
        
<link rel="stylesheet"
        href='<c:url value="/web-resources/lib/jquery/jquery-ui-1.10.4.custom.css"/>'>

<style type="text/css">
th {
        text-align: left
}
</style>


</head>

<body>
        <div style="width: 95%; margin: 0 auto;">

                <div id="bookDialog" style="display: none;">
                        <%@ include file="songForm.jsp"%>
                </div>

                <h1>List Songs</h1>

                <button class="btn btn-primary" onclick="addBook()">
                        <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add Book
                </button>
                <br>
                <table class="table table-striped table-bordered">
                        <thead>
                                <tr>
                                        <th width="4%">S.N</th>
                                        <th width="12%">Name</th>
                                        <th width="12%">Genre</th>
                                        <th width="12%">File</th>
                                        <th width="12%"></th>
                                </tr>
                        </thead>
                        <tbody>
                                <c:forEach items="${songList}" var="song" varStatus="loopCounter">
                                        <tr>
                                                <td><c:out value="${loopCounter.count}" /></td>
                                                <td><c:out value="${song.name}" /></td>
                                                <td><c:out value="${song.genre}" /></td>
                                                <td><c:out value="${song.file}" /></td>

                                                <td><nobr>
                                                                <button class="btn btn-primary"
                                                                        onclick="editBook(${song.id});">

                                                                        <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Edit
                                                                </button>

                                                                <a class="btn btn-primary"
                                                                        onclick="return confirm('Are you sure you want to delete this book?');"
                                                                        href="delete/${song.id}"> 
                                                                        <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> Delete
                                                                </a>

                                                        </nobr></td>
                                        </tr>
                                </c:forEach>
                        </tbody>
                </table>

        </div>

        <!--  It is advised to put the <script> tags at the end of the document body so they don't block rendering of the page -->
        <script type="text/javascript"
                src='<c:url value="/web-resources/lib/jquery/jquery-1.10.2.js"/>'></script>
        <script type="text/javascript"
                src='<c:url value="/web-resources/lib/jquery/jquery-ui-1.10.4.custom.js"/>'></script>
        <script type="text/javascript"
                src='<c:url value="/web-resources/lib/jquery/jquery.ui.datepicker.js"/>'></script>
        <script type="text/javascript"
                src='<c:url value="/web-resources/lib/bootstrap-3.3.6/js/bootstrap.min.js"/>'></script>
        <script type="text/javascript"
                src='<c:url value="/web-resources/js/js-for-listBooks.js"/>'></script>
</body>
</html>

Result: enter image description here

I do not want to display the above results with JSP java code. I want to replace it with angularJS. Help me, thanks!




How to become a game developer in C,C++ and/or python [on hold]

I am a noob developer.I know basic C,C++ and python.I want to be a game developer.Can anyone show me a pathway to become a game developer like in EA or Activision?




FOUC on foundation topbar dropdown menu

I'm trying to style a topbar menu with submenu items in Foundation. The code seems right, but the submenu items keep breaking the styling of the topbar on a page refresh, then going into place (hidden under the top menu item) when the javascript loads.

The docs address FOUC on the dropdown arrows, but not on the list items themselves.

Code:

<div class="top-bar">
<ul class="dropdown menu" data-dropdown-menu>
  <li class="is-dropdown-submenu-parent">
    <a href="#">Item 1</a>
    <ul class="menu">
      <li><a href="#">Item 1A</a></li>
      <li><a href="#">Item 1B</a></li>
      <li><a href="#">Item 1C</a></li>
      <li><a href="#">Item 1D</a></li>
      <li><a href="#">Item 1E</a></li>
      <li><a href="#">Item 1F</a></li>
      <li><a href="#">Item 1G</a></li>
      <!-- ... -->
    </ul>
  </li>
  <li><a href="#">Item 2</a></li>
  <li><a href="#">Item 3</a></li>
  <li><a href="#">Item 4</a></li>
</ul>
</div>

Codepen: http://ift.tt/2tkDyIK

This flashing also happens on the official codepen: http://ift.tt/2s1LkU0




Missing references when deploying to Azure

I have a basic site setup using Umbraco. It works perfectly fine locally but when I go to deploy the site from BitBucket to Azure, I get these missing reference errors. Everything is included in the project so not entirely sure whats going on with it!

enter image description here




Affordable Web host reqiured

Suggestion to choose best web host proving ssd shared hosting and allowing multiple php versions. Also providing affordable service.




CodeSchool-like learn to code by practicing

Is there a website or a platform that allows or provides simultaneous practicing while learning to code, either by simple tasks or projects, such like Codeschool or freecodecamp? PS: it's preferably that it contains at least one course for VueJS. Thank you :))




Using a domain name for a website

I know this should be a pretty easy thing to do, but I'm having trouble.

Say I bought a domain name from 123-reg.co.uk "example12345.com". And I have a website hosted on AWS called something like http://ift.tt/2uhr9lL.

I have read the following blog: http://ift.tt/2tjHmJK and followed the steps, but still have 2 issues/questions:

1) I have configured "web forwarding" on 123-reg.com to forward requests to example.com to my convoluted AWS address, but when I type in example12345.com to a browser, it just says the DNS can't find that domain name. I set this up weeks ago, and did manage to see it work a couple of times, but weeks later it doesn't work anymore.

2) On the occasions I did see the web forwarding working, I notice that the browser displays the convoluted AWS address after the redirect happens. Is there a way to configure it so that users type in example12345.com into the browser, and then it's that address that is always displayed in the browser address bar whilst they are browsing around my website? Surely I need more than just web forwarding and a redirect?

Thanks!




Session ID Regeneration cant prevent cookie from being copied

This could be a basic concept but I am bit confused over it.

Guidelines tell us to regenerate the session ID after user login in order to make it usable if it is being sniffed over the network thus preventing a replay attack.

My point is that even after the session ID is regenerated it would again be stored in a user browser and if an attacker or some other person who has access to the user's system he could copy that cookie and replay in another browser to gain post login access irrespective of TLS/NON TLS connections?

is it correct to say that this kind of activity can not be prevented?

Suggestions/Views please?




How to get used Bean in a JSP

I am doing a shool project in JSP with JavaBeans. Unfortunately, our teacher is not familiar with that. There is an index.jsp, where all entreis of the Bean "Issues" are shown. This bean contains an ArrayList of Issues. The Bean called Issue contains the data to the Issue, e.g. time and place. A servlet controls an add-Issue-operation, that will create a new Issue and add it to the ArrayList. If you click on on of the listed Issues on the index.jsp, you will be redirceted to a page with details. This one contains the details and a Chat. Therefore, there is a Class/Bean called ChatEntry, that saves the Chat and is part of every Issue.

Here the AddIssueServlet:

package servlets;

import java.io.IOException;
import java.time.LocalDateTime;

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

import beans.Issue;
import beans.Issues;

@WebServlet("/addIssue")
public class AddIssueServlet extends HttpServlet {
private static final long serialVersionUID = 1L;

protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    String category = request.getParameter("category");
    String title = request.getParameter("title");
    int maxParticipants = 
    Integer.parseInt(request.getParameter("maxParticipants"));
    int currParticipants = 1;
    String description = request.getParameter("description");
    String place = request.getParameter("place");

    String[] startTime = request.getParameter("startTime").split(":");
    String[] endTime = request.getParameter("endTime").split(":");
    String[] startDate = request.getParameter("startDate").split("-");
    String[] endDate = request.getParameter("endDate").split("-");

    LocalDateTime startDateTime = 
    LocalDateTime.of(Integer.parseInt(startDate[0]), 
    Integer.parseInt(startDate[1]),
            Integer.parseInt(startDate[2]), Integer.parseInt(startTime[0]), 
    Integer.parseInt(startTime[1]));
    LocalDateTime endDateTime = 
    LocalDateTime.of(Integer.parseInt(endDate[0]), 
    Integer.parseInt(endDate[1]),
            Integer.parseInt(endDate[2]), Integer.parseInt(endTime[0]), 
     Integer.parseInt(endTime[1]));

    Issue newIssue = new Issue(category, title, description, 
    maxParticipants, currParticipants, startDateTime,
            endDateTime, place);
    Issues issues = (Issues) getServletContext().getAttribute("issues");
    int id = issues.addIssue(newIssue);

    response.sendRedirect("/lobbyDetail.jsp?id=" + id);
}

}

details.jsp:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@taglib prefix="t" tagdir="/WEB-INF/tags"%>
<%@ taglib uri="http://ift.tt/QfKAz6" prefix="c"%>
<jsp:useBean id="issues" class="beans.Issues" scope="application" />

<!DOCTYPE html>
<script src="../js/scripts.js" type="text/javascript" charset="utf-8"
async defer></script>
<t:layout>
<t:issue issue="${issues.issues[param.id]}"></t:issue>

<div id="chat">
    <form action="lobbyDetail" name="lobbyDetail" method="post">
        <textarea rows="50" cols="50" id="textAreaChatHistory"
            readonly="readonly"> <jsp:getProperty property="getChat"
                name="getChat" /></textarea>
        <input type="text" id="username" name="username"
            placeholder="Ihr Nutzername">
        <textarea rows="2" cols="50">Ihre Nachricht</textarea>
        <input type="submit" value="Absenden">
    </form>
</div>
</t:layout>

ChatServlet:

package servlets;

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


import beans.Issue;
import beans.Issues;


@WebServlet("/ChatServerServlet")
public class ChatServerServlet extends HttpServlet
{
private static final long serialVersionUID = 1L;


/**
 * Default constructor.
 */
public ChatServerServlet()
{

}

/**
 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse 
response)
 */
protected void doGet(HttpServletRequest request, HttpServletResponse 
response) throws ServletException, IOException
{
}
HttpServlet#doPost(HttpServletRequest request, HttpServletResponse 
response)

protected void doPost(HttpServletRequest request, HttpServletResponse 
response) throws ServletException, IOException
{
    String username = request.getParameter("username");
    String userMessage = request.getParameter("userMessage");

//        How to get the"right" bean?
//        Bean.addChatEntry(username, userMessage);

}
}

How do i get the Bean that is used in the details-page where the button is clicked, so the Chat will be saved to the Correct Issue-Bean/Object?

I googled, read and watched YouToube for four days and found no solution.

We are only allowed to use JSP and JavaBeans.




C#, collecting data from web

I have to handle a project at college, and my idea is to write a desktop application that searches the web for data and store the results in a txt file. for example:

User would enter 5 cities and the app would search the web for the temperatures high and low for that day.

What sort of technologies would I have to use?

Thanks for the help.




How to merge duplicate objects by picking event from json and delete other duplicates

Im new with typescript so please be patient with me XD

I´ve got a problem with following:

I need to to read a json file from an other class and have to display it in my html file.

The json file consists from duplicate events. Every duplicated event has to be displayed and the user has to chose the right one by clicking on them.

After this the not selected events should automatically be removed.

Hope you can help me




How to Get json data in a single object while post from Rest Client?

I have the following json data which i used in RestClient to post.

{
  "Cars": [
      {
        "color":"Blue",
        "miles":100,
        "vin":"1234"
      },
      {
        "color":"Red",
        "miles":400,
        "vin":"1235"
      }
  ],
  "truck": {
    "color":"Red",
    "miles":400,
    "vin":"1235"
  }
}

and i am trying to get this json in a single object at server side while do post from Rest Client

public JsonResult Post([FromBody]Object Cars)
{
    return Cars;
}

How can i get this json in a single object?




Meteor JS and Vue Js

I have recently started to deploy web applications using the Meteor platform and Vue js framework. I have downloaded an example project from GITHUB two days ago and it was working properly. Yesterday though, I have updated Vue and now I get:

[Vue warn]: You are using the runtime-only build of Vue where the template option is not available. Either pre-compile the templates into render functions, or use the compiler-included build.

These are my file at the moment : Main.js

import { Template } from 'meteor/templating';
import { Session } from 'meteor/session';

import './main.html';

Session.setDefault("counter", 0);


Template.hello.helpers({
counter() {
return Session.get("counter");
},
});

Template.hello.events({
'click button'(event, instance) {
// increment the counter when button is clicked
Session.set("counter", Session.get("counter")+1);
},
});
import {Vue} from 'meteor/akryum:vue';
import Widget from '/imports/ui/Widget.vue';

Template.vue_demo.rendered = function() {
var vm = new Vue({
el: '#vue-demo',
template: '<div><widget></widget></div>',
components: {
  Widget
  }
 });
}

Main.html

<head>
<title>vue-blaze</title>
</head>

<body>
<h1>Welcome to Meteor!</h1>



</body>

<template name="hello">
<button>Click Me</button>
<p>You've pressed the button  times.</p>
</template>

<template name="vue_demo">
<div id="vue-demo"></div>
</template>

Widget.vue

<template>
<div class="widget">
<div>Hello !</div>
<input v-model="name" placeholder="Enter your name" />
<div>
  You've pressed the button  times (inside vue component).
</div>
</div>
 </template>

<script>
import {Session} from 'meteor/session';

export default {
data() {
return {
  name: 'world',
  counter: 0
  }
},
meteor: {
data: {
  counter() {
    return Session.get("counter");
  }
}
}
}
</script>

<style scoped>
.widget {
background: #a0ddc4;
padding: 12px;
border-radius: 3px;
width: 300px;
border-bottom: solid 1px #40b883;
}

I have red that it has something to do with needing the compiler setup in order to render the template and to do this I have to create an alias in my 'webpack.config' which I did:

var webpack = require('webpack');

module.exports = {
entry: './script.js',
devtool: 'inline-source-map',
output: {
filename: 'compiled.js'
},
resolve: {
extensions: ['', '.js'],
alias: {
    'vue$': 'vue/dist/vue.esm.js' // 'vue/dist/vue.common.js' for webpack 1
  }
}
};

I am new to both Meteor and Vue so probably the answer is very easy but I don't know what to do so I would appreciate some help ! Thanks !




mardi 27 juin 2017

PHP - Open a WS from PHP to PHP using Ratchet

I am using Ratchet to handle my web sockets for a website I am creating. Traditionally I understand a web socket is from client side to server side (i.e. JS -> PHP), however, relating to a question I had a few days ago I've come up with a solution with using web sockets from PHP -> PHP.

So my question is - is it possible to communicate with a web socket server using PHP as well?. My goal for this is to crontab a php script that executes every second, inside that script is code that will send a message to the web socket server that will direct it appropriately afterwards.

I've already written all the code except for the part where the PHP script connects to the web socket server and sends a message, which I'm unsure how to do yet.

Any help regarding that portion would be greatly appreciated,

Thank you.




HTML href tag adding a '#!' to fragment

I'm looking to redirect to a certian fragment of my page by using an anchor tag in HTML.

So far, I have

<ul>
    <li><a href="#Links">Links</a></li>
</ul>

as the link, and then later in the code

<section id = "Links">
    ...
</section>

However, when I click on the anchor when testing on my localhost, the URL becomes

http://localhost:5000/#!#Links

Rather than

http://localhost:5000/#Links

Why is this? How can I eliminate the shebang from the URL after I click on the link?




How to pass the username&password while download file from Web Url?

I have secured downloadable link to download the file. So configured the link in InvokeHTTP processor with StandardSSLContextService with the truststore certificate. In response, I get the HTML tags i.e., page source of the link.

But using RestClient opensource if I logged into the link, data is downloading properly. If the link is not logged into the link, page source html tag is the result.

I think the similar behavior achieved in InvokeHTTP? How to resolve this to accept the credentials of the link? I have configured the username and password in InvokeHTTP but it fails.




Rails 5: Ideal model for assigning records to a list?

I am learnerings the Ruby on Rails

What best approach in model design if try accomplish this:

  1. Database has records
  2. Have a page where I cam select individual database records and add it to a list(iterated table)

In mine practice project http://ift.tt/2sZzWtb I have "players" model (has_many pretenders) & "pretenders" model (belongs_to players, optional: true)

Idea is am can go to players page, & add 'pretenders' to individual players.

Am dificulty understand http://ift.tt/Lb5GiF lol




HTTP Caching, How to configure Nginx to achieve following two Simple Rules

1, Don’t cache HTML
2, Cache everything else forever

these two rulles are from http://ift.tt/1w598Cm




include php function to javascript

in test.php file

<html>
<head>
  <script type="text/javascript" src="java_script.js"></script>
</head>
<body>

Name: <input type="text" id="myText" value="Mickey">

<button onclick="myFunction()">Click Me</button>

</body>
</html>

in java_script.js

function myFunction() {
    var user_name = 'Hellow World';
    document.getElementById("myText").value = user_name;
}

How to use function or variable from php_test.php

in php_test.php

  <?php
      $phpVar = 'Hello World';
      echo $phpVar;
  ?>

Thank you everyone i'm not good in English, You can correct me :)




Extract text from PDF with PHP?

I want to be able to extract text from a PDF with PHP without Tesseract or any other tools for doing it. I have several invoices and I need to extract the text only.

I would like to know several options for PHP, able to be reproduced in a browser without more addons than the pure PHP code.

Thanks, I looked at pdf2text but it does not work with invoices.




how to review the task output on web page with phthon?

I want to implement a feature with python, just like the CI (Jenkins), when I startup a task, the task running log could be shown on a webpage, and rolling automatically, is there any python web framework or solution?




Error in importing org library

I am trying to import this "import org.json.JSONArray" but I have got an error in "org".. I tried to use "Add JAR/Folder" but nothing appeared to choose!

import org.json.JSONArray




What are some of the tools I should start learning?

I am a complete newbie to Web development, but I want to start from somewhere. I wonder if anyone could give me a list of things I need to learn and start with if I want to build a site like this following one. Does it use Wordpress? Also, what if I want my sites have membership function?

http://ift.tt/2jOawJ4

thanks!




MAMP php file - how to run it from outside the server ( not local)

I have installed MAMP, and created a PHP file to the root of my installation ( c:\MAMP\htdocs) and to run I only use the url localhost/script.php in my browser. This works really niicely. My question is: Can I access this same file from the outside world through a browser (with my IP address)? Many thanks in advanced.




Protocols, domains, and ports must match

I'm using Rollbar to track JS errors from client and server side, recently I start receiving this error message SecurityError: Blocked a frame with origin "http://ift.tt/1nmPB1E" from accessing a frame with origin "https://[CDN-url]-ssl.com". Protocols, domains, and ports must match.

And instead of cdn url it can google or facebook pixel, the same time I note a gaps in google analytics data, dunno if it's related or not, but anyway, I don't understand the reason of the first error, because protocols are identical, I'm not using http over https or vice versa.




jQuery focus() method not working?

I'm building an Outlook formatter and am having a problem getting the value of the input in the form to display on the copyDiv. It displays everything in theWholeString except for the inputted values. I'm thinking something might be wrong with the focus() method. How can I fix this so that the input is displayed as well? Here's my source code:

$(document).ready(function() {

  var firstName = $("#firstName").val();
  var lastName = $("#lastName").val();

  var lastNameLC = lastName.toLowerCase();
  var firstInitial = firstName.substr(0, 1);
  var firstInitialLC = firstInitial.toLowerCase();
  var firstInitialLast = firstInitial.concat(lastName);

  var theWholeString = "New-RemoteMailbox -Alias " + firstInitialLast + " -Name " + '"' + firstName + " " + lastName + '"' + " -FirstName " + firstName + " -LastName " + lastName + " -DisplayName " + '"' + firstName + lastName + '"' + " -UserPrincipalName " + firstInitialLC + lastNameLC + "@belmont.gov -RemoteRoutingAddress " + firstInitialLC + lastNameLC + "@belmont.gov.onmicrosoft.com -OnPremisesORganizationalUnit ";

  var finalString = "";

  $("#submitButton").click(function() {

    $('input[type="checkbox"]').click(function() {
      if ($(this).prop("checked")) {
        finalString = theWholeString + "blueone.pd/PDUser";
      } else {
        finalString = theWholeString + "belmont.local/BelmontUsers";
      }
    });

    $("#copyDiv").html(finalString).end().appendTo($("body"));
  });

  return false;
});

function changeFocus(id) {
  var v = "#" + id;
  $(v).focus();
}
<script src="http://ift.tt/1oMJErh"></script>
<link href="http://ift.tt/2apRjw3" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<body>
  <div class="container" style="margin-top:120px">
    <div class="row">
      <div class="col-xs-6 col-xs-offset-3">
        <h4>1. Enter name:</h4>
        <form id="nameForm" method="post" action="">
          <div class="form-group">
            <label for="firstName" class="sr-only">First:</label>
            <input class="form-control" id="firstName" name="firstName" type="text" placeholder="First Name" value="" />
          </div>
          <div class="form-group">
            <label for="lastName" class="sr-only">Last:</label>
            <input class="form-control" id="lastName" name="lastName" type="text" placeholder="Last Name" value="" />
          </div>
          <div class="check-box">
            <label for="policeDept">Police Department?</label>
            <input type="checkbox" id="pdCheck" data-group-cls="btn-group-sm">
          </div>
          <button class="btn btn-primary pull-right" id="submitButton" type="button" value="Submit" />Make </button>
        </form>
      </div>
      <div class="row">
        <div class="col-xs-6 col-xs-offset-3">
          <h4>2. Copy this text:</h4>
          <div id="copyDiv" class="panel panel-default" style="padding:10px">Result
          </div>
        </div>
      </div>
    </div>
  </div>
</body>
<script src="http://ift.tt/2aHTozy" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>



Comparing results of loop in Javascript

I was hoping someone could help me out with a problem I've had a hard time solving. What I have is a select box with multiple options. What I'm trying to do is get the all the items the user selected, loop through the array and compare the results and render them to the screen.

for instance, if a user selects LeBron and Kyrie, I know I can get those values in an array with cat1.val(). I know I can use a for loop to cycle through the items, the trouble I'm having is being able to compare multiple results and rendering them to the screen. Any help would be greatly appreciated.

    <select  multiple id="cat1">
    <!-- <option disabled selected>Please Select</option>-->
    <option value="lebron">Lebron James</option>
    <option value="kyrie">Kyrie Irving</option>
    <option value="kevin">Kevin Love</option>
    <option value="tristan">Tristan Thompson</option>
    <option value="jr">JR Smith</option>
    </select>


    for(var i = 0; i < $cat1.length; i++){
    //if user selects Lebron &&  kyrie

        $contentBlock.html('<h4>Lebron James</h4><h4>Kyrie Irving</h4>');
    }




I need a short task to test the skills of a PHP developer I want to hire

Shorter than 2 hours to complete, front end and backend. Any help much appreciated. In real life the developer will work on our ticketing platform and develop a diary system amongst other goodies.




Unable to run servlet in tomcat 8.5.15 and eclipse jee neon

I've followed the tutorial on youtube channel "Java Brains" link : https://www.youtube.com/watch?v=gU0RebsaFzQ&t=10s and got stuck while running a servlet file . I am getting this error message :

HTTP Status [404] – [Not Found]

Type Status Report

Message /SimpleServletProject/servlet/org.altamash.careersix.SimpleServlet

Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

My simple index.html is :

<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Simple Web Application</title>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>

web.xml file is as :

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://ift.tt/ra1lAU" xmlns="http://ift.tt/19L2NlC" xsi:schemaLocation="http://ift.tt/19L2NlC http://ift.tt/1drxgYl" id="WebApp_ID" version="3.1">
  <display-name>SimpleServletProject</display-name>
  <servlet>
        <servlet-name>SimpleServlet</servlet-name>
        <servlet-class>SimpleServlet</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>SimpleServlet</servlet-name>
        <url-pattern>/SimpleServlet</url-pattern>
    </servlet-mapping>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
  </welcome-file-list>
</web-app>

and finally my servlet file SimpleServlet.java is as follows :

package org.altamash.careersix;

import java.io.IOException;
import java.io.PrintWriter;

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

/**
 * Servlet implementation class SimpleServlet
 */
@WebServlet("/SimpleServlet")
public class SimpleServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;

    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("Hello from doGet method");
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter writer = response.getWriter();
        writer.println("<h3>Hello in HTML</h3>");
    }

}

Please guys Help me to solve this problem :( .. Thanks .