Questions Tagged with #Vim7.2

Get the value in an input text box

What are the ways to get and render an input value using jQuery? Here is one: _x000D_ _x000D_ $(document).ready(function() {_x000D_ $("#txt_name").keyup(function() {_x000D_ alert($(this).val(..

Jenkins Slave port number for firewall

We use Jenkins 1.504 on Windows. We need to have Master and Slave in different sub-networks with firewall in between. We can't have ANY to ANY port firewall rules, we must specify exact port numbers...

Java escape JSON String?

I have the following JSON string that i am sending to a NodeJS server: String string = "{\"id\":\"" + userID + "\",\"type\":\"" + methoden + "\",\"msg\":\"" + msget + "\", \"name\":\"" + namnet + "\"..

Comparing double values in C#

I've a double variable called x. In the code, x gets assigned a value of 0.1 and I check it in an 'if' statement comparing x and 0.1 if (x==0.1) { ---- } Unfortunately it does not enter the if stat..

Regex to test if string begins with http:// or https://

I'm trying to set a regexp which will check the start of a string, and if it contains either http:// or https:// it should match it. How can I do that? I'm trying the following which isn't working: ..

Shell Script — Get all files modified after <date>

I'd rather not do this in PHP so I'm hoping a someone decent at shell scripting can help. I need a script that runs through directory recursively and finds all files with last modified date is greate..

Google Play app description formatting

I've made an Android application that is available on Google Play. Now I want to add some more formatting to my app description (eg. indent, links, lists..). But I cannot find any website where possib..

Bulk Insertion in Laravel using eloquent ORM

How can we perform bulk database insertions in Laravel using Eloquent ORM? I want to accomplish this in Laravel: but I am getting the following error. ..

Dependency Walker reports IESHIMS.DLL and WER.DLL missing?

On a Windows XP Professional SP3 with Internet Explorer 8 box, when I run Dependency Walker on an executable of mine it reports that: IESHIMS.DLL and WER.DLL can't be found. Do I need these DLL's? W..

CUSTOM_ELEMENTS_SCHEMA added to NgModule.schemas still showing Error

I just upgraded from Angular 2 rc4 to rc6 and having troubles doing so. I see the following error on my console: Unhandled Promise rejection: Template parse errors: 'cl-header' is not a known elem..

How can I determine the character encoding of an excel file?

Possible Duplicate: Excel to CSV with UTF8 encoding Scenario: I have an excel file containing a large amount of global customer data. I do not know what encoding was used when the file was..

variable is not declared it may be inaccessible due to its protection level

My VB skills are not the best, and this problem has had me stumped for a few days. In the list of controls shown in Visual Studio that are not defined in the code behind, I can "mouseover" them and t..

How to add an event after close the modal window?

I have code modal: <-- Button to trigger modal --> <div id="result"></div> <a href="#myModal" role="button" class="btn" data-toggle="modal">Launch demo modal</a> &l..

Cannot read property 'length' of null (javascript)

While trying to debug I am get the 'length' null error with this line. It is written just like the book instructed, so I don't understand why it is giving me the error? Thanks, =) if (capital.leng..

c++ integer->std::string conversion. Simple function?

Problem: I have an integer; this integer needs to be converted to a stl::string type. In the past, I've used stringstream to do a conversion, and that's just kind of cumbersome. I know the C way is ..

How to add new column to MYSQL table?

I am trying to add a new column to my MYSQL table using PHP. I am unsure how to alter my table so that the new column is created. In my assessment table I have: assessmentid | q1 | q2 | q3 | q4 | q5 ..

AngularJS For Loop with Numbers & Ranges

Angular does provide some support for a for loop using numbers within its HTML directives: <div data-ng-repeat="i in [1,2,3,4,5]"> do something </div> But if your scope variable inclu..

How to autowire RestTemplate using annotations

When I try to autowire Spring RestTemplate, I am getting following error: nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springfr..

Excel VBA Password via Hex Editor

I have used the "Hex Editor to modify DPB to DPx" many times in the past to bypass VBA project security on my old Excel VBA projects (.xls), so I definitely know how to do it and know that I can do it..

Clearing <input type='file' /> using jQuery

Is it possible to clear an <input type='file' /> control value with jQuery? I've tried the following: $('#control').attr({ value: '' }); But it's not working...

How to SELECT by MAX(date)?

This is the table structure: CREATE TABLE `reports` ( `report_id` int(11) NOT NULL auto_increment, `computer_id` int(11) NOT NULL default '0', `date_entered` datetime NOT NULL default '1970-01-0..

Find unique rows in numpy.array

I need to find unique rows in a numpy.array. For example: >>> a # I have array([[1, 1, 1, 0, 0, 0], [0, 1, 1, 1, 0, 0], [0, 1, 1, 1, 0, 0], [1, 1, 1, 0, 0, 0], [..

oracle.jdbc.driver.OracleDriver ClassNotFoundException

This is my code for which I am getting error. My classes12.jar has been imported as an external jar. import; import; import java.sql.Connection; import java.sq..

Stop UIWebView from "bouncing" vertically?

Does anyone know how to stop a UIWebView from bouncing vertically? I mean when a user touches their iphone screen, drags their finger downwards, and the webview shows a blank spot above the web page I..

Angular cli generate a service and include the provider in one step

It is possible generate a service with angular cli and add it as a provider in the app.module.ts in a single step or using an special option in the ng g service command? When a execute: $ ng g servi..

Length of a JavaScript object

I have a JavaScript object. Is there a built-in or accepted best practice way to get the length of this object? const myObject = new Object(); myObject["firstname"] = "Gareth"; myO..

Convert JSON String to JSON Object c#

I have this String stored in my database: str = "{ "context_name": { "lower_bound": "value", "upper_bound": "value", "values": [ "value1", "valueN" ] } }" This string is already in the JSON format ..

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

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

Converting an integer to binary in C

I'm trying to convert an integer 10 into the binary number 1010. This code attempts it, but I get a segfault on the strcat(): int int_to_bin(int k) { char *bin; bin = (char *)malloc(sizeof(c..

Error: getaddrinfo ENOTFOUND in nodejs for get call

I am running a web server on node the code for which is given below var restify = require('restify'); var server = restify.createServer(); var quotes = [ { author : 'Audrey Hepburn', text : "Noth..

How to DROP multiple columns with a single ALTER TABLE statement in SQL Server?

I would like to write a single SQL command to drop multiple columns from a single table in one ALTER TABLE statement. From MSDN's ALTER TABLE documentation... DROP { [CONSTRAINT] constraint_name | ..

How do I apply a style to all children of an element

I have an element with class='myTestClass'. How do I apply a css style to all children of this elements? I only want to apply the style to the elements children. Not its grand children. I could use ..

#ifdef in C#

I would like to do the below but in C# instead of C++ #ifdef _DEBUG bool bypassCheck=TRUE_OR_FALSE;//i will decide depending on what i am debugging #else bool bypassCheck = false; //NEVER bypass it #..

OnClickListener in Android Studio

I'm attempting to develop and app using the new Android Studio, but I keep receiving major errors on my OnClickListeners. Mainly it is telling me that it cannot resolve symbol "setOnClickListener" and..

Allow access permission to write in Program Files of Windows 7

My application throws 'Access denied' errors when writing temporary files in the installation directory where the executable resides. However it works perfectly well in Windows XP. How to provide acce..

pip installing in global site-packages instead of virtualenv

Using pip3 to install a package in a virtualenv causes the package to be installed in the global site-packages folder instead of the one in the virtualenv folder. Here's how I set up Python3 and virtu..

Name node is in safe mode. Not able to leave

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

How to use <md-icon> in Angular Material?

I was wondering how to use Material's icons, as this is not working: <material-icon icon = "/img/icons/ic_access_time_24px.svg"> </material-icon> I guess there is a problem with the p..

How do you see recent SVN log entries?

Typing svn log spits out an incredibly long, useless list on a command line. I have no idea why that is the default. If I wanted to read (or even could read) 300 entries on the terminal, I wouldn't mi..

Get first date of current month in java

I am trying to get to and from date where ToDate will have previous date and FromDate will have first date of the current month. For January it would be 1/1/2013 and so on. How to get the first date o..

Correct way to find max in an Array in Swift

I've so far got a simple (but potentially expensive) way: var myMax = sort(myArray,>)[0] And how I was taught to do it at school: var myMax = 0 for i in 0..myArray.count { if (myArray[i] &g..

How to copy data from one HDFS to another HDFS?

I have two HDFS setup and want to copy (not migrate or move) some tables from HDFS1 to HDFS2. How to copy data from one HDFS to another HDFS? Is it possible via Sqoop or other command line?..

Properties file with a list as the value for an individual key

For my program I want to read a key from a properties file and an associated List of values for the key. Recently I was trying like that public static Map<String,List<String>>categoryMap ..

Truncate to three decimals in Python

How do I get 1324343032.324? As you can see below, the following do not work: >>1324343032.324325235 * 1000 / 1000 1324343032.3243253 >>int(1324343032.324325235 * 1000) / 1000.0 13243430..

How do I change column default value in PostgreSQL?

How do I change column default value in PostgreSQL? I've tried: ALTER TABLE ONLY users ALTER COLUMN lang DEFAULT 'en_GB'; But it gave me an error: ERROR: syntax error at or near "DEFAULT" ..

Python, TypeError: unhashable type: 'list'

i'm reciving the following error in my program: Traceback: Traceback (most recent call last): File "C:\Python33\Archive\PythonGrafos\", line 126, in <module> menugrafos() File "C:\Pytho..

How to make git mark a deleted and a new file as a file move?

I've moved a file manually and then I've modified it. According to Git, it is a new file and a removed file. Is there any way to force Git into treating it as a file move?..

Convert Text to Date?

I have a column of dates (column A) stored as text in the format yyyy-mm-dd which I'm trying to convert to dates, ultimately so that I can do look ups against them. I've read a few topics on here and..

Extract the first (or last) n characters of a string

I want to extract the first (or last) n characters of a string. This would be the equivalent to Excel's LEFT() and RIGHT(). A small example: # create a string a <- paste('left', 'right', sep = '')..

How to unzip gz file using Python

I need to extract a gz file that I have downloaded from an FTP site to a local Windows file server. I have the variables set for the local path of the file, and I know it can be used by GZIP muddle. ..

Recursive Fibonacci

I'm having a hard time understanding why #include <iostream> using namespace std; int fib(int x) { if (x == 1) { return 1; } else { return fib(x-1)+fib(x-2); } } ..

Using Html.ActionLink to call action on different controller

I am trying to navigate between controllers using ActionLink. I will tell my problem with an example. I am on Index view of Hat controller, and I am trying to use below code to create a link to Detai..

Move div to new line

I'm pretty new to CSS and it is still magic for me. I want to have my div movie_item_content_plot on a new line. Currently I use <br> in HTML and this works fine. When I replace the <br> w..

How to pattern match using regular expression in Scala?

I would like to be able to find a match between the first letter of a word, and one of the letters in a group such as "ABC". In pseudocode, this might look something like: case Process(word) => ..

Change the default editor for files opened in the terminal? (e.g. set it to TextEdit/Coda/Textmate)

Is there a way to make files opened for editing in the terminal open in Textedit instead? For example, where a command might open a file for editing (like git commit), instead of opening that file i..

Mysql service is missing

I have installed Mysql server locally and everything was working Ok but today when I tried to get a connection to the local db, I got an error. After checking services showed that the MySql service is..

Android: Force EditText to remove focus?

I would like to be able to remove the focus from the EditText. For example if the Keyboard appears, and the user hides it with the back button, I would like the focus and the cursor to disappear. How ..

Using context in a fragment

How can I get the context in a fragment? I need to use my database whose constructor takes in the context, but getApplicationContext() and FragmentClass.this don't work so what can I do? Database co..

How to Detect cause of 503 Service Temporarily Unavailable error and handle it?

i am getting the error 503 Service Temporarily Unavailable many times in my application and i want to detect why this error occurs, how ? if there's a log file or something like that, since i am not f..

Android design support library for API 28 (P) not working

I've configured android-P SDK environment successfully. When I attempt to use the android design support library I face project build errors. Project configurations are: IDE: 3.2 Canary 17 Target API..

CakePHP select default value in SELECT input

Using CakePHP: I have a many-to-one relationship, let's pretend it's many Leafs to Trees. Of course, I baked a form to add a Leaf to a Tree, and you can specify which Tree it is with a drop-down box..

What is the bit size of long on 64-bit Windows?

Not to long ago, someone told me that long are not 64 bits on 64 bit machines and I should always use int. This did not make sense to me. I have seen docs (such as the one on Apple's official site) sa..

Bash Shell Script - Check for a flag and grab its value

I am trying to make a shell script which is designed to be run like this: -t application Firstly, in my script I want to check to see if the script has been run with the -t flag. For exam..

Importing json file in TypeScript

I have a JSON file that looks like following: { "primaryBright": "#2DC6FB", "primaryMain": "#05B4F0", "primaryDarker": "#04A1D7", "primaryDarkest": "#048FBE", "secondaryBrig..

Github Push Error: RPC failed; result=22, HTTP code = 413

stupid issue with Github going on right now. I have a decent amount of changes (~120MB in size), when I attempt to push, this is what happens: error: RPC failed; result=22, HTTP code = 413 fatal: The..

error: function returns address of local variable

I'm beginner with C and I am learning on my own. I am creating the following function: char *foo(int x){ if(x < 0){ char a[1000]; char b = "blah"; x = x - 1; ..

is inaccessible due to its protection level

I can't figure this out. The problem is that the distance, club, cleanclub, hole, scores and par all say inaccessible due to protection level and I don't know why because I thought I did everything ri..

T-SQL CASE Clause: How to specify WHEN NULL

I wrote a T-SQL Statement similar like this (the original one looks different but I want to give an easy example here): SELECT first_name + CASE last_name WHEN null THEN 'Max' ELSE 'Peter' END A..

POST request send json data java HttpUrlConnection

I have developed a java code that convert the following cURL to java code using URL and HttpUrlConnection. the curl is : curl -i '' -X POST -H "Content-Type: application/json" -H "Acce..

How to execute a Python script from the Django shell?

I need to execute a Python script from the Django shell. I tried: ./ shell << But it didn't work. It was just waiting for me to write something...

Make footer stick to bottom of page using Twitter Bootstrap

I have some webpages that do not have much content and the footer sits in the middle of the page, but I want it to be at the bottom. I have put all my pages in a "holder" #holder { min-height: 10..

Do we need to execute Commit statement after Update in SQL Server

I have done some update to my record through SQL Server Manager. As Update statement is not having explicit commit, I am trying to write it manually. Update mytable set status=0; Commit; I am gett..

Error:java: invalid source release: 8 in Intellij. What does it mean?

Im trying to compile some code in I'm using Intellij Ultimate 13.1.4, but I get the following error and I have no idea what it means: Information:Using javac 1.7.0_55 to compile java sources Informat..

How to work with progress indicator in flutter?

I'm newbie in flutter and wanted to know what is better way to add CircularProgressIndicator in my layout. For example, my login view. This view have username, password and login Button. I did want cr..

Why doesn't Java allow overriding of static methods?

Why is it not possible to override static methods? If possible, please use an example...

Find what 2 numbers add to something and multiply to something

Hey so I'm making a factoring program and I'm wondering if anyone can give me any ideas on an efficient way to find what two numbers multiple to a specified number, and also add to a specified number...

video as site background? HTML 5

I want to use a video as a background instead of an image that automatically stretches to the whole screen (background). I would also like to rotate videos and images.. so that there is a random vide..

How to access model hasMany Relation with where condition?

I created a model Game using a condition / constraint for a relation as follows: class Game extends Eloquent { // many more stuff here // relation without any constraints fine ..

AngularJS - How to use $routeParams in generating the templateUrl?

Our application has 2-level navigating. We want to use AngularJS $routeProvider to dynamically provide templates to an <ng-view />. I was thinking of doing something along the lines of this: an..

How to add Android Support Repository to Android Studio?

I'm using Android Studio with an external Android SDK. I have installed the support library and the support repository. The support repository is in: ~/Development/Tools/android/sdk/extras/android/m2..

How do you run a single query through mysql from the command line?

I'm looking to be able to run a single query on a remote server in a scripted task. For example, intuitively, I would imagine it would go something like: mysql -uroot -p mydb_..

Graph visualization library in JavaScript

I have a data structure that represents a directed graph, and I want to render that dynamically on an HTML page. These graphs will usually be just a few nodes, maybe ten at the very upper end, so my ..

Laravel form html with PUT method for PUT routes

I Have this in my routes : +--------+---------------------------+--------------+--------------------------- ..

Easiest way to mask characters in HTML(5) text input

Does HTML5 have any kind of text field masking or do I still have to trap onkeydown etc.? jbabey is right--"masking" as in blocking certain illegal characters, not hiding what's typed. The best (as ..

How do I get the web page contents from a WebView?

On Android, I have a WebView that is displaying a page. How do I get the page source without requesting the page again? It seems WebView should have some kind of getPageSource() method that returns ..

How to get out of while loop in java with Scanner method "hasNext" as condition?

I am a beginner at java programming and has run into a strange issue. Below is my code, which asks user for input and prints out what the user inputs one word at a time. The problem is the program ne..

Extract Google Drive zip from Google colab notebook

I already have a zip of (2K images) dataset on a google drive. I have to use it in a ML training algorithm. Below Code extracts the content in a string format: from pydrive.auth import GoogleAuth fro..

How do I use setsockopt(SO_REUSEADDR)?

I am running my own http server on a raspberry pi. The problem is when I stop the program and restart it, the port is no longer available. Sometimes I get the same issue when receiving lots of request..

C# error: "An object reference is required for the non-static field, method, or property"

I have two classes, one for defining the algorithm parameters and another to implement the algorithm: Class 1 (algorithm parameters): using System; using System.Collections.Generic; using System.Lin..

Find the last time table was updated

I want to retrieve the last time table was updated(insert,delete,update). I tried this query. SELECT last_user_update FROM sys.dm_db_index_usage_stats WHERE object_id=object_id('T') but the data t..

How to include PHP files that require an absolute path?

I have a directory structure like the following; script.php inc/include1.php inc/include2.php objects/object1.php objects/object2.php soap/soap.php Now, I use those objects in..

Linq select objects in list where exists IN (A,B,C)

I have a list of orders. I want to select orders based on a set of order statuses. So essentially select orders where order.StatusCode in ("A", "B", "C") // Filter the orders based on the order stat..

How can I repeat a character in Bash?

How could I do this with echo? perl -E 'say "=" x 100' ..

How to split a string in Java

I have a string, "004-034556", that I want to split into two strings: string1="004"; string2="034556"; That means the first string will contain the characters before '-', and the second string will..

How to disable Django's CSRF validation?

I have commented out csrf processor and middleware lines in 122 123 TEMPLATE_CONTEXT_PROCESSORS = ( 124 'django.contrib.auth.context_processors.auth', 125 # 'django.core.context_..

how to pass parameter from @Url.Action to controller function

I have a function CreatePerson(int id) , I want to pass id from @Url.Action. Below is the reference code: public ActionResult CreatePerson(int id) //controller window.location.href = "@Url.Action(..

Host binding and Host listening

How to use the host listener and host binding in angular 2? I tried like the below for host listener, but it's always showing a Declaration expected error. app.component.ts: import {Component, EventE..

Why doesn't the height of a container element increase if it contains floated elements?

I would like to ask how height and float work. I have an outer div and an inner div that has content in it. Its height may vary depending on the content of the inner div but it seems that my inner div..

How can I switch language in google play?

I'm doing some statistical analysis about Google Play, comparing different languages. Every time I visit the site (, it always opens in my language. I want to change the l..

How to select date without time in SQL

When I select date in SQL it is returned as 2011-02-25 21:17:33.933. But I need only the Date part, that is 2011-02-25. How can I do this?..

cast class into another class or convert class to another

my question is shown in this code I have class like that public class maincs { public int a; public int b; public int c; public int d; } public class sub1 { public int a; public in..

Spring Data JPA and Exists query

I'm using Spring Data JPA (with Hibernate as my JPA provider) and want to define an exists method with a HQL query attached: public interface MyEntityRepository extends CrudRepository<MyEntity, St..

Binary Data in JSON String. Something better than Base64

The JSON format natively doesn't support binary data. The binary data has to be escaped so that it can be placed into a string element (i.e. zero or more Unicode chars in double quotes using backslash..

MySQl Error #1064

I keep getting this error: MySQL said: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INSERT..

Matplotlib tight_layout() doesn't take into account figure suptitle

If I add a subtitle to my matplotlib figure it gets overlaid by the subplot's titles. Does anybody know how to easily take care of that? I tried the tight_layout() function, but it only makes things w..

Datetime in where clause

How can I select 12/20/2008 in where clause of sql? The server is SQL server 2005. select * from tblErrorLog where errorDate = '12/20/2008' ..

Find and replace with a newline in Visual Studio Code

I am trying out the new Microsoft Visual Studio Code editor in Linux Fedora environment. I would like to know how to replace new line (\n) in place of some other text. For example, I have html text ..

Unable to launch the IIS Express Web server

I have an MVC 4 solution. When I try to open it using Visual studio 2012, I get following error: Microsoft Visual Studio Configuring Web https://localhost: for ASP.NET 4.5 failed. You..

deleting rows in numpy array

I have an array that might look like this: ANOVAInputMatrixValuesArray = [[ 0.96488889, 0.73641667, 0.67521429, 0.592875, 0.53172222], [ 0.78008333, 0.5938125, 0.481, 0.39883333, 0.]] Notice that ..

How can you customize the numbers in an ordered list?

How can I left-align the numbers in an ordered list? 1. an item // skip some items for brevity 9. another item 10. notice the 1 is under the 9, and the item contents also line up Change the char..

What is an unsigned char?

In C/C++, what an unsigned char is used for? How is it different from a regular char?..

How to change default text file encoding in Eclipse?

Whenever I add a new html file (or other text file) to the project its encoding is set to Cp1250. I am not sure why, I guess this is probably because my default language in Windows is Polish and I don..

How do you check in python whether a string contains only numbers?

How do you check whether a string contains only numbers? I've given it a go here. I'd like to see the simplest way to accomplish this. import string def main(): isbn = input("Enter your 10 digi..

How to recover Git objects damaged by hard disk failure?

I have had a hard disk failure which resulted in some files of a Git repository getting damaged. When running git fsck --full I get the following output: error: .git/objects/pack/pack-6863e0a0e4b4ded..

HTML input arrays

<input name="foo[]" ... > I've used these before, but I'm wondering what it is called and if there is a specification for it? I couldn't find it in the HTML 4.01 Spec and results in various G..

jQuery DataTables Getting selected row values

I am using jQuery datatable.I done it using Now I want to get selected row values ids Script: $(document).ready(function() { var table = $('#..

Static Block in Java

I was looking over some code the other day and I came across: static { ... } Coming from C++, I had no idea why that was there. Its not an error because the code compiled fine. What is this "st..

How do I allow HTTPS for Apache on localhost?

I was asked to set up HTTPS with a self-signed cert on Apache on localhost, but how do I actually do that? I have no idea at all...

Dynamically create checkbox with JQuery from text input

In my cms I have a checkbox group for categories. I would like to have a text input below that where the user can input the name of a new category and it will dynamically add a new checkbox with the p..

Is there a way to have printf() properly print out an array (of floats, say)?

I believe I have carefully read the entire printf() documentation but could not find any way to have it print out, say, the elements of a 10-element array of float(s). E.g., if I have float[] foo = ..

How to get the first and last date of the current year?

Using SQL Server 2000, how can I get the first and last date of the current year? Expected Output: 01/01/2012 and 31/12/2012..

Is string in array?

What would be the best way to look in a string[] to see if it contains a element. This was my first shot at it. But perhaps there is something that I am overlooking. The array size will be no larger t..

Easy way to get a test file into JUnit

Can somebody suggest an easy way to get a reference to a file as a String/InputStream/File/etc type object in a junit test class? Obviously I could paste the file (xml in this case) in as a giant Str..

Validation of radio button group using jQuery validation plugin

How to perform validation for a radio button group (one radio button should be selected) using jQuery validation plugin?..

Mergesort with Python

I couldn't find any working Python 3.3 mergesort algorithm codes, so I made one myself. Is there any way to speed it up? It sorts 20,000 numbers in about 0.3-0.5 seconds def msort(x): result = []..

Can't compile project when I'm using Lombok under IntelliJ IDEA

I'm trying to use Lombok in my project that I'm developing using IntelliJ IDEA 11. I've installed 3rd-party plugin for IDEA and it seems working fine because IDEA sees all autogenerated methods/fields..

How do I tell what type of value is in a Perl variable?

How do I tell what type of value is in a Perl variable? $x might be a scalar, a ref to an array or a ref to a hash (or maybe other things)...

How to change TextBox's Background color?

I got C# code that is like: if(smth == "Open") { TextBox.Background = ??? } How to change TextBox's background color?..

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

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

What is the best way to connect and use a sqlite database from C#

I've done this before in C++ by including sqlite.h but is there a similarly easy way in C#?..

Unable to get provider

I am testing the new Crash tool: After going through the steps, the app launches and it crashes saying: 05-18 17:28:18.870 28743 28743 E AndroidRuntime: java...

How can I send a file document to the printer and have it print?

Here's the basic premise: My user clicks some gizmos and a PDF file is spit out to his desktop. Is there some way for me to send this file to the printer queue and have it print to the locally connec..

File Upload to HTTP server in iphone programming

Can anyone provide me some links or examples to upload files to the HTTP server using iphone APIs...

How to set an environment variable in a running docker container

If I have a docker container that I started a while back, what is the best way to set an environment variable in that running container? I set an environment variable initially when I ran the run comm..


I tried to reinstall an apk $adb install -r new.apk And it shows the error: Failure [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES] One solution is to uninstall and install the new.apk, that wo..

How do I output coloured text to a Linux terminal?

How do I print coloured characters to a Linux terminal that supports it? How do I tell whether the terminal supports colour codes?..

How to read single Excel cell value

I have excel file with sheet1 that has a value I need to read on row 2 and column 10. Here is my code. Excel.Workbook excelWorkbook = excelApp.Workbooks.Open(workbookPath, 0, false, 5, "", "", false..

Change package name for Android in React Native

I used react-native init MyApp to initialise a new React Native app. This created among others an Android project with the package com.myapp. What's the best way to change this package name, for exam..

Java, How to implement a Shift Cipher (Caesar Cipher)

I want to implement a Caesar Cipher shift to increase each letter in a string by 3. I am receiving this error: possible loss of precision required char; found int Here is my code so far: impor..

moment.js, how to get day of week number

I have a moment date object, and want to get the selected day number (0-6) or (1-7). I tried this, but it doesn't work var aaa = moment(date).day(); help me with this please..

How to convert hex to rgb using Java?

How can I convert hex color to RGB code in Java? Mostly in Google, samples are on how to convert from RGB to hex...

MySQL Job failed to start

I'm on Kubuntu 12.04, and after installing mysql via an apt-get (mysql ver: 5.5.35), i'm trying to start mysql service, but I got this error: sudo service mysql start start: Job failed to sta..

org.hibernate.MappingException: Could not determine type for: java.util.Set

Although this question asked many times and I have already used all the suggestion but still I am getting this error. The is @Entity @Table(name = "USER") public class User implements User..

Eclipse error: "The import XXX cannot be resolved"

I'm trying to work with Hibernate in Eclipse. I'm creating a new simple project and I've downloaded a collegue project too, via CVS. Both don't work, while on my collegue's Eclipse do. The problem is ..

Android ImageView Animation

I've created a layout with an image view and a web view. The web view is set to have a default visibility of gone. When the activity fires up it displays the image view first and when the web view has..

Build Step Progress Bar (css and jquery)

You've seen iterations of this type of progress bar on sites like paypal. How does one go about setting this up using CSS and jquery? I have 4 pages and each page is a step... so 4 steps...

Get screenshot on Windows with Python?

I am creating a Beta Testers reporting module so they can send in thier comments on my software, but I would like to have the option to include a screenshot with the report. How do I take a screenshot..

Is there a code obfuscator for PHP?

Has anybody used a good obfuscator for PHP? I've tried some but they don't work for very big projects. They can't handle variables that are included in one file and used in another, for instance. Or ..

IF a cell contains a string

How can I assign a value to cells if it's neighbour contains a specific string? For example, fields in column A: dog11 cat22 cow11 chick11 duck22 cat11 horse22 cat33 ..

Is it correct to use DIV inside FORM?

I'm just wondering what are you thinking about DIV-tag inside FORM-tag? I need something like this: <form> <input type="text"/> <div> some </div> <div> another &l..

Use string value from a cell to access worksheet of same name

I have 2 worksheets: Summary and SERVER-ONE. In cell A5 on the Summary worksheet, I have added the value SERVER-ONE. Next to it, in cell B5, I would like a formula that uses the value in A5 to displ..

How to compare numbers in bash?

I'm unable to get numeric comparisons working: echo "enter two numbers"; read a b; echo "a=$a"; echo "b=$b"; if [ $a \> $b ]; then echo "a is greater than ..

Java8: HashMap<X, Y> to HashMap<X, Z> using Stream / Map-Reduce / Collector

I know how to "transform" a simple Java List from Y -> Z, i.e.: List<String> x; List<Integer> y = .map(s -> Integer.parseInt(s)) .collect(Collectors.toList()..

Convert from days to milliseconds

I want to create a function that will convert the days into milliseconds. The days format is stored as 0.2444, so how to convert this to milliseonds?..

Correct file permissions for WordPress

I've had a look over here but didn't find any details on the best file permissions. I also took a look at some of WordPress's form's questions over here too but anybody that suggests 777 obviously ne..

Are arrays passed by value or passed by reference in Java?

Arrays are not a primitive type in Java, but they are not objects either, so are they passed by value or by reference? Does it depend on what the array contains, for example references or a primitive ..

Git Push Error: insufficient permission for adding an object to repository database

When I try to push to a shared git remote, I get the following error: insufficient permission for adding an object to repository database Then I read about a fix here: Fix This worked for the next p..

Gradle finds wrong JAVA_HOME even though it's correctly set

When trying to run gradle, I get the following error: # gradle ERROR: JAVA_HOME is set to an invalid directory: /usr/lib/jvm/default-java Please set the JAVA_HOME variable in your environment to ma..

Adding HTML entities using CSS content

How do you use the CSS content property to add HTML entities? Using something like this just prints &nbsp; to the screen instead of the non-breaking space: .breadcrumbs a:before { content: '..

What is causing the error `string.split is not a function`?

Why am I getting... Uncaught TypeError: string.split is not a function ...when I run... _x000D_ _x000D_ var string = document.location;_x000D_ var split = string.split('/');_x000D_ _x000D_ _x00..

Converting a JToken (or string) to a given Type

TL;DR Version I have a object of type JToken (but can also be a string) and I need to convert it into a Type contained in the type variable: Type type = typeof(DateTime); /* can be any other Type li..

How to start activity in another application?

I have application A defined as below: <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name="com.example.MyExampleActivity" a..

Laravel Eloquent - distinct() and count() not working properly together

So I'm trying to get the number of distinct pids on a query, but the returned value is wrong. This is what I try to do: $ad->getcodes()->groupby('pid')->distinct()->count() what return..

In Java, how to append a string more efficiently?

I wrote a Java program, in which, I need to append a string " u13a2" to an existing one "u1234 u12de u1386 ... u15a3". So gradually the string becomes longer and longer. I found the time spent on e..

MongoDB running but can't connect using shell

CentOS 5.x Linux with MongoDB 2.0.1 (tried main and legacy-static) MongoDB is running: root 31664 1.5 1.4 81848 11148 ? Sl 18:40 0:00 ./mongod -f mongo.conf -vvvvv --fork Using a..

iPhone - Grand Central Dispatch main thread

I have been using with success, grand central dispatch in my apps, but I was wondering what is the real advantage of using something like this: dispatch_async(dispatch_get_main_queue(), ^{ ... do stu..

Pandas - Get first row value of a given column

This seems like a ridiculously easy question... but I'm not seeing the easy answer I was expecting. So, how do I get the value at an nth row of a given column in Pandas? (I am particularly interested..

cvc-elt.1: Cannot find the declaration of element 'MyElement'

I'm trying to validate a really simple xml using xsd, but for some reason I get this error. I'll really appreciate if someone can explain me why. XML File <?xml version="1.0" encoding="utf-8"?>..

Permission denied when launch python script via bash

# ./scripts/ bash: ./scripts/ Permission denied has chmod 600 # ls -l ./scripts/ -rw------- 1 ubuntu ubuntu 661 2011-04-27 ..

Axios having CORS issue

I added proxy in package.json and it worked great, but after npm run build the CORS issue has resurfaced again, does anyone know how to deal with CORS issue after npm run build in React. I have tried..

ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

I have installed Oracle 11g Express Edition Release 2 in my windows 7 64 bit OS and tried to execute JDBC program, then I got the following error: java.sql.SQLException: Listener refused the connecti..

A connection was successfully established with the server, but then an error occurred during the pre-login handshake

I am getting following error when i am trying to connect Production DB from Local Environment. I was able to connect Production DB before, but suddenly i am getting following error, any idea? A conne..

How do I convert a Swift Array to a String?

I know how to programmatically do it, but I'm sure there's a built-in way... Every language I've used has some sort of default textual representation for a collection of objects that it will spit ou..

Spring Boot REST API - request timeout?

I have a Spring Boot REST service that sometimes call third party services as a part of a request. I would like to set a timeout on all my resources (let's say 5 seconds), so that if any request handl..

Is a slash ("/") equivalent to an encoded slash ("%2F") in the path portion of an HTTP URL

I have a site that treats "/" and "%2F" in the path portion (not the query string) of a URL differently. Is this a bad thing to do according to either the RFC or the real world? I..

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

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

Always show vertical scrollbar in <select>

The following code produces a listbox with 2 options: <select size="10"> <option>1</option> <option>2</option> </select> Is it possible to always show a vertic..

Powershell remoting with ip-address as target

I successfully enabled PSRemoting on my Server 2008 R2. I'm able to do a remote-pssession from within the same network using the hostname as target. I'm failing when I try to use the IP-Address as ta..

How can I select the first day of a month in SQL?

I just need to select the first day of the month of a given datetime variable. I know it's quite easy to do using this kind of code: select CAST(CAST(YEAR(@mydate) AS VARCHAR(4)) + '/' + CAST(MONTH..

"cannot be used as a function error"

I am writing a simple program that uses functions found in different .cpp files. All of my prototypes are contained in a header file. I pass some of the functions into other functions and am not sure ..

Java 8 Lambda filter by Lists

I have two list and i want filter thoose elements which are both list contains. And i want to do this with lambda expression. Users getName and Clients getUserName both are return with String. Here ..

Failed to add the host to the list of know hosts

Mac OSX Lion 10.7. In an effort to get around weird environment stuff (homebrew wasn't installing wget, and I had all sorts of weird blocks and errors), I uninstalled zschrc and homebrew and a bunch ..

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

git submodule tracking latest

We are moving our (huge) project to git and we are thinking about using submodules. Our plan is to have three different heads in the superproject: release,stable,latest. The project leads will handle ..

How do I login and authenticate to Postgresql after a fresh install?

Did a new install of postgres 8.4 on mint ubuntu. How do I create a user for postgres and login using psql? When I type psql, it just tells me psql: FATAL: Ident authentication failed for user "m..

Can Windows' built-in ZIP compression be scripted?

Is the ZIP compression that is built into Windows XP/Vista/2003/2008 able to be scripted at all? What executable would I have to call from a BAT/CMD file? or is it possible to do it with VBScript? I ..

MySQL stored procedure vs function, which would I use when?

I'm looking at MySQL stored procedures and function. What is the real difference? They seem to be similar, but a function has more limitations. I'm likely wrong, but it seems a stored procedure can..

How to remove all of the data in a table using Django

I have two questions: How do I delete a table in Django? How do I remove all the data in the table? This is my code, which is not successful: Reporter.objects.delete() ..

How do I publish a UDP Port on Docker?

How do I forward a UDP port from my Docker container to the host machine?..

Any tools to generate an XSD schema from an XML instance document?

I am looking for a tool which will take an XML instance document and output a corresponding XSD schema. I certainly recognize that the generated XSD schema will be limited when compared to creating a..

How to check user is "logged in"?

I am using form authentication with below method in my ASP.NET application FormsAuthentication.RedirectFromLoginPage(txtUsername.Text, true); How do I check whether user is logged in or not? And ho..

How to save username and password with Mercurial?

I used Mercurial in a personal project, and I have been typing my username and password every time I want to push something to the server. I tried adding the following to the .hgrc file in my home di..

How to return a value from __init__ in Python?

I have a class with an __init__ function. How can I return an integer value from this function when an object is created? I wrote a program, where __init__ does command line parsing and I need to h..

Chrome Uncaught Syntax Error: Unexpected Token ILLEGAL

Receiving the subject error when Chrome tries to load the script file on the page. It says it's at the last line of the javascript file. I can't seem to find anything wrong with it. No errors in firef..

How can I trim beginning and ending double quotes from a string?

I would like to trim a beginning and ending double quote (") from a string. How can I achieve that in Java? Thanks!..

Can't bind to 'formGroup' since it isn't a known property of 'form'

THE SITUATION: Please help! I am trying to make what should be a very simple form in my Angular2 app but no matter what it never works. ANGULAR VERSION: Angular 2.0.0 Rc5 THE ERROR: Can't bind to..

iPhone: Setting Navigation Bar Title

Hey all. I'm still pretty new to iPhone development, and I'm having a bit of trouble figuring out how to change the title of my Navigation Bar. On another question on this site somebody recommended ..

Cannot find either column "dbo" or the user-defined function or aggregate "dbo.Splitfn", or the name is ambiguous

Hai guys, I ve used the following split function, CREATE FUNCTION dbo.Splitfn(@String varchar(8000), @Delimiter char(1)) returns @temptable TABLE (items varchar(8000)) as begin..

javascript create empty array of a given size

in javascript how would I create an empty array of a given size Psuedo code: X = 3; createarray(myarray, X, ""); output: myarray = ["","",""] ..

how to convert date to a format `mm/dd/yyyy`

I'm having a sql table with date column named CREATED_TS which holds the dates in different format eg. as shown below Feb 20 2012 12:00AM 11/29/12 8:20:53 PM Feb 20 2012 12:00AM 11/29/12 ..