Questions Tagged with #Javascript

JavaScript (not to be confused with Java) is a high-level, dynamic, multi-paradigm, weakly-typed language used for both client-side and server-side scripting. Its primary use is in rendering and allowing manipulation of web pages. Use this tag for questions regarding ECMAScript and its various dialects/implementations (excluding ActionScript and Google-Apps-Script).

How do I pass the this context to a function?

I thought this would be something I could easily google, but maybe I'm not asking the right question... How do I set whatever "this" refers to in a given javascript function? for example, like with ..

Load jQuery with Javascript and use jQuery

I am appending the jQuery library to the dom using: var script = document.createElement('script'); script.src = ''; script.type = 't..

iOS 7's blurred overlay effect using CSS?

It seems Apple's overlay is more than just a transparency. Any ideas on how to achieve this effect with CSS and possibly JS? ..

How do I set the focus to the first input element in an HTML form independent from the id?

Is there a simple way to set the focus (input cursor) of a web page on the first input element (textbox, dropdownlist, ...) on loading the page without having to know the id of the element? I would l..

JavaScript + Unicode regexes

How can I use Unicode-aware regular expressions in JavaScript? For example, there should be something akin to \w that can match any code-point in Letters or Marks category (not just the ASCII ones), ..

How to filter array when object key value is in array

I have an array model as below: records:[{ "empid":1, "fname": "X", "lname": "Y" }, { "empid":2, "fname": &quo..

Add a fragment to the URL without causing a redirect?

Is there is a way how to add hash # to my URL without redirect?..

How to make a button redirect to another page using jQuery or just Javascript

I am making a prototype and I want the search button to link to a sample search results page. How do I make a button redirect to another page when it is clicked using jQuery or plain JS...

jQuery: how to change title of document during .ready()?

I am using some nested layouts in Ruby on Rails, and in one of the layouts i have a need to read in a string from a div and set that as the title of the document. What is correct way (if any) to set t..

How to check if the user can go back in browser history or not

I want using JavaScript to see if there is history or not, I mean if the back button is available on the browser or not...

JavaScript - XMLHttpRequest, Access-Control-Allow-Origin errors

I'm attempting to send a XMLHttpRequest to a paste site. I'm sending an object containing all the fields that the api requires, but I keep getting this issue. I have read over the issue, and I thought..

How to pass a form input value into a JavaScript function

I have a generic JavaScript function which takes one parameter function foo(val) { ...} and I want to call the function when submit a form <form> <input type="text" id="formValueId"/>..

How to set the DefaultRoute to another Route in React Router

I have the following: <Route name="app" path="/" handler={App}> <Route name="dashboards" path="dashboards" handler={Dashboard}> <Route name="exploreDashboard" path="explore..

How to do case insensitive string comparison?

How do I perform case insensitive string comparison in JavaScript?..

JavaScript - Hide a Div at startup (load)

I have a div in my php page that uses jQuery to hide it once the page has loaded. But is there a way to hide it from the very start of loadup? The reason I ask is because for a brief second, you can ..

How do I capture response of form.submit

I have the following code: <script type="text/javascript"> function SubmitForm() { form1.submit(); } function ShowResponse() { } &..

mailto using javascript

I want to open a new outlook mail template with the 'To address' whenever a user clicks an image. I have return my code in a html page(linked with the image), whenever it loads the javascript should o..

Node.js: get path from the request

I have a service called "localhost:3000/returnStat" that should take a file path as parameter. For example '/BackupFolder/toto/tata/titi/myfile.txt'. How can I test this service on my browser? How ca..

Trees in Twitter Bootstrap

I have been trying to work on creating a tree (like a directory tree) that uses as much CSS and as little JS as possible (only for states, etc), and I want to know if there are some good existing tree..

How to check if a user likes my Facebook Page or URL using Facebook's API

I think I'm going crazy. I can't get it to work. I simply want to check if a user has liked my page with javascript in an iFrame app. FB.api({ method: "pages.isFan", page_id: my_pa..

Detect when a window is resized using JavaScript ?

Is there any way with jQuery or JavaScript to trigger a function when the user ends to resize the browser window? In other terms: Can I detect mouse up event when user is resizing the browser windo..

Javascript array declaration: new Array(), new Array(3), ['a', 'b', 'c'] create arrays that behave differently

Consider this example Javascript code: a = new Array(); a['a1']='foo'; a['a2']='bar'; b = new Array(2); b['b1']='foo'; b['b2']='bar'; c=['c1','c2','c3']; console.log(a); console.log(b); console.lo..

JQuery Redirect to URL after specified time

Is there a way to use JQuery to redirect to a specific URL after a give time period?..

Capture key press (or keydown) event on DIV element

How do you trap the keypress or key down event on a DIV element (using jQuery)? What is required to give the DIV element focus?..

JQuery .hasClass for multiple values in an if statement

I have a simple if statement as such: if ($('html').hasClass('m320')) { // do stuff } This works as expected. However, I want to add more classes to the if statement to check if any of the class..

How do I loop through or enumerate a JavaScript object?

I have a JavaScript object like the following: var p = { "p1": "value1", "p2": "value2", "p3": "value3" }; Now I want to loop through all p elements (p1, p2, p3...) And get their keys a..

Getting a UnhandledPromiseRejectionWarning when testing using mocha/chai

So, I'm testing a component that relies on an event-emitter. To do so I came up with a solution using Promises with Mocha+Chai: it('should transition with the correct event', (done) => { const cF..

if-else statement inside jsx: ReactJS

I need to change render function and run some sub render function when a specific state given, For example: render() { return ( <View style={styles.container}> if (..

Angular - Can't make ng-repeat orderBy work

I've tried many examples of ng-repeat with orderBy, but I can't make my json work with it. <div ng-app> <script type="text/javascript" src="

Check if all values of array are equal

I need to find arrays where all values are equal. What's the fastest way to do this? Should I loop through it and just compare values? ['a', 'a', 'a', 'a'] // true ['a', 'a', 'b', 'a'] // false ..

How can I hide a checkbox in html?

I want to hide a checkbox. But also want that, when I click on label associated with corresponding checkbox, the checkbox should get checked/unchecked. I also want that the checkbox MUST be able to b..

How to fix the error; 'Error: Bootstrap tooltips require Tether ('

I'm using Bootstrap V4 and the following error is logged in the console; Error: Bootstrap tooltips require Tether ( I have tried to remove the error by instal..

How to convert Moment.js date to users local timezone?

I use the Moment.js and Moment-Timezone frameworks, and have a Moment.js date object which is explicitly in UTC timezone. How can I convert that to the current timezone of the browser? var testDateUt..

Intercept a form submit in JavaScript and prevent normal submission

There seems to be lots of info on how to submit a form using javascript, but I am looking for a solution to capture when a form has been submitted and intercept it in javascript. HTML <form> ..

How to select a value in dropdown javascript?

i have a drop down like this <select style="width: 280px" id="Mobility" name="Mobility"> <option selected="">Please Select</option> <option>K</option> <option&g..

Loop and get key/value pair for JSON array using jQuery

I'm looking to loop through a JSON array and display the key and value. It should be a simplified version of the following post, but I don't seem to have the syntax correct: jQuery 'each' loop with..

How to show an alert box in PHP?

I want to display an alert box showing a message with PHP. Here is my PHP code: <?php header("Location:form.php"); echo '<script language="javascript">'; echo 'alert(message succes..

How to set a value for a selectize.js input?

I have a form from which I would like to copy some default values into the inputs. The form inputs are using the selectize.js plugin. I would like to set some of the form values programatically. Th..

Export javascript data to CSV file without server interaction

If we were on a nodeJS server, we could write a header, set a mime type, and send it: res.header("Content-Disposition", "attachment;filename="+name+".csv"); res.type("text/csv"); res.send(200, csvSt..

Disable/enable an input with jQuery?

$input.disabled = true; or $input.disabled = "disabled"; Which is the standard way? And, conversely, how do you enable a disabled input?..

var functionName = function() {} vs function functionName() {}

I've recently started maintaining someone else's JavaScript code. I'm fixing bugs, adding features and also trying to tidy up the code and make it more consistent. The previous developer used two way..

How to run server written in js with Node.js

I have installed node.js from here . in my windows8 machine. copied the example server code in my server.js file var http = require('http'); http.createServer(function (req, res)..

Why es6 react component works only with "export default"?

This component does work: export class Template extends React.Component { render() { return ( <div> component </div> ); } }; export default Template; ..

addEventListener in Internet Explorer

What is the equivalent to the Element Object in Internet Explorer 9? if (!Element.prototype.addEventListener) { Element.prototype.addEventListener = function() { .. } } How does it works in I..

How to call javascript function from code-behind

I wrote a javascript with a page. In Page <HTML> <HEAD> <script type="text/javascript"> function Myfunction(){ document.getElementId('MyText')...

How do I tell if an object is a Promise?

Whether it's an ES6 Promise or a bluebird Promise, Q Promise, etc. How do I test to see if a given object is a Promise?..

Best way to find if an item is in a JavaScript array?

What is the best way to find if an object is in an array? This is the best way I know: _x000D_ _x000D_ function include(arr, obj) {_x000D_ for (var i = 0; i < arr.length; i++) {_x000D_ if (..

How to reload or re-render the entire page using AngularJS

After rendering the entire page based on several user contexts and having made several $http requests, I want the user to be able to switch contexts and re-render everything again (resending all $http..

jQuery .val change doesn't change input value

I have an HTML input with a link in the value. <input type = 'text' value = '' id = 'link' /> I am using jQuery to change the value on a certain event. $('#link').val('new..

What's the difference between window.location= and window.location.replace()?

Is there a difference between these two lines? var url = ""; window.location = url; window.location.replace(url); ..

What's the easiest way to call a function every 5 seconds in jQuery?

JQuery, how to call a function every 5 seconds. I'm looking for a way to automate the changing of images in a slideshow. I'd rather not install any other 3rd party plugins if possible...

Is it possible to use JS to open an HTML select to show its option list?

Is it possible to use JavaScript to open an HTML select to show its option list?..

setInterval in a React app

I'm still fairly new at React, but I've been grinding along slowly and I've encountered something I'm stuck on. I am trying to build a "timer" component in React, and to be honest I don't know if I'..

How can I generate an apk that can run without server with react-native?

I've built my app, I can run it on my local emulator (and also on my android device within the same network by changing debug server). However, I want to build an APK that I can send to someone witho..

Uncaught TypeError: Cannot read property 'toLowerCase' of undefined

I'm getting this error and it is originating from jquery framework. When i try to load a select list on document ready i get this error. I can't seem to find why i'm getting this error. It works for ..

Redirecting to a relative URL in JavaScript

I have a problem: I want to redirect via JavaScript to a directory above. My code: location.href = (location.href).substr(0, (location.href).lastIndexOf('folder')); The URL looks like this: exa..

javascript - replace dash (hyphen) with a space

I have been looking for this for a while, and while I have found many responses for changing a space into a dash (hyphen), I haven't found any that go the other direction. Initially I have: var str ..

How to store arbitrary data for some HTML tags

I'm making a page which has some interaction provided by javascript. Just as an example: links which send an AJAX request to get the content of articles and then display that data in a div. Obviously ..

JavaScript: Alert.Show(message) From ASP.NET Code-behind

I am reading this JavaScript: Alert.Show(message) From ASP.NET Code-behind I am trying to implement the same. So I created a static class like this: using System; using System.Collections.Generic; u..

How to remove part of a string before a ":" in javascript?

If I have a string Abc: Lorem ipsum sit amet, how can I use JavaScript/jQuery to remove the string before the : including the :. For example the above string will become: Lorem ipsum sit amet...

Check if image exists on server using JavaScript?

Using javascript is there a way to tell if a resource is available on the server? For instance I have images 1.jpg - 5.jpg loaded into the html page. I'd like to call a JavaScript function every minut..

How do I put variables inside javascript strings?

s = 'hello %s, how are you doing' % (my_name) That's how you do it in python. How can you do that in javascript/node.js?..

Controlling fps with requestAnimationFrame?

It seems like requestAnimationFrame is the de facto way to animate things now. It worked pretty well for me for the most part, but right now I'm trying to do some canvas animations and I was wondering..

Javascript Get Values from Multiple Select Option Box

This one is driving me nuts. It’s got to be something simple and stupid that I am overlooking. I have a multiple select box in a form. I am just trying to get the values that are selected. In my lo..

Send array with Ajax to PHP script

I have array made by function .push. In array is very large data. How is the best way send this to PHP script? dataString = ??? ; // array? $.ajax({ type: "POST", url: "script.p..

jQuery animated number counter from zero to value

I have created a script to animate a number from zero to it's value. Working jQuery _x000D_ _x000D_ $({ Counter: 0 }).animate({_x000D_ Counter: $('.Single').text()_x000D_ }, {_x000D_ duration: ..

Using Jasmine to spy on a function without an object

I'm new to Jasmine and have just started using it. I have a library js file with lots of functions which are not associated with any object (i.e. are global). How do I go about spying on these functio..

how to make a jquery "$.post" request synchronous

I’ve been googling this and avoiding this error in my bug fix list for a long time now, but I’ve finally reached the end of the list, the last of which I have to make a function return true/false ..

AngularJS: How to run additional code after AngularJS has rendered a template?

I have an Angular template in the DOM. When my controller gets new data from a service, it updates the model in the $scope, and re-renders the template. All good so far. The issue is that I need to..

Disabling the button after once click

I need to disable a button once it's clicked so the user can't click it more than once. (My application is written in MVC ASP.NET, I've done this in a normal ASP.NET application.) I tried using JavaS..

Callback function for JSONP with jQuery AJAX

I didn't quite understand how to work with the callback for the ajax function of jQuery. I have the following code in the JavaScript: try { $.ajax({ url: '

JavaScript Chart.js - Custom data formatting to display on tooltip

I have looked at various documentation and similar questions on here, but cannot seem to find the particular solution. Apologies if I have missed anything obvious or have repeated this question! As a..

How to pop an alert message box using PHP?

How to pop an alert message box using PHP?..

Can I run javascript before the whole page is loaded?

I want to run a bit of javascript before the whole page has loaded. Is this possible? Or does the code start to execute on </html>?..

<script> tag vs <script type = 'text/javascript'> tag

I was just wondering, what is the difference between <script> and <script type = 'text/javascript'> Is it different for different webservers? For example,(I know it's incorrect to..

Javascript array value is undefined ... how do I test for that

I am trying to test to see whether a Javascript variable is undefined. You will see that I am not expecting the value of predQuery[preId] to be 'undefined' if I don't first get an alert saying "its u..

Uncaught TypeError: Cannot read property 'split' of undefined

Using JavaScript to split a date and rearrange the format. Date is provided through a json feed as YYYY-MM-DD. To get the date, I do: var og_date = ([totalItems -1].inspection_date); consol..

Get total number of items on Json object?

Possible Duplicate: Length of Javascript Object (ie. Associative Array) I have an object similar to this one: var jsonArray = { '-1': { '-1': 'b', '2': 'a', '10': 'c' }, ..

How to select option in drop down protractorjs e2e tests

I am trying to select an option from a drop down for the angular e2e tests using protractor. Here is the code snippet of the select option: <select id="locregion" class="create_select ng-pristine..

Get data from php array - AJAX - jQuery

I have a page as below; <head> <script type="text/javascript" src="jquery-1.6.1.js"></script> <script type="text/javascript"> $(document).ready( function() { $('#prev').click(..

What is the cleanest way to get the progress of JQuery ajax request?

In plain javascript is very simple: need just to attach the callback to {XMLHTTPRequest}.onprogress var xhr = new XMLHttpRequest(); xhr.onprogress = function(e){ if (e.lengthComputable) ..

How to set the max value and min value of <input> in html5 by javascript or jquery?

I am trying to find out how to set the max value and min value of html5 type input by javascript or jquery. <input type="number" max="???" min="???" step="0.5"/> Would someone please guide..

Remove first Item of the array (like popping from stack)

I have list of items created via ng-repeat. I also have Delete button. Clicking delete button removes last item of the array one by one. Plunker But I want to remove items one by one starting from th..

Looping over elements in jQuery

I want to loop over the elements of an HTML form, and store the values of the <input> fields in an object. The following code doesn't work, though: function config() { $("#frmMain").childre..

JavaScript null check

I've come across the following code: function test(data) { if (data != null && data !== undefined) { // some code here } } I'm somewhat new to JavaScript, but, from other qu..

fs: how do I locate a parent folder?

How do I write this to go back up the parent 2 levels to find a file? fs.readFile(__dirname + ''); ..

Mongoose: Find, modify, save

I have a Mongoose User model: var User = mongoose.model('Users', mongoose.Schema({ username: 'string', password: 'string', rights: 'string' }) ); I want to find one ..

Is there a way to make text unselectable on an HTML page?

I'm building an HTML UI with some text elements, such as tab names, which look bad when selected. Unfortunately, it's very easy for a user to double-click a tab name, which selects it by default in ma..

Function is not defined - uncaught referenceerror

I have this uncaught referenceerror function is not defined error which do not understand. If I have $(document).ready(function(){ function codeAddress() { var address = document.getElementById("..

Get key and value of object in JavaScript?

Given a JavaScript array of objects, how can I get the key and value of each object? The code below shows what I'd like to do, but obviously doesn't work: var top_brands = [ { 'Adidas' : 100 }, { 'N..

Programmatically open new pages on Tabs

I'm trying to "force" Safari or IE7 to open a new page using a new tab. Programmatically I mean something like:'page.html','newtaborsomething'); ..

HTML form action and onsubmit issues

I want to run JavaScript user validation on some textbox entries. The problem I'm having is that my form has the action of going to a new page within our site, and the onsubmit attribute never runs th..

How can I make a button redirect my page to another page?

I have been trying the following: <form action="/home" class="inline"> <button class="float-left submit-button" >Home</button> </form> It seems to work but it goes to th..

Google Maps: Set Center, Set Center Point and Set more points

I am using Google Maps V3 and I want to: Set the center of the map to a particular latlng. I am using: map.setCenter(new google.maps.LatLng(mylat,mylong)); Set a point in that center spot. I am cu..

How to get the caret column (not pixels) position in a textarea, in characters, from the start?

How do you get the caret position in a <textarea> using JavaScript? For example: This is| a text This should return 7. How would you get it to return the strings surrounding the cursor / sele..

img onclick call to JavaScript function

I am trying to make a img that when it is clicked a JavaScript function is called. I have searched on the web but haven't found anything that actually works (prob because of a mistake I made). This ..

Javascript array sort and unique

I have a JavaScript array like this: var myData=['237','124','255','124','366','255']; I need the array elements to be unique and sorted: myData[0]='124'; myData[1]='237'; myData[2]='255'; myData[..

Sort Array of object by object field in Angular 6

I am getting an array of "product"s from a resolver getting data from a json endpoint. ngOnInit() { this.products =; console.log('products: ', this.products); }..

check if jquery has been loaded, then load it if false

Does anyone know how to check if jquery has been loaded (with javascript) then load it if it hasnt been loaded. something like if(!jQuery) { //load jquery file } ..

add an onclick event to a div

I don't know if this is allowed or even possible. Is it possible to create a div element with an onclick event so that if anywhere in the div's area is clicked, the event will run. Eg JAVASCRIPT: va..

Change HTML email body font type and size in VBA

I have a VBA script that that generates and email when a VBA button is pushed in a given worksheet. The script currently generates the email in a relatively small font. I was wondering if there is a..

How do I compare two Integers?

I have to compare two Integer objects (not int). What is the canonical way to compare them? Integer x = ... Integer y = ... I can think of this: if (x == y) The == operator only compares refere..

Using %f with strftime() in Python to get microseconds

I'm trying to use strftime() to microsecond precision, which seems possible using %f (as stated here). However when I try the following code: import time import strftime from time print strftime("%H..

How do I return the response from an asynchronous call?

I have a function foo which makes an asynchronous request. How can I return the response/result from foo? I tried returning the value from the callback, as well as assigning the result to a local vari..

To compare two elements(string type) in XSLT?

i am new to XSLT ,can any one please suggest to me how to compare two elements coming from xml as string their values are: <OU_NAME>Vision Operations</OU_NAME> --XML code <OU_ADDR1>..

PHP Parse HTML code

Possible Duplicate: Best methods to parse HTML How can I parse HTML code held in a PHP variable if it something like: <h1>T1</h1>Lorem ipsum.<h1>T2</h1>The quick re..

Is there an ignore command for git like there is for svn?

I am a new user to git and I am starting a new project. I have a bunch of dot files that I would like to ignore. Is there an ignore command for git like there is for svn?..

Explicitly calling return in a function or not

A while back I got rebuked by Simon Urbanek from the R core team (I believe) for recommending a user to explicitly calling return at the end of a function (his comment was deleted though): foo = func..

TypeError: module.__init__() takes at most 2 arguments (3 given)

I have defined a class in a file named When I try to inherit from this class in another file, calling the constructor throws an exception: TypeError: module.__init__() takes at most 2 argu..

How to force open links in Chrome not download them?

I want to open a link that is .psd format with Photoshop when clicked in Google Chrome like Firefox that asks me to open or download the file. But Google Chrome downloads the file automatically. How c..

How can I get stock quotes using Google Finance API?

I'm looking for access to financial data from Google services. I found this URL that gets the stock data for Microsoft. What are all the possible parameters that Google allows for this kind of HTTP..

Easy way to build Android UI?

Is there a tool or a website that could help me create a UI for an Android application using drag-and-drop? I found this site but want to know if there is a more stable tool or website for this?..

Adding an img element to a div with javascript

I am trying to add an img to the placehere div using JavaScript, however I am having no luck. Can anyone give me a hand with my code? <html> <script type="text/javascript"> var elem = doc..

Finding the length of an integer in C

I would like to know how I can find the length of an integer in C. For instance: 1 => 1 25 => 2 12512 => 5 0 => 1 and so on. How can I do this in C?..

Validation error: "No validator could be found for type: java.lang.Integer"

I am working on a project with Spring why do I keep getting the following error? javax.validation.UnexpectedTypeException: No validator could be found for type: java.lang.Integer Here is my c..

Is it ok having both Anacondas 2.7 and 3.5 installed in the same time?

I am using currently Anaconda with Python 2.7, but I will need to use Python 3.5. Is it ok to have them installed both in the same time? Should I expect some problems? I am on a 64-bit Win8...

ERROR 1130 (HY000): Host '' is not allowed to connect to this MySQL server

Why oh why can I not connect to mysql? mysql -u root -ptest101 -h ERROR 1130 (HY000): Host '' is not allowed to connect to this MySQL server In my.cnf I have the belo..

"Press Any Key to Continue" function in C

How do I create a void function that will work as "Press Any Key to Continue" in C? What I want to do is: printf("Let the Battle Begin!\n"); printf("Press Any Key to Continue\n"); //The Void Functio..

Filter by process/PID in Wireshark

Is there a way to filter/follow a TCP/SSL stream based on a particular process ID using Wireshark?..

DataTable, How to conditionally delete rows

I'm engaged in a C# learning process and it is going well so far. I however just now hit my first "say what?" moment. The DataTable offers random row access to its Rows collection, not only through t..

Effective method to hide email from spam bots

On my homepage, I'm using this method to hide my email from spam bots: <a href="admin [at]" rel="nofollow" onclick="this.href='mailto:' + 'admin' + '@' + ''">Contac..

How can I list all foreign keys referencing a given table in SQL Server?

I need to remove a highly referenced table in a SQL Server database. How can I get a list of all the foreign key constraints I will need to remove in order to drop the table? (SQL answers preferable..

XSD - how to allow elements in any order any number of times?

I am trying to create an XSD, and trying to write the definition with the following requirement: Allow child element specified to appear any number of times (0 to unbounded) Allow child elements to ..

How to display a json array in table format?

I have a json array with this format: [ { id : "001", name : "apple", category : "fruit", color : "red" }, { id : "002", name : "melon", ..

Send POST request using NSURLSession

Update: Solution found. You can read it at the end of the post. I'm trying to perform a POST request to a remote REST API using NSURLSession. The idea is to make a request with two parameters: device..

Prevent scrolling of parent element when inner element scroll position reaches top/bottom?

I have a little "floating tool box" - a div with position:fixed; overflow:auto. Works just fine. But when scrolling inside that box (with the mouse wheel) and reaching the bottom OR top, the parent e..

How to maximize a window using Python

Just for curiosity I would like to know how to do this in the code below. I have been searching for an answer but is useless. import numpy as np import matplotlib.pyplot as plt data=np.random.exponen..

Can one AngularJS controller call another?

Is it possible to have one controller use another? For example: This HTML document simply prints a message delivered by the MessageCtrl controller in the messageCtrl.js file. <html xmlns:ng="htt..

Inconsistent Accessibility: Parameter type is less accessible than method

I'm trying to pass an object (a reference to the currently logged on user, basically) between two forms. At the moment, I have something along these lines in the login form: private ACTInterface oAc..

Using Panel or PlaceHolder

What is the difference between <asp:Panel > and <asp:PlaceHolder > in ASP.NET? When should you use one over the other?..

Which maven dependencies to include for spring 3.0?

I am trying to do my first project with Spring 3.0 (and maven). I have been using Spring 2.5 (and primer versions) in quite some projects. Nevertheless I am kinda confused, what modules I have to defi..

Connection Strings for Entity Framework

I want to share same Database information across multiple entities in Silverlight.. but I want the connection string to be named xyz and have everyone access that connection string from machine.config..

Why use getters and setters/accessors?

What's the advantage of using getters and setters - that only get and set - instead of simply using public fields for those variables? If getters and setters are ever doing more than just the simple ..

JavaScript alert box with timer

I want to display the alert box but for a certain interval. Is it possible in JavaScript?..

curl: (60) SSL certificate problem: unable to get local issuer certificate

root@sclrdev:/home/sclr/certs/FreshCerts# curl --ftp-ssl --verbose ftp://{abc}/ -u trup:trup --cacert /etc/ssl/certs/ca-certificates.crt * About to connect() to {abc} port 21 (#0) * Trying {abc}... ..

Codeigniter $this->db->order_by(' ','desc') result is not complete

I want to sort my database values in descending order using this query below in my model. However, it doesn't completely sort in descending order all the values in the database but when ascending is u..

Make browser window blink in task Bar

How do I make a user's browser blink/flash/highlight in the task bar using JavaScript? For example, if I make an AJAX request every 10 seconds to see if the user has any new messages on the server, I ..

How to add anchor tags dynamically to a div in Javascript?

How to add a list of hyperlinks (with their events and properties) dynamically to a div in Javascript?..

'Found the synthetic property @panelState. Please include either "BrowserAnimationsModule" or "NoopAnimationsModule" in your application.'

I upgraded an Angular 4 project using angular-seed and now get the error Found the synthetic property @panelState. Please include either "BrowserAnimationsModule" or "NoopAnimationsModule" in your..

What is the recommended project structure for spring boot rest projects?

I'm a beginner with spring boot. I'm involved in the beginning of a project where we would build rest services using spring boot. Could you please advise the recommended directory structure to follow ..

How to convert a selection to lowercase or uppercase in Sublime Text

I have several strings selected in a file in Sublime Text and I want to convert them all to lowercase. How can I convert them all to lowercase in Sublime Text?..

How to render an ASP.NET MVC view as a string?

I want to output two different views (one as a string that will be sent as an email), and the other the page displayed to a user. Is this possible in ASP.NET MVC beta? I've tried multiple examples: ..

How can I check if a value is of type Integer?

I need to check if a value is an integer. I found this: How to check whether input value is integer or float?, but if I'm not mistaken, the variable there is still of type double even though the value..

Receiving "fatal: Not a git repository" when attempting to remote add a Git repo

I am introducing myself to Git by following this tutorial: getting jekyll running on Everything works fine up until the part where the repo is added to my local machine: git rem..

MySQL error - #1932 - Table 'phpmyadmin.pma user config' doesn't exist in engine

I am trying to set up my database in MySQL using XAMPP. I am doing this via phpMyAdmin on localhost(Apache is running). The only action on my part is typing in a new, unused, name for a database, clic..

VBA Macro to compare all cells of two Excel files

I'm trying to compare two Excel files and store what's only there in the new file in one sheet and store what is only there in the old one in another sheet. (Basically new - old = sheet1 and old - new..

How to commit and rollback transaction in sql server?

I have a huge script for creating tables and porting data from one server. So this sceipt basically has - Create statements for tables. Insert for porting the data to these newly created tables. Cr..

HTML CSS How to stop a table cell from expanding

I have a table which is built with the contents coming from a returned dataset. What I want to do is stop a 'description' cell from expanding over 280px wide, no matter what the content length (its s..

How do I call one constructor from another in Java?

Is it possible to call a constructor from another (within the same class, not from a subclass)? If yes how? And what could be the best way to call another constructor (if there are several ways to do ..

How to export JSON from MongoDB using Robomongo

So I do not know much about MongoDB. I have RoboMongo using which I connect to a MongoDB. What I need to do is this - there is a collection in that MongoDB. I want to export the data from that collect..

No signing certificate "iOS Distribution" found

I am trying to sign an app with my client's certificates. I have received the following file from the client I tried installing the ios_distribution certificate and the key (.p12). Also I have inst..

How do I find duplicates across multiple columns?

So I want to do something like this sql code below: select,, from stuff s group by having count(where city and name are identical) > 1 To produce the following, (but ig..

How to search images from private 1.0 registry in docker?

I made a private registry,curl xx.xx.xx.xx:5000 is ok. I push an image into docker private registry by doing: docker push xx.xx.xx.xx:5000/centos it return: http://xx.xx.xx.xx:5000/v1/repositories/cen..

C# LINQ select from list

i have a list of event Ids returned from an xml document as shown below public IEnumerable<EventFeed> GetEventIdsByEventDate(DateTime eventDate) { return (from feed in xmlDoc.Desce..

Given URL is not allowed by the Application configuration Facebook application error

Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a sub..

How can I remove a pytz timezone from a datetime object?

Is there a simple way to remove the timezone from a pytz datetime object? e.g. reconstructing dt from dt_tz in this example: >>> import datetime >>> import pytz >>> dt = da..

How do MySQL indexes work?

I am really interested in how MySQL indexes work, more specifically, how can they return the data requested without scanning the entire table? It's off-topic, I know, but if there is someone who coul..

Adding n hours to a date in Java?

How do I add n hours to a Date object? I found another example using days on StackOverflow, but still don't understand how to do it with hours...

How to set DateTime to null

Using C#. I have a string dateTimeEnd. If the string is in right format, I wish to generate a DateTime and assign it to eventCustom.DateTimeEnd of type public Nullable<System.DateTime> DateTi..

Webclient / HttpWebRequest with Basic Authentication returns 404 not found for valid URL

Edit: I wanted to come back to note that the problem wasn't on my end at all, but rather with with code on the other company's side. I'm trying to pull up a page using Basic Authentication. I keep ge.. no protocol

I am getting Java exception like: no protocol My program is trying to parse an XML string by using: Document dom; DocumentBuilderFactory dbf = DocumentBuilderFacto..

Find closest previous element jQuery

I am wanting something similar to this person, except the element I want to match might not be a direct sibling. If I had this HTML, for example, <h3> <span> <b>Whaddup..

How to get the list of properties of a class?

How do I get a list of all the properties of a class?..

concatenate variables

I need to do a .bat for DOS that do the following: set ROOT = c:\programas\ set SRC_ROOT = (I want to put the ROOT Here)System\Source so after defining ROOT I want to have SRC_ROOT = c:\programas\S..

How To Set A JS object property name from a variable

I am in need to set a JS object property name dynamically. for(i=1; i<3; i++) { var key = i+'name'; data = { key : 'name1', } } Result should be: data = { 1name: 'name..

Getting the parameters of a running JVM

Is there a way to get the parameters of a running JVM? Is there a command line tool like jstat which takes as input the pid of the JVM and returns its starting parameters? I am particularly interested..

JWT refresh token flow

I'm building a mobile app and am using JWT for authentication. It seems like the best way to do this is to pair the JWT access token with a refresh token so that I can expire the access token as freq..

String concatenation: concat() vs "+" operator

Assuming String a and b: a += b a = a.concat(b) Under the hood, are they the same thing? Here is concat decompiled as reference. I'd like to be able to decompile the + operator as well to see what..

How do I print colored output to the terminal in Python?

Is there a Python equivalent of Perl's print color 'red'; print <something>; print color 'reset'; available? I am using this approach: "\x1b[1;%dm" % (<color code>) + "ERRO..

How to handle :java.util.concurrent.TimeoutException: android.os.BinderProxy.finalize() timed out after 10 seconds errors?

We're seeing a number of TimeoutExceptions in GcWatcher.finalize, BinderProxy.finalize, and PlainSocketImpl.finalize. 90+% of them happen on Android 4.3. We're getting reports of this from Critterci..

Subversion ignoring "--password" and "--username" options

When I try to do any svn command and supply the --username and/or --password options, it prompts me for my password anyways, and always will attempt to use my current user instead of the one specified..

pip install - locale.Error: unsupported locale setting

Full stacktrace: ? ~ pip install virtualenv Traceback (most recent call last): File "/usr/bin/pip", line 11, in <module> sys.exit(main()) File "/usr/lib/python3.4/site-packages/pip/_..

How to compare two dates in Objective-C

I have two dates: 2009-05-11 and the current date. I want to check whether the given date is the current date or not. How is this possible...

Is there an arraylist in Javascript?

I have a bunch of things I want to add into an array, and I don't know what the size of the array will be beforehand. Can I do something similar to the c# arraylist in javascript, and do myArray.Add(o..

React component initialize state from props

In React, are there any real differences between these two implementations? Some friends tell me that the FirstComponent is the pattern, but I don't see why. The SecondComponent seems simpler because ..

Override console.log(); for production

I'm fairly new to Javascript development so this might be a real newbie question. I've got a sencha-touch application riddled with console.log(); for debugging purposes. I've got chirpy doing all of..

How to make <input type="file"/> accept only these types?

I want my uploader only allows these types: doc, docx. xls, xlsx. ppt, pptx. txt. pdf. Image types. How can I achieve this? What should I put in the accept attribute? Thanks for your help. EDIT!!..

Cancel a UIView animation?

Is it possible to cancel a UIView animation while it is in progress? Or would I have to drop to the CA level? i.e. I've done something like this (maybe setting an end animation action too): [UIView ..

How do I disable the security certificate check in Python requests

I am using import requests'', data={'bar':'baz'}) but I get a request.exceptions.SSLError. The website has an expired certficate, but I am not sending sensitive da..

Using C# regular expressions to remove HTML tags

How do I use C# regular expression to replace/remove all HTML tags, including the angle brackets? Can someone please help me with the code?..

How to use onResume()?

Can anyone give me an example that uses onResume() in Android? Also, if I want to restart the activity at the end of the execution of another, which method is executed—onCreate() or onResume()? An.. failed to connect to / (port 2468): connect failed: ECONNREFUSED (Connection refused)

I want to transfer some data between PC and a mobile phone with WiFi. This is how I get the WiFi IP address: String ip = String.format( "%d.%d.%d.%d", (wifiI..

EXEC sp_executesql with multiple parameters

How to pass the parameters to the EXEC sp_executesql statement correctly? This is what I have now, but i'm getting errors: alter PROCEDURE [dbo].[usp_getReceivedCases] -- Add the parameters for..

" app-release.apk" how to change this default generated apk name

Whenever I generate a signed apk in Android Studio, by default it gives the name as app-release.apk... Can we do any settings so that it should prompt and ask me the name which need to be assigned t..

How can I retrieve the remote git address of a repo?

How can I retrieve the remote git address of a repo? I tried git remote but that just lists the branches. ..

process.start() arguments

when i do the following command into dos it will work fine ffmpeg -f image2 -i frame%d.jpg -vcodec mpeg4 -b 800k video.avi When I try to use the process class in c#, without the arguments, it loads..

How to automatically insert a blank row after a group of data

I have created a sample table below that is similar-enough to my table in excel that it should serve to illustrate the question. I want to simply add a row after each distinct datum in column1 (simple..

How can I convert a comma-separated string to an array?

I have a comma-separated string that I want to convert into an array, so I can loop through it. Is there anything built-in to do this? For example, I have this string var str = "January,February,..

How do I install cygwin components from the command line?

Is there a tool in the Cygwin package similar to apt-get on Debian or yum on redhat that allows me to install components from the command line?..

Ignore .classpath and .project from Git

I keep myself telling me and others not to commit .classpath and .project files and use Maven. Somehow, Junior developers always ignore certain rules and commits those files and it's much bette..

What are 'get' and 'set' in Swift?

I'm learning Swift and I'm reading The Swift Programming Language from Apple. I don't have any Objective-C background (only PHP, JavaScript, and others, but not Objective-C). On page 24-25 I see this ..

Convert month int to month name

I was simply trying to use the DateTime structure to transform an integer between 1 and 12 into an abbrieviated month name. Here is what I tried: DateTime getMonth = DateTime.ParseExact(Month.ToStri..

Angular HttpClient "Http failure during parsing"

I try to send an POST request from Angular 4 to my Laravel backend. My LoginService has this method: login(email: string, password: string) { return``, { em..

Get pandas.read_csv to read empty values as empty string instead of nan

I'm using the pandas library to read in some CSV data. In my data, certain columns contain strings. The string "nan" is a possible value, as is an empty string. I managed to get pandas to read "nan..

How to unpackage and repackage a WAR file

I have a WAR file. I would like to open it, edit an XML file, remove some jars and then re-package it. I used WINRAR to open the WAR file and I removed some Jars and did an 'Add to Archive' in WinRar..

json call with C#

I am trying to make a json call using C#. I made a stab at creating a call, but it did not work: public bool SendAnSMSMessage(string message) { HttpWebRequest request = (HttpWebRequest) ..

Multiple files upload (Array) with CodeIgniter 2.0

I've been searching and struggling for 3 days now to make this works but I just can't. What I want to do is use a Multiple file input form and then upload them. I can't just use a fixed number of file..

close fxml window by code, javafx

I need to close the current fxml window by code in the controller I know stage.close() or stage.hide() do this in fx how to implement this in fxml? I tried private void on_btnClose_clicked(Acti..

Generic Interface

Let's say I wanted to define an interface which represents a call to a remote service. Now, the call to the remote service generally returns something, but might also include input parameters. Suppose..

How to pass in parameters when use resource service?

A very rookie-ish question: I'm trying to build resource object using factory method: .factory('Magazines', [function ($resource) { var url = document.URL; var urlArray = url.split("/"); ..

Get distance between two points in canvas

I have canvas drawing tab and want lineWidth to be based on distance between two last mousemove coordinate updates. I will make translation of distance to width myself, I just need to know how to get ..

Whats the CSS to make something go to the next line in the page?

How can I make an element automatically be positioned on a new line in the page? In HTML I could use <br>, but how do I add something like a line-break in CSS? Say I have the following code for..

CSS Outside Border

I want to be able to draw a border OUTSIDE of my Div! So if my div is say 20px by 20px, I want a 1px border outside of this (so in essence, I get a div 22x22px large). I understand that I can just m..

Is it possible to use JS to open an HTML select to show its option list?

Is it possible to use JavaScript to open an HTML select to show its option list?..

How to initialize a struct in accordance with C programming language standards

I want to initialize a struct element, split in declaration and initialization. This is what I have: typedef struct MY_TYPE { bool flag; short int value; double stuff; } MY_TYPE; void function..

What is Hive: Return Code 2 from org.apache.hadoop.hive.ql.exec.MapRedTask

I am getting: FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.MapRedTask While trying to make a copy of a partitioned table using the commands in the hive console: CREAT..

What is %timeit in python?

I always read the code to calculate the time like this way: %timeit function() Can you explain what means "%" here? I think, the "%" is always used to replace something in a string, like %s means..

How to load a UIView using a nib file created with Interface Builder

I'm trying to do something a bit elaborate, but something that should be possible. So here is a challenge for all you experts out there (this forum is a pack of a lot of you guys :) ). I'm creating a..

What is android:weightSum in android, and how does it work?

I want to know: What is android:weightSum and layout weight, and how do they work?..

What does the error "JSX element type '...' does not have any construct or call signatures" mean?

I wrote some code: function renderGreeting(Elem: React.Component<any, any>) { return <span>Hello, <Elem />!</span>; } I'm getting an error: JSX element type Elem doe..

Assign static IP to Docker container

I'm now trying to assign a static IP when a Docker container be started up. I use port 2122 as the ssh port of this container so that I let this container listen port 2122. sudo docker r..

How to add class active on specific li on user click with jQuery

I have a menu with certain items and I want when a user clicks on any li than only its class becomes an active class. I have a menu items like following: <ul class="nav"> <li class="drop..

Script Tag - async & defer

I have a couple of questions about the attributes async & defer for the <script> tag which to my understanding only work in HTML5 browsers. One of my sites has two external JavaScript files ..

Format a message using MessageFormat.format() in Java

I have stored some messages in a resource bundle. I'm trying to format these messages as follows. import java.text.MessageFormat; String text = MessageFormat.format("You're about to delete {0} rows...

how to automatically scroll down a html page?

I'm trying to start each page after the homepage about 500px down, similar to this website: You'll notice when viewing pages after the homepage, you're automatically s..

Should I URL-encode POST data?

I'm POSTing data to an external API (using PHP, if it's relevant). Should I URL-encode the POST variables that I pass? Or do I only need to URL-encode GET data? UPDATE: This is my PHP, in case it is ..

Cosine Similarity between 2 Number Lists

I need to calculate the cosine similarity between two lists, let's say for example list 1 which is dataSetI and list 2 which is dataSetII. I cannot use anything such as numpy or a statistics module. I..

Cleanest way to write retry logic?

Occasionally I have a need to retry an operation several times before giving up. My code is like: int retries = 3; while(true) { try { DoSomething(); break; // success! } catch { if(..

int to hex string

I need to convert an int to hex string. When converting 1400 => 578 using ToString("X") or ToString("X2") but I need it like 0578. Can anyone provide me the IFormatter to ensure that the string ..

How can I find a file/directory that could be anywhere on linux command line?

Ideally, I would be able to use a program like find [file or directory name] to report the paths with matching filenames/directories. Unfortunately this seems to only check the current directory, ..

Unable to add window -- token null is not valid; is your activity running?

i want to show a custom popup menu when user click on a floating icon the float icon create with an service and i have no activity this is my floating icon code public class copy_actions_service ex..

How to scale an Image in ImageView to keep the aspect ratio

In Android, I defined an ImageView's layout_width to be fill_parent (which takes up the full width of the phone). If the image I put to ImageView is bigger than the layout_width, Android will scale i..

how to access iFrame parent page using jquery?

I have an iframe and in order to access parent element I implemented following code: window.parent.document.getElementById('parentPrice').innerHTML How to get the same result using jquery? UPDATE: ..

How do I read the source code of shell commands?

I would like to read the actual source code which the linux commands are written with. I've gained some experience using them and now I think it's time to interact with my machine at a deeper level. ..

Python initializing a list of lists

Possible Duplicate: List of lists changes reflected across sublists unexpectedly I intend to initialize a list of list with length of n. x = [[]] * n However, this somehow links the lists together..

pandas groupby sort within groups

I want to group my dataframe by two columns and then sort the aggregated results within the groups. In [167]: df Out[167]: count job source 0 2 sales A 1 4 sales B 2 6 sales C 3 ..

Rounding a double to turn it into an int (java)

Right now I'm trying this: int a = round(n); where n is a double but it's not working. What am I doing wrong? ..

Apache HttpClient 4.0.3 - how do I set cookie with sessionID for POST request?

can you tell me how to store jsessionid in cookie, so it can be passed to the servlet with post request? I'm using Apache HttpClient version 4.0.3. All the solutions I've found explains how to do this..

How to zoom div content using jquery?

I have a parent <div>. Inside that I place some text and images. Now I need to zoom to a particular portion of that parent <div>. Is it possible?..

Return datetime object of previous month

If only timedelta had a month argument in it's constructor. So what's the simplest way to do this? EDIT: I wasn't thinking too hard about this as was pointed out below. Really what I wanted was any..

Linq Syntax - Selecting multiple columns

This is my Linq Syntax which I am using to my entity model IQueryable<string> objEmployee = null; objEmployee = from res in _db.EMPLOYEEs where (res.EMAIL == givenInfo || res.USE..

How to convert XML to JSON in Python?

Possible Duplicate: Converting XML to JSON using Python? I'm doing some work on App Engine and I need to convert an XML document being retrieved from a remote server into an equivalent JSON..

How do I debug "Error: spawn ENOENT" on node.js?

When I get the following error: events.js:72 throw er; // Unhandled 'error' event ^ Error: spawn ENOENT at errnoException (child_process.js:1000:11) at Process.ChildProc..

How to get array keys in Javascript?

I have an array created with this code: var widthRange = new Array(); widthRange[46] = { min:0, max:52 }; widthRange[66] = { min:52, max:70 }; widthRange[90] = { min:70, max:94 }; I want to get ea..

Rotate an image in image source in html

Is there a way I could add in the source of my image codes that could rotate my image? Something like this: <img id="image_canv" src="/image.png" rotate="90"> I'm making my images dynamic, s..

Style jQuery autocomplete in a Bootstrap input field

I have implemented a jQuery autocomplete function to a Bootstrap input. The jQuery autocomplete is working fine but I want to see the results as a combo and I guess it's now happening because I'm usin..

Is it possible to GROUP BY multiple columns using MySQL?

Is it possible to GROUP BY more than one column in a MySQL SELECT query? For example: GROUP BY fV.tier_id AND 'f.form_template_id' ..

Why doesn't "System.out.println" work in Android?

I want to print something in console, so that I can debug it. But for some reason, nothing prints in my Android application. How do I debug then? public class HelloWebview extends Activity { ..

Python Database connection Close

Using the code below leaves me with an open connection, how do I close? import pyodbc conn = pyodbc.connect('DRIVER=MySQL ODBC 5.1 driver;SERVER=localhost;DATABASE=spt;UID=who;PWD=testest') csr..

Write / add data in JSON file using Node.js

I am trying to write JSON file using node from loop data, e.g.: let jsonFile = require('jsonfile'); for (i = 0; i < 11; i++) { jsonFile.writeFile('loop.json', "id :" + i + " square :" + i * i..

How to import classes defined in

I am trying to organize some modules for my own use. I have something like this: lib/ foo/ bar/ ..

Aligning a button to the center

I have a simple submit button. I am wanting to align it to the center. Here is my code: <input type="submit" name="btnSubmit" value="Submit" onClick="Submit" align="center"> However, it does ..

Launch Failed. Binary not found. CDT on Eclipse Helios

I'm using Eclipse Helios on Ubuntu 10.04, and I'm trying to install CDT plugin on it. I download it from here here. And then I go to Install New Software and select the zip file (I don't extract it,..

Targeting only Firefox with CSS

Using conditional comments it is easy to target Internet Explorer with browser-specific CSS rules: <!--[if IE 6]> ...include IE6-specific stylesheet here... <![endif]--> Sometimes it is..

The content type application/xml;charset=utf-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8)

I trying to consume a WCF web service using stand alone application. I am able to view this service using Internet Explorer also able to view in Visual studio service references. This is the error I..

How to extract text from a string using sed?

My example string is as follows: This is 02G05 a test string 20-Jul-2012 Now from the above string I want to extract 02G05. For that I tried the following regex with sed $ echo "This is 02G05 a te..

How to change webservice url endpoint?

I generated a web-service client using JBoss utils (JAX-WS compatible) using Eclipse 'web service client from a wsdl'. So, the only thing I provided was a url to a web-service WSDL. Now, the web ser..

Print Html template in Angular 2 (ng-print in Angular 2)

I want to print HTML template in angular 2. I had explored about this I got solution in angularjs 1 Print Html Template in Angularjs 1 Any suggestion would be appreciated ..

Cannot download Docker images behind a proxy

I installed Docker on my Ubuntu 13.10 (Saucy Salamander) and when I type in my console: sudo docker pull busybox I get the following error: Pulling repository busybox 2014/04/16 09:37:07 Get https..

Find ALL tweets from a user (not just the first 3,200)

With I can get 3,200 most recent tweets. However, certain sites like seems to bypass the limit, and my browse th..

How do I remove a property from a JavaScript object?

Say I create an object as follows: let myObject = { "ircEvent": "PRIVMSG", "method": "newURI", "regex": "^http://.*" }; What is the b..

Only one expression can be specified in the select list when the subquery is not introduced with EXISTS

My query is as follows, and contains a subquery within it: select count(distinct dNum) from myDB.dbo.AQ where A_ID in (SELECT DISTINCT TOP (0.1) PERCENT A_ID, COUNT(DISTINCT dNum) ..

ConvergenceWarning: Liblinear failed to converge, increase the number of iterations

Running the code of linear binary pattern for Adrian. This program runs but gives the following warning: C:\Python27\lib\site-packages\sklearn\svm\ ConvergenceWarning: Liblinear failed t..

Getting a better understanding of callback functions in JavaScript

I understand passing in a function to another function as a callback and having it execute, but I'm not understanding the best implementation to do that. I'm looking for a very basic example, like thi..

How to convert <font size="10"> to px?

I need to convert <font size="10"> to px. Example only(not correct): <font size="10"> is equivalent to 12px. Is there any formula or table conversion out there to convert <font size=..

How to allow all Network connection types HTTP and HTTPS in Android (9) Pie?

From Android 9 Pie now, requests without encryption will never work. And by default, the System will expect you to use TLS by default.You can read this feature here So if you only make requests via HT..

typedef fixed length array

I have to define a 24-bit data type.I am using char[3] to represent the type. Can I typedef char[3] to type24? I tried it in a code sample. I put typedef char[3] type24; in my header file. The compile..

Using SVG as background image

I can't seem to get this to work as desired. My page changes height based on what content is loaded and if it requires a scroll, the svg doesn't seem to be stretching... _x000D_ _x000D_ html {_x000D_..

Insert at first position of a list in Python

How can I insert an element at the first index of a list? If I use list.insert(0, elem), does elem modify the content of the first index? Or do I have to create a new list with the first elem and then..

Rollback a Git merge

develop branch --> dashboard (working branch) I use git merge --no-ff develop to merge any upstream changes into dashboard git log: commit 88113a64a21bf8a51409ee2a1321442fd08db705 Merge: 981bc2..

'System.Net.Http.HttpContent' does not contain a definition for 'ReadAsAsync' and no extension method

I made a console app to consume a Web API I just made. The console app code does not compile. It gives me the compilation error: 'System.Net.Http.HttpContent' does not contain a definition for 'Read..

writing a batch file that opens a chrome URL

looking for some help writing a batch file to use as a joke on my friend. essentially i want it to open a certain URL in chrome. then i was going to disguise it as something like svchost.exe and have ..

Convert a date format in epoch

I have a string with a date format such as Jun 13 2003 23:11:52.454 UTC containing millisec... which I want to convert in epoch. Is there an utility in Java I can use to do this conversion?..

How do I see the extensions loaded by PHP?

It's got to be somewhere in the phpinfo() dump, but I just don't know where. Is it supposed to be under the "Additional Modules" section? Somewhere else? I'm trying to figure out why some extension..

DataGridView checkbox column - value and functionality

I've added a checkbox column to a DataGridView in my C# form. The function needs to be dynamic - you select a customer and that brings up all of their items that could be serviced, and you select whic..

IntelliJ IDEA "The selected directory is not a valid home for JDK"

I just installed IntelliJ IDEA and I'm trying to set it up. I've gotten to the part where I need to select my home directory for my JDK. I tried navigating to my Java installation, C:\Program Files (..

How to implement a confirmation (yes/no) DialogPreference?

How can I implement a Preference that displays a simple yes/no confirmation dialog? For an example, see Browser->Setting->Clear Cache...

How to outline text in HTML / CSS

Let's say I have white characters and I want a black outline over each character (this is different from outlining the whole text box). What is the code to make this outline ? EDIT: Well bummer, I..

Solution for "Fatal error: Maximum function nesting level of '100' reached, aborting!" in PHP

I have made a function that finds all the URLs within an html file and repeats the same process for each html content linked to the discovered URLs. The function is recursive and can go on endlessly. ..

Why am I getting the message, "fatal: This operation must be run in a work tree?"

Just installed git on Windows. I set the GIT_DIR variable to be c:\git\ and verified that this environment variable is maintained by cygwin (i.e. echo $GIT_DIR is what it should be). I went to the fo..

How can I mock requests and the response?

I am trying to use Pythons mock package to mock Pythons requests module. What are the basic calls to get me working in below scenario? In my, I have a function that makes variety of requests..

Using CMake with GNU Make: How can I see the exact commands?

I use CMake with GNU Make and would like to see all commands exactly (for example how the compiler is executed, all the flags etc.). GNU make has --debug, but it does not seem to be that helpful are ..

How do you define a class of constants in Java?

Suppose you need to define a class which all it does is hold constants. public static final String SOME_CONST = "SOME_VALUE"; What is the preferred way of doing this? Interface Abstract Class Fin..

Combine Date and Time columns using python pandas

I have a pandas dataframe with the following columns; Date Time 01-06-2013 23:00:00 02-06-2013 01:00:00 02-06-2013 21:00:00 02-06-2013 22:00:00 02-06-2013 23:00:..

How can I get a list of all open named pipes in Windows?

Is there an easy way to test whether your named pipe is working correctly? I want to make sure that the data I'm sending from my app is actually being sent. Is there a quick and easy way to get a list..

Javascript - object key->value

var obj = { a: "A", b: "B", c: "C" } console.log(obj.a); // return string : A but i want to get by through a variable like this var name = "a"; console.log( // but return undefin..

Creating custom function in React component

I have a React component export default class Archive extends React.Component { ... } componentDidMount and onClick methods partially use the same code, except for slight change in parameters. ..

SQL Server: Is it possible to insert into two tables at the same time?

My database contains three tables called Object_Table, Data_Table and Link_Table. The link table just contains two columns, the identity of an object record and an identity of a data record. I want t..

Calling Python in PHP

I have a Python script I recently wrote that I call using the command line with some options. I now want a very thin web interface to call this script locally on my Mac. I don't want to go through th..

How to get year/month/day from a date object?

alert(dateObj) gives Wed Dec 30 2009 00:00:00 GMT+0800 How to get date in format 2009/12/30?..

Convert default format to Timestamp in Java

The default format of is something like this "Mon May 27 11:46:15 IST 2013". How can I convert this into timestamp and calculate in seconds the difference between the same and current t..

Check string for palindrome

A palindrome is a word, phrase, number or other sequence of units that can be read the same way in either direction. To check whether a word is a palindrome I get the char array of the word and compa..

Difference between long and int data types

Considering that the following statements return 4, what is the difference between the int and long types in C++? sizeof(int) sizeof(long) ..

How do I completely remove root password

I am running slitaz distro, and would like to completely remove the root password. I have tried giving a blank password to the passwd command, however that did not seem to do the trick. It gave me an ..

Easiest way to open a download window without navigating away from the page

What is the best cross browser way to open a download dialog (let's assume we can set content-disposion:attachment in the headers) without navigating away from the current page, or opening popups, whi..

How do I print a double value without scientific notation using Java?

I want to print a double value in Java without exponential form. double dexp = 12345678; System.out.println("dexp: "+dexp); It shows this E notation: 1.2345678E7. I want it to print it like this: ..

Disable / Check for Mock Location (prevent gps spoofing)

Looking to find the best way to prevent / detect GPS spoofing on Android. Any suggestions on how this is accomplished, and what can be done to stop it? I am guessing the user has to turn on mock locat..

When use ResponseEntity<T> and @RestController for Spring RESTful applications

I am working with Spring Framework 4.0.7, together with MVC and Rest I can work in peace with: @Controller ResponseEntity<T> For example: @Controller @RequestMapping("/person") @Profile("..

How can I convert an image into a Base64 string?

What is the code to transform an image (maximum of 200 KB) into a Base64 String? I need to know how to do it with Android, because I have to add the functionality to upload images to a remote se..

Chrome's remote debugging (USB debugging) not working for Samsung Galaxy S3 running android 4.3

Ever since I upgraded my Samsung Galaxy S3 to android 4.3 (from 4.1.2) I am unable to use Chrome's remote debugging for android (more details here). I have the developer options and USB debugging ena..

Can I change the headers of the HTTP request sent by the browser?

I'm looking into a restful design and would like to use the HTTP methods (POST, GET, ...) and HTTP headers as much as possible. I already found out that the HTTP methods PUT and DELETE are not support..

Sorting std::map using value

I need to sort an std::map by value rather than by key. Is there an easy way to do it? I got one solution from the follwing thread: std::map sort by data? Is there a better solution? map<long, ..

How to use Bash to create a folder if it doesn't already exist?

#!/bin/bash if [!-d /home/mlzboy/b2c2/shared/db]; then mkdir -p /home/mlzboy/b2c2/shared/db; fi; This doesn't seem to work. Can anyone help?..

Can two applications listen to the same port?

Can two applications on the same machine bind to the same port and IP address? Taking it a step further, can one app listen to requests coming from a certain IP and the other to another remote IP? I ..

Docker remove <none> TAG images

root@server:~# docker images -a REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE <none> <none> 5e2dfc8..

Which is the best Linux C/C++ debugger (or front-end to gdb) to help teaching programming?

I teach a sort of "lite" C++ programming course to novices ("lite" meaning no pointers, no classes, just plain old C, plus references and STL string and vectors). Students have no previous experience ..

Changing SqlConnection timeout

I am trying to override the default SqlConnection timeout of 15 seconds and am getting an error saying that the property or indexer cannot be assigned because it is read only. Is there a way ar..

What is the largest possible heap size with a 64-bit JVM?

The theoretical maximum heap value that can be set with -Xmx in a 32-bit system is of course 2^32 bytes, but typically (see: Understanding max JVM heap size - 32bit vs 64bit) one cannot use all 4GB. ..

How to get CSS to select ID that begins with a string (not in Javascript)?

If the HTML has elements like this: id="product42" id="product43" ... How do I match all of those id's starting with "product"? I've seen answers that do this exactly using javascript, but how to ..

"CSV file does not exist" for a filename with embedded quotes

I am currently learning Pandas for data analysis and having some issues reading a csv file in Atom editor. When I am running the following code: import pandas as pd df = pd.read_csv("FBI-CRIME11...