mardi 31 octobre 2017

Angular Project Styles and Images Not Deployed in Spring Project

I deployed my Angular (4) Project in the Spring MVC Project. Everything works except the External Stylesheets and the Images files. I included the external Stylesheets in the style.css file of the Angular Project like this

@import url("/assets/css/header.css");
@import url("/assets/css/footer.css");
@import url("/assets/css/content.css");

and the I used the Image files in some styles like this:

.check-status{
    background-image: url("/assets/images/header.png");
}

I am getting Error Messages like this:

GET http://localhost:8080/assets/css/footer.css net::ERR_ABORTED GET http://localhost:8080/assets/images/header 404 ()

Is it related to the Angular Project Build Problem? If yes, How do I need to build the Angular Project so that I can deploy in the Spring MVC Project?




How to open a local html file, not with file:// but with a web server like http://localhost:8080/VideoUsingWebComponents/index.html

I am not able to follow this .png file,posted for your reference

I have a zipped file extracted to the following location,C:\Program Files\WAMP\ht docs\VideoUsingWebComponents, created as per the image file uploaded here.In the folder I am supposed to open the index.html file with a web server, on simply clicking on the html file the browser opens with file:///C:/Program%20Files/WAMP/ht%20docs/VideoUsingWebComponents/index.html, I want it to open with http://localhost:8080...as instructed in the uploaded image, so I tried changing the above link like this, http://localhost:8080/C:/Program%20Files/WAMP/ht%20docs/VideoUsingWebComponents/index.html, but localhost refused to connect. I am using a windows pc , the image shown here is of a Mac.Please help to open index.html file with a web server. Thank you




Update the css of an element inside a child component - Ionic

So I am trying to show/hide a button that is inside a child component of a parent component. I am using ngStyle to alter the css of the child component itself, which works, but I can't seem to have the internal css update at the same time. I am using the (click) mechanic with [ngStyle] in the parent class, and that works for the child component itself, but not an internal element inside the child.

My parent code:

<child-component [sensor]="sensor" id="" (click)="onClick(sensor);" [ngStyle]="{'box-shadow': sensor.clickBorder}"></child-component>

with onClick() doing:

if(sensor.clickBorder == '0 0 0px 3px #4DB2EE'){
  sensor.clickBorder = '0 0 0px 1px #c2c2c2';
  sensor.buttonDisplay = 'none';
} else {
  sensor.clickBorder = '0 0 0px 3px #4DB2EE';
  sensor.buttonDisplay = 'inline-block';
}

and internally in the child component:

<button ion-button icon-only [ngStyle]="{'display': this.buttonDisplay}" id='sideButton'>

where both variables are declared in the class like:

clickBorder: string = '0 0 0px 1px #c2c2c2';
buttonDisplay: string = 'none';

This may look confusing but specifically I want to know how to style an internal element of a child class from a parent class, and have that internal element update.




Mongodb query on nested members with unknown keys

So I have objects which have thumbnail images that are stored like this under hashed keys:

{
    "_id" : xxxxxxxxx,
    "thumbnails" : {
        "dac898610078d3c8c277562902be79a7" : {
            "1500" : "http://ift.tt/2zm1r5Y",
            "1260" : "http://ift.tt/2iPp7ZC",
            "322x181" : "http://ift.tt/2zm1rD0"
    },
        "619b3999ed549a2fbc569d774ca921c4" : {
            "595x595" : "http://ift.tt/2iT4Cvb"
    }
}

(The different hashes are for desktop version/mobile version.) I introduced a bug into the image processing code for about a week that saved cropped and resized images as (and wrote to the db as)

{
    "thumbnails": {
        "dac898610078d3c8c277562902be79a7" : {
            "50x50" : "http://ift.tt/2zl3Ldn",
    }
}

(note the erroneously repeated TLD/bucketname).

Question is this: I'm trying to find a regex-based query to find all the places where these wrong URLs got saved to the database. My list of attempts is kind of embarrassing, so I'm not going to list them all here unless it's really wanted, but I think this is getting close (wide open regex because testing):

db.contentobjects.find({"thumbnails": { $elemMatch : { $regex : /.*/} } } )

This returns naught. Problem is I need to regex the key, not the val. Figuring out the search for the repeated TLD is a separate problem I'll deal with anon; right now I just want to find all the hash-based keys under

{
    "thumbnails" : {
        "*" : {}
    }
}

in a large collection of objects.




show dynamically changing data in my web app by flask

i want to show some dynamically changing data from request api on my web app my request is :

 url='http://ift.tt/2hrSIVr'
  z=[]
  r = requests.get(url)
  x=r.json()
  e1=x['result'][0]['Ask']

i want to display it on web app in pythonanywhere i have html file like this :

<!DOCTYPE html>

<html>

<head>
    <title>aaa</title>
</head>

<body>

Search: <input type="text" id="search_form_input"></input>

<div id="aaa"></div>

<script src="http://ift.tt/2eBd7UN"></script>

<script>
$("#search_form_input").keyup(function(){
    var text = $(this).val();

    $.ajax({
      url: "/aaa",
      type: "get",
      data: {jsdata: text},
      success: function(response) {
        $("#aaa").html(response);
      },
      error: function(xhr) {

      }
    });
});
</script>

</body>

</html>

my flask file:

from flask import Flask, render_template, request
import requests


app = Flask(__name__)


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


@app.route('/aaa')
def aaa():
    text = request.args.get('jsdata')

    aaa_list = []

    if text:
         url='http://ift.tt/2hrSIVr'
         z=[]
         r = requests.get(url)
         x=r.json()
         e1=x['result'][0]['Ask']
         suggestion=e1
         for suggestion in aaa:
            aaa_list.append(suggestion.attrs['data'])

        #print(aaa_list)

    return render_template('aaa.html', aaa=aaa_list)


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

i get this error :

Internal Server Error

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

i think something with ajax. please help me. I have no idea how to fix it and how to update data from http://ift.tt/2hrSIVr dinamicly changing every 2-3 seconds for example




Auto resize of my menu list CSS HTML

when i get the cursor on the "GOOGLE" button, the parrent block resize for it self i want the grandchild elements outside the parrent button. when i get the cursor on the "GOOGLE" button, the parrent block resize for it self i want the grandchild elements outside the parrent button.

CODE:

<html>
<head>
   <style type="text/css">

       ol{
           display: none;
       }
       li:hover ol 
       {
           display: block;
           margin-left: -4.2em;
       }
       #shadow li 
       { list-style-type: none;
       border: 2px solid black;
       box-shadow : 5px 5px 5px gray;
       margin-bottom: 10px;
       text-align: center;
       width: 10em;
       margin-left: 1.5em;
       float : left;
           display: block;


       }

</style>
    </head>
<body>
    <div id="shadow">
    <ul>
        <li style="margin-left : -2.5em"> 
            <a href="http://www.google.com">GOOGLE</a>
            <ol type="a"> 
        <li> <a href="http://www.google.com">google1</a>
        </li> 
        <li> <a href="http://www.google.com">google1</a>
        </li>


            </ol>


        </li>

        <li> <a href="http://www.youtube.com">YOUTUBE</a></li>

        <li> <a href="http://www.facebook.com">FACEBOOK</a></li>
        </ul>


    </div>

</body>
</html>




Add google maps to website

I am attempting to present the user with a map when they type an address into a text field. I have been able present a map at run time but am struggling to add the map on click as the error

"initMap is not a function"

How can I add the map after runtime in a js file?




Placement of two elements in one sequence

I would like the text and icons (login, shop) to be the same level as the 'Logo' but just to the right side. I tried by adding to the '.shop-icon' {margin: -30px auto;} but it all destroyed the page and then the entire 'nav bar' and 'article' covered the header.

I'm still learning, but at the beginning I know I've broken something.

* {
    margin: 0;
    padding: 0;
}

html {
    font-size: 62.5%;
}

body {
    font-family: 'Roboto', sans-serif;
    background: #2B2B2B;
    font-size: 1.6rem;
}

.header-front {
    max-width: 992px;
    margin: 0 auto;
}

h1.logo {
    color: #F6F6F6;
    font-size: 4.8rem;
    font-weight: 700;
    text-align: left;
}

.shop-icon {
    text-align: right;
}

.bag, .account {
    color: #F6F6F6;
    text-decoration: none;
    text-transform: uppercase;
    margin: 10px;
}

.main-menu {
    background-color: #F7FCFA;
     
     width: 100%;
}

p {
    color: #FFFFFF;
}
<body>
    <header class="header-front">
        <h1 class="logo">Logo </h1>
        <div class="shop-icon">
            <a href="_blank" class="account">
            Login <i class="fa fa-user-o" aria-hidden="true"></i>
            </a> 
            
            <a href="_blank" class="bag">
            shop <i class="fa fa-shopping-bag" aria-hidden="true"></i>
            </a>
        </div>
      
    </header>
       
        <nav class="main-menu">
           <ul>
               <li></li>
               <li></li>
               <li></li>
               <li></li>
           </ul>
        </nav>
    <article>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer ultrices elit eget tortor varius ornare. Etiam commodo sapien dui, in gravida purus malesuada eget. Vestibulum mollis ipsum consectetur ipsum tempor, non sagittis nunc gravida. Aenean dolor arcu, faucibus a urna nec, pulvinar mollis erat. Pellentesque scelerisque sapien purus, eget porta tellus lacinia ut. Aenean vel ipsum tortor. Ut faucibus sagittis lorem, a molestie enim commodo vel. Maecenas ac placerat nisl. Phasellus felis elit, tincidunt nec ullamcorper vitae, interdum non leo. </p>
    </article>
</body>
</html>



What to use for vertical spacing in web hybrid mobile views?

Some devices like the iPhone SE are very small so using EM for margins that look nice in bigger devices will mess up that view.

Should I use percentage or VH instead?




Ajax httprequest

I'm looking for some help when it comes to ajax. I have written this code.

let api = "http://ift.tt/1mGUATE?
q=city%20name&APPID=307cb175d7f136d2e8f4231faad9dd97"

let xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){
if(this.readyState === 4 && this.status === 200){
let weatherInfo = JSON.parse(this.responseText);
console.log(weatherInfo);
}
else {
console.log('Error: ' + this.status);
}
}
xhr.open("GET", api , true);
xhr.send();

This seems to work fine, however,it will console log the information that I require but it will also console log the "Error" and this.status even though everything has passed. I am just wondering why this happens?




Start an angular 4 application - What editor?

I am learning angular 4 and I wondered to start a new project what editor would be advisable to use, and in terms of architecture?

  • Use visual studio code and develop the web app completely separated from the server side?

  • Use the visual studio and embedded angular in a MVC or Api app?

  • Build an Api in visual studio in a separate project?




Elgg and the utilization of Relationship_created_time_lower

Finishing of my elgg plugin has come to some issues, after fixing my last question I have encountered another. Apperently I am misusing or misunderstanding the use of the Created time lower and upper functions in Elgg

With the code below:

    $monthSpan = (30 * 24 * 60 * 60);
$startTime = time() - $monthSpan;

$MemberDifference = elgg_get_entities_from_relationship(array(
    'relationship' => 'member', //get Members
    'relationship_guid' => $group->guid, //get individual guid for use
    'inverse_relationship' => true,
    'type' => 'user', //users are returned
    'limit' => 20,
    'joins' => array("JOIN {$db_prefix}users_entity u ON e.guid=u.guid"),
    'order_by' => 'u.name ASC',
    'relationship_created_time_lower' => $startTime, //the furthest back it will reach
    'relationship_created_time_upper' => time(), //possibly unneeded, but ensures the closest date is today
    'count' => true,
));

Using this function, I built it upon my way to get all of the members in the associated group, theoretically it should now grab any members that registered to that group within the last month. Unfortunately, it instead continues to grab every member in the group, regardless of the time they joined.

Does anyone have any information into where I have went wrong?




asp.net web api list of list pass into json ajax

I have web api controller where I try to do something like this:

public IHttpActionResult Get()
    {

        var Rooms = db.Rooms.Select(r => new {
            Id = r.Id,
            Name = r.Name,
            ChairNum = r.СhairNum,
            Requests = r.Requests.ToList()
        }).ToList();

   return Ok(new { results = Rooms });

}

In Model I have this:

public partial class Room
    {
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
        public Room()
        {
            this.Requests = new HashSet<Request>();
        }

        public int Id { get; set; }
        public string Name { get; set; }
        public int СhairNum { get; set; }
        public bool IsProjector { get; set; }
        public bool IsBoard { get; set; }
        public string Description { get; set; }

        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public virtual ICollection<Request> Requests { get; set; }
    }

I tried to pass this data in service. But I have serialization error. What is the best way to pass the data like in model into json?




Will I get into legal issues if i web scrape/crawl?

I did some research so far, if i want to web scrape/crawl i need to obey robots.txt and terms of service. My question is if everyone who are (i think at least) resellers of some kind of pc components use sites like ark.intel.com to get CPU info to fill out their information on their websites and terms of service say:

Personal Non-Commercial Use: This Web Site is for personal and non-commercial use. Unless otherwise specified or as provided in these Terms, you may not modify, copy, distribute, transmit, display, perform, reproduce, publish, license, create derivative works from, transfer, or sell any information, software, products or services obtained from the Materials.

  1. Can this get them in trouble if i make software that would get that info and put it in a database?
  2. How is this legal then, why its still kinda allowed to do it?
  3. Does it make difference if i sell such software or make it for personal use only?

I tried really hard to google this but every answer is vague. Please help me, if I wasnt specific enough i willl add more info, just ask me.




Looking for a web WYSIWYM editor

I am looking for a WYSIWYM web editor to integrate with a commercial web application (using TYPO3) we are developing.

Short version: We need a web editor where we can add custom widgets that will be rendered only once the HTML is generated, and we want the editor to be as much user-friendly as possible.

Long version: We need an editor for letting a user to write email templates in our application. Basic formatting are OK for us, but users need to be able to insert conditional boxes (to make e.g. greetings conditional to the recipient gender), attributes (variables such as recipient name, number of booked tickets) and custom elements that will be rendered when sending the email (such as booking details, recipient address). We would like to have these conditional boxes, attributes and custom elements diplayed in the editor as something like a box (+/- like a ERT in Lyx). User should also be able to insert raw HTML code in a code box (like an ERT in Lyx).

ProseMirror can probably fit our needs, but it has a very steep learning curve. My question is whether there are user-friendly WYSIWYM alternatives. I am wondering if Quill, Trix or Slate can do it.

Thanks in advance for your answers, Jonas




iOS WKWebView Swift javascript enable

I'm trying to do develop simple app to browse my website. However my website contains some javascript and it doesn't successfully show my website.

In the past develop with android the same app and had to activate like this: webSettings.setJavaScriptEnabled(true);

This currently my code I just have missing the option to enable javascript if somebody can help will really appreciate

import WebKit

class ViewController: UIViewController {

@IBOutlet weak var webView: WKWebView!




override func viewDidLoad() {
    super.viewDidLoad()
    let url = URL(string: "http://ift.tt/2iQprad")
    let urlRequest = URLRequest(url: url!)

    webView.load(urlRequest)



}

}




If statement based on whether an image loads or not from an external URL

I'm having a hard time phrasing the question - so there may be answers on Stackoverflow already - but I'm working with an API that provides image links to external URLS alongside other data in a JSON file. Unfortunately, some of the links no longer work.

My goal is to determine this in an if-statement and if the image doesn't load, don't load any of the other data either.

Here's the code I have attempted, but unfortunately, some of the items are still getting through:






Global variable capture and math in PHP

I will keep this short in order to not take too much of your day, but I have been working on a certain project in PHP for some time now, and I am finally coming to a close on it. However, I seem to be having trouble grasping this concept of the global variable and how to successfully use it in the way I want and I am not quite sure why.

My program essentially does this:

  • Takes in a bunch of IDs and forms groups
  • Creates a page for them which has a report of all the information, allows for download once a button is pressed
  • Takes the member total current when the button is pressed, and translates that into the global variable which will now define another option on the page (member change since last report) by taking that and subtracting the total value from it

Some examples of my code starting from the definition start page

$GLOBALS['TheDifference']; //defines the variable for later use

On the actual viewing pages for the groups, keep in mind this statement is in a foreach, so it will repeat each time for each group

        $MemberDifference;
        if ($MemberDifference == 0) {
                $MemberDifference = $FailureMessage;
        }
//the above will be blank at first due to nothing being in it
        $pastmembers = $GLOBALS['TheDifference'];
        if ($pastmembers == 0) {
            $pastmembers = $TotalMembers;
        }
//this activates when the variable becomes filled
        $MemberDifference =  $pastmembers - $TotalMembers;

And finally, when the button on the report pages are clicked:

$GLOBALS['TheDifference'] = $TotalMembers;

The issue is essentially, my MemberDifference variables are always 0, and they do not seem to save as I hope they should (from the code directly above this, 0 turns into whatever that variable is, which will then end up subtracting the new TotalMembers from PastMembers).

I hope I explained this mostly, maybe even with too much information. PHP isnt my best language and while I feel I am missing something very simple, I cannot for the life of me wrap my head around it.

Thank you all in advance!

*Edit, the reason I need global variables is because this program essentially runs over many different pages, at least 5 in total, and the global variables are the only ones I really know as a way to do this. If there is a better way, feel free to let me know!




Web api retrieving data form SQL server

i have never worked with web api before.

i have this problem where i want to read the tables in my database.

    ```// GET: api/test
    public IEnumerable<string> Get()
    {
        using(SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["myDB"].ConnectionString))
        {
            conn.Open();

            string query = "Select * from Werknemer";

            SqlCommand cmd = new SqlCommand(query, conn);
            SqlDataReader reader = cmd.ExecuteReader();

            return new string[] {  };
        }
    }```

this is what i have.... how do i return a table in my database?




How to decide the number of thread in a thread pool

In a java web project, users send their tasks to the web. To handle these tasks, I use a thread pool that contains 10 threads to handle their tasks. Every task will be built to a thread and send to the thread pool. The thread pool is designed to a static variable, which means that all of the tasks(threads) share the same thread pool.
Today, 200 users come to my web and then, they complained that their tasks ran very very slow...

  • are The threads in the static thread pool is too few? Maybe the number should be 30? 50 ?
  • Maybe I shouldn't use a static thread pool?
  • Maybe I shouldn't use a thread pool, since there are lots of tasks, I can just taskThread.start() ?



Trying to press a button on an internet page using vba

I know there is a similar question to this - but it doesn't show enough detail to help me, I am still new to this and need a little more guidance. What I am trying to do is use a VBA Macro to press a button on a web page.

The details that I can find out about the button are

class = "urBtnEmph"
id = "b1_pki"
ct= "Button"
onclick  = "LoginViaPKI();"

It isn't a page I have written, or have access to change anything on. But is there anyway I can automate clicking the button?

Thank You




Web responsive for phone

I'm developing a website, and after I finished the template I made it responsive for any screen size. It took me two or three days but it works, and right now it looks great in any computer and with any browser size, so for PC is completely responsive.

The problem is that in my phone it doesn't look good. Things are different, for example, some paddings are avoided (or very small, I don't know), or things aren't in the same exact position. I already have this line in the header:

<meta name="viewport" content="width=device-width; maximum-scale=1; minimum-scale=1">

But it doesn't help very much. Sorry, I can't show you pictures because I'm working in it in my company and I don't think I should.

Another thing that could be important is that, for most of measures (paddings, margins, font-size) I've used % or vw, not pixels nor em. I did this because the distances and sizes match better, for example if the font-size is in vw (viewport-width) instead of px or em, when the viewport is bigger the text font is bigger, when the browser is smaller, the text is smaller. Which is exactly what I want in my case.

The thing is that this technique has served me very well for pc and saved me a lot of time, so I don't want to change back to px or em, I'd prefer to stay with %, but the web doesn't look good in my phone and I don't know why, while I've achieved it to look great in any computer and browser size.

Oh, and just if it helps: both in PC and phone (android) I use chrome as browser.

Oh, and I'm also using media queries, for the sizes set by bootstrap (xs, sm, md and lg). I have 5 css: - stlye.css: just for colors, borders and so - style-lg.css, style-md.css, style-sm.css, stlye-xs.css, for % and vw (measures)

style.css is loaded always, while the rest is loaded depending on the size of the screen, which in phone will be style-xs.css.

And I've also tried to give the browser the same size as my phone. My phone's resolution is 1280x720. I've set that size in the browser and it looks fine (in pc)




Reasons for using of svelte js

I found svelte framework these days. What do you think about using it instead of reactjs or vuejs? I didnt use it at all so i don't understand deep difference between them. I have read that svetle much faster, but it doesnt have certain support for state storing like redux and so on. So what can you say about this? I tried to find some more info about advantages and disadvantages but it was in vain.




lundi 30 octobre 2017

Spring boot deployment error - java.lang.IllegalStateException: Multiple ServerProperties beans registered

Hi I am trying to deploy and application spring boot. It is a SOAP over JMS channel app using apache CXF. while deploying i get the below error

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tomcatEmbeddedServletContainerFactory' defined in class path resource [org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat.class]: Initialization of bean failed; nested exception is java.lang.IllegalStateException: Multiple ServerProperties beans registered 
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getEmbeddedServletContainerFactory(EmbeddedWebApplicationContext.java:199) ~[spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:162) ~[spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134) ~[spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE]
        ... 8 common frames omitted
Caused by: java.lang.IllegalStateException: Multiple ServerProperties beans registered 
        at org.springframework.util.Assert.state(Assert.java:70) ~[spring-core-4.3.11.RELEASE.jar:4.3.11.RELEASE]
        at org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration$DuplicateServerPropertiesDetector.customize(ServerPropertiesAutoConfiguration.java:84) ~[spring-boot-autoconfigure-1.5.7.RELEASE.jar:1.5.7.RELEASE]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_131]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_131]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_131]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_131]
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333) ~[spring-aop-4.3.11.RELEASE.jar:4.3.11.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) ~[spring-aop-4.3.11.RELEASE.jar:4.3.11.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.3.11.RELEASE.jar:4.3.11.RELEASE]
        at com.fidintl.bs.common.TransactionInterceptor.invoke(TransactionInterceptor.java:69) ~[BSCommons-1.3.22.jar:na]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.11.RELEASE.jar:4.3.11.RELEASE]
        at com.fidintl.wst.util.spring.PerformanceAdvice.invoke(PerformanceAdvice.java:33) ~[wst-utilities-3.0.0.jar:na]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.11.RELEASE.jar:4.3.11.RELEASE]
        at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:52) ~[spring-aop-4.3.11.RELEASE.jar:4.3.11.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.11.RELEASE.jar:4.3.11.RELEASE]
        at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52) ~[spring-aop-4.3.11.RELEASE.jar:4.3.11.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.11.RELEASE.jar:4.3.11.RELEASE]
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) ~[spring-aop-4.3.11.RELEASE.jar:4.3.11.RELEASE]
        at com.sun.proxy.$Proxy131.customize(Unknown Source) ~[na:na]
        at org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizerBeanPostProcessor.postProcessBeforeInitialization(EmbeddedServletContainerCustomizerBeanPostProcessor.java:73) ~[spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizerBeanPostProcessor.postProcessBeforeInitialization(EmbeddedServletContainerCustomizerBeanPostProcessor.java:59) ~[spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:409) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1620) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE]
        ... 16 common frames omitted

I have searched the net but i cant find why this is ? my app contains both xml and annotation based beans.i have checked and there are no duplicate beans. Has anyone faced a similiar issue ? Are there any specific types of beans which are causing this error?




how to implement twitter like interface in html

I need help on creating an independent page in parent HTML where feeds are displayed just like twitter and Facebook. The navigation area remains staid while scrolling up it down. Thanks a lot.




How can i develop a function that test internet spped on my android app?

How to develop the function of testing web page speed on Android, how to get the first packet size, loading time, speed and DNS corresponding time? Seek help!!

can i use proxy just like fiddercore?




Dropdown menu change two class in div on click

I have a code for submenu, where I need change, that I click on list, it will also add another class for <li class="dropdown"> and it would be class "test". It should work the same way it works for the submenu, it's a class for an active element where I need to have a colorful background.

Can help me someone please?!

var main = document.querySelector('.main');

main.addEventListener('click', accordion, false);

function accordion(e) {
  e.preventDefault();    
  if (e.target.tagName === 'A' && e.target !== e.currentTarget) { 
    var dropArray = Array.from(document.querySelectorAll('.dropdown-menu'));
    var tgt = e.target.nextElementSibling;
    if(tgt) {
      for (let drop of dropArray) {
        drop.classList.remove('show');
      }
      tgt.classList.add('show');
      tgt.classList.remove('hide');
    }
  }
  e.stopPropagation();
}
ul {
  list-style: none
}

.dropdown a {
  text-decoration: none;
}

.dropdown [data-toggle="dropdown"] {
  position: relative;
  display: block;
  color: black;
  padding: 10px;
}

.test {
  background:red;
}

.dropdown .dropdown-menu {
  max-height: 0;
  overflow: hidden;
}

.dropdown .dropdown-menu li {
  padding: 0;
}

.dropdown .dropdown-menu li a {
  display: block;
  padding: 10px 10px;
}

.dropdown .show {
  display: block;
  max-height: 9999px;
  margin-left: 50px;
}

.dropdown .hide {
  max-height: 0;
}
<div class="container">
  <ul class='main'>
    <li class="dropdown test">
      <a href="#" data-toggle="dropdown">First Menu</a>
      <ul class="dropdown-menu">
        <li><a href="#">Home</a></li>
        <li><a href="#">About Us</a></li>
        <li><a href="#">Services</a></li>
        <li><a href="#">Contact</a></li>
      </ul>
    </li>
    <li class="dropdown">
      <a href="#" data-toggle="dropdown">Second Menu</a>
      <ul class="dropdown-menu">
        <li><a href="#">Home</a></li>
        <li><a href="#">About Us</a></li>
        <li><a href="#">Services</a></li>
        <li><a href="#">Contact</a></li>
      </ul>
    </li>
    <li class="dropdown">
      <a href="#" data-toggle="dropdown">Third Menu </a>
      <ul class="dropdown-menu">
        <li><a href="#">Home</a></li>
        <li><a href="#">About Us</a></li>
        <li><a href="#">Services</a></li>
        <li><a href="#">Contact</a></li>
      </ul>
    </li>
  </ul>
</div>



Have a webpage host/run an electron app

I have created an electron app for the company i work for that functions as a facial recognition log in. It was originally to be designed as a desktop app, however they changed their minds last minute and want it to now be hosted online. Can I just integrate my app into their website and have it run that way, or do i need to redesign my app into a webpage (which i have already attempted and is quite difficult)




Apache installing and running php files

Im having some problems with running php files on my apache server. i have installed php 7, the folder /etc/php/7.0 exists which shows it's installed. I have configured apache to run .php files, however in my /etc/apache2/mods-enabled folder there isn't a php.conf file. Any ideas about how to install it?

(im on raspbian), apache version 2.4.25




web-based interface to linux or windows server

I'm volunteering to run a programming contest for my children's school and I want to build a web interface for children to submit their code - it is a competitive coding application, similar to robocode (http://ift.tt/KrJYKb) but a different thematic approach. I've already built a simulator that can handle between 1-4 contestants at a time, including a GUI based on freeglut, and it runs on Windows or Linux - but I'd like to create a web interface for submission/testing for the kids (submission for the final contest - testing for them to run their code in a demo environment for refinement). Ideally, it would be a file upload or text interface form that would remotely execute on my server and display the output in the web interface. The interface is low intensity 2D graphics, but does run for a few minutes (wall clock) of simulation time. No compilation of their code is necessary - the simulator is an interpreter. The school website uses wordpress, and I can use windows or linux for the server to run the simulator.

Is there any software already available to help me do this in a secure/robust manner? I have rudimentary PHP knowledge, but extensive non-web programming experience. I have tried to search for this on the forums, as I'm sure there are existing questions like this, but I'm having a hard time finding anything - maybe I have the wrong search terms.

thanks very much for any leads on this!




Access WEB API from my local server

So I'm trying to get access to a WEB API from my local server, using hurl.it it's no problem. But on my local server I'm getting this:

Failed to load http://ift.tt/2iMrUm0: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. The response had HTTP status code 404.

I've checked the response from the server and it gives me the Access-Control-Allow-Origin: *, which is needed for me to access it.

I'm using vue.js with axios, should not depend on that I believe but who knows :)

Thanks!




Does Jupyter support 'read-only' notebooks?

My team is currently developing a fairly quick clustering job using Pandas for business analysts. We're planning on hosting a local server where the end user can input a few parameters to be used during the routine execution, which will access an internal database and then return a CSV file.

A Jupyter server would be ideal for us, but the problem is that we can't have the user being able to edit the underlying code - all he needs to do is supply the parameters and start job execution. Converting it to HMTL, I think, turns everything static and means we can't delived updated data on demand.

Plan B is just making a small django app but I'm wondering if there's a way to accomplish what I need with Jupyter itself, or else if there's any better alternative for similar use cases? We don't even plan to display any widgets, just provide the user with the raw data output.

thanks in advance




Using RewriteEngine / mod_rewrite for login system?

Is it possible to build a login system using mod_rewrite? To be more specific on the problem: I have some static webpages that are build by a website generator and cannot modify by myself. But these webpages and their original URLs shall not be able to be accesed by the public. There is also a WordPress website using a login-system running on the same domain.

So, my idea to protect the static webpages to the public was to use a mod_rewrite rule, based on the WP session cookie. Is that even possible? Or is there even a cleaner and simpler solution for that?

Cheers, Valentin




How to call a JS function by Bean JSF passing parameter as soon as the page loads?

I have to call a function in my JS by passing a vector as a parameter when the page loads.

I can do this using a p: commandButton, where here:

 actionListener = "# {routeEnterBean.GetMap ()}"

I run the function in the Bean (getting values in the database) and then, here:

 oncomplete = "initMap (xhr , status, args) "

Thus, the JS function is executed

Code Bean:

public void gerarMapa() {   
        RequestContext context = RequestContext.getCurrentInstance();
        context.addCallbackParam("coord", new 
          org.primefaces.json.JSONArray(coordenadas));
    }

Function JS

function initMap(xhr, status, args) {  
    var qtd_entregas = args.coord.length;
    for (var i = 0; i < args.coord.length; i++) {
        waypts.push({
            location : args.coord[i].latitude + ', ' + args.coord[i].longitude,
            stopover : true,
        });
    }
}

But I'm wanting to do this without having to click the button as soon as I load the page.

I know that it is possible to execute a function using this command:

RequestContext.getCurrentInstance().execute("testeJS();");

But I do not know how to pass a vector as a parameter




Extract all links from html in Python

I have tried to find solution for this, and I found many answers, but all these answers works for cases where link seems like '




Import Web Map from internet

I want to import a web map in internet for my thesis but I don't know how is it possible. I want to use a free software to convert the hypotetical web map in a network.




Post data to python flask form from a html page

I would like to send data to a Flask form from an application that is developed in Polymer, how to do it?

Thanks.




How to save web page informations on android?

I want that the app only chack the web page only one time a day, so I want that the data are save. And if the app open again, the data shoud be load. I am inspired by http://ift.tt/1p228Gk. But I can not save the result with MainActivity extends AppCompatActivity:

String url = "http://ift.tt/16kwqqf"; SharedPreferences data; SharedPreferences.Editor dataEditor;

and Date extends AsyncTask:

Document document = Jsoup.connect(url).get(); Elements date = document.select("div#mp-otd p b"); String sDate = date.getText(); dataEtitor.setString("date", sDate) // <-- this do not work




How to execute a js code on a list of websites?

Im trying to transfer my saved list from one instagram account to another, I have found a code that allows me to like the picture when im on that picture link in the browser. Now I have wrote a code in js that pulls the links from my saved pictures and have a long list of links of pictures I have liked on my older account. each link is separated by
.

What I really need to do is to find a way to visit each of these links then execute the like code automatically (around 300+ links) , I will be on my new account and that way i will transfer the saved pictures.




how to display json data related to one id

so, ive written a code for which i need to get locations of that current bike, instead, i am getting the all locations

this is the api "http://ift.tt/2gNLjis"

i wanna display the locations at which that particular bike is available in the select box....

but i am getting all the locations irrespective of the bike...

function available(id){

      $.ajax({
        /*url:'http://ift.tt/2zJDXnw',*/
          url:'http://ift.tt/2hfMqb8'+id+'/models',
        method:"GET",
        data : {
            'start_time': $('#datetimepicker1').val(),
            'end_time': $('#datetimepicker111').val(),
            'end_date': $('#datetimepicker21').val(),
            'start_date': $('#datetimepicker2').val()
        },


    }).done(function(data){
          for (var i=0; i<data.result.data.length; i++){

            var available_location = data.result.data[i].available_locations;

                for(j=0; j<available_location.length; j++) {
                    console.log(available_location[j].area);
                    var options = $(".selectionBike");

                    $.each(data, function() {
                        options.append('<option>'  + available_location[j].area +  '</option>');

                    });



              $('.bike-imgs ').append(
                  '<div class="bike-imgs-inner col-xs-12">'+
                  '<img class="bike-in" style="width:100%" src="'+data.result.data[j].image.full+'" />' +
                  '<div class="col-sm-8 col-md-8 col-xs-6"><div class="selected-bike-s1">'+data.result.data[j].name+'</div></div>' +
                  '<div class="col-sm-8 col-md-8 col-xs-6"><div class="selected-bike-loc">'+data.result.data[j].available_locations[0].area+'</div></div>'+
                  //'<div class="col-xs-12 bike-price"> '+data.result.data[i].totalPrice+'  </div>' +
                  '<div class="col-xs-12 bike-price text-center"><select  class="selectionBike form-control"><option>'+available_location[j].area+'</option></select> </div>' +
                  '<div class="col-xs-12 bike-price text-center"> <p> '+data.result.data[i].available_locations[j].price[0]+' </p>  </div>' +
                  '<div class="col-xs-12 bike-price text-center"> <p> '+data.result.data[i].available_locations[j].price[1]+' </p>  </div>' +

                  '</div>'
              );

                }




          };


    });
};



Asynchronous update of promise in Netty Nio

Having a server and client architecture which sends information. I wanted to return from the server the number of connected channels to the clients. Am returning the message of the server to the clients using promise. My code is:

public static void callBack () throws Exception{

   String host = "localhost";
   int port = 8080;

   try {
       Bootstrap b = new Bootstrap();
       b.group(workerGroup);
       b.channel(NioSocketChannel.class);
       b.option(ChannelOption.SO_KEEPALIVE, true);
       b.handler(new ChannelInitializer<SocketChannel>() {
        @Override
           public void initChannel(SocketChannel ch) throws Exception {
            ch.pipeline().addLast(new RequestDataEncoder(), new ResponseDataDecoder(), new ClientHandler(promise));
           }
       });
       ChannelFuture f = b.connect(host, port).sync();
       //f.channel().closeFuture().sync();
   }
   finally {
    //workerGroup.shutdownGracefully();
   }
}

public static void main(String[] args) throws Exception {

  callBack();
  while (true) {

    Object msg = promise.get();
    System.out.println("The number if the connected clients is not two");
    int ret = Integer.parseInt(msg.toString());
    if (ret == 2){
        break;
    }
  }
  System.out.println("The number if the connected clients is two");
}

When I run one client it is always receiving the message The number if the connected clients is not two and the returned number is always one. When I run a second client it is receiving always as a ret value two, however, the first client still is receiving one. I cannot find which is the correct way to update the promise for the case of the first client.




How to give directions?

I am creating a website which includes a map to show the location of the restaurant, however, I want to add functionality to the site which lets the user select a button to get directions from their geolocation or current location if on mobile to the restaurants location and display it on the page.

My mock up of the map is like so:

    <main role="main" class="container bg-content">
    <h1 class="head-font text-center">Where are we</h1>

    <div class="row margin">
        <div class="col">
            <div id="map"></div>
            <script>
              function initMap() {
                var restaurant = {lat: 54.772373, lng: -6.526826};  
                var options = {
                    zoom: 14,
                    center: restaurant,
                    disableDoubleClickZoom: true,
                    draggable: true,
                    fullscreenControlOptions: true
                };

                var map = new google.maps.Map(document.getElementById('map'), options);

                var contentString = '<div class="col">' +
                                        '<div class="row">' +
                                            '<h1><p style="padding-left: 20px;">Our location</p></h1>' +
                                        '</div>' +
                                        '<div class="col">' +
                                            '<div class="row"' +
                                                '<p>116 Hillhead Rd, Castledawson, Magherafelt, BT45 8ET</p>' +
                                            '</div>' +
                                            '<div class="row"' +
                                                '<h2 class="active-item">Phone us: </h2>' +
                                                '<p style="padding-left: 5px;"><a href="tel:028 7946 8322"> 028 7946 8322</a></p>' +
                                            '</div>' +
                                        '</div>' +
                                    '</div>';


                var infowindow = new google.maps.InfoWindow({
                    content: contentString
                });

                var marker = new google.maps.Marker({
                  position: restaurant,
                  map: map,
                  maxWidth: 400,
                  title: 'The Old Thatch Inn'
                });

                marker.addListener('click', function() {
                    infowindow.open(map, marker);
                });
          }
            </script>
            <script async defer
                    src="http://ift.tt/2ifXaWD">
            </script>     
        </div>
    </div>

    <div class="row margin">
        <div class="col">
            <button type="button" class="btn btn-info btn-sm">Get directions to us</button>
        </div>
    </div>
</main>

I am new to Javascript and know the basics of it, just not sure how to go about things with this. Any help or guidance is appreciated. The directions will should display below the map itself




How to get value of CKEditor 5?

I want to be able to return the value of the CKeditor textarea, and also write my text inside it .. i used CKEDITOR 5 CDN, Fisrt this my code for the textarea it works fine

<script src="http://ift.tt/2zhLmhH"></script>

<textarea class="inputStyle" id="editor" name="content" placeholder="Write your email.."></textarea>
<script>ClassicEditor.create(document.querySelector('#editor')).catch( error => { console.error( error );  } ); </script>

I used to get the data from the textarea before the CKeditor by:

var text = $('textarea#editor').val();

and set the data by:

$('textarea#editor').html("");

but i'm lost now? i tried many ways .. what is the correct way?




Save As dialog in Angular

Is it possible to display a Save as dialog in angular or through vanilla js? similar to this? Where a user can specify where to save a file to?

Save As Dialog

Thanks.




Admin dashboard to run powershell

I am using PowerShell since several years now to ease up the work for me and my colleges with several PowerShell modules. Now we've had the idea to run everything directly from a website via IIS so that we don't have to bother with the deployment of the latest modules to all clients and also enabling the chance to work from home office and other places where there's only a very slow internet connection available. We'd also like to output some monitoring stats on the site.

Right now I'm struggling with finding the right solution for us. We'd like to avoid as much work as possible if it comes to styling and functions of the website itself. The best I could find so far and that I'd prefer using is something like the following template: http://ift.tt/KgMC7c

So my questions are as follows:

  • Are there any other solutions as well? We don't mind paying a reasonable price if it saves us work
  • What should we use? asp.net / ruby / php / ...? I only have experience with php. As far as I can see asp.net might be better suited to handle returned vars and objects from the powershell scripts and display them as we desire without writing html in the PS modules

thanks in advance




dimanche 29 octobre 2017

Handle charts for web

I have to graph around 525, 600 (a register each 5 minutes for 5 years) data fields (lat,long,time,etc) in a web app. the size for 10 rows is 1 KB thus, all this data will consume ~ 51.5 MB. The web app must show all this data for forecast purposes, the user can do zoom, pan, etc.... I have 2 problems.

1.- Handle half million registers ín a PC is very hard for that, and for mobile too, both are very slow. I think that is not a realy option.

2.- Make a http request for 50 MB for each time that a user make scroll, pan, etc can be expensive (the web app is entirely hosted in AWS and the GB/out have a co$t), the web app will have 5000 users many hours in a day.

I think in a diferencial data sending, example, the user fetch all data for analyze a chart, but when fetch the same data for another chart only fetch the differential data (the data missing) for that chart, but I am very confused.

I pray for your help how a handle correctly this data amount for good performance user experience and low costs in AWS, any idea will be welcome! Thank a lot.




MEAN Web Stack Application Structure

I recently began developing with the MEAN Web Development stack and whilst viewing and reading copious amounts of tutorials and documentation, I was never able to see any structural development similarities. One of the better online tutorials broke their structure into front-end and back-end folders and subsequence sub-folders and implementation of nodemon and gulp was used to run both sides simultaneously. Another tutorial simply started with Angular 2 and implemented the rest of the MEAN stack components on top, but putting server side code in it's own folder.

I was wondering if there was a web structure used by most web developers, or are there those that are better than others?




How to create charts for each user's statistics?

I am working on a wordpress website that will allow members to sign up. I was wanting to create a dashboard where after users take something like a personality quiz it would show a chart of their results. Along with this dashboard I was hoping that these charts and other statistics could be saved per user, i.e. Joe see's his results and Sarah her's. Does anyone know of a plugin or outline how I might attempt this. Thank you.




Telegram Bot - Bad Request: wrong file identifier/HTTP URL specified

I have a weird problem with uploading a file to telegram via the sendDocument method. I am writing a bot in python with python-telegram-bot. I try to send a ZIP file to a user, giving a URL as document. This is the URL: http://ift.tt/2zZ4KNC

bot.send_document(
    chat_id,
    document=document,
    filename=filename,
    timeout=60)

As much as I know my file follows the rules given by Telegram: http://ift.tt/2zZ4KNC

  • Provide Telegram with an HTTP URL
    • http://ift.tt/2zZ4KNC
  • 20 MB max
    • 2.14 MB
  • correct MIME type
    • application/zip
  • sending by URL will currently only work for gif, pdf and zip files
    • ZIP file

These are the headers:

Accept-Ranges →bytes
Connection →keep-alive
Content-Length →2247049
Content-Type →application/zip
Date →Sun, 29 Oct 2017 21:15:36 GMT
ETag →"59f5e6e6-224989"
Last-Modified →Sun, 29 Oct 2017 14:34:14 GMT
Server →nginx/1.10.3 (Ubuntu)

The file is served by nginx (v1.10.3), with this simple configuration.

server {
    listen 80;
    server_name telegram.nickespig.ch;

    root /path/to/download_dir;
    location / {
        try_files $uri $uri/ =404;
    }
}

Where /path/to/download_dir is replaced with the actual path of course.

The error I get, as said in the title, is this one:

{
    "ok": false,
    "error_code": 400,
    "description": "Bad Request: wrong file identifier/HTTP URL specified"
}

Also sending another ZIP file which I found online works: http://ift.tt/2xwTVAE

I already searched for a solution and eg. this Telegram bot weird error : Bad Request: wrong file identifier/HTTP URL specified and this Why i get Wrong file identifier/HTTP URL specified error in telegram bot? do not help.

I hope you guys can help me with this.




How to pass parameters from a jsp to fill form of jsp2 and execute submit

I have two JSPs

JSP1: has a search field a button and three tabs bellow just like Google has the tabs web, images and maps. This JSP sends the text entered as well as the selected tab in POST to a servlet that handles the searching given a string and type.

JSP2: is a separate page with annotated paragraphs with some sentences as links. when a link is clicked, it submits two parameters(content and type) in a get method to JSP1.

What I want to achieve resembles the service (LetMeGoogleItForYou). #1 When a link is clicked in JSP2, I want to redirect the browser to JSP1 and #2 fill the search bar of JSP1 with the content submitted from JSP2 and make the tab corresponding to type active as well as trigger the form submit of JSP1.

I have achieved #1, but I can not figure out how to do #2. I am requesting any approaches or examples on how to achieve this.




Professional Web Developers – can you please help a worthy cause by taking an 8-minute survey?

I am a researcher studying web developer practices for developing client web sites, especially as it relates to security.

You can help with this project by taking a survey at:

http://ift.tt/2zgwU9L

NOTE: A charitable donation will be made for each completed survey – additional details on the survey.

Participants can also receive a free copy of survey results by contacting me at nscalera28@optonline.net.

Thanks,

Nick Scalera NJS Marketing Services




Serving static content with Jersey

I have a sample web application in Jersey. I want to serve static content with it. The thing is I dont want to use web.xml and I have tried many configurations without any luck. Can someone please help? Here is my configuration.

ApplicationConfig.java

package com.zeeshanabid.jblog;

import com.zeeshanabid.jblog.controller.PostController; import org.glassfish.jersey.server.ResourceConfig;

import javax.ws.rs.ApplicationPath;

@ApplicationPath("/blog") public class ApplicationConfig extends ResourceConfig {

    public ApplicationConfig() {
        super(PostController.class);
        packages("com.zeeshanabid.jblog");
    }

}

IndexController.java

package com.zeeshanabid.jblog.controller;


import javax.ws.rs.GET;
import javax.ws.rs.Path;


@Path("/index")
public class IndexController {
    @GET
    @Path("/")
    public String index() {
       return "index.html";
    }
}

And I have a static file index.html in resources directory.

enter image description here

The whole repository is at this location. http://ift.tt/2iGAaUF

Any help is appreciated. Thanks a lot.




Website - Issues with responsivness on mobile devices

To make my website as responsive as possible, I used rem and % to set the sizes of everything. Furthermore, I used flexible boxes that are shown horizontally on displays with a big width and shown vertically on smaller display. This works perfectly fine when I resize my desktop browser window on my laptop, but when I use a smartphone, most of the rules seem to be ignored.

Is there a special setting that I have to configurate to be responsive on mobile devices or what do you think?




Microsoft QnA Active Learning Bot Node.js

i have the following code for the Microsoft QnA Bot but i want to know how can i integrate the active learning feature.I found some tutorials and some code samples but i really don't know how to add it to my bot!

var demo=JSON.stringify({"question":"Hi"});

var extServerOptionsPost={
    host:'westus.api.cognitive.microsoft.com',
    path:'/knowledgebases/*my_id*/generateAnswer',
    method:'POST',
    headers:{
        'Ocp-Apim-Subscription-Key':'*my_sub*',
        'Content-Type':'application/json',
        'Content-Length':Buffer.byteLength(demo)
}
};

var reqPost=http.request(extServerOptionsPost,function(res){
    console.log("response statusCode: ",res.statusCode);
    res.on('data',function(data){
        console.log('Posting Result:\n');
        process.stdout.write(data);
        console.log('\n\n POST Operation Completed');
    });
});


reqPost.write(demo);


reqPost.end();
reqPost.on('error',function(e){
    console.error(e);
});




Submenu does not work as I want

I have a problem with my submenu. The submenu reacts on click, but I have a problem, that I click on submenu <li>, content is removed and I don't want this. And is there any error with that, it write this error "Uncaught TypeError: Cannot read property 'classList' of null".

Can help me someone?

/* Added .main class to parent <ul>
|| By adding the eventListener to the
|| parent of multiple clickable nodes
|| and using e.target property to find
|| the exact node actually clicked, we
|| have just needed the <ul> to listen
|| rather than 3 separate <li>
|| This is part of Event Delagation
*/
var main = document.querySelector('.main');

main.addEventListener('click', accordion, false);

function accordion(e) {
  // Stop <a> from jumping
  e.preventDefault();

  /* Gather all .dropdown-menu to a NodeList
  || then covert it to an array
  */
  var dropArray = Array.from(document.querySelectorAll('.dropdown-menu'));

  /* if the clicked node (e.target) is NOT the
  || node listening for event (e.currentTarget
  || ul.main) then...
  */
  if (e.target !== e.currentTarget) {

    /* Assign e.target to var
    || Find tgr next sibling (.dropdown-menu)
    || Iterate through dropArray wth a
    || for...of loop
    || Remove .show and add .hide on
    || each .dropdown-menu in dropArray
    || Then add .show and remove .hide
    || on tgt
    || Finally stop the click event from
    || bubbling, thereby preventing anything
    || else from being triggered.
    */
    var tgr = e.target;
    var tgt = tgr.nextElementSibling;
    for (let drop of dropArray) {
      drop.classList.remove('show');
      drop.classList.add('hide');
    }
    tgt.classList.add('show');
    tgt.classList.remove('hide');
  }
  e.stopPropagation();
}
ul {
  list-style: none
}

.dropdown a {
  text-decoration: none;
}

.dropdown [data-toggle="dropdown"] {
  position: relative;
  display: block;
  color: black;
  padding: 10px;
}

.dropdown .dropdown-menu {
  max-height: 0;
  overflow: hidden;
}

.dropdown .dropdown-menu li {
  padding: 0;
}

.dropdown .dropdown-menu li a {
  display: block;
  padding: 10px 10px;
}

.dropdown .show {
  display: block;
  max-height: 9999px;
  margin-left: 50px;
}

.dropdown .hide {
  max-height: 0;
}
<div class="container">
  <ul class='main'>
    <li class="dropdown">
      <a href="#" data-toggle="dropdown">First Menu</a>
      <ul class="dropdown-menu">
        <li><a href="#">Home</a></li>
        <li><a href="#">About Us</a></li>
        <li><a href="#">Services</a></li>
        <li><a href="#">Contact</a></li>
      </ul>
    </li>
    <li class="dropdown">
      <a href="#" data-toggle="dropdown">Second Menu</a>
      <ul class="dropdown-menu">
        <li><a href="#">Home</a></li>
        <li><a href="#">About Us</a></li>
        <li><a href="#">Services</a></li>
        <li><a href="#">Contact</a></li>
      </ul>
    </li>
    <li class="dropdown">
      <a href="#" data-toggle="dropdown">Third Menu </a>
      <ul class="dropdown-menu">
        <li><a href="#">Home</a></li>
        <li><a href="#">About Us</a></li>
        <li><a href="#">Services</a></li>
        <li><a href="#">Contact</a></li>
      </ul>
    </li>
  </ul>
</div>



adding online payments to website

I'm new in online payment who could inform me the basic things about online payment I want know How I could add my mastercard or visa to my website to sell my products please who could guide me step by step




Making FileField link through ForeignKey object

How can i create a link to the particular file?

models.py

class Post(models.Model):
    ....

class Presentation(models.Model):
    pres_id = models.AutoField(primary_key=True)
    description = models.CharField(max_length=100)
    upload = models.FileField(upload_to='presentation', null=True)
    def __str__(self):
        return self.description

class Participant(models.Model):
    conference = models.ForeignKey(Post, related_name = 'members', on_delete=models.CASCADE, null=True, blank=True) #Post class
    presentation = models.ForeignKey(Presentation, related_name = 'pres', on_delete=models.CASCADE, null=True, blank=True)

views.py

def post_detail(request, pk):
    post = get_object_or_404(Post, pk=pk)
    return render(request, 'plan/post_detail.html', {'post': post})

post_detail.html



part.presentation returns only Presentation description. But I need also a file link. How can i solve this problem. Thanks.

(Structure: there is a post with information about conference participants, presentations, etc. Presentation descriprion link should open a pdf file in browser)




show my cursor on another pc - Client - Server

Me and my friend is working in Blender on each our pc. We use Skype to see each others screens.(He lives i another city). When i'm looking at my friends screen in Skype(fullscreen) and try to guide him to click on something, it's very difficult for me to explain where he needs to click. I can tell him to move up a bit or look in bottom left corner for the button or menu he needs to click. but i cant actually show him. It's very time consuming and frustrating.

I want to make a C# program that takes my mouse-position on my screen and shows it on my friends screen. As a second cursor.(semi-transparent or colored or mirrored).

I don't want to Click on his screen. I just want to point him to the right place on the screen. Then i just have to point and say click HERE!!

I imagine that we both have two cursors on our screens. On my screen i see his cursor as yellow, and my cursor as white. on his screen my cursor is Yellow and his is white.(regardless who's sharing the screen i Skype.)

I't has to be aware of different screen sizes, i'm using 1680 x 1050. He is using 1980 x 1050. How do i convert the positions to %? (we both have a two screen setup)

We have tried JoinMe. but it was not what were where looking for. No cursor!

We both have a webpage on a server.(can we use that?)

http://ift.tt/2z0k3rk I have tried this code but it seems to be local only. When i send the client.exe to my friend, and i run the server.exe, we can't connect. it works fine Local. on my pc.

I've tried making an exe that constantly sends my mouse pos to an text file. And then another exe that constantly receive those numbers. Problem is i don't have WRITE access to the text file on my server.

http://ift.tt/WP0Vzj This one i have tried too, but could't get it to work.

Hope this explains it well enough.

So, is it even possible?(does it exist already(free)?) What should i be looking for.(i have tried, multi cursor, share cursor, show cursor Online, remote cursor an more....no luck!!) How should i approach this?

I think it would be a very nice and time saving tool for Skype Screen Sharing.

Looking forward to some nice ideas.

-MM-




i want to resize all the elements in my css animation

you can see only the boxshadow that resize in my animation,i have problem when i want to resize the image and the input ,knowing the div contain all other elements . the code :

<html lang="en">
<head> <meta charset="UTF-8"> <title>miniproject.html</title>
<style type = "text/css">
    .boxshadow
    {
        box-shadow:10px 10px 20px 1px #555;
        width: 400px;
        height: 180px;
        background-color: gold;
        border-radius: 50px;
        margin-top: 200px;

    }
    body
    { background-color:aqua;}

    /*animation*/
    @keyframes anim{
       0% {width: 0px;height: 0px;} 
       100% {transform: rotate(360deg);} 
 }

#animation    
    {position : relative;
    animation-name : anim;
    animation-duration: 5s;
    animation-timing-function: linear;

    }





    </style>

        </head>
    <body>
    <center><div class="boxshadow" id="animation"> 
    <img src="logo.png" width="100px" heighth="100px"><br>
      <table>
          <tr>
              <td> name :</td> <td> <input type="text"></td></tr>
          <tr>  <td> password :</td> <td> <input type="password"></td>  </tr>
        </table>
        </div></center>



    </body>
</html>




List and image on one row appear to be warpping [bootstrap]

I want to have a list and an image side by side in one row on my webpage. I feel like I have made some errors with bootstrap because the list is ending up below the image (maybe because they take up too much space- I don't think I have too many columns and it is wrapping)

Any suggestions woould be appreciated.

Thanks

HTML

<div class="row">
            <div class="col-xs-3">
              <img class="image-two image-border" src="http://ift.tt/2ycngVA" alt="Me and Ami laughing together" /> 
            </div>
       </div>


            <!-- list of reasons I love Ami here -->
            <div class="row">
              <div class="col-xs-5 list-background">
              <p> Reasons I love her: </p>
                <ul> She is filled with love </ul>
                <ul> Her beautiful eyes </ul>
                <ul> Her lust for life </ul>
                <ul> The way she loves me </ul>


    </div>
</div>

CSS

.image-two 
{
max-width:40%;
max-height:40%;
}

.image-border {
padding:2px;
border:1px solid #021a40;
background-color: #0000ff;
}

.list-background{
display: inline-block;
background-color: yellow;
text-align: left;
border: solid;
border-radius: 25px;
max-width: 50%;
padding-top: 10px;
padding-bottom: 10px;
font-size: 20px;
padding-bottom: 0px;




I want to know what path to follow to become a full stack developer

I am a computer science student in a university and the university does not provide any proper guidance or any proper technical knowledge to become a good developer in the current world,even the syllabus is outdated,I am trying to learn on my own but i want some kind of guidance.

Right now I am Learning MEAN stack development,ML,openCV and android and i am not getting anywhere,I am trying to learn everything in parallel but it's not helping me.

If anyone can provide me with some kind of help on how to become a relevant developer in this day and age,and could tell me what path to follow or what technologies to learn that would be a huge help.

I know it's not a technical question but I don't know where else to ask for help.

Thank You in advance.




C# | How to Post JSON to Webserver

i have an Webspace with the domain http://www.xyz.de for example. And a program in c# where i can create user profiles. When i created a user profile, it should be that the new user profile should post to Webspace in JSON. So that it would like this: URL: http://www.xyz.de/user

JSON:

{
  "userid": 1,
  "username": "Username"
}

I have searched after results for my problem, but i get only a 404 Not Found Error or nothing and still nothing happened.




Warning SMS before actual date to Client using PHP

Let's assume. I have a customer who purchases some goods and gives me a half payment and tells me that I will pay the remaining payment on this specific date.

So for this, I want to make a program which sends message automatically to the client before the actual date. This message act like a warning that 2 days are remaining or 3 days. I want to do this in PHP.

How is this possible I mean what step I have to do after using SMS Gateway?




How to add a small dash under a word?

enter image description here[How do I add that small dash under the word? border bottom doesn't work.][2]




Text and images won't center on my page

I am making my first webpage and I have the elements I want- I can't seem to get them to center on the page. I have tried margin: auto, text-align: center, and lots of toher things. Nothing has worked.

I want the header, an image , and a button at the end of my page, to be a central spine down my page. Any suggestions would be appreciated.

Thanks

Here is my code:

HTML:

<div class="container">

  <h1 class="text-center"> My tribute to Ami Coxill Moore</h1>
</div>

<!-- picture of ami here -->
<div class="container">
  <div class="row">
     <div class="col-xs-4 col-xs-offset-4"></div>
          <a href="#add-fastrack"><img class="img-resize img-center img-zero image-border img-responsive" src="http://ift.tt/2yUQfKp" alt="Ami laughing at her 26th Birthday"> </a>
  </div>
</div>

CSS

body {margin-top: 100px;
background-color: #ff69b4;
font-family: "gerogia", serif;
 color: #0000ff;  }


h1 {
display: inline-block;
background-color: yellow;
font-size: 300%;
border: solid;
border-radius: 25px;
align: center;
padding-left: 40px;
padding-right: 40px;
float: center;
max width: 100%;
text-align: center;
marrgin: 0 auto;
float: center;}

div {
padding-bottom: 20px;
padding-right: 50px;
padding-left: 50px;}

.img-responsive {
margin: 0 auto;}

.img-resize {
max-width: 400px; 
max-height: auto;}




How to include and present 360 Degree pictures on a website?

We want to present a 360° pictures on our website where you can explore the image. Like on the following website:

http://ift.tt/2hjLJxG

Following questions: → How can we realize this technically ?
→ What kind of editorial programm for the 360 photos we neeed?




How to retrieve or store files dynamically to cpanel/server using java code

I purchased server space from goDaddy and got all the required things for a website to run. Now I created a web page and uploaded it in the cpanel public_html folder and could see my changes online. My question is, how to I make it dynamic?

How can I upload files from my website and store it in my server and view it in my cpanel? Is there any path that I should provide in java servlet such that the file gets stored? I am new to web development, kindly provide suggestions or references.




Web API cross layers variable per session

I have WEB API controller, which i need to return some informative value on the header response per each API method call.I can init this value only on my lower layer (DAL). i also have a business Layer (BL) in the middle. Is there an elegant way to set the value on the DAL , and then easily retrieve it on the controller? instead of passing it all over the layers or returning it wrapped in some returned object. i cannot use static global as it will be shared right? and i need it per session.

Any advise?

Thanks




How to write ad revenue sharing algorithm for user uploaded content?

How could I make an algorithm to automatically split ad revenue on a website? I've heard it can be done in php but I don't know where to start.




samedi 28 octobre 2017

How to Bypass Safari Autoplay Block

I am developing a site which one of it's core features is playing music. It works flawlessly on any browser except for Safari. After hours of investigation I discovered a setting in Safari, preventing websites from auto playing media.

Once I disabled this feature (so I allowed auto playing media) the music was being played on Safari flawlessly too.

I now need to discover a way to bypass the auto playing media block Safari has implemented as it's default setting. I tried googling around but any problem like mine has remained unanswered, at least from what I found.

Any help would be great, thanks!




How to fix "Cannot read property 'apply' of undefined"?

i use openlayers 2, and when i try run my project in my web browser (chrome), i have this error. can you give me a solution? thanks

http://ift.tt/2lqgGEG




Getting TypeError 'callback' is not a function on event emitter

I am trying to make this module work on Node 8.7 When I run it, console throws Type Error callback is not a function(on emit method).

I'm using this module with a class in order to make the other class inherit from the Event Emitter.

Node keeps throwing me random errors, when I tried the same code on one file(with Event Emitter and the other class as separate classes) it worked.

//export class EventEmitter...

class EventEmitter{
    constructor(){
        this.events = {};
    }
    on(eventName,callback){
        if (typeof this.events[eventName] !== 'object') {
            this.events[eventName] = [];
        }

        this.events[eventName].push(callback);
    }
    emit(eventName, ...rest) {
        if (this.events[eventName]) {
          this.events[eventName].forEach((callback) => {
            callback(rest);
          });
        } else {
          console.log("The event doesn't exists.");
        }
      }

    off(eventName,callback){
        var index;

            if (typeof this.events[eventName] === 'object') {
                index = this.events[eventName].indexOf(callback);

                if (index > -1) {
                    this.events[eventName].splice(index, 1);
                }
            }
    }
}

module.exports = EventEmitter;

What I'm missing?




Project design for Customized Live Score app for amateur sports games (no existing API)

Please forgive me this is not a question that has codes. I am planning to do a personal project of making a mobile Live Score Application, but I am totally lost where to start and how to move on.

http://ift.tt/12u82km

I want to make my app look something like the website above. But, I want to show a live match of amateur games (like school pick-up games).

In summary, I need to do:

  1. Make a website that display the score of a live game.
  2. Find a way how to input live matches and update scores.
  3. Make it accessible to users.

But I am totally new to this kind of projects and having a hard time how to build a plan for this. What would be a good language, code, platform, etc. for doing this?




How to protect a client-facing json api against bot attacks?

Disclaimer: I am a frontend developer without in-depth training in web security. Perhaps my question will sound trivial. Frankly, I hope it is — that means there is a simple solution. Please don't be angry.

I am working on a single-page web application that is architected according to a common pattern for modern web apps. Specifically, there is a web app itself that lives in the browser, a node-based "backend for frontend" that is responsible for rendering the app and for accepting ajax requests from it (most of which it then proxies to the "proper" backend), and then there is the "real" backend that is responsible for CRUD operations:

enter image description here

We want to make sure that requests coming to the "backend for frontend" have originated in the client-side app in the browser, and not in an attacker's script.

As a part of that task, I enabled csrf protection (using the csurf library), but then it occurred to me that that cannot possibly be enough, because if the attacker makes a normal request using the browser, examines it in dev tools' network panel, and then copies cookies and headers (with the csrf token and the secret key stored in the cookies) from that request to his script, csrf protection will not be able to block such requests. At least as far as I understand how csurf works.

So, I am looking for a better way to make sure that requests are from the client app. Perhaps there is a way to combine the regular csrf-token-based protection with a timestamp to make sure that csrf token copied from request headers expires momentarily? Or maybe there are some other solutions? I am reluctant to invent my own security mechanism. Please advise?

(I have found a similar discussion on security.stackexchange.com, but with few concrete recommendations)




Connecting to a database from a web server

Not sure if this is possible in the way I originally thought it was, but i'm trying to connect a web page to a sql file stored on the same web server. I first had the database set up on my own computer, with the following credentials.

   define('DB_SERVER', 'localhost:3306');
   define('DB_USERNAME', 'root');
   define('DB_PASSWORD', '');
   define('DB_DATABASE', 'test');
   $db = mysqli_connect(DB_SERVER,DB_USERNAME,DB_PASSWORD,DB_DATABASE);

This connection worked and I got everything working locally. When I try to use this code after transferring everything to the web server, I get an error. I assumed it was with the credentials, so I've tried changing the above values to match the web server address, as well as the user login for the web server, with no luck. Not quite sure what else to try, or if this can be done. Also unsure of how to put the database on a database server and how to connect to that, if that's what I need to do.




when to use service layer over DAO in MVC architecture based web application development in java

I had doubt about, can i go with service layer instead of dao layer in MVC architecture based web application development. Please suggest me the best MVC architecture layers for web application development.




How do you make a real-time crowdsourcing website?

I'd like to make an interactive website that changes contents on the screen depending on the total mouse clicks from all clients per given unit time. (For the purposes of crowdsourcing).

Being new to programming, I cannot fathom how many more hours it will take to tackle a real-time crowdsourced website as opposed to relatively static sites until CTA buttons are clicked.

What's the easiest method for a complete beginner to create real-time crowdsource-able website? Thanks in advance.




javascript - select nodes and all their child nodes inside tbody

I want to select all elements inside < tbody > and all their sub-elements so i can change a class using javascript.

For example, i want to change the class cl1 into cl2 in the following example

<table>
    <thead>
         ....
    </thead>
    <tbody>
        <tr class="cl1 other-class">
            <td>Some value</td>
            <td class="cl1 other-class">Some value</td>
            <td>Some value</td>
        </tr>
        <tr class="cl1 other-class">
            <td class="cl1 other-class">Some value</td>
            <td>Some value</td>
            <td>
                <a class="cl1 link" href="#">Some link</a>
            </td>
        </tr>
    </tbody>

I want to use javascript for this, no jQuery




Perfect Plan to learn web development

I know a fair bit of web development.

But i feel now that i have rushed through things and want a solid plan to learn web development and then maybe Mobile apps development as well.

Open to suggestions from you people.

do let me know.




propper interaction with mysql database

so i saw this code online and liked it and then decided to use same code as my register protocol in my app. but it dosen't seem to work well for me, below is the full registerProcess i want to use.

/**
 * Function to store user in MySQL database will post params(tag, name,
 * email, password) to register url
 * */
private void registerUser(final String name, final String email,
                          final String password) {
    // Tag used to cancel the request
    String tag_string_req = "req_register";

    pDialog.setMessage("Registering ...");
    showDialog();

    StringRequest strReq = new StringRequest(Method.POST,
            AppConfig.URL_REGISTER, new Response.Listener<String>() {

        @Override
        public void onResponse(String response) {
            Log.d(TAG, "Register Response: " + response.toString());
            hideDialog();

            try {
                JSONObject jObj = new JSONObject(response);
                boolean error = jObj.getBoolean("error");
                if (!error) {
                    // User successfully stored in MySQL
                    // Now store the user in sqlite
                    String uid = jObj.getString("uid");

                    JSONObject user = jObj.getJSONObject("user");
                    String name = user.getString("name");
                    String email = user.getString("email");
                    String created_at = user
                            .getString("created_at");

                    // Inserting row in users table
                    db.addUser(name, email, uid, created_at);

                    Toast.makeText(getApplicationContext(), "User successfully registered. Try login now!", Toast.LENGTH_LONG).show();

                    // Launch login activity
                    Intent intent = new Intent(
                            RegisterActivity.this,
                            LoginActivity.class);
                    startActivity(intent);
                    finish();
                } else {

                    // Error occurred in registration. Get the error
                    // message
                    String errorMsg = jObj.getString("error_msg");
                    Toast.makeText(getApplicationContext(),
                            errorMsg, Toast.LENGTH_LONG).show();
                }
            } catch (JSONException e) {
                e.printStackTrace();
            }

        }
    }, new Response.ErrorListener() {

        @Override
        public void onErrorResponse(VolleyError error) {
            Log.e(TAG, "Registration Error: " + error.getMessage());
            Toast.makeText(getApplicationContext(),
                    error.getMessage(), Toast.LENGTH_LONG).show();
            hideDialog();
        }
    }) {

        @Override
        protected Map<String, String> getParams() {
            // Posting params to register url
            Map<String, String> params = new HashMap<String, String>();
            params.put("name", name);
            params.put("email", email);
            params.put("password", password);

            return params;
        }

    };

    // Adding request to request queue
    AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
}

private void showDialog() {
    if (!pDialog.isShowing())
        pDialog.show();
}

private void hideDialog() {
    if (pDialog.isShowing())
        pDialog.dismiss();
}

}

the problem actually is that it those not properly connect with the server,when i run the code it only displays an empty black spot at the bottom with no "success" or "failure" message. and when i check my mySQL database no account is added.

please i want you guys to help me examine the code to know what is wrong with it,or what i am not doing right that could make not work.




Putting Youtube playlist on website, but I want to be like a stream

So my problem is, i am making a DJ website. I have a youtube channel, and i have good music there, and what i want is to make a youtube playlist and then show it in my website, but i want to be like so - playlist with 20 songs, it goes like a stream (first song, secons song ect) it cant stop, it should go in a loop. I want kinda like a radio but with a video who no one could rewing or go further. A good example is this site, and i don't know how he is doing that with his youtube playlist ... http://ift.tt/2h6zMvd




How can i prevent horizental scrolling in mobile view when div move with jquery

i wrote some code to simulate papers for each page of my website but when you view it on gadget(mobile) devices when a div move(translateX) left screen scoll automatically with div to left then came back.

var width = divs.eq(currentDiv).width()+100;
$(".books-pages").css("transform" , "rotate(0)");
$(".main-menu").parent().css("transform" , "translateX("+width+"px)");
var menu = $(".main-menu").clone();
$("."+id).css("transform" , "translateX("+-width+"px)");

how can i prevent this scrolling?




Trying to UPDATE a database through HTML forms throws Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064

I am working on a project for school. I am new to PHP and databases, but managed to make a quite a good system for adding posts dynamically to my website. All is done with OOP aproach using the MVC framework and handling database is done through PDO. This is the add function, that works wonders and is called once user submits the HTML form:

public function add(){
    // Sanitize POST
    $post = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);

    if($post['submit']){
        if($post['title'] == '' || $post['content'] == '' || $post['link'] == '' || $post['image_name'] == ''){
            Messages::setMsg('Please Fill In All Fields', 'error');
            return;
        }
        // Insert into MySQL
        $this->query('INSERT INTO posts (country, language, title, content, link,  image_name) VALUES(:country, :language, :title, 
                    :content, :link, :image_name)');
        $this->bind(':country', $post['country']);
        $this->bind(':language', $post['language']);
        $this->bind(':title', $post['title']);
        $this->bind(':content', $post['content']);
        $this->bind(':link', $post['link']);
        $this->bind(':image_name', $post['image_name']);
        $this->execute();
        // Verify
        if($this->lastInsertId()){
            // Redirect
            header('Location: '.ROOT_URL.'shares/add');
        }
    }
    return;
}

The problem began, when I tried to do an editing system, for the posts in the database. When user is in admin mode, he can click a edit button, that redirects him to a URL with a queery, where the ID is written like this:

http://localhost/shares/edit/?id=2

Once user is on this URL, he has the option to input new values into the form, to owerwrite the current database row on that ID. (in the future, the form will be autofilled once you get redirected with the stuff on the ID)

This is the function edit:

public function edit(){
    // Sanitize POST
    $post = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);

    if($post['submit']){
        if($post['title'] == '' || $post['content'] == '' || $post['link'] == '' || $post['image_name'] == ''){
            Messages::setMsg('Please Fill In All Fields', 'error');
            return;
        }
        // Get ID from URL
        $url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
        $parts = parse_url($url);
        parse_str($parts['query'], $query);
        $id = $query['id'];
        // Insert into MySQL
        $this->query('UPDATE `posts` (`id`, `country`, `language`, `title`, `content`, `link`, `image_name`) VALUES(:id, :country, :language, :title, 
                    :content, :link, :image_name) WHERE id = :id');
        $this->bind(':id', $id);
        $this->bind(':country', $post['country']);
        $this->bind(':language', $post['language']);
        $this->bind(':title', $post['title']);
        $this->bind(':content', $post['content']);
        $this->bind(':link', $post['link']);
        $this->bind(':image_name', $post['image_name']);
        $this->execute();
        // Verify
        if($this->lastInsertId()){
            // Redirect
            header('Location: '.ROOT_URL);
        }
    }
    return;
}   

and it throws this error:

Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(`id`, `country`, `language`, `title`, `content`, `link`, `image_name`) VALUES('' at line 1 in C:\xampp\htdocs\classes\Model.php:43 Stack trace: #0 C:\xampp\htdocs\classes\Model.php(43): PDOStatement->execute() #1 C:\xampp\htdocs\models\share.php(27): Model->execute() #2 C:\xampp\htdocs\controllers\shares.php(18): ShareModel->edit() #3 C:\xampp\htdocs\classes\Controller.php(12): Shares->edit() #4 C:\xampp\htdocs\index.php(29): Controller->executeAction() #5 {main} thrown in C:\xampp\htdocs\classes\Model.php on line 43

I went through a lot of questions, that asked a similar question, but none helped me with debugging mine. Any help with debugging this function will get you my eternal thanks. :)




HTML 5 code to imput and submit a WEB FORM automatically

Hi I need to have this form (http://ift.tt/2xgMBdm ) be filled in and submitted automatically. It has to be html 5 code. How would I do it?

And if it is already “open” it should then not “open” it

Thanks A dumb programmer




Package bflows does not exist on NetBeans

Hi guys i'm making a web application with the jsp using netbenas, then my problem is the following: i have created some packages and i want to import them into my jsp page(SignUp.jsp) for i when i do i have this error.how do I fix this error?

ERROR:

enter image description here

SignUp.jsp

<%@ page contentType="text/html" %>
<%@ page session="false" %>
<%@ page buffer="30kb" %>
<%@ page errorPage="/ErrorPage.jsp" %>

<jsp:useBean id="UserManagement" scope="page" class="bflows.UserManagement" />
<jsp:setProperty name="UserManagement" property="*" />

Web application hierarchy

enter image description here




vendredi 27 octobre 2017

Inflated Size Webhost Fixed Ad? (on bottom)

What would cause this webhost ad to be so big? (on bottom) http://ift.tt/2ySwtlz

This is the size it is suppose to be? http://ift.tt/2gPHVHC

Would you think it is something in my code? I deleted all the code and then remade it.

Sorry if this is in the wrong section




Sticky footer in Material Components for Web?

How can I have a footer that stays at the bottom of the page using Material Components for Web?




Postioning text and button in a specific position over an image

i wanted to postion a text in (h1) on the image but it affected by the opacity of the image so how can i make it not to get affected by it, i want also to position the button directly under the text but it positiond under the image. the third problem is that there an empty space between the nav bar and div of (the text and the image) as it shown in the screen shot `screenshot of the webpage

@import url('http://ift.tt/2eZzRT2');

body{
    font-family: 'Quicksand', sans-serif;
    width: 100%;
}

.container-fluid {
    width: 100%;
    padding: 0px;
    
}

#top-header {
    text-align: center;
    background: #480000 ;
}
    
.inner {
  
  max-width:960px;
  margin: 0 auto;
  min-height: 50px;
}

.nav a {
    
    display: block;
    padding: 8px;
    color: white;
    padding-top: 15px;
}

.txt{

    top: 32%;
    left: 15%;
    font-size: 2.5vw;
    color: green;
    font-weight: bolder;
}

.main-img {
    opacity: 0.5;
    width: 100%;
    z-index: -1;
}


.btn {
    top: 40%;
    left: 20%;
}
<!DOCTYPE html>
<html lang="en">
  <head>
      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE-edge">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <link rel="stylesheet" href="http://ift.tt/2yYrQXn" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
      <script src="http://ift.tt/2iF8Hmw" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
      <title></title>
      <link href="http://ift.tt/2zcHM8r" rel="stylesheet">
      <link rel="stylesheet" href="stylesheet/style.css">
  </head>

  <body>
    <div class="container-fluid">
        <div class="row header row-fluid" id="top-header">
           <div class="inner">
               <nav class="nav topnav">
                <a href="#home">Home</a>
                <a href="#protfolio">Protfolio</a>
                <a href="#service">Serviice</a>
                <a href="#contact">Contact</a>
                <a href="#about">About</a>
               </nav>
            </div>
        </div>
        
        <div class="container-fluid main-div">
            <div class="row">
                <div>
                    <h1 class="txt col-md-4">We Know how to get your Job done</h1>
                    <img  class="img-fluid main-img" src="images/12.jpg" alt="main-image">
                    <a class="btn btn-primary" href="#">Pro</a>
                </div>
            </div>
            
        </div>
    </div>

 
      
  </body>

</html>

thank you in advance