Questions Tagged with #Jquery

jQuery is a popular cross-browser JavaScript library that facilitates Document Object Model (DOM) traversal, event handling, animations, and AJAX interactions by minimizing the discrepancies across browsers. A question tagged jquery should be related to jquery, so jquery should be used by the code in question and at least a jquery usage-related elements need to be in the question.

Animate scroll to ID on page load

Im tring to animate the scroll to a particular ID on page load. I have done lots of research and came across this: $("html, body").animate({ scrollTop: $('#title1').height() }, 1000); but this seem..

Set height of <div> = to height of another <div> through .css

I have two <div> elements on this site. It's a site I'm developing, and is a work in progress, but some of the design choices I'd like to finalize tonight. Right now my simplified .css is thus: ..

Getting data-* attribute for onclick event for an html element

<a id="option1" data-id="10" data-option="21" href="#" onclick="goDoSomething(?,?);"> Click to do something </a> I want to get the data-id and data-option values inside the functi..

jQuery - Dynamically Create Button and Attach Event Handler

I would like to dynamically add a button control to a table using jQuery and attach a click event handler. I tried the following, without success: $("#myButton").click(function () { var test = $(..

Change border-bottom color using jquery?

I want to change the color of the bottom border using jquery..Thanks..

Adding click event for a button created dynamically using jQuery

How to add a button click event on a button that was added dynamically using jQuery? The jQuery code that adds the dynamic buttons inside a div container: $('#pg_menu_content').empty(); $div = $('&l..

jQuery UI Dialog individual CSS styling

I'm looking to style a modal dialog (using UI Dialog) with unique CSS that is separate from the traditional dialog, so in essence to have two jQuery dialogs that each look different. I've styled one,..

jQuery How to Get Element's Margin and Padding?

Just wondering - how using jQuery - I can get an elements formatted total padding and margin etc ? i.e. 30px 30px 30px 30px or 30px 5px 15px 30px etc I tried var margT = jQuery('img').css('margin')..

Integrating Dropzone.js into existing HTML form with other fields

I currently have a HTML form which users fill in details of an advert they wish to post. I now want to be able to add a dropzone for uploading images of the item for sale. I have found Dropzone.js wh..

Pure JavaScript equivalent of jQuery's $.ready() - how to call a function when the page/DOM is ready for it

With jQuery, we all know the wonderful .ready() function: $('document').ready(function(){}); However, let's say I want to run a function that is written in standard JavaScript with no library backi..

Can I append an array to 'formdata' in javascript?

I'm using FormData to upload files. I also want to send an array of other data. When I send just the image, it works fine. When I append some text to the formdata, it works fine. When I try to attac..

How can I display a tooltip message on hover using jQuery?

As the title states, how can I display a tooltip message on hover using jQuery?..

How to set column widths to a jQuery datatable?

I have a jQuery datatable(outlined in red), but what happens is that the table jumps out of the width I have set for the div(which is 650 px). Here is the screen shot: Here is my code: <script typ..

jQuery: click function exclude children.

Trying to wrap my head around the jQuery ".not()" function, and running into a problem. I would like to have the parent div to be "clickable" but if a user clicks on a child element, the script is not..

How do I select an element with its name attribute in jQuery?

How to get an element with its name attribute with jQuery? Is there anything (like # for id and . for class) for name in jQuery?..

Creating a jQuery object from a big HTML-string

I have a big HTML-string containing multiple child-nodes. Is it possible to construct a jQuery DOM object using this string? I've tried $(string) but it only returns an array containing all the indi..

AngularJS + JQuery : How to get dynamic content working in angularjs

I am working on a Ajax app using both jQuery and AngularJS. When I update content (which contains AngularJS bindings) of a div using jQuery's html function, the AngularJS bindings doesn't work. Fol..

How to set top position using jquery

I am creating custom div scroller and want to set top position of content div. My jquery code is as below: containerOuterHeight=$("#messagePopUpContainer").outerHeight(); contentOuterHeig..

How to use FormData for AJAX file upload?

This is my HTML which I'm generating dynamically using drag and drop functionality. <form method="POST" id="contact" name="13" class="form-horizontal wpc_contact&..

Jquery onclick on div

I have a simple question. The following code works for all the tags: $('*').click(function(e) { alert(1); }); But, when I try this code for the div with id "content": $('#content').click(fun..

OnClick Send To Ajax

I'm trying to complete some ajax requests to insert a textarea into a database without refresh. Here is my code: HTML: <textarea name='Status'> </textarea> <input type='button' oncli..

Browser back button handling

I am trying to handle browser back button event but i could not find any solution. I want to ask user if he clicks on browser back button using "confirm box" if he chooses ok i have to allow back bu..

Create, read, and erase cookies with jQuery

Somebody help me. How to create, read and erase some cookies with jQuery ? ..

Disable elastic scrolling in Safari

I just wanted to diable the elastic scrolling/bounce effect in Safari (OSX Lion). I found the solution to set overflow: hidden for body in css, but as expected it only disables the scrollbar, so if t..

JavaScript or jQuery browser back button click detector

Could someone please share experience / code how we can detect the browser back button click (for any type of browsers)? We need to cater all browser that doesn't support HTML5..

How can I override the OnBeforeUnload dialog and replace it with my own?

I need to warn users about unsaved changes before they leave a page (a pretty common problem). window.onbeforeunload = handler This works but it raises a default dialog with an irritating standard me..

Jquery, Clear / Empty all contents of tbody element?

I thought this would be rather simple but it seems the empty method is not working to clear out a tbody that I have. I would appreciate if anyone knows a proper way to do this, I just want to delete e..

adding to window.onload event?

I'm wondering how to add another method call to the window.onload event once it has already been assigned a method call. Suppose somewhere in the script I have this assignment... window.onload = fu..

jQuery get textarea text

Recently I have started playing with jQuery, and have been following a couple of tutorials. Now I feel slightly competent with using it (it's pretty easy), and I thought it would be cool if I were abl..

Check if an array is empty or exists

When the page is loading for the first time, I need to check if there is an image in image_array and load the last image. Otherwise, I disable the preview buttons, alert the user to push new image bu..

bootstrap datepicker change date event doesnt fire up when manually editing dates or clearing date

<script type="text/javascript"> // When the document is ready $(document).ready(function () { $('.datepicker').datepicker({ format: "yyyy-mm-dd", }).on('chang..

Call PHP function from jQuery?

I have a PHP function on my site which takes a couple of seconds to complete. This holds the whole page up which I don't want. Would it be possible with jquery to call this PHP function after the pag..

How to change the text of a button in jQuery?

How do you change the text value of a button in jQuery? Currently, my button has 'Add' as its text value, and upon being clicked I want it to change to 'Save'. I have tried this method below, but so f..

How can I add an element after another element?

I have a certain textbox and I want to add a div after it. I've tried the .append() function, but that only adds the div in the element. For example, I have: <input type="text" id="bla" /> a..

Sending credentials with cross-domain posts?

According to Requests with credentials, Firefox will only send credentials along with cross-domain posts if invocation.withCredentials = "true"; is set… But it doesn't seem like jQuery's Ajax AP..

How can I get name of element with jQuery?

How can I get name property of HTML element with jQuery?..

Change the jquery show()/hide() animation?

By default if you specify a speed jquery adds a weird looking animation where it expands from the left end corner. I want it to just slide down. Is there a way to do that without importing something e..

Why does the jquery change event not trigger when I set the value of a select using val()?

The logic in the change() event handler is not being run when the value is set by val(), but it does run when user selects a value with their mouse. Why is this? <select id="single"> <op..

jQuery rotate/transform

I'd like to use this function to rotate then stop at a particular point or degree. Right now the element just rotates without stopping. Here's the code: <script type="text/javascript"> ..

Difference between $(document.body) and $('body')

I am a jQuery beginner and while going through some code examples I found: $(document.body) and $('body') Is there any difference between these two?..

The preferred way of creating a new element with jQuery

I've got 2 ways I can create a <div> using jQuery. Either: var div = $("<div></div>"); $("#box").append(div); Or: $("#box").append("<div></div>"); What are the dra..

Count characters in textarea

I want to count characters in a textarea, so I just made: <textarea id="field" onkeyup="countChar(this)"></textarea> function countChar(val){ var len = val.value.length; if (le..

jQuery DataTable overflow and text-wrapping issues

I have the following DataTable (full-width css class sets width = 100%) <table class="datatable full-width"> <thead> <th>LOB</th> <th>Creditor Line 1..

how to remove only one style property with jquery

I have a div with this property style="-moz-user-select:none; position:static !important;". I need to remove the -moz-user-select Tried with $(selector).css() but I don't know what value to set becaus..

jQuery UI Dialog Box - does not open after being closed

I have a problem with the jquery-ui dialog box. The problem is that when I close the dialog box and then I click on the link that triggers it, it does not pop-up again unless I refresh the page. H..

jQuery AJAX file upload PHP

I want to implement a simple file upload in my intranet-page, with the smallest setup possible. This is my HTML part: <input id="sortpicture" type="file" name="sortpic" /> <button id="uploa..

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..

jQuery adding 2 numbers from input fields

I am trying to add two values of alert boxes but I keep getting a blank alert box. I don't know why. $(document).ready(function(){ var a = $("#a").val(); var b = $("#b").val(); $("sub..

Twitter Bootstrap scrollable table rows and fixed header

Does anyone know how to make a table with a fixed header row and scrollable body rows? I'm using twitter bootstrap if that matters. This is an example of what I'm trying to create: http://www.sitee..

How to get numeric value from a prompt box?

I was trying to do some simple mathematical calculations in HTML and jQuery and JavaScript, so I wanted to get input from user. For input I tried doing this : var x = prompt("Enter a Value","0"); v..

jQuery click not working for dynamically created items

I have a piece of jQuery that loops through each element in a given div( #container) and does a javascript alert each time a span is clicked. This works fine if the <span>'s are static. Howeve..

jQuery Ajax requests are getting cancelled without being sent

I am trying to hook up a script to Microsoft's World-Wide Telescope app. The latter listens on port 5050 for commands. It is running on the same machine as the browser (Chrome right now, but as far as..

What does [object Object] mean? (JavaScript)

One of my alerts is giving the following result: [object Object] What does this mean exactly? (This was an alert of some jQuery object.)..

JQuery find first parent element with specific class prefix

I want to get the first parent which has a specific class prefix, suppose: <div class="div-a3332"> <div class="div-a89892"> <p> <div class="div-b2"> <d..

How to bind 'touchstart' and 'click' events but not respond to both?

I'm working on a mobile web site that has to work on a variety of devices. The one's giving me a headache at the moment are BlackBerry. We need to support both keyboard clicks as well as touch events..

jQuery - simple input validation - "empty" and "not empty"

I have an input that I want to validate: <input type="text" id="input" /> And here's the JS: jQuery("#input").live('change', function() { if("#input:not(:empty)") { ..

(Deep) copying an array using jQuery

Possible Duplicate: What is the most efficient way to clone a JavaScript object? I need to copy an (ordered, not associative) array of objects. I'm using jQuery. I initially tried jquery...

jQuery: Get height of hidden element in jQuery

I need to get height of an element that is within a div that is hidden. Right now I show the div, get the height, and hide the parent div. This seems a bit silly. Is there a better way? I'm using jQu..

Bootstrap tab activation with JQuery

I have the following code: <ul class="nav nav-tabs"> <li><a href="#aaa" data-toggle="tab">AAA</a></li> <li><a href="#b..

jQuery - find table row containing table cell containing specific text

I need to get a tr element which contains a td element which contains specific text. The td will contain that text and only that text (so I need text = 'foo' not text contains 'foo' logic). So I need..

append to url and refresh page

I am looking to write a piece of javascript that will append a parameter to the current url and then refresh the page - how can I do this?..

Converting a JS object to an array using jQuery

My application creates a JavaScript object, like the following: myObj= {1:[Array-Data], 2:[Array-Data]} But I need this object as an array. array[1]:[Array-Data] array[2]:[Array-Data] So I trie..

Force browser to download image files on click

I need the browser to download the image files just as it does while clicking on an Excel sheet. Is there a way to do this using client-side programming only? <html xmlns="http://www.w3.org/1999/..

Accessing clicked element in angularjs

I'm relatively new to AngularJS and suspect I'm not grasping a concept. I'm also using Twitter Bootstrap and I've got jQuery loaded. Workflow: User clicks a link from a list, "master" section is upda..

jQuery validation: change default error message

Is there a simple way to change the default error values in the jQuery validation plugin? I just want to rewrite the error messages to be more personal to my app--I have a lot of fields, so I don't w..

Jquery ajax call click event submit button

I've to build an ajax call when the user clicks a submit button, so i've included jquery and i've written the following code (taken from the jquery documentation): <script src="http://code.jquery...

Read/write to file using jQuery

Is there a way to get jQuery to get information to and from a file? Is it possible? How?..

JQuery: dynamic height() with window resize()

I'm having an issue identical to this poster: Jquery problem with height() and resize() But the solution doesn't fix my issue. I have three stacked divs, and I want to use JQuery to make the middle o..

Only on Firefox "Loading failed for the <script> with source"

I want to integrate Marketo form with my existing website on yii framework. My code works on all the browsers except Firefox. Excerpt from my code: $('#button').click(function () { var formD..

event.returnValue is deprecated. Please use the standard event.preventDefault() instead

I have this script: <script> $(document).ready(function () { $("#changeResumeStatus").click(function () { $.get("{% url 'main:changeResumeStatus' %}", function (data) { ..

How to delete last character from a string using jQuery?

How to delete last character from a string for instance in 123-4- when I delete 4 it should display 123- using jQuery...

Prevent Default on Form Submit jQuery

What's wrong with this? HTML: <form action="http://localhost:8888/bevbros/index.php/test" method="post" accept-charset="utf-8" id="cpa-form" class="forms"> <input type="text" ..

Get jQuery version from inspecting the jQuery object

Is there a way to find out what version of jQuery is being used by inspecting the jQuery object? jQuery is dynamically getting added to my page and I cannot see any reference to it in my markup. If I ..

How to get href value using jQuery?

I'm trying to get href value using jQuery: <html> <head> <title>Jquery Test</title> <script type="text/javascript" src="http://code.jquery.com/jquery-l..

"Uncaught TypeError: a.indexOf is not a function" error when opening new foundation project

I've created a new Foundation 5 project through bash, with foundation new my-project. When I open the index.html file in Chrome an Uncaught TypeError: a.indexOf is not a function error is shown in the..

current/duration time of html5 video?

I need a way of getting the total time length of the video and the current time with jquery and displaying it in a couple of <div> tags. <div id="current">0:00</div> <div id="dur..

Ajax Success and Error function failure

I am having trouble getting my jQuery ajax to work properly. It directs to the PHP page to update the database, but never returns back to the script for the success or error options. My code is below..

How to loop and render elements in React.js without an array of objects to map?

I'm trying to convert a jQuery component to React.js and one of the things I'm having difficulty with is rendering n number of elements based on a for loop. I understand this is not possible, or re..

Twitter Bootstrap add active class to li

Using twitter bootstrap, and I need to initiate active class to the li portion of the main nav. Automagically. We use php not ruby. Sample nav : <ul class="nav"> <li><a href="/"&g..

Real time data graphing on a line chart with html5

I want to make a line chart that updates every couple of seconds and doesn't need the page to be refreshed(it would get the info from a separate file that updates on a server), is their any JavaScript..

How to iterate a table rows with JQuery and access some cell values?

<table class="checkout itemsOverview"> <tr class="item"> <td>GR-10 Senderos</td> <td><span class="value">15.00</span> €</td> ..

Resize jqGrid when browser is resized?

Is there any way to resize a jqGrid when the browser window is resized? I have tried the method described here but that technique does not work in IE7...

Detect Safari using jQuery

Though both are Webkit based browsers, Safari urlencodes quotation marks in the URL while Chrome does not. Therefore I need to distinguish between these two in JS. jQuery's browser detection docs ma..

Getting Error "Form submission canceled because the form is not connected"

I have an old website with JQuery 1.7 which works correctly till two days ago. Suddenly some of my buttons do not work anymore and, after clicking on them, I get this warning in the console: Form ..

Can jQuery get all CSS styles associated with an element?

Is there a way in jQuery to get all CSS from an existing element and apply it to another without listing them all? I know it would work if they were a style attribute with attr(), but all of my style..

JQuery show/hide when hover

I have three links, Cat, Dog, Snakes. When I hover over each, the content relating to each link should change. So if i hover over cat, then cat content will appear, if i hover over dog the cat conte..

Stopping fixed position scrolling at a certain point?

I have an element that is position:fixed and so scrolls with the page how i want it to however. when the user scrolls up I want the element to stop scrolling at a certain point, say when it is 250px f..

How can I detect window size with jQuery?

How can I detect window/browser size with jQuery like Gmail? In Gmail, we don't need to refresh or reload current page as soon as we have changed window resolution in window setting? In my project, I ..

what is the difference between ajax and jquery and which one is better?

I am confused about using ajax or jquery so I want to know what the differences are and which one is better such as performance and complexity ...

jQuery - Add active class and remove active from other element on click

I'm new to jQuery, so I'm sorry if this is a silly question. But I've been looking through Stack Overflow and I can find things that half work, I just can't get it to fully work. I have 2 tabs - 1 i..

jQuery select element in parent window

Is there a way to select a DIV in the parent window using jQuery? For example: Main page contains this, <div id="testdiv"></div> Popup page has a form with some options and an 'Apply'..

jQuery - Getting the text value of a table cell in the same row as a clicked element

I click a link in a table cell. I need to get the value of a specific cell within this same table row. <tr> <td class="one">this</td> <td class="two">that</td> ..

What is the opposite of evt.preventDefault();

Once I've fired an evt.preventDefault(), how can I resume default actions again?..

How can I include all JavaScript files in a directory via JavaScript file?

I have a bunch of JavaScript files that I would like to include in the page, but I don't want to have to keep writing <script type="text/javascript" src="js/file.js"></script> So is th..

jQuery calculate sum of values in all text fields

I have an order form with about 30 text fields that contain numerical values. I'd like to calculate the sum of all those values on blur. I know how to select all text fields but not how to loop throu..

How to get the text node of an element?

<div class="title"> I am text node <a class="edit">Edit</a> </div> I wish to get the "I am text node", do not wish to remove the "edit" tag, and need a cross browser so..

How do I remove the height style from a DIV using jQuery?

By default, a DIV's height is determined by its contents. But, I override that and explicitly set a height with jQuery: $('div#someDiv').height(someNumberOfPixels); How can I reverse that? I want..

jquery ajax get responsetext from http url

Neither: var response = $.ajax({ type: "GET", url: "http://www.google.de", async: false, success : function() { alert (this); } }); Nor: var response2 = $.get("ht..

Uncaught TypeError: Cannot read property 'msie' of undefined - jQuery tools

I am getting the following error in Chrome dev console: Uncaught TypeError: Cannot read property 'msie' of undefined My understanding is that it is because .browser is now deprecated in jQuery howe..

How can I recognize touch events using jQuery in Safari for iPad? Is it possible?

Is it possible to recognize touch events on the iPad's Safari browser using jQuery? I used mouseOver and mouseOut events in a web application. Are there any similar events for the iPad's Safari brow..

Ruby replace string with captured regex pattern

I am having trouble translating this into Ruby. Here is a piece of JavaScript that does exactly what I want to do: function get_code(str){ return str.replace(/^(Z_.*): .*/,"$1")?????????????????..

Copying text to the clipboard using Java

I want to copy text from a JTable's cell to the clipboard, making it available to be pasted into other programs such as Microsoft Word. I have the text from the JTable, but I am unsure how to copy it ..

Very simple C# CSV reader

I'd like to create an array from a CSV file. This is about as simple as you can imagine, the CSV file will only ever have one line and these values: Device, SignalStrength, Location, Time, Age. I'..

How to fix "could not find a base address that matches schema http"... in WCF

I'm trying to deploy a WCF service to my server, hosted in IIS. Naturally it works on my machine :) But when I deploy it, I get the following error: This collection already contains an address..

node: command not found

I am in the process of setting up node.js in order to work with a framework like Meteor, Derby, or Ember, but am running into some problems early on. Following these instructions (http://www.nodebegin..

How do you check that a number is NaN in JavaScript?

I’ve only been trying it in Firefox’s JavaScript console, but neither of the following statements return true: parseFloat('geoff') == NaN; parseFloat('geoff') == Number.NaN; ..

How to send a simple string between two programs using pipes?

I tried searching on the net, but there are hardly any resources. A small example would suffice. EDIT I mean, two different C programs communicating with each other. One program should send "Hi" and ..

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..

How to submit a form on enter when the textarea has focus?

When filling out a form's textarea, the default behavior when the enter key is hit is to move to the next line. How can I change the behavior of the form so it will submit upon user hitting enter even..

Markdown and including multiple files

Is there any markdown fork that allows you to reference other files, something like an includes file? Specifically, I want to create a separate markdown file with links that I call often but not alway..

Enter key press in C#

I tried this code: private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if (Convert.ToInt32(e.KeyChar) == 13) { MessageBox.Show(" Enter pressed "); } } and this..

Remove specific commit

I was working with a friend on a project, and he edited a bunch of files that shouldn't have been edited. Somehow I merged his work into mine, either when I pulled it, or when I tried to just pick the..

How to set menu to Toolbar in Android

I want use ToolBar instead of ActionBar, but don't show me menu in toolbar!!! i want set menu such as Refresh or Setting buttons in ActionBar. Toolbar.xml code : <?xml version="1.0" encoding="u..

Add button to navigationbar programmatically

Hi I need to set the button on right side, in navigation bar, programatically , so that if I press the button I will perform some actions. I have created the navigation bar, programatically by; navB..

How to create a jQuery plugin with methods?

I'm trying to write a jQuery plugin that will provide additional functions/methods to the object that calls it. All the tutorials I read online (have been browsing for the past 2 hours) include, at th..

Visual Studio Code: Auto-refresh file changes

Working with Visual Studio Code I have noticed if a file you are working with change, whenever that file get focused in a code panel it will be reloaded from the disk (if you don't have changes in the..

Oracle 11g Express Edition for Windows 64bit?

I registered on http://Oracle.com in order to download 11g R2 Express edition database. But http://Oracle.com offered me download links only for Windows 32bit and for Linux 64bit. Is there somewhere ..

How can I disable selected attribute from select2() dropdown Jquery?

I know how to enable the selected attribute from dropdown; I can use this code : $('select').select2(); but my problem is how to disable it ? thx ..

Count with IF condition in MySQL query

I have two tables, one is for news and the other one is for comments and I want to get the count of the comments whose status has been set as approved. SELECT ccc_news . *, count(if(ccc_news..

How to insert text in a td with id, using JavaScript

I know it may be a simple thing, but I can't figure out. I am trying to insert some text coming from a JavaScript function onload event into a td. <html> <head> <script type="text/j..

Recommended way of making React component/div draggable

I want to make a draggable (that is, repositionable by mouse) React component, which seems to necessarily involve global state and scattered event handlers. I can do it the dirty way, with a global va..

Finding the second highest number in array

I'm having difficulty to understand the logic behind the method to find the second highest number in array. The method used is to find the highest in the array but less than the previous highest (whic..

Regex credit card number tests

I'm testing one application where Regex pattern match credit card then such numbers should be highlighted. I'm using site http://regexpal.com/ to create test credit credit card numbers for my testing...

Asp.net - Add blank item at top of dropdownlist

Why is the dropdown not showing my blank item first? Here is what I have drpList.Items.Add(New ListItem("", "")) With drpList .DataSource = myController.GetList(userid) .DataTextField = "Nam..

Eclipse: stop code from running (java)

Sometimes, I'll run a program that accidentally contains an infinite loop or something. Eclipse will let me continue editing the program, but be super slow. How can I stop it? (Do I want to restart th..

How to update-alternatives to Python 3 without breaking apt?

The other day I decided that I wanted the command python to default to firing up python3 instead of python2. So I did this: $ sudo update-alternatives --install /usr/bin/python python /usr/bin/pytho..

Using two values for one switch case statement

In my code, the program does something depending on the text entered by the user. My code looks like: switch (name) { case text1: { //blah break; } cas..

Counting unique values in a column in pandas dataframe like in Qlik?

If I have a table like this: df = pd.DataFrame({ 'hID': [101, 102, 103, 101, 102, 104, 105, 101], 'dID': [10, 11, 12, 10, 11, 10, 12, 10], 'uID': ['James', 'Henry', 'Abe'..

Name node is in safe mode. Not able to leave

root# bin/hadoop fs -mkdir t mkdir: org.apache.hadoop.hdfs.server.namenode.SafeModeException: Cannot create directory /user/root/t. Name node is in safe mode. not able to create anything in hdfs I di..

Getting "unixtime" in Java

Date.getTime() returns milliseconds since Jan 1, 1970. Unixtime is seconds since Jan 1, 1970. I don't usually code in java, but I'm working on some bug fixes. I have: Date now = new Date(); Lon..

How to redirect 404 errors to a page in ExpressJS?

I don't know a function for doing this, does anyone know of one?..

What is the closest thing Windows has to fork()?

I guess the question says it all. I want to fork on Windows. What is the most similar operation and how do I use it...

Using wget to recursively fetch a directory with arbitrary files in it

I have a web directory where I store some config files. I'd like to use wget to pull those files down and maintain their current structure. For instance, the remote directory looks like: http://mysit..

If Else If In a Sql Server Function

I have this function I am trying to create. When I parse it, it works fine, but to actually create the function in the database it says my column names are invalid. That is not true, I spelled them co..

CodeIgniter: How to use WHERE clause and OR clause

I am using the following code to select from a MySQL database with a Code Igniter webapp: $query = $this->db->get_where('mytable',array('id'=>10)); This works great! But I want to write th..

In c++ what does a tilde "~" before a function name signify?

template <class T> class Stack { public: Stack(int = 10) ; ~Stack() { delete [] stackPtr ; } //<--- What does the "~" signify? int push(const T&); int pop(T&) ;..

JavaScript - Use variable in string match

I found several similar questions, but it did not help me. So I have this problem: var xxx = "victoria"; var yyy = "i"; alert(xxx.match(yyy/g).length); I don't know how to pass variable in match co..

oracle sql: update if exists else insert

Possible Duplicate: Oracle: how to UPSERT (update or insert into a table?) Hi, I have a table in which a record has to be modified if it already exists else a new record has to be inserted..

ImportError: no module named win32api

I am using Python 2.7 and I want to use pywin32-214 on Windows 7. I installed pywin32-214 by using the msi installer. But when I import win32api in my Python script, it throws the error: no module na..

File changed listener in Java

I'd like to be notified when a file has been changed in the file system. I have found nothing but a thread that polls the lastModified File property and clearly this solution is not optimal...

How to set headers in http get request?

I'm doing a simple http GET in Go: client := &http.Client{} req, _ := http.NewRequest("GET", url, nil) res, _ := client.Do(req) But I can't found a way to customize the request header in the do..

100% width Twitter Bootstrap 3 template

I am a bootstrap newbie and I have a 100% wide template that I want to code with bootstrap. The first column begins at the left corner and I have a Google map the stretches to the rightmost. I thought..

Remove a prefix from a string

I am trying to do the following, in a clear pythonic way: def remove_prefix(str, prefix): return str.lstrip(prefix) print remove_prefix('template.extensions', 'template.') This gives: xtensio..

UnicodeEncodeError: 'ascii' codec can't encode character at special name

My python (ver 2.7) script is running well to get some company name from local html files but when it comes to some specific country name, it gives this error "UnicodeEncodeError: 'ascii' codec can't ..

How to access a DOM element in React? What is the equilvalent of document.getElementById() in React

How do I select certain bars in react.js? This is my code: var Progressbar = React.createClass({ getInitialState: function () { return { completed: this.props.completed }; }, add..

INSERT and UPDATE a record using cursors in oracle

I have 2 tables- student and studLoad both having 2 fields studID and studName. I want to load data from student table into stuLoad table. If the data already exists in the studLoad table, then it sho..

PHP Email sending BCC

I know there are a few similar questions to this but I just can't get it working. Ok, I have a list of emails grabbed from my database in a variable called $emailList. I can get my code to send an e..

How to get "their" changes in the middle of conflicting Git rebase?

I have conflicting branches, branch2 branched from branch1. Let's say when rebasing branch2 on current branch1, while resolving conflicts, I decide to take some (not all) of "their" (i.e. branch1) fi..

Bad Request, Your browser sent a request that this server could not understand

There are two application servers and a switch. When i access application by using application server ip it works fine. However if i use switch ip in my url Bad request error throws up only for firefo..

How to make an ImageView with rounded corners?

In Android, an ImageView is a rectangle by default. How can I make it a rounded rectangle (clip off all 4 corners of my Bitmap to be rounded rectangles) in the ImageView? ..

How do I find out what version of WordPress is running?

I have just taken over someone's hosted WordPress site. How do I find out what version he is running?..

How do I set log4j level on the command line?

I want to add some log.debug statements to a class I'm working on, and I'd like to see that in output when running the test. I'd like to override the log4j properties on the command line, with somethi..

"starting Tomcat server 7 at localhost has encountered a prob"

Trying configure tomcat in my eclipse but "Port 8080 required by Tomcat v7.0 Server at localhost is already in use. The server may already be running in another process, or a system process may be usi..

SSL certificate is not trusted - on mobile only

My site is working great over SSL in my desktops (chrome) I have a green lock near the address bar saying "Identity verified" But using a mobile mobile browser (Chrome/Safari)I see the following mess..

Distribution certificate / private key not installed

Using Xcode 9.1, after building an iOS app, I want to archive it and upload it to the appStore for beta-testing. But I get the following issue after clicking the button Upload to the App Store... and ..

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..

How to enter ssh password using bash?

Everyday I am connecting to a server through ssh. I go through this routine: IC001:Desktop user$ ssh [email protected] [email protected]'s password: Last login: Tue Jun 4 10:09:01 2013 from 0.0...

Python Threading String Arguments

I have a problem with Python threading and sending a string in the arguments. def processLine(line) : print "hello"; return; . dRecieved = connFile.readline(); processThread = threading.Th..

Is there a way to perform "if" in python's lambda

In python 2.6, I want to do: f = lambda x: if x==2 print x else raise Exception() f(2) #should print "2" f(3) #should throw an exception This clearly isn't the syntax. Is it possible to perform an ..

Difference between jQuery .hide() and .css("display", "none")

Is there any difference between jQuery('#id').show() and jQuery('#id').css("display","block") and jQuery('#id').hide() and jQuery('#id').css("display","none") ..

Oracle sqlldr TRAILING NULLCOLS required, but why?

I have an abstruse sqlldr problem that's bothering me. My control file looks something like this: load data infile 'txgen.dat' into table TRANSACTION_NEW fields terminated by "," optionally enclosed..

CASE (Contains) rather than equal statement

Is there a method to use contain rather than equal in case statement? For example, I am checking a database table has an entry lactulose, Lasix (furosemide), oxazepam, propranolol, rabeprazole, sert..

sql query to find the duplicate records

what is the sql query to find the duplicate records and display in descending, based on the highest count and the id display the records. for example: getting the count can be done with select tit..

Can we have functions inside functions in C++?

I mean something like: int main() { void a() { // code } a(); return 0; } ..

std::string formatting like sprintf

I have to format std::string with sprintf and send it into file stream. How can I do this?..

Find a value anywhere in a database

Given a #, how do I discover in what table and column it could be found within? I don't care if it's fast, it just needs to work...

<button> background image

I have got a little problem with setting a background image for <button>. Here is the html I have got on site: <button id="rock" onClick="choose(1)">Rock</button> And here is th..

How to clean up R memory (without the need to restart my PC)?

I am running my code in R (under Windows) which involves a lot of in-memory data. I tried to use rm(list=ls()) to clean up memory, but seems the memory is still occupied and I cannot rerun my code. I ..

Optional args in MATLAB functions

How can I declare function in MATLAB with optional arguments? For example: function [a] = train(x, y, opt), where opt must be an optional argument...

What is the use of static synchronized method in java?

I have one question in my mind , I read static synchronized method locked on class object and synchronized method locks on current instance of an object.So Whats the meaning of locked on class objec..

How do I use a file grep comparison inside a bash if/else statement?

When our server comes up we need to check a file to see how the server is configured. We want to search for the following string inside our /etc/aws/hosts.conf file: MYSQL_ROLE=master Then, we ..

db.collection is not a function when using MongoClient v3.0

I have been trying W3schools tutorial on nodeJS with MongoDB. When I try to implement this example in a nodeJS environment and invoke the function with an AJAX call, I got the error below: TypeErro..

What are these ^M's that keep showing up in my files in emacs?

So I think it may have to do with textmate, but we work in a small team and are having some issues with full-file conflicts of nearly identical files in git because each line of one branch has a ^M ap..

Laravel migration default value

I didn't understand what is the effect of the default option in the migrations. I can see that the column in the database is defined with default value, but the models are ignore it completely. Say I..

How to get the mysql table columns data type?

I want to get the column data type of a mysql table. Thought I could use MYSQLFIELD structure but it was enumerated field types. Then I tried with mysql_real_query() The error which i am getting is..

How can you get the build/version number of your Android application?

I need to figure out how to get or make a build number for my Android application. I need the build number to display in the UI. Do I have to do something with AndroidManifest.xml?..

Download file from web in Python 3

I am creating a program that will download a .jar (java) file from a web server, by reading the URL that is specified in the .jad file of the same game/application. I'm using Python 3.2.1 I've manage..

How to POST request using RestSharp

I m trying to POST the request using RestSharp client as follows I m passing the Auth Code to following function public void ExchangeCodeForToken(string code) { if (string.IsNullOrEmpty(code)) ..

make a phone call click on a button

I'm trying to make a call when I press a button in android ((Button)findViewById(R.id.button1)).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String phno=..

Angular 4 - get input value

I would like to know how to get the value from an input on angular 4. I looked over the documentation on angular and the example with the key event doesn't work very well for me and I can't find a pro..

Access-control-allow-origin with multiple domains

In my web.config I would like to specify more than one domain for the access-control-allow-origin directive. I don't want to use *. I've tried this syntax: <add name="Access-Control-Allow-Origin..

Hibernate throws org.hibernate.AnnotationException: No identifier specified for entity: com..domain.idea.MAE_MFEView

Why am I getting this exception? package com.domain.idea; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinColu..

_DEBUG vs NDEBUG

Which preprocessor define should be used to specify debug sections of code? Use #ifdef _DEBUG or #ifndef NDEBUG or is there a better way to do it, e.g. #define MY_DEBUG? I think _DEBUG is Visual Stu..

On Windows, running "import tensorflow" generates No module named "_pywrap_tensorflow" error

On Windows, TensorFlow reports either or both of the following errors after executing an import tensorflow statement: No module named "_pywrap_tensorflow" DLL load failed. ..

$_POST not working. "Notice: Undefined index: username..."

Possible Duplicate: PHP: “Notice: Undefined variable” and “Notice: Undefined index” So, I am currently learning PHP and was reading on a book about the md5 function for passwords, ..

How do I convert a Django QuerySet into list of dicts?

How can I convert a Django QuerySet into a list of dicts? I haven't found an answer to this so I'm wondering if I'm missing some sort of common helper function that everyone uses...

What does \0 stand for?

Possible Duplicate: What does the \0 symbol mean in a C string? I am new at iPhone Development. I want to know, what does '\0' means in C, and what is the equivalent for that in objective c..

Declaring array of objects

I have a variable which is an array and I want every element of the array to act as an object by default. To achieve this, I can do something like this in my code. var sample = new Array(); sample[0]..

IntelliJ does not show 'Class' when we right click and select 'New'

We're creating a new project in IntelliJ and must have something wrong because when we right click on a directory, select New and then get the context menu, Java based options are not shown. Currently..

Could not resolve this reference. Could not locate the assembly

Everytime I build my solution, I get this error message: Warning 3 Could not resolve this reference. Could not locate the assembly "StandardClassLibrary, Version=1.0.0.0, Culture=neutr..

Hibernate table not mapped error in HQL query

I have a web application that use Hibernate to make CRUD operations over a database. I got an error saying that the table is not mapped. See the Java files: Error message: org.springframework.orm.hi..

How can I decode HTML characters in C#?

I have email addresses encoded with HTML character entities. Is there anything in .NET that can convert them to plain strings?..

Custom CSS Scrollbar for Firefox

I want to customize a scrollbar with CSS. I use this WebKit CSS code, which works well for Safari and Chrome: ::-webkit-scrollbar { width: 15px; height: 15px; } ::-webkit-scrollbar-track-pi..

How to check string length and then select substring in Sql Server

In a view, i have a column comments which may contain large string. I just want to select first 60 characters and append the '...' at the end of the selected string. For selecting first 60 characters..

What is difference between sjlj vs dwarf vs seh?

I can't find enough information to decide which compiler should I use to compile my project. There are several programs on different computers simulating a process. On Linux, I'm using GCC. Everything..

How to execute a * .PY file from a * .IPYNB file on the Jupyter notebook?

I am working on a Python Notebook and I would like that large input code [input] pack into a [* .PY] files and call this files from the notebook. The action of running a [.PY] file from the Notebook..

Cache an HTTP 'Get' service response in AngularJS?

I want to be able to create a custom AngularJS service that makes an HTTP 'Get' request when its data object is empty and populates the data object on success. The next time a call is made to this se..

How to get the browser viewport dimensions?

I want to provide my visitors the ability to see images in high quality, is there any way I can detect the window size? Or better yet, the viewport size of the browser with JavaScript? See green area..

How to create loading dialogs in Android?

Those dark spinning progress dialogs in the Amazon and Engadget apps - are those standard in Android?..

Find length of 2D array Python

How do I find how many rows and columns are in a 2d array? For example, Input = ([[1, 2], [3, 4], [5, 6]])` should be displayed as 3 rows and 2 columns...

open link of google play store in mobile version android

I have link of my other apps in my latest app, and I open them in that way. Uri uri = Uri.parse("url"); Intent intent = new Intent (Intent.ACTION_VIEW, uri); startActivity(intent); this codes ope..

Sorting Values of Set

I am trying to sort elements of a set but unable to do so far. here is my code which i am trying to do public static void main(String [] args){ Set<String> set=new HashSet<String>(); ..

DBCC CHECKIDENT Sets Identity to 0

I'm using this code to reset the identity on a table: DBCC CHECKIDENT('TableName', RESEED, 0) This works fine most of the time, with the first insert I do inserting 1 into the Id column. However, if ..

Linux Shell Script For Each File in a Directory Grab the filename and execute a program

Scenario : A folder in Linux system. I want to loop through every .xls file in a folder. This folder typically consists of various folders, various filetypes (.sh, .pl,.csv,...). All I want to do i..

Why am I getting "Cannot Connect to Server - A network-related or instance-specific error"?

I get the following error when trying to connect to SQL Server: Cannot connect to 108.163.224.173. A network-related or instance-specific error occurred while establishing a connection to SQL Server...

PHP - Debugging Curl

I'd like to see what the post fields in the request are before I send it. (For debugging purposes). The PHP library (class) I am using is already made (not by me), so I am trying to understand it. A..

Error 330 (net::ERR_CONTENT_DECODING_FAILED):

Recently we migrated to a new server. After 2 days, I got the following issues 1) We had a crash on a session table, which we easily fixed by reparing it 2) We run OpenX as our adserver, and it also..

Can't ping a local VM from the host

My work laptop is is a member of a domain (the OS is Windows 8). Created a new VM, locally on this laptop (using built-in Hyper-V). DHCP is provided by the domain and all IP addresses are assigned by ..

Insert line after first match using sed

For some reason I can't seem to find a straightforward answer to this and I'm on a bit of a time crunch at the moment. How would I go about inserting a choice line of text after the first line matchi..

Remove stubborn underline from link

I am attempting to have a link show up in white, without an underline. The text color shows up correctly as white, but the blue underline is stubbornly persisting. I tried text-decoration: none; and t..

PHP - add 1 day to date format mm-dd-yyyy

<?php $date = "04-15-2013"; $date = strtotime($date); $date = strtotime("+1 day", $date); echo date('m-d-Y', $date); ?> This is driving me crazy and seems so simple. I'm pretty..

Have bash script answer interactive prompts

Is it possible to have a bash script automatically handle prompts that would normally be presented to the user with default actions? Currently I am using a bash script to call an in-house tool that w..

Is it possible to change the radio button icon in an android radio button group

I am wanting to allow the user of my android application the ability to set some parameters. The radio button is ideal for this situation. However, I don't like the radio buttons are rendered. Is..

SQL User Defined Function Within Select

I have a user defined function in SQL called getBuisnessDays it takes @startdate and @enddate and returns the number of business days between the two dates. How can I call that function within my sele..

What to gitignore from the .idea folder?

Possible Duplicate: Intellij Idea 9/10, what folders to check into (or not check into) source control? I started using WebStorm for web development and am not sure what to add and what to e..

Git diff between current branch and master but not including unmerged master commits

I want a diff of all changes in a branch that is not merged to master yet. I tried: git diff master git diff branch..master git diff branch...master However, in each of these cases the diff contai..

Filter by Dates in SQL

I have a column in my table for dates (DateTime) and I am trying to create a WHERE clause that says, WHERE dates BETWEEN 12-11-2012 and 12-13-2012 A sample value of dates column = 2012-05-24 00:38:40..

Eclipse projects not showing up after placing project files in workspace/projects

I've searched for 2 days and can't find anything. I find things that are close, but not what I need. I got a new computer recently and copied all of my projects over to my new computer. I opened Ecl..

Recursively list all files in a directory including files in symlink directories

Suppose I have a directory /dir inside which there are 3 symlinks to other directories /dir/dir11, /dir/dir12, and /dir/dir13. I want to list all the files in dir including the ones in dir11, dir12 a..

Can Console.Clear be used to only clear a line instead of whole console?

While working on a question/answer program for school, it occurred to me that I can use Console.Clear() to wipe out everything on the screen. I wonder if I can use Console.Readline(valueOne), then out..

How to use getJSON, sending data with post method?

I am using above method & it works well with one parameter in URL. e.g. Students/getstud/1 where controller/action/parameter format is applied. Now I have an action in Students controller that a..

How to pass a PHP variable using the URL

I want to pass some PHP variables using the URL. I tried the following code: link.php <html> <body> <?php $a='Link1'; $b='Link2'; echo '<a href="pass.php?link=$a">Link 1</a..

C++ [Error] no matching function for call to

I can't compile my code because of some errors. Here some of them : In function 'int main(int, char**)': [Error] no matching function for call to 'deckOfCards::shuffle(deckOfCards&)' [Note] c..

How can I get the data type of a variable in C#?

How can I find out what data type some variable is holding? (e.g. int, string, char, etc.) I have something like this now: using System; using System.Collections.Generic; using System.Linq; using Sy..

Why do this() and super() have to be the first statement in a constructor?

Java requires that if you call this() or super() in a constructor, it must be the first statement. Why? For example: public class MyClass { public MyClass(int x) {} } public class MySubClass ex..

How can multiple rows be concatenated into one in Oracle without creating a stored procedure?

How can I achieve the following in oracle without creating a stored procedure? Data Set: question_id element_id 1 7 1 8 2 9 3 10 3 ..

php exec() is not executing the command

I have tried to use exec() with 'whoami' to check if it works and I got the result of nt authority\system Now I need to run a .exe file with parameters from php via exec() function. I tried this..

From an array of objects, extract value of a property as array

I have JavaScript object array with the following structure: objArray = [ { foo: 1, bar: 2}, { foo: 3, bar: 4}, { foo: 5, bar: 6} ]; I want to extract a field from each object, and get an array con..

Using JavaScript to display a Blob

I am retrieving a Blob image from a database, and I'd like to be able to view that image using JavaScript. The following code produces a broken image icon on the page: var image = document.createElem..

How to get a variable value if variable name is stored as string?

How can I retrieve a bash variable value if I have the variable name as string? var1="this is the real value" a="var1" Do something to get value of var1 just using variable a. Con..

Difference between Arrays.asList(array) and new ArrayList<Integer>(Arrays.asList(array))

What is the difference between 1.List<Integer> list1 = new ArrayList<Integer>(Arrays.asList(ia)); //copy 2.List<Integer> list2 = Arrays.asList(ia); where ia is array of integers..

keytool error bash: keytool: command not found

I have tried to execute keytool from Java bin directory but I get an error with warning bash: keytool: command not found. root@xxxxxx]# keytool -genkey -alias mypassword -keyalg RSA bash: keytools: ..

error: unknown type name ‘bool’

I downloaded the source code and wanted to compile the file of scanner. It produces this error: [meepo@localhost cs143-pp1]$ gcc -o lex.yy.o lex.yy.c -ll In file included from scanner.l:15:0: scanne..

Adding two numbers concatenates them instead of calculating the sum

I am adding two numbers, but I don't get a correct value. For example, doing 1 + 2 returns 12 and not 3 What am I doing wrong in this code? _x000D_ _x000D_ function myFunction() {_x000D_ var y = ..

CSS horizontal scroll

I'm trying to create a <div> with a series of photos which are horizontally scrollable only. It should look something like this LINK; However the above is only achieved by specifying a width..

Python set to list

How can I convert a set to a list in Python? Using a = set(["Blah", "Hello"]) a = list(a) doesn't work. It gives me: TypeError: 'set' object is not callable ..

Exception: Unexpected end of ZLIB input stream

There is something wrong with GZIPInputStream or GZIPOutputStream. Just please read the following code (or run it and see what happens): def main(a: Array[String]) { val name = "test.dat" new..

How to multiply duration by integer?

To test concurrent goroutines, I added a line to a function to make it take a random time to return (up to one second) time.Sleep(rand.Int31n(1000) * time.Millisecond) However when I compiled, I go..

What is the best Java QR code generator library?

I wish to dynamically generate QR codes in Java. What is the best QR code generator library to use. I will consider both commercial and opensource?..

Java Scanner String input

I'm writing a program that uses an Event class, which has in it an instance of a calendar, and a description of type String. The method to create an event uses a Scanner to take in a month, day, year..

What are the differences between Abstract Factory and Factory design patterns?

I know there are many posts out there about the differences between these two patterns, but there are a few things that I cannot find. From what I have been reading, I see that the factory method pat..

How do I get logs/details of ansible-playbook module executions?

Say I execute the following. $ cat test.sh #!/bin/bash echo Hello World exit 0 $ cat Hello.yml --- - hosts: MyTestHost tasks: - name: Hello yourself script: test.sh $ ansible-playbook He..

"Uncaught SyntaxError: Cannot use import statement outside a module" when importing ECMAScript 6

I'm using ArcGIS JSAPI 4.12 and wish to use Spatial Illusions to draw military symbols on a map. When I add milsymbol.js to the script, the console returns error Uncaught SyntaxError: Cannot use ..

How do I style radio buttons with images - laughing smiley for good, sad smiley for bad?

I would like to create an HTML form for user feedback. If the overall feedback is good, the user should click on a laughing smiley, if the overall feedback is bad, the user should choose a sad smiley...

How to center links in HTML

I am really new to HTML and was wondering how you center multiple links with html? I have been trying : <a href="http//www.google.com"><p style="text-align:center">Search</a> B..

Cordova app not displaying correctly on iPhone X (Simulator)

I tested my Cordova-based app yesterday on the iPhone X Simulator in Xcode 9.0 (9A235) and it didn't look good. Firstly, instead of filling the full screen area, there was a black area above and belo..

Convert Data URI to File then append to FormData

I've been trying to re-implement an HTML5 image uploader like the one on the Mozilla Hacks site, but that works with WebKit browsers. Part of the task is to extract an image file from the canvas objec..

Moving from JDK 1.7 to JDK 1.8 on Ubuntu

I am on UBUNTU. JDK version currently installed is: java version "1.7.0_51" Java(TM) SE Runtime Environment (build 1.7.0_51-b13) Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode) the ..

How to correctly use Html.ActionLink with ASP.NET MVC 4 Areas

I recently discovered Areas in ASP.NET MVC 4, which I have successfully implemented, but I'm running into troubles with the @Html.ActionLink helper in my Razor views. The URL this helper generates alw..

Generate a dummy-variable

I have trouble generating the following dummy-variables in R: I'm analyzing yearly time series data (time period 1948-2009). I have two questions: How do I generate a dummy variable for observati..

What is exactly the base pointer and stack pointer? To what do they point?

Using this example coming from wikipedia, in which DrawSquare() calls DrawLine(), (Note that this diagram has high addresses at the bottom and low addresses at the top.) Could anyone explain me wh..

Keep placeholder text in UITextField on input in IOS

Is there any way to prevent placeholder text in a UITextField from being overwritten when the text field receives an input? I have a text field that takes an expiration date in this format "MM/YYYY" w..

What is the difference between tinyint, smallint, mediumint, bigint and int in MySQL?

What is the difference between tinyint, smallint, mediumint, bigint and int in MySQL? In what cases should these be used?..

Reading file using fscanf() in C

I need to read and print data from a file. I wrote the program like below, #include<stdio.h> #include<conio.h> int main(void) { char item[9], status; FILE *fp; if( (fp = fopen("D:\\Sa..

Session only cookies with Javascript

I was wondering if it's possible to create session only cookies with Javascript. When the browser is closed the cookies should be removed. I can't use anything on the server as the website is HTML o..

In ASP.NET MVC: All possible ways to call Controller Action Method from a Razor View

I know this is a pretty basic question over here. But could you tell me all possible options available to, call a Control Action Method [generally any server side routine] from a Razor View and, ..

pycharm convert tabs to spaces automatically

I am using pycharm IDE for python development it works perfectly fine for django code so suspected that converting tabs to spaces is default behaviour, however in python IDE is giving errors everywher..

Update and left outer join statements

I have two tabels with a relation and I want to update a field in table A. Is it possible to combine update and join in the same query? I googled it but didnt find any working solution? UPDATE md SET..

How to split page into 4 equal parts?

I want to divide my page into four equal parts, each of same height and width (50-50%). I don't want to use JavaScript. I want blocks (<div>s) to be resized automatically (and relatively) if th..

Mac SQLite editor

I am aware of CocoaMySQL but I have not seen a Mac GUI for SQLite, is there one? My Google search didn't turn up any Mac related GUI's which is why I'm asking here rather than Google...

Remove menubar from Electron app

How do I remove this menu-bar from my electron apps: Also it says "Hello World"(is this because I downloaded electron pre-built, and will go away once I package the application?). I didn't code the..

How to reset a timer in C#?

There are three Timer classes that I am aware of, System.Threading.Timer, System.Timers.Timer, and System.Windows.Forms.Timer, but none of these have a .Reset() function which would reset the current ..

How to convert the system date format to dd/mm/yy in SQL Server 2008 R2?

I'm using SQL Server 2008 R2. I want to convert the system date to this format: dd/mm/yy "2013-01-01 00:00:00.000" to "Score Calculation - 10/01/13". My column contains the data: 1. DMS01A130101..

How to properly upgrade node using nvm

Is it possible to upgrade node right in place, instead of manually installing the latest stable version? I have installed node.js version 5.0 with nvm, but now I want to update it to 5.4. I'm trying..

Spring Data: "delete by" is supported?

I am using Spring JPA for database access. I am able to find examples such as findByName and countByName, for which I dont have to write any method implementation. I am hoping to find examples for del..

Python - converting a string of numbers into a list of int

I have a string of numbers, something like: example_string = '0, 0, 0, 11, 0, 0, 0, 0, 0, 19, 0, 9, 0, 0, 0, 0, 0, 0, 11' I would like to convert this into a list: example_list = [0, 0, 0, 11, 0, ..

Parsing HTTP Response in Python

I want to manipulate the information at THIS url. I can successfully open it and read its contents. But what I really want to do is throw out all the stuff I don't want, and to manipulate the stuff ..

Cannot create cache directory .. or directory is not writable. Proceeding without cache in Laravel

I created a new Laravel project. When I go to the terminal to install the dependecies composer displays the following warning: Cannot create cache directory /home/w3cert/.composer/cache/repo/https---..

Necessary to add link tag for favicon.ico?

Are there any modern browsers that won't detect the favicon.ico automatically? Is there any reason to add the link tag for favicon.ico? <link rel="shortcut icon" href="/favicon.ico"> My guess..

Sorting using Comparator- Descending order (User defined classes)

I want to sort my objects in descending order using comparator. class Person { private int age; } Here I want to sort a array of Person objects. How can I do this?..

md-table - How to update the column width

I have started using the md-table for my project, and I want fixed column width. Currently all columns width are divided into equal size. Where can I get the documentation of data table dimensions? ..

PHP Fatal error: Call to undefined function mssql_connect()

I've never used php before and am trying to connect to a SQL Server 2008 instance on a Windows machine running IIS7 and PHP5.3. I have downloaded and installed SQLSRV30.EXE from here in C:\Program Fi..

How to input automatically when running a shell over SSH?

In my shell script I am running a command which is asking me for input. How can I give the command the input it needs automatically? For example: $cat test.sh ssh-copy-id [email protected] When run..

What is /var/www/html?

I am starting to pick up PHP / MySQL, but in all the documentation I'm reading, it mentions /var/www/html as being the folder you want to install a framework such as CakePHP, or for example /var/www/h..

Using Pairs or 2-tuples in Java

My Hashtable in Java would benefit from a value having a tuple structure. What data structure can I use in Java to do that? Hashtable<Long, Tuple<Set<Long>,Set<Long>>> table =..

SQL - Create view from multiple tables

I have three tables: POP(country, year, pop) FOOD(country, year, food) INCOME(country, year, income) I am trying to create a view such as: V(country, year, pop, food, income) This is my code so ..

jQuery to serialize only elements within a div

I would like to get the same effect as jQuery.serialize() but I would like to return only the child elments of a given div. Sample result : single=Single2&multiple=Multiple&radio=radio1 ..

endsWith in JavaScript

How can I check if a string ends with a particular character in JavaScript? Example: I have a string var str = "mystring#"; I want to know if that string is ending with #. How can I check it? I..

How to get a date in YYYY-MM-DD format from a TSQL datetime field?

How do I retrieve a date from SQL Server in YYYY-MM-DD format? I need this to work with SQL Server 2000 and up. Is there a simple way to perform this in SQL Server or would it be easier to convert it ..

get parent's view from a layout

I have a FragmentActivity with this layout: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.andr..

Relationship between hashCode and equals method in Java

I read in many places saying while override equals method in Java, should override hashCode method too, otherwise it is "violating the contract". But so far I haven't faced any problem if I override ..

Creating Dynamic button with click event in JavaScript

How can I create a dynamic button with a click event with JavaScript? I tried this, but when I click the add button, an alert message show up! It's not what I want - I want to be able to click the bu..

Rails: How to run `rails generate scaffold` when the model already exists?

I'm new to Rails so my current project is in a weird state. One of the first things I generated was a "Movie" model. I then started defining it in more detail, added a few methods, etc. I now reali..

How can I time a code segment for testing performance with Pythons timeit?

I've a python script which works just as it should, but I need to write the execution time. I've googled that I should use timeit but I can't seem to get it to work. My Python script looks like this:..

change values in array when doing foreach

example: var arr = ["one","two","three"]; arr.forEach(function(part){ part = "four"; return "four"; }) alert(arr); The array is still with it's original values, is there any way to have writi..

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax — PHP — PDO

I've looked through all the other StackOverflow (and google) posts with the same problem, but none seemed to address my problem. I am using PDO and PHP. My code: $vals = array( ':from' => ..

String.equals versus ==

This code separates a string into tokens and stores them in an array of strings, and then compares a variable with the first home ... why isn't it working? public static void main(String...aArguments..

Loop timer in JavaScript

I need to execute a piece of JavaScript code say, each 2000 milliseconds. setTimeout('moveItem()',2000) The above will execute a function after 2000 milliseconds, but won't execute it again. So in..

DataTables fixed headers misaligned with columns in wide tables

Problem When using the sScrollX, sScrollXInner and/or sScrollY to achieve a fixed header table with its inner content scrolling, the headers of the table go out of alignment with the rest of the body..

How to stick table header(thead) on top while scrolling down the table rows with fixed header(navbar) in bootstrap 3?

Bootstrap layout with fixed-navbar. Having table with so many rows in body. Issue? As i scroll the page navigation-bar will be there because it is fixed. as i scroll more i want table header to be fi..

Why is Java Vector (and Stack) class considered obsolete or deprecated?

Why is Java Vector considered a legacy class, obsolete or deprecated? Isn't its use valid when working with concurrency? And if I don't want to manually synchronize objects and just want to use a th..

isset PHP isset($_GET['something']) ? $_GET['something'] : ''

I am looking to expand on my PHP knowledge, and I came across something I am not sure what it is or how to even search for it. I am looking at php.net isset code, and I see isset($_GET['something']) ..

Node Multer unexpected field

I'm working on uploading a file to my app using the multer npm module. The multer function I have defined is to allow a single file uploaded to the file system. Everything works during run time; the..

Python's time.clock() vs. time.time() accuracy?

Which is better to use for timing in Python? time.clock() or time.time()? Which one provides more accuracy? for example: start = time.clock() ... do something elapsed = (time.clock() - start) vs. ..

java.net.SocketException: Connection reset by peer: socket write error When serving a file

I am trying to implement an HTTP Server using Sockets. If the Client (For example a browser) requests a directory the server displays a list of available files. The problem arises when the client is r..

Forward request headers from nginx proxy server

I'm using Nginx as a proxy to filter requests to my application. With the help of the "http_geoip_module" I'm creating a country code http-header, and I want to pass it as a request header using "head..

How to remove non UTF-8 characters from text file

I have a bunch of Arabic, English, Russian files which are encoded in utf-8. Trying to process these files using a Perl script, I get this error: Malformed UTF-8 character (fatal) Manually checking..

Spring JPA @Query with LIKE

I'm trying to make a method in CrudRepository that will be able to give me list of users, whose usernames are LIKE the input parameter(not only begin with, but also contains it). I tried to use method..

How can I split a text file using PowerShell?

I need to split a large (500 MB) text file (a log4net exception file) into manageable chunks like 100 5 MB files would be fine. I would think this should be a walk in the park for PowerShel..

Tool to Unminify / Decompress JavaScript

Are there any command line scripts and/or online tools that can reverse the effects of minification similar to how Tidy can clean up horrific HTML? (I'm specifically looking to unminify a minified Ja..