Questions Tagged with #Edit distance

A string metric describing the differences between two strings. More specifically, it is the number of operations that transform one string into another string. Operations include the insertion, deletion, substitution, or transposition of a character in the string. Operations can be considered in combinations and may have different costs.

calculating execution time in c++

I have written a c++ program , I want to know how to calculate the time taken for execution so I won't exceed the time limit. #include<iostream> using namespace std; int main () { int st[..

How to have the formatter wrap code with IntelliJ?

I'm not able to format my code in IntelliJ. I can see the margin line (by default at 120 columns) but it seems that the activation from the menu: Code -> Reformat Code is just ignoring this ma..

Deserialize JSON to ArrayList<POJO> using Jackson

I have a Java class MyPojo that I am interested in deserializing from JSON. I have configured a special MixIn class, MyPojoDeMixIn, to assist me with the deserialization. MyPojo has only int and Strin..

How to compare pointers?

Suppose I have 2 pointers: int *a = something; int *b = something; If I want to compare them and see if they point at the same place does (a == b) work?..

Change bundle identifier in Xcode when submitting my first app in IOS

I'm trying to submit my first app in iOS. I have entered iOS Provisioning Portal and I am about to create an app ID. Lets say that I name my bundle identifier: com.mycompany.appdemo Then going to..

Get current value when change select option - Angular2

I'm writing an angular2 component and am facing this problem. Description: I want to push an option value in select selector to its handler when the (change) event is triggered. Such as the below temp..

How to do a background for a label will be without color?

I want to add a label to my form , and I want it without any color- I want just it's text to be visible, I don't find this option in the label's properties, can anyone help me please?..

How to printf a 64-bit integer as hex?

With the following code I am trying to output the value of a unit64_t variable using printf(). Compiling the code with gcc, returns the following warning: warning: format ‘%x’ expects argument..

How to install mysql-connector via pip

I use sqlalchemy to access MySQL in my Python project. sqlalchemy's conf is like this: dialect=mysql driver=mysqlconnector So I need to install the Python module mysql connector via pip. Any help?..

Close Form Button Event

in my application, the user is first presented with the log in screen, and the form that shows up after you log in has a Menu Bar. On that menu bar are 2 items: "log out" and "exit". If the user selec..

angularjs: allows only numbers to be typed into a text box

In angularjs is there any functionality available that allows only numbers to be typed into a text box like..

Open mvc view in new window from controller

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

How to include SCSS file in HTML

I dont know how to include SCSS file in my website but I have completely developed .scss file using notepad. Please let me know how to include it in my website?..

$(form).ajaxSubmit is not a function

I'm trying to use the jquery validate plugin to validate a form and submit the contents with an ajax request. This code is in the head of my document. $(document).ready(function() { $('#contact..

How to force maven update?

I imported my already working project on another computer and it started to download dependencies. Apparently my internet connection crashed and now I get the following: >Build errors for c..

MySQL Foreign Key Error 1005 errno 150 primary key as foreign key

I'm making a small DataBase with MySQL Workbench. I have a main table, called "Immobili", which has a Primary Key composed by four columns: (Comune, Via, Civico, Immobile). I also have three..

dyld: Library not loaded: @rpath/libswiftCore.dylib

I am trying to run a Swift app on my iPhone 4s. It works fine on the simulator, and my friend can successfully run it on his iPhone 4s. I have iOS 8 and the official release of Xcode 6. I have tried ..

How to set up Android emulator proxy settings

I want to to use the browser inside the Android emulator, and I want to use the proxy settings on my machine. How can I set this up? Reading the very good Android manuals, they tell me that I should ..

Where can I find the .apk file on my device, when I download any app and install?

Where can I find the .apk file of an application on my device, which I downloaded and installed from Google Play Store. Just in case I want to send it to one of my friends through Bluetooth etc..,??..

SQL Connection Error: System.Data.SqlClient.SqlException (0x80131904)

I am seeing this in several situations and it is intermittent in our web based application connecting to SQL 2008 R2 serve back end. Users are coming across a point 2 point connection and seeing this..

How to make a variadic macro (variable number of arguments)

I want to write a macro in C that accepts any number of parameters, not a specific number example: #define macro( X ) something_complicated( whatever( X ) ) where X is any number of parameters I..

Is there a better way to iterate over two lists, getting one element from each list for each iteration?

I have a list of Latitudes and one of Longitudes and need to iterate over the latitude and longitude pairs. Is it better to: A. Assume that the lists are of equal lengths: for i in range(len(Latit..

Center image in div horizontally

I have an img in a div (class="top_image") and I want this image to be exactly in the middle of the div but nothing I try works... Thanks for any help!..

How to add text at the end of each line in Vim?

In Vim, I have the following text: key => value1 key => value2 key => value1111 key => value12 key => value1122222 I would like to add "," at the end of each line. The previous text ..

Warning: date_format() expects parameter 1 to be DateTime

I am using the following script to pull the calendar info out of the mysql database and display it on the page. I am trying to re format the date from the standard Mysql date format , but when retriev..

Difference between signed / unsigned char

So I know that the difference between a signed int and unsigned int is that a bit is used to signify if the number if positive or negative, but how does this apply to a char? How can a character be po..

How to change the Title of the window in Qt?

How to change the title of the window in Qt? (Both for QDialog and QMainWindow.)..

How to convert object array to string array in Java

I use the following code to convert an Object array to a String array : Object Object_Array[]=new Object[100]; // ... get values in the Object_Array String String_Array[]=new String[Object_Array.len..

Convert string to date in Swift

How can I convert this string "2016-04-14T10:44:00+0000" into an NSDate and keep only the year, month, day, hour? The T in the middle of it really throws off what I am used to when working with dates..

Delete rows with foreign key in PostgreSQL

I would like to delete rows which contain a foreign key, but when I try something like this: DELETE FROM osoby WHERE id_osoby='1' I get this statement: ERROR: update or delete on table "osoby"..

What's NSLocalizedString equivalent in Swift?

Is there an Swift equivalent of NSLocalizedString(...)? In Objective-C, we usually use: NSString *string = NSLocalizedString(@"key", @"comment"); How can I achieve the same in Swift? I found a func..

How to window.scrollTo() with a smooth effect

I can scroll to 200px using the following btn.addEventListener("click", function(){ window.scrollTo(0,200); }) But I want a smooth scroll effect. How do I do this?..

This version of Android Studio cannot open this project, please retry with Android Studio 3.4 or newer

This version of Android Studio cannot open this project, please retry with Android Studio 3.4 or newer. but my android studio version is 3.2.1 and there is no new update from Google..

How to use adb command to push a file on device without sd card

How to push a file from computer to an Android device having no SD Card in it. I tried: C:\anand>adb push anand.jpg /data/local 3399 KB/s (111387 bytes in 0.032s) C:\anand>adb push anand.jpg /d..

Changing default encoding of Python?

I have many "can't encode" and "can't decode" problems with Python when I run my applications from the console. But in the Eclipse PyDev IDE, the default character encoding is set to UTF-8, and I'm fi..

Get Unix timestamp with C++

How do I get a uint unix timestamp in C++? I've googled a bit and it seems that most methods are looking for more convoluted ways to represent time. Can't I just get it as a uint?..

Better naming in Tuple classes than "Item1", "Item2"

Is there a way to use a Tuple class, but supply the names of the items in it? For example: public Tuple<int, int, int int> GetOrderRelatedIds() That returns the ids for OrderGroupId, OrderTy..

Using HTTPS with REST in Java

I have a REST server made in Grizzly that uses HTTPS and works wonderfully with Firefox. Here's the code: //Build a new Servlet Adapter. ServletAdapter adapter=new ServletAdapter(); adapter.addInitP..

no match for ‘operator<<’ in ‘std::operator

I am a C++ newbie.I tried out my first program here.To my eyes this program is correct. #include <iostream> using namespace std; class mystruct { private: int m_a; float m..

javac not working in windows command prompt

I'm trying to use javac with the windows command prompt, but it's not working. After adding the directory "C:\Program Files\Java\jdk1.6.0_16\bin\" to the end of the PATH environment variable, the jav..

Compile to a stand-alone executable (.exe) in Visual Studio

how can I make a stand-alone exe in Visual Studio. Its just a simple Console application that I think users would not like to install a tiny Console application. I compiled a simple cpp file using the..

Where is the Java SDK folder in my computer? Ubuntu 12.04

I know it's installed because when I type: $java -version I get: OpenJDK Runtime Environment (IcedTea6 1.12.5) (6b27-1.12.5-0ubuntu0.12.04.1) OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode) ..

Java converting Image to BufferedImage

There is already question like this link on StackOverflow and the accepted answer is "casting": Image image = ImageIO.read(new File(file)); BufferedImage buffered = (BufferedImage) image; In my pro..

Want to download a Git repository, what do I need (windows machine)?

I want to download this open source application, and they are using Git. What do I need to download the code base? Update How do I change the working directory when I am using Git Bash? (I want to ..

Python: "Indentation Error: unindent does not match any outer indentation level"

I just can't figure out what's wrong with this... #!/usr/bin/env python # # Bugs.py # from __future__ import division # No Module! if __name__ != '__main__': print "Bugs.py is not..

Looping over arrays, printing both index and value

I want to do something like this: foo=( ) foo[0]="bar" foo[35]="baz" for((i=0;i<${#foo[@]};i++)) do echo "$i: ${foo[$i]}" done # Output: # 0: bar # 1: Then i tried to loop through it using ..

Difference between Activity Context and Application Context

This has me stumped, I was using this in Android 2.1-r8 SDK: ProgressDialog.show(getApplicationContext(), ....); and also in Toast t = Toast.makeText(getApplicationContext(),....); using getApp..

Update Fragment from ViewPager

I have an Activity with a ViewPager. I also have a Dialog that will retrieve a list with some items that the user will choose. Now, how can I update the Fragment where the Items are supposed to displa..

How to delete a module in Android Studio

Is there a way to delete a module within Android Studio? When I right click on a module I can't find an option for deletion, is it elsewhere?..

Get restaurants near my location

I've tried to find a suitable Google Places API that takes in My Location and returns the nearby restaurants. Currently, I've been able to find only restaurants in a "particular" city. https://maps...

Java 32-bit vs 64-bit compatibility

Will Java code built and compiled against a 32-bit JDK into 32-bit byte code work in a 64-bit JVM? Or does a 64-bit JVM require 64-bit byte code? To give a little more detail, I have code that was w..

Changing three.js background to transparent or other color

I've been trying to change what seems to be the default background color of my canvas from black to transparent / any other color - but no luck. My HTML: <canvas id="canvasColor"> My CSS: &..

Convert a JSON string to object in Java ME?

Is there a way in Java/J2ME to convert a string, such as: {name:"MyNode", width:200, height:100} to an internal Object representation of the same, in one line of code? Because the current method ..

Data-frame Object has no Attribute

I know that this kind of question was asked before and I've checked all the answers and I have tried several times to find a solution but in vain. In fact I call a Dataframe using Pandas. I've upload..

Right pad a string with variable number of spaces

I have a customer table that I want to use to populate a parameter box in SSRS 2008. The cust_num is the value and the concatenation of the cust_name and cust_addr will be the label. The required fiel..

How do you stash an untracked file?

I have changes to a file, plus a new file, and would like to use git stash to put them away while I switch to another task. But git stash by itself stashes only the changes to the existing file; the ..

Why doesn't Dijkstra's algorithm work for negative weight edges?

Can somebody tell me why Dijkstra's algorithm for single source shortest path assumes that the edges must be non-negative. I am talking about only edges not the negative weight cycles...

How to fix "Root element is missing." when doing a Visual Studio (VS) Build?

How to fix "Root element is missing." when doing a Visual Studio (VS) Build? Any idea what file I should look at in my solution? Actually, I am getting this error message inside of "Visual Build Pro..

remove white space from the end of line in linux

i have file in which i want to remove white space from the end of line test.txt is as following (there is white space at the end of line. ath-miRf10005-akr ath-miRf10018-akr ath-miRf10019-akr ath-m..

How to write a JSON file in C#?

I need to write the following data into a text file using JSON format in C#. The brackets are important for it to be valid JSON format. [ { "Id": 1, "SSN": 123, "Message": "whatever" ..

How to make an inline element appear on new line, or block element not occupy the whole line?

I can't figure out how to do this with CSS. If I just use a <br> tag, it works flawlessly, but I'm trying to avoid doing that for obvious reasons. Basically, I just want the .feature_desc span ..

Xampp MySQL not starting - "Attempting to start MySQL service..."

I've just installed XAMPP for Windows - should be the newest version (XAMPP Control Panel v3.2.1). Apache is running just fine on port 80 and 443, but MySQL is not starting. When I press the start b..

div with dynamic min-height based on browser window height

I have three div elements: one as a header, one as a footer, and a center content div. the div in the center needs to expand automatically with content, but I would like a min-height such that the bo..

Difference between iCalendar (.ics) and the vCalendar (.vcs)

I want to send booking information through mail in an attachment to add in MS Outlook. Which format is better? Especially for MS Outlook 2003?..

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

Select multiple images from android gallery

So basically what i am trying to achieve is opening the Gallery in Android and let the user select multiple images. Now this question has been asked frequently but i'm not satisfied with the answers. ..

What are best practices that you use when writing Objective-C and Cocoa?

I know about the HIG (which is quite handy!), but what programming practices do you use when writing Objective-C, and more specifically when using Cocoa (or CocoaTouch)...

How to connect android emulator to the internet

How can I connect my Android emulator to the internet, e.g. to use the browser? I've found lots of advice on what do to when your connected through a proxy, but that's not the case here, my machine (W..

When to use margin vs padding in CSS

When writing CSS, is there a particular rule or guideline that should be used in deciding when to use margin and when to use padding?..

Is there any way to install Composer globally on Windows?

I've read the global installation documentation for Composer, but it's for *nix systems only: curl -s https://getcomposer.org/installer | php sudo mv composer.phar /usr/local/bin/composer I would..

How do I expand the output display to see more columns of a pandas DataFrame?

Is there a way to widen the display of output in either interactive or script-execution mode? Specifically, I am using the describe() function on a pandas DataFrame. When the DataFrame is 5 columns ..

Angular Directive refresh on parameter change

I have an angular directive which is initialized like so: <conversation style="height:300px" type="convo" type-id="{{some_prop}}"></conversation> I'd like it to be smart enough to refre..

How can I detect if Flash is installed and if not, display a hidden div that informs the user?

How can I use javascript/jQuery/etc to detect if Flash is installed and if it isn't, display a div that contains information informing the user that they need to install flash?..

Hibernate: best practice to pull all lazy collections

What I have: @Entity public class MyEntity { @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, orphanRemoval = true) @JoinColumn(name = "myentiy_id") private List<Address> add..

The type arguments for method cannot be inferred from the usage

Maybe I'm overworked, but this isn't compiling (CS0411). Why? interface ISignatur<T> { Type Type { get; } } interface IAccess<S, T> where S : ISignatur<T> { S Signature { g..

Creating and Update Laravel Eloquent

What's the shorthand for inserting a new record or updating if it exists? <?php $shopOwner = ShopMeta::where('shopId', '=', $theID) ->where('metadataKey', '=', 2001)->first(); if ($sho..

Python SQLite: database is locked

I'm trying this code: import sqlite connection = sqlite.connect('cache.db') cur = connection.cursor() cur.execute('''create table item (id integer primary key, itemno text unique, scancode..

Elastic Search: how to see the indexed data

I had a problem with ElasticSearch and Rails, where some data was not indexed properly because of attr_protected. Where does Elastic Search store the indexed data? It would be useful to check if the ..

How to convert String to DOM Document object in java?

I have a case like getting an XML and convert the XML elements to document object and getting the element values and attributes which i have been created already Here is the piece of code i have trie..

<button> vs. <input type="button" />. Which to use?

When looking at most sites (including SO), most of them use: <input type="button" /> instead of: <button></button> What are the main differences between the two, if any? Are t..

jQuery multiple conditions within if statement

What is the syntax for this loop to skip over certain keys? The way I have it written is not working properly. $.each(element, function(i, element_detail){ if (!(i == 'InvKey' && i == '..

How to generate unique id in MySQL?

I'm programming a script using PHP and MySQL and I want to get a unique id (consisting of a string: capitals and small letters with numbers) like: gHYtUUi5b. I found many functions in PHP that can g..

JS regex: replace all digits in string

I need to replace all digits. My function only replaces the first digit. var s = "04.07.2012"; alert(s.replace(new RegExp("[0-9]"), "X")); // returns "X4.07.2012" ..

Extract values in Pandas value_counts()

Say we have used pandas dataframe[column].value_counts() which outputs: apple 5 sausage 2 banana 2 cheese 1 How do you extract the values in the order same as shown above from max to min ?..

npm ERR! network getaddrinfo ENOTFOUND

I am getting npm ERR! network getaddrinfo ENOTFOUND error while trying to install any package using NPM. I know there are numerous threads on the same issue but I could not find any thread which can h..

Find and replace - Add carriage return OR Newline

In the case of following string to be parsed. ford mustang,10,blue~~?bugatti veyron,13,black I want to replace the ~~? with a carriage return Replacing with \n just adds the string "\n" How can t..

Verify a method call using Moq

I am fairly new to unit testing in C# and learning to use Moq. Below is the class that I am trying to test. class MyClass { SomeClass someClass; public MyClass(SomeClass someClass) { ..

Run Function After Delay

I have the below global jQuery function stored, but on page load, I want to execute it after a 1000 delay. Is there something wrong with my syntax? I know the delay always goes before the function. It..

How to convert BigInteger to String in java

I converted a String to BigInteger as follows: Scanner sc=new Scanner(System.in); System.out.println("enter the message"); String msg=sc.next(); byte[] bytemsg=msg.getBytes(); BigInteger m=new BigInt..

Inline SVG in CSS

Is it possible to use an inline SVG definition in CSS? I mean something like: .my-class { background-image: <svg>...</svg>; } ..

commands not found on zsh

I am using the z Shell (zsh) instead of the default bash, and something wrong happen so that all commands who used to work are no longer recognized: ls zsh: command not found: ls open -e .zshrc zsh:..

Casting to string in JavaScript

I found three ways to cast a variable to String in JavaScript. I searched for those three options in the jQuery source code, and they are all in use. I would like to know if there are any differences ..

The model backing the <Database> context has changed since the database was created

The error message : "The model backing the 'AddressBook' context has changed since the database was created. Either manually delete/update the database, or call Database.SetInitializer with an ID..

Is there any way of configuring Eclipse IDE proxy settings via an autoproxy configuration script?

I am behind a firewall which uses autoproxy configuration script. I am able to browse the internet when I enable the autoproxy url in most browsers I use (IE 7, IE 8, FF, Chrome). For your reference t..

How to set maximum fullscreen in vmware?

I'm using VMware workstation 8 on windows 7 and having some Linux hosts such as Centos, Backtrack and ... on it. The problem is the screen of the virtual machines is not fixed with my screen. here is ..

Why should we NOT use sys.setdefaultencoding("utf-8") in a py script?

I have seen few py scripts which use this at the top of the script. In what cases one should use it? import sys reload(sys) sys.setdefaultencoding("utf-8") ..

How can I create an error 404 in PHP?

My .htaccess redirects all requests to /word_here to /page.php?name=word_here. The PHP script then checks if the requested page is in its array of pages. If not, how can I simulate an error 404? I tr..

Make one div visible and another invisible

I have two div tags, one is for the search and the other is for the results. What I need is for when the submit button is clicked the results are returned and placed into the results div (with an ifra..

How to import an existing project from GitHub into Android Studio

I've just imported EdgeEffectOverride project from Github into Android Studio. This is the screen shot When I run the project, I get the error: Error running build: Module 'EdgeEffectOverride-maste..

How to set HttpResponse timeout for Android in Java

I have created the following function for checking the connection status: private void checkConnectionStatus() { HttpClient httpClient = new DefaultHttpClient(); try { String url = "ht..

How to convert from []byte to int in Go Programming

I need to create a client-server example over TCP. In the client side I read 2 numbers and I send them to the server. The problem I faced is that I can't convert from []byte to int, because the commun..

How do I make a WPF TextBlock show my text on multiple lines?

i have a wpf window where i have a stackpanel with two viewports in it - each Viewport with a textblock in it. <Grid> <StackPanel VerticalAlignment="Center" Orientation="Vertical" > ..

A beginner's guide to SQL database design

Do you know a good source to learn how to design SQL solutions? Beyond the basic language syntax, I'm looking for something to help me understand: What tables to build and how to link them How to d..

How might I find the largest number contained in a JavaScript array?

I have a simple JavaScript Array object containing a few numbers. [267, 306, 108] Is there a function that would find the largest number in this array?..

How can I escape a single quote?

How can I escape a ' (single quote) in HTML? This is where I'm trying to use it: <input type='text' id='abc' value='hel'lo'> The result for the above code is "hel" populated in the te..

Excel Calculate the date difference from today from a cell of "7/6/2012 10:26:42"

So I have a cell with 7/6/2012 10:26:42 inputted, I want to show the date difference from today in another cell. I tried to extract 7/6/2012 with =LEFT(A1, Find(" ", A1, 1) -1) but turned out theres..

jQuery: Test if checkbox is NOT checked

I'm having trouble figuring this out. I have two checkboxes (in the future will have more): checkSurfaceEnvironment-1 checkSurfaceEnvironment-2 Basically, I want to write an if statement and test ..

Hamcrest compare collections

I'm trying to compare 2 lists: assertThat(actual.getList(), is(Matchers.containsInAnyOrder(expectedList))); But idea java: no suitable method found for assertThat(java.util.List<Agent>,org...

Easiest way to activate PHP and MySQL on Mac OS 10.6 (Snow Leopard), 10.7 (Lion), 10.8 (Mountain Lion)?

What is the easiest way to activate PHP and MySQL on Mac OS 10.6 (Snow Leopard), 10.7 (Lion), 10.8 (Mountain Lion)? I'd prefer to use any bundled versions before resorting to downloading from the PHP..

php.ini: which one?

I moved from my old apache to nginx and php 5.3.10. And when I tried to modify php.ini to suit my needs, I found there are 3 of them: $ locate php.ini /etc/php5/cgi/php.ini /etc/php5/cli/php.ini /et..

In Bootstrap open Enlarge image in modal

How do I open / enlarge an image in a modal using jquery / js and not data attributes? Anytime a user inserts an image into a content editor I need it to be clickable to expand in a modal with js, s..

Binding List<T> to DataGridView in WinForm

I have a class class Person{ public string Name {get; set;} public string Surname {get; set;} } and a List<Person> to which I add some items. The list is bound to my DataGridView...

LINQ to Entities how to update a record

Okay, so I'm new to both EF and LINQ. I have figured out how to INSERT and DELETE but for some reason UPDATE seems to escape my grasp. Here is a sample of my code: EntityDB dataBase = new EntityDB()..

Kotlin Ternary Conditional Operator

What is the equivalent of this expression in Kotlin? a ? b : c This is not valid code in Kotlin...

DateDiff to output hours and minutes

my code gives TOTAL HOURS in hours, but i am trying to output something like TotalHours 8:36 where 8 represents hour part and 36 represents minutes part mean totalHours a person has worked in a..

Youtube - How to force 480p video quality in embed link / <iframe>

How to force 480p video quality for iframed Youtube videos? Sample code: <iframe width="560" height="315" src="http://www.youtube.com/embed/FqRgAs0SOpU" frameborder="0" allowfullscreen></if..

Javascript: output current datetime in YYYY/mm/dd hh:m:sec format

I need to output the current UTC datetime as a string with the following format: YYYY/mm/dd hh:m:sec How do I achieve that with Javascript?..

What is the difference between Cygwin and MinGW?

I want to make my C++ project cross platform, and I'm considering using Cygwin/MinGW. But what is the difference between them ? Another question is whether I will be able to run the binary on a syste..

Is it possible to view RabbitMQ message contents directly from the command line?

Is it possible to view RabbitMQ message contents directly from the command line? sudo rabbitmqctl list_queues lists the queues. Is there any command like sudo rabbitmqctl list_queue_messages <queue..

How do I space out the child elements of a StackPanel?

Given a StackPanel: <StackPanel> <TextBox Height="30">Apple</TextBox> <TextBox Height="80">Banana</TextBox> <TextBox Height="120">Cherry</TextBox> <..

Difference between List, List<?>, List<T>, List<E>, and List<Object>

What are the differences between List, List<?>, List<T>, List<E>, and List<Object>? 1. List List: is a raw type, therefore not typesafe. It will only generate a runtime error..

How to convert List<string> to List<int>?

My question is part of this problem: I recieve a collection of id's from a form. I need to get the keys, convert them to integers and select the matching records from the DB. [HttpPost] public A..

Eclipse IDE: How to zoom in on text?

I want the same behaviour Firefox has, when you use the scroll button in the mouse to zoom in and out on the current view. Is there something like it for eclipse?..

Linking a UNC / Network drive on an html page

Just a basic html link question. I have an intranet setup, and I need to link to some network drives. They are located on drives such as \server_drive\blahblah\doc.docx Using file:// does not work..

Cassandra cqlsh - connection refused

I've just started working with Cassandra (datastax), version 2.1.3 and cqlsh version 5.0.1. Cassandra starts up fine and the cluster is operational instantly. Cqlsh is not working (on any of the nod..

back button callback in navigationController in iOS

I have pushed a view onto the navigation controller and when I press the back button it goes to the previous view automatically. I want to do a few things when back button is pressed before popping th..

How can I draw circle through XML Drawable - Android?

I'm trying to draw circle with the help of XML file in android, but circle is not displaying properly. Below code is showing Oval. How can I create circle in XML file. <shape xmlns:android="http:/..

Better way to Format Currency Input editText?

I have an editText, starting value is $0.00. When you press 1, it changes to $0.01. Press 4, it goes to $0.14. Press 8, $1.48. Press backspace, $0.14, etc. That works, the problem is, if somebody man..

How can I get a list of all classes within current module in Python?

I've seen plenty of examples of people extracting all of the classes from a module, usually something like: # foo.py class Foo: pass # test.py import inspect import foo for name, obj in inspect..

How to create a numeric vector of zero length in R

I wonder, how can I create a numeric zero-length vector in R?..

Moment js date time comparison

I'm using moment.js to format my date time, here I have two date values, and I want to achieve a particular function when one date is greater than the other. I read most of their docs, but didn't find..

How can I split a shell command over multiple lines when using an IF statement?

How can I split a command over multiple lines in the shell, when the command is part of an if statement? This works: if ! fab --fabfile=.deploy/fabfile.py --forward-agent --disable-known-hosts depl..

Where does pip install its packages?

I activated a virtualenv which has pip installed. I did pip3 install Django==1.8 and Django successfully downloaded. Now, I want to open up the Django folder. Where is the folder located? Normally it..

How can I get relative path of the folders in my android project?

How can I get the relative path of the folders in my project using code? I've created a new folder in my project and I want its relative path so no matter where the app is, the path will be correct. ..

how to delete default values in text field using selenium?

I want to delete a default value of a textbox to enter the new value, but I am not getting how to do that. I was thinking to use CTRL+a and then Delete but I'm not sure how to do this. I even used W..

How to monitor SQL Server table changes by using c#?

I have more than one application accessing the same DB and I need to get notified if one of these apps change anything (update, insert) in a certain table. Database and apps are not in the same serve..

How can I get the value of a registry key from within a batch script?

I need to use a REG QUERY command to view the value of a key and set the result into a variable with this command: FOR /F "tokens=2* delims= " %%A IN ('REG QUERY "KeyName" /v ValueName') DO SET Va..

Proxy setting for R

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

What's the best way to center your HTML email content in the browser window (or email client preview pane)?

I normally use CSS rules for margin:0 auto along with a 960 container for my standard browser based content, but I'm new to HTML email creation and I've got the following design that I'd like to now ..

Copy a file in a sane, safe and efficient way

I search for a good way to copy a file (binary or text). I've written several samples, everyone works. But I want hear the opinion of seasoned programmers. I missing good examples and search a way wh..

How to create a stacked bar chart for my DataFrame using seaborn?

I have a DataFrame df: df = pd.DataFrame(columns=["App","Feature1", "Feature2","Feature3", "Feature4","Feature5", "Feature6","Feature7","Feature8..

How to get the android Path string to a file on Assets folder?

I need to know the string path to a file on assets folder, because I'm using a map API that needs to receive a string path, and my maps must be stored on assets folder This is the code i'm trying: ..

read word by word from file in C++

this function should read a file word by word and it does work till the last word, where the run stops void readFile( ) { ifstream file; file.open ("program.txt"); string word; char..

Set Google Chrome as the debugging browser in Visual Studio

When I press F5 in Visual Studio 2008, I want Google Chrome launched as the browser that my ASP.NET app runs in. May I know how this can be done?..

How to get EditText value and display it on screen through TextView?

I want to get the user input for the EditText view and display it on the screen through TextView when the Button is clicked. I also, want to know what modifications can be done on the string.xml file ..

What is the difference between MacVim and regular Vim?

I'm reasonably new to OS X, but I'm familiar with Vim from using it in various *nix systems. I've seen many people recommend running MacVim over Vim in the terminal. Can anyone tell me what difference..

Change image in HTML page every few seconds

I want to change images every few seconds, this is my code: <?xml version = "1.0" encoding = "utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml..

Create an empty object in JavaScript with {} or new Object()?

There are two different ways to create an empty object in JavaScript: var objectA = {} var objectB = new Object() Is there any difference in how the script engine handles them? Is there any reason ..

Error in eval(expr, envir, enclos) : object not found

I cannot understand what is going wrong here. data.train <- read.table("Assign2.WineComplete.csv",sep=",",header=T) # Building decision tree Train <- data.frame(residual.sugar=data.train$resid..

Eclipse error "Could not find or load main class"

I know there are many duplicates of this question, but I have looked at them all, and none of them have solved the issue. I am trying to run a class that has a main function. I have cleaned the proje..

What are Maven goals and phases and what is their difference?

What is the difference/relation between Maven goals and phases? How they are related to each other?..

Compiling an application for use in highly radioactive environments

We are compiling an embedded C++ application that is deployed in a shielded device in an environment bombarded with ionizing radiation. We are using GCC and cross-compiling for ARM. When deployed, our..

How to change working directory in Jupyter Notebook?

I couldn't find a place for me to change the working directory in Jupyter Notebook, so I couldn't use the pd.read_csv method to read in a specific csv document. Is there any way to make it? FYI, I'm ..

How do I parse JSON into an int?

I have Parsed some JSON data and its working fine as long as I store it in String variables. My problem is that I need the ID in an int varibable and not in String. i have tried to make a cast int id..

Permission denied on CopyFile in VBS

I'm trying to automate pushing a file into my users' home directories, but am stuck on a "Permission Denied" error — is thrown on line 6 here, with the CopyFile call. There are other parts of the s..

Read and parse a Json File in C#

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

Need to find a max of three numbers in java

Possible Duplicate: Find the max of 3 numbers in Java with different data types (Basic Java) Write a program that uses a scanner to read three integers (positive) displays the biggest numbe..

How to refresh materialized view in oracle

Iam trying to refresh the materialized view by using: DBMS_MVIEW.REFRESH('v_materialized_foo_tbl') But it's throwing invalid sql statement. Then I have created a stored procedure like this: CREA..

How to get file name from file path in android

I want to get file name from sdcard file path. e.g. :/storage/sdcard0/DCIM/Camera/1414240995236.jpg I want get 1414240995236.jpg I have written the code to fetch the same but it is not working. Plea..

How to change column datatype from character to numeric in PostgreSQL 8.4

I am using following query: ALTER TABLE presales ALTER COLUMN code TYPE numeric(10,0); to change the datatype of a column from character(20) to numeric(10,0) but I am getting the error: column..

How do I remove lines between ListViews on Android?

I'm using two ListViews like this: <ListView android:id="@+id/ListView" android:text="@string/Website" android:layout_height="30px" android:layout_width="150px" android:scrollbars="..

rake assets:precompile RAILS_ENV=production not working as required

I am trying to precompile assets using the command rake assets:precompile RAILS_ENV=production, but I always get the error below. ** Invoke assets:precompile (first_time) ** Execute assets:precom..

Component is part of the declaration of 2 modules

I try to build an ionic 2 app. When I try the app in the browser with ionic serve or launch it on an emulator everything works fine. But when I try to build it every time the error ionic-app-script ..

Facebook user url by id

I have a list of FB ids, is there a canon way of constructing their FB url without a graph query? For example, I have ids 3, 4, 5, and i want the Facebook URL for them without using the graph api and..

onSaveInstanceState () and onRestoreInstanceState ()

I'm trying to save and restore the state of an Activity using the methods onSaveInstanceState() and onRestoreInstanceState(). The problem is that it never enters the onRestoreInstanceState() method. ..

MySQL PHP - SELECT WHERE id = array()?

Possible Duplicate: MySQL query using an array Passing an array to mysql I have an array in PHP: $array = array(1, 4, 5, 7); As you can see, I have an array of different values, but I ..

How to read the post request parameters using JavaScript

I am trying to read the post request parameters from my HTML. I can read the get request parameters using the following code in JavaScript. $wnd.location.search But it does not work for post reques..

How to redirect to an external URL in Angular2?

What is the method for redirecting the user to a completely external URL in Angular 2. For example, if I need to redirect the user to an OAuth2 server in order to authenticate, how would I do that? ..

Unable to find valid certification path to requested target - error even after cert imported

I have a Java client trying to access a server with a self-signed certificate. When I try to Post to the server, I get the following error: unable to find valid certification path to requested ta..

Android: How to get a custom View's height and width?

Possible Duplicate: How to size an Android view based on its parent’s dimensions how do I use getMeasuredWidth() and getMeasuredHeight? It always returns 0. what is the diffrence between ..

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

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

How to draw a path on a map using kml file?

Can I parse kml file in order to display paths or points in Android? Please could you help me with that? This is kml sample code which I would like to display in android google map: <?xml version..

How to "Open" and "Save" using java

I want to make an "Open" and "Save" dialog in java. An example of what I want is in the images below: Open: Save: How would I go about doing this?..

UnicodeDecodeError, invalid continuation byte

Why is the below item failing? Why does it succeed with "latin-1" codec? o = "a test of \xe9 char" #I want this to remain a string as this is what I am receiving v = o.decode("..

How to use BOOLEAN type in SELECT statement

I have a PL/SQL function with BOOLEAN in parameter: function get_something(name in varchar2, ignore_notfound in boolean); This function is a part of 3rd party tool, I cannot change this. I would l..

Adding click event listener to elements with the same class

I have a list view for delete id. I'd like to add a listener to all elements with a particular class and do a confirm alert. My problem is that this seems to only add the listener to the first elemen..

JavaScriptSerializer - JSON serialization of enum as string

I have a class that contains an enum property, and upon serializing the object using JavaScriptSerializer, my json result contains the integer value of the enumeration rather than its string "name". ..

Changing Background Image with CSS3 Animations

Why this isn't working? What am I doing wrong? CSS @-webkit-keyframes test { 0% { background-image: url('frame-01.png'); } 20% { background-image: url('frame-02.png'); } 40% { ..

LabelEncoder: TypeError: '>' not supported between instances of 'float' and 'str'

I'm facing this error for multiple variables even treating missing values. For example: le = preprocessing.LabelEncoder() categorical = list(df.select_dtypes(include=['object']).columns.values) for c..

What is a callback?

What's a callback and how is it implemented in C#?..

Total Number of Row Resultset getRow Method

Read the Following Code: public class selectTable { public static ResultSet rSet; public static int total=0; public static ResultSet onLoad_Opetations(Connection Conn, int rownum,String sql) { int r..

Suppress console output in PowerShell

I have a call to GPG in the following way in a PowerShell script: $key = & 'gpg' --decrypt "secret.gpg" --quiet --no-verbose > $null I don't want any output from GPG to be seen on the main ..

Remove not alphanumeric characters from string

I want to convert the following string to the provided output. Input: "\\test\red\bob\fred\new" Output: "testredbobfrednew" I've not found any solution that will handle special characters like \r..

Python Pandas - Missing required dependencies ['numpy'] 1

Since yesterday I've had this error when I try to import packages on anaconda : ImportError: Missing required dependencies ['numpy'] I have tried un-installing Anaconda and Python, switching to Pyth..

How to disable all div content

I was under the assumption that if I disabled a div, all content got disabled too. However, the content is grayed but I can still interact with it. Is there a way to do that? (disable a div and get ..

how to get param in method post spring mvc?

I'm using spring mvc. And I can't get param from url when method = post. But when I change method to GET, so I can get all param. This is my form: <form method="POST" action="http://localhost:808..

Is there a W3C valid way to disable autocomplete in a HTML form?

When using the xhtml1-transitional.dtd doctype, collecting a credit card number with the following HTML <input type="text" id="cardNumber" name="cardNumber" autocomplete='off'/> will flag a w..

Editing legend (text) labels in ggplot

I have spent hours looking in the documentation and on StackOverflow, but no solution seems to solve my problem. When using ggplot I can't get the right text in the legend, even though it's in my dat..

Calculating the SUM of (Quantity*Price) from 2 different tables

I have two tables as follows PRODUCT table Id | Name | Price And an ORDERITEM table Id | OrderId | ProductId | Quantity What I'm trying to do is, calculate the subtotal price for each product (..

How to colorize diff on the command line?

When I have a diff, how can I colorize it so that it looks good? I want it for the command line, so please no GUI solutions...

TypeScript and array reduce function

Do you know what the reduce array method does in JavaScript? Can you provide a simple example of usage? I searched on Google and the TypeScript language specification but could not find any decent exp..

Use Invoke-WebRequest with a username and password for basic authentication on the GitHub API

With cURL, we can pass a username with an HTTP web request as follows: $ curl -u <your_username> https://api.github.com/user The -u flag accepts a username for authentication, and then cURL ..

Select element based on multiple classes

I have a style rule I want to apply to a tag when it has two classes. Is there any way to perform this without JavaScript? In other words: <li class="left ui-class-selector"> I want t..

How to play a notification sound on websites?

When a certain event occurs, I want my website to play a short notification sound to the user. The sound should not auto-start (instantly) when the website is opened. Instead, it should be played on ..

ng-change get new value and original value

I'm using ng-options to select values from a pulldown. I'd like to be able to compare the old value to the new value. ng-change works well for grabbing the new value of the pull down, but how can I ge..

Check if date is a valid one

Following is the scenario: I have a String date and a date format which is different. Ex.: date: 2016-10-19 dateFormat: "DD-MM-YYYY". I need to check if this date is a valid date. I have tried foll..

VBA for clear value in specific range of cell and protected cell from being wash away formula

I have data from like A1:Z50 but I want to delete only A5:X50 using VBA (I think it will be a lot faster than dragging the whole cell or using clickA5+shift+clickX50+delete). How can I do this ? And ..

Rails filtering array of objects by attribute value

So I perform a query to the db and I have a complete array of objects: @attachments = Job.find(1).attachments Now that I have an array of objects I don't want to perform another db query, but I wou..

Capture the close event of popup window in JavaScript

I need to perform some action before a popup window(using window.open ) closes. Something like will be good: var new_window = window.open('some url') new_window.onBeforeUnload = function(){ my code}..

How to remove lines in a Matplotlib plot

How can I remove a line (or lines) of a matplotlib axes in such a way as it actually gets garbage collected and releases the memory back? The below code appears to delete the line, but never releases..