mercredi 30 novembre 2016

What does mean ?page=1

Suppose I have an URL like this http://ift.tt/2gL1wnD or have http://ift.tt/2gXN2DK. Here what does mean by ?page=1 or ?text=1. Some website like youtube there I can see that they use like https://youtube.com?watch=zcDchec . What does mean it?

Please explain anyone. I need to know this.




How to Create a new image from three images in PHP or using other web languages?

I have three images. 1.Backgroundimage.jpg , 2.image1.jpg ,3.image2.jpg

Backgroundimage size 400*400

image1 100*100

image2 100*100

I need to place the image1 and image2 on the Backgroundimage in php?

My php file have some contents so if I am using header('Content-type':'image/jpg'),it is showing empty page. Now to show that Edited image(final image) in my PHP file?

I am tried add two images: code:

<?php  
$img1= imagecreatefromjpeg('image1.png');
$img2 = imagecreatefromjpeg('image2.jpg');

imagealphablending($img2 , false);
imagesavealpha($img2 , true);

imagecopymerge($img2 , $img1 , 10, 9, 0, 0, 181, 180, 100); 

header('Content-Type: image/jpeg'); // If i am using that line it is showing empty page otherwise the image displayed in ASCII value
imagepng($img2);

imagedestroy($img2);
imagedestroy($img1);
?>




Using Python to request draftkings.com info that requires login?

I'm trying to get contest data from the url: "http://ift.tt/2gIowpP"

If you go to this URL and aren't logged in, it'll just re-direct you to the lobby. If you're logged in, it'll actually show you the contest results.

Here's some things I tried:

-First, I used Chrome's Dev networking tools to watch requests while I manually logged in

-I then tried copying the cookie that I thought contained the authentication info, it was of the form:

 'ajs_anonymous_id=%123123123123123, mlc=true; optimizelyEndUserId'

-I then stored that cookie as an Evironment variable and ran this code:

HEADERS= {'cookie': os.environ['MY_COOKIE'] }
requests.get(draft_kings_url, headers= HEADERS)

No luck, this just gave me the lobby.

I then tried request's built in:

  • HTTPBasicAuth
  • HTTPDigestAuth

No luck here either.

I'm no python expert by far, and I've pretty much exhausted what I know and the search results I've found. Any ideas?




missing files in HttpContext.Current.Request.Files when i click button events in server side.

When i trace input files in client side after chose files, there are files in this input ($('#inputid')[0].files). And then, after click events in server side, missing request files. PS: I create input elements dynamic. Let me know why missing files.

 HttpFileCollection hfc = HttpContext.Current.Request.Files;
            for (int i = 0; i < hfc.Count; i++)
            {
                HttpPostedFile hpf = hfc[i];
            } code here




Three JS Plane Animation

I have a plane and each frame I am trying to animate its vertices using perlin noise. I tried to follow this codepen but in my project its animating way to fast. I know the simplex.noise3D values are different but its because they values from codepen demo react different in my version. Below is the code I am using and here is a codepen

function createCube() {
    groundGeometry = new THREE.PlaneGeometry(10, 10, 20, 20);
    groundMaterial = new THREE.MeshLambertMaterial({color: 0x2d2d2d, wireframe: true});
    groundMesh = new THREE.Mesh(groundGeometry, groundMaterial);

    groundMesh.receiveShadow = false;
    groundMesh.castShadow = false;
    groundMesh.rotation.x = -0.5 * Math.PI;
    groundMesh.position.set(0, 0, 0);

    scene.add(groundMesh);
}

var tick = 0;

function loop(){

    tick++;
    groundGeometry.verticesNeedUpdate = true;
    groundGeometry.colorsNeedUpdate = true;
    for (var i = 0; i < groundGeometry.vertices.length; i++) {
        var vert = groundGeometry.vertices[i],
        noiseVal = simplex.noise3D(vert.x * 0.025, vert.y * 0.025, tick * 0.025);
        vert.z = noiseVal;
    }

    renderer.render(scene, camera);
    requestAnimationFrame(loop);
}




how to make one user account, one password, and session

I am trying to make an admin page but I need only one account for this and a predefined password. I guess it needs a session too that only lasts until the page is closed. Also multiple people should be able to log into this account at once. Will this require a database even though it is one account?

Please provide me with some code, I have searched and found nothing. Anyone have ideas?




Having Multiple Modals per page

I'm creating a website where the user can click on an image to open a modal with menu items within, while the first modal works fine, subsequent modals do not.

JS Code:

<script>
// Get the modal
var modal = document.getElementById('myModal');

// Get the button that opens the modal
var btn = document.getElementById("myImg");

// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];

// When the user clicks the button, open the modal 
btn.onclick = function() {
    modal.style.display = "block";
}

// When the user clicks on <span> (x), close the modal
span.onclick = function() {
    modal.style.display = "none";
}

// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
    if (event.target == modal) {
        modal.style.display = "none";
    }
}
</script>

HTML where its used:

    <div class="col-md-3">
        <h2>Starters</h2>
        <img src="http://ift.tt/2gKaOQN" height="100%" width="100%" id="myImg">
                <!-- The Modal -->
                <div id="myModal" class="modal">

                  <!-- Modal content -->
                  <div class="modal-content">
                    <div class="modal-header">
                      <span class="close">×</span>
                      <br>
                      <h2>Starters</h2>
                    </div>
                    <div class="modal-body">
                      <p><b>PRODUCT <span style="display:inline-block; width: 75%;"></span> PRICE</b></p>
                      <hr>
                      <p> Humus <span style="display:inline-block; width: 78%;"></span>  £3.00</p>
                      <p> Dolma <span style="display:inline-block; width: 78%;"></span>  £3.20</p>
                      <p> Coleslaw <span style="display:inline-block; width: 77%;"></span>  £1.50</p>
                      <p> Prawn Cocktail <span style="display:inline-block; width: 73.5%;"></span>  £4.60</p>
                    </div>

                  </div>

                </div>

    </div>

    <div class="col-md-3">
        <h2>Wraps</h2>
        <img src="http://ift.tt/2gWR0wK" height="100%" width="100%" id="myImg">

                <div id="myModal" class="modal">

                  <!-- Modal content -->
                  <div class="modal-content">
                    <div class="modal-header">
                      <span class="close">×</span>
                      <br>
                      <h2>Starters</h2>
                    </div>
                    <div class="modal-body">
                      <p><b>PRODUCT <span style="display:inline-block; width: 75%;"></span> PRICE</b></p>
                      <hr>
                      <p> Chicken Wrap <span style="display:inline-block; width: 78%;"></span>  £3.00</p>
                      <p> Doner Wrap <span style="display:inline-block; width: 78%;"></span>  £3.20</p>
                      <p> Shish Wrap <span style="display:inline-block; width: 77%;"></span>  £1.50</p>
                      <p> Kofte Wrap <span style="display:inline-block; width: 73.5%;"></span>  £4.60</p>
                    </div>

                  </div>

                </div>

    </div>

The first modal box shown will work as expected, while the second will not show at all, i would rather not have to unnecessarily replicate JavaScript if i don't have to, which is why i tired this method.

Very new to JS and modal boxes, so any input would be appreciated, thanks.




SQlite Database browser in web

I have a sqlite database, which I want to publish on the web. I do not need any web interface for writing, however I do need search and sorting options. Basically something like embedding SQlite browser in the web. Is there a platform that allows to do this?




Programmatically read all rows containing a word from a table on a web page

In the table on http://ift.tt/2gmcW33, I want to read the second column from all rows that have "C. elegans" or "H. sapiens" in the first column. I need to do that programmatically because I have 654 web pages that have a similar table with different information. Can someone give an example code that achieves this? I would prefer an example in R, if possible.




Loading javascript tag into react component

I'm trying to load a Trading View Widget inside a react component. I tried using _dangerouslySetInnerHTML, however, it doesn't run the javascript code.

I also tried this:

import React from 'react';

export default class TradingView extends React.Component{

  constructor(props){
    super(props);
  }

  componentDidMount() {
    const tradingViewCode = '<!-- TradingView Widget BEGIN --><script type="text/javascript" src="http://ift.tt/1o6Vmfh"></script><script type="text/javascript">new TradingView.widget({"autosize": true,"symbol": "BITFINEX:BTCUSD","interval": "D","timezone": "America/New_York","theme": "White","style": "1","locale": "en","toolbar_bg": "#f1f3f6","enable_publishing": false,"hide_top_toolbar": true,"save_image": false,"hideideas": true});</script><!-- TradingView Widget END -->';
    new Function(tradingViewCode)();
  }

  render(){
    return (
      <noscript />
    );
  }
}




Get website hidden behind loading page

Some websites (example) have a "loading" screen display before they show you their actual content.

http://ift.tt/2fEWjRa

If I curl the site, I get this loading screen rather than the content which I want.

How can a bash program get the actual content of the web page?




Responsively center an image inside a flexbox container, maintaining the aspect ratio and keeping known image boundaries

The image should resize itself to take up as much space as is available in the "purple" container, without upscaling and without changing its aspect ratio.

The image should never overflow the purple container.

The green image overlay is needed, therefore using background-position: contain; is not possible.

object-fit: contain; is also not possible for the above reason as well as the still "poor" support (~80%, thanks Microsoft...)

Example sandbox




Struggling with Basic HTML and CSS

I'm really new to code and I'm trying to build a website but I can't get my first block of writing to go under my navigation bar, its positioning inline and I don't know why. ANy tips would be appriciated. I have tried floating it and changing the size and the display and nothing works




How to get webpage hidden behind slow "redirect"

Some web pages only display after some previous page "Checking your browser.. please allow up to 5 seconds" disappears.

Note that the url doesn't change.

How do I get the actual page from bash? Not the loading screen.




Okta API Questions on GetApp Requests

I'm currently working on a project using the OKTA platform and API but have some queries.

  1. When making a GET call for List Apps Assigned to User or List Apps Assigned to User, I'm getting a response for all apps added to the OKTA instance, rather than the ones relevant to the current users session. Is there a flag I'm overlooking?

  2. When getting the result array for list of applications, it returns all the office 365 'sub-apps' (mail, calendar etc) as child arrays to the parent application. However, these sub-apps in the child arrays don't get returned with image links, which other standard applications do. Now while I could hard code for them, it's not ideal. Any advice on this as well?

Thanks!




serve different content according to header value in Nginx

I have some web content behind the follwoing arch, for which I need to serve different content for desktop and mobile clients.

client > AWS Cloudfront > Nginx > ...

cloudfront has the builtin ability to identify the user-agent and they kind of unify it into 4 special headers (for example CloudFront-Is-Desktop-Viewer) which are either true or false.

on Nginx I'm trying to decide which content to serve according to those headers. for example:

 location / {
   if ($http_CloudFront-Is-Desktop-Viewer = true) {
        proxy_pass http://upstream;
        break;
   }
   root /var/www/static/en-US;
   try_files $uri /index.html;
 }

so in the above case it should go to the upstream if the CloudFront-Is-Desktop-Viewer value is true, and get the static files from nginx if it's false or not present.

but for some reason I always get the static files from nginx. I'm sure this header is being forwarded, I've even tried to send it directly from chrome with a header modifier.

what am i missing?

many thanks




Does Azure Web Jobs and Azure App Service API read from the same "Application Settings" once deployed?

I am hosting an API with Azure App Services and there is also a Web Job deployed. When I debug locally, I have to have the app settings config keys in the web.config and the app.config respectively for each project. On the azure app portal, there is a place to add 'Application Settings' - I am wondering if once deployed and running, will both the API and WebJob read from this same location?

Thank you.




SQL - Select a variable that needs to be populated

Long time no see !

I'm using wordpress for my site with lots of custom post_type and multiple category system with toxonomies set by the Toolset plugin.

I'm trying to store some posts into a mysql table from a huge query that i want to cron each night to increase speed of my site.

Here is what I did :

SELECT wp_posts.ID as mid,wp_posts.post_title,wp_posts.post_name,(
    SELECT COUNT(wp_posts.ID) FROM wp_posts INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) INNER JOIN wp_postmeta AS mt1 ON ( wp_posts.ID = mt1.post_id ) LEFT JOIN wp_icl_translations t
    ON wp_posts.ID = t.element_id
    AND t.element_type = CONCAT('post_', wp_posts.post_type) WHERE 1=1 AND (
        ( wp_postmeta.meta_key = 'my_key' AND wp_postmeta.meta_value = mid )
        AND
        (
            ( mt1.meta_key = 'end_date' AND CAST(mt1.meta_value AS SIGNED) >= date_format(curdate(), '%Y%m%d') )
            OR
            ( mt1.meta_key = 'end_date' AND CAST(mt1.meta_value AS SIGNED) = '' )
        )
    ) AND wp_posts.post_type IN ('bp','code') AND ((wp_posts.post_status = 'publish'))
) AS countpost
FROM wp_posts INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) WHERE 1=1 AND ( ( wp_postmeta.meta_key = 'top-key' AND wp_postmeta.meta_value = 'yes' ) ) AND wp_posts.post_type = 'my_type' AND ((wp_posts.post_status = 'publish')) GROUP BY wp_posts.ID ORDER BY wp_posts.post_title

It work great but i want to add a column !

The columni want should look like an "array" of "term_taxonomy_id" of the "COUNT(wp_posts.ID) query result" like this :

SELECT group_concat(term_taxonomy_id) FROM `bpo_term_relationships` WHERE `object_id` = id_of_the_current_post_scanned_by_count_query

my result should look like this

bpo_posts.ID | bpo_posts.post_title | bpo_posts.post_name | COUNT(bpo_posts.ID) | "array" of "term_taxonomy_id"
1            | the title            | the-title           | 16                  | 815,712,1025
2            | hey you              | hey-you             | 5                   | 75,105,200
...
...

I'm stuck :( Anybody has an idea ?

Thanks.




Slow Windows server web performance (high TTFB)

I am currently looking at an issue with one of our Windows Servers, whereby the exact same web app running on another server is fairly fast, but on the problematic server there is a long "time to first byte" on several files (roughly 7-8 seconds of "Waiting (TTFB)"), particularly the larger ones. This results in the page taking 10 seconds+ to load versus >1 second on the other server.

Download speed of the ~800kb content once the first byte is received is quick, around 20ms, so I think I can rule out network issues.

I performed a hard refresh of the page while running a few parameters on Performance Monitor and noticed that it appears to not be using much CPU, and the % disk time is fairly low and spiked during the load time whereas the same parameters on the server that loads the content quickly shows much more activity, with the spikes reaching 100% or close to, and finishing the operation quickly.

I've been pulling my hair out trying to work out what the issue is here. CPU load is low, as the diagrams show, so I do not believe that it is that the processor. There is roughly 8gb of the 16gb of RAM free on the server, and I can't think what would be causing the load on the hard drive to not hit 100% and just return the files quickly.

I must state that I do not usually work with these kind of issues with a server, and am simply a junior developer, so it's likely that I might have missed something simple or am coming to the wrong conclusions.

Any ideas or thoughts are much appreciated!




Loading a HTML page from webfoot folder of apache server - newbie

As the tittle says I'm new to all concepts of networkiing and web development.

Yesterday I was able to set up a Local Apache Server which I am using for development testing purposes.

I have assigned for a Server the ServerName "client1.dev" with a VirtualDocumentRoot "/www/client1/wwwroot", yet it is unclear for me how I am supposed to link my HTML page.

I am currently stuck at the point where all my files when accessing the domain appear under a plain list format from which I can select my files which will eventually load the HMTL content of choosing.

Since I'm a total beginner in this domain and I've got a hard time even googling the right questions. I'd like to know how I could instantly when accessing the server name domain to load a given HTML page.




What is the analogue of struct.pack() in php?

I have a variable id = 1615239032

In python i do

struct.pack('<i', id)

Result is

x\x97F`

In php i do

pack('i', $id)

But result is

x▒F`

How to get the same in php?




Searching for a open Web Application with Form modules WYSIWYG editor

Searching for a simple open Web Application (HTML5 is best )like a CMS with Form modules WYSIWYG editor who save only compiled data with a module reference, storing it in a file or DB.

Nice to have: import modules from ODF or MS Office XML (html tidy, can be great!) modules:form editor(fast and easy), to insert input structure ACL Read/Write Locking Signature with acompatible device. Versioning Templating Data saving in a file or DB Recent Project Recent Technology Web Application No plugins required

Wordpress with ACL Manager, and Ninja Forms can be a solution, but forced.... Something more elegant is needed.

Thanks, Ivan.




could not resolve all dependencies for configuration ':runtime'

I am studing Mybatis and this is my build.gradle file enter image description here

but when I refresh it,IntelliJ IDEA told me "could not resolve all dependencies for configuration ':runtime'" enter image description here

How can I fix it?Thanks.




Activemq web console in Spring

I am creating an embedded ActiveMQ broker in Spring application like this:

@EnableJms
@Configuration
public class MqConfig {
    @Bean
    public BrokerService broker() throws Exception {
        BrokerService broker = new BrokerService();
        broker.setBrokerName("ETL");
        broker.addConnector("tcp://localhost:61616");
        broker.start();
        return broker;
    }
}

How can I embed the ActiveMQ Admin Web console also in the same spring application? Searched the net for 2-3 hours, but found no useful answer. The only thing that ActiveMQ site mentions is this http://ift.tt/1yNBL62, however is not useful with Spring




JavaScript Cloud/Web Desktop Platform

Is there any websites similar to this, in Anjular js or other js framework?

https://osjsv2.0o.no/




Can we implement offline capability in Sitecore?

I have a requirement where the sitecore web app or mobile app has to work with offline capability. Which means even if there is no network coverage, my app (web or mobile) has to work fetching content from Sitecore.

Thanks




PHP 7 NGINX vs PHP 5.6 Apache

We have a php 5.6 , mariadb, apache written member administration system with about 500k active members on it but we considering migrating to a php 7, mariadb and nginx server in the new year. This is a very broad question but how have you found specifically nginx and php 7 to be like? I have read up on a few articles like http://ift.tt/18usieB but I would like to know from real life users what the pros and cons are?




Java script stop when the tab becomes inactive [on hold]

Java script stop when the tab becomes inactive.. How to run a java script function using web workers,when the tab is not active in the browser??




Does the UI layer change between iOS and Android in React Native?

I am just exploring react and have couple of doubts. I don't see common UI components for react native apart from scroll, flexbox, input list in the documentation. So if I am writing for iOS will the UI part be different from that of Android? If I am having a web app written in react, can I reuse it (no div, img etc for react native)? So is there any possibility of reusing the web UI to native UI? So how exactly is it cross platform? I can reuse the logic only, right? Thanks.




How to make my text moving from right to left in php?

I have a site which support Arabic Languge and I need to move the text from right to left ,I have tried
dir="rtl" but it doesn't work any help please? thanks in advance :)




c# Web browser : how to solve?

I'm coding on c# with some lectures. But there is an error on webbrowser. That means it doesn't support this webbrowser. But my webbrower is already fully updated. Who know how to figure out this problem? help me please.. here is image.




Messagge handling - BE of FE

I have a web application made in angular that interacts with JBoss REST API for the business logic. My question is: Should the message localization handled by FE or BE?

I guess that message and localization should be treated by FE, so BE should only return a status code parseable by FE. Is this correct ?




AMP amp-list dynamic height

I'm using amp-list and I would like to have a dynamic height based on the results that I got. There is a way to do it? I couldn't get it done.




Alternative to PHP Web Application Development

I am a freelance web application developer who's lately getting worried about getting out-dated in the marketplace, as well as wondering whether my current toolset for building enterprise web applications is still effective and efficient enough; given the advent of several new-age technologies and frameworks out there such as Bootstrap, AngularJS, Express, Node.js, Unheard.me, etc (a lot more that i haven't even heard of).

I have so far built most of client business applications using the traditional technology toolset that includes leveraging XAMPP, PHP, Javascript, and MySQl. And so far I have done fine. But as mentioned above I would like get some serious and honest advise whether I should start to learn and leverage any of the new new tools (above mentioned or something else), frameworks for my development work?

My few submissions to all: firstly pardon me in case this is a repetitive query, i did try and lookup before posting this but could not find anything on lines of what i would like to know. So if anything already relevant to my query is out there then kindly pardon me and appreciate if you can point me to it. Secondly, I would like to inform that my area of application development is primarily building transactional web applications for businesses (B2B) and so I am not really into fancy B2C website development area. So I seek your advice for tools/technologies from that perspective. Tools/technologies/frameworks that will allow me to deliver better web-based business applications: applications that are responsive (can render seamlessly on any device type), that are faster & lighter, that are more dynamic (can update web page content asynchronously), support cloud environments easily, can connect to new age apps (mobile wallets, twitter, FB, etc), etc.

I look forward to some useful guidance from you. Thanks in advance.




mardi 29 novembre 2016

Computer Coding Tutorial Algorithm

I am developing Java Tutorial program. However, when I put many questions in it. I can't put everythings. So I think I need algorithms to make similar questions shows up. However, I don't have any idea for now. Don't just put random number to generate question with number change. I want something really special.




Web Dev: Need Advice from a seasoned developer

Recently I've been getting into Django development and I am currently working on creating my own website. As for the static portions of the site, (about section, header, and footer) I am setting everything manually in my html file. Is this typically how professionals go about their business?

As for my github repository, I find my self having to create dozens of tedious commits as I troubleshoot (the site is hosted on AWS). Any advice on getting around redundancies in this aspect?




How to remove all spaces in an array?

How to remove all spaces in an array? all kinds of spaces such as double space, tabs, whitespaces and etc...

I tried this but it only removes a single space.

array_filter( parse_ini_file( 'C:/xampp/htdocs/essentials/configuration.ini' ) )




web developers and jobs public discussion [on hold]

i need to know if this happen in your county or not i'm a web developer woking on html5 - css3 - bootstrap3 - php - laravel - oop - my sql - java script - j query seo - web masters tools - ajax - api google

but companies in my country when open vacancies for job they asked the web developer to know every thing in programming language and design and cms and mobile such as
php - laravel - wordpress - drupal -joomla - android - mobile application - design - graphics such as -photoshop - illustrator - ...... etc

and not define major . they need you to do every thing so i don't find job since 2 years because i belive that web developer must be specialized in one field such as private programming such as php - laravel ... or cms such as wordpress - drupal - joomla .... or design such as bootstrap - css3 .... or graphic such as photoshop - illustrator - in design .... or develope mobile .....

i'm tired of that companies thinking what should i do learn everything or what

please tell me i'm wrong or companies wrong and what should i do to overcome this problem to find job and tell me that happen in your country or not

note : i have 2 years experience and work on multi projects as freelancer but i need job in company




How do I animate polygons with jQuery?

I'm looking to render filled polygons that are animated by dynamic vertex data. Is that possible to do this with a jQuery engine that generates the vertices in an interactive environment on a webpage?




Override Only 1 Action Per Import Scenario

There is only one -1 Action Per Import Scenario.

enter image description here

Adding any new ones will get automatically cleaned up by the import scenario.

This is a severe limitation for automation purposes and if the BLC can be customized to override this limitation... I think the import scenario's instructions should still run just fine... Any idea how to customize it?




Next step in web design?

I am new to the field of web design. I am learning html5 and css3, and I have a decent grasp on these mark-up languages. I have built a few hello world sites, and even some rudimentary commerce sites

What should my next step be? I'm so overwhelmed by everything out there that I want to learn that I can't pinpoint where my efforts should lie.




onerror Event didn`t work

I try create code which replace src image on another. I want to use function invalidUrl():

function invalidUrl() {
    paint.src = randomvariable;
}

but this function isn`t running :<

var paint = '<img src="' + url + '"class="heightImg" onerror="invalidUrl()"/>' + '</br></br>' + description;

How to change src images if current picture doesn`t exist?




Serious unload approach for web application

I know there is a lot of questions already answered related to this.

People developing serius web applications need a robust way to avoid data-lost when the page is unloaded.

By now 'beforeunload' control is poor and dangerous, IMHO, specially because you can't offer a custom dialog and also the 'Don't show this message again' that disable the unload detection....

I'd like ( I need, we need) a way to ask the user for 'Do you want to be conveniently warned allways when close the browser tab, or refresh the page, to avoid data lost ?

Or something like "This app wants to warn you allways when the page is going to be closed, Do you let it to have this behaviour" . (as when you install an app at your smartphone'

Have we do it with extensions ? I dont want.... Neither to change from html5/js to app or web app... I want to use pure Js/html5....

Does anybody knows what are doing for this google, mozilla, MS, Apple, etc ?

Any ideas would be appreciated.




Cannot fit table columns on page with bootstrap

table doesn't fit on the screen. tried with most of the combination but doesn't work. amateur, help needed.

i don't know whats going wrong maybe some silly mistake and wasn't able to find any mistake

  <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Generate</title>

        <script src="http://ift.tt/2eBd7UN"></script>
        <script src="http://ift.tt/2aHTozy"></script>
        <link rel="stylesheet" href="http://ift.tt/2apRjw3">
    </head>
    <body>

    <nav class="navbar navbar-inverse">
        <div class="container-fluid">
            <div class="navbar-header"  >
                <a class="navbar-brand" href="index.html"> <img alt="Brand" src="slideshow/img.png" style="height: 40px; display: inline-block; margin-top: -5px"> </a>
            </div>
            <ul class="nav navbar-nav" >
                <li class="active"><a href="index.html">Home</a></li>
                <li><a href="about.html">Generate POR</a></li>
                <li><a href="Update\Adminlogin.html">Update POR</a></li>
                <li><a href="video.html">Help</a></li>
                <li><a href="contact.html">Contact us</a></li>

            </ul>

            <form class="navbar-form navbar-right">
                <div class="form-group" id="demo">
                    <input type="text" class="form-control" placeholder="Search">
                </div>
                <button type="submit" class="btn btn-default">Submit</button>
            </form>

            <form class="navbar-form navbar-right">
                <div class="form-group" id="txt1" style="color: aliceblue; margin-top: -5px"  >

                </div>
            </form>

        </div>
    </nav>

        <div class="col-md-8 col-md-offset-2">
            <div class="row">
                <form>
                    <div class="col-sm-12">
                        <div class="row">
                            <div class="col-sm-6 form-group">
                                <label>P O Date</label>
                                <input type="date" class="form-control">
                            </div>
                            <div class="col-sm-6 form-group">
                                <label>Category</label>
                                <select class="form-control" >
                                    <option>Technology</option>
                                    <option>Business</option>
                                    <option>Development</option>
                                    <option>Process</option>
                                </select>
                            </div>
                        </div>
                    </div>

                    <div class="col-sm-12">
                        <div class="row">
                            <div class="col-sm-6 form-group">
                                <label>Location</label>
                                <select class="form-control" >
                                    <option>Bengaluru</option>
                                    <option>Mumbai</option>
                                    <option>Pune</option>
                                </select>
                            </div>
                            <div class="col-sm-3 form-group">
                                <label>Type of training</label>
                                <select class="form-control" >
                                    <option>RBI</option>
                                    <option>PST</option>
                                    <option>Org needs</option>
                                </select>
                            </div>
                            <div class="col-sm-3 form-group">
                                <label>Venue Details</label>
                                <select class="form-control" >
                                    <option>Mumbai</option>
                                    <option>Bengluru</option>
                                    <option>Pune</option>
                                </select>
                            </div>
                        </div>
                    </div>

                    <div class="col-sm-12">
                        <div class="row">
                            <div class="col-sm-6 form-group">
                                <div class="form-group">
                                    <label>Vendor Address</label>
                                    <textarea placeholder="Vendor Address Here.." rows="3" class="form-control"></textarea>
                                </div>
                            </div>

                            <div class="col-sm-6 form-group">
                                <div class="form-group">
                                    <label>Billing Address</label>
                                    <br>
                                        Billing Address :<br>
                                        Quinnox Consultancy Services Ltd.;<br>
                                        Unit 170,SDF VI, SEEPZ SEZ,<br>
                                        Andheri(East), Mumbai-400096<br>

                                </div>
                            </div>
                        </div>
                    </div>

Display of tables isnt good below part is the problemtable doest fit on the screen

                            <div class="col-sm-12">
                                <div class="row">
                                    <table class="table table-condensed table-striped  table-hover" align="center">
                                        <thead class="thead-inverse">
                                             <tr>
                                               <div class="form-group">

                                                    <th>Subject</th>
                                                    <th>Faculty</th>
                                                    <th colspan="2" align="center">Date</th>
                                                    <th>Days</th>
                                                    <th>Batch Size</th>
                                                    <th>Rate per day</th>
                                                    <th>Approx Expected value(INR)</th>
                                                </div>
                                             </tr>
                                        </thead>

                                        <tbody>
                                            <tr>
                                                <div class="form-group">
                                                    <td><input type="text"/></td>
                                                    <td><input type="text"/></td>
                                                    <td><input type="date"/></td>
                                                    <td><input type="date"/></td>
                                                    <td><input type="text"/></td>
                                                    <td><input type="text"/></td>
                                                    <td><input type="text"/></td>
                                                    <td><input type="text"/></td>
                                                </div>
                                          </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>




                </form>
            </div>
        </div>

    </body>
    </html>




C# - Woocommerce API error Unauthorized on server

I trying to use WooCommerce.NET library in my Web MVC api application to call Woocommerce's API. I've wrote some php code in class-wc-api-customers.php file of Woocommerce to make more an API which allow authenticate user login from third party system (here is my Web MVC api application). Here is php code which I added into class-wc-api-customers.php file :

1.Register router

# GET /customers/login/<usernamepass> 
$routes[ $this->base . '/login/(?P<usernamepass>.+)' ] = array( array( array( $this, 'login_customer' ), WC_API_SERVER::READABLE ), );

2. login_customer function:

public function login_customer($usernamepass) {

        list($username, $password) = split('[-]', $usernamepass);   

// Checks the username.
if ( ! isset( $username) ) {
    return new WP_Error( 'woocommerce_api_missing_customer_username', sprintf( __( 'Missing parameter %s', 'woocommerce' ), 'username' ), array( 'status' => 400 ) );
}

// Checks the password.
if ( ! isset( $password) ) {
    return new WP_Error( 'woocommerce_api_missing_customer_password', sprintf( __( 'Missing parameter %s', 'woocommerce' ), 'password' ), array( 'status' => 400 ) );
}

// Attempts to login customer
$credentials = array();
$credentials['user_login'] = $username;
$credentials['user_password'] = $password;
$credentials['remember'] = true;
$user = wp_signon( $credentials, false );

// Checks for an error in the customer login.
if ( is_wp_error( $user) ) {
    return new WP_Error( 'woocommerce_api_cannot_login_customer', $user->get_error_message(), array( 'status' => 400 ) );
}

do_action( 'woocommerce_api_login_customer', $user );

$this->server->send_status( 201 );

return $this->get_customer( $user->ID );}

And I wrote a method LoginCustomers inside WCObject class of WooCommerce.NET library. Here is code :

public async Task LoginCustomers(string username, string password, Dictionary<string, string> parms = null){
    string json =  await API.SendHttpClientRequest("customers/login/" + username +"-"+password, RequestMethod.GET, string.Empty, parms);
    return json;}

Here is code of SendHttpClientRequest method :

public async Task SendHttpClientRequest(string endpoint, RequestMethod method, T requestBody, Dictionary<string, string> parms = null){

    HttpWebRequest httpWebRequest = null; 
    try 
    { 
        string requestUrl = GetOAuthEndPoint(method.ToString(), endpoint, parms); 
        string responseString = ""; 
        using (var client = new HttpClient()) 
        { 
            client.BaseAddress = new Uri(wc_url); 
            client.DefaultRequestHeaders.Accept.Clear(); 
            client.DefaultRequestHeaders.Accept.Add(new       MediaTypeWithQualityHeaderValue("application/json")); 
            var response = client.GetAsync(requestUrl).Result; 
            responseString = response.ReasonPhrase; 
            if (response.IsSuccessStatusCode) 
            { 
                 responseString = response.Content.ReadAsStringAsync().Result; 
            } 
        } 
        return responseString; 
    } 
    catch (WebException we) 
    { 
        if (httpWebRequest != null && httpWebRequest.HaveResponse) 
            if (we.Response != null) 
                throw new Exception(await GetStreamContent(we.Response.GetResponseStream(), we.Response.ContentType.Split('=')[1])); 
            else 
                throw we; 
        else 
            throw we; 
    } 
    catch (Exception e) 
    { 
        return e.Message; 
    } 
}

And here is code which I wrote to call that API from my Web MVC api application :

public async Task getWoocommerceCustomer(string uEmail, string uPassword)

{
    try
    {
        RestAPI rest = new RestAPI("http://ift.tt/2gFKSGc", "ck_xxx", "cs_xxx");
        WooCommerceNET.WooCommerce.Legacy.WCObject wc = new WooCommerceNET.WooCommerce.Legacy.WCObject(rest);
        string s = await wc.LoginCustomers(uEmail, uPassword);
        LogWriter.WriteLog("getWoocommerceCustomer s = " + s);
        return s;
    }
    catch (NullReferenceException e)
    {
        String ex = e.ToString();
        return null;
    }
}

When I run my application in debug mode, I got the json object which received from Woocommerce system by login_customer API which I wrote on Woocommerce when I used correct account and password as below :

{ "customer":{
      "id":3,
      "created_at":"2016-08-30T18:55:27Z", "last_update":"2016-11-26T13:22:00Z",
      "email":"customerregistered@gmail.com",
      "first_name":"Acid",
      "last_name":"Burn",
      "username":"acidburn",
      "role":"administrator",
      "last_order_id":null,
      "last_order_date":null,
      "orders_count":0,
      "total_spent":"0.00",
      "avatar_url":"http:\/\/0.gravatar.com\/avatar\/?s=96",
      "billing_address":{
                        "first_name":"",
                        "last_name":"",
                        "company":"",
                        "address_1":"",
                        "address_2":"",
                        "city":"",
                        "state":"",
                        "postcode":"",
                        "country":"",
                        "email":"",
                        "phone":""
                       },
      "shipping_address":{
                        "first_name":"",
                        "last_name":"",
                        "company":"",
                        "address_1":"",
                        "address_2":"",
                        "city":"",
                        "state":"",
                        "postcode":"",
                        "country":""
                        }
              }

}

I've set up, config IIS and deploy a server version on my computer from dll files which be generated by publish my application process. Then use Postman tool to call API. It got same result as above.

But when I deploy that files (dll files) to my server (VPS - I used Window Server 2012 R2). My API not work correctly, it always return Unauthorized even when I entered correct account and password.

Because server version on my computer, it work well for that API, So I think the difference of timezones not might cause my problems. My Window Server on VSP already installed .NET framework 4.5 and I tried to config some security option in Internet Explore on my Server to make Internet Explore possible connected to Woocommerce website. But my API still not work correctly.

I don't know why it work wrong. Someone has some idea for my problems ? please kindly help me. I am very grateful for that !




How to remove days or other elements from this countdown timer

I'm in a need of something super basic, and inline. I found this on here, but I've been trying to ticker with it and get the days removed. Every time I do it's blinking differently or repeating the clock over and over again. Any suggestions would be greatly appericated.

var end = new Date('11/30/2016 12:00 AM');

    var _second = 1000;
    var _minute = _second * 60;
    var _hour = _minute * 60;
    var _day = _hour * 24;
    var timer;

    function showRemaining() {
        var now = new Date();
        var distance = end - now;
        if (distance < 0) {

            clearInterval(timer);
            document.getElementById('countdown').innerHTML = 'EXPIRED!';

            return;
        }
        var days = Math.floor(distance / _day);
        var hours = Math.floor((distance % _day) / _hour);
        var minutes = Math.floor((distance % _hour) / _minute);
        var seconds = Math.floor((distance % _minute) / _second);

        document.getElementById('countdown').innerHTML = days + 'days ';
        document.getElementById('countdown').innerHTML += hours + 'hrs ';
        document.getElementById('countdown').innerHTML += minutes + 'mins ';
        document.getElementById('countdown').innerHTML += seconds + 'secs';
    }

    timer = setInterval(showRemaining, 1000);
<div id="countdown"></div>



How can i manage my team work (my first time) at school to build a web app with Django and i have small background in web and python?

we are 3 students(2 boys and one girl ) we are not a great programmers and not even a developers and this is our first "end of studies project"(end of second year of school not studies !) we Have to create a WebApp with Django (this is our first time) that manage the marks and absence of students in school my questions is : 1- should we divide tasks so everyone do a part of the project or we build the project together step by step? 2- how can i manage the team and the project remotely *and We do not live in the same house,we meet each other only at school !

NOT: i have small background in web development and python But i never used Django, now i'm going good into step of learning Django But i don't know how to sart building the project thank you in advance




Why google drive doesn't update its URL while opening a resource?

I recently observed that while opening a video or document the URL is not updated to reflect the current resource i.e. what if I wanted to bookmark the currently viewing resource. What could be the reason of not doing it?

PS: There is an option to open the document on the separate tab but there too the URL is some encoded string not the name of the document?




create a simple soap based web service in Laravel project

I am new to laravel and i want to add a soap based web service in my laravel project. Help me as there not much help available for this particular topic from the one i searched for. using laravel 5.3




How to save URL parameters (UTMs) browsing website

When user comes on a site with some UTMs (for example: http://ift.tt/2gRVzZ4) this UTMs removes from URL ending when he reach another pages on the website. I can use this UTM parameters by JavaScript only at the first page he have came, but I want to save this UTMs while user serfs the site pages to use them by JavaScript all the time user serfs the website.




YouTube extract audio with Web Audio API

Is there a way to access audio track from YouTube video using Web Audio API?

Is there a way to load parts or whole YouTube video using <audio> or <video> tags?




How to send a request to the Telegram API?

I have read the documentation here http://ift.tt/1ctUT2G. I want to use api (not bot). I created an application and received api_id, app_hash, Test configuration (ip and port), Production configuration (ip and port) and Public keys. This is all metods http://ift.tt/1dopX0j. I want use metod auth.checkPhone. But I do not understand how to send a request.

Headers should be such as:

POST /apiw1 HTTP/1.1
Host: 000.000.000.000:443 //Production configuration
Connection: keep-alive
Content-Length: ...
Origin: ...
User-Agent: ...
Accept: */*
Referer: ...
Accept-Encoding: gzip, deflate
Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4

But the data is encoded by MTProto.

From documentation written

auth.checkedPhone#e300cc3b phone_registered:Bool phone_invited:Bool = auth.CheckedPhone;
---functions---
auth.checkPhone#6fe51dfb phone_number:string = auth.CheckedPhone;

Please tell me step by step how to encode data from this metod "auth.checkPhone". And how to get the Authorization Key? I read the documentation, but I do not understand. Tell me the logic please, the code I will write itself on php.




what is the difference between Web Architecture and Web Development

I want to know what is the difference between Web Architecture and Web Development ?

I'm working on classification for job postings and I want to know if this classification right

[Software Development , Web Development ] -> [ Spring,  jQuery,  CSS,  Angular, Javascript]
[Software Development , Web Architecture ]-> [Java,  JSTL, JBoss, XQuery,  JSP,  DOM,  XSLT,  XML, Struts]




Can JRebel be used for Java Applets within C# MVC web applications?

I am investigating whether JRebel can be used with a C# MVC app that hosts Java applets. Is this possible?




Search through a webstores all products

Maybe this is the wrong form but I try.

I have a question about how to search/scan through a webstore all products. I have no problem with send a search request to the website and the recieve the answer. But how can I get all products from the website.

It should be possible right? Because several pricecomparing sites can list all the products that a store has.

The solution I have right now is that I send a reqular search?q=cpu to the website and then parse the data that is received.




How to make authentication in mobile apps, if Django web app hash passwords?

I have Django web application, with authentication. Hash passwords with sha2. But now, we want to make Android/iOS application.

How to make authentication in mobile apps, if Django hash/unhash passwords?




Redirect to different web api based on url path

I have two APIs, UserStore and some resource API lets say cars that belongs to that users.

UserStore API: http://ift.tt/2gRcGdq Cars API: http://ift.tt/2gExjGU

How to consolidate this two APIs? I mean that client could access user store resources and cars resources using the above URLs that located at different WEB APIs.

If there is a solution I prefer it using Microsoft technologies (.net core, azure api management and etc...).

Thanks




How come illegal websites are allowed to exist?

I am working on a paper here at my local university and the topic is basically asking me , "How come illegal websites are allowed to exist?". i am honestly curious even without the topic. Some website such as unescape state in the terms and conditions that their service is not allowed to be used for commercial use, but website sell unescape gold and virtual stuff. I am curious how come they are allowed to get away with it? Can anyone make a terms and conditions? Is it free? What are they doing that allow them to function daily? And lastly, are these websites operating legally?




Android WebView Mixed Content error for redirect https to http form

I have a WebView with primary https secure connection for payment page. Result of this payment page redirected to my site with http non secure connection. when user click on first page, that page reloaded instead open my site and i gave this error message:
"Mixed Content: The page at 'http://ift.tt/2gB8Mol' was loaded over a secure connection, but contains a form which targets an insecure endpoint 'http://ift.tt/2fH0tmw'. This endpoint should be made available over a secure connection.", source: http://ift.tt/2gB8Mol (347)

I try 2 way to solve it. first use webviewclient and override onReceivedSslError and handler.proceed() inside it. second use if (Build.VERSION.SDK_INT >= 21) { webview.getSettings().setMixedContentMode( WebSettings.MIXED_CONTENT_ALWAYS_ALLOW ); }
but both not working.




Is there any way to set the custom header when making a API call?

I want to add custom header at the time of API call. I am actually calling a function from controller and inside that function the $resource object is going to be set as follows:

// Generate the $resource object based on the stored API object
                    var resourceObject = $resource(apiObject.url, apiObject.paramDefaults, apiObject.actions, apiObject.options);

                    // Make the call...
                    resourceObject[method](params,

                        // Success
                        function (response)
                        {
                            deferred.resolve(response);

                            // Emit an event
                            $rootScope.$broadcast('msApi::resolveSuccess');
                        },

                        // Error
                        function (response)
                        {
                            deferred.reject(response);

                            // Emit an event
                            $rootScope.$broadcast('msApi::resolveError');
                        }
                    );

How to add custom header inside this ?




Wysiwyg style web based editor for Microsoft RDLC report

I have been searching for wysiwyg style web based editor for Microsoft RDLC report. But had no luck so far. I'm were of fyireporting, but it doesn't seem to fit the bill. The idea is to allow customer to edit their report layout and use preset report parameters to provide database data for the report. Any idea how this can be accomplished?

Sry, for my bad english. Any help is appreciated!




lundi 28 novembre 2016

how to get the output in notepad by using selenium web driver

As i am expecting the output should print in notepad as well as with console window in eclipse so any one can suggeststrong text




Display data from Angularjs2 file(.ts) in html page

code in my .ts file is

  constructor(
      private config  :  ConfigService,
      private http: Http){


     this.getWS('ngoName')
      .do((data) => {
        console.log(data);
        this.saveObj(data);
      }).toPromise();




}

saveObj(data:any){
  this.profileObj = data;

  console.log(this.profileObj);

}


  getWS(ngoName:string):any{


    return this.http.get(this.config.serverBaseURL + "ngos.php?ngoId=1")
        .map((res: Response) => res.json());

  }

the object which i have to use in my html file is the profileObj, structure of profileObj is like this

{ "statusCode" : "200", "message" : "success", "ngoDetails" : [ {"ngoId":"1","ngoName":"Test 1","emailId":"ritesh@gmail.com"}]}

but when i am giving i am getting error:

zone.js:357 Error: Uncaught (in promise): Error: Error in ./Profile class Profile - inline template:28:9 caused by: Cannot read property 'statusCode' of undefined

please help me to resolve this error.




Add reporting charts to web application users using python

I am looking to create a production grade visualization portion of my web application (Imagine Google Analytics but with my own data).

My data is stored in an AzureSQL instance and currently, I am generating the required graphs using Bokeh, Matplotlib and Seaborn in an ipython notebook

I do not understand very well web technologies but I am looking now to create a reporting section in my web application for each user. The front-end is built using basic CSS+Javascript+HTML and the backend is built on Node.js, however, I'd like the data processing to be done in python. My question is how to feed the web app with the charts so that the users of my website can access their own reporting charts in their own account.




Understanding the requirements of the site assignment

The site should ...

  • Use Ajax to make use of some third party service such as Facebook, Google, Twitter etc.
  • Be responsive to device size, displaying differently between laptops and phones.

How do I understand them? How to insert Facebook, Google, Twitter code into my website? And how to detect whether it is a computer or a mobile which is browsing my website?




How to configure tomcat java application in apache web server?

I just configured the tomcat java application in apache like below.

<VirtualHost *:80>
    ServerName domain.com
    ProxyRequests Off
    ProxyPreserveHost On
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>
    ProxyPass / http://localhost:8080/app_name
    ProxyPassReverse / http://localhost:8080/app_name
</VirtualHost>

Later I enabled site using a2ensite adavipalem.conf and restarted the server.

When I try to access from the browser by hitting like >> domain.com I got something like below at browser.

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator at [no address given] to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Apache/2.4.7 (Ubuntu) Server at adavipalem.com Port 80

Can anyone help me where should I have to change this config?

Regards,




How to visit html static site inside web2py project

Say I have some comp html files designer gave me and I want to just use it right away in a web2py website running on 127.0.0.1, with web2py MVC structure, how can I achieve that?




Facebook Crawler to scrape events and add to google calendar

I am trying to scrape events from my facebook group using facebook crawler maybe? and add it to my calendar automatically without having to manually add it. Is this possible to do? Has anyone tried doing this or is there actually a better way of directly adding events ( from said fb group ) to my calendar? The group has events from Eventbrite, Facebook, Meetups etc. Thanks




JS-Cookie: Cookies is not defined

I'm making a small website with PHP, HTML and Javascript, along with some JQuery. I'm trying to use the js-cookie library to manage javascript cookies on my site. I'm using XAMPP to run the project.

As instructed, I've downloaded the library on a directory names 'js' along with JQuery and the file for my project called app.js. Folder with Javascript

On the <head> of my index.php, I've linked the javascript code like so:

   <script src="js/jquery-3.1.1.js" charset="utf-8"></script>
   <script src="js/js.cookie.js"></script>
   <script src="js/app.js" charset="utf-8"></script>

To test that the library, I've created a simple code right at the top of my app.js (on the first two lines).

Cookies.set( 'myCookie', '1' );
console.log( Cookies.get( 'myCookie' ) );

However, when I try to run the website, I get the following errors (on Chrome):

js.cookie.js:5 Uncaught SyntaxError: Unexpected token <
app.js:1

Uncaught ReferenceError: Cookies is not defined(…)(anonymous function) @ app.js:1
app.js:1 

Uncaught ReferenceError: Cookies is not defined(…)(anonymous function) @ app.js:1
app.js:1 

I can't tell if there's a mistake in the way I'm referencing the library on index.php, or in the way I'm creating the cookie, or in the way I'm calling it.

I should also mention that I don't get the first error if I delete the link to js-cookies on my index.php.




Building an expert skunkworks team - What do I look for?

I wanted to ask all of you what you think I should look for in a dev for a team I'm building.

This team will be part of a larger ecosystem with other developers, designers, copywriters, etc.

This team will be responsible for web applications, data visualization, and other interactive experiences. The key is, the team will be expected to produce (take your pick of adjectives) high-end, innovative, cutting-edge, out-of-the-box, complex, type of the type of work

I know I can just hunt for experts in PHP, JS, maybe Python and Django, but I know that I don't know a lot.

I.E. Trending languages Laravel, React, Angular, this is as "cutting edge" or "new" my knowledge gets, What else is out there people are doing new things with?

I.E. Are there new capabilities in the most recent releases of browsers, mobile OS', or HTML5/CSS3 that could be used, if only we knew about them?

Beyond the basic stuff like experience with and knowledge of specific languages, what else should I look for?

Am I looking for a unicorn? Can elite teams like what I'm suggesting ever be "built" or do they need to grow from somewhere else, etc?

Any other thoughts?

Thank you




Grabbing Query Strings in an AWS Authorizer

I currently have an AWS custom authorizer set up for my API gateway on Lambda. It works with my client side app and I am able to authorize properly, except for when I call a link (a link to the api gateway) in an img tag. From my understanding one cannot change the Authorization header the img tag sends out, so I thought I would append the authorization token to the link itself. The link looks something like this:

http://ift.tt/2fFzs2X

How would I allow the custom authorizer to retrieve that token? I understand there's a query string field in method request, but that seems to only deliver data to the underlying lambda.

Another solution could also work here too.




Installed the Phalcon Framework and FactoryDefault not found

I installed the phalcon dev tools on my laptop Windows 7 Sp2 64 on Xamp but when I open the new project this error appear Phalcon\Di\FactoryDefault not'found at line 16 from Public/index.php

Probably it doesn't find the FactoryDefault class, but how can I fix this ?




Spring Web Application

I am creating a online browser game (clicking based). I have a general question about how Java works in web applications.

For example I have a class Mining and after a user logs in (using the form in html) in I want to fetch data from database to put that class certain values. And if users session will end the values from Mining will be saved to database and object will be destroyed. Can I make a new Mining object for each user that uses my application?

package application.data.character;

public class Mining implements PlayerStat{

private int level, exp;

public Mining(int level, int exp) {
    super();
    this.level = level;
    this.exp = exp;
}


public void addExp(int amount) {
    exp += amount;
     ExperienceHandler h = new ExperienceHandler();

     level = h.checkForLevel(exp, level);



}




public int getLevel() {
    return level;
}

public void setLevel(int level) {
    this.level = level;
}

public int getExp() {
    return exp;
}

public void setExp(int exp) {
    this.exp = exp;
}








}




Book recommendation for PHP programming

my wife's brother is willing to learn some PHP for Web Development. Even if I'm quite good at programming, I cannot recommend him any books suitable for a rookie.

Do you have any recommendations?

Thanks a lot!




I have a java application and I would like to make it into an applet to use on a website

Basically, I want to take this program and I want to make it run on a website. Could someone tell me how to do this? Is there some code that I can add to it to be able to do this or...?

import java.util.Scanner;

public class Hashing4 {

    static Scanner stdIn = new Scanner(System.in);

    public static void main(String[] args) {

        int process = 0;

        do{

        System.out.println("Please select an action:");
        System.out.println("1: Encrypt");
        System.out.println("2: Decrypt");
        System.out.println("3: Hash");
        System.out.println("4: Exit");
        process = stdIn.nextInt();

        while (process!=1 && process!=2 && process!=3 && process!=4){   //While to make valid input
            System.out.println("Invalid input.");
            System.out.println("Please select an action:");
            System.out.println("1: Encrypt");
            System.out.println("2: Decrypt");
            System.out.println("3: Hash");
            System.out.println("4: Exit");
            process = stdIn.nextInt();
        }

        if (process == 1){
    //          System.out.println("This is where to put encrypt method call");
                System.out.println("Please enter a text to encrypt: ");
                String plaintext;
                stdIn.nextLine();       //Added extra nextLine cause scanner needs extra for input
                plaintext = stdIn.nextLine();
                System.out.println("Input encryption key value (number of letters to shift by):");
                int key = stdIn.nextInt();
                System.out.println(encrypt(key,plaintext));
        }
        else if (process ==2){
            System.out.println("Input text to decrypt:");
            String plaintext;
            stdIn.nextLine();       
            plaintext = stdIn.nextLine();
            System.out.println("Input encryption key value (number of letters to shift by):");
            int key = stdIn.nextInt();
            key = key%26;
            System.out.println(encrypt(26-key,plaintext));  //Decrypt 26-key
        }
        else if (process ==3){
            String decrypted = null;
            System.out.println("Please enter a text to hash: ");
            stdIn.nextLine();   
            decrypted = stdIn.nextLine();
            System.out.println(hash(decrypted));
        }
        System.out.println("");
        }while(process!=4);     //Loops back to do statement
    }


    public static String encrypt(int key,String plaintext) {    //int is variable of shift

        key = key%26;   //Makes encryption key stay within 0-25 as a container to keep input from going out of range
        char ctext[] = plaintext.toCharArray();

        for (int i = 0; i < plaintext.length(); i++){
            ctext[i] = plaintext.charAt(i);
            if(((ctext[i]>=65)&&(ctext[i]<=90))||((ctext[i]>=97)&&(ctext[i]<=122))){    //As long as ctext is within ascii letter ranges
                ctext[i] += key;
                if(((ctext[i]<65)||(ctext[i]>90))&&((ctext[i]<(97+key))||(ctext[i]>122))){  //97+key prevent spillover into other case by making the gap wider
                    ctext[i] -= 26;     //If encrypted letters go outside of uppercase or lowercase range, minuses 26 to bring it back into range
                }
            }
        }
        String encrypted = "";
        for (int i = 0; i < plaintext.length(); i++){
//          System.out.print(ctext[i]);
            encrypted += ctext[i];
        }
        return encrypted;
    }

    public static String hash(String hash) {
        int len = hash.length();
        if(len==0){
            return "\0";
        }
        len = len%16;
        if(len!=0){
            for(int i = 0;i<(16-len);i++){  //16-len is how many characters you need to add to get to set length
                hash += hash.charAt(0); //Takes hash and adds character at(0)to the end
            }
        }
        int hstuff[] = {0,0,0,0,0,0,0,0};
        for(int i = 0;i<hash.length();i++){
            hstuff[i%8] += hash.charAt(i);  //If string is bigger than array, will add value to each cell again
        }
        for(int i = 0;i<8;i++){
            hstuff[i] /= (hash.length()/8); //Takes values from hstuff(i) and divides by number of values added together to get average ascii values to use
        }
        String hout = "";       //Out value name
        for(int i = 0;i<8;i++){
            hout += (char)hstuff[i];    //converting hstuff into String
        }
        return hout;
    }
}




Confused about nodejs session managment

I was recently testing for session related issue like prevelage escalation in a web app using nodejs express. Its my first time testing nodejs app, the situation is like this,the site has 3 user roles admin, manager, user and all three have same value for connect.sid and thats the only cookies present after auth.

I am confused how nodejs is handling session and how its differentiating that this is admin and he is manager and stuff like that ?

Can someone having experience in nodejs web programming throw some light onto this?




Uncaught ReferenceError: AV_ga is not defined

I have been trying to implement the Adobe image editor UI in a rails project however I am running into a problem. I also get the same error when implementing Adobe's web-getting-started-samples project so I don't understand what is going wrong.

When I click on edit, the image pops up in the adobe UI however none of the functionality works. When I press on frames or stickers or enhance a loading wheel appears but thats it. In the console the following is logged:

Uncaught ReferenceError: AV_ga is not defined

Does anybody know what is going wrong? Thanks




ASP.NET OData, route typeless/untyped entities to same controller

I am using the ASP.NET OData API, version 6.0 I am creating the EDM model using typeless objects. Reason is that I have a semantic data model in my database, crud operations on any object type is done using the same piece of code. So I essentially just need to make one controller which parses the OData query string, and apply it to my native way of loading objects. I have all this working, almost. Whats missing to defined the routing dynamic in some way....

So how can I map entity x,y and z to use the same controller??

My code for building the model looks similar to below. This will route to controllers named IdentitiesController, ResourcesController, SystemsController and OrgunitsController. But they should all route to the same controller "NativeObjectsController"....

The below is just a set of the possible entity types... and the enduser can create his own types, so I cannot just make specialized controllers...

public static void Register(HttpConfiguration config)
{
  IList<IODataRoutingConvention> routingConventions = ODataRoutingConventions.CreateDefault();
  IODataPathHandler pathHandler = new DefaultODataPathHandler();

  config.MapODataServiceRoute(
    routeName: "ODataRoute",
    routePrefix: "odata/dataobjects",
    model: GetEntityModel()
   // ,pathHandler: pathHandler,
    //routingConventions: routingConventions
  );

  var routes = config.Routes;
  config.AddODataQueryFilter();
  config.EnsureInitialized();
}

public static EdmModel GetEntityModel()
{
  if (model != null)
    return model;

  model = new EdmModel();
  EdmEntityContainer container = new EdmEntityContainer(ns_ois, "OISContainer");
  model.AddElement(container);

  AddDataObjectTypeToModel(model, container, "IDENTITY", "Identities");
  AddDataObjectTypeToModel(model, container, "RESOURCE", "Resources");
  AddDataObjectTypeToModel(model, container, "SYSTEM", "Systems");
  AddDataObjectTypeToModel(model, container, "ORGUNIT", "OrgUnits");

  return model;
}

private static void AddDataObjectTypeToModel(EdmModel model, EdmEntityContainer container, string dataObjectSystemName, string entitySetName)
{
  DataObjectTypeController dotController = Factory.Default.CreateController<DataObjectTypeController>();
  int dotId = dotController.GetId(dataObjectSystemName);
  DataObjectType dot = dotController.GetDataObjectType(dotId);

  var entityObject = new EdmEntityType(ns_ois, dataObjectSystemName);
  model.AddElement(entityObject);
  entityObject.AddKeys(entityObject.AddStructuralProperty("Id", EdmPrimitiveTypeKind.Int32, false));
  entityObject.AddStructuralProperty("UId", EdmPrimitiveTypeKind.Guid, false);
  entityObject.AddStructuralProperty("DisplayName", EdmPrimitiveTypeKind.String, false);

  foreach (var property in dot.GetProperties())
  {
  }

  var entitySet = container.AddEntitySet(entitySetName, entityObject);
}




Asp.NET Web Api GetExternalLoginInfoAsync() Allways returns null

I am not able to use the External Login (google and facebook) by calling api. My info variable which returns external credentials is always null. But when I call GET /api/Account/UserInfo, I can actually see user's Email and that he is not registered in my application yet.

 public async Task<IHttpActionResult> RegisterExternal(RegisterExternalBindingModel model)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            var info = await Authentication.GetExternalLoginInfoAsync();
            if (info == null)
            {
                return InternalServerError();
            }

            var user = new ApplicationUser() { UserName = model.Username, Email = model.Email };

            IdentityResult result = await UserManager.CreateAsync(user);
            if (!result.Succeeded)
            {
                return GetErrorResult(result);
            }

            result = await UserManager.AddLoginAsync(user.Id, info.Login);
            if (!result.Succeeded)
            {
                return GetErrorResult(result); 
            }
            return Ok();
        }

I have seen similar problems on the web, but it is not clear how to solve this issue.




How to put a template column in Vaadin-Grid?

I have the following table:

                <vaadin-grid id="temp" style=" height:70vh;">
                  <table>
                    <colgroup>
                      <col name="Column1"/> 
                      <col name="ColumnTime"/>                                
                    </colgroup> 
                    <thead>
                      <tr>
                        <th >Column1</th>
                        <th >ColumnTime</th>
                      </tr>
                   </thead>
                  </table>
                </vaadin-grid>

and my datasource:

{
    "Column1": "My Name",
    "ColumnTime": "<iron-icon icon='image:timelapse' style='cursor:pointer'></iron-icon>"

}

The problem is that the Vaadin-Grid does not deploy the Iron-Icon:

enter image description here

I have noticed that it is because it is within a SPAN element; Which is automatically added by Vaadin, any idea how to make the Iron-Icon deploy?




How to see and use Git files in a ftp directory?


I own my VPS server, with of course ftp and git both installed.

Usually, my workflow consists in editing files downloading/uploading through FTP (with WinSCP). I'm new to the Git system and I would like to use it to do web developing in an enhanced way.

I've been able to init a repo inside the root of a website and successfully push/pull/commit changes. What it is not clear to me, is: how can I access those files I'm uploading? I know everything is inside a hidden ".git" folder but it is not physically possible to access them. This makes Git useless for web developers.. But many of them use it, so there must be something I'm missing.

Can someone help me? I couldn't find anything clear elsewhere on the web and I feel completely in stuck. Thank you in advance.




Providing options in view depending on conditions

I am trying to decide the best ways to deliver up partialViews inside a view based on different options.

I have a partial view inside of a view. I want to give the user a choice using mutually exclusive buttons (radio buttons). I'm not sure of the best way to handle this. I am thinking of using razor or Jquery.

Example: In competition page

3 buttons = [create new team] [join a team] [solo competition]

[create new team]'s view will allow the user to create a new team (the name will be checked to make sure it is unique) then the team will be associated with the competition being viewed.

[join team]'s view will allow the user to enter the name of a team, if the team exists and has room the user can join it. If not, other things will happen.

[solo competition]'s view will allow the user to join the competition without any team.

These options will only be viewable if 1) the user is not already associated with the competition 2) the event is not a single's only competition.

I'm trying to figure out the most efficient way to render this.




Different Add to Cart button links for different products in Woocommerce?

How do I customize this php snippet to have different Add to Cart button links for different products throughout the website?

The code is intended to do the following

I.E:

Product with ID: 01 uses a Buy Button that redirects to www.example/ONE Product with ID: 02 uses a Buy Button that redirects to www.example/TWO

Code I want to customize:

<?php   

function custom_add_to_cart_redirect() 
{ 
    return 'http://ift.tt/2go5hPu'; 
}
add_filter( 'woocommerce_add_to_cart_redirect', 'custom_add_to_cart_redirect' );

?>

So, how would I take into account the product var ID in other to have different buy buttons links depending on the product ID?




How to run python script in HTML?

Currently I'm having some python files which connects to sqlite database for user inputs and then performs some calculations which sets the output of the program. I'm new to python web programming and I want to know what is the best method to use python on web?

Ex: I want to run my python files when the user clicks a button on the web page. Is it possible?

I started with Django. But it needs some time for the learning. And I also saw something called CgiScripts. Which option should I use? Please advice.




Turning cURL request into PHP

Really stuck on how to convert the below into a PHP get request. I can see there is a request URL and header paramters, but not sure how it would look. Please can you lovely people help :)

curl -v -X GET \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: SSWS ${api_token}" \
"http://ift.tt/2gOdnEo"




what is progressive mobile website?

I am working with the responsive website, Which is running on all platforms and various browsers in Mobile, Desktop, Tablet. I noticed this term from a blog

Progressive Mobile website

Can anyone please share about this?




Yii2: how to change/add response headers?

I have some truble with Yii2. I try to add/set response headers in my controller's action. Below is code:

   Yii::$app->response->headers->set('Content-type', ['application/pdf']);
   Yii::$app->response->headers->set('Content-Disposition', ['inline', 'filename=' . $fileName]);
   Yii::$app->response->headers->set('Content-Transfer-Encoding', ['binary']);
   Yii::$app->response->headers->set('Content-Length', [$fileSize]);
   Yii::$app->response->headers->set('Accept-Ranges', ['bytes']);

   return readfile($filePath);

If I change set() to add(), or second argument from array to string so get no reaction. Pdf file is not opened. But if I use native PHP header() method - all works correct.




how to get values of description list, with terms and descriptions in DOMXPath?

So far i get complete html of page now i want to get data of description list from that page. i am new with web scrapping so please help me out with this?

Here is html that i want to get.

<dl id="specs">

    <dt class="section">Keyboard</dt>
    <dt>Keyboard</dt>
    <dd>88 keys</dd>
    <dt>Touch Sensitivity</dt>
    <dd>Key Touch: 5 types, fixed touch</dd>
    <dt>Keyboard Mode</dt>

    <dt class="section">Sound Generator</dt>
    <dt>Piano Sound</dt>
    <dd>SuperNATURAL Piano Sound</dd>

</dl>




How webpage security works

This question is in my mind for long time, As a web developer, i tried to find answer over the years but failed miserably. Hence, planned to approach the experts here. There are lots of heavy security available in regular java/J2EE apps for session hijacking, so lets discuss the simple javascript app.

For eg: A normal Javascript Application launches (AngularJS), www.example.com/# welcome, after successful login, and user can navigate to the next page, like 'http://ift.tt/2fVORwU', the navigation continues.

Suppose, now user2 without logging in, get to know the url path 'http://ift.tt/2fVORwU', and tries to launch it, the access denies. But how this is happening under the hood. How the javascript handles the session/client id, and tracing.

Or is there any simple approach to handle this session hijacking.

Apologize if the question sounds too dumb.

Thanks, David




How to Creating a web and connecting to a database [on hold]

I want Creating a basic web form and connecting to a database in windows server

please help me .....




dimanche 27 novembre 2016

High charts hidden data

Please check this image link

How to fix this issue? I just want to see all the data without disabling other legends. If I disable "IT Services - Headcount" and "IT Services - Present", "Learning - Headcount" and "Learning - Present" will be shown (vice versa)




Does altova mapforce exposes any REST APIS?

I am new to altova mapforce. I wanted to know that does Altova Mapforce exposes any kind of REST APIS so that we can supply it the input from a single page web application and get the data from the tool back in any format(JSON,XML)?




Styling script inside of HTML

I'm trying to style a stock widget taken from: http://ift.tt/2fH9VcW. I am using Bootstrap to help style the page.

In order to place it inside of a div, I had to put the script itself inside of the HTML code I've written as shown below:

    <div class="col-md-3 col-sm-12 well">
        <script src="http://ift.tt/2gmtc1N"></script>
    </div>

However, I cannot style the size of the stock which causes it to be bigger than the space I have allocated for it as shown below:

Stocks

Is there any way for me to edit the size of the script? I have already considered increasing the column size, but that is not an attractive option considering other elements of the page.




How to use ng2-page-croll Scroll to load a route and then scroll

With my website setup my-app loads header+navigation+footer. In the contents I am using router-outlet to load in views based on current routes.

Some of my navigation though uses page scrolling (anchors), to scroll to various sections on the home page.

I have use NG-Page-Scroll and it works well, however these anchor links are available to me when in a different route. How can I use these links to A, route to the "home" page and then scroll to the appropriate section.

Navigation Nonlead - > routes to 'nonlead' news - scrolls to news in route 'home' aboutus - scrolls to aboutus in route 'home' events - scrolls to events in route 'home' calendar - scrolls to calendar in route 'home' join us -> routes to joinus

when in Joinus or Nonlead, how can I make the other links work by going to the home route and then scrolling to the section.

http://ift.tt/2g8nF0X




Which 2nd language to learn? Java or .NET

I am a software developer in my mid-40s. Have been programming the same language all these time (shame on me, desktop development only in Delphi), only know little about HTML, CSS. Have 1.5 year in CSharp desktop progamming. Always thinking of I need an insurance and also in dev world a second language is important. First of all to choose either desktop development or go to web development field. Then to choose second programming language.

Can you comment on these and tell me the reason of your choice? Thanks.




Amateur programmer looking to turn an idea into a website

I mostly work with Python and R, but I'm looking to turn a recent project in R into a website using D3.js, JQuery and PHP to accomplish what I was using shiny for previously - I think. I'm completely new to web development, and I want to make sure I'm at least in the right ballpark with my plan before I start working on it.

My R Script (feel free to try it out here, it's definitely a WIP) is fairly straightforward, essentially it takes data from Spotify's API to find related artists and create a graph where each node represents an artist and each edge is a connection between two artists (one appears on the other's related list). To convert this script into a website, it looks like I'm going to have to learn a few new languages.

  • For backend, it seems like PHP is the way to run scripts server-side that can then pass information to the client. Is this true? I can't imagine one can run a script in HTML or Javascript... Does PHP talk to Javascript? Like could I create a graph like this one and run a PHP script to query the Spotify API every time a user moused over a node?
  • For the front end, it seems like what I want to do is make a website that has super minimal HTML & CSS, as most of the site should be the graph. Does that seem right? I'm reading that the more Javascript a site utilizes, the more it tends to slow down on the client side. Could that be an issue?

Sorry if these seem like dumb questions, like I said I have virtually no idea how to build a website, I want to know if this is how I should get started on learning.




Is there any website to publish an XML file with XSLT?

I want to publish my XML file with XSLT on some website, so someone else can see the formatted output with a link of the website.




Exception occured during code generation : null WEB services

Good evening guys. I am keep getting the error related to web services. I am trying to add wsdl file from url on eclipse http://localhost:50245/WebService_Client.asmx?wsdl.

This web service is created on C#, unfortunately, I have to consume those web services on eclipse. That is the requirement for the project. How could I solve this error?

EDIT: web services are made public but error still occurs

Here is the image of how the error looks like.

http://ift.tt/2gMTwoS




How to create structured data in PHP for Google Web Pages?

I am told, We do not detect any structured data on your site.

What does that mean? I can't seem to add a structure because my file is in PHP, not HMTL.

Any suggestions?




How is a weather forecasting website like weather.com built?

Can somebody please explain the technology stack behind it? And how it is implemented with a high level architecture diagram (if possible)?

I would like to understand how it functions, and how can they monetise the website, and I may not know all the technology behind it, but I want to gain a very deep understanding of it for academic reasons and also to satisfy my intellectual curiosity.


Regards,

Bengalurean




Firebase Auth Inivite Only Scheme : How to communicate the credentials to user?

Here's my question. To access our app, the users must be invited.

This means, we use an admin web app to create the user account in Firebase and we send him an invite to download the app and use it.

Now the next phase, how can we send to the newly created user his credentials?

Our first idea was to use a temporary password. We could send the password by email to the user and ask him to redefine his password at his first logging.

His this a good idea? I guess it's not

Is there a better way?

Thanks for the help. T




What URL to hit to log out of Facebook through java APIs?

I am using the below code to log into Facebook. Once i get the code, using that i get access token and then query graph api and get some basic details.

@RequestMapping(value = "/fblogin")
        public String inititateFBlogin(ModelMap model) {

            System.out.println("in FB login ");

            String fbAuthURL = fbConnectionService.getFBAuthUrl();


            return  "redirect:"+fbAuthURL;

        }


        public String getFBAuthUrl() {
                String fbLoginUrl = "";
                try {
                    fbLoginUrl = "http://ift.tt/VyM1TP?" + "client_id="
                            + FBConnection.FB_APP_ID + "&redirect_uri="
                            + URLEncoder.encode(FBConnection.REDIRECT_URI, "UTF-8")
                            + "&scope=email";
                } catch (UnsupportedEncodingException e) {
                    e.printStackTrace();
                }
                return fbLoginUrl;
            }

But to logout , i am hitting the URL in below format. //http://ift.tt/1rjUmp0]

@RequestMapping(value = "/fblogout", method=GET)
    public String  fbLogOut(ModelMap model) {


        String fbLogoutURL = "http://ift.tt/2foKPB4";


        String appURL = "http://localhost:15005/abc";

        String accessToken = accessTokenFB ;

        String logOutURL =   fbLogoutURL+appURL+"&access_token="+accessToken;

        return "redirect:"+logOutURL;

    }

But looks like the above FB url always redirects to the FB homepage. Is there any way that i can log out by simply calling any FB service through java, I would rather avoid going down to the javascript SDK. Many thanks.




What should I do after the Open Authentication

This is more of a general question. I'm developing a web application which authenticate users using OpenID. Now, let's say the user is authenticated and their ID is sent back. My question is, what should I do with the ID? should I add a record for every authenticated user in my database? I still cannot get the gist of this. I'd appreciate any ideas.




How to scrap Ajax webpage using python

Hi i am learning Python scrapping technique then i stuck into problem that I want to scrap a Ajax page link here: http://ift.tt/2gvwWNE

I want to scrap all the medicines name and details coming in the page .Since i read most of the answer on the stack overflow but i am not getting the right data after scrapping . I also tried to scrap using selenium or send a forge post request but i am failed .

So please help me on this Ajax scrapping topic specially this page because ajax is triggered on selection an option from drop down options . Also provide me some resources for ajax page scrapping




Why cookies are not set in IE10 if port is specified?

I'm loading a page from IE10 which results in following request

GET http://localhost:9000/api/test/StartUser HTTP/1.1
Accept: text/html, application/xhtml+xml, image/jxr, */*
Accept-Language: en-US,en;q=0.7,ru;q=0.3
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393
Accept-Encoding: gzip, deflate
Host: localhost:9000
Connection: Keep-Alive
Pragma: no-cache
Cookie: .ASPXAUTH=E37B3981C02B6ACA23C4E1378387650F5B7628627BB3A110B622AA4BA81E871757C16F12F24DA6EDD8512DD76DBFB0C58FADCFDFEA96920EDABE2C0384988F6BC2C19952FA0A1BAE465F31B40361F0F1A07645875031605DB509241296BB182BF76CC742AFEF46D6478F95C0E24ECA5DC95A46AB8980974F62004EB8611F7119C71D0F3DCE905F2AD88C88DBD2ACB44C8D094B656F47825AC4D2363CCB8C622FF25600E64795042E91CBE5EC5381608E

And i've got a response:

HTTP/1.1 200 OK
Content-Length: 13
Content-Type: text/plain; charset=utf-8
Server: Microsoft-HTTPAPI/2.0
Set-Cookie: TestUserSID=S-1-5-15-768210012-1870262352-668750042-1446; expires=Mon, 27 Nov 2017 16:54:48 GMT; domain=localhost; path=/
Date: Sun, 27 Nov 2016 16:54:48 GMT

Cookie set :)

Then I open other Tab in a browser got ot the same url and my new request is

GET http://localhost:9000/api/test/StartUser HTTP/1.1
Accept: text/html, application/xhtml+xml, image/jxr, */*
Accept-Language: en-US,en;q=0.7,ru;q=0.3
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393
Accept-Encoding: gzip, deflate
Host: localhost:9000
Connection: Keep-Alive
Pragma: no-cache
Cookie: .ASPXAUTH=E37B3981C02B6ACA23C4E1378387650F5B7628627BB3A110B622AA4BA81E871757C16F12F24DA6EDD8512DD76DBFB0C58FADCFDFEA96920EDABE2C0384988F6BC2C19952FA0A1BAE465F31B40361F0F1A07645875031605DB509241296BB182BF76CC742AFEF46D6478F95C0E24ECA5DC95A46AB8980974F62004EB8611F7119C71D0F3DCE905F2AD88C88DBD2ACB44C8D094B656F47825AC4D2363CCB8C622FF25600E64795042E91CBE5EC5381608E

Why cookies were not sent with my second request ?




Creating event-based backend for mobile, desktop and web system

I am planning to build an application that will consist of a mobile app, desktop app, web app and it will communicate with several devices (sensors) that will supply data that will be processed by server and pushed to all of the devices. Users will also be able to make changes to some data and those changes should be immediately visible to other devices/users.

I wanted to use an event-based backend where let's say the sensor sends the data to the server that processes it and creates an event that lets all the devices know that new data is available and that they should download and display it. Also, when user makes a change to some bite of data, that should create an event that will be catched on the server that will check if that change somehow affects other data that would have to be processed again and after it processes it, it would fire an event to let devices know that data has been changed.

I just want to know if there are any solutions to that kind of problem. For a long time I've been thinking about using something that would let me fire system events that would be catched by all the devices on all different platforms, but I couldn't find any good solution. At this point, device operating systems and technologies don't matter, I'm looking for all available solutions.

If you need more information, I will be happy to provide it.

Thanks!




No template named index

I'm trying to get a simple blog running on web.py, it launches fine(python bin/blog.py) but when i enter website it says it cannot find template. I'm pretty sure the path is right, i did a simple todo list before that and it works fine. What's wrong?

here's my project folder look: -blogpy -bin -blogwebpy -docs -templates -tests

Here's the code for blog.py which is located in bin(templates are located in templates):

import web
import model

### Url mappings

urls = (
    '/', 'Index',
    '/view/(\d+)', 'View',
    '/new', 'New',
    '/delete/(\d+)', 'Delete',
    '/edit/(\d+)', 'Edit',
)


### Templates
t_globals = {
    'datestr': web.datestr
}
render = web.template.render('templates/', base='base', globals=t_globals)


class Index:

    def GET(self):
        """ Show page """
        posts = model.get_posts()
        return render.index(posts)


class View:

    def GET(self, id):
        """ View single post """
        post = model.get_post(int(id))
        return render.view(post)


class New:

    form = web.form.Form(
        web.form.Textbox('title', web.form.notnull,
            size=30,
            description="Post title:"),
        web.form.Textarea('content', web.form.notnull,
            rows=30, cols=80,
            description="Post content:"),
        web.form.Button('Post entry'),
    )

    def GET(self):
        form = self.form()
        return render.new(form)

    def POST(self):
        form = self.form()
        if not form.validates():
            return render.new(form)
        model.new_post(form.d.title, form.d.content)
        raise web.seeother('/')


class Delete:

    def POST(self, id):
        model.del_post(int(id))
        raise web.seeother('/')


class Edit:

    def GET(self, id):
        post = model.get_post(int(id))
        form = New.form()
        form.fill(post)
        return render.edit(post, form)


    def POST(self, id):
        form = New.form()
        post = model.get_post(int(id))
        if not form.validates():
            return render.edit(post, form)
        model.update_post(int(id), form.d.title, form.d.content)
        raise web.seeother('/')


    app = web.application(urls, globals())

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




User information not getting into MYSQL db

Hi im making this user signup form and linking the user email name and password tot he table in mysql DB,but its not showing any row in mySQl DB here is the code!!