Questions Tagged with #Heading

How to export table as CSV with headings on Postgresql?

I'm trying to export a PostgreSQL table with headings to a CSV file via command line, however I get it to export to CSV file, but without headings. My code looks as follows: COPY products_273 to '/..

Calculate compass bearing / heading to location in Android

I want to display an arrow at my location on a google map view that displays my direction relative to a destination location (instead of north). a) I have calculated north using the sensor values fro..

Do HTTP POST methods send data as a QueryString?

I'd like to know if the POST method on HTTP sends data as a QueryString, or if it use a special structure to pass the data to the server. In fact, when I analyze the communication with POST method f..

is python capable of running on multiple cores?

Question: Because of python's use of "GIL" is python capable running its separate threads simultaneously? Info: After reading this I came away rather uncertain on whether or not python is capable ..

Ruby class instance variable vs. class variable

I read "" but I'm of two minds when to use class instance variables. Class variables are shared by all objec..

Change div width live with jQuery

Is it possible to change a div's width live with jQuery? And if it is, how? What I want is to change its width depending on the browser's window width in real time, so if/when the user changes the br..

How do I make the return type of a method generic?

Is there a way to make this method generic so I can return a string, bool, int, or double? Right now, it's returning a string, but if it's able find "true" or "false" as the configuration value, I'd ..

Add a UIView above all, even the navigation bar

I want to display, above any other views, even the navigation bar, a kind of "pop-up" view that looks like this: full screen black background with a 0.5 alpha to see the other UIViewController under..

select rows in sql with latest date for each ID repeated multiple times

I have a table where each ID is repeated 3 times. there is a date in front of each id in each row. I want to select entire row for each ID where date is latest. There are total 370 columns in this ta..

Can jQuery provide the tag name?

I've got several elements on a HTML page which have the same class - but they're different element types. I want to find out the tag name of the element as I loop over them - but .attr doesn't take "..

Find out where MySQL is installed on Mac OS X

How do I find out where MySQL is installed on Mac OS X 10.7.9? I have MAMP installed so I presume that it is bundled with this install?..

How do I set up NSZombieEnabled in Xcode 4?

How do I set up NSZombieEnabled and CFZombieLevel for my executable in Xcode 4?..

regex string replace

I am trying to do a basic string replace using a regex expression, but the answers I have found do not seem to help - they are directly answering each persons unique requirement with little or no expl..

SQL Server Regular expressions in T-SQL

Is there any regular expression library written in T-SQL (no CLR, no extended SP, pure T-SQL) for SQL Server, and that should work with shared hosting? Edit: Thanks, I know about PATINDEX, LIKE, xp..

Refresh Fragment at reload

In an android application I'm loading data from a Db into a TableView inside a Fragment. But when I reload the Fragment it displays the previous data. Can I repopulate the Fragment with current data i..

How to copy a file to a remote server in Python using SCP or SSH?

I have a text file on my local machine that is generated by a daily Python script run in cron. I would like to add a bit of code to have that file sent securely to my server over SSH...

How do I pretty-print existing JSON data with Java?

I have a compact JSON string, and I want to format it nicely in Java without having to deserialize it first -- e.g. just like does it. Are there any libraries out there that provides thi..

TypeError: 'undefined' is not an object

I have a currently fairly dysfunctional Javascript program that's been causing me problems. However, it throws one error that I just don't understand: TypeError: 'undefined' is not an object (evaluat..

Adding elements to a collection during iteration

Is it possible to add elements to a collection while iterating over it? More specifically, I would like to iterate over a collection, and if an element satisfies a certain condition I want to add som..

You don't have write permissions for the /var/lib/gems/2.3.0 directory

I have ruby installed on my ubuntu 16.04. $which ruby /usr/bin/ruby $ruby -v ruby 2.3.0p0 (2015-12-25) [x86_64-linux-gnu] $gem install bundler ERROR: While executing gem ... (Gem::FilePermi..

Open a PDF using VBA in Excel

I'm trying to open all appropriate PDFs found in the same directory as my Excel workbook using VBA. I've added the Adobe Acrobat xx.x Type Library reference to the project. But when I try to create ..

Get the last item in an array

Here is my JavaScript code so far: var linkElement = document.getElementById("BackButton"); var loc_array = document.location.href.split('/'); var newT = document.createTextNode(unescape(capWords(loc..

Add a space (" ") after an element using :after

I want to add a blank space after some content, however the content: " "; doesn't seem to work. This is my code: h2:after { content: " "; } ... which doesn't work, however this does: h2:after..

Cannot read configuration file due to insufficient permissions

I've recently encountered an error trying to host my site with IIS. I have found a solution that many swear by. Solution: Add IIS_IUSRS with Read permission on files in the folder Change II..

How do I reference a cell range from one worksheet to another using excel formulas?

I have a single worksheet with sheets Sheet1 and Sheet2 and I am trying to reference a range of cells from Sheet2 to Sheet1 I know how to reference worksheet cells such as =Sheet2!A1 but how can I d..

How to extract the decimal part from a floating point number in C?

How can we extract the decimal part of a floating point number and store the decimal part and the integer part into two separate integer variables?..

Is it possible to ignore one single specific line with Pylint?

I have the following line in my header: import config.logging_settings This actually changes my Python logging settings, but Pylint thinks it is an unused import. I do not want to remove unused-impor..

How to debug Spring Boot application with Eclipse?

My Spring Boot webapp is running just fine, and I'd like to debug it through Eclipse. So when launching my Remote Java Application debugger, which port should I listen to? And is there a setting on m..

Gunicorn worker timeout error

I have setup gunicorn with 3 workers 30 worker connections and using eventlet worker class. It is setup behind Nginx. After every few requests, I see this in the logs. [ERROR] gunicorn.error: WORKER ..

Get all files and directories in specific path fast

I am creating a backup application where c# scans a directory. Before I use to have something like this in order to get all the files and subfiles in a directory: DirectoryInfo di = new DirectoryInfo..

What is the best way to implement a "timer"?

What is the best way to implement a timer? A code sample would be great! For this question, "best" is defined as most reliable (least number of misfires) and precise. If I specify an interval of 15 se..

Giving UIView rounded corners

My login view has a subview which has a UIActivityView and a UILabel saying "Signing In…". This subview has corners which aren't rounded. How can I make them round? Is there any way to do it inside..

Set multiple system properties Java command line

Is there an easier way to specify multiple System Properties on the command line to a Java program rather than having multiple -D statements? Trying to avoid this: java -jar -DNAME="myName" -DVERSI..

How to make ng-repeat filter out duplicate results

I'm running a simple ng-repeat over a JSON file and want to get category names. There are about 100 objects, each belonging to a category - but there are only about 6 categories. My current code is ..

SQL MAX of multiple columns?

How do you return 1 value per row of the max of several columns: TableName [Number, Date1, Date2, Date3, Cost] I need to return something like this: [Number, Most_Recent_Date, Cost] Query?..

What's the difference between "super()" and "super(props)" in React when using es6 classes?

When is it important to pass props to super(), and why? class MyComponent extends React.Component { constructor(props) { super(); // or super(props) ? } } ..

Why can't I change my input value in React even with the onChange listener

I am quite new to React and after going through some tutorials, I was trying the below code of mine. I made one component, passed props to it from a store, on componentWillMount I make a new state for..

Convert canvas to PDF

Is it possible to directly convert canvas to pdf using JavaScript (pdf.js or something like that)? Is there another possible way like canvas to img and then img to pdf? Can you give me an example?..

Why are only final variables accessible in anonymous class?

a can only be final here. Why? How can I reassign a in onClick() method without keeping it as private member? private void f(Button b, final int a){ b.addClickHandler(new ClickHandler() { ..

Cannot construct instance of - Jackson

I am using Jackson and I'm having problems, when I try to deserialize an Object I get the following error: com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of net...

Change Background color (css property) using Jquery

I want to Change the background colour on click . This is my code work that i tried.pls help me out :) <script src=""> $(docu..

Google Maps v2 - set both my location and zoom in

My question is, does anyone know how to set google maps up, to open up both my location and in a zoomed-in view? Currently, the main view opens up to Africa, all the way zoomed out. And so I have be..

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

Is there a math nCr function in python?

Possible Duplicates: Statistics: combinations in Python counting combinations and permutations efficiently Project euler problem in python (problem 53) I'm looking to see if built in wi..

Access mysql remote database from command line

I have a server with Rackspace. I want to access the database from my local machine command line. I tried like: mysql -u username -h -ppassword But it gives an error: ERROR 2003 (..

How to use sessions in an ASP.NET MVC 4 application?

I am new to ASP.NET MVC. I have used PHP before and it was easy to create a session and select user records based on the current session variables. I have looked everywhere on the Internet for a sim..

Is there a good JSP editor for Eclipse?

I need a nice JSP editor plugin for Eclipse. What are my choices?..

Select data from "show tables" MySQL query

Is it possible to select from show tables in MySQL? SELECT * FROM (SHOW TABLES) AS `my_tables` Something along these lines, though the above does not work (on 5.0.51a, at least)...

Disabled UIButton not faded or grey

In my iPhone app, I have a UIButton which I have created in Interface Builder. I can successfully enable and disable it like this in my code ... sendButton.enabled = YES; or sendButton.enabled = N..

Temporarily change current working directory in bash to run a command

I know I can use cd command to change my working directory in bash. But if I do this command: cd SOME_PATH && run_some_command Then the working directory will be changed permanently. Is ..

How to send string from one activity to another?

I have a string in activity2 String message = String.format( "Current Location \n Longitude: %1$s \n Latitude: %2$s", lat, lng); I want to insert this string into text field in activity1. How can ..

Load external css file like scripts in jquery which is compatible in ie also

Is there a way to load external CSS files, like we load JS file by using .getScript method and also use the callback function like in .getScript $("<link/>", { rel: "stylesheet", type: "t..

Preloading CSS Images

I have a hidden contact form which is deployed clicking on a button. Its fields are set as CSS background images, and they always appears a bit later than the div that have been toggled. I was using ..

Combine two ActiveRecord::Relation objects

Suppose I have the following two objects: first_name_relation = User.where(:first_name => 'Tobias') # ActiveRecord::Relation last_name_relation = User.where(:last_name => 'Fünke') # ActiveRe..

Is it better to return null or empty collection?

That's kind of a general question (but I'm using C#), what's the best way (best practice), do you return null or empty collection for a method that has a collection as a return type ?..

Add tooltip to font awesome icon

Has anyone here added tooltips to font-awesome icons? I have the following jsfiddle, but cannot seem to find a guide to add tooltips to the icons. <header> <!-- icons for settings, change..

SQL How to Select the most recent date item


How to show imageView full screen on imageView click?

I am getting images from url and showing it on the imageView. This functionality is working properly. But I want that when I click on that image, then it must be full screen. So how to achieve this fu..

Using numpy to build an array of all combinations of two arrays

I'm trying to run over the parameters space of a 6 parameter function to study its numerical behavior before trying to do anything complex with it, so I'm searching for an efficient way to do this. My..

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

Save PHP variables to a text file

I was wondering how to save PHP variables to a txt file and then retrieve them again. Example: There is an input box, after submitted the stuff that was written in the input box will be saved to a t..

What is a Data Transfer Object (DTO)?

What is a Data Transfer Object? In MVC are the model classes DTO, and if not what are the differences and do we need both?..

Unsupported major.minor version 52.0 when rendering in Android Studio

When I try to render a layout preview in Android Studio I get error: Unsupported major.minor version 52.0..

Change the Right Margin of a View Programmatically?

Can this attribute be changed dynamically in Java code? android:layout_marginRight I have a TextView, that has to change its position some pixels to the left dynamically. How to do it programmati..

How to get the nth element of a python list or a default if not available

I'm looking for an equivalent in python of dictionary.get(key, default) for lists. Is there any one liner idiom to get the nth element of a list or a default value if not available? For example, give..

Can we update primary key values of a table?

Can we update primary key values of a table?..

AmazonS3 putObject with InputStream length example

I am uploading a file to S3 using Java - this is what I got so far: AmazonS3 s3 = new AmazonS3Client(new BasicAWSCredentials("XX","YY")); List<Bucket> buckets = s3.listBuckets(); s3.putObject..

Fatal error: Call to undefined function mcrypt_encrypt()

NOTE: The libraries MCrypt support depend on have not been updated in years and MCrypt should no longer be considered a viable or secure method of encrypting data. What's more, MCrypt has been deprec..

Get HTML inside iframe using jQuery

Here is my situation. I have a file called iframe.html, which contains the code to for a image slideshow. The code is somewhat like <html> <head> <!-- Have added title and js fi..

Hide strange unwanted Xcode logs

When using the Xcode 8+ and creating a new blank project, the following logs appear when running the application: 2016-06-13 16:33:34.406093 TestiOS10[8209:100611] bundleid: com.appc.TestiOS10, enabl..

How to enable cURL in PHP / XAMPP

How do I enable cURL in PHP? ??..

Should functions return null or an empty object?

What is the best practice when returning data from functions. Is it better to return a Null or an empty object? And why should one do one over the other? Consider this: public UserEntity GetUserBy..

Python: How to create a unique file name?

I have a python web form with two options - File upload and textarea. I need to take the values from each and pass them to another command-line program. I can easily pass the file name with file uploa..

Recyclerview and handling different type of row inflation

I'm trying to work with the new RecyclerView, but I could not find an example of a RecyclerView with different types of rows/cardviews getting inflated. With ListView I override the getViewTypeCount ..

"Permission Denied" trying to run Python on Windows 10

Seems as though an update on Windows 10 overnight broke Python. Just trying to run python --version returned a "Permission Denied" error. None of the three updates; KB4507453, KB4506991, or KB4509096..

Error handling in Bash

What is your favorite method to handle errors in Bash? The best example of handling errors I have found on the web was written by William Shotts, Jr at He suggests usin..

How can I find out the current route in Rails?

I need to know the current route in a filter in Rails. How can I find out what it is? I'm doing REST resources, and see no named routes...

Standard Android menu icons, for example refresh

The Android SDK offers the standard menu icons via android.R.drawable.X. However, some standard icons, such as ic_menu_refresh (the refresh icon), are missing from android.R. Is there any way to get ..

PHP - get base64 img string decode and save as jpg (resulting empty image )

hi i'm actually sending a base64 image string trough ajax to a php script which just decodes string and save content as .jpg file. But the result is an empty image. How can this be possible? php sc..

how to permit an array with strong parameters

I have a functioning Rails 3 app that uses has_many :through associations which is not, as I remake it as a Rails 4 app, letting me save ids from the associated model in the Rails 4 version. These a..

Display PNG image as response to jQuery AJAX request

Is it possible to display an image returned by jQuery AJAX call, in the main stream of your HTML? I have a script that draws an image with a header (image/PNG). When I simply call it in the browser, ..

Adding attribute in jQuery

How can I add an attribute into specific HTML tags in jQuery? For example, like this simple HTML: <input id="someid" /> Then adding an attribute disabled="true" like this: <input id="som..

How to find MySQL process list and to kill those processes?

The MySQL database hangs, due to some queries. How can I find the processes and kill them?..

How to install maven on redhat linux

Note: When originally posted I was trying to install maven2. Since the main answer is for maven3 I have updated the title. The rest of the question remains as it was originally posted. I'm trying to ..

AngularJS : Why ng-bind is better than {{}} in angular?

I was in one of the angular presentation and one of the person in the meeting mentioned ng-bind is better than {{}} binding. One of the reason, ng-bind put the variable in the watch list and only wh..

telnet to port 8089 correct command

I am using telnet to port 8089 on remote server. Can any tell me which of the following commands are true. telnet 8089 or telnet 89 Thanks in Advance...

How to round an average to 2 decimal places in PostgreSQL?

I am using PostgreSQL via the Ruby gem 'sequel'. I'm trying to round to two decimal places. Here's my code: SELECT ROUND(AVG(some_column),2) FROM table I get the following error: PG::Error:..

useState set method not reflecting change immediately

I am trying to learn hooks and the useState method has made me confused. I am assigning an initial value to a state in the form of an array. The set method in useState is not working for me even with ..

What is the best way to remove accents (normalize) in a Python unicode string?

I have a Unicode string in Python, and I would like to remove all the accents (diacritics). I found on the web an elegant way to do this (in Java): convert the Unicode string to its long normalized f..

Cygwin - Makefile-error: recipe for target `main.o' failed

I am currently failing to write a good makefile and don't know the reason why.. -.- This is my main.c: #include <windows.h> #include <stdio.h> int main(int argc, char *argv[]) { pr..

How to quit android application programmatically

I Found some codes for quit an Android application programatically. By calling any one of the following code in onDestroy() will it quit application entirely? System.runFinalizersOnExit(true) ..

Make an existing Git branch track a remote branch?

I know how to make a new branch that tracks remote branches, but how do I make an existing branch track a remote branch? I know I can just edit the .git/config file, but it seems there should be an e..

How do I keep jQuery UI Accordion collapsed by default?

I am working with jQuery UI Accordion and it works great, but I would like to have the accordion stay closed unless it I click on it. I am using this code right now, which allows be to toggle it clos..

java.lang.ClassNotFoundException: Didn't find class on path: dexpathlist

I'm currently working on a project in which I have to use purely native ndk. It worked when I try running an helloworld example from Irrlicht engine source. Then I try using it in my project following..

Getting value of selected item in list box as string

I am trying to get the value of the selected item in the listbox using the code below, but it is always returning null string. DataSet ds = searchforPrice(Convert.ToString(listBox1.SelectedItem)); ..

How do I update pip itself from inside my virtual environment?

I'm able to update pip-managed packages, but how do I update pip itself? According to pip --version, I currently have pip 1.1 installed in my virtualenv and I want to update to the latest version. W..

How to check whether a int is not null or empty?

I really dont know if this is possible or not. But I am strucking in a place where I want to check an int value is null or not, to call different methods. Is there any way to do it? Actually, variab..

What is the difference between . (dot) and $ (dollar sign)?

What is the difference between the dot (.) and the dollar sign ($)? As I understand it, they are both syntactic sugar for not needing to use parentheses...

The Completest Cocos2d-x Tutorial & Guide List

I'm developing a game using Cocos2d-x to Android and iPhone. At the beggining, I had a lot of problems to start using this library, so, in this question, I want to collect all basic, medium and expert..

What is the difference between <section> and <div>?

What is the difference between <section> and <div> in HTML? Aren't we defining sections in both cases?..

How to create Custom Ratings bar in Android

Hello all i need to perform Ratings in my application... SO i need to create custom Ratings bar... Can Anyone Help me in this?..

How can I combine two commits into one commit?

I have a branch 'firstproject' with 2 commits. I want to get rid of these commits and make them appear as a single commit. The command git merge --squash sounds promising, but when I run git merge -..

C++: Converting Hexadecimal to Decimal

I'm looking for a way to convert hex(hexadecimal) to dec(decimal) easily. I found an easy way to do this like : int k = 0x265; cout << k << endl; But with that I can't input 265. Is the..

Check if application is installed - Android

I'm trying to install apps from Google Play. I can understand that on opening the Google Play store URL, it opens the Google Play and when I press the back button, the activity resumes. Intent market..

ReactJS: Warning: setState(...): Cannot update during an existing state transition

I am trying to refactor the following code from my render view: <Button href="#" active={!this.state.singleJourney} onClick={this.handleButtonChange.bind(this,false)} >Retour</Button> t..

trying to align html button at the center of the my page

I'm trying to align an HTML button exactly at the centre of the page irrespective of the browser used. It is either floating to the left while still being at the vertical centre or being somewhere on ..

Can't Load URL: The domain of this URL isn't included in the app's domains

I'm trying to get access token from user string response_script = "<script>top.location.href='[APPLICATION ID]&r..

PHPExcel set border and format for all sheets in spreadsheet

I'm currently trying to set all borders for my spreadsheet, also formatting such as autosize. My code below is working, for sheet 1. All other sheets inside the spreadsheet are completely untouched. ..

Is there any difference between DECIMAL and NUMERIC in SQL Server?

Is there any difference between DECIMAL and NUMERIC data types in SQL Server? When should I use DECIMAL and when NUMERIC?..

Quickly getting to YYYY-mm-dd HH:MM:SS in Perl

When writing Perl scripts I frequently find the need to obtain the current time represented as a string formatted as YYYY-mm-dd HH:MM:SS (say 2009-11-29 14:28:29). In doing this I find myself taking ..

Can I run multiple versions of Google Chrome on the same machine? (Mac or Windows)

This fabulous answer suggests there’s no way to run multiple versions of Google Chrome on one machine. Every now and then you’ll get a website user stuck on an old version of Chrome (no idea how,..

<SELECT multiple> - how to allow only one item selected?

I have a <SELECT multiple> field with multiple options and I want to allow it to have only one option selected at the same time but user can hold CTRL key and select more items at once. Is ther..

What does Statement.setFetchSize(nSize) method really do in SQL Server JDBC driver?

I have this really big table with some millions of records every day and in the end of every day I am extracting all the records of the previous day. I am doing this like: String SQL = "select col1,..

How to get ALL child controls of a Windows Forms form of a specific type (Button/Textbox)?

I need to get all controls on a form that are of type x. I'm pretty sure I saw that code once in the past that used something like this: dim ctrls() as Control ctrls = Me.Controls(GetType(TextBox)) ..

Changes in import statement python3

I don't understand the following from pep-0404 In Python 3, implicit relative imports within packages are no longer available - only absolute imports and explicit relative imports are supporte..

PostgreSQL: How to change PostgreSQL user password?

How do I change the password for PostgreSQL user?..

MySQL, Check if a column exists in a table with SQL

I am trying to write a query that will check if a specific table in MySQL has a specific column, and if not — create it. Otherwise do nothing. This is really an easy procedure in any enterprise-cla..

How to get the url parameters using AngularJS

HTML source code <div ng-app=""> <div ng-controller="test"> <div ng-address-bar browser="html5"></div> <br><br> $location.url() = {{$locatio..

NOW() function in PHP

Is there a PHP function that returns the date and time in the same format as the MySQL function NOW()? I know how to do it using date(), but I am asking if there is a function only for this. For e..

Count number of occurrences of a pattern in a file (even on same line)

When searching for number of occurrences of a string in a file, I generally use: grep pattern file | wc -l However, this only finds one occurrence per line, because of the way grep works. How can I..

Exception: Serialization of 'Closure' is not allowed

So I am not sure exactly what I would have to show you guys, how ever if you need more code please do not hesitate to ask: So this method will set up the initMailer for Zend with in our application: ..

Get Application Directory

Does someone know how do I get the path of my application directory? (e.g. /data/data/ Currently I'm using this method: myActivity.getFilesDir().getParent(); but it seems to me like ..

How to prevent "The play() request was interrupted by a call to pause()" error?

I made a website where if the user clicks, it plays a sound. To prevent the sound from overlapping, I had to add the code: n.pause(); n.currentTime = 0;; But that causes the error: The pl..

How to schedule a task to run when shutting down windows

How do you schedule a task in Windows XP to run when you shutdown windows. Such that I want to run a simple command line program I wrote in c# everytime I shut down windows. There doesn't seem to be a..

How do I create HTML table using jQuery dynamically?

I am trying to create a HTML table like the following dynamically using jQuery: <table id='providersFormElementsTable'> <tr> <td>Nickname</td> <td>&..

Copying text to the clipboard using Java

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

How do you get the length of a list in the JSF expression language?

How would I get the length of an ArrayList using a JSF EL expression? #{MyBean.somelist.length} does not work...

Where does linux store my syslog?

I wrote a simple test application to log something in a log file. I am using linux mint and after the application executes I try to view the log using this command: tail -n 100 /var/log/messages b..

Set min-width in HTML table's <td>

My table has several columns. Each column should have dynamic width that depends on the browser window size. On the other hand, each column must not be too tiny. So I tried to set min-width for thos..

NumPy array initialization (fill with identical values)

I need to create a NumPy array of length n, each element of which is v. Is there anything better than: a = empty(n) for i in range(n): a[i] = v I know zeros and ones would work for v = 0, 1. I..

'and' (boolean) vs '&' (bitwise) - Why difference in behavior with lists vs numpy arrays?

What explains the difference in behavior of boolean and bitwise operations on lists vs NumPy arrays? I'm confused about the appropriate use of & vs and in Python, illustrated in the following ex..

Android-Studio upgraded from 0.1.9 to 0.2.0 causing gradle build errors now

My current project had been building with Gradle just fine, since I created it (about a month ago), after acquiring Android-Studio. [I installed some earlier updates to Android-Studio, and had no prob..

TypeError: Router.use() requires middleware function but got a Object

There have been some middleware changes on the new version of express and I have made some changes in my code around some of the other posts on this issue but I can't get anything to stick. We had it..

PHP Function with Optional Parameters

I've written a PHP function that can accepts 10 parameters, but only 2 are required. Sometimes, I want to define the eighth parameter, but I don't want to type in empty strings for each of the paramet..

Delete commits from a branch in Git

I would like to know how to delete a commit. By delete, I mean it is as if I didn't make that commit, and when I do a push in the future, my changes will not push to the remote branch. I read git he..

What does it mean to "call" a function in Python?

What does "call" mean and do? How would you "call" a function in Python?..

C++ - Assigning null to a std::string

I am learning C++ on my own. I have the following code but it gives error. #include <iostream> #include <string> using namespace std; int setvalue(const char * value) { string mVal..

unable to set private key file: './cert.pem' type PEM

I am using curl to download data from a https site using public certificate files. System information: OS: fedora 14 curl: curl 7.30.0 openssl: OpenSSL 1.0.0a-fips The command is, curl -v "https..

How to create a table from select query result in SQL Server 2008

I want to create a table from select query result in SQL Server, I tried create table temp AS select..... but I got an error Incorrect syntax near the keyword 'AS' ..

How do I check that multiple keys are in a dict in a single pass?

I want to do something like: foo = { 'foo': 1, 'zip': 2, 'zam': 3, 'bar': 4 } if ("foo", "bar") in foo: #do stuff How do I check whether both foo and bar are ..

Detect the Enter key in a text input field

I'm trying to do a function if enter is pressed while on specific input. What I'm I doing wrong? $(document).keyup(function (e) { if ($(".input1").is(":focus") && (e.keyCode == 13)) { ..

How to write PNG image to string with the PIL?

I have generated an image using PIL. How can I save it to a string in memory? The method requires a file. I'd like to have several such images stored in dictionary...

escaping question mark in regex javascript

This is a simple question I think. I am trying to search for the occurrence of a string in another string using regex in JavaScript like so: var content ="Hi, I like your Apartment. Could we schedu..

How to compare two double values in Java?

A simple comparison of two double values in Java creates some problems. Let's consider the following simple code snippet in Java. package doublecomparision; final public class DoubleComparision { ..

Should I use the Reply-To header when sending emails as a service to others?

Suppose we have an application that acts as a middleman, allowing Company A to send reports to their customers. Company A --> Company B (me)--> Company A's customers After getting the report we ..

PHP write file from input to txt

I've searched around this site for an answer but couldnt find any. I have a form and I'd like to get the contents of the input written into a txt file. To make it simple I just wrote a simple form an..

Why can't I shrink a transaction log file, even after backup?

I have a database that has a 28gig transaction log file. Recovery mode is simple. I just took a full backup of the database, and then ran both: backup log dbmcms with truncate_only DBCC SHRINKFIL..

C#: HttpClient with POST parameters

I use codes below to send POST request to a server: string url = "http://myserver/method?param1=1&param2=2" HttpClientHandler handler = new HttpClientHandler(); HttpClient httpClient = new Ht..

How do I hide the status bar in a Swift iOS app?

I'd like to remove the status bar at the top of the screen. This does not work: func application (application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {..

Sanitizing strings to make them URL and filename safe?

I am trying to come up with a function that does a good job of sanitizing certain strings so that they are safe to use in the URL (like a post slug) and also safe to use as file names. For example, wh..

When adding a Javascript library, Chrome complains about a missing source map, why?

My code <html> <head> <!-- Load TensorFlow.js --> <script src=""></script> <!-- Load Posenet --> &l..

Background image jumps when address bar hides iOS/Android/Mobile Chrome

I'm currently developing a responsive site using Twitter Bootstrap. The site has a full screen background image across mobile/tablet/desktop. These images rotate and fade through each, using two divs..

Fixed width buttons with Bootstrap

Does Bootstrap support fixed width buttons? Currently if I have 2 buttons, "Save" and "Download", the button size changes based on content. Also what is the right way of extending Bootstrap?..

What is the reason for java.lang.IllegalArgumentException: No enum const class even though iterating through values() works just fine?

This question is basically an extension of my previous question . I asked the previous question to be sure that the Enum constants are populated when the class loads . Here's is my class again with th..

Notepad++ cached files location

On the most recent versions of Notepad++, when the application is closed, unsaved files are maintained when the application is restarted. I presume that those files are cached on a temporary files. W..

Changing the page title with Jquery

How to make dynamic changing <title> tag with jquery? example: adding 3 > symbols one by one > title >> title >>> title ..

How to temporarily disable a click handler in jQuery?

Say I have something like the following to trap the click event of a button: $("#button_id").click(function() { //disable click event //do something //re-enable click event } How do I tempora..

How to set a binding in Code?

I have the need to set a binding in code. I can't seem to get it right tho. This is what i have tried: XAML: <TextBox Name="txtText"></TextBox> Code behind: Binding myBinding = new ..

Fastest way to Remove Duplicate Value from a list<> by lambda

what is fastest way to remove duplicate values from a list. Assume List<long> longs = new List<long> { 1, 2, 3, 4, 3, 2, 5 }; So I am interesting in use lambda to remove duplicate and retu..

Where are $_SESSION variables stored?

Are $_SESSION variables stored on the client or the server?..

Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints

I make an outer join and executed successfully in the informix database but I get the following exception in my code: DataTable dt = TeachingLoadDAL.GetCoursesWithEvalState(i, bat); Failed to en..

How to format code in Xcode?

I wonder how can I format my code to align it neatly? Does it have a feature similar to Eclipse's ctrlshiftf?..

How to terminate a process in vbscript

How can I terminate process using vbscript. PLEASE NOTE, I need to terminate process that runs under windows 64-bit environment as native 64 (not using select * from win_32_Process) Thanks,..

List of Stored Procedures/Functions Mysql Command Line

How can I see the list of the stored procedures or stored functions in mysql command line like show tables; or show databases; commands...

Reading and writing binary file

I'm trying to write code to read a binary file into a buffer, then write the buffer to another file. I have the following code, but the buffer only stores a couple of ASCII characters from the first ..

How to keep keys/values in same order as declared?

I have a dictionary that I declared in a particular order and want to keep it in that order all the time. The keys/values can't really be kept in order based on their value, I just want it in the orde..

How to use find command to find all files with extensions from list?

I need to find all image files from directory (gif, png, jpg, jpeg). find /path/to/ -name "*.jpg" > log How to modify this string to find not only .jpg files?..

Android WSDL/SOAP service client

I have some web services that uses WSDL/SOAP for communication. Specifically, I am using PHP and Nusoap to make them. How can I use these web services on Android? I am going to get a new Android phone..

load external URL into modal jquery ui dialog

why doesn't this display into a 400x500px modal? The section appears to be correct, but it doesn't cause the popup modal to appear. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN..

How do I find out which settings.xml file maven is using

I recently changed my password and have to change my maven settings.xml file to reflect that. However, no matter what I do in the settings.xml file, the changed password just won't get picked up. Out ..

Filtering a spark dataframe based on date

I have a dataframe of date, string, string I want to select dates before a certain period. I have tried the following with no luck data.filter(data("date") < new java.sql.Date(format.parse("2..

How to tell Jackson to ignore a field during serialization if its value is null?

How can Jackson be configured to ignore a field value during serialization if that field's value is null. For example: public class SomeClass { // what jackson annotation causes jackson to skip ..

Can't include C++ headers like vector in Android NDK

When I try to include any C++ class like vector in my Android NDK project (using NDK r5b, the latest), I get an error like the following... Compile++ thumb : test-libstl <= test-libstl.cpp /Users..

Log4j2 configuration - No log4j2 configuration file found

Lately I decided to learn how to use the log4j2 logger. I downloaded required jar files, created library, xml comfiguration file and tried to use it. Unfortunately i get this statement in console (Ecl..

Purpose of #!/usr/bin/python3 shebang

I have noticed this in a couple of scripting languages, but in this example, I am using python. In many tutorials, they would start with #!/usr/bin/python3 on the first line. I don't understand why we..

SQL Server using wildcard within IN

Since I believe this should be a basic question I know this question has probably been asked, but I am unable to find it. I'm probably about to earn my Peer Pressure badge, but I'll ask anyway: Is th..

Convert List<T> to ObservableCollection<T> in WP7

I don't know if it's just too late or what, but I don't see how to do this... What I'm expecting to do, and what the object browser says is there, is this: var oc = new ObservableCollection<T>..

How to search for a file in the CentOS command line

I am using CentOS minimal version and I am trying to locate a file, but I have no idea how to search all of the server for the file. I am sure there is a command out there to do it, can anyone help me..

Differences between Ant and Maven

Could someone tell me the differences between Ant and Maven? I have never used either. I understand that they are used to automate the building of Java projects, but I do not know where to start from...

How to get system time in Java without creating a new Date

I need to get the system date, and Java provides the new Date().getTime(). But I need to avoid new object allocation (I'm working on a embedded system). How can I get the system time without allocati..

How do browser cookie domains work?

Due to weird domain/subdomain cookie issues that I'm getting, I'd like to know how browsers handle cookies. If they do it in different ways, it would also be nice to know the differences. In other wo..

c# datagridview doubleclick on row with FullRowSelect

I have a datagridview in my C# application and the user should only be able to click on full rows. So I set the SelectionMode to FullRowSelect. But now I want to have an Event which is fired when the..

Playing mp3 song on python

I want to play my song (mp3) from python, can you give me a simplest command to do that? This is not correct: import wave w ="e:/LOCAL/Betrayer/Metalik Klinik1-Anak Sekolah.mp3","r") ..

How do I add a bullet symbol in TextView?

I have a TextView and I want to add a bullet symbol in my text through XML. Is it possible?..

AngularJS - Create a directive that uses ng-model

I am trying to create a directive that would create an input field with the same ng-model as the element that creates the directive. Here's what I came up with so far: HTML <!doctype html> &l..

Java 8 Stream API to find Unique Object matching a property value

Find the object matching with a Property value from a Collection using Java 8 Stream. List<Person> objects = new ArrayList<>(); Person attributes -> Name, Phone, Email. Iterate throu..

Firebase Permission Denied

I'm relatively new to coding and am having trouble. I have this code to send data to firebase app.userid = app.user.uid var userRef = app.dataInfo.child(app.users); var useridRef = userRef.child(a..

How do I pick 2 random items from a Python set?

I currently have a Python set of n size where n >= 0. Is there a quick 1 or 2 lines Python solution to do it? For example, the set will look like: fruits = set(['apple', 'orange', 'watermelon', 'gr..

Can I specify multiple users for myself in .gitconfig?

In my ~/.gitconfig, I list my personal email address under [user], since that's what I want to use for Github repos. But, I've recently started using git for work, too. My company's git repo allows m..

Java split string to array

I need help with the split() method. I have the followingString: String values = "0|0|0|1|||0|1|0|||"; I need to put the values into an array. There are 3 possible strings: "0", "1", and "" My p..

How can I check if a string is null or empty in PowerShell?

Is there a built-in IsNullOrEmpty-like function in order to check if a string is null or empty, in PowerShell? I could not find it so far and if there is a built-in way, I do not want to write a func..

How to get list of all installed packages along with version in composer?

I have been working on a project using Symfony 2.1 on my local machine. I have uploaded it to my server but when I try and install the vendor bundles using Composer, I'm getting a lot of dependency e..

How to reload current page in ReactJS?

How to reload current page in ReactJS? in case of javascript we can wrote window.location.reload(); How to do the same in reactjs? I'm able to add new data by UI. But without refresh I'm not able to s..

SQL Query to add a new column after an existing column in SQL Server 2005

I need a SQL query which add a new column after an existing column, so the column will be added in a specific order. Please suggest me if any ALTER query which do that...

How do I simulate placeholder functionality on input date field?

It's impossible to use placeholder on date fields but I really need it. I want two date inputs with texts "From" and "To" on each one as placeholders...

Referring to the null object in Python

How do I refer to the null object in Python?..

What is the difference between Builder Design pattern and Factory Design pattern?

What is the difference between the Builder design pattern and the Factory design pattern? Which one is more advantageous and why ? How do I represent my findings as a graph if I want to test and c..

Div not expanding even with content inside

I have a stack of divs inside of each other, all of which have an ID which specifies CSS only. But for some reason the surrounding DIV tag only expands to it's anointed height value, and not it's def..

jQuery Ajax Request inside Ajax Request

Is it possible to make an ajax request inside another ajax request? because I need some data from first ajax request to make the next ajax request. First I'm using Google Maps API to get LAT & LN..

react-router go back a page how do you configure history?

Can anyone please tell me how I can go back to the previous page rather than a specific route? When using this code: var BackButton = React.createClass({ mixins: [Router.Navigation], render: fun..

Navigation bar with UIImage for title

I want to customize my app's look by using a logo image as the navigation bar's title, instead of plain text. When I use this code let logo = UIImage(named: "logo.png") self.navigationItem.titleView ..

Getting value of HTML text input

Say I have an HTML form like this to collect an email from a website visitor: <form name="input" action="handle_email.php" method="post"> Email: <input type="text" name="email" /> <inp..