mercredi 31 janvier 2018

Is there usually a performance impact between localhost XAMPP and hosting server online?

For Instance:

I have a website that has a form of category checkboxes that adjust a resulting array of .gif img src paths. and in XAMPP localhost, it runs PERFECTLY, the script runs flawlessly and there is a function that compares width and height and resizes it to fit browser window and everything.

The Problem:

Then when I upload it on "name.com" Domain Hosting, the script is so slow and images are resized after like 3 seconds of waiting. I figured that was just because its a cheap shared server, so I am now trying Amazon EC2 Beanstalk and it is still kinda slow and laggy.

The Question:

Is this normal? Is there usually a noticeable discrepency between localhost and server performance?

-Thanks




Initializing the ModelView in AngularJs

I made a oriented object analysis for some project using a Model View Controller architecture style (Model-View-Presenter). For instance for a given Use Case some View need to ask some controller about some data and then the controller get the data from some models classes. Now for the design we need to use AngularJs (Model-View-ViewModel).

Now some HTML view, for displaying the data, it get the data using the controller (a .js file) via attributes of this controller. This way:

HTML:

....
<div>
    <p></p>
</div> 
....

JS:

....
appControllers.controller ("SomeController",function(){
    var self = this;
    self.someAttribute = 'someValue';
});
....

I think this is the right way to work with AngularJS right? Also the View is associated with the controller via Angular Routing. The issue is the attributes data of the controller (the ModelView) is retrieved via API REST, and I dont know if the right thing to do is to have a private function in the controller getting this data and then call this function when initizalizing the controller:

....
appControllers.controller ("SomeController",function(){
    var self = this;

    getSomeData();       


    function getSomeData  () {      
    $http({
        method : "GET",
        url : someRestResourceURL,  
        headers : {
            'Content-Type' : 'application/json'
        }
    }).then(function successCallback(response) {
        self.someAttribute = angular.fromJson(response.data);

    }, function errorCallback(response) {
    });
}

});




Nginx Redirect all 404 to index excluding files

I just moved to Nginx from Apache and I'm quite novice. I'm trying to redirect all 404 errors to my index file, done by this:

error_page 404 =200 /index.php;

This rule also returns an HTTP 200 instead of produced HTTP 404. This works as expected excepting that all not found resources are affected by this rule too. For example: images, scripts, etc... This causes the innecessary execution of my index file. I just want to redirect 404 errors generated from innexistent URL paths. For example:

These will be handled by the rule:

http://example.com/wrongpath
http://example.com/wrong/path2

These won't be handled by the rule:

<img src='/resources/images/innexistentimage.jpg'/>
<script src='/resources/scripts/innexistentscript.js'></script>

And code may look something like this:

server{

    . . . .

    location ~* \ [NOT] .(jpe?g|png|gif|ico|js|css)${
        error_page 404 =200 /index.php;
    }

    . . . .

}

Thanks in advance




Flask not finding root to / -404

Hello Im new to flask and python, i tried redirecting my script to go to something.html as it was apresenting a 404 i decided to run a hello world and did not work.

Not Found

The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.

http://localhost:5500/hello

from flask import Flask
from flask import request
from flask import url_for
from flask import redirect
from flask_sqlalchemy import SQLAlchemy

app = Flask(__name__)
app.debug = True
app.config['SQLALCHEMY_DATABASE_URI']=         'postgre://postgres:*****@localhost/web'
db = SQLAlchemy(app)

class Rent(db.Model):
id = db.Column(db.Integer, primary_key=True)
email = db.Column(db.String(200) , unique=True)
sug1 = db.Column(db.String(200) , unique =True)
sug2 = db.Column(db.String(200) , unique = True)
sug3 = db.Column(db.String(200), unique = True)



def __init__ (self,email,sug1,sug2,sug3):
    self.email = email
    self.sug1 = sug1
    self.sug2 = sug2
    self.sug3 = sug3


def __repr__(self):
    return '<User %>' % self.email


    @app.route('/hello')
    def index():
        return "Hello"



@app.route('/resumo', methods=['POST'])
def pesquisa():
    rent = Rent(request.form['email'],request.form['sug1'],request.form['sug2'],request.form['sug3'])
    db.session.add(rent)
    db.session.commit()
    return redirect(url_for('index')) 

if __name__ == "__main__":
        app.run(port=5500)




CSS not loading after site URL changes

So, basically we changed our site URL from a big one to a rather small URL. for example, http://ift.tt/2rVzPBU to www.newsite.com/12345

After these changes I see that the css is not loading anymore, is there anything that I need to add/remove to my jsp files?

I am accessing the css in my JSP files like:

resources folder is under ther web/webroot folder.

Please help.




What different between this color code ( #fff3f3f3 ) ( #ffffff ) the first one is 8 characters and second one is 6? [duplicate]

This question already has an answer here:

What the difference between this color code #fff3f3f3 and #ffffff - the first one is 8 characters and second one is 6 ?

And how I can read that kind of colors #fff3f3f3 ?




Web Services Project Ideas [on hold]

So I'm taking a Web Services course and I have no idea what I could possibly do for a project. And rather than being a productive student, I'm being lazy and asking on stack overflow.
So I'm wondering if anyone here has any ideas for some who has never done a web service before.




How to force https:// and www. with htaccess even when requested from https://

I've looked everywhere and tried the top results from Stack Exchange but none of the solutions actually solve this problem.

If user types:

example.com/secure
http://example.com/secure

it redirects to https://www.example.com/secure <---GOOD!

but if the user types:
http://www.example.com/secure
www.example.com/secure
https://example.com/secure

it redirects to http://www.example.com/secure <---not good

I need to force both https:// and www. regardless of how the user types it.

Here are the solutions I've tried:

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

and

RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Please, can someone suggest an ultimate solution for this?




how to host m3u8 files

recently i was experimenting around live streaming techniques and i found a site hosting live channel and i found that the player was hosting from a link ending an extension with .m3u8 like (eg: http://xyz.xyz/xxxxx/xx.m3u8) and i download that file and played using vlc it worked fine and i also tried playing the same m3u8 from the example link above, the video streamed n played and then the m3u8 files that i had downloaded before i upload it into cloud and generated a link for m3u8 and tried to stream with that uploaded m3u8 link . the player was unable to play i wanted to know why this happened just for some knowledge and how can i stream that m3u8 file from my own cloud host (ps: my hosted file was on public mode of access permission)




How do I make a website which show graphs of sentiment analysis of tweets using Twitter API?

how to make a live website which show graphs of sentiment analysis on tweets based on a specific topic by using python and text-blob library . Iam new to web-development , have moderate knowledge in python . please suggest the resources that i should follow ?




YML file dosn't work with spring boot

I have a problem and i really don't know how to solve it, and for me it doesn't make sens. Can anyone tell me where is the mistake because i can't see it. I am using spring-boot

Here I have the yml file:

spring:
   profiles: dev
 devices: 
  list: 
- id : TV1
  type : TV
  value : boolean
  name : TV_sufragerie
- id : TV2
  type : TV  
  value : boolean
  name : TV_dormitor
- id : Therme1
  type : Therme
  value : Double
  name : Therme-hol
- id : SmartBulb1
  type : SmartBulb
  value : SmartBulbValue
  name : SmartBulbDormitor

And this is how I try to take the data from the yml file:

@Component
@ConfigurationProperties("devices")
public class DeviceYml {

private List<DevicesList> list = new ArrayList<>();

public static class DevicesList {

    private String id;

    private  String type ;

    private List<String> value = new ArrayList<>();

    private String name;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public List<String> getValue() {
        return value;
    }

    public void setValue(List<String> value) {
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "YAMLConfigDevice [id=" + id + ", type=" + type + ", value=" + value + ", name=" + name + "]";
    }

}
public List<DevicesList> getDevices() {
    return list;
}

public void setDevices(List<DevicesList> list) {
    this.list = list;
}

@Override
public String toString() {
    return "devicesList=" + list + "";
}
}

I alsow have in the applicaton.properties this:

spring.profiles.active=dev




Is it possible to automate Outlook Online App with Excel vba?

I am was wondering if it was possible to automate Outlook Online App with Excel vba. I need to scan the inbox for specific email attachments and save those attachments to a designated folder. Seems like this is possible with the desktop version of Outlook but I'm not having luck with the Outlook Web App. Any ideas?




Taking a HTML input and saving it then outputting that into a table

I am trying to make a web app and I wanted to get the user input and save that. Then I want to take that saved input and put it into a table. I have it to were it will output into a table and save. My problem is that I can not figure out how to save multiple inputs then output those. I was using Java Script localStorage but if there is something better to use I would use that.




Servers, web servers, ftp server

i've got some questions about servers used on web and i would like if You can help me please.. here there are.. i Hope you'll understand them.. Thanks.. When i want to upload a website by using an ftp client, is the server software (like apache, nginx) which manages the send files, or there is a different and dedicated server for ftp? Also, if the last one is true, this dedicated server sends the received files to the web server?

Pd: i'm sorry about muy english, it's not my native language




What if user manually deletes cookie? - Login

I have a general architectual question about simple cookie-session based authentication.

In my web application I create a session when a user logs in and return a cookie with the session id which is then sent back from the client/browser with every request and so on and so good. But now what if the user manually deletes this cookie with the session information in his browser? Because on the server the session still exists then and the user is thereforecmore or less still logged in on the server. However there is no more cookie returned from the client and the server will treat it like an unlogged user. How do I solve this? Cause Ideally I would like to delete the session (and additionally log out the user in the database) just each time the user manually deletes the cookie in the browser.

Thank you!!




btrace with glassfish web container

Recently I use btrace to check exceptions that are thrown inside glassfish 4.1 b13 VM. When I attach to GF 4.1.1 (build 1) with BTrace v.1.3.10.2 (20180129) using '-v' the following stracktrace is generated by GF and I see no console output thrown by btrace:

btrace DEBUG: parsed command line arguments]]  
btrace DEBUG: Bootstrap ClassPath: .]]
btrace DEBUG: ignoring boot classpath element '.' - only jar files allowed]]
btrace DEBUG: System ClassPath: /usr/lib/jvm/java-8-oracle/jre/../lib/tools.jar]]
btrace DEBUG: debugMode is true]]
btrace DEBUG: probe descriptor path is .]]
btrace DEBUG: stdout is false]]
btrace DEBUG: starting agent thread]]
btrace DEBUG: Agent init took: 10482105ns]]
btrace DEBUG: starting server at 2020]]
btrace DEBUG: waiting for clients]]
btrace DEBUG: client accepted    Socket[addr=/127.0.0.1,port=43496,localport=2020]]]
btrace DEBUG: got instrument command]]
btrace DEBUG: loading BTrace class]]
btrace DEBUG: verifying BTrace class ...]]
btrace DEBUG: BTrace class com.sun.btrace.samples.OracleNsPacket  verified]]
btrace DEBUG: preprocessing BTrace class com.sun.btrace.samples.OracleNsPacket ...]]
btrace DEBUG: ... preprocessed]]  
btrace DEBUG: loaded 'com.sun.btrace.samples.OracleNsPacket' successfully]]
btrace DEBUG: creating BTraceRuntime instance for com.sun.btrace.samples.OracleNsPacket]]
btrace DEBUG: created BTraceRuntime instance for com.sun.btrace.samples.OracleNsPacket]]
btrace DEBUG: sending Okay command]]
btrace DEBUG: client com.sun.btrace.samples.OracleNsPacket: got com.sun.btrace.comm.OkayCommand@26cab401]]
btrace DEBUG: about to defineClass com/sun/btrace/samples/OracleNsPacket]]
btrace DEBUG: defineClass succeeded for com.sun.btrace.samples.OracleNsPacket]]
btrace DEBUG: skipping transform for BTrace class com/sun/btrace/agent/RemoteClient$1]]
btrace DEBUG: starting client command handler thread]]
btrace DEBUG: skipping transform for BTrace class com/sun/btrace/agent/Main$3]]
btrace DEBUG: new Client created com.sun.btrace.agent.RemoteClient@44c6c5b2]]
btrace DEBUG: retransforming loaded classes]]
btrace DEBUG: filtering loaded classes]]
btrace DEBUG: skipping transform for BTrace class com/sun/btrace/runtime/ClassCache$Singleton]]
btrace DEBUG: skipping transform for BTrace class com/sun/btrace/runtime/ClassInfo$ClassName]]
btrace DEBUG: skipping transform for BTrace class com/sun/btrace/runtime/ClassInfo$JavaClassName]]
btrace DEBUG: skipping transform for BTrace class com/sun/btrace/runtime/ClassInfo$BaseClassName]]
btrace DEBUG: skipping transform for BTrace class com/sun/btrace/runtime/ClassInfo$InternalClassName]]
btrace DEBUG: skipping transform for BTrace class com/sun/btrace/runtime/BTraceClassReader$BailoutExceptio]]
btrace DEBUG: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: This web container has not yet been started]]

java.util.concurrent.ExecutionException: java.lang.IllegalStateException:    This web container has not yet been started
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at com.sun.btrace.agent.Main.startServer(Main.java:674)
at com.sun.btrace.agent.Main.access$000(Main.java:60)
at com.sun.btrace.agent.Main$2.run(Main.java:125)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: This web container has not yet been started
at org.glassfish.web.loader.WebappClassLoader.findResourceInternal(WebappClassLoader.java:2827)
at org.glassfish.web.loader.WebappClassLoader.findResource(WebappClassLoader.java:1320)
at org.glassfish.web.loader.WebappClassLoader.getResourceAsStream(WebappClassLoader.java:1528)
at com.sun.btrace.runtime.ClassInfo.loadExternalClass(ClassInfo.java:262)
at com.sun.btrace.runtime.ClassInfo.<init>(ClassInfo.java:215)
at com.sun.btrace.runtime.ClassCache.get(ClassCache.java:70)
at com.sun.btrace.runtime.ClassCache.get(ClassCache.java:62)
at com.sun.btrace.runtime.ClassCache.get(ClassCache.java:51)
at com.sun.btrace.agent.Client.retransformLoaded(Client.java:451)
at com.sun.btrace.agent.Main$3.run(Main.java:693)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

btrace DEBUG: waiting for clients]]
btrace DEBUG: skipping transform for BTrace class sun/security/ssl/ServerNameExtension]]
btrace DEBUG: skipping transform for BTrace class sun/security/ssl/UnknownExtension]]  
btrace DEBUG: skipping transform for BTrace class sun/security/provider/PolicyFile$6]]

The thing I am confused about is the glassfish exception. When btrace is being attached there is already an application deployed on GF that serves HTTP requests. If there is a webapp deployed that uses web container why 'the container has not been started' is raised?

But sometimes it works and btrace output appears..but it is 1/10 tries. Any suggestions what causes this Ex?




retrieve data from the website using php

I would like to create an insurance comparison site, the idea and send a request to the web and recover sites that offer insurance(for exemple like trivago system's ), the concern, I do not know how to proceed is what you can m help on that thank you and have a nice day :).




I need some help/advice with my new job, about taking control of the system (web, javascript, nodejs, android, brokersms, fcm)

I started a new job in the middle of this month, and my first task is to "domain" this software that was made by the last intern. The software was made to notify all clients that they have to pay for the products/services theyve demanded, by push (android app) and SMS (mobile). Well, its been two weeks now and im totally lost, because i have no experience in web development and i believe this system is built in js/nodejs. There is no one to train or guide me, so that makes me aflict, because ive barely made progress so far. Can anyone give me some advice? where should i begin? how can i take control of this system?




Framework for contact tiles with Sharepoint

I'm working on a webpart for sharepoint where I would like to have an interface, that contains multiple self created business cards to navigate through. I've attached a picture of my idea and would be very grateful, for some advices regarding a framework that simplifys my work.

Already a big thank you from my side!

Contact Tiles in Sharepoint




crawljax web ui fails after runnig with empty result

When I run Crawljax Web UI and configure it, it can run and do some work after that fails and result will empty. I searched a lot and found nothing.(like documentation in github and it's wiki) So I appreciate that anybody can help Me. I tried 3.6 and 3.5 versions and tried in Windows 10 and Linux Mint. I used firefox newest and older versions all of those has similar failure. When I run it, a firefox official out of date page opens, but I used newest and older versions. Here some logs:

12:20:43.428 [pool-1-thread-1] INFO c.crawljax.plugins.crawloverview.CrawlOverview - Initialized the Crawl overview plugin

12:20:43.795 [pool-1-thread-1] INFO com.crawljax.core.plugin.Plugins - Loaded Crawl overview plugin as a OnNewStatePlugin

12:20:43.795 [pool-1-thread-1] INFO com.crawljax.core.plugin.Plugins - Loaded Crawl overview plugin as a PreStateCrawlingPlugin

12:20:43.795 [pool-1-thread-1] INFO com.crawljax.core.plugin.Plugins - Loaded Crawl overview plugin as a PostCrawlingPlugin

12:20:43.811 [pool-1-thread-1] INFO com.crawljax.core.plugin.Plugins - Loaded Crawl overview plugin as a OnFireEventFailedPlugin

12:20:43.811 [pool-1-thread-1] INFO com.crawljax.core.plugin.Plugins - Loaded Crawl overview plugin as a PreCrawlingPlugin

and it's a line of output in cmd:

Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:



1517388664711   addons.productaddons    INFO    sending request to: https://aus5.mozilla.org/update/3/GMP/56.0/20170926190823/WINNT_x86_64-msvc-x64/en-US/release/Windows_NT%2010.0.0.0%20(x64)/default/default/update.xml
1517388667577   DeferredSave.webext.sc.lz4      DEBUG   Starting write
1517388667593   DeferredSave.webext.sc.lz4      DEBUG   Write succeeded
1517388684721   addons.productaddons    WARN    Failed downloading XML, status: 0, reason: timeout
1517388684721   addons.productaddons    INFO    fetching config from: chrome://global/content/gmp-sources/openh264.json
1517388684722   addons.productaddons    INFO    fetching config from: chrome://global/content/gmp-sources/widevinecdm.json
1517388684723   addons.productaddons    INFO    found plugin: gmp-gmpopenh264
1517388684723   addons.productaddons    INFO    found plugin: gmp-widevinecdm
1517388686420   addons.productaddons    INFO    downloadXHR File download. status=200
1517388686437   addons.productaddons    INFO    Downloaded file will be saved to C:\Users\...\AppData\Local\Temp\tmpaddon-31e4a
1517388692707   addons.productaddons    INFO    downloadXHR File download. status=200
1517388692710   addons.productaddons    INFO    Downloaded file will be saved to C:\Users\...\AppData\Local\Temp\tmpaddon-7c0b9d

        at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:118)

Thanks a lot.




Upload multi files in delphi & web page

I'm using custom components to upload multiple files at the same time, it crop, rotate and automatically upload to the server.

How to simulate the click button in firefox, select the files in delphi form?

PS: the source folder is fixed "C:\Scan" it can be added automatically in the web page?

Regards




mardi 30 janvier 2018

Code breaks when running as a service worker

I have two js files - one with some vendor code (jQuery, medium-zoom.js, and prism.js), and another with some really minimal custom code, and I'm trying to save them with a service worker.

(function () {
if ('serviceWorker' in navigator) {
  window.addEventListener('load', () => {  

    navigator.serviceWorker.register('/js/vendor.js').then((registration) => {
      // Registration was successful
      console.log('ServiceWorker registration successful with scope: ', registration.scope);
    }, (err) => {
      // registration failed :(
      console.log('ServiceWorker registration failed: ', err);
    });

    navigator.serviceWorker.register('/js/scripts.js').then((registration) => {
      // Registration was successful
      console.log('ServiceWorker registration successful with scope: ', registration.scope);
    }, (err) => {
      // registration failed :(
      console.log('ServiceWorker registration failed: ', err);
    });
});

The error I'm seeing

vendor.js:2 Uncaught TypeError: Cannot read property 'createElement' of undefined
sw.js:12 ServiceWorker registration failed:  TypeError: Failed to register a ServiceWorker: ServiceWorker script evaluation failed
sw.js:17 ServiceWorker registration successful with scope:  http://localhost:3000/js/

Essentially the code works when it's not attempting to be a service worker - but the moment it is - I'm getting errors like Uncaught TypeError: Cannot read property 'createElement' of undefined.

I thought that it might be due to one file working off of another (MediumZoom) as it is built in one file, and init in the other - but even when I put both files into one, I still ran into the exact same issue.

Is there something I'm missing?

Thanks




How to open a web browser for a Run/Debug Configuration in PhpStorm?

My specs:

  • OS: Arch Linux
  • WM: KDE Plasma
  • PHP: 7.2.1 (with XDebug)
  • PhpStorm: 2017.3.3

I have these settings in PhpStorm: img01

img02

img03

When starting PhpStorm, the port 7999 is always listening. I have to start manually the web server specified in "Run/Debug Configuration" then port 8000 is listening too.

My problem is when trying to run any script from editor by using browser popup, i.e., this file:

~/Projects/PHP/LearningPHP/ch01/ex0102-form.html

By using browser popup, web browser opens this URL:

http://localhost:7999/LearningPHP/ex0102-form.html?_ijt=cfvfi8l80ks1r42h10and6krpr

and I can get one error if this file is calling another file located in subdirectory "ch01".

I'd wish this browser popup opens the resource according to "Run/Debug Configuration", meanwhile I have to input manually in web browser this URL:

http://localhost:8000/ch01/ex0102-form.html

So I have three questions:

  1. How can PhpStorm be configured according to my wish?
  2. When and What is port 7999 used for?
  3. What's the difference between services using ports 7999 and 8000?

Thanks in advance.




Web scraping on android reCAPTCHA

I want to make an Android app which can scrap a website, and provide the useful information to client problem is that website I want to scrap have reCAPTCHA with login. Thinking if I can load the page into the app and let user solve the reCAPTCHA... then rest let app do his work




How move asp.net Core web application project in other folder

Visual Studio 2017 community: I create a "ASP.NET Core Web Application" project. If not change the default location (default is "C:\Users[User]\source\repos\"), everything is ok (build, debug, intellisense). But if I specify another disk (or folder) or, if i move the project, I get a build error: "Error Assets file '[path]\obj\project.assets.json' not found.Run a NuGet package restore to generate this file.web C:\Program Files\dotnet\sdk\2.1.4\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets"

If after this error, in the sln folder executes "dotnet restore", the project is build and run, but it is difficult to debug (do not work breakpoints and code tracking and , intellisense). Folders "Dependencies", "Dependencies\NuGet" and "Dependencies\SDK" in solution is yellow (warnings) subfolders is empty.

How do I create or move to any folder "ASP.NET Core Web Application" project?




Partial view, MVC app

I got a application, using alot of the auto generated code by the visual studio MVC web app.

I got 3 controllers, which individually each do their job well.

Normally the auto code does 1 page for each specific view, but i decided to use some of them as partial view:

My specific problem is this:

Controller 1: Responsible for handling the creation of Recipes. Each recipe can have many ingredients, controller for ingridients is controller 2.

    public ActionResult Create()
    {
        return View();
    }

    // POST: Recipes/Create
    // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
    // more details see https://go.microsoft.com/fwlink/?LinkId=317598.
    [HttpPost]
    [ValidateAntiForgeryToken]
    public async Task<ActionResult> Create([Bind(Include = "RecipeId,Name,Instructions")] Recipe recipe)
    {
        if (ModelState.IsValid)
        {
            db.Recipes.Add(recipe);
            await db.SaveChangesAsync();
            return RedirectToAction("Index");
        }

        return View(recipe);
    }

Create View, Where the mistake is made

    @{
        var db = new DataContext();
        var recipelist = db.Recipes.AsEnumerable();
        Html.RenderPartial("Index", recipelist);

        ViewBag.RecipeId = new SelectList(db.Recipes, "RecipeId", "Name");
        Html.RenderPartial(Url.Content("~/Views/IngredientRecipes/Create.cshtml"));
    }

The first 3 code lines, perfectly render the Index view (listview) of the recipes, so that one is working fine.

however, the next 2 line, render the view, of the creation of ingridients for a recipe, but when i press create it fails. It should be noted that if i open the ingridient creation view directly, the ingridient belonging to a recipy is created as intended.

Controller 2 Responsible for handling the creation of ingridients:

public ActionResult Create()
    {
        ViewBag.RecipeId = new SelectList(db.Recipes, "RecipeId", "Name");
        return View();
    }

    // POST: IngredientRecipes/Create
    // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
    // more details see https://go.microsoft.com/fwlink/?LinkId=317598.
    [HttpPost]
    [ValidateAntiForgeryToken]
    public async Task<ActionResult> Create([Bind(Include = "IngredientId,RecipeId,IngredientName")] IngredientRecipe ingredientRecipe)
    {
        if (ModelState.IsValid)
        {
            db.IngredientRecipes.Add(ingredientRecipe);
            await db.SaveChangesAsync();
            return RedirectToAction("Index");
        }

        ViewBag.RecipeId = new SelectList(db.Recipes, "RecipeId", "Name", ingredientRecipe.RecipeId);
        return View(ingredientRecipe);
    }

Creation of ingredients full (full)

@model IwantFood.Models.IngredientRecipe

<!DOCTYPE html>

<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Create</title>
</head>
<body>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/jqueryval")


@using (Html.BeginForm()) 
{
    @Html.AntiForgeryToken()

    <div class="form-horizontal">
        <h4>IngredientRecipe</h4>
        <hr />
        @Html.ValidationSummary(true, "", new { @class = "text-danger" })
        <div class="form-group">
            @Html.LabelFor(model => model.RecipeId, "RecipeId", htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.DropDownList("RecipeId", null, htmlAttributes: new { @class = "form-control" })
                @Html.ValidationMessageFor(model => model.RecipeId, "", new { @class = "text-danger" })
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.IngredientName, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.IngredientName, new { htmlAttributes = new { @class = "form-control" } })
                @Html.ValidationMessageFor(model => model.IngredientName, "", new { @class = "text-danger" })
            </div>
        </div>

        <div class="form-group">
            <div class="col-md-offset-2 col-md-10">
                <input type="submit" value="Create" class="btn btn-default" />
            </div>
        </div>
    </div>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

The problems seems to be a parent child relation and partial view, problem but i dont know how to fix it :/ Thank you very much in advance!




What are the must have for a Frontend/Backend web javascript oriented developper in 2018 and is Fullstack js dev great?

i'm currently looking for work and try to specialies myself as a Javascript developper and I was wondering what are the technologies to focus on and what is no longer interesting also I'm wondering if specialies as Full stack JS is really a gold way like some says.

Frontend looks like to have two opponents called Angular and React. Angular is on the top on the scene and it's has both old angularjs version and angular 5 with typescript, not every companies are moving on the new versions. React looks like it's getting more famous everyday and I don't know which is the most promising for the future. While I can see people crying about the use of JQuery it looks like it's still used in combination with frontend frameworks.

While using these on frontend I don't know if backend frameworks like Expressjs is really needed, they already perform routing and server and db request can be used through Http requests right?

No SQL Database like Mongo DB looks interresting but not really used a lot in most of the companies where I still see the demand on PHP+SQL combo to manage server side requests. Wordpress is still used a lot and there's some argument about using all these language on server side which were used to front end or for software dev (C, python, javascript, Java,...)

So I can't really figure if getting to fullstack JS is a real plus for now or the future and if so what are the combo of tech to focus on.

Have you guys thoughts on this?




Impossibile caricare il file o l'assembly 'log4net, Version=1.2.13.0

when I run my web application with .NET Framework 4.0.30319 I have this error:

Impossibile caricare il file o l'assembly 'log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a' o una delle relative dipendenze. Accesso negato. Descrizione: Eccezione non gestita durante l'esecuzione della richiesta Web corrente. Per ulteriori informazioni sull'errore e sul suo punto di origine nel codice, vedere la traccia dello stack.

Dettagli eccezione: System.IO.FileLoadException: Impossibile caricare il file o l'assembly 'log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a' o una delle relative dipendenze. Accesso negato.

how can I solve the problem at runtime? The code compiles

Thanks a lot.

Salvatore




Improving my broken search bar

That's my first post and i got stuck a bit. I am a student , i do web-design for myself in my free time . It begun as a try , but now is a hobby. So , there's my question: How to make a to a Text or an Id from the current web through an and some js?

I tried something but i still don't understand at all how this works. I am usually getting how things works when i am using them. So , could you help me ?

Codes:

<p style="text-align: center; position: relative;top: 200px"><input type="text" name="search" id="search" style="font-size: 30px" value=""><input type="submit" name="search" value="Cauta" style="font-size: 30px" onclick="leadtores()"></p>

the javascript : function leadtores() { var x; x=document.getElementById('search').value ; window.open(#x,"_self")

It may look weird and very unprofesional , but i am just at begining. Thank you !




Prevent my website from being wrapped up and served on someone else's mobile app

I discovered recently that my website is being wrapped up and served in an Android app. What preventative measures can I take to prevent this from happening? Is there a solution to prevent this happening on both Android and iOS? I use nginx, Node and Express.




POST requests without Content-Type header pass throught @Consumes check(In Jersey application)

We created Jersey service for client with two classes, we used First class with Content type Multiple Part Form Data -- @POST @Consumes(MediaType.MULTIPART_FORM_DATA) and in Second class we used only @POST as per our requirement. Service is working fine but client is hitting to Application without any content type so request is mapping with first class which lead to error.

As per my query it should match with 2nd class @POST if we do not use any content Type.

In 1st Class

@POST @Consumes(MediaType.MULTIPART_FORM_DATA) public Response submitForm(

In 2nd class

@POST public Response submitForm(

QUESTION : POST requests without Content-Type header pass throught @Consumes check.




How to compare two web sites in different ways?

I'm looking for solution for comparing two web sites and check difference. And for now I have only two ideas. It's need for checking web sites after migration from old server to new server(mostly wordpress cms)

1) Getting content from main page with curl and check difference. Or getting status code with curl and check it.

2) I think it's not good idea. I can make a screenshot of main page(with python script) and after migration make a new one and compare them with python script again.

Any ideas? How to compare same web page before and after migration and make sure that everything is working?

Thanks!




How to make reload page function after submit data in php

I want to make reload page after submitting data, but I got some problem with that, i've tried several ways but it doesn't work. here's my code :

public function prosesTambah() {

    $this->form_validation->set_rules('tgl_date', 'Date', 'trim|required');

    $data   = $this->input->post();


    if ($this->form_validation->run() == TRUE) {

        $result = $this->M_posisi->insert($data);

        if ($result > 0) {
            $out['status'] = '';
            $out['msg'] = show_succ_msg('Add Success!', '20px');

        } else {
            $out['status'] = '';
            $out['msg'] = show_err_msg('Add Failed!', '20px');
        }
    } else {
        $out['status'] = 'form';
        $out['msg'] = show_err_msg(validation_errors());
    }

    echo json_encode($out);
}




I'm getting the following error in angular 5 please check the below mentioned code

I'm getting below error anyone please help me here is my error code

    _zone_symbol__currentTask: Object { runCount: 0, _state: "notScheduled", type: "microTask", … }
columnNumber: 19
fileName: "http://localhost:4200/vendor.bundle.js line 2559 > eval"
lineNumber: 1190
message: "StaticInjectorError[MasterService]: \n  StaticInjectorError[MasterService]: \n    NullInjectorError: No provider for MasterService!"
ngDebugContext: Object { view: {…}, nodeIndex: 1, nodeDef: {…}, … }
ngErrorLogger: bound ()
name: "bound "
__proto__: function ()
ngTempTokenPath: null
ngTokenPath: Array [ MasterService() ]

here is my mudule.ts

  providers: [HighlightJsService,AuthGuard, DatePipe],
  bootstrap: [AppComponent]
})
export class AppModule { }




getting the image name and count them in Angular

Lets say I have more than 100 schools. And there is a folder in my local PC that has many images of those schools. Image names are according to Schools id's. Imagine that the school has id=223, then inside the image folder there should be one or many images like 223.jpg, 223_1.jpg, 223_2.jpg, 223_4.jpg. It could be one or more i do not know. I take each image from its source directory. My problem is how i know the number of images a school has with respect to its id. So that i put them in an array and show them in for loop.

Like:

image url :

'http://localhost/photoFolder/'

data.attributes.photos = environment.imageUrl + data.attributes.school_id + '.jpg';

<ngb-carousel>
    <ng-template ngbSlide *ngFor="let photo of navbar.infoData.attributes.photos">
        <img class="card-img-top img-fluid w-full" [src]="photo" alt="Okul Fotoğrafı Bulunamadı">
    </ng-template>
</ngb-carousel>




Angularjs factory service inside a config block

Whats is the difference between angular.module('modulename',[..]).factory(...) and $provide.factory(...) inside angular.module('modulename',[..]).config(..) block?




Hosting emails with ISP and website with Justhost

I'm a total noob at this, I have a client that has a domain registered with a local ISP and they also have their mail also hosted with the ISP. they recently had me develop their website and I would like to host it with Justhost without moving or interrupting their mail delivery service (i.e. i just want to host their website with just host and they can continue hosting their mail with the ISP and do so without interrupting their service). I have no idea how to go about this, any help will be appreciated.




What's the effective way for compress URL of 1200-1500 characters?

I have many problematics in this question. I have to compress URI which doesn't have a static architecture then it's hard to do a things like that :

repos=aaa,bbb,ccc&
labels=ddd,eee,fff&
milestones=ggg,hhh,iii&
username=kkk&
show_open=0&
show_closed=1&
show_commented=1&
show_uncommented=0

extract:

aaa,bbb,ccc|ddd,eee,fff|ggg,hhh,iii|kkk|0110

The request are made a little bit in a GraphQL way so we send structure and have answers for this structure. For the moment the compression we use is juste changing some wording which are in all requests (function: is f:, ..). We want to do a generic compression, not something we have to maintain if the architecture change(in the following example we don't want to change quizz.campaign to #12 per example). We do this kind of request one to two times per connection so what is the most expensive between download a library at the connection which will compress my request from 1500 to maybe 300 characters OR do some generic compression like change the [ to ( which will compress from 1500 to 900.

The generic compression could look like something like that:

str.replace(/\*/g, "%#111")
        .replace(/\!/g, "%#222")
        .replace(/\(/g, "%#333")
        .replace(/\)/g, "%#444")
        .replace(/\~/g, "%#555")
        .replace(/\_/g, "%#666")
        .replace(/\'/g, "%#777")
        .replace(/\,/g, "*")
        .replace(/\:/g, "!")
        .replace(/\[/g, "(")
        .replace(/\]/g, ")")
        .replace(/\{/g, "~")
        .replace(/\}/g, "_")
        .replace(/\"/g, "'")
        .replace(/\%#111/g, ",")
        .replace(/\%#222/g, ":")
        .replace(/\%#333/g, "[")
        .replace(/\%#444/g, "]")
        .replace(/\%#555/g, "{")
        .replace(/\%#666/g, "}")
        .replace(/\%#777/g, '"');

The json of a request looks like that:

    [{
    "f": "find-qzc-by-id",
    "k": "qzcpn",
    "a": {
        "quizz.campaign/id": "quizz-kdfjdslk"
    },
    "n": [{
        "f": "quizz.campaign/activeQuizzQuestions",
        "k": "quizz.campaign/activeQuizzQuestions",
        "n": ["fanQuestion/id", "fanQuestion/questionText", "fanQuestion/questionType", {
            "f": "fanQuestion/choices",
            "k": "fanQuestion/choices",
            "n": ["quizz.question.choice/bgImg", "fanQuestion.choice/id", "fanQuestion.choice/adminLabel", "fanQuestion.choice/text"]
        }, "bs.model/scid", "bs.model/uiConfig"]
    }, "quizz.campaign/id", "quizz.campaign/gameLogic", "quizz.campaign/quizzConfig", "quizz.campaign/bgImg", "quizz.campaign/previewImage", "quizz.campaign/title", "quizz.campaign/description", "campaign/publicOrganizerName", {
        "f": "campaign/organization",
        "k": "campaign/organization",
        "n": ["org/id"]
    }, "campaign/bsCpnType", "bs.model/scid", "bs.model/uiConfig", "bs.model/bsCustomContent", "bs.time/created", "bs.model/nl"]
}]

Then the encoded request looks like that :

?q=%5B%7B%22f%22%3A%22find-qzc-by-id%22%2C%22k%22%3A%22qzcpn%22%2C%22a%22%3A%7B%22quizz.campaign%2Fid%22%3A%22quizz-kdfjdslk%22%7D%2C%22n%22%3A%5B%7B%22f%22%3A%22quizz.campaign%2FactiveQuizzQuestions%22%2C%22k%22%3A%22quizz.campaign%2FactiveQuizzQuestions%22%2C%22n%22%3A%5B%22fanQuestion%2Fid%22%2C%22fanQuestion%2FquestionText%22%2C%22fanQuestion%2FquestionType%22%2C%7B%22f%22%3A%22fanQuestion%2Fchoices%22%2C%22k%22%3A%22fanQuestion%2Fchoices%22%2C%22n%22%3A%5B%22quizz.question.choice%2FbgImg%22%2C%22fanQuestion.choice%2Fid%22%2C%22fanQuestion.choice%2FadminLabel%22%2C%22fanQuestion.choice%2Ftext%22%5D%7D%2C%22bs.model%2Fscid%22%2C%22bs.model%2FuiConfig%22%5D%7D%2C%22quizz.campaign%2Fid%22%2C%22quizz.campaign%2FgameLogic%22%2C%22quizz.campaign%2FquizzConfig%22%2C%22quizz.campaign%2FbgImg%22%2C%22quizz.campaign%2FpreviewImage%22%2C%22quizz.campaign%2Ftitle%22%2C%22quizz.campaign%2Fdescription%22%2C%22campaign%2FpublicOrganizerName%22%2C%7B%22f%22%3A%22campaign%2Forganization%22%2C%22k%22%3A%22campaign%2Forganization%22%2C%22n%22%3A%5B%22org%2Fid%22%5D%7D%2C%22campaign%2FbsCpnType%22%2C%22bs.model%2Fscid%22%2C%22bs.model%2FuiConfig%22%2C%22bs.model%2FbsCustomContent%22%2C%22bs.time%2Fcreated%22%2C%22bs.model%2Fnl%22%5D%7D%5D

If you think that a library would be the better way for the cost question, do you have some recommandations for compress in js and decompress on the jvm ? Thanks.




PHP delete row in mysql dont know sipmple code

I have this mysql table, I also have a delete button ready, but I dont know what i should write in the <a href=" "> My code for the table is here

while($row = mysqli_fetch_array($result))
{
echo "<tr align='center'>";
echo "<td>" . $row['nazev'] . "</td>";
echo "<td>" . $row['ico'] . "</td>";
echo "<td>" . $row['statistika'] . "</td>";
echo "<td>" . $row['konzultant'] . "</td>";
echo "<td><a href='php delete row??'><img src='delete.jpg' alt='delete' /></a></td>";




How to recover menu mismatching error in webview

I'm trying to develop app using reference HTTP link in webview...it was run successful in emulator but site main menu alignment was mismatched then how to fix this error....enter image description here enter image description here




How To Use Vuejs With Nodejs Express and Mongodb for a login and signup app

How will i use passport and jwt token to achieve this all the while but its not working

router.post('/login' , 
  passport.authenticate('local' , {
  failureRedirect: "/sss",
  // failureFlash:true
  }),function(req,res){
  res.send({
  status: true,
  messasge: "Login Succesful" + user,

 });


});




which is better for large projects, Codeigniter or Laravel? [on hold]

I am going to develop a large project in php for accounting field which will take around 3 to 5 years. So i just want to know which framework should i use ? codeigniter or laravel ?




Multiple Inputs To Azure Function

TLDR:

Is it possible to have multiple inputs to an Azure Function?

Longer Explanation:

I'm new to Azure Functions and still don't have a good understanding of it.

I have an application which downloads HTML data through a proxy web request and I was considering moving it to Azure Functions.

However, the function would require two inputs: a string URL and a proxy object (which contains IP address, username and password properties).

I was thinking of having two queues, one for URLs and one for proxies.

URLs would be added to the queue by a client application, which would trigger the function.

The proxy queue would have a limited pool of proxy objects which would be added back into the queue by the consuming function after they had been used for the web request.

So, if there are no proxies in the proxy queue, the function will not be able to create a web request until one is added back into the queue.

This is all assuming that Azure Functions are parallel and every trigger from the URL queue runs a function on another thread.

So, is what I'm considering possible? If not, is there an alternative way that I could go about it?




Javascript working locally but not on Github Pages site

I have recently been coding some animations for my website, and its working all fine locally, but the second I push it and try and access the page(hosted with GithubPages) it throws errors at me. Uncaught TypeError: Cannot read property 'addEventListener' of null(…)
I went and I did some research and came across this page: https://teamtreehouse.com/community/error-uncaught-typeerror-cannot-read-property-addeventlistener-of-null
and this one:
Cannot read property 'addEventListener' of null
And I tried applying the solutions, and it still didn't work. Some solutions said that it may be because the element doesn't exist. Well, since the element is the body element, it 100% exists and has definitely been defined.
I really hope i just haven't made some silly mistake!! That would be embarrassing.
The JS is attatched below, the error occurs at document.body.addEventListener("mousemove", function(ev) {

var possibleImages = [
  "assets/images/Moana.jpg",
  "assets/images/GuitarPlaying.png",
  "assets/images/Cheese.jpg",
  "assets/images/CryptoPhoto.jpg",
  "assets/images/LogoSmall.png",
  "assets/images/Group5.jpg"
  ];

document.body.addEventListener("mousemove", function(ev) {
    if (Math.random() < 0.85) {
        return;
    }

    const index = Math.round(Math.random() * possibleImages.length);
    const image = possibleImages[index];

    const el = document.createElement("img");
    document.body.appendChild(el);

    el.classList.add('emoji');
    el.src = image
    el.offsetLeft;  // forces layout

    el.style.left = (event.clientX-410) + 'px';
    el.style.top = (event.clientY-50) + 'px';
    el.style.transform = 'translate(' + (Math.random() * -1000 + 500) + 'px, 1200px) scale(0)';


    el.addEventListener('transitionend', () => {
        el.remove()
})

}, true);




lundi 29 janvier 2018

Webpage Icon on Desktop and Notification Badge

We have a web portal and our client have a requirement of keeping the webpage icon on the desktop that part was as easy as keeping and shortcut with icon which points to Webpage, however they also want to have dynamic notification badge on the icon something similar to below one -

Icon With Notification Badge

This notification badge will keep changing based on number of action items, I couldn't figure out how to solve this without having an full fledge desktop application any pointer or help would be greatly appreciated.




HTML form with select

This is probably pretty simple to do but I cant figure it out. I have a form that has a select element and a button and I want to make it go to specific page when I choose certain item from drop down list. Thank you.




When to use desktop apps vs web apps?

I'm very new to web development (learning for about 2 months) but I keep wondering when an application is better suited for the web or desktop. For instance, would a hospital tend to use a desktop or web app to keep track of all it's patients records. Also would large businesses such as insurance companies use web or desktop apps for storing and accessing all of their customers information? Thank you.




How can I restrict access to a php file so that it can only be reached via iframe in my server?

I have a content.php file on my server that I need to load in an iframe on another page mask.php. This works just fine but I do not want content.php to be reachable at mydomain.com/content.php, only at mydomain.com/mask.php via iframe.

Is there a way to restrict the access to content.php to only via iframe on same server? PHP or HTTP?

I read about restricting the referer of content.php, so that it has to be mask.php for it to load but it doesn't seam to work. I can imagine that it should be doable with PHP.

Thanks for any ideas!




House rental service endpoints

I am developing a site for a house rental service The owner will have access to an admin panel at /owner, and list of their houses at /owner/houses and a view of a specific house on /owner/houses/:id.

Since the owner has access to a calendar for each house showing when it is rented, should the calendar be on /owner/houses/:id/calendar or have its own endpoint /owner/calendar/:id or is there a third better option?




How to make login React.js & Spring application

I really need some help! I need to do web app with react.js in front-end and spring as back-end. Now I am trying to make login using Jwt. But it is just not working.When I am trying to access post method in browser it just saying that request GET is not supported. No react.js is showing, no errors in console. Also it is pretty hard for me to find some examples with react and spring on internet. Maybe someone have ideas or examples how I can do it.? Not necessarily just I need quit simple but working login/logout. Thanks.

Also this is my project as I have it now: https://github.com/DonneGri/HealthProject




Why are some domains allowed to use a self signed certificate?

I noticed that the SSL certificate for https://www.google.com appears to be a self signed certificate, verified by Google Inc.

enter image description here

Any other website I encounter with a self signed certificate gets yelled at by my browser and I have to add exceptions to view them.

Why does Google get the pass here?




For Loop is not looping the numbers i want

i am trying to use forloop as a method to send in multiple data, however, the number that i want to loop is not the one i want to sent in. For example, when i allocated 1 - 5, it only stores in the data 1 - 2. And everytime no matter how many different amount i allocate, it only stores in 2 data, instead of the amount i required. I believe is the method of me looping got error. Please help. @allocate.php

<td width="1%">
<?php
$mysqli = new mysqli(spf, dbuser, dbpw, db);
$sql="Select cardno from tvoucher where lol='' order by cardno asc";
$result = $mysqli->query($sql);
    if ($result->num_rows > 0) {
     echo "<select name='cardfrom'>";
      while($row = $result->fetch_assoc()) {
     echo "<option value='" . $row['cardno'] . "'>" . $row['cardno'] . "</option>";
  }
  echo "</select>";
}  
$mysqli->close();
?>
</td>
<td width="1%">
<?php
$mysqli = new mysqli(spf, dbuser, dbpw, db);
$sql="Select cardno from tvoucher where lol=''order by cardno asc";
$result = $mysqli->query($sql);
    if ($result->num_rows > 0) {
     echo "<select name='cardto'>";
      while($row = $result->fetch_assoc()) {
     echo "<option value='" . $row['cardno'] . "'>" . $row['cardno'] . "</option>";
  }
  echo "</select>";
}  
$mysqli->close();
?>

@processallocate.php

for ($cardfrom=$cardfrom;$cardfrom<=$cardto;$cardfrom++) 
{

if ($cardfrom && $staff_name && $session && $allocation_id && $staff_id && $admin_id && $lol && $request_id && $requestnoleft && $requestnoleft>-1)
{

$mysqli = new mysqli(spf, dbuser, dbpw, db); 
$stmt = $mysqli->prepare("INSERT INTO allocation 
(cardfrom, staff_name, session, allocation_id, staff_id, admin_id) 
VALUES (?,?,?,?,?,?)");
$stmt->bind_param("ssssss", $cardfrom, $staff_name, $session, $allocation_id, $staff_id, $admin_id);
$result = $stmt->execute();

if ($cardfrom && $lol){
$mysqli = new mysqli(spf, dbuser, dbpw, db); 
$stmt = $mysqli->prepare("update tvoucher set lol = '$lol' where cardno='$cardfrom'");
$stmt->bind_param("s", $lol);
$result=$stmt->execute();

if ($requestnoleft && $request_id){
$mysqli = new mysqli(spf, dbuser, dbpw, db); 
$stmt = $mysqli->prepare("update request set requestno = '$requestnoleft' where request_id='$request_id'");
$stmt->bind_param("s", $requestno);
$result=$stmt->execute();


if ($result == true && $stmt->affected_rows>0) 
        {
            echo "<b>". $check . "</b><br>";
            echo "<script>window.location = 'http://mp14.mybitmp.org/spf/allocation.php'</script>";
        }

else    {
            echo '<p>Taxi Voucher has already been allocated</p>';    
            echo '<p>Please <a href="allocation.php">Click Here</a> to return</p>';
            break;
        }
$stmt->close();
$mysqli->close();
}
}
}
else 
{
echo '<p>Error</p>';    
echo '<p>Please <a href="allocation.php">Click Here</a> to resubmit</p>';
}
}
?>

</div>




Spectre & Meltdown Patches vs WWW

Some 20 days ago Greg Rozmarynowycz here at SO asked

What are the performance impacts on web services resulting from Meltdown patches?

He probably knew, as I know, that this kind of question is not ideal for SO for many reasons. Since he did asked, I am going to ask as well.

He made me search for how M&S patches effect JS engines, common bundlers such as Webpack and tech such as WebGL. You see, I am more interested in client side than in cloud. Since there are JS exploits related to M&S and some web apps are saucing CPU/GPU extensively, the question seems to be appropriate. But I have not found any conclusive and comprehensive set of benchmarks or studies targeting this field. I have tried to measure time vs CPU power during build of Angular5 by Angular CLI 1.6 before and after updating my machines and also the performance of final app in production in evergreen browsers. There seems to be a difference. But I would not put my hand in fire for what I did. I am no expert to say and I have no appropriate tools to run any conclusive tests (I do not even know how to do it scholarly).

Did anybody tried to investigate these issues? Does it make a sense to investigate them? What is the appropriate way of benchmarking JS processes in browser? Is jsperf.com a reliable source of JS-related test cases? Are there any solid data on this or is just everybody keep saying how bad these patches are and how largely they slow down everything?




javascript bookmarklet does not work on github

I have the following code on a web page. I have bookmarked it to make a bookmarklet. It works fine. I can click my bookmarklet to book mark a page (it connects to my bookmark app, on my local website).

However it does not work on github. When I click the bookmarklet, nothing happens. It should re-direct to a page on my site, with a pre-filled form.

Why does it not work on this site (github)? How can I fix it?

<a href="javascript:
(function () {
    function selectedText(){
        var t;
        try {
            t= ((window.getSelection && window.getSelection()) ||
                (document.getSelection && document.getSelection()) ||
                (document.selection &&
                 document.selection.createRange &&
                 document.selection.createRange().text));
        }
        catch(e){
            t = '';
        }
        return t;
    }

    function link() {
        return 'http://bookmarkdb/add'+
            '?url='   +encodeURIComponent(location.href)+
            '&title=' +encodeURIComponent(document.title)+
            '&description=' +encodeURIComponent(selectedText());
    }

    window.open(link());
})();
">addbookmark</a>


For full code see https://bitbucket.org/davids_dad/bookmarker




Image Uploading and Signup Code

Here is My code for Image upload and Inserting data into Database but it is not working Properly. and also not showing any error. Tell me My Mistake where i'm wrong in this i'm bit new on PHP.Echo and Error (die) does not showing any message or error ?? what should i do ??

<?php
if(isset($_Post['submitbtn']))
{
    $target_dir = "Resources/images/users/";
    $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
    $uploadOk = 1;
    $imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
    // Check if image file is a actual image or fake image
    $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
    if($check !== false) {
        echo "File is an image - " . $check["mime"] . ".";
        $uploadOk = 1;
    } else {
        echo "File is not an image.";
        $uploadOk = 0;
    }
    if (file_exists($target_file))
    {
        echo "Sorry, file already exists.";
        $uploadOk = 0;
    }   
    if (file_exists($target_file)) 
    {
        echo "Sorry, file already exists.";
        $uploadOk = 0;
    }
    if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
    && $imageFileType != "gif" ) 
    {
        echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
        $uploadOk = 0;
    }
    if ($uploadOk == 0) 
    {
        echo "Sorry, your file was not uploaded.";
    // if everything is ok, try to upload file
    } 
    else 
    {
        if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) 
        {
            echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
        } 
        else 
        {
            echo "Sorry, there was an error uploading your file.";
        }
    }

    $qur = "insert into users values ('"+$_Post['Id']+"','"+$_Post['firstname']+"','"+$_Post['lastname']+"','"+$_Post['email']+"','"+$_Post['Password']+"','"+'shopkeeper'+"','"+$target_file+"')";

    if(mysqli_query($con,$qur))
    {
        echo "Data Saved";
    }
    else
    {
         die("Connection failed: " . mysqli_error());
    }
}

?>




My web API has date and datetime values with a specified format

My web API has date and datetime values with a specified format like this "1975-12-10 12:11:20". The datetime values are formatted as local time without timezone information. I'm not really sure how to put this into the swagger. This is what I have so far, but I'm not sure it's right. In any case, the swagger editor doesn't show my expected format for the values:




Markerless AR for web browser?

Is there a markerless AR library that can run on any mobile web browser? Something that does not require a standalone app like Google Article, and can be run on both Android and iOS.




WAMP Apache httpd.conf file lacking content

My httpd.conf file is missing these lines:

Order Deny,Allow

Deny from all

So I cant make my website public. Is there another way of doing so or is that option called something else and I'm just looking at an outdated guide?




External protocol requests not working in IE 11 on Windows 7

I have an external protocol request set up that works in Chrome, Firefox, Edge, and IE 11 on windows 8, but not on windows 7. What gives?




upload via delphi, simulate browse file in firefox

I'm using the custom components in my web framework as below

enter image description here

the purpose of the multiple is to crop, rotate and automatically upload to the server.

so can I make a tool to simulate the click and automatically upload everything in the path c:\scan on button click in delphi form?

Please note that I don't have a problem with the uploading from delphi a single file directly to PHP file, but in my situation I need the action client to client and continue the process by the user when press Save in the Web Page.

Regards




Assign values to input texts from Jquery Ajax [duplicate]

This question already has an answer here:

Hi everybody good morning:

I have trouble when retrieving values from an Ajax request and I don't know why... I'm getting crazy with this since 2 days ago:

HTML

<input name="txtCOD_ANALISTA" type="text" id="txtCOD_ANALISTA" 
maxlength="4" size="6" />
<input name="txtNOMB_ANALISTA" type="text" id="txtNOMB_ANALISTA" 
maxlength="150" size="42" />
<input name="txtFECHA" type="text" id="txtFECHA"
maxlength="10" size="10"/>

so, I made it save data... yeeeehhhh!, but when I try to retrieve data I use this:

$.ajax({
url: "../Pagweb/modeltablacomunidades.asp?tipo=40&ccdd="+$('#cboDpto_id option:selected').val()+"&ccpp="+$('#cboProvincia_id option:selected').val()+"&ccdi="+$('#cboDistrito_id option:selected').val()+"&area="+$('#cboArea_id option:selected').val(),

      type: "POST",
      cache: false,
      async: true,
      dataType: "json",
      success: function (response) {
          var resdatarow = JSON.stringify(response)
          var datacollet = JSON.parse(resdatarow);

          console.log(resdatarow);
          console.log(datacollet);
          console.log(datacollet.FECHA);
          console.log(datacollet[2]);

          $('#txtCOD_ANALISTA').val(datacollet.COD_ANALISTA);          
          $('#txtNOMB_ANALISTA').val(datacollet.NOMB_ANALISTA);
          $('#txtFECHA').val(datacollet.FECHA);
      }
    });

Then, when I check in Chrome Console, I can see the JSON object returned:

{"data":[{"COD_ANALISTA":"157 ","NOMB_ANALISTA":"SOTO CCANCCE JUAN CARLOS","FECHA":"26/01/2018"}]}
{data: Array(1)}
data: Array(1)
0: {COD_ANALISTA: "157 ", NOMB_ANALISTA: "SOTO CCANCCE JUAN CARLOS", FECHA: "26/01/2018"}
length: 1__
proto__: Array(0)__
proto__: Object
undefined
undefined

But I can't see anything in my 3 inputs :( Why is that? Why? What am I doing wrong? and when I put: console.log(datacollet.FECHA); or any field, it shows me "UNDEFINED"




Laravel 5.5 update image

I'v created a form to update the table 'organizer'. My problem is that the image wont update. I've already added enctype="multipart/form-data" to my form.

If I set the validation of the image to required, laravel throwes the error "The logo must be an image". It seems that my ImageController doesn't get the image file . But why does the Controller get all the other data like the description, name ..?

All the other data in the table 'organizer' is updating without problems!

Form

    <form class="form" enctype="multipart/form-data" action="/organizer/update/">
        <input type="hidden" name="_method" value="PUT">
        <input type="hidden" name="_token" value="">
        ...
        other input fields...
        ...
        <label>Logo</label>
        <input type="file" name="logo" id="logo" accept="image/*"/>

        <button class="btn-add" type="submit">@lang('Save')</button>
        </form>

Controller (only the code for updating the image)

        if($request->hasFile('logo')){
        // ADD NEW lOGO
        $logo = $request->file('logo');
        $logo_name = $request->name.'_logo'.time().'.'.$logo->getClientOriginalExtension();
        $request->logo->move($destinationPath, $logo_name);
        $oldFilename = $organizer->logo;
        // UPDATE DATABASE
        $organizer->logo = $logo_name;
        // DELETE OLD lOGO
        Storage::disk('public')->delete("organizer/$oldFilename.jpg");
    }




Website Links on Mobile Devices - Opening Native Applications or Redirecting to App Store if Uninstalled

How can you let social media links (this could actually be generalized to any link to a mobile application) on your website direct mobile devices either to the corresponding native application (say, Facebook, for example) OR (if the application is not installed) to the app store page on which the app is offered? I'm mainly concerned with doing this with Apple's iOS 11.




Exception in thread "main" java.lang.NoClassDefFoundError: com.ibm.ejs.ras.hpel.HpelHelper

Pom.xml :

added these dependency 

<dependency>
            <groupId>com.ibm.jaxws</groupId>
            <artifactId>thinclient</artifactId>
            <version>8.5.0</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.ibm.ws.admin</groupId>
            <artifactId>client</artifactId>
            <version>8.5.0</version>
            <scope>provided</scope>
        </dependency>

    <dependency>
            <groupId>com.ibm.ws.webservices</groupId>
            <artifactId>thinclient</artifactId>
            <version>8.5.0</version>
            <scope>provided</scope>
        </dependency>



  SLF4J: Class path contains multiple SLF4J bindings.
    SLF4J: Found binding in [jar:file:/C:/Program%20Files%20(x86)/IBM/WebSphere/AppServer1/plugins/com.ibm.ws.prereq.jaxrs.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: Found binding in [jar:file:/C:/Users/IBM_ADMIN/.m2/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.0.2/log4j-slf4j-impl-2.0.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
    Exception in thread "main" java.lang.NoClassDefFoundError: com.ibm.ejs.ras.hpel.HpelHelper
        at com.ibm.ejs.ras.RasHelper.getThreadId(RasHelper.java:1764)
        at com.ibm.ejs.ras.RasEvent6$1.initialValue(RasEvent6.java:101)
        at java.lang.ThreadLocal.setInitialValue(ThreadLocal.java:174)
        at java.lang.ThreadLocal.get(ThreadLocal.java:164)
        at com.ibm.ejs.ras.RasEvent6.<init>(RasEvent6.java:292)
        at com.ibm.ejs.ras.MessageEvent6.<init>(MessageEvent6.java:203)
        at com.ibm.ejs.ras.Tr.fireMessageEvent(Tr.java:1562)
        at com.ibm.ejs.ras.Tr.error(Tr.java:730)
        at c

I am simply calling a web services by creating a client and calling a method through generated proxy. please let me know where I am missing and what other jars needs to be added.




WSDL nullreference in C#

I'm using service reference to SAP with WSDL. I'm getting an error with parameters. How debug this problem and find what is wrong?

View

Testing with SOAPUI everything is fine.




my domain messed up because of .htaccess

please help me, i played with .htaccess, before, my domain is http://www.goodank.com, now my domain is always redirected to http://www.goodank.com/http%1://www.www.goodank.com/

i've tried to reset the .htaccess file with changing it back to RewriteEngine on

please help me how to fix that thanks.




Webbrowser dropdown selected

I can not choose. I want to select the data in the dropdownlist at the desired value.

   <div role="combobox" id="rw_71_input" aria-owns="rw_71_listbox" class="rw-dropdown-list rw-widget">
        <div class="rw-widget-input rw-widget-picker rw-widget-container">
            <div class="rw-input rw-dropdown-list-input">Live</div>
            <span class="rw-select">
                <button role="presentational"   class="rw-btn rw-btn-select"><span aria-hidden="true" class="rw-i rw-i-caret-down"></span></button>
            </span></div>
        <div class="rw-popup-container rw-popup-transition-exited">
            <div class="rw-popup-transition">
                <div class="rw-popup"> 
                    <ul id="rw_71_listbox" class="rw-list" role="listbox">
                        <li role="option" aria-selected="true" >Super</li>
                        <li role="option" aria-selected="false" >Live</li>
                        <li role="option" aria-selected="false" >Education</li>
                        <li role="option" aria-selected="false" >Mannas</li>
                    </ul>
                </div>
            </div>
        </div>
    </div>

C#

 webBrowser1.Document.GetElementById("rw_71_listbox").Children[3].SetAttribute("selected", "selected");




XSS leaking into other parts of site

I've got a web application in which there are several XSS vulnerabilities on it, on the Profile Page for example there is a text box which is vulnerable to XSS along with the Messages Page. They both have text boxes yet when I add some XSS into the Profile Page, the pop up also comes up in the messages section and I cant figure out why. I've attached some screenshots for more information. If anyone can explain why this does this, id be very great full.

The below Links are for visuals of the application

https://i.stack.imgur.com/sqPl2.png
https://i.stack.imgur.com/nU7b5.png
https://i.stack.imgur.com/Mh48n.png
https://i.stack.imgur.com/47wHP.png

These are the source code images/files Profile Page Source Code:

https://drive.google.com/file/d/1fA_Zoa7z4fdhBBzW2-e3Wm-fWF1qwXw7/view?usp=sharing

Message Page Code:

https://drive.google.com/file/d/1YApsri_3YSmUwlRfyajcebgpe26L37TZ/view?usp=sharing




Extract HTML Table from Web Page source in Unity

I build a script in C# for Unity to read & download a specific webpage source in a text file in Unity, what I really want to achieve is to extract from this pages only html tables data, for example I want to remove all the lines from DOCTYPE html PUBLIC to table class="formular" to extract table & data:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<link rel="shortcut icon" href="https://mywebsite.com/favicon.ico" />
<title>My Website Com</title>
<meta name="description" content="Ministerul pentru intreprinderi mici si mijlocii, comert, turism si profesii liberale"/>
<meta name="keywords" content="My Web Site/>
<meta name="Language" content="en"/>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="rating" content="General" />
<meta name="revisit-after" content="7 Days" />
<meta name="robots" content="index,follow" />
<link rel="shortcut icon" href="/favicon.ico" />
<meta name="publisher" content="Unity Design" />
<meta name="copyright" content="Copyright (c) Unity Design" />
<meta name="author" content="Developed by Unity Design - www.UnityDesign.com" />
<link href="/css/style.css?t=2017061401" rel="stylesheet" type="text/css" />
<link href="/css/uploader.css?t=2017061401" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/js/jquery-1.8.0.min.js?t=2017061401"></script>
<script>
    var jQr = jQuery.noConflict();
</script>
<script type="text/javascript" src="/js/mootools-1.2.5-core-yc.js?t=2017061401"></script>
<script type="text/javascript" src="/js/mootools-1.2.5.1-more.js?t=2017061401"></script>
<script type="text/javascript" src="/js/uploader/Swiff.Uploader.js?t=2017061401"></script>
<script type="text/javascript" src="/js/uploader/Fx.ProgressBar.js?t=2017061401"></script>
<script type="text/javascript" src="/js/uploader/Lang.js?t=2017061401"></script>
<script type="text/javascript" src="/js/uploader/FancyUpload2.js?t=2017061401"></script>
<script type="text/javascript" src="/js/js.js?t=2017061401"></script>
<script src='https://www.google.com/recaptcha/api.js?hl=en'></script>
</head>
<body onload="$('ajaxloader').setStyle('display','none')"><div id="container">

        <div class="logo_container">
                <a href="/" id="logo" title="MWC - Home Page"><img src="/i/logo.png?40084" /></a>
                
                <div style="position:absolute; right:0; top:107px;" id="ajaxloader"><img src="/i/ajax-loader.gif" /></div>
        </div>
        <div class="menu_top">
                <a href="https://mywebsite.com/" title="Home Page"><h2>Home Page</h2></a>
                <a href="https://mywebsite.com/contact/" title="Contact"><h2>Contact</h2></a>
        <div class="clear"></div>
    </div>
        <div style="clear:both;"></div>
        <div style="padding:5px 0;"></div>

<div id="content" ><h1>List of items: Example</h1><br><br>

        <div class="tableExample" style="padding-left:0;">
        <table class="formular">
                <tr>
                        <th>Position</th>
                        <th>Name of item</th>
                        <th>Date added</th> 
                                        </tr>
                                                        <tr>
                                <td>1</td>
                                <td>John</td>
                                <td>2017-07-14 19:19</td>
                                                        </tr>
                                        <tr>
                                <td>2</td>
                                <td>Jane</td>
                                <td>2017-07-14 19:30</td>
                                                        </tr>
                                        <tr>
                                <td>3</td>
                                <td>Kelly</td>
                                <td>2017-07-14 18:44</td>
                                                        </tr>
                                        <tr>
                                <td>4</td>
                                <td>Michael</td>
                                <td>2017-07-12 12:49</td>
                                                        </tr>
                                        <tr>
                                <td>5</td>
                                <td>William</td>
                                <td>2017-07-13 00:26</td>
                                                        </tr>
                        </table>  
        </div>

Any ideas how can achieve this? Thanks in advance!




how to enable firestore persistence through web?

Actually I'm New in FIRESTORE . I don't know how to enable persistence throught web. In firestore API they gave some steps, but still i didnt understand

      firebase.initializeApp(config);
    saveButton.addEventListener("click",function(){
    var config = { 
apiKey: "AIzaSyCuUm2LH0OEeojblAYHN52RFGogHEcnsDY",
        authDomain: "cloud-7aac4.firebaseapp.com",
        databaseURL: "https://cloud-7aac4.firebaseio.com",
        projectId: "cloud-7aac4",
        storageBucket: "cloud-7aac4.appspot.com",
        messagingSenderId: "605897634030",
        presistence:"true"};
      firebase.initializeApp(config);
    /*enable persistence*/
    firebase.firestore().enablePersistence()
      .then(function() {
    var db = firebase.firestore();
    var docRef = db.doc('samples/alovelace');
     docRef.set({
        first: 'Ada',
        last: 'Lovelace',
        born: 1815
    });
      })
      .catch(function(err) {
          if (err.code == 'failed-precondition') {
              // Multiple tabs open, persistence can only be enabled
              // in one tab at a a time.
              // ...
          } else if (err.code == 'unimplemented') {
              // The current browser does not support all of the
              // features required to enable persistence
              // ...
          }
      });

And also is there is any possible to enable persistence using nodejs sdk without web?

Please point me to some working samples.




Can we create a db table from the front using php ? if yes ! then how?

How do we create database table from the front in php ? I got an idea that if we store the variables in an array and then call it in the query will it get the job done. Plus how to pass unknown number of variables in an array ?




Python Flask updating file in background

So I have 3 files, api.py, build.py and data.json

My problem is that when I update the json file via api.py and try to load a page it won't be adjusted to the new and updated data.

Example: Json contains a field which is 0 or 1, if I change one to the other nothing happens, however if I go in and manually update the build.py file and reload the page it works(etc change a string in the 'build_header()' function below).

Here is a short example of my code:

api.py:

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

build.py:

def build_page(page):
    with open('data.json') as json_data:
        data = json.load(json_data)
    if page === 'index':
        header = build_header()
        body = build_body(data)

The json file is updated in a separate thread, which isn't relevant here afaik.

When I make a HTTP GET request I get the right codes 200 if changed and 304 if not changed for data.json.

Thanks in advance.




Accessing textContent within connectedCallback() for a custom HTMLElement

Within the connectedCallback() method of my custom element the textContent is returned as an empty string.

Essentially my code boils down to the following...

class MyComponent extends HTMLElement{
    constructor() {
        super()

        console.log(this.textContent) // not available here, but understandable
    }           

    connectedCallback() {
        super.connectedCallback() // makes no difference if present or not

        console.log(this.textContent) // not available here either, but why?!
    }
}

customElements.define('my-component', MyComponent);     

And the HTML...

<my-component>This is the content I need to access</my-component>

From reading about connectedCallback() it sounds like it's called once the element has been added to the DOM so I would expect that the textContent property should be valid.

I'm using Chrome 63 if it helps...




Can't display info windows for markers

I have some troubles with displaying info windows for a marker on the map. I have a json file and markers are return well. But when I click the marker, info window not display.

Below I paste all my code. I feel so confused, because I tried different answers and nothing works fine, I spend few days to fix that and I need some help.

In my code I add console.log to test data and it looks good in console. I will be grateful for every advice.

<script>
    var infowindow = null;

        function initMap() {

        var map = new google.maps.Map(document.getElementById('mapGoogle'), {
            zoom: 14,
            scrollwheel: true,
            center: {lat: 51.500407513572796, lng: -0.129061164107939},
            disableDefaultUI: true,
            gestureHandling: 'greedy',
            styles: [
                {
                    "featureType": "water",
                    "elementType": "geometry",
                    "stylers": [
                        {
                            "color": "#e9e9e9"
                        },
                        {
                            "lightness": 17
                        }
                    ]
                },
                {
                    "featureType": "landscape",
                    "elementType": "geometry",
                    "stylers": [
                        {
                            "color": "#f5f5f5"
                        },
                        {
                            "lightness": 20
                        }
                    ]
                },
                {
                    "featureType": "road.highway",
                    "elementType": "geometry.fill",
                    "stylers": [
                        {
                            "color": "#ffffff"
                        },
                        {
                            "lightness": 17
                        }
                    ]
                },
                {
                    "featureType": "road.highway",
                    "elementType": "geometry.stroke",
                    "stylers": [
                        {
                            "color": "#ffffff"
                        },
                        {
                            "lightness": 29
                        },
                        {
                            "weight": 0.2
                        }
                    ]
                },
                {
                    "featureType": "road.arterial",
                    "elementType": "geometry",
                    "stylers": [
                        {
                            "color": "#ffffff"
                        },
                        {
                            "lightness": 18
                        }
                    ]
                },
                {
                    "featureType": "road.local",
                    "elementType": "geometry",
                    "stylers": [
                        {
                            "color": "#ffffff"
                        },
                        {
                            "lightness": 16
                        }
                    ]
                },
                {
                    "featureType": "poi",
                    "elementType": "geometry",
                    "stylers": [
                        {
                            "color": "#f5f5f5"
                        },
                        {
                            "lightness": 21
                        }
                    ]
                },
                {
                    "featureType": "poi.park",
                    "elementType": "geometry",
                    "stylers": [
                        {
                            "color": "#dedede"
                        },
                        {
                            "lightness": 21
                        }
                    ]
                },
                {
                    "elementType": "labels.text.stroke",
                    "stylers": [
                        {
                            "visibility": "on"
                        },
                        {
                            "color": "#ffffff"
                        },
                        {
                            "lightness": 16
                        }
                    ]
                },
                {
                    "elementType": "labels.text.fill",
                    "stylers": [
                        {
                            "saturation": 36
                        },
                        {
                            "color": "#333333"
                        },
                        {
                            "lightness": 40
                        }
                    ]
                },
                {
                    "elementType": "labels.icon",
                    "stylers": [
                        {
                            "visibility": "off"
                        }
                    ]
                },
                {
                    "featureType": "transit",
                    "elementType": "geometry",
                    "stylers": [
                        {
                            "color": "#f2f2f2"
                        },
                        {
                            "lightness": 19
                        }
                    ]
                },
                {
                    "featureType": "administrative",
                    "elementType": "geometry.fill",
                    "stylers": [
                        {
                            "color": "#fefefe"
                        },
                        {
                            "lightness": 20
                        }
                    ]
                },
                {
                    "featureType": "administrative",
                    "elementType": "geometry.stroke",
                    "stylers": [
                        {
                            "color": "#fefefe"
                        },
                        {
                            "lightness": 17
                        },
                        {
                            "weight": 1.2
                        }
                    ]
                }
            ] 
        });

        infoWindow = new google.maps.InfoWindow();

        // Try HTML5 geolocation.
        /*if (navigator.geolocation) {
            navigator.geolocation.getCurrentPosition(function(position) {
            var pos = {
            lat: position.coords.latitude,
            lng: position.coords.longitude
            };

            map.setCenter(pos);
        }, function() {
            handleLocationError(true, infoWindow, map.getCenter());
        });
        } else {
        // Browser doesn't support Geolocation
        handleLocationError(false, infoWindow, map.getCenter());
        }*/

        var clusterStyles = [
            {
            textColor: 'white',
            url: 'https://regain-app.com/wp-content/uploads/2018/01/m3.png',
            height: 30,
            width: 30
            },
        {
            textColor: 'white',
            url: 'https://regain-app.com/wp-content/uploads/2018/01/m2.png',
            height: 30,
            width: 30
            },
        {
            textColor: 'white',
            url: 'https://regain-app.com/wp-content/uploads/2018/01/m1.png',
            height: 30,
            width: 30
            }
        ];

        var mcOptions = {
            gridSize: 50,
            styles: clusterStyles,
            maxZoom: 15
        };

        // Create an array of alphabetical characters used to label the markers.
        var labels = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';

        var icon = {
            url: "https://regain-app.com/wp-content/uploads/2018/01/marker.png",
            scaledSize: new google.maps.Size(14, 14)
        };


        // Add some markers to the map.
        // Note: The code uses the JavaScript Array.prototype.map() method to
        // create an array of markers based on a given "locations" array.
        // The map() method here has nothing to do with the Google Maps API.
        var InfoWindowwindow = new google.maps.InfoWindow({
          content: 'test'
        });


        var temp = 0;
        var markers = locations.map(function(location, i) {

            let marker = new google.maps.Marker({
                position: location,
                label: location.label,
                icon: icon
            });

            let infowindow = new google.maps.InfoWindow({
                content: "sssssss"
            });

            marker.addListener('click', function() {
                infowindow.open(map, marker);
            });

            console.log(temp);
            console.log(infowindow);
            console.log(marker);

            return marker;
        });


        // Add a marker clusterer to manage the markers.
        var markerCluster = new MarkerClusterer(map, markers, mcOptions);

        function handleLocationError(browserHasGeolocation, infoWindow, pos) {
            infoWindow.setPosition(pos);
            infoWindow.setContent(browserHasGeolocation ?
                                'Error: The Geolocation service failed.' :
                                'Error: Your browser doesn\'t support geolocation.');
            infoWindow.open(map);
        }


        }/*end of InitMap*/


        var locations = [];
        var points;
        var url = '/api/points.json';
        var loadData = jQuery.getJSON(url, function(json) {

            jQuery.each( json.results, function( key, val ) {
            // console.log(val.lat);
            // console.log(val.lng);

            locations.push({            
                lat: Number(val.lat),
                lng: Number(val.lng),
                label: "lorem ipsum"
            });

            });
        });

        loadData.complete(function(){
            initMap();
        });
    </script>




This site can’t provide a secure connection adbc.com sent an invalid response. ERR_SSL_PROTOCOL_ERROR

When I try to invoke a get request via URL in the browser (no matter what the browser is), this is the response I got.




dimanche 28 janvier 2018

How to find path or something like sitemap of website or web application ?(Python)

I want to know about sitemap of website. Just like absolute sitemap , all sitemap. How do i do in python?. Thank you.




Disable refresh button click for javascript timer

I'm working on the timer module for a quiz project. I have created a timer program it works as expected. But when I click the refresh button the timer restarts. I want the timer to not be affected by the refresh button click. How to achieve this.

<script type ="text/javascript">


var timer = 3600;
var min=0;
var sec = 0;

function starttimer()
{

min=parseInt(timer/60);
sec=parseInt(timer%60);

if(timer<1)

{

window.location="over.html";

}

document.getElementById("time").innerHTML="<b> Time Left: </b>" 
+min.toString()+":"+sec.toString();
timer--;
setTimeout(function(){
starttimer();

},1000);

}
</script>

</head>

<body onload="starttimer();">

<h1> Test Page  </h1>
<div>
<center><b>[<span id="time"></span></b>]</center>
</div>




Validate mobile number without sending OTP?

I need to design a registration page, ask for user's mobile number and validate it.

Is there any way to access the user's mobile number and validate it without sending the OTP? Is there any API exposed to read the mobile number internally and validate on the client side?




Images are rendering incorrectly in web viewer gallery

Screen shot of images displayed in a viewer

here is a link to view it in a browser

http://www.quest360.io/viewer/share.php?318&uid=318&title=tunaev

I have been unable to figure out the cause! Please help...




"urllib.error.HTTPError: HTTP Error 404: Not Found" Python

I'm trying to open this webpage with the urllib.request.open function: "https://prenotaonline.esteri.it/login.aspx?cidsede=100001&returnUrl=//"

I can access this webpage with my regular browser, still with the urrlib.request.open function it returns HTTP error 404:

import urllib.request


page = urllib.request.urlopen("https://prenotaonline.esteri.it/login.aspx?cidsede=100001&returnUrl=//").read()
print(page)

I get the following error:

Traceback (most recent call last):
  File "/Users/markmouawad/Documents/consu_programa/scrapper.py", line 4, in <module>
    page = urllib.request.urlopen("https://prenotaonline.esteri.it/login.aspx?cidsede=100001&returnUrl=//").read()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 163, in urlopen
    return opener.open(url, data, timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 472, in open
    response = meth(req, response)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 582, in http_response
    'http', request, response, code, msg, hdrs)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 510, in error
    return self._call_chain(*args)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 444, in _call_chain
    result = func(*args)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 590, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

I'm using Python 3.5.3




Which backend development language should I start learning?

I have a pretty good HTML/CSS/JS knowledge, and I wanted to start back-end development, I'm wondering if I should start with Ruby or Node.js? Thanks.




String Declaration in Javascript

Following are some declaration of String in JAVASCRIPT

var str = "Hello World"
var str1 = new String("Hello World")
str2 = "Hello World"

What is the difference between declarations mentioned above. Memory wise or if any.




How to import jquery extension in webpack?

I am trying to import owl.carousel module.

Method as:

import 'owl.carousel/dist/assets/owl.carousel.css';
import $ from 'jquery';
import 'imports?jQuery=jquery!owl.carousel';

from official documentation makes webpack return error:

ERROR in ./main/templates/default/assets/js/index.js
Module not found: Error: Can't resolve 'imports' in 
'/var/www/digits/main/templates/default/assets/js'
 @ ./main/templates/default/assets/js/index.js 6:0-44

while frontend compilation.

What am I doing wrong?




HTTP Error 405.0 - Method Not Allowed when call api

i have same api ,when call api in angualr 2 i gat this error

HTTP Error 405.0 - Method Not Allowed The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used.

my Webconfig

<rewrite>
  <!--This directive was not converted because it is not supported by IIS: RewriteBase /.-->
  <rules>
    <rule name="Imported Rule 1" stopProcessing="true">
      <match url="^index\.html" ignoreCase="false" />
      <action type="None" />
    </rule>
    <rule name="Imported Rule 2" stopProcessing="true">
      <match url="." ignoreCase="false" />
      <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
      </conditions>
      <action type="Rewrite" url="/index.html" />
    </rule>
  </rules>
</rewrite>

 <httpProtocol>
  <customHeaders>
    <add name="Access-Control-Allow-Origin" value="*" />
    <add name="Access-Control-Allow-Headers" value="*" />
    <add name="Access-Control-Allow-Credentials" value="true" />
  </customHeaders>
</httpProtocol>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
  <remove name="OPTIONSVerbHandler" />
  <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
  <remove name="OPTIONSVerbHandler" />
  <remove name="TRACEVerbHandler" />
  <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
<modules>
  <remove name="ApplicationInsightsWebTracking" />
  <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
</modules>