samedi 31 mars 2018

update specific attribute in mongoose

I have a production MEAN web project and I need to modify specific attribute after being created

app.post('/api/user',function(req,res){

var user = req.body;
console.log(req.body);


userModel
    .create(user)
    .then(
        function(postObj){
            var number = req.body.phone.substring(1);
     res.json(200); 
    },function(error){
        // res.sendStatus(400);
        console.log(error)
        res.json(error)
            }
    );});

Here I have to update specific attribute let's assume it's name gender and give it static value such as 'male' and I don't want to have a callback or use the return object

any help please...?




How put NetBeans on redhat?

Umm ... I try to build some html ,jsp,java(servlet) and databaseMysql in netbeans, I just created a account for redhat, how can I move the NetBeans on redhat and the MySQL too.

I did not find any way on searching related content .please help thank you

What should I do to host the server on redhat , rather than from my pc local




socket.io repeatedly update change

I was trying to use socket.io to make a real-time collaboration editor with two different WYSIWYG Editors called summernote and froala. Server and client side both can receive and send content, however, it repeatedly refreshes stuff and I don't know why. Any advice? Thanks!

Here is part of my code: Server side:

var express = require('express'), 
app = express(),
http = require('http'),
io = require('socket.io');

var server = http.createServer(app);
var io = require('socket.io').listen(server);
server.listen(8000);
app.use(express.static(__dirname + '/public'));
console.log("Server running on 127.0.0.1:8000");


// event-handler for new incoming connections
io.on('connection', function (socket) {

   // first send the history to the new client
   socket.on("summer_change", function (data) {
    io.sockets.emit('summer_change', {content: data.content});
   });



   socket.on("text_change", function (data) {
    io.sockets.emit('text_change', {content: data.content});
   });
});

Client:

document.addEventListener("DOMContentLoaded", function() {


// get canvas element and create context
   var socket  = io.connect();
   var text = {
       text: ''
   };
   $(function() {
    $('#text').froalaEditor()
  });
   //Update summer
   $('#summernote').on('summernote.change', function(we, contents, $editable) {
      console.log('summernote content is changed:'+$('#summernote').summernote('code'));
      var contents = $('#summernote').summernote('code')
      socket.emit("summer_change",{content:contents});
   });
   // Change summer content from server
   socket.on("summer_change", function (data){
      console.log("Back from server! ");
      $('#summernote').summernote('code', data.content);
   });

   $('#text').froalaEditor().on('froalaEditor.contentChanged', function (e, editor) {
      var contents=editor.html.get();
      socket.emit("text_change",{content:contents});
    })

   socket.on("text_change", function (data){
      console.log("Back from server! ");
      $('#text').froalaEditor('html.set', data.content);
   });
});




Style div if specific li is active [duplicate]

This question already has an answer here:

I need to change some css attributes from a section that has an id when a specific li is active. But the li is inside this section.

Can someone help me out?




quero saber como faço para selecionar todo o texto de um webeview pelo butão com android estudo

tipo assim , eu coloco um botão e uma webview e ao clicar no botão too texto do site é selecionado




Django deleting default form labels

While styling Authentication form i got defining labes "Username" and "Password" picture is here. How to delete these elements?

Forms module

class LogForm(AuthenticationForm):
username = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Enter Login'}))
password = forms.CharField(widget=forms.PasswordInput(attrs={'class': 'form-control', 'placeholder': 'Enter Login'}))




"Application Error" when deploying with Heroku for node

I managed to finally make a running client-server easy app in local (after weeks of trying) and... I tried to give Heroku a try, so my last server was so confusing and frustrating. It seemed it was working but... after an "okay" deploy, the web shows "An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details.".

I found things like allowing to run in process.env.PORT and not only 8080 port, fixed it, but still the same mistake, though still working in local. Any advice?

The log of the deploy...

-----> Node.js app detected
-----> Creating runtime environment

       NPM_CONFIG_LOGLEVEL=error
       NODE_VERBOSE=false
       NODE_ENV=production
       NODE_MODULES_CACHE=true
-----> Installing binaries
       engines.node (package.json):  unspecified
       engines.npm (package.json):   unspecified (use default)

       Resolving node version 8.x...
       Downloading and installing node 8.11.1...
       Using default npm version: 5.6.0
-----> Restoring cache
       Loading 2 from cacheDirectories (default):
       - node_modules
       - bower_components (not cached - skipping)
-----> Building dependencies
       Installing node modules (package.json + package-lock)
       up to date in 3.888s
-----> Caching build
       Clearing previous node cache
       Saving 2 cacheDirectories (default):
       - node_modules
       - bower_components (nothing to cache)
-----> Pruning devDependencies
       Skipping because npm 5.6.0 sometimes fails when running 'npm prune' due to a known issue
       https://github.com/npm/npm/issues/19356

       You can silence this warning by updating to at least npm 5.7.1 in your package.json
       https://devcenter.heroku.com/articles/nodejs-support#specifying-an-npm-version
-----> Build succeeded!
-----> Discovering process types
       Procfile declares types     -> (none)
       Default types for buildpack -> web
-----> Compressing...
       Done: 19.4M
-----> Launching...
       Released v5
       https://myweb.herokuapp.com/ deployed to Heroku




Oauth 2.0 post request

POST /oauth/v2/accessToken HTTP/1.1 Host: www.linkedin.com Content-Type: application/x-www-form-urlencoded grant_type=authorization_code&code=987654321&redirect_uri=https%3A%2F%2Fwww.myapp.com%2Fauth%2Flinkedin&client_id=123456789&client_secret=shhdonottell


I need to make this post request. But unable to figure how to make the request. Explain the different parts of the request ie, headers cookie ... etc

Need a javascript / jquery solution

Plz help thanks




Is there a non-hacky way to prevent pinch zoom on iOS 11.3 Safari?

I know a lot of apple fanboys and kool-aid pundits from the web of 1990s will be up in arms for this but I really want to disable pinch to zoom on my webpages.

Ability to enable or disable must rest with developers and no single corporation should be able to force feed a pattern masquerading as an accessibility feature.

This is important for AR/VR based deployments, experience of gaming on web and for tight experience around buttons, input boxes, books or slide out/slide in type of interfaces and simply for having page turns instead of scrolls.

Ideally, I'd prefer Safari honored the following clause:

<meta name="viewport" content="width=device-width, window-zoomable=no" />

Right.




How to "store" data from buttons?

Sorry, I'm super new to web dev, as you can probably tell. So basically, I want the user to be able to choose options from a couple different categories.

Basically, this is a language learning website.

  1. They can click buttons to choose a male or female speaker or both
  2. Choose number of trials through a slider
  3. They can choose what sounds they want to practice out of a list - I used a MultiSelect list for this.

After they choose everything, there's a game start button.

So like I said, I'm really new to javascript and while I know how to toggle functions on click, I don't know how to store the button data (as in, whether it's clicked or not) and then use it when I toggle the game start button.

<button id="male" type="button" class="btn"> Male </button>
<button id="female" type="button" class="btn"> Female </button>

<input type="range" min="1" max="10" value="5" class="slider" id="myRange"> 

<div class="MultiSelect"> 
    <input type="checkbox" id="boxA" name="box[]"> 
        <label for="boxA">A</label> 
    <input type="checkbox" id="boxB" name="box[]"> 
        <label for="boxB">B</label>
</div>

<button type="submit" class="btn-submit"> Let's Start!</button>

Would someone be kind enough to walk me through it and show me an example (on maybe show me an example on one of the ones I listed)? Thank you so much!




PHP- get the last 6 months from the current date

I am trying to get the last six months from the current date in PHP. It's a simple problem, but my code is not giving the right result.

for ($j = 0; $j <= 5; $j++) {
    echo date("F Y", strtotime(" -$j month"));
    echo "<br>";
}

And the output is

March 2018
March 2018
January 2018
December 2017
December 2017
October 2017

I dont understand why March is coming twice.




Selenium experimental Options Disabled?

I'm trying to use the experimental options, but apparently its no longer defined in ChromeOptions, im guessing i'm just missing something?

What is going on here? I have a feeling its something simple that im overlooking.

Im using code from Here

But this is what i get Here

I also cant get that .js to run either, but thats a different problem.

Code

namespace WEBTEST
{
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }



    private void button1_Click(object sender, EventArgs e)
    {
        ChromeOptions cOptions = new ChromeOptions();
        cOptions.AddArguments("test-type");
        cOptions.AddArguments("start-maximized");
        cOptions.setExperimentalOption("excludeSwitches", Arrays.asList("enable-automation"));

        IWebDriver driver = new ChromeDriver();
        IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
        string title = (string)js.ExecuteScript("run");
        driver.Url = "http://www.Kittens.com";

    }




How to re-verify with password before adding data to cloud firestore in firebase?

I have to update a document from the settings menu of my web app. I'm using cloud firestore as my db service. When updating the document, I want to send those data with the verification password so that it will be re verifing the user before updating. This cannot be done in the front end because of the security reasons. Is there any way of doing it?




How to do subcomments

from django.db import models

class Post(models.Model):
    post_title = models.CharField(max_length=120, default=None)
    post_text = models.TextField()
    pub_date = models.DateTimeField('date published')

    def __str__(self):
        return self.post_title

class Comment(models.Model):
    post = models.ForeignKey(Post, on_delete=models.CASCADE)
    sub_comment = models.ForeignKey('self', on_delete=models.CASCADE, blank=True, null=True)
    author = models.CharField(max_length=50)
    comment_text = models.CharField(max_length=250)
    pub_date = models.DateTimeField('date published')


    def __str__(self):
        return self.author

Hello, i've got a question. How to preform displaying comment as a thread if i have models like this?




SVGs are inconsistent in their color behavior, when a background color is overlaid upon them. (Browser)

I'm working on some background art, and I'm going to be using it alongside a background color which will be overlaid on it. But the behavior of the background color overlay doesn't make sense. The color of the lines are different than the color of the squares when a background color is applied, but the same when there is no background

body {
    background-color: #2d3137; /*Background 1*/
    background-image: url('/static/bg.svg');
    background-repeat: no-repeat;
    background-size: cover;
    background-attachment: fixed;
}

Original:
The original svg with no background.

Background #1:
The same svg rendered with a background

Background #2:
The same svg rendered with another background




connection db error mysqli connection

please help me resolve

Warning: mysqli_select_db() expects parameter 1 to be mysqli, string given in C:\xampp\htdocs\trperpus\include\koneksi_db.php on line 10

Warning: mysqli_error() expects exactly 1 parameter, 0 given in C:\xampp\htdocs\trperpus\include\koneksi_db.php on line 10 Gagal mengaktifkan database

<?php
$db_host    = "localhost";
$db_user    = "root";
$db_pass    = "";
$db_name    = "db_perpus";
$konek  = mysqli_connect($db_host,$db_user,$db_pass,$db_name) or die ("Gagal koneksi ke server");
mysqli_select_db($db_name, $konek) or die ("Gagal mengaktifkan database".mysqli_error());
$denda1=200;
?>




Searching Only From td table not from Header (th)

I can search from the entire table by using jquery and show only tr that match from search and it make header (th) gone. But i want it only search from table content. (Header stay and content that match show)

here my style

<style>
  td{border: 1px solid black}
</style>

here my html code

<input type="text" id="search" placeholder="Type to search">
<table id="tableAll">
  <tr>
     <th>Fruit name</th>
     <th>Color</th>
     <th>Notes</th>
  </tr>
   <tr>
      <td>Apple</td>
      <td>Green</td>
      <td>Delicious</td>
   </tr>
   <tr>
      <td>Grapes</td>
      <td>Green</td>
   </tr>
   <tr>
      <td>Orange</td>
      <td>Orange</td>
   </tr>
</table>

here my Script

var $rows = $('#tableAll tr');
$('#search').keyup(function() {
  var val = $.trim($(this).val()).replace(/ +/g, ' ').toLowerCase();

  $rows.show().filter(function() {
      var text = $(this).text().replace(/\s+/g, ' ').toLowerCase();
      return !~text.indexOf(val);
  }).hide();
});

you can also click here for code it in jsfiddle




vendredi 30 mars 2018

Notice: Undefined variable: lic_photo in /opt/lampp/htdocs/11/licence.php on line 60

I have getting this error " Notice: Undefined variable: lic_photo in /opt/lampp/htdocs/11/licence.php on line 60" while I trying to upload a file into the database.

<?php
session_start();
include('conn.php');

if(isset($_POST["submit"])){

  $lic_no=$_POST["lr-ln"];
  $lic_date=$_POST["lr-date"];
  $lc_name=$_POST["lr-name"];
  $lic_guard=$_POST["lr-guard"];
  $lic_dob=$_POST["lr-dob"];
  $lic_blood=$_POST["lr-blood"];
  $lic_rhfactor=$_POST["lr-rh"];
  $lic_paddress=$_POST["lr-paddr"];
  $lic_taddress=$_POST["lr-taddr"];
  $lic_mark1=$_POST["lr-mark1"];
  $lic_mark2=$_POST["lr-mark2"];

  /*uploading photos and signature to the datebase
  --------------------------------------------------*/
  if (isset($_FILES["lr_photo"]["name"])) {

      $lic_photo = $_FILES["lr_photo"]["name"];
      $ptmp_name = $_FILES['lr_photo']['tmp_name'];
      $perror = $_FILES['lr_photo']['error'];

      if (!empty($lic_photo)) {
          $plocation = 'uploads/photos';

          if  (move_uploaded_file($ptmp_name, $plocation.$lic_photo)){
              echo 'Uploaded';
          }

      } else {
          echo 'please choose a file';
      }
  }

  if (isset($_FILES["lr_sig"]["name"])) {

      $lic_signature = $_FILES["lr_sig"]["name"];
      $stmp_name = $_FILES['lr_sig']['tmp_name'];
      $serror = $_FILES['lr_sig']['error'];

      if (!empty($lic_signature)) {
          $slocation = 'uploads/photos';

          if  (move_uploaded_file($stmp_name, $slocation.$lic_signature)){
              echo 'Uploaded';
          }

      } else {
          echo 'please choose a file';
      }
  }
  /*  entering data into mySQL database
  ------------------------------------------------*/

  $sql = "insert into licence values ('$lic_no','$lic_date','$lc_name','$lic_guard','$lic_dob','$lic_blood','$lic_rhfactor'.'$lic_paddress','$lic_taddress',
   '$lic_mark1','$lic_mark2','$lic_photo','$lic_signature')";

   mysqli_query($conn,$sql);
                 echo "<script>alert('registerd suceessfully')

                           </script>";
}

?>

This is the code that I runned.when I declare the variable name in the declaring section.It shows no error but the data is not entering in to the database.

<?php
session_start();
include('conn.php');

if(isset($_POST["submit"])){

  $lic_no=$_POST["lr-ln"];
  $lic_date=$_POST["lr-date"];
  $lc_name=$_POST["lr-name"];
  $lic_guard=$_POST["lr-guard"];
  $lic_dob=$_POST["lr-dob"];
  $lic_blood=$_POST["lr-blood"];
  $lic_rhfactor=$_POST["lr-rh"];
  $lic_paddress=$_POST["lr-paddr"];
  $lic_taddress=$_POST["lr-taddr"];
  $lic_mark1=$_POST["lr-mark1"];
  $lic_mark2=$_POST["lr-mark2"];
  $lic_photo=1;
  $lic_signature=2;

  /*uploading photos and signature to the datebase
  --------------------------------------------------*/
  if (isset($_FILES["lr_photo"]["name"])) {

      $lic_photo = $_FILES["lr_photo"]["name"];
      $ptmp_name = $_FILES['lr_photo']['tmp_name'];
      $perror = $_FILES['lr_photo']['error'];

      if (!empty($lic_photo)) {
          $plocation = 'uploads/photos';

          if  (move_uploaded_file($ptmp_name, $plocation.$lic_photo)){
              echo 'Uploaded';
          }

      } else {
          echo 'please choose a file';
      }
  }

  if (isset($_FILES["lr_sig"]["name"])) {

      $lic_signature = $_FILES["lr_sig"]["name"];
      $stmp_name = $_FILES['lr_sig']['tmp_name'];
      $serror = $_FILES['lr_sig']['error'];

      if (!empty($lic_signature)) {
          $slocation = 'uploads/photos';

          if  (move_uploaded_file($stmp_name, $slocation.$lic_signature)){
              echo 'Uploaded';
          }

      } else {
          echo 'please choose a file';
      }
  }
  /*  entering data into mySQL database
  ------------------------------------------------*/

  $sql = "insert into licence values ('$lic_no','$lic_date','$lc_name','$lic_guard','$lic_dob','$lic_blood','$lic_rhfactor'.'$lic_paddress','$lic_taddress',
   '$lic_mark1','$lic_mark2','$lic_photo','$lic_signature')";

   mysqli_query($conn,$sql);
                 echo "<script>alert('registerd suceessfully')

                           </script>";
}

?>

The above code shows no error but the data is not entering into the database.




What are the minimum/maximum periods for vibrations in the Vibration Web API?

What are the minimum/maximum periods of pulses (in ms) for window.navigator.vibrate() in the Vibration Web APIs?

Is it device-dependent?

What if I specify the period that is too small for the device hardware capability? Will it vibrate at all?

I haven't found anything in the official documentations.

Thanks!




Framework for a web card game development

I'm about to start a new project for a Web Card Game.

This is the first game I want to develop, I have no experience in game development and I was wondering if you guys could suggest me some Frameworks to start with. I won't say much, but it's a multiplayer game that includes also an AI that can replace a player. I've done some research and I found some framework like Phaser, but I don't know if this framework it's good for my scope.




golang garbage collection frequency increases very rapidly when using my own response writter

func ResponseLogger() negroni.HandlerFunc { return negroni.HandlerFunc(func(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) { responseWriter := newLoggingResponseWriter(rw) next(responseWriter, r) path := GetAPIPath(r.URL.Path) statusCode := responseWriter.StatusCode() metric := getAPIPathWithStatusCode(path, statusCode) instrumentation.IncrementCounter(metric, 1) }) }

When I profiled this with traffic around 40K rpm. I witnessed something like this. enter image description here .

the GC pause frequency almost trippled. enter image description here

my application exposes multiple APIs and each of them in turn creates many objects to serve the data. What's going wrong here.




API for retrieving books prices

I am developing a website for selling new and used books (as a graduation project). So I want an API to get the price of a book when its new. Then based on its price I can evaluate the used book price. I tried GoogleApis, it rarely provide a price, most of the books under sale info it show not for sale. So does anyone know an api to get the price?




how to open link in external window with click on anchor tag with javascript?

This is probably such a noob question, but i can't get it to work.

I want to open external window link by clicking on anchor tag, but i keep getting error that myFunction() is not defined.

<a href="#" id="searchEng" onclick="myFunction()">Open link</a>

js

$(document).ready(function(){ 
$('#searchEng').click(function() {
    const engine = document.getElementById('engine');
    var en_ = engine.val();
    if (en_ == "firefox")
    {
        function myFunction(){
                var url = "https://www.mozilla.org/en-US/firefox/new/";
                window.open(url,'_blank');
            };
    }
});

));

Why is it undefined?

I have .js included because other stuff works.

Thanks :)




How to handle users and roles by app in Django

Hello everyone let me ask something about the admin interface and how can I handle my users by app.

Well so sorry I'm nooby first of all. So, I need to create a new app for basically take some quiz so I will need users and these users within my app should have a different role as a student or teacher and so on.

The thing is that I don't know if the admin Django interface is just for the DB models or whether I can use it as a security layer in my app.

Or otherwise, I should create a buck of tables in my app model for users and roles and then handle everything from the model because the admin is just the DB access. what could you tell me? thanks so much.




Can I make sidebar for my ios app in xcode using swift and add functinality from my website?

I am new to iOS development and I am trying to make an app hybrid app for my website.

How to we add functionality from website to the iOS app sidebar which I designed today?

The code for sidebar is written in Swift 4.x and I want to add functionality of the website's sidebar.




Add mocking back-end requests of front-end side

I have application with front-end (React.js) and back-end (Node.js). I write a tests with cypress.io. On back-end side my applciation exists some request which send him on another resource. Can I mock this request using by cypress, if she doesn't checking on terminal and front-end? Or how I can disable this request for development mode?




JSON injection in RESTful

I'm new to web applications and haven't got much info. in google for JSON Injection.
Can you please provide some insight to the below questions.

  1. What is JSON Injection?
  2. Is JSON Injection is client-side or server-side attack?
  3. How can you handle JSON Injection security aspects in terms of RESTful Application?



manifest.json of web app in sub directory not detected

I have my localhost server running at root folder and my webapp folder lies inside this root folder.

http://127.0.0.1:8887/ -> root

http://127.0.0.1:8887/webapp -> root/webapp

The webapp contains it's index.html which links to manifest.json file in same folder like this.

<link rel="manifest" href="./manifest.json">

The manifest file of webapp is not being detected by Chrome in this setup.

manifest.json is detected only if localhost server is started at webapp folder.

http://127.0.0.1:8887/ -> webapp

I want it work other way, how to do that?




What response code Apache throws when it max out?

I use Apache 2.4 as web server. When it exceeds max connections limit, what response code the client receives from the web server?




System.IO.FileNotFoundException: Could not load file or assembly... (.resources)

On my ASP.NET Web API i have a method that parses some data from email messages using MsgReader. It works OK, but after a while it starts to throw following exception:

System.IO.FileNotFoundException: Could not load file or assembly 'MsgReader.resources, Version=2.1.3.0, Culture=en-US, PublicKeyToken=47f99f3a9a2648df' or one of its dependencies. The system cannot find the file specified.
File name: 'MsgReader.resources, Version=2.1.3.0, Culture=en-US, PublicKeyToken=47f99f3a9a2648df' ---> System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
   at System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence)
   at System.Reflection.Assembly.LoadFile(String path)
   at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalGetSatelliteAssembly(String name, CultureInfo culture, Version version, Boolean throwOnFileNotFound, StackCrawlMark& stackMark)
   at System.Resources.ManifestBasedResourceGroveler.GetSatelliteAssembly(CultureInfo lookForCulture, StackCrawlMark& stackMark)
   at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark)
   at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark)
   at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
   at System.Resources.ResourceManager.GetString(String name, CultureInfo culture)
   at MsgReader.Mime.MessagePart..ctor(Byte[] rawBody, MessageHeader headers) in C:\Users\Kees\Documents\GitHub\MsgReader\MsgReader\Mime\MessagePart.cs:line 242
   at MsgReader.Mime.Message..ctor(Byte[] rawMessageContent, Boolean parseBody) in C:\Users\Kees\Documents\GitHub\MsgReader\MsgReader\Mime\Message.cs:line 139
   at MsgReader.Mime.Message.Load(Stream messageStream) in C:\Users\Kees\Documents\GitHub\MsgReader\MsgReader\Mime\Message.cs:line 301
   at MsgReader.Outlook.Storage.Message.LoadClearSignedMessage(IStorage storage) in C:\Users\Kees\Documents\GitHub\MsgReader\MsgReader\Outlook\Message.cs:line 1558
   at MsgReader.Outlook.Storage.Message.LoadStorage(IStorage storage) in C:\Users\Kees\Documents\GitHub\MsgReader\MsgReader\Outlook\Message.cs:line 1384
   at MsgReader.Outlook.Storage..ctor(Stream storageStream, FileAccess fileAccess) in C:\Users\Kees\Documents\GitHub\MsgReader\MsgReader\Outlook\Storage.cs:line 196
   ...

After i recycle application pool, it works again (for a while) then at some time the error repeats...

I tried with assemblyBinding

  <dependentAssembly>
    <assemblyIdentity name="MsgReader" publicKeyToken="47f99f3a9a2648df" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-2.1.3.0" newVersion="2.1.3.0" />
  </dependentAssembly>

but no success...

I think the problem the problem is with Culture? Because as i see in error the Culture is en-US, but in MsgReader package there are only these cultures:

Image

Thank you for help




jeudi 29 mars 2018

how to make a div that looks like this button in CSS

I am trying to create a div that will have following look alike CSS.

Though i am not sure how to get that kind of texture with just CSS also how to add multiple borders like this one( there dark border around white border and internal content has little bit of gradiant shadowy looks.

Here is my fiddle : https://jsfiddle.net/ad4xv9mt/7/

fiddle link

enter image description here

Edit: adding a clear image

enter image description here




How does website identity different user by cities automatically?

I'm using Django to build a website,I need a function,that website can automatically identify the cities of the users ,and then I will supply different content for users from different cities.

But I have no clue what kind of technology I need to use.

I heard something about google map api,but not sure.Anybody has such experience?




Font is not displaying in all browsers

I was experimenting and using Helvetica Neue Condensed Bold for a page. My mac's screen needs to be replaced, so I continued working on the same code from my second windows laptop. The font is not displaying in any of the browsers. What is usually the best way to make your desired font visible on maximum browsers possible?




Users can copy & paste a credit card payment URL and process a payment without our knowledge, any suggestions?

Our customers can copy & paste the URL of a third party payment and make payments even when logged out of our software.

If the users do this we currently have no way of knowing, and our records will not show that they made a payment.

Obviously this is a pretty serious issue.

I'm a newer developer and this is a rather daunting, open-ended problem that I'd like some guidance on.

Here's what I have to go on so far:

  1. The postback from this third party payment page contains all of the information necessary for us to create a record of the payment.

Is there a way we can capture this postback even when the user is logged out of our software, so that our records never get out of sync with the third party's?

  1. Another idea is to only permit payments to be made when the user is also logged into our server, regardless of how they arrived at the URL.

How can we track this with a third party web page?

Sorry if this is an overloaded question; imagine how I feel!

Thanks in advance for your help!




How to upload an image or a video to a persistant folder in class-path with Spring-Boot?

I am new in Spring-Boot... I want to upload images or videos, and store them in a persistant folder "upload-storage" in the class-path of my project in the server. I don't want to store them in the database (20 Mo). Spring-Boot store them in target/upload-storage. That functions : I can show the videos on the view with the controller and Thymeleaf. I can close tomcat, close the browser, and open them again : that functions. But the day after, upload-storage is disapeared ! I think that I don't use the good process. But I found how to upload an image : ok. I found how to show images from a folder in class-path : ok. I found how to upload images to database. But nothing to store the uploaded images in a persistant folder. Can you help me ?




Run a Jmeter Test from a webpage

At the moment this is untested, and not attempted, I am asking moreso in theory.

What I am hoping to do, is use the "Jmeter Dashboard Report" page as an internal testing reporting website. On this site, I would like to have a link/button somewhere on the page to run 1 of X Jmeter tests. The tests would not be run through GUI (Preferably), and after the test has ran the page will refresh with the new results.

I have searched on google for anything similar to this, with no luck.

I am basically wondering if something like this would be possible to do? Or if I should rethink what I am hoping to do.




To overlap multiple images in javascript and html

How to overlap multiple images in html and javascript?? more than two images using html and javascript.




Rendering accessible graphs and equations on web browsers and Word

I'd like to know how to best render accessible graphs and equations in a browser and in Word. Which type of mark up language is the best - MathML, LaTex or ASCIIMathML?

Are there any particular browsers that are superior with this kind of rendering?

Any help is welcome!

Thanks!




hide header on Login page

i want to hide the header bar in the Login page and after a succesful login it should appear in the other pages i tried to make a class in the css so it hides the header but i couldn't find a way to disable it after a succesful login

import React, { Component } from 'react';
import './App.css';
import Authen from './Pages/Authen';
import Home from './Pages/Home';
import {
  BrowserRouter as Router,
  Route,
  Link
} from 'react-router-dom';
class App extends Component {


  render() {
    return (

  <div className="app">

    <Router>
    <div>
       <div className="hide">
      <ul>
        <li><Link to="/Home">Home</Link></li>
      </ul>
      </div>
      <Route exact path="/" component={Authen}/>
      <Route path="/Home" component={Home}/>
    </div>
  </Router>

  </div>

    );
  }
}

export default App;

the css :

.hide{
  display: none;
}

And this is how the page redirects from Authentication page to the home page. The login page is not in the same file as the router page :

    Login = () => {
    const email = this.refs.email.value;
    const password = this.refs.password.value;
    console.log(email,password);

    const auth = firebase.auth();

    const promise = auth.signInWithEmailAndPassword(email, password);

    promise.then(user =>{
      var lout = document.getElementById('Login');

      lout.classList.remove('hide');
    });

    promise.catch(e =>{
      var err = e.message;
      console.log(err);
      this.setState({err: err});
    });
    firebase.auth().onAuthStateChanged((user) => {
  if (user) {
    console.log(user.uid);
 this.props.history.push('/Home')
  }
});
}

thank you for your time :)




To remove the image which was dragged

I have dragged an image to division. How to remove the dragged image from division?? How to drag and remove image in html and javascript?




How to validate a button click on client side

Let's say, i have a website and it has one button: click me, and also a counter which counts how many times people clicked on the button. The thing is, how to validate if the clicker is a real person, that he clicked only once e.t.c. ? Ip's can be changed. Also, it's not a good choise to make a whole account system for a single button.




How to show specific text based on page path using a php function

I am using on a multipage website built in php that uses a global footer in its own blade. When a page blade loads in content for the body, it calls upon the global footer blade to import content for the footer. This way I only need to make changes in the global footer blade instead of every page.

Want I want to do now, is to create a conditional statement in my footer that allows me to load content depending on the page path.

For example:

animals.com/foxes/basics Load in content in the footer about foxes.

animals.com/bears/info Load in content in the footer about bears.

This info is based on the path having bears vs foxes, and affects alls child pages in that path.

Any advice on how to get started with using a PHP conditional that looks at the path in a URL or site? Any help would be appreciated!




Touch scrolling

I am using ftcroller.js for adding touch scrolling to my website, but the problem is that when I scroll using my finger it also triggers other touch events (if there is any) on the touchpoint . Is there any way to disable other events when touch scroll happens?




PHP search doesn't work?

I am trying to create a search algorithm for my website but it doesn't work. It should show the title of an entry when what is searched is inside the title it gets from json files in a folder on the site. My HTML body in search.php:

<body>
<p>Your search: <script type="text/plain" style="display: inline;"><?php
                $query = $_GET['q'];
                echo $query;
                ?></script>

</p>
<p>Results: <?php
                $files = array();
                foreach (glob("jsons/*.json") as $file) {
                  $files[] = $file;
                }

                //echo($files[0]);

                foreach ($files as $file) {
                    $content = file_get_contents($file);
                    $json = json_decode($content);
                    $title = $json->title;
                    //echo 'x'.$title;
                    if (strpos("x".$title,$query !== false)) {
                       echo $title;
                    }
                }
            ?></p>
</body>

The file structure:

root
  jsons
    test.json
  index.html
  search.php

The content of test.json:

{
    "title": "Test",
    "text": "I am a test",
    "attachment": "test.txt"
}

The URL: http://example.com/path/to/page/search.php?q=Test

What I get when accessing the page:

Your search: Test

Results:

What it should return:

Your search: Test

Results:
Test

Does anyone here know why it doesn't find it or does anyone know a easier way?




how to use url parameters in html?

I get URL parameters using Javascript but i can't use those variables in my html. the JS code is this:

<script>
var url_string = window.location.href; //window.location.href
var url = new URL(url_string);
var c = url.searchParams.get("name");
console.log(c);
</script>

and my URL is localhost:8000/something?name=ABC.here i can get the value of name and show it in the browser console but when i try to set the value of an input tag in my HTML it doesn't do it and raises some errors. my JS and html is like:

<script>
    var url_string = window.location.href; //window.location.href
    var url = new URL(url_string);
    var c = url.searchParams.get("name");
    document.getElementById("user").value =url.searchParams.get("name");
    </script>
<input id="user" value"">

this should have changed the value of the input tag but doesn't.




How yo change the Whatsapp links image?

How to change the image that shows when someone share a news in the Whatsapp?? All links are showing the logo of the site but instead of it i need the news image.




Unknown provider when try to call my authorise service

In my angular 1.5 app i try to call an authorisation service in order to predict the group of the current user.

I read the way to do so before the app is loaded is by adding to the routerProvider.

However i see it's not possible as the service wasn't initialised by then:

  app.config(['$stateProvider', '$urlRouterProvider', '$compileProvider', 'authorizationService',
        function ($stateProvider, $urlRouterProvider, $compileProvider, authorizationService) {

            $compileProvider.preAssignBindingsEnabled(true);

            $urlRouterProvider.otherwise('/');

            $stateProvider.state('home', {
                url: '/',
                template: '<home-component></home-component>',
                component: 'homeComponent',
                params: {
                    selectedFilter: undefined
                },
                resolve: {
                    ldapGroup: function (authorizationService) {
                        return authorizationService.getLdapGroup().then(
                            function successCallback(data) {
                                $scope.isAdOps = data;
                            },
                            function errorCallback(response) {
                                // called asynchronously if an error occurs
                                // or server returns response with an error status.
                                console.log(response);
                            }
                        );
                    }
                }
            })

I get:

Uncaught Error: [$injector:modulerr] Failed to instantiate module myApp due to:
Error: [$injector:unpr] Unknown provider: authorizationService




Creating graphics on website

I want to create an online whiteboard application but I can't figure out how to draw graphics like that on web

for reference : https://awwapp.com/#

This web app creates graphics and when you zoom in they don't get blurred out I inspected the element they use HTML-Canvas, but how ?




Augment not specified parameter

-error of argument not specified parameter appears in stored procedure Add_EC_Customers , where Add_EC_Customers stored procedure has 10 parameters but i need to insert only 5 parameters not 10 but i think error told me you must insert all parameters

Partial Class Register Inherits System.Web.UI.Page

Private Sub BTNReg_Click(sender As Object, e As EventArgs) Handles BTNReg.Click

    Using DSCustomers As New Dal.Customers.CustomersDataContext

Dim Customers = DSCustomers.Add_EC_Customers(TxtfirstName.Text, TxtLastName.Text, TxtUserName.Text, TxtEmail.Text, RdoGender.SelectedValue, DrpDwnCountry.SelectedValue, TxtPassword.Text)

    End Using




setTimeout funtion and drag and drop in html

I have an image. When I drag drop that image in a division, only then I want setTimeout function to run. Not before dropping the image.




Web-scraping Restaurant menu data

I am creating a mobile application where users are provided with a list of restaurants based on their location. I m using Google Maps API to get these results. However I wanted to enhance a bit further by providing the restaurant menu as well. The problem I am finding is that there are no stable API's that provides necessary data (restaurant menu). So I looked into web scraping. I can get the link to the restaurant menu restaurant_menu via Google Maps. Now I need to extract menu details from the page. Is web scraping the best option for this? I m unsure how to do this.




Redirect for nginx with args

How to make redirect from this https://client.root.com/client/#/service-select?serviceRef=2121030305507970382 to this: https://client.root.com/client/#/service-details?serviceRef=2121030305507970382&locationRef=372133208406979272&date=2018-04-07 ? Exactly from one to another url. Web server - NGINX




Font-Awesome CSS stylesheet appearing in chrome only

I am doing a freelancing website and i am using css html js and php The problem is when i refer to my font awesome css sheet in my local folders it opens great in google chrome

But when i open it in edge or firefox the icons of do not appear (facebook icon,instagram...)




Google Places API Web Service business

Is their a way to limit the Google Places API Web Service to only business places?

Regards




Bs Grids are overlapping in small screen size

The following code snippet is producing overlapping card and footers. I have included the webpage.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>hospitalHome</title>
  <link rel="stylesheet" href="css/font-awesome.min.css">
  <link rel="stylesheet" href="css/bootstrap.css">
  <link rel="stylesheet" href="css/style.css">
</head>
<body id="home">
  <nav class="navbar navbar-expand-sm bg-dark navbar-dark fixed-top">
    <div class="container">

          <span class="navbar-brand text-warning" style="font-size:30px;">Welcome </span>
          
           <span class="navbar-brand">Demo User</span>

      <button class="navbar-toggler" data-toggle="collapse" data-target="#navbarCollapse">
        <span class="navbar-toggler-icon"></span>
      </button>
      <div class="collapse navbar-collapse" id="navbarCollapse">
        <ul class="navbar-nav ml-auto">
                  
          <li class="nav-item">
            <button class="btn btn-outline-info"> Logout</button>
          </li>
        </ul>     
     </div>
    </div>
  </nav>
  
  
  <!-- HOME SECTION -->
  <header id="home-section" style="background-image:url('./img/hosp.jpeg');">
    <div class="dark-overlay">
      <div class="home-inner">
        <div class="container">
          <div class="row">
                  
            
                        <!-- UPDATE DETAIL CARD-->
                        
                        <div class="col-sm-4" style="opacity:0.9;">
              <div class="card bg-info text-center card-form ">
                <div class="card-body">
                  <h3 class="align-center">Update Detail</h3>
                  <p>Please fill out this form to update </p>
                  <form>
                    <div class="form-group">
                      <input type="password" class="form-control form-control-lg" placeholder="Mobile no.">
                    </div>
                    <div class="form-group">
                                                <span class="glyphicon glyphicon-calendar"></span>
                      <input type="password" class="form-control form-control-lg" placeholder="Date">
                    </div>
                    <input type="submit" class="btn btn-dark btn-block">
                  </form>
                </div>
              </div>
            </div>
                        
                        <!-- ADD DETAIL CARD-->

                        <div class="col-sm-4" style="opacity:0.9;">
              <div class="card bg-info text-center card-form">
                <div class="card-body">
                  <h3 class="align-center">Add Details</h3>
                  <p>Please fill out this form to add </p>
                  <form>
                    <div class="form-group">
                      <input type="password" class="form-control form-control-lg" placeholder="Mobile no.">
                    </div>
                    <div class="form-group">
                      <select class="form-control form-control-lg" placeholder="Blood Group">
                                                                                                                <option>Options:</option>
                                                                                                                <option>A</option>
                                                                                                                <option>B</option>
                                                                                                                <option>C</option>
                                                                                                                <option>D</option>
                                                                                                                <option>E</option>
                                                                                                                <option>F</option>
                                                                                                                <option>G</option>
                                                                                                                <option>H</option>
                                        </select>
                    </div>
                    <div class="form-group">
                      <input type="password" class="form-control form-control-lg" placeholder="Date">
                    </div>
                    <div class="form-group">
                      <input type="password" class="form-control form-control-lg" placeholder="City">
                    </div>
                    <input type="submit" class="btn btn-dark btn-block">
                  </form>
                </div>
              </div>
            </div>
                                                
                                <!--SEARCH FOR DATA -->
                                
                                
            <div class="col-sm-4">
              <div class="card bg-info text-center card-form">
                <div class="card-body">
                  <h3 class="align-center">Search for blood</h3>
                  <p>Please fill out these first</p>
                  <form>
                    <div class="form-group">
                      <select class="form-control form-control-lg" placeholder="Blood Group">
                                                                                                                <option>DATA</option>
                                                                                                                <option>A</option>
                                                                                                                <option>B</option>
                                                                                                                <option>C</option>
                                                                                                                <option>D</option>
                                                                                                                <option>E</option>
                                                                                                                <option>F</option>
                                                                                                                <option>G</option>
                                                                                                                <option>H</option>
                                        </select>
                    </div>
                    <div class="form-group">
                      <input type="email" class="form-control form-control-lg" placeholder="City">
                    </div>
                    <input type="submit" class="btn btn-dark btn-block">
                  </form>
                </div>
              </div>
            </div>
                        
                        
          </div>
        </div>
      </div>
    </div>
  </header>


  
  
  
  
  <!-- MAIN FOOTER -->
  <footer id="main-footer" class="bg-dark">
    <div class="container">
      <div class="row">
        <div class="col text-center">
          <div class="py-4">
            <h1 class="h3">Demo</h1>
            <p> Project &copy; 2017-18</p>
            <!--<button class="btn btn-primary" data-toggle="modal" data-target="#contactModal">Contact Us</button>-->
          </div>
        </div>
      </div>
    </div>
        
        
  </footer>
 <script src="js/jquery.min.js"></script>
  <script src="js/popper.min.js"></script>
  <script src="js/bootstrap.min.js"></script>
  
  </body>
  </html>

Problem Explanation: On reducing the size of window to tablet mode, the footer overlaps with the third card. On reducing the size further to mobile view, all the three cards overlaps and the footer too. Any help is highly appreciated.




How do I know if all matches within for loop with onChange too taking place

I want to know if all conditions inside the for-loop match, so that I can do something. However onChange() is blocking me.

jQuery code:

var arrayLength = array.length;
var count = 0;
for ( var i = 0; i < arrayLength; i++ ) {
    if(array[i].status == '0' ) {
        jQuery("#"+array[i].field+"_field").on('change', ( function(  dbvalue ) {
            return function(e) {
                if( e.target.value == dbvalue ) {
                    count++;
                } else {
                    count--;
                }
            };
        })(array[i].value));
    }
}

I have used count and if count matches array.length I want to do something. However with onChange() being called, count can decrease if value does not matches multiple times, hence the incorrect logic.

if(count == arrayLength) {
    alert('success');
} else {
   alert('Failure');
}

What could be the solution?




bind root-component in a child-component in angular2

i need to bind root component in a child component and when click appropriate link a popup will appear and display root component data enter image description here

Loading...</project-app>-->

                                <project-app 
                                             section_type="LINK" page_type="projectPageType"section="projectSection"
                                            project_id="newprojectId"client_id="newclientId"
                                              is_expand="true">Loading...</project-app>

                                <!--<project-app sectionType="LINK" pageType="projectPageType" section="projectSection"
                                             projectId="newprojectId" clientId="newclientId"
                                             projectName="projectName">Loading...</project-app>-->


                            </section>

added inside activity.html page and called related functions but data not loading




How to set up a condition in a html type form?

How I set up a condition that requires a date as dd/mm/yyyy and for a gender (male/female or other)? I make this input type for the style with the other input type, but I want to set a condition to validate this fields.

     <div class="input-container input9">
      <input type="#{type}" id="#{label}" required="required"/>
      <label for="#{label}">gender</label>
      <div class="bar"></div>
     </div>
     <div class="input-container input10">
        <input type="#{type}" id="#{label}" required="required"/>
        <label for="#{label}">date of birth</label>
        <div class="bar"></div>
     </div>




Steps to get hosted reactjs website?

I'm creating a reactjs web application project with create-react-app. Now it's all most ready. I did little research about how to get hostname and all. I found that https://www.netlify.com/ from this website I can able to host my website. Can anyone suggest which file I required to provide them. Like main index.js or what? Or I need to upload my whole project folder?? And what are the steps for it! Like FTP configuration and all.




How do Alison, Khanacademy and other elearning platforms upload, save and display their courses?

I have a few ideas but nothing concrete.

The platform needs to be able to build presentations and assessments.

Also upload premade files to use. Eg. Using a spreadsheet.

The only few platforms I have found that do the same are e-learning sites.

Any insights would be much appreciated.




Alert box not working in php

This is my contact-form-handler.php file. After clicking submit button, I want an alert in PHP. I am receiving Mail successfully and redirect to my main page but without an alert message. How can I use the alert box in PHP?

My form is working fine, but this time I stucked in this simple task.

<?php 
    if(isset($_POST['submit'])){
        //$companyMail = 'enesh@gmail.com';
        $to = "eneshpal@gmail.com"; // this is your Email address
        $customerMail = $_POST['formEmail']; // this is the sender's Email address
        $first_name = $_POST['formFirstName'];
        $last_name = $_POST['formLastName'];
        $phone = $_POST['formPhone'];
        $text = $_POST['formText'];
        /* foreach($_POST['project_type'] as $project_type_value){} */
        $projectType = implode(', ',$_POST['project_type']);
        $scopeProject = implode(', ',$_POST['scope_project']);
        $project_type_Str = 'Project Type : '.$projectType;
        $scope_project_Str = 'Scope of Project : '.$scopeProject;
        $subject = "Form Submission";
        $message = "Hi, \n\n";
        $message .= "First Name: ".$first_name . "\nLast Name: " . $last_name . " \nEmail: " . $customerMail . " \nPhone : " . $phone . "\nDescription: " . $text . "\n";
        $message .=  $project_type_Str."\n";
        $message .= $scope_project_Str;
        //$message2 = "Here is a copy of your message " . $first_name . "\n\n" . $_POST['message'];
        //$headers = "From:" . $companyMail;
        //$headers2 = "From:" . $to;
        if(mail($to,$subject,$message)){
            //echo 'Mail Sent';
            //$message = "Thanks, We Will Contact you Shortly";
            //echo "<script type='text/javascript'>alert('$message');</script>";
            echo "<script>alert('Thanks, We Will Contact you Shortly');</script>";
            header('Location:get_estimation.php');
        }else{
            echo 'Mail Not Sent';
        }
        //mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender
        /*if( "Mail Sent. Thank you " . $first_name . ", we will contact you shortly.")
        else die; */
        // You can also use header('Location: thank_you.php'); to redirect to another page.
    }
?>




Unable to add county, state and city dropdown using api by https://ift.tt/2ijZQWB

I used following code snippet to add city with help of country and state filters.

<select name="country" class="countries" id="countryId">
    <option value="">Select Country</option>
</select>
<select name="state" class="states" id="stateId">
    <option value="">Select State</option>
</select>
<select name="city" class="cities" id="cityId">
    <option value="">Select City</option>
</select>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> 
<script src="//geodata.solutions/includes/countrystatecity.js"></script>

I get following errors in my console Any help is highly appretiated

Failed to load file://geodata.solutions/api/api.php?type=jquery.min.js:4 getCountries&addClasses=order-alpha%2Cinclude-: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.

Failed to load file://geodata.solutions/api/api.php?type=jquery.min.js:4 getCountries&addClasses=order-alpha%2Cinclude-: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.




add missing google maps place through code

I am able to add a missing place through google maps website or app, but i want some API or a way, by which i can add a place and all its description through a separate android app. I have tried Google places api add feature(deprecated) but it only add corresponding to a API key i.e visible to a specific app, I want to add directly to google's database so that the place i add is visible globally i.e it is visible not only in my app but also in google maps. I don't care how many verfications or time google may take in its queue because info will be geniune.




anybody know how to change colors of labels in tredingView charts?

Anybody know how to change colors of labels in tredingview charts or replace theme to dark?

https://prnt.sc/ixwpv2

function initTradingView(pair, minutes, id) {
    var widget = window.tvWidget = new TradingView.widget({
        fullscreen: false,
        width: "100%",
        symbol: pair,
        debug: false,
        interval: minutes,
        timeframe: '1D',
        container_id: id,
        datafeed: new Datafeeds.UDFCompatibleDatafeed("http://igt-crypto.net/api/feed", 5000),
        style: "1",
        // withdateranges: true,
        toolbar_bg: "#292d44",
        library_path: "/charting_library/",
        locale: "ru",
        drawings_access: {type: 'white', tools: [{name: "Regression Trend"}]},
        disabled_features: ['left_toolbar', 'header_symbol_search', 'header_resolutions', 'header_interval_dialog_button', 'show_interval_dialog_on_key_press', 'header_chart_type', 'header_settings', 'header_indicators', 'header_compare', 'header_undo_redo', 'header_fullscreen_button', 'header_saveload', 'header_screenshot', 'timeframes_toolbar', 'go_to_date', 'legend_context_menu', 'edit_buttons_in_legend', 'display_market_status', 'adaptive_logo', 'show_logo_on_all_charts'],
        overrides: {
            "symbolWatermarkProperties.color": "rgba(0, 0, 0, 0)"
        },
        loading_screen: {backgroundColor: "#292d44"},
        border_around_the_chart: 'off'

    });
}

https://www.tradingview.com/

I dont understand their documentation...




How to view a table with MVC (C# Web App) that has SQL data? (Visual Studio)

I would like to display data from my SQL Database (Client Server) in a table, in my MVC Web Application.

However, I can't find a good tutorial to help me with displaying the data. I have followed this tutorial. But in the end, in the Application_Start method, they use a SampleData class (with data) that was created in a previous tutorial that has nothing to do with the SQL Database. So, no table that displays the actual SQL data.

If anyone knows any good tutorials or can look up the tutorial and tell me what to do with the same base that was used, it would be awesome. Thanks!

PS : My Web App has C#, HTML and javascript code.




What is the best technologies in 2018 to build a social media website for job seeker?

I want to build a social media website for a career path and job search. Also, it has a learning path. so which is the best technology which I can use to build the website. -Best Programming languages -Best database -Error detecting tools




mercredi 28 mars 2018

How to change element value by comparing another xml using xslt

I have below xml 1 and xml2. I want compare </publication> from xml1 with xml2 and update <price> in xml1 with the value present in xml2.Please help me out,I have stored whole xml2 in one variable and parse through it inside a template which looks for match="book" its adding new tag inside but not updating existing one.

XML-1

<books>
<book>
<name>abc</name>
<publication>triangle</publication>
<price></price>
</book>
<book>
<name>def</name>
<publication>rectangle</publication>
<price></price>
</book>
</books>

xml-2

<resource>
<prices>
<publication>triangle</publication>
<price>100</price>
<prices>
<prices>
<publication>rectangle</publication>
<price>200</price>
<prices>
</resource>

expected output

<books>
    <book>
    <name>abc</name>
    <publication>triangle</publication>
    <price>100</price>
    </book>
    <book>
    <name>def</name>
    <publication>rectangle</publication>
    <price>200</price>
    </book>
    </books>




Build a custom map of a place and display it in an app

I need to creat and save a custom map in a web interface, then display it in a mobile aplication and show the position in there.

What tecnologies should I use?




copied jersey signature, but the 2nd isn't reached

I have this jersey java code on the server:

    @Path("/Voices")
    public class VoicesOperation {

        @Path("/search")
        @GET
        @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
        public List<VoiceUi> search(@QueryParam("q") String searchTerm) throws Exception {
...
    }


    @Path("/searching")
        @GET
        @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
        public List<VoiceUi> searching(@QueryParam("q") String searchTerm) throws Exception {
...
    }

I copied the same method twice and changed the name for the 2nd

I try to call

http://localhost:8860/Elton/Voices/search

which worked.

but

http://localhost:8860/Elton/Voices/searching

haven't.

i get in the server an error:

javax.ws.rs.NotFoundException: HTTP 404 Not Found

what am i missing?

same method was copied twice. I restarted the server of course.




Python: Problems with a directory web and files

How can I use python files that are stored in a web directory? That is, I want to access python files that are in a web directory, to later use them to create another file. I dont know how do this, and it's so important to me.

Please Help!




Can I change content on my website remotely?

Can I change content on my website remotely? (Like paragraphs or divs) I think this is possible, and if yes, how?




Java call web service issue - javax.servlet.ServletException: java.lang.NullPointerException

I get an error when I call the service. I tried every solution I could find

Full text of the error:

SEVERE: Servlet.service() for servlet [Jersey RESTful Application] in context with path [/sove] threw exception [java.lang.NullPointerException] with root cause java.lang.NullPointerException at com.sun.xml.internal.bind.v2.runtime.reflect.ListTransducedAccessorImpl.useNamespace(ListTransducedAccessorImpl.java:63) at com.sun.xml.internal.bind.v2.runtime.property.AttributeProperty.hasSerializeURIAction(AttributeProperty.java:96) at com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.link(ClassBeanInfoImpl.java:232) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.(JAXBContextImpl.java:348) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.(JAXBContextImpl.java:124) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1123) at com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:147) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:247) at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:234) at javax.xml.bind.ContextFinder.find(ContextFinder.java:462) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:641) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:584) at org.glassfish.jersey.jaxb.internal.AbstractJaxbProvider.getStoredJaxbContext(AbstractJaxbProvider.java:259) at org.glassfish.jersey.jaxb.internal.AbstractJaxbProvider.getJAXBContext(AbstractJaxbProvider.java:251) at org.glassfish.jersey.jaxb.internal.AbstractJaxbProvider.getMarshaller(AbstractJaxbProvider.java:218) at org.glassfish.jersey.jaxb.internal.AbstractJaxbProvider.getMarshaller(AbstractJaxbProvider.java:185) at org.glassfish.jersey.jaxb.internal.AbstractRootElementJaxbProvider.writeTo(AbstractRootElementJaxbProvider.java:163) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:265) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:250) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162) at org.glassfish.jersey.server.internal.JsonWithPaddingInterceptor.aroundWriteTo(JsonWithPaddingInterceptor.java:106) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162) at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundWriteTo(MappableExceptionWrapperInterceptor.java:86) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162) at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1128) at org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(ServerRuntime.java:664) at org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:421) at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:411) at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:308) at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) at org.glassfish.jersey.internal.Errors.process(Errors.java:315) at org.glassfish.jersey.internal.Errors.process(Errors.java:297) at org.glassfish.jersey.internal.Errors.process(Errors.java:267) at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317) at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:288) at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1110) at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:401) at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:386) at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:335) at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:222) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:861) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748)

I have a jax-rs web service like:

@GET
@Path("/getAnalyzedMatches")
@Produces(MediaType.APPLICATION_XML)
public static AnalyzeResponseModel getAnalyzedMatches() throws ClassNotFoundException, SQLException {
    AnalyzeResponseModel response = new AnalyzeResponseModel();
    List<AnalyseResultModel> analyzedMatches = SoveMatchesUtil.getAnalyzedMatches();
    /* try to set object */
    List<Object> objectList = new ArrayList<>();
    for (AnalyseResultModel item : analyzedMatches) {
        objectList.add(item);
    }
    response.setList(objectList);
    return response;
}

Here is my Response Model:

package com.sove.model;

import java.util.List;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "list")
public class AnalyzeResponseModel {
    List<Object> list;

    public AnalyzeResponseModel() {
    }

    public List<Object> getList() {
        return list;
    }

    @XmlAttribute
    public void setList(List<Object> list) {
        this.list = list;
    }

}

Here is my pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>sove</groupId>
<artifactId>sove</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.5.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>3.0.0</version>
            <configuration>
                <warSourceDirectory>WebContent</warSourceDirectory>
            </configuration>
        </plugin>
    </plugins>
</build>
<dependencies>

    <dependency>
        <groupId>javax.ws.rs</groupId>
        <artifactId>javax.ws.rs-api</artifactId>
        <version>2.0.1</version>
    </dependency>
    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>jaxrs-api</artifactId>
        <version>3.0.12.Final</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.bundles</groupId>
        <artifactId>jaxrs-ri</artifactId>
        <version>2.17</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.lucee/postgresql -->
    <dependency>
        <groupId>org.lucee</groupId>
        <artifactId>postgresql</artifactId>
        <version>8.3-606.jdbc4</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/log4j/log4j -->
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>

</dependencies>

And here is my web.xml

<?xml version = "1.0" encoding = "UTF-8"?> 
<web-app xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"  
   xmlns = "http://java.sun.com/xml/ns/javaee"  
   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee  
   http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"  
   id = "WebApp_ID" version = "3.0"> 
   <display-name>sove</display-name> 
   <servlet> 
      <servlet-name>Jersey RESTful Application</servlet-name> 
      <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class> 
      <init-param> 
         <param-name>jersey.config.server.provider.packages</param-name> 
         <param-value>com.sove.service</param-value> 
      </init-param> 
   </servlet> 
   <servlet-mapping> 
      <servlet-name>Jersey RESTful Application</servlet-name> 
      <url-pattern>/*</url-pattern> 
   </servlet-mapping>   
</web-app>

Thanks for your help.




Running a Python script upon HTML submit

I have a python script that uses a string argument to render a png for display. I'm using a Flask server to handle this; users can press 'Submit' and the script will run based off user input. However, I'm starting to think this is not the right way to go about this. If multiple users are using the site, won't the image be overriden? Is there a more appropriate way to perform this task?




How to validate model conditionally in web api and onion architecture?

I have two json file in which there are properties like isVisible and isReqired for two different scenario. For example in jsonfile1 DOB Has visible true and required is true and in jsonfile2 DOB is visible but not required. Now I have implemented Fluent Api validation to validate my request in api layer. My first doubt is ... is it right palce to valodate request or it is need to valodate at core layer. My second issue is that I have ckndionally load my json file but I have no ide how I validate my request condionally.

I am very new in c# and web api... can someone please suggest me how to achieve above mentioned scenario.




Return images back to normal when user scrolls to top again

I have 2 static (html position: fixed;) images at the edges of the screen (right and left). When users scrolls more than 100 pixels from top, these edges retract 50 pixels.

I want to them to reappear (normal again, as they were at the beginning) when users scrolls back to top. I tried adding boolean value which is true when they retract and added it to condition when they need to reappear again. But it isn't working. Why?

userHasScrolled = false;

$(document).ready(function(){
 $(window).scroll(function(){
 if ($(window).scrollTop() > 100) {
  $(".rightstatic").animate({marginRight:'-50px'}, 900);
  $(".leftstatic").animate({marginLeft:'-50px'}, 900);
  userHasScrolled = true;
 }
 });
});

if($(window).scrollTop() <= 0 && userHasScrolled) {
  $(".rightstatic").animate({marginRight: '+50px'}, 400);
  $(".leftstatic").animate({marginLeft:'+50px'}, 400);
  userHasScrolled = false;
}




Password protected web page with c# and visual studio

I need there to be a section that a user can sign into with a spesific username and password, gaining access to features like adding removing and updating a database




About loading the data in localhost is too low in a MEAN web app

sorry about my English, i know it's too bad but i hope you can know my problem I am a beginner and i started to learn my full-stack course with the book "getting mean with mongo express angular and node" by Simon Holmes I followed all the page and i get my result that can be the same as the author do. My problem is: if i run my app on localhost:3000, the locations are loaded in the right way enter image description here

but after i clicked on a location, then i clicked to the Loc8r's icon, the homepage is checking enter image description here It costs a lot of time to load the data like it was before i click the location's detail, but it still load the data I'm sure that i do everything correctly in the book, but i can't know why the locations are loaded so low like that. Thank you!




Computer Web browser fonts cannot reads

I am try to read "Sinhala" language web page and I can't see letters. Instead of showing letters it's showing squares. Please advise. Thanks in advanced.

Regards, Aja




sensor data printing on webserver(python-flask)

I want to print sensor data on web server with using import flask in raspberry pi. I receive sensor data from arduino to raspberry pi via bluetooth and this is code.

#! /usr/bin/python
import bluetooth
bd_addr=Mac Address
port=1
sock=bluetooth.BluetoothSocket(bluetooth.RFCOMM)
sock.connect((bd_addr,port))
data=""

while 1:
  try:
    data +=sock.recv(1024)
    data_end=data.find('\n')
    if data_end!=-1:
      rec=data[:data_end]
      print data
      data=data[data_end+1:]
  except KeyboardInterrupt:
    break
sock.close()

And If I run this code in Genie I can print sensor data in terminal. And I want to print this sensor data in web page with using import flask. How can I print in web server?




javax.ws.rs.NotFoundException: HTTP 404 Not Found angular 1.5

i have this client angular 1.5 code

    var getGroupForUser = function () {
        var deferred = $q.defer();
        $http.get(env.domain+'/Voices/authorize').then(
            function successCallback(response) {


                // self.isAdOps = response.data.;

                deferred.resolve(response.data);

            }, function errorCallback(response) {
                console.log(response.data.errorMsg);
                self.isAdOps = true;
                deferred.reject("data: "+response.data+" code:"+response.status+" "+response.statusText+", please look at the web console");
            });
        return deferred.promise;
    };

and this jersey java code on the server:

@Path("/Voices")
public class VoicesOperation {

    @Path("/search")
    @GET
    @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
    public List<VoiceUi> search(@QueryParam("q") String searchTerm) throws Exception {...
}


    @Path("/authorize")
    @GET
    @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
    public String authorize() {

        logger.info("in voicesOperation - authorization");
        logger.error("checking error log ==== in voicesOperation - authorization");

However i get in the server an error:

javax.ws.rs.NotFoundException: HTTP 404 Not Found

what am i missing?




Where do i start in backend programming? [on hold]

I have been doing front end devleoping for close to 2 months and really want to learn backend because of the cocneptual thinking that goes into it. It seems very interesting.

I have experience with Javascript and have used DOM manipulation, so i have a knowledge in that.

I see the growing popularity in node.js and i would want to learn that as a start and progress further. I am just stuck on where i can start for backend. What can i start off doing with node.js on an application and what other applications can i do after to work my way up?




Google Analytics - How to show location for each user id?

When I click on "User Explorer", I see list of User Id. When I click on a user id, I reach a "User Report" page, but there's no information on the location of this user.

What would be the best way to find out the location of each user? Or in which cities this user-id has accessed the web?




What are the benefits of using Node js in laravel project?

i hope you'll doing well. I've never used nodejs and i know it's a JavaScript engine the make the app work faster... but i still don't understand how that happens and what is the proper way to use it in a Larvel project. And..is there any possibility of problems if i use nodejs. If i decide to stop using it in my project later what would happen then? Please give me an outline so i can decide.

My application is going to be used in SaaS mode which gives an idea of the requirements.




Organizing Code in Web Develpment [on hold]

this is my first post on Stack Overflow so treat me well ;).

I've been using php to organize my code for quite a while now, and by this I mean I have separate php folders for things such as my navigation, footer etc and then just include that specific file in the correct spot to save me having to insert the whole chunk of code again.

From a organization point of view, I like this method as it's also a lot cleaner, but how does this change things in terms of performance of the website?

Thanks, Cameron




Cloud vision Web Detection in Android

Hi i have been implementing an application to detect image from Cloud Vision. I have a sample source code for detecting Data's in the following link,

https://github.com/GoogleCloudPlatform/cloud-vision/blob/master/android/CloudVision/app/src/main/java/com/google/sample/cloudvision/MainActivity.java

But this one doesn't have an option to detect Web Entities from cloud so can anyone help me to let me know the possibilities of cloud detection with Android SDK given in the link.

Thanks in advance.




Interactive Web design using Reactjs

I want to develop an interactive portfolio website like this http://www.rleonardi.com/interactive-resume/. Is there any Javascript library or npm package to develop a site like this..?

Thanks in advance.




How to call a selenium class from HTML file?

I am developing automation web-based testing framework. I want to know how to use and call class and methods from HTML file?




How put two p element next to each other [duplicate]

This question already has an answer here:

How can i put two p elements next to each other,

Using inline method every line in p element gets serrated so what is the correct way? "i can't find any question on it" here is my code on this

body {
  margin: 0;
  padding: 0;
}

.div1 {
  width: 100%
}

p {
  margin: 0;
}

.p1 {
  width: 50%;
  background: rgb(136, 224, 220);
}

.p2 {
  width: 50%;
  background: rgb(114, 235, 131);
}
<div class="div1">
  <p class="p1">
    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
    survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing
    software like Aldus PageMaker including versions of Lorem Ipsum.
  </p>
  <p class="p2">
    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
    survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing
    software like Aldus PageMaker including versions of Lorem Ipsum.
  </p>
</div>



Adding condition block in Activity diagram using gojs

I would like to make an activity diagram like image below, please someone help ! i have Tried gojs but i would like to make a conditionnel block (yes/no)

here is the screenshots: https://imgur.com/a/eQTgR




Generating alert on an image on web page

How to generate an alert on an image after certain time periods on a web page? Or how to show a frame on an image after certain periods of time on a webpage?




Span breaks complex text shaping in HTML

For example I want to set the background color of some glyph in a complex text layout https://en.wikipedia.org/wiki/Complex_text_layout to a different color, Then the only way is to use a span. Then it will breaks text shaping.

Is there a way to avoid this?

Or is there something needs new web API?




Get external resources from html code

I'm trying to build a simple web proxy to retrieve some webpage content and proxy all further requests. i can do that quite well with javascript requests by overriding the native functions like xhr , appendchild , .... but for the html resources like <img src...> or <script src..> ... i cant do nothing , so my question is if there's a way to "render" the html via javascript and extract all the resources and proxy the url or should i do that server side?




How Can I make a button clickable in video full screen

I have a wordpress page and html5 video and a paypal donation widget I want to make it clickable when in fullscreen I have already made it visible and clickable when not in fullscreen but when in fullscreen and i click on it it just plays the video here is the page: http://theposturesaver.com/bretching-video/ here is the page code:

<div style="width: 50%; float: left;">
<h6>Please make sure to watch the video in its entirety at least once . This will ensure that you will enjoy all the benefits of this powerful therapeutic technique</h6>
[video width="640" height="360" mp4="http://theposturesaver.com/wp-content/uploads/2018/03/Bretching.mp4" id="myVideo" controls="controls"][/video]
<div class="btd" style="width: 150px; text-align: center; display: none; position: absolute; margin-top: -370px; margin-left: 200px; z-index: 2147483647;"><form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input name="cmd" type="hidden" value="_s-xclick" />
<input name="hosted_button_id" type="hidden" value="5TKNPWWBH73VL" />
<p style="color: white; font-weight: bold; width: 550px; margin-left: -170px; font-size: 15px;">OUR PROJECT CANNOT BE SUCCESSFUL WITHOUT YOUR HELP, WE ARE HONORED THAT YOU ARE CONSIDERING MAKING A CONTRIBUTION.</p>
<input alt="PayPal - The safer, easier way to pay online!"  type="image" src="http://www.freepngimg.com/download/paypal_donate_button/8-2-paypal-donate-button-high-quality-png.png" value="submit" />
<img src="http://www.freepngimg.com/download/paypal_donate_button/8-2-paypal-donate-button-high-quality-png.png" alt="" width="1" height="1" border="0" />

<h6 style="color: white; width: 550px; margin-left: -170px;">WHEN YOU ARE GOOD TO OTHERS YOU ARE BEST TO YOURSELF</h6>
</form></div>




<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

<script>
    /*<![CDATA[*/ $(document).ready(function(){ $('video').on('ended',function(){ 
if( (screen.availHeight || screen.height-30) <= window.innerHeight) {
$('.btd').css('margin-top', '-235px');
$('.btd').css('margin-left', '500px');
}
else{
$('.btd').css('margin-top', '-370px');
$('.btd').css('margin-left', '200px');
}
$('.btd').css('display','block'); $('video').css('opacity','0'); }); $('video').on('pause',function(){ 
if( (screen.availHeight || screen.height-30) <= window.innerHeight) {
$('.btd').css('margin-top', '-235px');
$('.btd').css('margin-left', '500px');
}
else{
$('.btd').css('margin-top', '-370px');
$('.btd').css('margin-left', '200px');
}
$('.btd').css('display','block'); $('video').css('opacity','0'); }); $('video').on('play', function() { 
if( (screen.availHeight || screen.height-30) <= window.innerHeight) {
$('.btd').css('margin-top', '-235px');
$('.btd').css('margin-left', '500px');
}
else{
$('.btd').css('margin-top', '-370px');
$('.btd').css('margin-left', '200px');
}
$('.btd').css('display','none'); $('video').css('opacity','1'); }); }); /*]]>*/
$('video').on('mouseover', function(){
if( (screen.availHeight || screen.height-30) <= window.innerHeight) {
$('.btd').css('margin-top', '-235px');
$('.btd').css('margin-left', '500px');
}
else{
$('.btd').css('margin-top', '-370px');
$('.btd').css('margin-left', '200px');
}
})
$(document).on('webkitfullscreenchange mozfullscreenchange fullscreenchange', function(){
if( (screen.availHeight || screen.height-30) <= window.innerHeight) {
$('.btd').css('margin-top', '-235px');
$('.btd').css('margin-left', '500px');
}
else{
$('.btd').css('margin-top', '-370px');
$('.btd').css('margin-left', '200px');
}
})
</script>

</div>




ubuntu, web crawler source code module error

I just started Python3

i am getting a link to the title of the article from the Search for newspaper articles page

windows, ubuntu AII Trying to compile...

I think there is a problem with the bs4(BeautifulSoup) module

I don't know how to solve this problem

enter image description here

source code link : https://drive.google.com/file/d/1_UU6x5iP7fLcB-MsHIrwGQ-eKKjsJ0s6/view

enter link description here




mardi 27 mars 2018

Structuring json data in GET call query parameters

I'm trying to pass a list of the following objects as query params to a GET call to my Java service:

{
    "id": "123456",
    "country": "US",
    "locale": "en_us"
}

As a url, this would like like

GET endpoint.com/entity?id1=123456&country1=US&locale1=en_us&id2=...

What's the best way to handle this as a service? If I'm passing potentially 15 of these objects, is there a concise way to take in these parameters and convert them to Java objects on the server side?

I imagine with a URL like this, the service controller would have a lot of @QueryParams...




C#: How to grab specific data from a string?

I grab the html from a website entered by the user from a textbox using the WebClient class. I want to grab the title from the website, but I don't know how to do it. I have researched, but I still can't find the answer. Can anyone shed some light on my problem?




Android Web Site make Phone Call whit parameters

I created a web site whit some phonenumbers inside; im using the tag:

< a href="Tel:+55555555555,20703%23,109837%23,2%23,,1" >Home< /a >

where: Tel:+55555555555 is the phone number,

20703%23,109837%23,2%23,,1: parameters

I need send the paremeters to a IVR; it´s work on all version less in the 5 and 6 de Android.

Do you have some idea.




C++ Web Request Crash

I'm working on a pretty big project that also involves making some get requests, pulling data from websites etc. For that this library: [CHttpClient] is used.

Sometimes when web requests are made like shown below, the program just crashes without any verbal error message or anything like that. When I looked at the previously used strings in memory in ollydbg, there were some blocks that had tons of '??????' in them. I suspect that somewhere there is an overflow occuring, but I cannot for the life of it figure out where. Also setting a try / catch around the code segment in question does not help. It would be great if you could point me into a direction, as the last resort I see would be to switch up the library.

This right below is the "top level" call that's being made.

if (!HttpUtils::makeGetRequest(L"https://calendar.yahoo.com", outCookies, response))
        return false;

(outCookies is a NameValueMap (defined below) with the users cookies, response is a std::wstring in which the response is stored)

typedef std::map<std::wstring, std::wstring> NameValueMap;

I have a HttpUtils.cpp class that handles the HTTP requests. Source code for that is as follows (the commented out MessageBoxes are for debugging purposes)

The makeRequest method is the one in question

#include "HttpUtils.h"
#include <memory>

using namespace andrivet::ADVobfuscator;

bool Utilities::HttpUtils::makePostRequest(const wchar_t* url, NameValueMap& postData, NameValueMap& cookies, std::wstring& outResponse)
{
    return makeRequest(url, REQUEST_TYPE::POST, postData, cookies, NameValueMap(), outResponse);
}

bool Utilities::HttpUtils::makePostRequest(const wchar_t* url, NameValueMap& postData, std::wstring& outResponse)
{
    return makeRequest(url, REQUEST_TYPE::POST, postData, NameValueMap(), NameValueMap(), outResponse);
}

bool Utilities::HttpUtils::makeGetRequest(const wchar_t* url, std::wstring& outResponse)
{
    return makeRequest(url, REQUEST_TYPE::GET, NameValueMap(), NameValueMap(), NameValueMap(), outResponse);
}

bool Utilities::HttpUtils::makeGetRequest(const wchar_t* url, NameValueMap& cookies, std::wstring& outResponse)
{
    return makeRequest(url, REQUEST_TYPE::GET, NameValueMap(), cookies, NameValueMap(), outResponse);
}


bool Utilities::HttpUtils::makeRequest(const wchar_t* url, REQUEST_TYPE type, NameValueMap& postData, NameValueMap& cookies, NameValueMap& headers, std::wstring& outResponse)
{
    CHttpClientW httpClient;
    std::unique_ptr<CHttpResponseW> response;
    std::wstringstream responseStream;
    bool redirect_flag = true;
    std::wstring cur_url = url;


    try
    {
        //Add default user agent
        httpClient.SetInternet(L"Mozilla/5.0 (compatible; Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1");

        //Add post data if needed
        for (auto postEntry : postData)
            httpClient.AddParam(postEntry.first.c_str(), postEntry.second.c_str());


        //Add header if needed
        for (auto header : headers)
            httpClient.AddHeader(header.first.c_str(), header.second.c_str());


        while (redirect_flag)
        {
            //Add cookies if needed
            for (int i = 0; i < httpClient.GetHeaderCount(L"Cookie"); i++)
                httpClient.RemoveHeader(L"Cookie"), i;

            if (cookies.size())
            {
                std::wstring cookieString = getCookieString(cookies);

                httpClient.AddHeader(L"Cookie", cookieString.c_str());
            }

            //Check if cur_url is good
            if (cur_url.size() > 4 && cur_url.substr(0, 4) != L"http")
            {
                std::wstring baseUrl;

                if (cur_url[0] == L'/')
                {
                    //Need to construct URL adding baseURL
                    if (!getBaseUrl(url, baseUrl))
                        return false;

                    cur_url = baseUrl + cur_url;
                }
                else
                {
                    // TODO: What shall I do ?!

                    return false;
                }
            }

            //Perform request
            if (type == GET)
            {
                //MessageBox(0, cur_url.c_str(), L"CUR_URL REQ", 0);
                try
                {
                    response.reset(httpClient.RequestGet(cur_url.c_str()));
                }
                catch (std::overflow_error &err)
                {
                    MessageBoxA(0, "ERROR", "Debug", 0);
                }
            }
            else
                response.reset(httpClient.RequestPost(cur_url.c_str()));

            if (response->GetStatus() == 302)
            {
                MessageBoxA(0, "Redirect", "Debug", 0);
                redirect_flag = true;

                if (response->GetHeaderCount(L"Location") == 0)
                    return false;

                //Update next url
                cur_url = response->GetHeader(L"Location", 0);

                //Update cookies if needed
                handleSetCookie(response.get(), cookies);
            }
            else
            {
                redirect_flag = false;
                //Get response text
                if (Ryeol::Utils::getResponseContent(response.get(), responseStream, 8192))
                {
                    outResponse = responseStream.str();
                    //MessageBox(0, outResponse.c_str(), L"Printing outResponse", 0);
                    responseStream.clear();

                    return true;
                }
            }
        }
    }
    catch (httpclientexception& e) {
        return false;
    }

    return false;
}

void Utilities::HttpUtils::handleSetCookie(CHttpResponseW* response, NameValueMap& inOutCookies)
{
    int count = response->GetHeaderCount(L"Set-Cookie");

    for (int i = 0; i < count; i++)
    {
        std::wstring curSetCookie = response->GetHeader(L"Set-Cookie", i);
        std::wstring name, value;

        if (getCookieFromSetCookie(curSetCookie, name, value))
            inOutCookies[name] = value;
    }
}

bool Utilities::HttpUtils::getBaseUrl(const std::wstring& url, std::wstring& outBase)
{
    const std::wstring protocol_end = L"://";
    const int offs1 = url.find(protocol_end);

    if (offs1)
    {
        //Get next '/'
        const int offs2 = url.find(L'/', offs1 + protocol_end.size());

        outBase = url.substr(0, offs2);

        return true;
    }

    return false;
}

std::wstring Utilities::HttpUtils::getCookieString(NameValueMap& cookies)
{
    CHttpEncoderW encoder;
    std::wstring cookieString;

    for (auto cookie : cookies)
    {
        size_t encodedSize = encoder.UrlEncodeLenW(cookie.second.c_str());
        //PWSTR encodedBuf = new WCHAR[encodedSize];

        //Add name as it is
        cookieString += cookie.first;
        cookieString += L"=";

        //URL encode cookie value
        //encoder.UrlEncodeW(encodedBuf, cookie.second.c_str());

        //Add encoded value to cookieString
        cookieString += cookie.second;
        cookieString += L"; ";

        //Release encodedBuf
        //delete[] encodedBuf;
    }

    return cookieString;
}

bool Utilities::HttpUtils::getCookieFromSetCookie(std::wstring& setCookie_str, std::wstring& outName, std::wstring& outValue)
{
    int offset1 = setCookie_str.find(L"=");
    int offset2 = setCookie_str.find(L";", offset1);

    if (offset1 != std::wstring::npos && offset2 != std::wstring::npos)
    {
        outName = setCookie_str.substr(0, offset1);
        outValue = setCookie_str.substr(offset1 + 1, offset2 - offset1 - 1);

        return true;
    }

    return false;
}

Thanks in advance for your help!