Questions Tagged with #Vpim

Console.WriteLine and generic List

I frequently find myself writing code like this: List<int> list = new List<int> { 1, 3, 5 }; foreach (int i in list) { Console.Write("{0}\t", i.ToString()); } Console.WriteLine(); B..

What exactly does Double mean in java?

I'm extremely new to Java and just wanted to confirm what Double is? Is it similar to Float or Int? Any help would be appreciated. I also sometimes see the uppercase Double and other times the lower c..

Implementing IDisposable correctly

In my classes I implement IDisposable as follows: public class User : IDisposable { public int id { get; protected set; } public string name { get; protected set; } public string pass { ge..

Best timestamp format for CSV/Excel?

I'm writing a CSV file. I need to write timestamps that are accurate at least to the second, and preferably to the millisecond. What's the best format for timestamps in a CSV file such that they can..

How to run Rake tasks from within Rake tasks?

I have a Rakefile that compiles the project in two ways, according to the global variable $build_type, which can be :debug or :release (the results go in separate directories): task :build => [:so..

remove script tag from HTML content

I am using HTML Purifier ( I just want to remove <script> tags only. I don't want to remove inline formatting or any other things. How can I achieve this? One more t..

Java 8 optional: ifPresent return object orElseThrow exception

I'm trying to make something like this: private String getStringIfObjectIsPresent(Optional<Object> object){ object.ifPresent(() ->{ String result = "result"; ..

Difference between no-cache and must-revalidate

From the RFC 2616 no-cache If the no-cache directive does not specify a field-name, then a cache MUST NOT use the response ..

Does HTML5 <video> playback support the .avi format?

I am wondering if the HTML5 <video> tag now supports playback of .avi format video files...

How to change Maven local repository in eclipse

I'm importing a multiple-module Maven project from the root directory on a shared drive on another server A. On server A, mvn install will run successfully, and Maven is set up properly with repositor..

Loop through all the resources in a .resx file

Is there a way to loop through all the resources in a .resx file in C#?..

POST an array from an HTML form without javascript

I have a form that is a little complex and I am hoping to simplify the server-side (PHP) processing by natively POSTing an array of tuples. The first part of the form represents a User: First Name ..

Ruby get object keys as array

I am new to Ruby, if I have an object like this {"apple" => "fruit", "carrot" => "vegetable"} How can I return an array of just the keys? ["apple", "carrot"] ..

Calculate the number of business days between two dates?

In C#, how can I calculate the number of business (or weekdays) days between two dates?..

How can I use "e" (Euler's number) and power operation in python 2.7

How can i write x.append(1-e^(-value1^2/2*value2^2)) in python 2.7? I don't know how to use power operator and e...

Android Studio doesn't recognize my device

Here is the problem. I want to run my Android Studio apps on my device (Samsung Galaxy Ace 2). But nothing works for me. Tell me what I've missed: 1) USB debugging is on 2) ADB driver is installed (..

JSON array get length

I can't get the array length of the JSON array. when I using length(); method it is not working, it show as red underline in Netbeans this is the source code try { JSONObject myjson = JS..

How do you sign a Certificate Signing Request with your Certification Authority?

During my search, I found several ways of signing a SSL Certificate Signing Request: Using the x509 module: openssl x509 -req -days 360 -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out ..

Filtering a pyspark dataframe using isin by exclusion

I am trying to get all rows within a dataframe where a columns value is not within a list (so filtering by exclusion). As an example: df = sqlContext.createDataFrame([('1','a'),('2','b'),('3','b'),(..

How do I compile C++ with Clang?

I have installed Clang by using apt-get in Ubuntu, and I can successfully compile C files using it. However, I have no idea how to compile C++ through it. What do I need to do to compile C++?..

How to use a servlet filter in Java to change an incoming servlet request url?

How can I use a servlet filter to change an incoming servlet request url from to

Firebase cloud messaging notification not received by device

I am having an issue with FireBase Cloud Messaging in which I get the Token from the device and send the notification test through the Google Firebase notification console however, the notification is..

UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactory'

I have a database configuration class to connect my spring web service with the database. I'm using spring boot, to make it stand alone application. Here is my class @Configuration @EnableTransactio..

When should I use cross apply over inner join?

What is the main purpose of using CROSS APPLY? I have read (vaguely, through posts on the Internet) that cross apply can be more efficient when selecting over large data sets if you are partitioning...

How do I rename a local Git branch?

I don't want to rename a remote branch, as described in Rename master branch for both local and remote Git repositories. How can I rename a local branch which hasn't been pushed to a remote branch? ..

Adding a rule in iptables in debian to open a new port

I am trying to open port 3306 in iptables in my Debian System to allow access to MySQL server. For which I entered this command: root@debian:/# sudo iptables -A INPUT -p tcp --dport 3306 ACCEPT root@..

How to convert date into this 'yyyy-MM-dd' format in angular 2

I want to convert current data into 'yyyy-MM-dd' format in .ts file. i template it can easily be done by using data pipe. how to do that in typescript. In template: {{date | date:'yyyy-MM-dd'}} H..

ActiveMQ connection refused

I am trying to use activemq in my application, but keep getting an error when I try and connect to localhost: log4j:WARN No appenders could be found for logger (org.springframework.core.env.StandardE..

Array to String PHP?

What is the best method for converting a PHP array into a string? I have the variable $type which is an array of types. $type = $_POST[type]; I want to store it as a single string in my database w..

Express.js Response Timeout

PROBLEM I've been looking for request/response timeouts for Express.js but everything seems to be related to the connection rather than the request/response itself. If a request is taking a long tim..

Xcode variables

In Xcode, I know that you can get variables such as PROJECT_DIR to use in some situations, such as a run script build phase. I am wondering if it's possible to get the build type (i.e., Release or Deb..

Check if XML Element exists

How can someone validate that a specific element exists in an XML file? Say I have an ever changing XML file and I need to verify every element exists before reading/parsing it. ..

How to get the server path to the web directory in Symfony2 from inside the controller?

The question is as follows: How can I get the server path to the web directory in Symfony2 from inside the controller (or from anywhere else for that reason) What I've already found (also, by search..

Counting the number of True Booleans in a Python List

I have a list of Booleans: [True, True, False, False, False, True] and I am looking for a way to count the number of True in the list (so in the example above, I want the return to be 3.) I have f..

Calculate Pandas DataFrame Time Difference Between Two Columns in Hours and Minutes

I have two columns, fromdate and todate, in a dataframe. import pandas as pd data = {'todate': [pd.Timestamp('2014-01-24 13:03:12.050000'), pd.Timestamp('2014-01-27 11:57:18.240000'), pd.Timestamp('2..

How do I select an entire row which has the largest ID in the table?

How would I do something like this? SQL SELECT row FROM table WHERE id=max(id) ..

How do I detect the Python version at runtime?

I have a Python file which might have to support Python versions < 3.x and >= 3.x. Is there a way to introspect the Python runtime to know the version which it is running (for example, 2.6 or 3.2.x..

How to remove an HTML element using Javascript?

I am a total newbie. Can somebody tell me how to remove an HTML element using the original Javascript not jQuery. index.html <html> <head> <script type="text/javascript" src="myscrip..

How to sort a list of strings?

What is the best way of creating an alphabetically sorted list in Python?..

Load a Bootstrap popover content with AJAX. Is this possible?

The appropriate bits of what I tried are here: <a href="#" data-content="<div id='my_popover'></div>"> Click here </a> $(".button").popover({html: true}) $(".button").click(..

Django: TemplateSyntaxError: Could not parse the remainder

I am getting this issue when I type localhost:8000/admin/. `TemplateSyntaxError: Could not parse the remainder: ':password_change' from 'admin:password_change'. The syntax of 'url' changed in Djan..

How can I check if a checkbox is checked?

I am building a mobile web app with jQuery Mobile and I want to check if a checkbox is checked. Here is my code. <script type=text/javascript> function validate(){ if (remember.checked ==..

php refresh current page?

I have a page which, If a variable is set(in a session) it will do an action, then it unsets the session. Now it has to refresh itself. This is where i am stuck. Is there a way to get the exact ur..

What's the effect of adding 'return false' to a click event listener?

Many times I've seen links like these in HTML pages: <a href='#' onclick='someFunc(3.1415926); return false;'>Click here !</a> What's the effect of the return false in there? Also, I d..

What is a NullPointerException, and how do I fix it?

What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them? What methods/tools can be used to determine the cause so that you stop the exception from causing the program t..

anchor jumping by using javascript

I have a question that will be found very often. The problem is that nowhere can be found an explicit solution. I have two problems regarding anchors. The main goal should be to get a nice clean url..

Error when trying to inject a service into an angular component "EXCEPTION: Can't resolve all parameters for component", why?

I've built a basic app in Angular, but I have encountered a strange issue where I cannot inject a service into one of my components. It injects fine into any of the three other components I have creat..

Catching multiple exception types in one catch block

I'd like a cleaner way to obtain the following functionality, to catch AError and BError in one block: try { /* something */ } catch( AError, BError $e ) { handler1( $e ) } catch( Exception $..

How is using "<%=request.getContextPath()%>" better than "../"

I have worked on number of J2EE projects where the view layer is JSP. In most projects, I have seen that we reference external resources i.e. images, javascript, jsp's, css etc. using the contextPath ..

How do I cancel an HTTP fetch() request?

There is a new API for making requests from JavaScript: fetch(). Is there any built in mechanism for canceling these requests in-flight?..

Can I write a CSS selector selecting elements NOT having a certain class or attribute?

I would like to write a CSS selector rule that selects all elements that don't have a certain class. For example, given the following HTML: <html class="printable"> <body class="printabl..

How to use ConfigurationManager

I want to use App.config for storing some setting. I tried to use the next code for getting a parameter from a config file. private string GetSettingValue(string paramName) { return String.Format(..

Why isn't this code to plot a histogram on a continuous value Pandas column working?

I am trying to create a histogram on a continuous value column Trip_distance in a large 1.4M row pandas dataframe. Wrote the following code: fig = plt.figure(figsize=(17,10)) trip_data.hist(column="..

Why use a ReentrantLock if one can use synchronized(this)?

I'm trying to understand what makes the lock in concurrency so important if one can use synchronized (this). In the dummy code below, I can do either: synchronized the entire method or synchronize t..

Show Console in Windows Application?

Is there a way to show the console in a Windows application? I want to do something like this: static class Program { [STAThread] static void Main(string[] args) { bool consoleMode =..

How to handle change text of span

I'm using jQuery and I want to show some calculation in a span (called span1) and I want when text of span1 changed do some calculation on it's value and show in other spans (called `span2 ,span3,...)..

How to enable Google Play App Signing

I think a lot of developers are trying to learn more about the new Google Play App Signing feature presented at Google I/O 2017. The ability to store the keystore to sign the apps inside Google Play ..

Compare objects in Angular

Is it possible to do a "deep" comparison of two object in Angular? What I would like to do is compare each key/value pair. For example: Object 1 { key1: "value1", key2: "value2", key3: "val..

How can I change the color of AlertDialog title and the color of the line under it

I changed the color of an AlertDialog title using this command alert.setTitle( Html.fromHtml("<font color='#FF7F27'>Set IP Address</font>")); But I want to change the color of the line..

All combinations of a list of lists

I'm basically looking for a python version of Combination of List<List<int>> Given a list of lists, I need a new list that gives all the possible combinations of items between the lists. ..

Proxy setting for R

I am facing problem while conecting R with internet in my office. May be this due to LAN settings. I tried the almost all possible ways I come across in the web (see below) but still in vain. Metho..

What's the simplest way to list conflicted files in Git?

I just need a plain list of conflicted files. Is there anything simpler than: git ls-files -u | cut -f 2 | sort -u or: git ls-files -u | awk '{print $4}' | sort | uniq I guess I could set up ..

How can I inspect the file system of a failed `docker build`?

I'm trying to build a new Docker image for our development process, using cpanm to install a bunch of Perl modules as a base image for various projects. While developing the Dockerfile, cpanm returns..

Scrollable Menu with Bootstrap - Menu expanding its container when it should not

I tried this method (their fiddle) to enable scrollable menu with Bootstrap, but with that approach, the scrollable menu expands its container -- fiddle -- the non-scrollable menu, correctly, does not..

How do I create a list of random numbers without duplicates?

I tried using random.randint(0, 100), but some numbers were the same. Is there a method/module to create a list unique random numbers? Note: The following code is based on an answer and has been adde..

Average of multiple columns

I have a table called Request and the data looks like: Req_ID R1 R2 R3 R4 R5 R12673 2 5 3 7 10 R34721 3 5 2 1 8 R27835 1 3 8 5 6 Now I want ..

Detect changed input text box

I've looked at numerous other questions and found very simple answers, including the code below. I simply want to detect when someone changes the content of a text box but for some reason it's not wo..

Combine multiple results in a subquery into a single comma-separated value

I've got two tables: TableA ------ ID, Name TableB ------ ID, SomeColumn, TableA_ID (FK for TableA) The relationship is one row of TableA - many of TableB. Now, I want to see a result like this: ..

Node.js - How to send data from html to express

this is form example in html: <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>CSS3 Contact Form</title> </head> <body> <div id="contac..

Find Item in ObservableCollection without using a loop

Currently i have the following syntax (list is a list containing objects with many different properties (where Title is one of them): for (int i=0; i < list.Count; i++) { if(title == list[i].Ti..

Can CSS force a line break after each word in an element?

I'm building a multilingual site, with the owner helping me with some translations. Some of the displayed phrases need line breaks to maintain the style of the site. Unfortunately, the owner isn't..

How do you create a read-only user in PostgreSQL?

I'd like to create a user in PostgreSQL that can only do SELECTs from a particular database. In MySQL the command would be: GRANT SELECT ON mydb.* TO 'xxx'@'%' IDENTIFIED BY 'yyy'; What is the equi..

Is there any simple way to convert .xls file to .csv file? (Excel)

Is there any simple way to convert .xls file to .csv file ? (Excel) in C# code ? i mean to take an existing .xls file and convert them to .csv file Thanks in advance..

What does '&' do in a C++ declaration?

I am a C guy and I'm trying to understand some C++ code. I have the following function declaration: int foo(const string &myname) { cout << "called foo for: " << myname << end..

Unable to find the requested .Net Framework Data Provider in Visual Studio 2010 Professional

Why am I getting "Unable to find the requested .Net Framework Data Provider" when trying to setup a new datasource in Visual Studio 2010 Professional? My stats: Windows 7 64bit 16gig RAM Visual Stu..

Regular Expression to reformat a US phone number in Javascript

I'm looking to reformat (replace, not validate - there are many references for validating) a phone number for display in Javascript. Here's an example of some of the data: 123 4567890 (123) 456-7890..

How do I obtain the frequencies of each value in an FFT?

I have an FFT result. These are stored in two double arrays: a real part array and an imaginary part array. How do I determine the frequencies that correspond to each element in these arrays? In othe..

Interfaces vs. abstract classes

In C#, when should you use interfaces and when should you use abstract classes? What can be the deciding factor?..

Ignore duplicates when producing map using streams

Map<String, String> phoneBook = .collect(toMap(Person::getName, Person::getAddress)); ..

Can we instantiate an abstract class?

During one of my interview, I was asked "If we can instantiate an abstract class?" My reply was "No. we can't". But, interviewer told me "Wrong, we can." I argued a bit on this. Then he told me to ..

numpy matrix vector multiplication

When I multiply two numpy arrays of sizes (n x n)*(n x 1), I get a matrix of size (n x n). Following normal matrix multiplication rules, a (n x 1) vector is expected, but I simply cannot find any info..

Determine a string's encoding in C#

Is there any way to determine a string's encoding in C#? Say, I have a filename string, but I don't know if it is encoded in Unicode UTF-16 or the system-default encoding, how do I find out?..

C - casting int to char and append char to char

I am making my first parallel application, but I am stuck with basics of C. I need to know, how to cast int to char and then how to append one char to another. It you could help me please, i would b..

Pandas timeseries plot setting x-axis major and minor ticks and labels

I want to be able to set the major and minor xticks and their labels for a time series graph plotted from a Pandas time series object. The Pandas 0.9 "what's new" page says: "you can either us..

JavaScript Uncaught ReferenceError: jQuery is not defined; Uncaught ReferenceError: $ is not defined

This is my fiddle, It work fine in my fiddle. However, when I transfer it to dreamweaver, it can't work. And I found this two error in my coding. Uncaught ReferenceEr..

LaTeX table positioning

I have a LaTeX document that contains a paragraph followed by 4 tables followed by a second paragraph. I want the 4 tables to appear between the two paragraphs which from what I've read means I should..

Multiple IF statements between number ranges

I'm trying to set up a formula with multiple IF statements between number ranges but I'm seeing the error: Formula parse error Here is the forumula: =IF((AND(A2>0,A2<500),"Less than 500",..

MySQL dump by query

Is it possible to do mysqldump by single SQL query? I mean to dump the whole database, like phpmyadmin does when you do export to SQL..

Converting string to tuple without splitting characters

I am striving to convert a string to a tuple without splitting the characters of the string in the process. Can somebody suggest an easy method to do this. Need a one liner. Fails a = 'Quattro ..

Change "on" color of a Switch

I'm using a standard Switch control with the holo.light theme in a ICS app. I want to change the highlighted or on state color of the Toggle Button from the standard light blue to green. This should..

Testing if a site is vulnerable to Sql Injection

I was reading about sql injection and i understand how it works if there is a form where the user can enter his username and login. What i dont get is how websites without a login page can be vulnerab..

Disable HttpClient logging

I am using commons-httpclient 3.1 in an integration test suite. The default logging for HttpClient is extremely noisy and I can't seem to turn it off. I've tried following the instructions here but no..

Parsing jQuery AJAX response

I use the following function to post a form to via jQuery AJAX: $('form#add_systemgoal .error').remove(); var formdata = $('form#add_systemgoal').serialize(); $.ajaxSetup({async: false}); ..

Setting up Eclipse with JRE Path

I have downloaded and extracted Eclipse. I have Eclipse in the following directory: C:\Applications\eclipse. When I try and run the executable , I get the following message : I currently have the f..

Search an Oracle database for tables with specific column names?

We have a large Oracle database with many tables. Is there a way I can query or search to find if there are any tables with certain column names? IE show me all tables that have the columns: id, fna..

python getoutput() equivalent in subprocess

I want to get the output from some shell commands like ls or df in a python script. I see that commands.getoutput('ls') is deprecated but'ls') will only get me the return code. I'll ..

Why ModelState.IsValid always return false in mvc

In my controller this code: [HttpPost] public ActionResult Edit(Company company, FormCollection IsCostCenters) { if (ModelState.IsValid) { Comp..

SCCM 2012 application install "Failed" in client Software Center

We're using SCCM 2012 and I'm packaging all of our application and testing them as I go. Some only have .exe's and are more difficult than the .msi's. Some have no documentation and I'm trying diffe..

Replace all non Alpha Numeric characters, New Lines, and multiple White Space with one Space

I'm looking for a neat RegEx solution to replace All non Alpha-Numeric Characters All NewLines All multiple instances of white space With a single space For those playing at home (the following..

Adding a css class to select using @Html.DropDownList()

I'm building my first MVC application after years of doing webforms, and for some reason I am not able to make this work: @Html.DropDownList("PriorityID", String.Empty, new {@class="textbox"} ) Er..

Regular expression for matching latitude/longitude coordinates?

I'm trying to create a regular expression for matching latitude/longitude coordinates. For matching a double-precision number I've used (\-?\d+(\.\d+)?), and tried to combine that into a single expres..

How to pick an image from gallery (SD Card) for my app?

This question was originally asked for Android 1.6. I am working on photos options in my app. I have a button and an ImageView in my Activity. When I click the button it would redirect to the galle..

How to use icons and symbols from "Font Awesome" on Native Android Application

I'm trying to use Font Awesome on my application, I was able to integrate the font using Typeface.createFromAsset(), but I also want to use the icons provided by this font, but so far I haven't been a..

find the array index of an object with a specific key value in underscore

In underscore, I can successfully find an item with a specific key value var tv = [{id:1},{id:2}] var voteID = 2; var data = _.find(tv, function(voteItem){ return == voteID; }); //data = ..

What's the difference between Sender, From and Return-Path?

What's the difference between an email Sender, From and Return-Path value? Example: I have a contact form where the user can input their email, would this be assigned to sender, from or return-path? ..

How to get PID by process name?

Is there any way I can get the PID by process name in Python? PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND ..

What is Common Gateway Interface (CGI)?

CGI is a Common Gateway Interface. As the name says, it is a "common" gateway interface for everything. It is so trivial and naive from the name. I feel that I understood this and I felt this every ti..

Accessing inventory host variable in Ansible playbook

I am using Ansible 2.1. I have the following inventory host file and a role being called by a play that needs access to the host file variable. Any thoughts on how to access it (currently getting an..

Convert from MySQL datetime to another format with PHP

I have a datetime column in MySQL. How can I convert it to the display as mm/dd/yy H:M (AM/PM) using PHP?..

How to create JSON string in C#

I just used the XmlWriter to create some XML to send back in an HTTP response. How would you create a JSON string. I assume you would just use a stringbuilder to build the JSON string and them forma..

Exclude all transitive dependencies of a single dependency

In Maven2, to exclude a single transitive dependency, I have to do something like this: <dependency> <groupId></groupId> <artifactId>sample-artifactB</artif..

What does the explicit keyword mean?

What does the explicit keyword mean in C++?..

Java to Jackson JSON serialization: Money fields

Currently, I'm using Jackson to send out JSON results from my Spring-based web application. The problem I'm having is trying to get all money fields to output with 2 decimal places. I wasn't able to ..

JavaScript unit test tools for TDD

I've looked into and considered many JavaScript unit tests and testing tools, but have been unable to find a suitable option to remain fully TDD compliant. So, is there a JavaScript unit test tool tha..

Calculating a 2D Vector's Cross Product

From wikipedia: the cross product is a binary operation on two vectors in a three-dimensional Euclidean space that results in another vector which is perpendicular to the plane containing the two..

Concatenating variables and strings in React

Is there a way to incorporate React's curly brace notation and an href tag? Say we have the following value in the state: {} and the following HTML attributes on a tag: href="#demo1" ..

How to get name of calling function/method in PHP?

I am aware of function debug_backtrace, but I am looking for some ready to use implementation of function like GetCallingMethodName()? It would be perfect if it gave method's class too (if it is indee..

Add my custom http header to Spring RestTemplate request / extend RestTemplate

My current code: RestTemplate restTemplate = new RestTemplate(); restTemplate.getMessageConverters().add(new MappingJackson2HttpMessageConverter()); Mall[] malls = restTemplate.getForObject(url, Mall..

apache ProxyPass: how to preserve original IP address

We are using ProxyPass to redirect all "/r" requests to jboss on port 18080 as follows: ProxyPreserveHost on ProxyPass /r http://localhost:18080/redirectService/ ProxyPassReverse /r http://localhost:..

How to set 'X-Frame-Options' on iframe?

If I create an iframe like this: var dialog = $('<div id="' + dialogId + '" align="center"><iframe id="' + frameId + '" src="' + url + '" width="100%" frameborder="0" height="'+frameHeightF..

How to navigate through textfields (Next / Done Buttons)

How can I navigate through all my text fields with the "Next" Button on the iPhone Keyboard? The last text field should close the Keyboard. I've setup the IB the Buttons (Next / Done) but now I'm st..

Java int to String - Integer.toString(i) vs new Integer(i).toString()

Sometimes java puzzles me. I have a huge amount of int initializations to make. What's the real difference? Integer.toString(i) new Integer(i).toString() ..

Asynchronous Requests with Python requests

I tried the sample provided within the documentation of the requests library for python. With, I get the response codes, but I want to get the content of each page requested. This, for ..

Simple JavaScript Checkbox Validation

I usually work with PHP so sadly don't have some basic JS principles down. This is all I want to accomplish--I've seen many posts on this topic but they are usually beyond what I need. Here is my fo..

How to conditionally take action if FINDSTR fails to find a string

I have a batch file as follows; CD C:\MyFolder findstr /c:"stringToCheck" fileToCheck.bat IF NOT XCOPY "C:\OtherFolder\fileToCheck.bat" "C:\MyFolder" /s /y I am getting an error ("C:\OtherFolder\fi..

Returning binary file from controller in ASP.NET Web API

I'm working on a web service using ASP.NET MVC's new WebAPI that will serve up binary files, mostly .cab and .exe files. The following controller method seems to work, meaning that it returns a file,..

Android Saving created bitmap to directory on sd card

I created a bitmap and now i want to save that bitmap to a directory somewhere. Can anyone show me how this is done. Thanks FileInputStream in; BufferedInputStream buf; try { ..

Recursively list files in Java

How do I recursively list all files under a directory in Java? Does the framework provide any utility? I saw a lot of hacky implementations. But none from the framework or nio ..

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

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

How can I find the OWNER of an object in Oracle?

I want to find the foreign keys of a table but there may be more than one user / schema with a table with the same name. How can I find the one that the currently logged user is seeing? Is there a fun..

REST HTTP status codes for failed validation or invalid duplicate

I am building an application with a REST-based API and have come to the point where I am specifying status codes for each requests. What status code should i send for requests failing validation or w..

List of special characters for SQL LIKE clause

What is the complete list of all special characters for a SQL (I'm interested in SQL Server but other's would be good too) LIKE clause? E.g. SELECT Name FROM Person WHERE Name LIKE '%Jon%' SQL Ser..

How to convert string to binary?

I am in need of a way to get the binary representation of a string in python. e.g. st = "hello world" toBinary(st) Is there a module of some neat way of doing this?..

apache server reached MaxClients setting, consider raising the MaxClients setting

I am running centos 5.5 with 768mb ram. i keep getting server reached MaxClients setting, consider raising the MaxClients setting in the logs also apache runs really slow. when i look at cacti graphs ..

Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null

I have a component in React which I am importing in index.js, but it is giving this error: Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing..

How to import other Python files?

How do I import other files in Python? How exactly can I import a specific python file like import How can I import a folder instead of a specific file? I want to load a Python file dynamic..

How to make a div with a circular shape?

i want to create a div with background color red and completely circular in shape How can i do that? Css or jquery both can be used..

Parse JSON String into List<string>

string json = "{\"People\":[{\"FirstName\":\"Hans\",\"LastName\":\"Olo\"} {\"FirstName\":\"Jimmy\",\"LastName\":\"Crackedcorn\"}]}"; var obj = JObject.Parse(json); List&l..

C++ cout hex values?

I want to do: int a = 255; cout << a; and have it show FF in the output, how would I do this?..

.NET Format a string with fixed spaces

Does the .NET String.Format method allow placement of a string at a fixed position within a fixed length string. " String Goes Here" " String Goes Here " "String Goes Here ..

C# DateTime to UTC Time without changing the time

How would I convert a preexisting datetime to UTC time without changing the actual time. Example: DateTime dateTime = GetSomeDateTime(); // dateTime here is 3pm dateTime.ToUtcDateTime() // datetime ..

"Cannot start compilation: the output path is not specified for module..."

I have a very simple Java + Gradle project. It builds fine. It runs fine from the shell with "gradle run". However, if I try to run inside of IntelliJ, I get: Cannot start compilation: the output pat..

How can I create basic timestamps or dates? (Python 3.4)

As a beginner, creating timestamps or formatted dates ended up being a little more of a challenge than I would have expected. What are some basic examples for reference?..

How to make Visual Studio copy a DLL file to the output directory?

I have a Visual Studio C++ project that relies on an external DLL file. How can I make Visual Studio copy this DLL file automatically into the output directory (debug/release) when I build the project..

Javascript (+) sign concatenates instead of giving sum of variables

Why when I use this: (assuming i = 1) divID = "question-" + i+1; I get question-11 and not question-2?..

where is create-react-app webpack config and files?

I create a ReactJS project with the create-react-app package and that worked well, but I cannot find webpack files and configurations. How does react-create-app work with webpack? Where are the webpa..

Checking if a variable is initialized

Seems like this would be a duplicate, but maybe it is just so obvious it hasn't been asked... Is this the proper way of checking if a variable (not pointer) is initialized in a C++ class? class MyCl..

Calculating average of an array list?

I'm trying to use the below code to calculate the average of a set of values that a user enters and display it in a jTextArea but it does not work properly. Say, a user enters 7, 4, and 5, the program..

How to comment multiple lines in Visual Studio Code?

I cannot find a way to comment and uncomment multiple lines of code in Visual Studio Code. Is it possible to comment and uncomment multiple lines in Visual Studio Code using some shortcut? If yes, ho..

php.ini & SMTP= - how do you pass username & password

My ISP account requires that I send a username & password for outbound SMTP mail. How do I get PHP to use this when executing php.mail()? The php.ini file only contains entries for the server (S..

How to get rid of punctuation using NLTK tokenizer?

I'm just starting to use NLTK and I don't quite understand how to get a list of words from text. If I use nltk.word_tokenize(), I get a list of words and punctuation. I need only the words instead. Ho..

ASP.NET DateTime Picker

is there any good free/open source time picker control that goes well with ASP.NET Calendar control?..

How to get xdebug var_dump to show full object/array

I am using xdebug (php_xdebug-2.1.2-5.3-vc9.dll) on WAMP. When I use var_dump on a large object or variable it does not show the full variable. array 'node' => array 'my_form' => ..

JavaScript/JQuery: $(window).resize how to fire AFTER the resize is completed?

I'm using JQuery as such: $(window).resize(function() { ... }); However, it appears that if the person manually resizes their browser windows by dragging the window edge to make it larger/smaller, .. main method

I created a project in Eclipse using the Spring Starter project template. It automatically created an Application class file, and that path matches the path in the POM.xml file, so all is well. Here ..

How do I force a DIV block to extend to the bottom of a page even if it has no content?

In the markup shown below, I'm trying to get the content div to stretch all the way to the bottom of the page but it's only stretching if there's content to display. The reason I want to do this is so..

How to Make Laravel Eloquent "IN" Query?

I want to make query in Laravel Eloquent like here its raw MySQL query SELECT * from exampleTbl where id in(1,2,3,4) I have tried this in Laravel Eloquent but it's not working DB::where("id IN..

android edittext onchange listener

I know a little bit about TextWatcher but that fires on every character you enter. I want a listener that fires whenever the user finishes editing. Is it possible? Also in TextWatcher I get an instanc..

Validate date in dd/mm/yyyy format using JQuery Validate

I am taking input of date of birth and date of death. Validation required date of death should be more than date of birth Date format to be dd/mm/yyyy Dates to be less than or equal to today. Val..

Could not reserve enough space for object heap to start JVM

Just faced with strange issue. When i type java -version i got Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine. ..

git diff between cloned and original remote repository

I have cloned a github repository and made no changes locally. Github repository moved forward with commits on the same branch. How do I find a diff between my local repository and the original gith..

How do I convert NSInteger to NSString datatype?

How does one convert NSInteger to the NSString datatype? I tried the following, where month is an NSInteger: NSString *inStr = [NSString stringWithFormat:@"%d", [month intValue]]; ..

Setting a PHP $_SESSION['var'] using jQuery

I need to set a PHP $_SESSION variable using the jQuery. IF the user clicks on an image I want to save a piece of information associated with that image as a session variable in php. I think I can d..

C Macro definition to determine big endian or little endian machine?

Is there a one line macro definition to determine the endianness of the machine. I am using the following code but converting it to macro would be too long. unsigned char test_endian( void ) { in..

How to convert an address to a latitude/longitude?

How would I go about converting an address or city to a latitude/longitude? Are there commercial outfits I can "rent" this service from? This would be used in a commercial desktop application on a Win..

Random word generator- Python

So i'm basically working on a project where the computer takes a word from a list of words and jumbles it up for the user. there's only one problem: I don't want to keep having to write tons of words ..

PANIC: Cannot find AVD system path. Please define ANDROID_SDK_ROOT (in windows 10)

While running an app on the virtual device (AVD) created on Android studio (in Windows 10), I am getting an error and panic. Emulator: PANIC: Cannot find AVD system path. Please define ANDROID_SDK_RO..

How to render pdfs using C#

I want to load and draw pdf files graphically using C#. I don't need to edit them or anything, just render them at a given zoom level. The pdf libraries I have found seem to be focussed on generation..

What's the C++ version of Java's ArrayList

Just getting back into using C++ and trying to convert a simple Java program I wrote recently. What's the preferred equivalent to the Java ArrayList in C++?..

Is Java RegEx case-insensitive?

In Java, when doing a replaceAll to look for a regex pattern like: replaceAll("\\?i\\b(\\w+)\\b(\\s+\\1)+\\b", "$1"); (to remove duplicate consecutive case-insensitive words, e.g. Test test), I'm ..

Get WooCommerce product categories from WordPress

I am trying to get the product categories from WooCommerce through a function in my WordPress theme function get_me_list_of($atts, $content = null) { $args = array( 'post_type' =&..

Create <div> and append <div> dynamically

I am trying to create a <div> dynamically, with an appended <div> inside. I have this so far which works: var iDiv = document.createElement('div'); = 'block'; iDiv.className = 'bl..

How do I close an open port from the terminal on the Mac?

I opened port #5955 from a java class to comunicate from a client. How do i close this port after I am done? and also which command can show me if port open or closed?..

Convert a numpy.ndarray to string(or bytes) and convert it back to numpy.ndarray

I'm having a little trouble here, I'm trying to convert a numpy.ndarray to string, I've already done that like this: randomArray.tostring() It works, but I'm wondering if I can transform it back t..

Django CSRF Cookie Not Set

I have some problem for a while now, I'm experiencing CSRF Cookie not set. Please look at the codes below Python def deposit(request, account_num): if request.method == 'POST': account = g..

Can't load IA 32-bit .dll on a AMD 64-bit platform

I am trying to use SVMLight from Java, using the JNI wrapper on this page: static { System.loadLibrary("lib/JNI_SVM-light-6.01/lib/svmlight"); } I get the following error: ... lib\JNI_S..

Regex to Match Symbols: !$%^&*()_+|~-=`{}[]:";'<>?,./

I'm trying to create a Regex test in JavaScript that will test a string to contain any of these characters: !$%^&*()_+|~-=`{}[]:";'<>?,./ More Info If You're Interested :) It's for a pre..

Plot yerr/xerr as shaded region rather than error bars

In matplotlib, how do I plot error as a shaded region rather than error bars? For example: rather than ..

How to change legend size with matplotlib.pyplot

Simple question here: I'm trying to get the size of my legend using matplotlib.pyplot to be smaller (i.e., the text to be smaller). The code I'm using goes something like this: plot.figure()

jQuery pass more parameters into callback

Is there a way to pass more data into a callback function in jQuery? I have two functions and I want the callback to the $.post, for example, to pass in both the resulting data of the AJAX call, as w..

Eclipse - Unable to install breakpoint due to missing line number attributes

I am getting this strange error in Eclipse while trying to set a breakpoint. Unable to insert breakpoint Absent Line Number Information I ticked the checkbox from Compiler options but no luck...

Android studio Error "Unsupported Modules Detected: Compilation is not supported for following modules"

I am using Android studio 1.0.1. I have a java module referred by other modules in my project. I have checked it out from SVN But now every Unsupported Modules Detected: Compilation is not supported..

JPA or JDBC, how are they different?

I am learning Java EE and I downloaded the eclipse with glassfish for the same. I saw some examples and also read the Oracle docs to know all about Java EE 5. Connecting to a database was very simple...

Cannot delete or update a parent row: a foreign key constraint fails

When doing: DELETE FROM `jobs` WHERE `job_id` =1 LIMIT 1 It errors: #1451 - Cannot delete or update a parent row: a foreign key constraint fails (paymesomething.advertisers, CONSTRAINT advertise..

Edit and Continue: "Changes are not allowed when..."

Even if I create a clean WinForms project, Edit and Continue doesn't work and gives me the error: Changes are not allowed when the debugger has been attached to an already running process or the code..

Python: Fetch first 10 results from a list

Is there a way we can fetch first 10 results from a list. Something like this maybe: list = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20] list.fetch(10) ?..

Directory.GetFiles: how to get only filename, not full path?

Possible Duplicate: How to get only filenames within a directory using c#? Using C#, I want to get the list of files in a folder. My goal: ["file1.txt", "file2.txt"] So I wrote this: stri..

How to prevent line breaks in list items using CSS

I'm trying to put a link called Submit resume in a menu using a li tag. Because of the whitespace between the two words it wraps to two lines. How to prevent this wrapping with CSS?..

Undefined reference to static class member

Can anyone explain why following code won't compile? At least on g++ 4.2.4. And more interesting, why it will compile when I cast MEMBER to int? #include <vector> class Foo { public: ..

Java: Literal percent sign in printf statement

I'm trying to add an actual percent sign into a printf statement in Java and I'm getting the error: illegal escape character System.out.printf("%s\t%s\t%1.2f\%\t%1.2f\%..

How to open Form in Add record

I have a form to input records to a table. I would like it to open on an empty add (New) instead of displaying the first record of the table. To be used by a Navigation Form which opens the input fo..

SQLite - UPSERT *not* INSERT or REPLACE Insert Update stored proc on SQL Server Is there some clever way to do this in SQLite that I have not thought of? Basically I want to update three out of four co..

ASP.NET GridView RowIndex As CommandArgument

How can you access and display the row index of a gridview item as the command argument in a buttonfield column button? <gridview> <Columns> <asp:ButtonField ButtonType="Button" ..

Java - How Can I Write My ArrayList to a file, and Read (load) that file to the original ArrayList?

I am writing a program in Java which displays a range of afterschool clubs (E.G. Football, Hockey - entered by user). The clubs are added into the following ArrayList: private ArrayList<Club>..

I want to delete all bin and obj folders to force all projects to rebuild everything

I work with multiple projects, and I want to recursively delete all folders with the name 'bin' or 'obj' that way I am sure that all projects will rebuild everything (sometimes it's the only way to fo..

How can I get my Android device country code without using GPS?

An Android mobile actually does know quite well where it is - but is there a way of retrieving the country by something, like a country code or country name? There isn't any need to know the exact GPS..

disable a hyperlink using jQuery

<a href="gohere.aspx" class="my-link">Click me</a> I did $('.my-link').attr('disabled', true); but it didn't work Is there an easy way to disable the hyperlink using jquery? Remove ..

TypeError: 'NoneType' object has no attribute '__getitem__'

I'm having an issue and I have no idea why this is happening and how to fix it. I'm working on developing a Videogame with python and pygame and I'm getting this error: File "/home/matt/Smoking-Gam..

Add new element to an existing object

I was looking for a way to add new elements to an an existing object like what push does with arrays I have tried this and it didn't work : var myFunction = { Author: 'my name ', date: '15-..

How can I give eclipse more memory than 512M?

I have following setup, but when I put 1024 and replace all 512 with 1024, then eclipse won't start at all. How can I have more than 512M memory for my eclipse JVM? -startup plugins/org.eclipse.equin..