#StackBounty: #html #vb.net #response.write #view-source Why is my debug msg not being written into my page?

Bounty: 50

I’ve got some debug msgs (written via Response.Write()) that I can see when I do a “View Source” like so (within VB code):

currentYear = Year(Now)
SQLString = "Select NewBiz from MasterUnitsprojSales where CYear = " & currentYear & " and Unit = '" & Unit & "'"
adoRS = New ADODB.Recordset
adoRS.Open(SQLString, adoCon)
IsNewBusiness = TRUE 'default (if record not found)
Category = "New Business"
If Not adoRS.EOF Then
    IsNewBusiness = adoRS.Fields.Item(0).Value <> 0 
    if Not IsNewBusiness
            Category = "Existing Business"
    End If
    Response.Write("<!-- IsNewBusiness after NOT EOF assignment = " & CStr(IsNewBusiness) & "-->")
End If
adoRS.Close()

-and (within hmtl):

<% Response.Write("<!-- Is New Biz = " & IsNewBusiness & "-->") %>

I can see these messages when I go to the page and “View Source”

But I have other similar instances that are not being written out, such as:

If Request.Form.Item("Action") = "Save" Then
    Response.Write("<!-- Made it into the Action =Save block -->")
    . . .

I know this block is bring reached, because the logic in it is taking place (database inserts).

Why would the Response.Write() not always work?


Get this bounty!!!

#StackBounty: #php #html #http-status-code-406 PHP – Not Acceptable – 406 – file could not be found on this server

Bounty: 50

I am getting this error

Not Acceptable

An appropriate representation of the requested resource
/admin/prc_res.php could not be found on this server.

Additionally, a 406 Not Acceptable error was encountered while trying
to use an ErrorDocument to handle the request.

There is a $_POST['additionalinfo'] (from html teaxtarea) which is giving me this error. If I remove this, code works fine.

But why I am getting 406 error?

My index1.php in unnat1ir.in/cdn/

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>406 Error</title>
</head>
<p><form method="post" action="process.php">
<textarea name="test" rows="10" style="width:100%"></textarea><br>
<button type="submit">Check for 406 Error</button>
</form>
</p>
<p>This form is posted to <code>process.php</code>. In <code>process.php</code> I am just echo-ing <code>$_POST['test']</code> of the <code>textare with tinymce plugin</code>. <strong>If little amount of data is entered in textarea, no issues, BUT LARGE DATA will cause <code>406</code> error</strong></p>
<h1>Please check by inserting large <code>html</code> data </h1>
<body>
</body>
</html>

And process.php

<?
ini_set("log_errors", 1);
ini_set("error_log", "err.txt");
?>
<h1>The <code> echo ($_POST['test'])</code> is</h1>
<hr>
<code><? echo htmlentities($_POST['test']); ?></code>
<hr>

All the above codes working fine on localhost


Get this bounty!!!

#StackBounty: #javascript #jquery #html #image How to check width and height from all images has been called by jquery?

Bounty: 50

i have a problem on jquery image, which i need validate all image has been clicked or show with jquery

here is my code, how i add new images and show the images


true_image = false;
var _URL = window.URL || window.webkitURL;
$(document).ready(function(){

    var abc = 0;
    var wrapper         = $(".images");
    var add_button      = $("#add_more");

    var x = 1;
    $(add_button).click(function(){

        x++;
            $(wrapper).append('
" class="remove_field">
'); }); $(wrapper).on("click",".remove_field", function(e){ e.preventDefault(); $(this).parent('div').remove(); x--; }); $('body').on('change', '#file_input', function() { var image ; if (this.files && this.files[0]) { image = new Image; image.onload =function() { console.log("width : "+this.width+" height: "+this.height); if(this.width
"); var reader = new FileReader(); reader.onload = imageIsLoaded; reader.readAsDataURL(this.files[0]); $(this).hide(); $("#abcd" + abc).append($("", { id: 'img', src: '', alt: 'delete' }).click(function() { $(this).parent().parent().remove(); if(($('#file_input').val()) == undefined){ $(wrapper).append('
'); } })); } } }); function imageIsLoaded(e) { $('#previewimg' + abc).attr('src', e.target.result); $('.remove_field').hide(); }; $('body').on('click', '.images_view', function() { abc += 1; var cover = false; var image_id = this.id; $('.images_view').filter(function( index ) { if($( this ).attr( "id" ) === image_id){ $(this).parent().find('#file_input').attr('name','cover'); $(this).parent().find('#cover').remove(); $(this).parent().append("Cover"); }else{ $(this).parent().find('#file_input').attr('name','file[]'); $(this).parent().find('#cover').remove(); } }) }); });

from the above code, i trying to upload multi images so i add a button, and after it was clicked a new <input id="file_input" class="images_file" type="file" name="file[]"/> will be added, than after an images has been selected it could show the images. i want trying to validate the file is an image file, width and height on the image

my problem are, if i selected the false image (not in criteria) the button will be disabled but if in the next select, i choose the true image the button back to normal. I know this will happen because i don’t check the old images that has been selected before, and that is my problem i don’t know how to check it.

guys can you help me how to solve the problem?


Get this bounty!!!

#StackBounty: #html #css #angular2 Angular 2 get elements width, and offset

Bounty: 50

I have a template that creates a list of links using *ngFor and a separate div element that I want to change its location based on the currently active link.

Template:


This results in a structure like so:

I want my highlighter div to get the width of Link 1 when activeLink = 0. Similar to this plain js:

var High = document.getElementById('highlighter');
High.style.width = document.getElementsByClass('div-link')[0].children[activeLink].offsetWidth; //activeLink = 0

In my app.component.ts file:

import { Component, AfterViewInit, ViewChildren, Directive, QueryList, ElementRef} from '@angular/core';

@Directive({selector: '[class~=div-link]'})
@Directive({selector: '.div-link'}) // variant
@Directive({selector: '#divHandle'}) // variant
@Directive({selector: '[divHandle]'}) // variant
export class ChildDirective {
    constructor(elem: ElementRef){}
}

@Component({
    selector: 'my-app',
    ...
})
export class AppComponent implements AfterViewInit {
    @ViewChildren(ChildDirective) childrenContent: QueryList<ChildDirective>;

    ngAfterViewInit(){
        console.log(this.childrenContent);
    }
}

When I log the childrenContent I get a QueryList object, but it is empty, no elements to get info from.

I have tried several @Directive selectors and always my QueryList is empty.


Get this bounty!!!

#StackBounty: #javascript #html #google-chrome #email Chrome email field autocomplete options not showing for my website

Bounty: 100

As I visit many new websites for the first time, I see that:

  1. For some websites, putting my cursor in the email field of signup form immediately shows me email options from what I had entered in other websites.
  2. For other websites, putting my cursor in the email field does not give me any email options. And, I have to manually type every letter of the email.

I couldn’t find what piece of code differentiates the two cases. For my website, I am stuck with #2. I am trying to achieve #1, where user can just re-use emails entered in other websites.

I used some code like this:

<input type="email" name="email" id="frmEmailA" placeholder="name@example.com" required autocomplete="email">


Get this bounty!!!

#StackBounty: Google Maps API Winding path within polygon with rotate/grow/shrink/order options

Bounty: 50

I’m not certain what I’m trying to achieve is possible, but I know there are some creative people here and admittedly, I’m going to need some hand holding on this one.

Here is a mockup of what I’d like to add:
Example

Using these links below for reference of what’s possible. I need to apply each of these features to every user-drawn polygon.

  1. Auto-generating/filling a shape inside a polygon. For my purpose, I don’t need boxes, I need a single winding path to fill every user-created polygon. I need that winding path to hug the boundaries of the polygon as in my picture above.
    Draw small boxes inside a polygon

  2. Rotating a shape. The solution for rotating a shape 90 degrees offered by Vadim Gremyachev. Except, instead of rotating the polygon, I need to be able to rotate the path within the polygon and have it recalculate to maintain the winding path as in my pic above, only now with a different oritentation.
    Google Maps Rotate Polygon

  3. Another awesome example of drawing inside a polygon by geocodezip
    jsfiddle

  4. As in my mockup, I also need to be able to widen and shrink the path (grow = less winding and shrink = more winding). Arrows in mockup are just to illustrate the grow/shrink points.

  5. I need to be able to designate the order of paths via some way of passing the ability to number the final paths to the user.

  6. Finally, I need to be able to collect (save) all user generated paths in the correct sequence order. This includes any manually drawn paths as well as all of the paths auto-generated within each user-drawn polygon.

Here is my code I’m trying to apply these features to:

//debugger;

/////////////////////////////////////////////////////////////
//Map Specifications

function initialize() {
  var map = new google.maps.Map(document.getElementById('map'), {
    zoom: 18,
    center: new google.maps.LatLng(33.27144940863937, -117.2983479390361),
    mapTypeId: google.maps.MapTypeId.SATELLITE,
    mapTypeId: google.maps.MapTypeId.HYBRID,
    tilt: 0,
    disableDefaultUI: true,
    zoomControl: true,
    mapTypeControl: false,
    scaleControl: true,
    streetViewControl: true,
    rotateControl: true,
    fullscreenControl: false
  });

  // Creates a drawing manager attached to the map that allows the user to draw
  // markers, lines, and shapes.
  drawingManager = new google.maps.drawing.DrawingManager({
    drawingControlOptions: {
      position: google.maps.ControlPosition.TOP_CENTER,
      drawingModes: [
        google.maps.drawing.OverlayType.POLYLINE,
        google.maps.drawing.OverlayType.POLYGON
      ]
    },
    markerOptions: {
      draggable: false
    },
    //https://developers.google.com/maps/documentation/javascript/reference#PolygonOptions
    polygonOptions: {
      clickable: true,
      draggable: false,
      editable: true,
      fillColor: '#00FF00',
      fillOpacity: 0.45,
      geodesic: false,
      strokeColor: '#000000',
      strokeOpacity: 08,
      //strokePosition: CENTER,
      strokeWeight: 3,
      visible: true,
      zIndex: 0
    },
    //https://developers.google.com/maps/documentation/javascript/reference#PolylineOptions
    polylineOptions: {
      clickable: true,
      draggable: false,
      editable: true,
      geodesic: false,
      //icons: ,
      strokeColor: '#FF00FF',
      strokeOpacity: 0.8,
      strokeWeight: 3,
      visible: true,
      zIndex: 0
    }
  });

  ////////////////////////////////////////////////////////////////////////////////
  var drawingManager;
  var deleteSelectedShape;
  var selectedShape;

  function clearSelection() {
    if (selectedShape) {
      if (selectedShape.type !== 'marker') {
        selectedShape.setEditable(false);
      }

      selectedShape = null;
    }
  }

  function setSelection(shape) {
    if (shape.type !== 'marker') {
      clearSelection();
      shape.setEditable(true);
    }

    selectedShape = shape;
  }
  DeleteShape = function deleteSelectedShape() {
    if (selectedShape) {
      selectedShape.setMap(null);
    }
    if (selectedShape.type == 'polygon') {
      document.getElementById("action_gon").value = 'adds, moves, deletions'
    } else if (selectedShape.type == 'polyline') {
      document.getElementById("action_line").value = 'adds, moves, deletions'
    }
  };

  /////////////////////////////////////////////////////////////
  //Populate textboxes with geo data when new polygon and polyline shape added

  drawingManager.setMap(map);

  google.maps.event.addDomListener(drawingManager, 'markercomplete', function(marker) {
    document.getElementById("action").value += "#markern";
    document.getElementById("action").value += marker.getPosition() + "n";
  });

  google.maps.event.addDomListener(drawingManager, 'polylinecomplete', function(line) {
    path = line.getPath();
    //document.getElementById("action_line").value = ''
    document.getElementById("action_line").value = "#polyline shape addedn";
    for (var i = 0; i < path.length; i++) {
      document.getElementById("action_line").value += path.getAt(i) + "n";
    }
  });

  google.maps.event.addDomListener(drawingManager, 'polygoncomplete', function(polygon) {
    var markerCnt = 0;
    path = polygon.getPath();
    //document.getElementById("action_gon").value = ''
    document.getElementById("action_gon").value = "#polygon shape addedn";
    for (var i = 0; i < path.length; i++) {
      document.getElementById("action_gon").value += path.getAt(i) + 'n';
    }
  });

  //////////////////////////////////////////////////////////////////////

  google.maps.event.addListener(drawingManager, 'overlaycomplete', function(e) {

    var newShape = e.overlay;
    newShape.type = e.type;

    if (e.type !== google.maps.drawing.OverlayType.MARKER) {
      // Switch back to non-drawing mode after drawing a shape.
      drawingManager.setDrawingMode(null);

      if (e.type == google.maps.drawing.OverlayType.POLYGON) {
        var coordinatesArray = e.overlay.getPath().getArray();
        document.getElementById("count_gon").value += "#n";
        document.getElementById("count_gon").value += coordinatesArray + "n";
      }

      //Catch vertex modifications (moves)
      function processVertices(e) {
        var ele;
        if (newShape.type == "polygon") {
          ele = document.getElementById("action_gon");
          //ele.value = "Modified vertex: "+e+"n"+this.getAt(e)+"nPolygon coords :n";
          ele.value = "#polygon vertex " + e + " movedn" + this.getAt(e) + "n";
        } else if (newShape.type == "polyline") {
          ele = document.getElementById("action_line");
          //ele.value = "Modified vertex: "+e+"n"+this.getAt(e)+"nPolyline coords :n";
          ele.value = "#polyline vertex " + e + " movedn" + this.getAt(e) + "n";
        } else return;
        for (var i = 0; i < newShape.getPath().getLength(); i++) {
          ele.value += newShape.getPath().getAt(i) + 'n';
        };
      };

      google.maps.event.addListener(newShape.getPath(), 'set_at', processVertices);
      google.maps.event.addListener(newShape.getPath(), 'insert_at', processVertices);

      /////////////////////////////////////////////////////////////
      // Add an event listener that selects the newly-drawn shape when the user clicks it.
      google.maps.event.addListener(newShape, 'click', function(e) {
        if (e.vertex !== undefined) {
          if (newShape.type === google.maps.drawing.OverlayType.POLYGON) {
            var path = newShape.getPaths().getAt(e.path);
            path.removeAt(e.vertex);

            /////////////////////////////////////////////////////////////
            //Update textboxes with geo data when polygon vertex deleted
            document.getElementById("action_gon").value = "#polygon vertex deletedn";
            for (var i = 0; i < path.length; i++) {
              document.getElementById("action_gon").value += path.getAt(i) + 'n';
            }

            if (path.length < 3) {
              newShape.setMap(null);
              document.getElementById("action_gon").value = 'This box shows updated coords for POLYGONS based on user interactions (adds, moves, deletions).'
            }
          }

          if (newShape.type === google.maps.drawing.OverlayType.POLYLINE) {
            var path = newShape.getPath();
            path.removeAt(e.vertex);
            /////////////////////////////////////////////////////////////
            //Update textboxes with geo data when polyline vertex deleted
            document.getElementById("action_line").value = "#polyline vertex deletedn";
            for (var i = 0; i < path.length; i++) {
              document.getElementById("action_line").value += path.getAt(i) + 'n';
            }

            if (path.length < 2) {
              newShape.setMap(null);
              document.getElementById("action_line").value = 'This box shows updated coords for POLYLINES based on user interactions (adds, moves, deletions).'
            }
          }
        }

        setSelection(newShape);
      });
      setSelection(newShape);
    } else {
      google.maps.event.addListener(newShape, 'click', function(e) {
        setSelection(newShape);
      });
      setSelection(newShape);
    }
  });

  // Link delete button to the UI element.
  var delbtn = /** @type {HTMLInputElement} */ (
    document.getElementById('delete-button'));
  map.controls[google.maps.ControlPosition.TOP_RIGHT].push(delbtn);

  // Clear the current selection when the drawing mode is changed, or when the
  // map is clicked.
  google.maps.event.addListener(drawingManager, 'drawingmode_changed', clearSelection);
  google.maps.event.addListener(map, 'click', clearSelection);

  // Listen for delete button click.
  google.maps.event.addDomListener(document.getElementById('delete-button'), 'click', deleteSelectedShape);

  /////////////////////////////////////////////////////////////////////

  //Places Search Box Setup
  var markers = [];
  var input = /** @type {HTMLInputElement} */ (
    document.getElementById('pac-input'));
  map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);

  var searchBox = new google.maps.places.SearchBox(
    /** @type {HTMLInputElement} */
    (input));

  // [START region_getplaces]
  // Listen for the event fired when the user selects an item from the
  // pick list. Retrieve the matching places for that item.
  google.maps.event.addListener(searchBox, 'places_changed', function() {
    var places = searchBox.getPlaces();

    if (places.length == 0) {
      return;
    }
    for (var i = 0, marker; marker = markers[i]; i++) {
      marker.setMap(null);
    }

    // For each place, get the icon, place name, and location.
    markers = [];
    var bounds = new google.maps.LatLngBounds();
    for (var i = 0, place; place = places[i]; i++) {
      var image = {
        url: place.icon,
        size: new google.maps.Size(71, 71),
        origin: new google.maps.Point(0, 0),
        anchor: new google.maps.Point(17, 34),
        scaledSize: new google.maps.Size(25, 25)
      };

      bounds.extend(place.geometry.location);
    }

    map.fitBounds(bounds);
  });
}

google.maps.event.addDomListener(window, 'load', initialize);
#map,
html,
body {
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
}
#geoinfoboxes {
  display: none;
}
#delete-button {
  background: #0084ff;
  background-image: -webkit-linear-gradient(top, #0084ff, #000000);
  background-image: -moz-linear-gradient(top, #0084ff, #000000);
  background-image: -o-linear-gradient(top, #0084ff, #000000);
  background-image: linear-gradient(to bottom, #0084ff, #000000);
  border-radius: 30px;
  text-shadow: 0px 1px 3px #cfcdcf;
  -webkit-box-shadow: 0px 1px 3px #666666;
  -moz-box-shadow: 0px 1px 3px #666666;
  box-shadow: 0px 1px 3px #666666;
  font-family: Arial;
  margin-top: 5px;
  right: 0.5%;
  color: #ffffff;
  font-size: 15px;
  padding: 8px 10px 8px 10px;
  border: solid #a8a8a8 2px;
  text-decoration: none;
}
#delete-button:hover {
  background: #09ff00;
  background-image: -webkit-linear-gradient(top, #09ff00, #000000);
  background-image: -moz-linear-gradient(top, #09ff00, #000000);
  background-image: -o-linear-gradient(top, #09ff00, #000000);
  background-image: linear-gradient(to bottom, #09ff00, #000000);
  text-decoration: none;
}
.controls {
  border: 1px solid transparent;
  border-radius: 30px 30px 30px 30px;
  box-sizing: border-box;
  -moz-box-sizing: border-box;
  height: 32px;
  outline: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  margin-top: 5px;
}
#pac-input {
  background-color: #fff;
  font-family: Roboto;
  font-size: 15px;
  font-weight: 300;
  margin-left: 12px;
  padding: 0 11px 0 13px;
  text-overflow: ellipsis;
  width: 400px;
}
#pac-input:focus {
  border-color: #4d90fe;
}
.pac-container {
  font-family: Roboto;
}
<!DOCTYPE html>
<!-- saved from url=(0014)about:internet -->
<html>

<head>
  <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
  <meta charset="UTF-8">
  <title>Test</title>
  http://maps.google.com/maps/api/js?key=AIzaSyBgmfaITmUDhXxk-0V33IPmNPd43mMd4ZU&libraries=drawing,places
</head>
<!-- -->

<body>
  <input id="pac-input" class="controls" type="text" placeholder="Search...">
  <input id="delete-button" onclick="DeleteShape();" type=button value="Delete Selected Shape">
  
</body> </html>

I realize this is a tall order, so I plan to add a bounty if I can’t get there with general help. Also, willing to work with someone offline.

EDIT: Looks like the grid-filled polygon from my image has been done using the Google API. Here’s an exact example of the grid type I’m wanting to create (skip to 2:10): https://www.youtube.com/watch?v=u-k8ax2JGC4


Get this bounty!!!

jSoup: Java HTML Parser

jsoup is a Java library for working with real-world HTML. It provides a very convenient API for extracting and manipulating data, using the best of DOM, CSS, and jquery-like methods.

jsoup implements the WHATWG HTML5 specification, and parses HTML to the same DOM as modern browsers do.

  • scrape and parse HTML from a URL, file, or string
  • find and extract data, using DOM traversal or CSS selectors
  • manipulate the HTML elements, attributes, and text
  • clean user-submitted content against a safe white-list, to prevent XSS attacks
  • output tidy HTML

jsoup is designed to deal with all varieties of HTML found in the wild; from pristine and validating, to invalid tag-soup; jsoup will create a sensible parse tree.

Example

Fetch the Wikipedia homepage, parse it to a DOM, and select the headlines from theIn the news section into a list of Elements (online sample):

Document doc = Jsoup.connect("http://en.wikipedia.org/").get();
Elements newsHeadlines = doc.select("#mp-itn b a");

Open source

jsoup is an open source project distributed under the liberal MIT license. The source code is available at GitHub.

Getting started

  1. Download the jsoup jar (version 1.8.3)
  2. Read the cookbook introduction
  3. Enjoy!

Resources

What is the difference between target=_new and target=_blank in HTML Code?

According to the HTML5 WIP Spec:

A valid browsing context name is any string with at least one character that does not start with a U+005F LOW LINE character. (Names starting with an underscore are reserved for special keywords.)

A valid browsing context name or keyword is any string that is either a valid browsing context name or that is an ASCII case-insensitive match for one of: _blank, _self, _parent, or _top.” –Source

That means that there is no such keyword as _new in HTML5, and not in HTML4 (and consequently XHTML) either.

That means, that there will be no consistent behavior whatsoever if you use this as a value for the target attribute.

Source

How to create a Custom ADF Component

In this tutorial, we will create a custom ADF Component.

Create new files and package structure as shown:

Structure
Create a Custom ADF Component

Source Code of the required files is as below:

Final Output:

final
Create a Custom ADF Component

How to create multilevel menu’s in JSP using recursion..

There was a requirement where in I need to create multi-level menu’s in a JSP

A role has certain set of Privileges.
Each privilege may or may not have child privileges..

Where Privilege has child privileges, it was desired to display a sub menu..

So this is how I have achieved…
First thing you need to know about this is how to create multi level menu’s using HTML and CSS.
(http://javakafunda.blogspot.in/2014/08/how-to-create-multi-level-menus-using.html)

and once you learn that you’ll have to use recursion in JSP to achieve the above requirement.

I’ll just put the core logic here which is the base of this..

Create a parent jsp (lets say LoginSuccess.jsp)

Create a showPrivileges.jsp as follows: