Questions Tagged with #Time management

Time management is the act or process of planning and exercising conscious control over the amount of time spent on specific activities, especially to increase effectiveness, efficiency or productivity.

How to dismiss keyboard for UITextView with return key?

In IB's library, the introduction tells us that when the return key is pressed, the keyboard for UITextView will disappear. But actually the return key can only act as '\n'. I can add a button and u..

Running Bash commands in Python

On my local machine, I run a python script which contains this line bashCommand = "cwm --rdf test.rdf --ntriples > test.nt" os.system(bashCommand) This works fine. Then I run the same code on a..

Using awk to print all columns from the nth to the last

This line worked until I had whitespace in the second field. svn status | grep '\!' | gawk '{print $2;}' > removedProjs is there a way to have awk print everything in $2 or greater? ($3, $4.. u..

Installing Android Studio, does not point to a valid JVM installation error

I just downloaded the Android Studio. While trying to run it, I had to modify the environment variable and add JAVA_HOME and C:\Progra~2\Java\jdk1.6.0_22 Once I finished that hurdle, now ..

What is the proper way to re-attach detached objects in Hibernate?

I have a situation in which I need to re-attach detached objects to a hibernate session, although an object of the same identity MAY already exist in the session, which will cause errors. Right now, ..

Is there a naming convention for git repositories?

For example, I have a RESTful service called Purchase Service. Should I name my repository: purchaserestservice purchase-rest-service purchase_rest_service or something else? What's the convention..

Deserializing JSON array into strongly typed .NET object

When I can call the 3rd party api and get back a single class worth of data everything deserialises fine using this code TheUser me = jsonSerializer.Deserialize(response, typeof(TheUser)) as TheUser..

Plot a horizontal line using matplotlib

I have used spline interpolation to smooth a time series and would also like to add a horizontal line to the plot. But there seems to be an issue that is out of my grips. Any assistance would be reall..

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

I just discovered a logical bug in my code which was causing all sorts of problems. I was inadvertently doing a bitwise AND instead of a logical AND. I changed the code from: r = mlab.csv2rec(datafi..

Check whether IIS is installed or not?

I am trying to create a Local IIS Website using ASP.NET. When I click on New -----> Website and select the type as HTTP and from the dialog box if I select the option as LOCAL IIS WEBSITE I am get..

How do I get TimeSpan in minutes given two Dates?

To get TimeSpan in minutes from given two Dates I am doing the following int totalMinutes = 0; TimeSpan outresult = end.Subtract(start); totalMinutes = totalMinutes + ((end.Subtract(start).Days) * 24..

What is the purpose of .PHONY in a Makefile?

What does .PHONY mean in a Makefile? I have gone through this, but it is too complicated. Can somebody explain it to me in simple terms?..

unable to dequeue a cell with identifier Cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard

I am fairly new to coding in general and really new to Xcode (Swift). I understand that I need to register a nib or a class but I don't understand 'where or how?'. import UIKit class NotesListViewCo..

HTML radio buttons allowing multiple selections

In my HTML form I have the below as a set of radio buttons, depending on what radio button you select depends on what the next form <fieldset> is revealed, this all works. The problem is for som..

How to convert a structure to a byte array in C#?

How do I convert a structure to a byte array in C#? I have defined a structure like this: public struct CIFSPacket { public uint protocolIdentifier; //The value must be "0xFF+'SMB'". public ..

Sizing elements to percentage of screen width/height

Is there a simple (non-LayoutBuilder) way to size an element relative to screen size (width/height)? For example: how do I set the width of a CardView to be 65% of the screen width. It can't be done ..

Change Placeholder Text using jQuery

I am using a jQuery placeholder plugin( I need to change the placeholder text with the change in dropdown menu. But it is not changing. Here is the ..

What is the size of ActionBar in pixels?

I need to know the exact size of ActionBar in pixels so to apply correct background image...

Read and parse a Json File in C#

I have spent the best part of two days "faffing" about with code samples and etc., trying to read a very large JSON file into an array in c# so I can later split it up into a 2d array for processing. ..

MIN and MAX in C

Where are MIN and MAX defined in C, if at all? What is the best way to implement these, as generically and type safely as possible? (Compiler extensions/builtins for mainstream compilers preferred.)..

What is the syntax for Typescript arrow functions with generics?

The typescript handbook currently has nothing on arrow functions. Normal functions can be generically typed with this syntax: example: function identity<T>(arg: T): T { return arg; } What..

Update Item to Revision vs Revert to Revision

I've started to use Subversion with TortoiseSVN. If I open up the log and right click on an old revision I see two options that sound like they roll back to an older version: "Update item to revision"..

Google Maps API V3 : How show the direction from a point A to point B (Blue line)?

I have latitude and longitude for 2 points on database, I want my Google Map to display a route from point A to point B... Just like we see here (Google Maps Directions) How to draw that direction..

PHP: How to remove all non printable characters in a string?

I imagine I need to remove chars 0-31 and 127, Is there a function or piece of code to do this efficiently...

Regex lookahead, lookbehind and atomic groups

I found these things in my regex body but I haven't got a clue what I can use them for. Does somebody have examples so I can try to understand how they work? (?!) - negative lookahead (?=) - positive..

Check if an object belongs to a class in Java

Is there an easy way to verify that an object belongs to a given class? For example, I could do if(a.getClass() = (new MyClass()).getClass()) { //do something } but this requires instantiating ..

jquery disable form submit on enter

I have the following javascript in my page which does not seem to be working. $('form').bind("keypress", function(e) { if (e.keyCode == 13) { e.preventDefault(); return false..

HTTP URL Address Encoding in Java

My Java standalone application gets a URL (which points to a file) from the user and I need to hit it and download it. The problem I am facing is that I am not able to encode the HTTP URL address prop..

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

Chrome ignores autocomplete="off"

I've created a web application which uses a tagbox drop down. This works great in all browsers except Chrome browser (Version 21.0.1180.89). Despite both the input fields AND the form field having th..

How to remove close button on the jQuery UI dialog?

How do I remove the close button (the X in the top-right corner) on a dialog box created by jQuery UI?..

The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32'

I am building My first MVC application, I have a table in database containing 3 columns: Id ? primary key Username password When I am clicking on edit link edit a record, its throwing following ex..

"Active Directory Users and Computers" MMC snap-in for Windows 7?

Is there an equivalent tool available for use in Windows 7? I just need to browse the membership of some small Active Directory groups that are deep within a huge hierarchy, so I can eventually write..

warning: control reaches end of non-void function [-Wreturn-type]

I am having a slight is regarding functions. I believe it is likely because I am not using them. My code is as follows: /*date difference calculator*/ #include <stdio.h> int main() { int Da..

jQuery creating objects

How would I create an object in jQuery, and then proceed to make a couple of different instances of this object I.e Create an object named box which holds a variable called color. And then make a co..

CSS transition fade on hover

I've encountered a problem with CSS transitions. I'm designing a CSS gallery for my portfolio and I need my images to fade in on hover. I've been playing around with this for over an hour and I was h..

"Invalid signature file" when attempting to run a .jar

My java program is packaged in a jar file and makes use of an external jar library, bouncy castle. My code compiles fine, but running the jar leads to the following error: Exception in thread "main" ..

ANTLR: Is there a simple example?

I'd like to get started with ANTLR, but after spending a few hours reviewing the examples at the site, I still can't get a clear understanding of the grammar to Java process. Is there some .. Invalid postback or callback argument

I am getting this error: Server Error in '/' Application. Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or &l..

Check folder size in Bash

I'm trying to write a script that will calculate a directory size and if the size is less than 10GB, and greater then 2GB do some action. Where do I need to mention my folder name? # 10GB SIZE="1074..

shell script. how to extract string using regular expressions

I am new to shell scripts. I want to send a http request using curl and then extract some string using regular expressions. For example, how can I extract a domain name from a http response? (The exam..

Downloading MySQL dump from command line

I am moving away from Linode because I don't have the Linux sysadmin skills necessary; before I complete the transition to a more noob-friendly service, I need to download the contents of a MySQL data..

MySql: is it possible to 'SUM IF' or to 'COUNT IF'?

I have a column 'hour' I have a column 'kind' (it can be 1,2 or 3) I'd like to do something like: SELECT count(id), SUM(hour) as totHour, SUM( IF ( kind = 1, 1, 0 ) ) as countKindOne or SELECT ..

how to add background image to activity?

using theme or ImageView ?..

How to update one file in a zip archive

Is it possible to replace a file in a zip file without unzipping deleting the old file adding the new file and rezipping it back? Reason is I have a zip file which is really big there is one xml insi..

Access And/Or exclusions

I have some sample data like: |H.RISK|NOTE|NORMAL| The | are actually in the data, it's a String. I am using Access, and am trying to exclude records that contain RISK in the String. Sample query..

NSRange from Swift Range?

Problem: NSAttributedString takes an NSRange while I'm using a Swift String that uses Range let text = "Long paragraph saying something goes here!" let textRange = text.startIndex..<text.endIndex ..

PHP substring extraction. Get the string before the first '/' or the whole string

I am trying to extract a substring. I need some help with doing it in PHP. Here are some sample strings I am working with and the results I need: home/cat1/subcat2 => home test/cat2 => test ..

What is the difference between & vs @ and = in angularJS

I am very new to AngularJS. can anybody explain me the difference among these AngularJS operators: &, @ and = when isolating scope with proper example...

Java socket API: How to tell if a connection has been closed?

I am running into some issues with the Java socket API. I am trying to display the number of players currently connected to my game. It is easy to determine when a player has connected. However, it ..

Differences between Lodash and Underscore.js

Why would someone prefer either the Lodash or Underscore.js utility library over the other? Lodash seems to be a drop-in replacement for underscore, the latter having been around longer. I think both ..

NSDate get year/month/day

How can I get the year/month/day of a NSDate object, given no other information? I realize that I could probably do this with something similar to this: NSCalendar *cal = [[NSCalendar alloc] init]; N..

Concatenate multiple files but include filename as section headers

I would like to concatenate a number of text files into one large file in terminal. I know I can do this using the cat command. However, I would like the filename of each file to precede the "data dum..

Start ssh-agent on login

I have a site as a remote Git repo pulling from using an SSH alias. I can manually start the ssh-agent on my server but I have to do this every time I login via SSH. I manually start th..

Could not find a version that satisfies the requirement tensorflow

I installed the latest version of Python (3.6.4 64-bit) and the latest version of PyCharm (2017.3.3 64-bit). Then I installed some modules in PyCharm (Numpy, Pandas, etc), but when I tried installing ..

How do you return a JSON object from a Java Servlet

How do you return a JSON object form a Java servlet. Previously when doing AJAX with a servlet I have returned a string. Is there a JSON object type that needs to be used, or do you just return a Str..

How to resize a VirtualBox vmdk file

I've run out of space on a virtual machine disk which is a vmdk and need to resize the virtual image. Resizing with the command vboxmanage modifyhd Machine-disk1.vmdk --resize 30720 gives the erro..

Matching a Forward Slash with a regex

I don't have much experience with JavaScript but i'm trying to create a tag system which, instead of using @ or #, would use /. var start = /#/ig; // @ Match var word = /#(\w+)/ig; //@abc Match Ho..

Kubernetes pod gets recreated when deleted

I have started pods with command $ kubectl run busybox --image=busybox --restart=Never --tty -i --generator=run-pod/v1 Something went wrong, and now I can't delete this Pod. I tried using the meth..

Why rgb and not cmy?

Seeing as how the three primary colors are cyan, magenta and yellow (CMY), why do monitors and almost all the GUI components out there use red, green and blue (RGB)? (If I'm not mistaken, printers use..

Angular2 handling http response

I just have a question regarding structuring and handling responses from http requests within a service. I am using Angular2.alpha46 Typescript ( Just started testing it out- which I love... Ps.. Than..

How to open .mov format video in HTML video Tag?

I want to play .mov video like as this, but video doesn't play in any browser. <video width="400" controls Autoplay=autoplay> <source src="D:/" type="video/mov"> </video> ..

Create code first, many to many, with additional fields in association table

I have this scenario: public class Member { public int MemberID { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public virtual ICollection&l..

sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 74 supplied

def insert(array): connection=sqlite3.connect('images.db') cursor=connection.cursor() cnt=0 while cnt != len(array): img = array[cnt] print(array[cnt]) ..

Missing Authentication Token while accessing API Gateway?

I am trying to call a Lambda Function through AWS API Gateway. When I mention Authentication type NONE it works fine but API become public and anyone with url can access my API. To make API call secu..

Count number of occurences for each unique value

Let's say I have: v = rep(c(1,2, 2, 2), 25) Now, I want to count the number of times each unique value appears. unique(v) returns what the unique values are, but not how many they are. > uniq..

How to push objects in AngularJS between ngRepeat arrays

So I'm new to AngularJS and I'm trying to build a very simple list app, where I can create an ng-repeat item list and then push a selected item into another ng-repeat list. Although my problem seems t..

How to verify if $_GET exists?

So, I have some PHP code that looks a bit like this: <body> The ID is <?php echo $_GET["id"] . "!"; ?> </body> Now, when I pass an ID like http://localhost/myph..

How to use SQL Select statement with IF EXISTS sub query?

How to select Boolean value from sub query with IF EXISTS statement (SQL Server)? It should be something like : SELECT TABEL1.Id, NewFiled = (IF EXISTS(SELECT Id FROM TABLE2 WHERE TABLE2.ID = ..

How do I fetch lines before/after the grep result in bash?

I want a way to search in a given text. For that, I use grep: grep -i "my_regex" That works. But given the data like this: This is the test data This is the error data as follows . . . . ...

How to Install Sublime Text 3 using Homebrew

How can I use homebrew cask to install Sublime Text 3? I only see sublime text 2 in the repos. I even tried tapping homebrew/versions, but no luck. Thanks! EDIT: Answered by my answer below..

TypeError : Unhashable type

I am trying to get a list of list of tuples : something like [ [(1,0),(2,0),(3,0)],[(1,1),(2,1),(3,1)....]] I used this statement set([(a,b)for a in range(3)]for b in range(3)) But it gives me an ..

When do I have to use interfaces instead of abstract classes?

I was wondering when I should use interfaces. Lets think about the following: public abstract class Vehicle { abstract float getSpeed(); } and : public interface IVehicle { float getSpeed();..

How to parse Excel (XLS) file in Javascript/HTML5

I am able to read Excel file via FileReader but it outputs text as well as weird characters with it. I need to read xls file row-wise, read data in every column and convert it to JSON. How to read x..

Iterate through a C array

I have an array of structs that I created somewhere in my program. Later, I want to iterate through that, but I don't have the size of the array. How can I iterate through the elements? Or do I need..

What is this Javascript "require"?

I'm trying to get Javascript to read/write to a PostgreSQL database. I found this project on github. I was able to get the following sample code to run in node. var pg = require('pg'); //native libpq..

How to solve Notice: Undefined index: id in C:\xampp\htdocs\invmgt\manufactured_goods\change.php on line 21

I have a problem with my PHP code saying that "Notice: Undefined index" I am sure its very simple, since I am a beginner i am not getting well what is wrong exactly so please help me. Here's the code..

How to use struct timeval to get the execution time?

After reading this article about elapsed time, I wrote a simple code to calculate the execution time of a loop: #include <stdio.h> #include <sys/time.h> int main (int argc, char** argv) ..

$(document).ready equivalent without jQuery

I have a script that uses $(document).ready, but it doesn't use anything else from jQuery. I'd like to lighten it up by removing the jQuery dependency. How can I implement my own $(document).ready fu..

blur() vs. onblur()

I have a input tag with an onblur event listener: <input id="myField" type="input" onblur="doSomething(this)" /> Via JavaScript, I want to trigger the blur event on this input so that it, in ..

Vertical divider doesn't work in Bootstrap 3

I opened the Nav example which comes with the standard Bootstrap download (bootstrap-3.0.0\examples\navbar\index.html) and added vertical dividers between two of the links. However, it doesn't seem t..

Add animated Gif image in Iphone UIImageView

I need to load an animated Gif image from a URL in UIImageview. When I used the normal code, the image didn't load. Is there any other way to load animated Gif images?..

Psql list all tables

I would like to list all tables in the liferay database in my PostgreSQL install. How do I do that? I would like to execute SELECT * FROM applications; in the liferay database. applications is a tabl..

What does print(... sep='', '\t' ) mean?

I am having a bit of trouble trying to find an answer to this. I would like to know what the syntax sep="" and \t means. I have found some informaion about it but I didn't quite understand what the pu..

How to generate XML file dynamically using PHP?

I have to generate a xml file dynamically at runtime. Please help me in generating the below XML file dynamically using PHP. <?xml version="1.0" encoding="UTF-8"?> <xml> <track> ..

What's the point of 'meta viewport user-scalable=no' in the Google Maps API

I'm using the Google Maps JavaScript API V3 and the official examples always have you include this meta tag: <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> Most of the..

Android Studio: /dev/kvm device permission denied

When I try to run my Android app on an emulator I get this error: /dev/kvm permission denied. I checked the permissions and added the user I am currently logged in with to the kvm group. What ..

What does `unsigned` in MySQL mean and when to use it?

What does "unsigned" mean in MySQL and when should I use it?..

Change color of PNG image via CSS?

Given a transparent PNG displaying a simple shape in white, is it possible to somehow change the color of this through CSS? Some kind of overlay or what not?..

How to add default value for html <textarea>?

I want to set a default value for my html <textarea>. I read from a material that to add default value you have to do something like <textarea>This is default text</textarea>. I did ..

How do I catch an Ajax query post error?

I would like to catch the error and show the appropriate message if the Ajax request fails. My code is like the following, but I could not manage to catch the failing Ajax request. function getAjaxD..

Word wrapping in phpstorm

How can I enable Word wraping in phpstorm? I need to enable it only for some of my files (with extension .txt). Is is possible?..

PHP - remove <img> tag from string

Hey, I need to delete all images from a string and I just can't find the right way to do it. Here is what I tryed, but it doesn't work: preg_replace("/<img[^>]+\>/i", "(image) ", $content);..

Extract every nth element of a vector

I would like to create a vector in which each element is the i+6th element of another vector. For example, in a vector of length 120 I want to create another vector of length 20 in which each element..

How to disable CSS in Browser for testing purposes

Is there any way I can disable all external CSS in a browser (Firefox, Chrome...)? When using slower internet connection, sometimes only the bare HTML is loaded by the browser without the CSS info. I..

H2 database error: Database may be already in use: "Locked by another process"

I am trying to use the H2 database from a Java application. I created the database and its tables through the H2 Console and then I try to connect from Java using Connection con =

What are ODEX files in Android?

After some android apps installed, I found that it will change to odex file (not apk) in smartphone. How does it happens? Who can teach me, I am very interested about it...

error C4996: 'scanf': This function or variable may be unsafe in c programming

I have created a small application to find max number by using user-defined function with parameter. When I run it, it shows this message Error 1 error C4996: 'scanf': This function or variab..

problem with <select> and :after with CSS in WebKit

I would like to add some style on a select box with the pseudo :after (to style my select box with 2 parts and without images). Here's the HTML: <select name=""> <option value="">Test&l..

In log4j, does checking isDebugEnabled before logging improve performance?

I am using Log4J in my application for logging. Previously I was using debug call like: Option 1: logger.debug("some debug text"); but some links suggest that it is better to check isDebugEnabled(..

What exactly is node.js used for?

Is it a web server or a programming language for server-side scripts?..

How to iterate over a string in C?

Right now I'm trying this: #include <stdio.h> int main(int argc, char *argv[]) { if (argc != 3) { printf("Usage: %s %s sourcecode input", argv[0], argv[1]); } else { ..

Beginner Python Practice?

Well just getting into the flow of thing with Python. Reading a few books, finding it fairly easy as I already have some experience with C++/Java from school and Python is definetly my favorite thus f..

Using CSS td width absolute, position

Please see this JSFIDDLE td.rhead { width: 300px; } Why doesn't the CSS width work? <table> <thead> <tr> <td class="rhead">need 300px</td> <td colspan="7">Week ..

Is it possible to create a 'link to a folder' in a SharePoint document library?

Is it possible to create a shortcut to a folder in a different document library in a document library?..

How can I view all historical changes to a file in SVN

I know that I can svn diff -r a:b repo to view the changes between the two specified revisions. What I'd like is a diff for every revision that changed the file. Is such a command available?..

At runtime, find all classes in a Java application that extend a base class

I want to do something like this: List<Animal> animals = new ArrayList<Animal>(); for( Class c: list_of_all_classes_available_to_my_app() ) if (c is Animal) animals.add( new c()..

How do I tokenize a string in C++?

Java has a convenient split method: String str = "The quick brown fox"; String[] results = str.split(" "); Is there an easy way to do this in C++?..

Pass multiple parameters to rest API - Spring

I am trying to figure out if it is possible to pass a JSON object to rest API, Or pass a multiple parameters to that API ? And how to read these parameters in Spring ? Lets assume that the url looks l..

Regex using javascript to return just numbers

If I have a string like "something12" or "something102", how would I use a regex in javascript to return just the number parts?..

Warning: Found conflicts between different versions of the same dependent assembly

I am currently developing a .NET application, which consists of 20 projects. Some of those projects are compiled using .NET 3.5, some others are still .NET 2.0 projects (so far no problem). The probl..

chrome undo the action of "prevent this page from creating additional dialogs"

I sometimes find that I need to re-enable alerting for debugging. Of course I can close the tab and reload it but Is there a better way? ..

Plotting a 3d cube, a sphere and a vector in Matplotlib

I search how to plot something with less instruction as possible with Matplotlib but I don't find any help for this in the documentation. I want to plot the following things: a wireframe cube cente..

How to center the text in a JLabel?

despite many tries I can't get the result that I would like to see - text centered within the JLabel and the JLabel somewhat centered in the BorderLayout. I said "somewhat" because there should be als..

How to give a Blob uploaded as FormData a file name?

I am currently uploading images pasted from the clipboard with the following code: // Turns out getAsFile will return a blob, not a file var blob = event.clipboardData.items[0].getAsFile(), form..

clearing a char array c

I thought by setting the first element to a null would clear the entire contents of a char array. char my_custom_data[40] = "Hello!"; my_custom_data[0] = '\0'; However, this only sets the first ele..

How can I turn a JSONArray into a JSONObject?

Basically I have: JSONArray j = new JSONArray(); j.add(new JSONObject()); //JSONObject has a bunch of data in it j.add(new JSONArray()); //JSONArray has a bunch of data in it And now I would like ..

Returning a value from thread?

How do I return a value from a thread?..

Is there a NumPy function to return the first index of something in an array?

I know there is a method for a Python list to return the first index of something: >>> l = [1, 2, 3] >>> l.index(2) 1 Is there something like that for NumPy arrays?..

Difference between VARCHAR and TEXT in MySQL

When we create a table in MySQL with a VARCHAR column, we have to set the length for it. But for TEXT type we don't have to provide the length. What are the differences between VARCHAR and TEXT?..

How to get the last char of a string in PHP?

I need to get the last character of a string. Say I have "testers" as input string and I want the result to be "s". how can I do that in PHP?..

No connection could be made because the target machine actively refused it (PHP / WAMP)

Note: I realise this could be seen as a duplicate but i have looked at the other responses and they didn't fix the problem for me. I have recently installed Zend Studio and Zend Server with the mys..

How to create .ipa file using Xcode?

Please tell me the complete procedure to build my app & use it on a real iPhone...

Check if a variable is null in plsql

I want to check if a variable is null. If it is null, then I want to set a value to that variable: //data type of var is number if Var = null then var :=5; endif But I am geting error in it. ..

How to bind list to dataGridView?

I seem to be running around in circles and have been doing so in the last hours. I want to populate a datagridview from an array of strings. I've read its not possible directly, and that I need to cr..

How to ignore a property in class if null, using

I am using Json.NET to serialize a class to JSON. I have the class like this: class Test1 { [JsonProperty("id")] public string ID { get; set; } [JsonProperty("label")] public string ..

Creating a range of dates in Python

I want to create a list of dates, starting with today, and going back an arbitrary number of days, say, in my example 100 days. Is there a better way to do it than this? import datetime a = datetime..

Clearing input in vuejs form

Just completed a todolist tutorial. When submitting the form the input field doesn't clear. After trying both: document.getElementById("todo-field").reset(); document.getElementById("#todo..

Multiple inputs on one line

I have looked to no avail, and I'm afraid that it might be such a simple question that nobody dares ask it. Can one input multiple things from standard input in one line? I mean this: float a, b; ch..

Is PowerShell ready to replace my Cygwin shell on Windows?

I'm debating whether I should learn PowerShell, or just stick with Cygwin/Perl scripts/Unix shell scripts, etc. The benefit of PowerShell would be that the scripts could be more easily used by teamma..

How to add smooth scrolling to Bootstrap's scroll spy function

I've been trying to add a smooth scrolling function to my site for a while now but can't seem to get it to work. Here is my HTML code relating to my navigation: <div id="nav-wrapper"> <di..

UPDATE and REPLACE part of a string

I've got a table with two columns, ID and Value. I want to change a part of some strings in the second column. Example of Table: ID Value --------------------------------- 1 c..

What is "Linting"?

PHPLint, JSLint, and I recently came across "you can lint your JS code on the fly" while reading something about some IDE. So, what is "linting"?..

Exporting PDF with jspdf not rendering CSS

I am using jspdf.debug.js to export different data from a website but there are a few problems, I can't get it to render the CSS in the exported PDF and if I have an image in the page I am exporting, ..

How to update all MySQL table rows at the same time?

How do I update all MySQL table rows at the same time? For example, I have the table: id | ip | port | online_status | 1 | ip1 | port1 | | 2 | ip2 | por..

How to position a CSS triangle using ::after?

I've created a div with a bottom arrow using ::after. Here is the HTML code: <div class="sidebar-resources-categories">Topics</div> <div class="text-content">ok ok</div> And..

How can I convert String to Int?

I have a TextBoxD1.Text and I want to convert it to an int to store it in a database. How can I do this?..

Why is "forEach not a function" for this object?

This is probably something really dumb, but I don't understand why this doesn't work. var a = {"cat":"large"}; a.forEach(function(value, key, map){ console.log(value); }); Uncaught TypeError: ..

How to open Visual Studio Code from the command line on OSX?

The docs mention an executable called code, but I'm not sure where I can find that so I can put it on my path. The zip I downloaded from the VSCode site did not include any such executable. (I am able..

Exception in thread "main" java.lang.Error: Unresolved compilation problems

I am having a problem importing classes and setting variables and I need help with a test program I am doing. So I am testing out a program that just simply outputs what your input was and puts a time..

How to use a variable from a cursor in the select statement of another cursor in pl/sql

I want to run a query, get the results and then iterate through the results of that query with another select statement using the values of the first statement in my 2nd statement (cursor). I have 40..

How to close a GUI when I push a JButton?

Does anyone know how to make a jbutton close a gui? I think it is like System.CLOSE(0); but that didnt work. it also could be exitActionPerformed(evt);, but that didn't work either. just the line of c..

Python ValueError: too many values to unpack

I am getting that exception from this code: class Transaction: def __init__ (self): self.materials = {} def add_material (self, m): self.materials[m.type + m.purity] = m ..

Getting all file names from a folder using C#

I wanted to know if it is possible to get all the names of text files in a certain folder. For example, I have a folder with the name Maps, and I would like to get the names of all the text files in..

Display back button on action bar

I'm trying to display a Back button on the Action bar to move previous page/activity or to the main page (first opening). And I can not do it. my code. ActionBar actionBar = getActionBar(); actionBa..

How to check a Long for null in java

How do I check a Long value for null in Java? Will this work? if ( longValue == null) { return blah; } ..

How can I use Async with ForEach?

Is it possible to use Async when using ForEach? Below is the code I am trying: using (DataContext db = new DataLayer.DataContext()) { db.Groups.ToList().ForEach(i => async { await GetA..

Removing the remembered login and password list in SQL Server Management Studio

I've recently used our company's spare laptop (that has a general user set up) while mine was being repaired. I've checked the "Remember password" option in SQL Server Management Studio when logging i..

Python != operation vs "is not"

In a comment on this question, I saw a statement that recommended using result is not None vs result != None I was wondering what the difference is, and why one might be recommended over the oth..

Where to put the file

I am following the Artifactory 1-min Setup. I have Artifactory up and running on my localhost, and now I am trying to integrate it with Intellij/Gradle. The artifactory webapp gives a gradle.properti..

Find the max of 3 numbers in Java with different data types

Say I have the following three constants: final static int MY_INT1 = 25; final static int MY_INT2 = -10; final static double MY_DOUBLE1 = 15.5; I want to take the three of them and use Math.max() t..

Pythonic way to print list items

I would like to know if there is a better way to print all objects in a Python list than this : myList = [Person("Foo"), Person("Bar")] print("\n".join(map(str, myList))) Foo Bar I read this way is..

How to redirect output of an already running process

Normally I would start a command like longcommand &; I know you can redirect it by doing something like longcommand > /dev/null; for instance to get rid of the output or longcommand 2&g..

How to call Stored Procedures with EntityFramework?

I have generated an EF4 Model from a MySQL database and I have included both StoredProcedures and Tables. I know how to make regular instert/update/fetch/delete operations against the EF but I can't ..

Meaning of @classmethod and @staticmethod for beginner?

Could someone explain to me the meaning of @classmethod and @staticmethod in python? I need to know the difference and the meaning. As far as I understand, @classmethod tells a class that it's a met..

How do you format code on save in VS Code

I would like to automatically format TypeScript code using the build-in formatter when I save a file in Visual Studio Code. I'm aware of the following options, but none of them is good enough: Fo..

HTML 5 input type="number" element for floating point numbers on Chrome

I need to have users enter floating point numbers, so I use the following element: <input type="number" name="my_number" placeholder="Enter number"/> Works great on Firefox, but Chrome compla..

How to call Stored Procedure in a View?

How would I call a Stored Procedure that returns data in a View? Is this even possible? ..

How to detect a textbox's content has changed

I want to detect whenever a textbox's content has changed. I can use the keyup method, but that will also detect keystrokes which do not generate letters, like the arrow keys. I thought of two methods..

I want to truncate a text or line with ellipsis using JavaScript

I'm looking for a simple script which can truncate a string with ellipsis (...) I want to truncate something like 'this is a very long string' to 'this is a ve...' I don't want to use CSS or PHP...

How do I add a auto_increment primary key in SQL Server database?

I have a table set up that currently has no primary key. All I need to do is add a primary key, no null, auto_increment. I'm working with a Microsoft SQL Server database. I understand that it can't b..

printf formatting (%d versus %u)

What is difference between %d and %u when printing pointer addresses? For example: int a = 5; // check the memory address printf("memory address = %d\n", &a); // prints "memory address = -12" pr..

Android Call an method from another class

I know that this Question is repeated but I can't find the answer in Internet. I want to call a method from another class. I've Class1 and Class2. In Class 2 I've that method: public void UpdateEm..

Understanding inplace=True

In the pandas library many times there is an option to change the object inplace such as with the following statement... df.dropna(axis='index', how='all', inplace=True) I am curious what is being ..

Using success/error/finally/catch with Promises in AngularJS

I'm using $http in AngularJs, and I'm not sure on how to use the returned promise and to handle errors. I have this code: $http .get(url) .success(function(data) { // Handle data ..

Hadoop cluster setup - Connection refused

I want to setup a hadoop-cluster in pseudo-distributed mode. I managed to perform all the setup-steps, including startuping a Namenode, Datanode, Jobtracker and a Tasktracker on my machine. Then I tr..

SQL query to select distinct row with minimum value

I want an SQL statement to get the row with a minimum value. Consider this table: id game point 1 x 5 1 z 4 2 y 6 3 x 2 3 y 5 3 z 8 How do I sel..

Converting an array to a function arguments list

Is it possible to convert an array in JavaScript into a function argument sequence? Example: run({ "render": [ 10, 20, 200, 200 ] }); function run(calls) { var app = .... // app is retrieved from ..

How to use if - else structure in a batch file?

I have a question about if - else structure in a batch file. Each command runs individually, but I couldn't use "if - else" blocks safely so these parts of my programme doesn't work. How can I do make..

How to link html pages in same or different folders?

How can I link to html pages if they are in same or different folders without writing full path?..

Numpy where function multiple conditions

I have an array of distances called dists. I want to select dists which are between two values. I wrote the following line of code to do that: dists[(np.where(dists >= r)) and (np.where(dists <..

How to send a simple email from a Windows batch file?

I'm running Windows 2003 Service Pack 2. I have a batch file that runs on demand. I want to have an email sent every time the batch file runs. The email is simple, just a sentence indicating that the ..

How to terminate process from Python using pid?

I'm trying to write some short script in python which would start another python code in subprocess if is not already started else terminate terminal & app (Linux). So it looks like: #!/usr/bin/..

Disable cross domain web security in Firefox

In Firefox, how do I do the equivalent of --disable-web-security in Chrome. This has been posted a lot, but never a true answer. Most are links to add-ons (some of which don't work in the latest Firef..

MySQL Error 1215: Cannot add foreign key constraint

I am trying to forward engineer my new schema onto my db server, but I can't figure out why I am getting this error. I've tried to search for the answer here, but everything I've found has said to ei..

Convert a String representation of a Dictionary to a dictionary?

How can I convert the str representation of a dict, such as the following string, into a dict? s = "{'muffin' : 'lolz', 'foo' : 'kitty'}" I prefer not to use eval. What else can I use? The main re..

How to get full width in body element

How would I be able to get a website to auto-fit in the page? It's a landscape design which needs no scrolling...

How do I uninstall a package installed using npm link?

When installing a node package using sudo npm link in the package's directory, how can I uninstall the package once I'm done with development? npm link installs the package as a symbolic link in the ..

converting a base 64 string to an image and saving it

Here is my code: protected void SaveMyImage_Click(object sender, EventArgs e) { string imageUrl = Hidden1.Value; string saveLocation = Server.MapPath("~/PictureUploads..

How to get info on sent PHP curl request

I'm trying to debug a curl request to a webservice 'getToken' endpoint. I'm not 100% confident that the URL and the auth info is getting written in to the curl handle correctly. I'm trying to use ..

Convert int to a bit array in .NET

How can I convert an int to a bit array? If I e.g. have an int with the value 3 I want an array, that has the length 8 and that looks like this: 0 0 0 0 0 0 1 1 Each of these numbers are in a sepa..

Can I get all methods of a class?

Suppose that I have a .class file, can I get all the methods included in that class ?..

Is there any way to kill a Thread?

Is it possible to terminate a running thread without setting/checking any flags/semaphores/etc.?..

How to determine if Javascript array contains an object with an attribute that equals a given value?

I have an array like vendors = [{ Name: 'Magenic', ID: 'ABC' }, { Name: 'Microsoft', ID: 'DEF' } // and so on... ]; How do I check this array to see if "Magenic" exis..

How to maximize the browser window in Selenium WebDriver (Selenium 2) using C#?

Is there any way to maximize the browser window using WebDriver (Selenium 2) with C#?..

How do I set the time zone of MySQL?

On one server, when I run: mysql> select now(); +---------------------+ | now() | +---------------------+ | 2009-05-30 16:54:29 | +---------------------+ 1 row in set (0.00 sec) On..

Fluid width with equally spaced DIVs

I have a fluid width container DIV. Within this I have 4 DIVs all 300px x 250px... <div id="container"> <div class="box1"> </div> <div class="box2"> </div> <..

Username and password in command for git push

It's possible to clone down a git repository, specifying username and password in the command. Example: git clone https://username:[email protected]/file.git Is it is possible to also specif..

jQuery.getJSON - Access-Control-Allow-Origin Issue

I'm jusing jQuery's $.getJSON() function to return a short set of JSON data. I've got the JSON data sitting on a url such as I didn't realize it, but as I was accessing that same url, t..

Case insensitive string as HashMap key

I would like to use case insensitive string as a HashMap key for the following reasons. During initialization, my program creates HashMap with user defined String While processing an event (network ..

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

Difference between RegisterStartupScript and RegisterClientScriptBlock?

Is the only difference between the RegisterStartupScript and the RegisterClientScriptBlock is that RegisterStartupScript puts the javascript before the closing </form> tag of the page and Regist..

How to check if a map contains a key in Go?

I know I can iterate over a map m by, for k, v := range m { ... } and look for a key but is there a more efficient way of testing a key's existence in a map? I couldn't find the answer in the lan..

What do I need to do to get Internet Explorer 8 to accept a self signed certificate?

We use self signed certificates on our intranet. What do I need to do to get Internet Explorer 8 to accept them without showing an error message to the user? What we did for Internet Explorer 7 appare..

Open mvc view in new window from controller

Is there any way to open a view from a controller action in a new window? public ActionResult NewWindow() { // some code return View(); } How would I get the NewWindow.cshtml view to open i..

Java Program to test if a character is uppercase/lowercase/number/vowel

As I said before, how do I test if the entered character is one of the parameters? I've written this code, but it doesn't seem to run very well(or at all), no errors, however. Also, I need to use the ..

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

I am trying to open a program for the first time on Windows XP Pro that uses PostgreSQL 9. I'm getting an error message that says : A problem was encountered while trying to log into or create the..

how to wait for first command to finish?

I am writing a script in bash, which is calling two bash scripts internally. Where first script includes different tests which runs in background and second script print results of first script. When..

Save multiple sheets to .pdf

I have a reporting spreadsheet that grabs some data from a database and forms three sheets of summary report information. I want to run the spreadsheet automatically from the command line, and have it..