Questions Tagged with #Suffix tree

A suffix tree is a data structure that stores all suffixes of a string. It is the basis for many fast algorithms on strings.

Ukkonen's suffix tree algorithm in plain English

I feel a bit thick at this point. I've spent days trying to fully wrap my head around suffix tree construction, but because I don't have a mathematical background, many of the explanations elude me as..

Setting timezone in Python

Is it possible with Python to set the timezone just like this in PHP: date_default_timezone_set("Europe/London"); $Year = date('y'); $Month = date('m'); $Day = date('d'); $Hour = date('H'); $Minute =..

How to encode Doctrine entities to JSON in Symfony 2.0 AJAX application?

I'm developing game app and using Symfony 2.0. I have many AJAX requests to the backend. And more responses is converting entity to JSON. For example: class DefaultController extends Controller { ..

java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getImportantForAccessibility()' on a null object reference

I'm trying to put together a shopping list app, based on input fields, ArrayList, and ListView. The app will be based on Fragments. However, I have encountered a problem and I do not know how to solve..

How do I change the figure size with subplots?

I came across this example in the Matplotlib website. I was wondering if it was possible to increase the figure size. I tried with f.figsize(15,15) but it does nothing...

Adding an item to an associative array

//go through each question foreach($file_data as $value) { //separate the string by pipes and place in variables list($category, $question) = explode('|', $value); //place in assoc array ..

How to make a window always stay on top in .Net?

I have a C# winforms app that runs a macro in another program. The other program will continually pop up windows and generally make things look, for lack of a better word, crazy. I want to implement..

Appending items to a list of lists in python

I'm getting mad with list indexes, and can't explain what I'm doing wrong. I have this piece of code in which I want to create a list of lists, each one containing values of the same circuit paramete..

Java 8 lambdas, Function.identity() or t->t

I have a question regarding the usage of the Function.identity() method. Imagine the following code: Arrays.asList("a", "b", "c") .stream() .map(Function.identity()) // <- Thi..

What is compiler, linker, loader?

I wanted to know in depth meaning and working of compiler, linker and loader. With reference to any language preferably c++...

Delete with Join in MySQL

Here is the script to create my tables: CREATE TABLE clients ( client_i INT(11), PRIMARY KEY (client_id) ); CREATE TABLE projects ( project_id INT(11) UNSIGNED, client_id INT(11) UNSIGNE..

Sorting a list using Lambda/Linq to objects

I have the name of the "sort by property" in a string. I will need to use Lambda/Linq to sort the list of objects. Ex: public class Employee { public string FirstName {set; get;} public string L..

Fatal error: "No Target Architecture" in Visual Studio

When I try to compile my c++ project using Visual Studio 2010 in either Win32 or x64 mode I get the following error: >C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winnt.h(135): fata..

How do I add a linker or compile flag in a CMake file?

I am using the arm-linux-androideabi-g++ compiler. When I try to compile a simple "Hello, World!" program it compiles fine. When I test it by adding a simple exception handling in that code it works t..

how to achieve transfer file between client and server using java socket

I have implement the simple TCP server and TCP client classes which can send the message from client to server and the message will be converted to upper case on the server side, but how can I achieve..

How to compare strings in C conditional preprocessor-directives

I have to do something like this in C. It works only if I use a char, but I need a string. How can I do this? #define USER "jack" // jack or queen #if USER == "jack" #define USER_VS "queen" #elif US..

How to sort by Date with DataTables jquery plugin?

I am using the datatables jquery plugin and want to sorty by dates. I know they got a plugin but I can't find where to actually download it from I believe I n..

count number of rows in a data frame in R based on group

I have a data frame in R like this: ID MONTH-YEAR VALUE 110 JAN. 2012 1000 111 JAN. 2012 2000 . . . . 121 FEB. 2012 3000 131 FEB. 2..

Select first 10 distinct rows in mysql

Is there any way in MySQL to get the first 10 distinct rows of a table. i.e. Something like... SELECT TOP 10 distinct * FROM people WHERE names='SMITH' ORDER BY names asc However this method do..

Could not execute menu item (internal error)[Exception] - When changing PHP version from 5.3.1 to 5.2.9

I have installed two PHP versions in my WAMP server. When I am using 5.3.10, my wamp server is running just fine. But when I switch to older version of PHP (5.2.9) my wamp server tray icon is showing ..

Invert match with regexp

With PCRE, how can you construct an expression that will only match if a string is not found. If I were using grep (which I'm not) I would want the -v option. A more concrete example: I want my r..

Mail not sending with PHPMailer over SSL using SMTP

I am trying to use PHPMailer to send e-mails over SMTP but so far have had no luck. I've gone through a number of SO questions, PHPMailer tutorials and forum posts but still cannot get it to work. I'l..

How to access Spring MVC model object in javascript file?

I am using spring 3 MVC and i have below classes. External system would call my application using below URL: http://somehost/root/param1/param2/param3 I have a spring MVC controller method as belo..

What is aria-label and how should I use it?

A few hours ago I read about the aria-label attribute, which: Defines a string value that labels the current element. But in my opinion this is what the title attribute was supposed to do. I loo..

How can I get the number of records affected by a stored procedure?

For INSERT, UPDATE and DELETE SQL statements executed directly against the database, most database providers return the count of rows affected. For stored procedures, the number of records affected is..

How can I confirm a database is Oracle & what version it is using SQL?

I'm building an installer for an application. The user gets to select a datasource they have configured and nominate what type of database it is. I want to confirm that the database type is indeed Or..

Selenium WebDriver: I want to overwrite value in field instead of appending to it with sendKeys using Java

In WebDriver, if I use sendKeys it will append my string to the value that already exists in the field. I can't clear it by using clear() method because the second I do that, the webpage will throw a..

Visual Studio build fails: unable to copy exe-file from obj\debug to bin\debug

Update: A sample project reproducing this bug can be found here at Microsoft Connect. I have also tested and verified that the solution given in the accepted answer below works on that sample project...

Command to collapse all sections of code?

In Visual Studio is there a command to collapse/expand all the sections of code in a file?..

lexers vs parsers

Are lexers and parsers really that different in theory? It seems fashionable to hate regular expressions: coding horror, another blog post. However, popular lexing based tools: pygments, geshi, or..

How can I know which radio button is selected via jQuery?

I have two radio buttons and want to post the value of the selected one. How can I get the value with jQuery? I can get all of them like this: $("form :radio") How do I know which one is selected?..

Brew install docker does not include docker engine?

Trying to setup docker from brew, however the engine does not seem to be included in any of the any of the official formulas. brew install docker-machine docker-compose So these only installs the c..

How to deal with page breaks when printing a large HTML table

I have a project which requires printing an HTML table with many rows. My problem is the way the table is printed over multiple page. It will sometimes cut a row in half, making it unreadable because..

How does Access-Control-Allow-Origin header work?

Apparently, I have completely misunderstood its semantics. I thought of something like this: A client downloads javascript code MyCode.js from http://siteA - the origin. The response header of MyCod..

How to measure height, width and distance of object using camera?

I referred lot many links but still I am not able to get any point from that I can start my development. I want to measure my image height, width and distance using camera. I found this app . I want t..

Comparing Dates in Oracle SQL

I'm trying to get it to display the number of employees that are hired after June 20, 1994, Select employee_id, count(*) From Employee Where to_char(employee_date_hired, 'DD-MON-YY') > 31-DEC-95; ..

apache not accepting incoming connections from outside of localhost

I've booted up a CentOS server on rackspace and executed yum install httpd'd. Then services httpd start. So, just the barebones. I can access its IP address remotely over ssh (22) no problem, so ther..

Thymeleaf: how to use conditionals to dynamically add/remove a CSS class

By using Thymeleaf as template engine, is it possible to add/remove dynamically a CSS class to/from a simple div with the th:if clause? Normally, I could use the conditional clause as follows: <a..

Is there any way to change input type="date" format?

I'm working with HTML5 elements on my webpage. By default input type="date" shows date as YYYY-MM-DD. The question is, is it possible to change its format to something like: DD-MM-YYYY? ..

Regular expression matching a multiline block of text

I'm having a bit of trouble getting a Python regex to work when matching against text that spans multiple lines. The example text is ('\n' is a newline) some Varying TEXT\n \n DSJFKDAFJKDAFJDSAKFJADS..

Retrieve specific commit from a remote Git repository

Is there any way to retrieve only one specific commit from a remote Git repo without cloning it on my PC? The structure of remote repo is absolutely same as that of mine and hence there won't be any c..

Execute JavaScript using Selenium WebDriver in C#

How is this achieved? Here it says the java version is: WebDriver driver; // Assigned elsewhere JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScript("return document.title"); But I..

JSON.parse unexpected token s

Why is it that whenever I do :- JSON.parse('"something"') it just parses fine but when I do:- var m = "something"; JSON.parse(m); it gives me an error saying:- Unexpected token s ..

setup android on eclipse but don't know SDK directory

According to the beginner guide, to setup the ADT Plugin, one of the procedures is For the SDK Location in the main panel, click Bro..

How to convert a String into an array of Strings containing one character each

I have a small problem here.I need to convert a string read from console into each character of string. For example string: "aabbab" I want to this string into array of string.How would I do that? ..

Logical operators ("and", "or") in DOS batch

How would you implement logical operators in DOS Batch files?..

What is the default database path for MongoDB?

I got an error about dbpath (/data/db/) does not exist, but /etc/mongodb.conf named it dbpath = /var/lib/mongodb. So, which is the default dbpath for MongoDB?..

python JSON only get keys in first level

I have a very long and complicated json object but I only want to get the items/keys in the first level! Example: { "1": "a", "3": "b", "8": { "12": "c", "25": "d" ..

Required attribute on multiple checkboxes with the same name?

I have a list of checkboxes with the same name attribute, and I need to validate that at least one of them has been selected. But when I use the html5 attribute "required" on all of them, th..

JavaScript Array to Set

MSDN references JavaScript's Set collection abstraction. I've got an array of objects that I'd like to convert to a set so that I am able to remove (.delete()) various elements by name: var array = [..

Setting up PostgreSQL ODBC on Windows

I have the latest 64 bit version of PostgreSQL. I am running Win 7 64 bit. I had installed the ODBC driver (via the initial installer) when I installed PG, and upgraded it to the latest version from h..

Calling Member Functions within Main C++

#include <iostream> using namespace std; class MyClass { public: void printInformation(); }; void MyClass::printInformation() { return; } int main() { MyClass::printInformat..

What does -1 mean in numpy reshape?

A numpy matrix can be reshaped into a vector using reshape function with parameter -1. But I don't know what -1 means here. For example: a = numpy.matrix([[1, 2, 3, 4], [5, 6, 7, 8]]) b = numpy.res..

How to frame two for loops in list comprehension python

I have two lists as below tags = [u'man', u'you', u'are', u'awesome'] entries = [[u'man', u'thats'],[ u'right',u'awesome']] I want to extract entries from entries when they are in tags: result = [..

How to convert string to binary?

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

Count number of rows by group using dplyr

I am using the mtcars dataset. I want to find the number of records for a particular combination of data. Something very similar to the count(*) group by clause in SQL. ddply() from plyr is working fo..

Convert DateTime to TimeSpan

I want to convert a DateTime instance into a TimeSpan instance, is it possible? I've looked around but I couldn't find what I want, I only find time difference. More specifically, I want to convert ..

Index of Currently Selected Row in DataGridView

It's that simple. How do I get the index of the currently selected Row of a DataGridView? I don't want the Row object, I want the index (0 .. n)...

How do I remove the top margin in a web page?

I have had this problem with every web page I have created. There is always a top margin above the 'main container' div I use to place my content in the center of the page. I am using a css style sh..

Windows Explorer "Command Prompt Here"

I frequently find myself with a folder open in Windows, wishing to have a command prompt open with the same working directory. I am aware of Power Toys "Command Prompt", but that only works as a cont..

How do I read configuration settings from Symfony2 config.yml?

I have added a setting to my config.yml file as such: app.config: contact_email: [email protected] ... For the life of me, I can't figure out how to read it into a variable. I tried someth..

How can labels/legends be added for all chart types in chart.js (

The documentation for chart.js mentions "legend templates" but gives no resources or examples of such legends. How can these be displayed?..

Removing u in list

I have read up on remove the character 'u' in a list but I am using google app engine and it does not seem to work! def get(self): players = db.GqlQuery("SELECT * FROM Player") print players ..

How to check string length and then select substring in Sql Server

In a view, i have a column comments which may contain large string. I just want to select first 60 characters and append the '...' at the end of the selected string. For selecting first 60 characters..

How to add a filter class in Spring Boot?

I wonder, if there is any annotation for a Filter class (for web applications) in Spring Boot? Perhaps @Filter? I want to add a custom filter in my project. The Spring Boot Reference Guide mentione..

Animate change of view background color on Android

How do you animate the change of background color of a view on Android? For example: I have a view with a red background color. The background color of the view changes to blue. How can I do a smo..

Bootstrap 3 - How to load content in modal body via AJAX?

As you can see here, I have a button that launches a modal. Setting an href url for the button this url is automatically loaded into modal by Bootstrap 3. The fact is this page is loaded into modal ro..

How does one use the onerror attribute of an img element

CSS: .posting-logo-div { } .posting-logo-img { height:120px; width:120px; } .posting-photo-div { height:5px;width:5px;position:relative;top:-140px;left:648px; } .posting-photo-img { height:240px; wi..

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

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

Iterate through 2 dimensional array

I have a "connect four board" which I simulate with a 2d array (array[x][y] x=x coordinate, y = y coordinate). I have to use "System.out.println", so I have to iterate through the rows. I need a way..

How to change JDK version for an Eclipse project

I need to write a project that's only compatible with Java 1.5. I have Java 1.6 installed. Is there some form of backwards compatibility to get Eclipse to compile with 1.5? Do I have to install Java ..

What's the CMake syntax to set and use variables?

I'm asking this as a reminder to myself the next time I use CMake. It never sticks, and Google results aren't great. What's the syntax to set and use variables in CMake?..

Why is "throws Exception" necessary when calling a function?

class throwseg1 { void show() throws Exception { throw new Exception("my.own.Exception"); } void show2() throws Exception // Why throws is necessary here ? { show..

Passing multiple variables to another page in url

I'm passing a variable to another page in a url using sessions like this but it seems that I can't concatenate another variable to the same url and retrieve it in the next page successfully Page 1..

sort json object in javascript

For example with have this code: var json = { "user1" : { "id" : 3 }, "user2" : { "id" : 6 }, "user3" : { "id" : 1 } } How can I sort this json to be..

Reading Excel file using node.js

Okay so i am using the FileUploader module to upload my file from angular to my REST API: var uploader = $scope.uploader = new FileUploader({ url: api.getUrl('uploadCompetence',null) }); This i..

What is the easiest way to disable/enable buttons and links (jQuery + Bootstrap)

Sometimes I use anchors styled as buttons and sometimes I just use buttons. I want to disable specific clicky-things so that: They look disabled They stop being clicked How can I do this?..

must appear in the GROUP BY clause or be used in an aggregate function

I have a table that looks like this caller 'makerar' cname | wmname | avg --------+-------------+------------------------ canada | zoro | 2.0000000000000000 spain | luf..

PHP: Call to undefined function: simplexml_load_string()

I am implementing facebook count function using cron file. In which cron runs every 10 minutes and counts the total likes of a page. for($i=0;$i<3;$i++){ $source_url =$cars[$i]; $rest_url ..

Change text from "Submit" on input tag

I have a tag, <input type="submit" class="like"/>. I want to have the text inside the button say "Like", but right now, it says "Submit". class="like" is the CSS of the button, by the way...

What is an IIS application pool?

What exactly is an application pool? What is its purpose?..

SEVERE: Unable to create initial connections of pool - tomcat 7 with context.xml file

I tried to run project on tomcat 7.0.52 and initialize to DB through context.xml file. But it throws bunch of exceptions, I couldn't figure out what is wrong there. Here is console output: java.sql..

How to randomly pick an element from an array

I am looking for solution to pick number randomly from an integer array. For example I have an array new int[]{1,2,3}, how can I pick a number randomly?..

Filter multiple values on a string column in dplyr

I have a data.frame with character data in one of the columns. I would like to filter multiple options in the data.frame from the same column. Is there an easy way to do this that I'm missing? Exampl..

Showing loading animation in center of page while making a call to Action method in ASP .NET MVC

My application makes several calls to an Action method (ASP .NET MVC) which returns a Json object. When the application is waiting for this method to return its data I want to display a loading animat..

How can I load the contents of a text file into a batch file variable?

I need to be able to load the entire contents of a text file and load it into a variable for further processing. How can I do that? Here's what I did thanks to Roman Odaisky's answer. SetLocal ..

How to define the basic HTTP authentication using cURL correctly?

I'm learning Apigility (Apigility docu -> REST Service Tutorial) and trying to send a POST request with basic authentication via cURL: $ curl -X POST -i -H "Content-Type: application/hal+json" -H "Au..

JavaFX "Location is required." even though it is in the same package

I am trying to get my JavaFX program to run but am having some difficulty. I keep getting an error of 'java.lang.NullPointerException: Location is required.' The fxml file is in the same package as Ap..

Where to find htdocs in XAMPP Mac

I cannot find the htdocs directory anywhere on XAMPP for Mac. Many videos on YouTube show people just clicking a button that says "Go to application folder" but on my user interface, it reads: "Go to..

How can I add an ampersand for a value in a app config file value

I've got a C# program with values in a config file. What I want is to store ampersands for an url value like... <appSettings> <add key="myurl" value="

Read binary file as string in Ruby

I need an easy way to take a tar file and convert it into a string (and vice versa). Is there a way to do this in Ruby? My best attempt was this: file ="path-to-file.tar.gz") contents = ""..

Get string after character

I have a string that looks like this: GenFiltEff=7.092200e-01 Using bash, I would like to just get the number after the = character. Is there a way to do this?..

What exactly is the 'react-scripts start' command?

I've been working with a React project using create-react-app and I have two options to start the project: First way: npm run start with the definition at the package.json like this: "start"..

Disable ScrollView Programmatically?

I would like to enable ScrollView and disable it by a Button Click. Disable means like if the ScrollView wasn't there.. and enable it returns the ScrollView. I want that because I have a gallery wi..

Getting windbg without the whole WDK?

Does anyone know how to get ahold of windbg without having to download the entire 620MB WDK ISO? All I can find on the net to download the debugger is this link, which says you have to get the whole ..

Static linking vs dynamic linking

Are there any compelling performance reasons to choose static linking over dynamic linking or vice versa in certain situations? I've heard or read the following, but I don't know enough on the subject..

jquery change class name

I want to change the class of a td tag given the td tag's id: <td id="td_id" class="change_me"> ... I want to be able to do this while inside the click event of some other dom object. How do..

How do I get the localhost name in PowerShell?

How do I get the localhost (machine) name in PowerShell? I am using PowerShell 1.0...

Link to "pin it" on pinterest without generating a button

I have a page with tens or hundreds of posts, each one with social buttons. I just can't generate all the buttons for each url: it is too slow (facebook, g+, twitter, pinterest... for hundreds of link..

Pods stuck in Terminating status

I tried to delete a ReplicationController with 12 pods and I could see that some of the pods are stuck in Terminating status. My Kubernetes cluster consists of one control plane node and three worke..

Error:Failed to open zip file. Gradle's dependency cache may be corrupt

I updated android studio 2.3 and there is a bug, gradle doesn't build and it keeps giving me the same error for all projects. Error:Failed to open zip file. Gradle's dependency cache may be corrupt ..

Does Git Add have a verbose switch

I am in the process of moving all my private an public repo's over to github. One of the decisions I have made is to only use the console as it means a smaller tooling footprint if I ever need to chan..

Get first and last day of month using threeten, LocalDate

I have a LocalDate which needs to get the first and last day of the month. How do I do that? eg. 13/2/2014 I need to get 1/2/2014 and 28/2/2014 in LocalDate formats. Using threeten LocalDate class...

What is the best method of handling currency/money?

I'm working on a very basic shopping cart system. I have a table items that has a column price of type integer. I'm having trouble displaying the price value in my views for prices that include bo..

How do I change Bootstrap 3 column order on mobile layout?

I'm making a responsive layout with a top fixed navbar. Underneath I have two columns, one for a sidebar (3), and one for content (9). Which on desktop looks like this navbar [3][9] When I resize ..

Sheet.getRange(1,1,1,12) what does the numbers in bracket specify?

Sheet.getRange(1,1,1,12) I cannot understand the arguments 1,1,1,12 . What is this - the sheet id or row or what? method getRange(row, column, optNumRows, optNumColumns) here what does optNumRows..

How can I save a base64-encoded image to disk?

My Express app is receiving a base64-encoded PNG from the browser (generated from canvas with toDataURL() ) and writing it to a file. But the file isn't a valid image file, and the "file" utility simp..

Efficient thresholding filter of an array with numpy

I need to filter an array to remove the elements that are lower than a certain threshold. My current code is like this: threshold = 5 a = numpy.array(range(10)) # testing data b = numpy.array(filter(..

Validate a username and password against Active Directory?

How can I validate a username and password against Active Directory? I simply want to check if a username and password are correct...

If Browser is Internet Explorer: run an alternative script instead

I'm using an image carousel script that is quite heavy on the browser. It works great in Opera and Chrome, half decent in FF and absolutely breaks my balls in IE. So i'd like to give IE users an alter..

Listing information about all database files in SQL Server

Is it possible to list information about the files (MDF/LDF) of all databases on an SQL Server? I'd like to get a list showing which database is using what files on the local disk. What I tried: ..

Make a link open a new window (not tab)

Is there a way to make a link open a new browser window (not tab) without using javascript?..

Best way to generate a random float in C#

What is the best way to generate a random float in C#? Update: I want random floating point numbers from float.Minvalue to float.Maxvalue. I am using these numbers in unit testing of some mathematica..

What is the difference between the remap, noremap, nnoremap and vnoremap mapping commands in Vim?

What is the difference between the remap, noremap, nnoremap and vnoremap mapping commands in Vim?..

How to delete a file or folder?

How do I delete a file or folder in Python?..

How To Save Canvas As An Image With canvas.toDataURL()?

I'm currently building a HTML5 web app/Phonegap native app and I can't seem to figure out how to save my canvas as an image with canvas.toDataURL(). Can somebody help me out? Here's the code, what's ..

HTML5 Video Stop onClose

I'm using jQuery tools for an overlay. Inside the overlay I have an HTML5 video. However, when I close the overlay, the video keeps playing. Any idea how I might get the video to stop when I close the..

How to store Query Result in variable using mysql

SET @v1 := SELECT COUNT(*) FROM user_rating; SELECT @v1 When I execute this query with set variable this error is shown. Error Code : 1064 You have an error in your SQL syntax; check the manual tha..

Split string into array of characters?

How is it possible to split a VBA string into an array of characters? I tried Split(my_string, "") but this didn't work...

What is a mixin, and why are they useful?

In "Programming Python", Mark Lutz mentions "mixins". I'm from a C/C++/C# background and I have not heard the term before. What is a mixin? Reading between the lines of this example (which I've link..

How to check whether a Button is clicked by using JavaScript

Is there a simple way to do something along these lines: JavaScript: if(document.getElementById('button').clicked == true) { alert("button was clicked"); } HTML: <input id="button" type="su..

How to get Text BOLD in Alert or Confirm box?

How to get BOLD Text and change color of text in Alert or Confirm box? var conFrm = confirm("Following List(s) already Sent...!\n<strong>List Name: </strong>"+ss.replace(",","\n<b>..

How to maintain page scroll position after a jquery event is carried out?

I have searched high and low for an answer and have found similar examples of the problem but the answers do not apply to my scenario. The reality is I am new to this and therefore I don't have the sk..

Oracle select most recent date record

I am trying to find the most recent record based on a date field. When I set latest = 1 in the where clause, I get an error. Please help if possible. DATE is a the field I'm sorting by. I have tried..

How to get value by class name in JavaScript or jquery?

i wan to retrive all the value of this code using class name it possible in jquery . i want to retrive only the text within a div or number of div may be change the next form <span class="..

Excel: Searching for multiple terms in a cell

I use this handy equation to search for a term inside of a cell in excel. =IF(ISNUMBER(SEARCH("*Gingrich*",C1)),"1","") This equation searches for the presence of Gingrich in C1, if it exists, it d..

delete a column with awk or sed

I have a file with three columns. I would like to delete the 3rd column(in-place editing). How can I do this with awk or sed? 123 abc 22.3 453 abg 56.7 1236 hjg 2.3 Desired output 123 abc..

Algorithm to detect overlapping periods

I've to detect if two time periods are overlapping. Every period has a start date and an end date. I need to detect if my first time period (A) is overlapping with another one(B/C). In my case, if th..

Adding a parameter to the URL with JavaScript

In a web application that makes use of AJAX calls, I need to submit a request but add a parameter to the end of the URL, for example: Original URL: http://server/myapp.php?id=10 Resulting URL:..

Get all rows from SQLite

I have been trying to get all rows from the SQLite database. But I got only last row from the following codes. FileChooser class: public ArrayList<String> readFileFromSQLite() { fileName =..

How can I hide a TD tag using inline JavaScript or CSS?

How can I hide a <td> tag using JavaScript or inline CSS?..

How to display loading message when an iFrame is loading?

I have an iframe that loads a third party website which is extremely slow to load. Is there a way I can display a loading message while that iframe loads the user doesn't see a large blank space? PS..

Python - Locating the position of a regex match in a string?

I'm currently using regular expressions to search through RSS feeds to find if certain words and phrases are mentioned, and would then like to extract the text on either side of the match as well. For..

Get nth character of a string in Swift programming language

How can I get the nth character of a string? I tried bracket([]) accessor with no luck. var string = "Hello, world!" var firstChar = string[0] // Throws error ERROR: 'subscript' is unavailable..

What is the simplest way to get indented XML with line breaks from XmlDocument?

When I build XML up from scratch with XmlDocument, the OuterXml property already has everything nicely indented with line breaks. However, if I call LoadXml on some very "compressed" XML (no line bre..

Formatting MM/DD/YYYY dates in textbox in VBA

I'm looking for a way to automatically format the date in a VBA text box to a MM/DD/YYYY format, and I want it to format as the user is typing it in. For instance, once the user types in the second nu..

Remove quotes from a character vector in R

Suppose you have a character vector: char <- c("one", "two", "three") When you make reference to an index value, you get the following: > char[1] [1] "one" How can you strip off the quote ..

C# convert int to string with padding zeros?

In C# I have an integer value which need to be convereted to string but it needs to add zeros before: For Example: int i = 1; When I convert it to string it needs to become 0001 I need to know t..

Git: How configure KDiff3 as merge tool and diff tool

Recently I was using GitExtension 2.46, but the Git version that has the same is 1.9.4.msysgit.2. Willing to use only Git commands, I uninstalled GitExtension and install the latest version available ..

Best practice to look up Java Enum

We have a REST API where clients can supply parameters representing values defined on the server in Java Enums. So we can provide a descriptive error, we add this lookup method to each Enum. Seems l..

How do I copy a 2 Dimensional array in Java?

I need to make a copy of a fairly large 2 dimensional array for a project I am working on. I have two 2D arrays: int[][]current; int[][]old; I also have two methods to do the copying. I need to cop..

How to add option to select list in jQuery

My select list is called dropListBuilding. The following code does not seem to work: for (var i = 0; i < buildings.length; i++) { var val = buildings[i]; var text = buildings[i]; a..

Printing out a number in assembly language?

mov al,10 add al,15 How do I print the value of 'al'?..

Query an object array using linq

I would like to know how can I query an array of objects. For example I have an array object like CarList. So CarList[0] would return me the object Car. Car has properties Model and Make. Now, I want ..

How I can check if an object is null in ruby on rails 2?

I want to check when my object @objectname is not equal to null to show the values of the @objectname else to show that no values found. I tried this: <% if (@objectname != null) then %> bu..

git rm - fatal: pathspec did not match any files

I added over 9000 photos by accident to my project folder. And committed them. Then deleted them from disk. Committed. Now I try to push changes to git server. But it takes too long and tries to se..

IntelliJ inspection gives "Cannot resolve symbol" but still compiles code

Platform: IntelliJ Community Edition 10.0.3 SDK: jdk1.6.0_21 OS: Windows 7 So I have a strange situation with IntelliJ that has me completely stumped. I setup a Maven project and add log4j as a depe..

ant build.xml file doesn't exist

After the installation of my ant in my windows 7 . In cmd i typed ant -v it's given the ant version but it says the following also. Buildfile: build.xml does not exist! Build failed What's the pro..

Showing all errors and warnings

UPDATE 2: I have now removed the following from the .php file: <?php error_reporting( E_ALL ); ?> I have set display_erros in php.ini as follows: display_errors = On Error reporting is..

LaTex left arrow over letter in math mode

I want to put a left arrow over letter in math mode. I am looking for exactly the reverse of the vector symbol in \vec{x}. I tried to put it with \stackrel{\leftarrow}{x}, but it doesn't look good. T..

Status bar and navigation bar appear over my view's bounds in iOS 7

I recently downloaded Xcode 5 DP to test my apps in iOS 7. The first thing I noticed and confirmed is that my view's bounds is not always resized to account for the status bar and navigation bar. In ..

Is there a good Valgrind substitute for Windows?

I was looking into Valgrind to help improve my C coding/debugging when I discovered it is only for Linux - I have no other need or interest in moving my OS to Linux so I was wondering if there is a eq..

C# Threading - How to start and stop a thread

Can anyone give me a headstart on the topic of threading? I think I know how to do a few things but I need to know how to do the following: Setup a main thread that will stay active until I signal it..

error TS1086: An accessor cannot be declared in an ambient context in Angular 9

I'm learning Angular Material and I'm getting this error when importing { MatButtonModule } from "@angular/material/button". From what I read in other answers, it looks like package compatibility iss..

Spring Boot not serving static content

I can't get my Spring-boot project to serve static content. I've placed a folder named static under src/main/resources. Inside it I have a folder named images. When I package the app and run it, it c..

Changing background color of selected item in recyclerview

How to change the background color of only selected view in my recycle view example?only the background color of clicked itemview needs to be changed. Only one selected item must be displayed with bac..

How do I install PyCrypto on Windows?

I've read every other google source and SO thread, with nothing working. Python 2.7.3 32bit installed on Windows 7 64bit. Download, extracting, and then trying to install PyCrypto results in "Unable ..

find if an integer exists in a list of integers

i have this code: List<T> apps = getApps(); List<int> ids; List<SelectListItem> dropdown = apps.ConvertAll(c => new SelectListItem { Selec..

Draw on HTML5 Canvas using a mouse

I want to draw on a HTML Canvas using a mouse (for example, draw a signature, draw a name, ...) How would I go about implementing this?..

How to utilize date add function in Google spreadsheet?

I believe the issue I am having now should be much easier in MS Excel. However, since my company uses Google Spreadsheet so I have to figure out a way. Basically, I have a cell that contains a date v..

How can we run a test method with multiple parameters in MSTest?

NUnit has a feature called Values, like below: [Test] public void MyTest( [Values(1,2,3)] int x, [Values("A","B")] string s) { // ... } This means that the test method..

adding classpath in linux

export CLASSPATH=.;../somejar.jar;../mysql-connector-java-5.1.6-bin.jar java -Xmx500m folder.subfolder../dit1/some.xml cd .. is the above statement for setting the classpath to already existing clas..

Change private static final field using Java reflection

I have a class with a private static final field that, unfortunately, I need to change it at run-time. Using reflection I get this error: java.lang.IllegalAccessException: Can not set static final bo..

Operator overloading in Java

Please can you tell me if it is possible to overload operators in Java? If it is used anywhere in Java could you please tell me about it...

How to read integer values from text file

Possible Duplicate: Java: Reading integers from a file into an array I want to read integer values from a text file say contactids.txt. in the file i have values like 12345 3456778 2342342..

Logging with Retrofit 2

I'm trying to get the exact JSON that is being sent in the request. Here is my code: OkHttpClient client = new OkHttpClient(); client.interceptors().add(new Interceptor(){ @Override public com.squ..

How to check if click event is already bound - JQuery

I am binding a click event with a button: $('#myButton').bind('click', onButtonClicked); In one scenario, this is getting called multiple times, so when I do a trigger I see multiple ajax calls wh..

finished with non zero exit value

I am trying to import my project. but when I run the application I am getting the following error: Error: Execution failed for task ':app:processDebugResources'. >

Convert pem key to ssh-rsa format

I have a certificate in der format, from it with this command I generate a public key: openssl x509 -inform der -in ejbcacert.cer -noout -pubkey > Which results in this: -----BEGIN ..

calling server side event from html button control

I am creating an application using ASP.Net, in which I have a HTML button on an aspx page. <input type="submit" id="btnSubmit" runat="server" style="background-image:url(App_Themes/default/Im..

How to get the GL library/headers?

#include <gl\gl.h> #include <gl\glu.h> #include <gl\glaux.h> This is an example, but where to get GL headers?..

How do I output lists as a table in Jupyter notebook?

I know that I've seen some example somewhere before but for the life of me I cannot find it when googling around. I have some rows of data: data = [[1,2,3], [4,5,6], [7,8,9], ..

How to remove underline from a name on hover

I have such html: <legend class="green-color"><a name="section1">Section</a></legend>{ color:green; } In my case Section looking green, but when i pu..

How should I have explained the difference between an Interface and an Abstract class?

In one of my interviews, I have been asked to explain the difference between an Interface and an Abstract class. Here's my response: Methods of a Java interface are implicitly abstract and can..

How to drop unique in MySQL?

Create Table: CREATE TABLE `fuinfo` ( `fid` int(10) unsigned NOT NULL, `name` varchar(40) NOT NULL, `email` varchar(128) NOT NULL, UNIQUE KEY `email` (`email`), UNIQUE KEY `fid` (`fid`) ) EN..

make: *** [ ] Error 1 error

I am trying to compile a Pro*C file on gcc and I am getting this error : make: *** [MedLib_x.o] Error 1 This is the command printed by make: /usr/bin/gcc -g -fPIC -m64 -DSS_64BIT_SERVER -I/hom..

uncaught syntaxerror unexpected token U JSON

I get this error "uncaught syntaxerror unexpected token U" when I run my page in chrome. And in firefox I get, "JSON.parse: unexpected character". I'm returning the json data from a php file and the r..

View array in Visual Studio debugger?

Is it possible to view an array in the Visual Studio debugger? QuickWatch only shows the first element of the array...

How to get the list of properties of a class?

How do I get a list of all the properties of a class?..

How does the modulus operator work?

Let's say that I need to format the output of an array to display a fixed number of elements per line. How do I go about doing that using modulus operation? Using C++, the code below works for displa..

How to "pretty" format JSON output in Ruby on Rails

I would like my JSON output in Ruby on Rails to be "pretty" or nicely formatted. Right now, I call to_json and my JSON is all on one line. At times this can be difficult to see if there is a proble..

Adding :default => true to boolean in existing Rails column

I've seen a few questions (namely this one) here on SO about adding a default boolean value to an existing column. So I tried the change_column suggestion but I mustn't be doing it right. I tried: $..

How do I stretch an image to fit the whole background (100% height x 100% width) in Flutter?

I have an image that doesn't match the aspect ratio of my device's screen. I want to stretch the image so that it fully fills the screen, and I don't want to crop any part of the image. CSS has the c..

What's the most concise way to read query parameters in AngularJS?

I'd like to read the values of URL query parameters using AngularJS. I'm accessing the HTML with the following URL: As expected, is "?targ..

Eclipse can't find / load main class

My Eclipse (Indigo) was running just fine. I created a simple class Hello. It is placed in package cont in the folder ch13. However, when I try to run it from Eclipse I get info from Java Virtual M..

How to correctly get image from 'Resources' folder in NetBeans

I have a Java Project in NetBeans 7.0. I want to add some image to some label dynamically. The image will differ depending on the state of the program. I put one such image, 'filling.jpg', in the 'r..

Return array in a function

I have an array int arr[5] that is passed to a function fillarr(int arr[]): int fillarr(int arr[]) { for(...); return arr; } How can I return that array? How will I use it, say I returned ..

paint() and repaint() in Java

I've spent maybe the last two hours browsing and reading up on these methods and the Graphics class, and maybe I'm stupid, haha, but I'm just not understanding them. What are they for? I understand th..

How to add a Try/Catch to SQL Stored Procedure


Merging two images with PHP

I'm trying to merge two images together with PHP. For example... how would I go about placing image one on top of image two or merge, with basic PHP? I have tried something such as watermarking, but ..

Using Panel or PlaceHolder

What is the difference between <asp:Panel > and <asp:PlaceHolder > in ASP.NET? When should you use one over the other?..

How do I set default terminal to terminator?

Using Xubuntu. I'd like to have terminator replace the default terminal. For instance, when right-clicking inside a folder then selecting open terminal, I'd like Terminator to open instead of the de..

How to multi-line "Replace in files..." in Notepad++

If the free source code editor Notepad++ has the feature "Find in files...", that is without the files being opened in the editor, does it also have the feature "Replace in files..."? Notepad++ is ba..

Filter element based on .data() key/value

Say I have 4 div elements with class .navlink, which, when clicked, use .data() to set a key called 'selected', to a value of true: $('.navlink')click(function() { $(this).data('selected', true); }) ..

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

Running Internet Explorer 6, Internet Explorer 7, and Internet Explorer 8 on the same machine

Like everyone else, I need to test my code on Internet Explorer 6 and Internet Explorer 7. Now Internet Explorer 8 has some great tools for developer, which I'd like to use. I'd also like to start tes..

Handling 'Sequence has no elements' Exception

I am updating a quantity in my cart, but it is throwing a Sequence has no elements' exception. And I don't know what that even means. At first I thought that maybe there was a null value being passed..

Eclipse - Failed to create the java virtual machine

I'm having issue with running my Eclipse with the following config: eclipse.ini -startup plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar --launcher.library plugins/org.eclipse.equinox.launc..

How to find out whether a file is at its `eof`?

fp = open("a.txt") #do many things with fp c = if c is None: print 'fp is at the eof' Besides the above method, any other way to find out whether is fp is already at the eof?..

Get decimal portion of a number with JavaScript

I have float numbers like 3.2 and 1.6. I need to separate the number into the integer and decimal part. For example, a value of 3.2 would be split into two numbers, i.e. 3 and 0.2 Getting the integer ..

MySQL - Replace Character in Columns

Being a self-taught newbie, I created a large problem for myself. Before inserting data in to my database, I've been converting apostrophes (') in a string, to double quotes (""), instead of the requi..