Questions Tagged with #Scite

SciTE is a text editor based on the Scintilla source code editing component. Originally built to demonstrate Scintilla, it has grown to be a generally useful editor with facilities for building and running programs. It is best used for jobs with simple configurations.

How to escape apostrophe (') in MySql?

The MySQL documentation says that it should be \'. However, both scite and mysql shows that '' works. I saw that and it works. What should I do?..

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

Difference between framework vs Library vs IDE vs API vs SDK vs Toolkits?

I want some examples. I always get confused, so with some examples I might be able to figure it out better. Also: Is Eclipse an API or IDE?..

scroll image with continuous scrolling using marquee tag

I am using a <marquee> tag for continues moving of image horizontally. Suppose I have a 5 images than it moving fine but after completion of last image move there is a big gap to start scrollin..

No resource found - Theme.AppCompat.Light.DarkActionBar

I used ActionBar Style Generator, and now trying to use into my app, but getting : error: Error retrieving parent for item: No resource found that matches the given name '@style/ Theme.App..

String.Replace(char, char) method in C#

How do I replace \n with empty space? I get an empty literal error if I do this: string temp = mystring.Replace('\n', ''); ..

Writing JSON object to a JSON file with fs.writeFileSync

I am trying to write a JSON object to a JSON file. The code executes without errors, but instead of the content of the object been written, all that gets written into the JSON file is: [object Object..

Resource interpreted as stylesheet but transferred with MIME type text/html (seems not related with web server)

I have this problem. Chrome continues to return this error Resource interpreted as stylesheet but transferred with MIME type text/html The files affected by this error are just the Style, chose..

Rails where condition using NOT NIL

Using the rails 3 style how would I write the opposite of: Foo.includes(:bar).where(:bars=>{:id=>nil}) I want to find where id is NOT nil. I tried: Foo.includes(:bar).where(:bars=>{:id=&..

How can I match on an attribute that contains a certain string?

I am having a problem selecting nodes by attribute when the attributes contains more than one word. For example: <div class="atag btag" /> This is my xpath expression: //*[@class='atag'] ..

Problem in running .net framework 4.0 website on iis 7.0

Hey I got problem in running .NET framework 4.0 website on IIS7.0. the error I got is like: HTTP Error 404.2 - Not Found "The page you are requesting cannot be served because of the ISAPI and CGI Res..

Angular HTML binding

I am writing an Angular application and I have an HTML response I want to display. How do I do that? If I simply use the binding syntax {{myVal}} it encodes all HTML characters (of course). I need ..

How to get character for a given ascii value

How can I get the ascii character of a given ascii code. e.g. I'm looking for a method that given the code 65 would return "A". Thanks..

Return the characters after Nth character in a string

I need help! Can someone please let me know how to return the characters after the nth character? For example, the strings I have is "001 baseball" and "002 golf", I want my code to return baseball a..

Refresh page after form submitting

I have a little problem. I want to reload my page after submitting a form. <form method="post" action=""> <textarea cols="30" rows="4" name="update" id="update" maxlength="200" ></t..

How can I display a modal dialog in Redux that performs asynchronous actions?

I'm building an app that needs to show a confirm dialog in some situations. Let's say I want to remove something, then I'll dispatch an action like deleteSomething(id) so some reducer will catch that..

Handle Guzzle exception and get HTTP body

I would like to handle errors from Guzzle when the server returns 4xx and 5xx status codes. I make a request like this: $client = $this->getGuzzleClient(); $request = $client->post($url, $heade..

If list index exists, do X

In my program, user inputs number n, and then inputs n number of strings, which get stored in a list. I need to code such that if a certain list index exists, then run a function. This is made more ..

How to get the HTML for a DOM element in javascript

Imagine I have the following HTML: <div><span><b>This is in bold</b></span></div> I want to get the HTML for the div, including the div itself. Element.innerHTML..

How to determine one year from now in Javascript

I'm trying to get one year from now's date, and it's not working. JS: var now = new Date(); var oneYr = new Date(); oneYr.setYear(now.getYear() + 1); $("#yearFromNow").append(oneYr.toString()); va..

How to set the text color of TextView in code?

In XML, we can set a text color by the textColor attribute, like android:textColor="#FF0000". But how do I change it by coding? I tried something like: holder.text.setTextColor(R.color.Red); Where..

Find the index of a char in string?

I have a string that goes like "abcdefg..." I would like to find the index where the letter d is at, so I can get the number 3. I managed to do it by looping through each letter in the string, but t..

When does a cookie with expiration time 'At end of session' expire?

There is a session cookie with expiration time which says 'At end of session'. When exactly does it expire or will it be alive forever? ..

Installing the Android USB Driver in Windows 7

I am attempting to install the Android USB Driver in my computer running on Windows 7. I followed the instructions in the developer section of the website, but I am stuck. Here is the website with the..

How do I get IntelliJ to recognize common Python modules?

I'm using IntelliJ 10 IDEA Ultimate Edition. I've created a new file, and IntelliJ has correctly switched to Python parsing mode. (I can confirm this by typing "d", it pops up "def" as a sug..

HTTPS and SSL3_GET_SERVER_CERTIFICATE:certificate verify failed, CA is OK

I am using XAMPP for development. Recently I upgraded my installation of xampp from an old version to 1.7.3. Now when I curl HTTPS enabled sites I get the following exception Fatal error: Uncaug..

JSON Naming Convention (snake_case, camelCase or PascalCase)

Is there a standard on JSON naming?I see most examples using all lower case separated by underscore, aka snake_case, but can it be used PascalCase or camelCase as well?..

How to view the list of compile errors in IntelliJ?

I am looking for a way to view all compile errors in IntelliJ, similar to how they are displayed in Eclipse. I tried searching here and Google but have not really found a solution. I really like Int..

Matrix multiplication using arrays

I'm trying to make a simple matrix multiplication method using multidimensional arrays ([2][2]). I'm kinda new at this, and I just can't find what it is I'm doing wrong. I'd really appreciate any help..

Using other keys for the waitKey() function of opencv

I'm working on a program (python ,opencv) in which I use the spacebar to go to the next frame, and Esc to exit the program. These are the only two keys i've got working. I tried to find out about more..

httpd: Could not reliably determine the server's fully qualified domain name, using for ServerName

I tried to restart my Apache server on CentOS 5.0 and got this message: httpd: Could not reliably determine the server's fully qualified domain name, using for ServerName Here is the /..

How to stop event propagation with inline onclick attribute?

Consider the following: <div onclick="alert('you clicked the header')" class="header"> <span onclick="alert('you clicked inside the header');">something inside the header</span> &..

Printing Java Collections Nicely (toString Doesn't Return Pretty Output)

I wish to print a Stack<Integer> object as nicely as the Eclipse debugger does (i.e. [1,2,3...]) but printing it with out = "output:" + stack doesn't return this nice result. Just to clarify, I..

git: fatal: I don't handle protocol '??http'

I copy and pasted an git clone command from a web page: I got this: user@host> git clone ?? C..

com.sun.jdi.InvocationException occurred invoking method

I just want to create an object of class, but got this error when debugging. Can anybody tell me what the problem is? The location of this code is in some Spring(2.5) Service class. There is a simil..

How do I rename a repository on GitHub?

I wanted to rename one of my repositories on GitHub, but I got scared when a big red warning said: We will not set up any redirects from the old location You will need to update your local re..

send checkbox value in PHP form

I have a question regarding a php form. I've added a checkbox to the existing form, but not sure how to add it to the php. I would like it to send "yes" if the visitores checks it, and "no" if he is n..

Spark Kill Running Application

I have a running Spark application where it occupies all the cores where my other applications won't be allocated any resource. I did some quick research and people suggested using YARN kill or /bin..

Purpose of installing Twitter Bootstrap through npm?

Question 1: What exactly is the purpose of installing Twitter Bootstrap through npm? I thought npm was meant for server side modules. Is it faster to serve the bootstrap files yourself than using a 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..

How to install XNA game studio on Visual Studio 2012?

Is it possible to create XNA games using Visual Studio 2012?..

Fixing "Lock wait timeout exceeded; try restarting transaction" for a 'stuck" Mysql table?

From a script I sent a query like this thousands of times to my local database: update some_table set some_column = some_value I forgot to add the where part, so the same column was set to the same..

How to format Joda-Time DateTime to only mm/dd/yyyy?

I have a string "11/15/2013 08:00:00", I want to format it to "11/15/2013", what is the correct DateTimeFormatter pattern? I've tried many and googled and still unable to find the correct pattern. e..

bad operand types for binary operator "&" java

The error shows this line if ((a[0] & 1 == 0) && (a[1] & 1== 0) && (a[2] & 1== 0)){ This is the whole code: public class Ex4 { public static void main(String[] ar..

How do I put variable values into a text string in MATLAB?

I'm trying to write a simple function that takes two inputs, x and y, and passes these to three other simple functions that add, multiply, and divide them. The main function should then display the re..

How can I deserialize JSON to a simple Dictionary<string,string> in ASP.NET?

I have a simple key/value list in JSON being sent back to ASP.NET via POST. Example: { "key1": "value1", "key2": "value2"} I AM NOT TRYING TO DESERIALIZE INTO STRONGLY-TYPED .NET OBJECTS I simply ..

How to do a SUM() inside a case statement in SQL server

I want to add some calculation inside my case statement to dynamically create the contents of a new column but I get the error: Column 'Test1.qrank' is invalid in the select list because it is no..

How do I get the RootViewController from a pushed controller?

So, I push a view controller from RootViewController like: [self.navigationController pushViewController:anotherViewController animated:YES] ; BUT, FROM anotherViewController now, I want to access..

How to properly make a http web GET request

i am still new on c# and i'm trying to create an application for this page that will tell me when i get a notification (answered, commented, etc..). But for now i'm just trying to make a simple call t..

console.log showing contents of array object

I have tried using console.log so I can see the content of my array that contains multiple objects. However I get an error saying console.log is not an object etc. I'm using jquery 1.6.2 and my array ..

Auto code completion on Eclipse

I want Eclipse to automatically suggest to me all possible options, while I'm writing some variable/class name or keyword, like in Flash Develop or Visual Studio. Is it possible? If not, with which ..

Selecting default item from Combobox C#

I have few items on my ComboBox items collection, and i'd like to select one item from this list and set it as default item - when app starts - this item is already on comboBox. I'm trying something ..

draw diagonal lines in div background with CSS

I have a div for a preview box: HTML: <div class="preview-content">PREVIEW</div> CSS: .preview-content { background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYA..

Loop through Map in Groovy?

I have a very simple task I am trying to do in Groovy but cannot seem to get it to work. I am just trying to loop through a map object in groovy and print out the key and value but this code does not ..

Toolbar navigation icon never set

I'm trying the new Toolbar component and having some trouble with the navigation icon. I want to implement a custom icon for back navigation : In my manifest i set a parent to my activity : <activi..

Combine multiple Collections into a single logical Collection?

Assume, I have a constant number of collections (e.g. 3 ArrayLists) as members of a class. Now, I want to expose all the elements to other classes so they can simply iterate over all elements (ideally..

OSError: [Errno 8] Exec format error

I am having hard time parsing the arguments to subprocess.Popen. I am trying to execute a script on my Unix server. The script syntax when running on shell prompt is as follows: /usr/local/bin/script..

Maintaining href "open in new tab" with an onClick handler in React

I have an onClick (React) handler on a table cell that fires properly, however I want to maintain the "Open in a new Tab" feature that having an href on a tag gives you. Trying to combine both on a s..

System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll?

I'm using WPF on C# as code bellow <Window xmlns="" xmlns:x="" xmlns:d="http..

How can I make space between two buttons in same div?

What is the best way to horizontally space Bootstrap buttons? At the moment the buttons are touching: <div class="btn-group"> <button class="btn btn-inverse dropdown-toggle" data-toggle..

UICollectionView cell selection and cell reuse

Upon cell selection, I want to handle changing the cell appearance. I figured the delegate method collectionView:didSelectItemAtIndexPath: & collectionView:didDeselectItemAtIndexPath: is where I s..

Android Material and appcompat Manifest merger failed

I have next grade dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation '' implementation '

iText - add content to existing PDF file

I want to do the following with iText: (1) parse an existing PDF file (2) add some data to it, on the existing single page of the document (such as a timestamp) (3) write out the document I just c..

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

I installed LAMP on Ubuntu 12.04 LTS (Precise Pangolin) and then set root password on phpMyAdmin. I forgot the password and now I am unable to login. When I try to change password through termina..

Laravel Rule Validation for Numbers

I have the following Rule : 'Fno' => 'digits:10' 'Lno' => 'min:2|max5' // this seems invalid But How to have the Rule that Fno Should be a Digit with Minimum 2 Digit to Maximum 5 Digit an..

if checkbox is checked, do this

When I check a checkbox, I want it to turn <p> #0099ff. When I uncheck the checkbox, I want it to undo that. Code I have so far: $('#checkbox').click(function(){ if ($('#checkbox').attr('..

get current date and time in groovy?

What is the code to get the current date and time in groovy? I've looked around and can't find an easy way to do this. Essentially I'm looking for linux equivalent of date I have : import java.text...

How to use cURL to get jSON data and decode the data?

So I have a link that returns a jSON object, and I need to have it decoded and put into variables in PHP. URL api.php?action=getThreads&hash=123fajwersa&node_id=4&order_by=post_date&..

How to force garbage collection in Java?

Is it possible to force garbage collection in Java, even if it is tricky to do? I know about System.gc(); and Runtime.gc(); but they only suggest to do GC. How can I force GC?..

How to undo 'git reset'?

What's the simplest way to undo: git reset HEAD~ Currently, the only way I can think of is doing a git clone http://... from a remote repo...

Check if space is in a string

' ' in word == True I'm writing a program that checks whether the string is a single word. Why doesn't this work and is there any better way to check if a string has no spaces/is a single word....

Why are you not able to declare a class as static in Java?

Why are you not able to declare a class as static in Java?..

How can I divide two integers to get a double?

How do I divide two integers to get a double?..

Convert java.util.Date to java.time.LocalDate

What is the best way to convert a java.util.Date object to the new JDK 8/JSR-310 java.time.LocalDate? Date input = new Date(); LocalDate date = ??? ..

Angular 2: Can't bind to 'ngModel' since it isn't a known property of 'input'

I'm trying to implement Dynamic Forms in Angular 2. I've added additional functionalities like Delete and Cancel to the dynamic forms. I've followed this documentation:

How to get the path of src/test/resources directory in JUnit?

I know I can load a file from src/test/resources with: getClass().getResource("somefile").getFile() But how can I get the full path to the src/test/resources directory, i.e. I don't want to load a ..

Can an int be null in Java?

Can an int be null in Java? For example: int data = check(Node root); if ( data == null ) { // do something } else { // do something } My goal is to write a function which returns an int. Said ..

Add button to a layout programmatically

I'm having trouble adding a button to a layout that I've created in XML. Here's what I want to achieve: //some class else { startActivity(new Intent(StatisticsScreen.this, ScreenTemperature.c..

How to get the browser to navigate to URL in JavaScript

What is the best (correct, modern, cross-browser, safe) way to get a web browser to navigate to a URL of your choice using JavaScript?..

How to select label for="XYZ" in CSS?

HTML: <label for="email">{t _your_email}:</label> CSS: label { display: block; width: 156px; cursor: pointer; padding-right: 6px; padding-bottom: 1px; } I wish to sel..

A reference to the dll could not be added

When I add a .dll file as a reference in C# application it shows an error : A reference to the "....dll" could not be added.Please make sure that the file is accessible and that it is a valid as..

Trigger a Travis-CI rebuild without pushing a commit?

Using Travis-CI, is it possible to trigger a rebuild without pushing a new commit to GitHub? Use case: A build fails due to an externality. The source is actually correct. It would build OK and pass ..

How to save a git commit message from windows cmd?

I run git from the command line. How does one save the commit message? I mean what keys should I press to go past this screen: ..

wp-admin shows blank page, how to fix it?

I am working with WordPress 3.5.8. Yesterday I made some changes into it to a friend. I don't know what happened, but after some time when I try to log in at wp-admin side and execute URL www.mysite.c..

"Conversion to Dalvik format failed with error 1" on external JAR

In my Android application in Eclipse I get the following error. UNEXPECTED TOP-LEVEL EXCEPTION: java.lang.IllegalArgumentException: already added: Lorg/xmlpull/v1/XmlPullParser; .... Convers..

How to set ANDROID_HOME path in ubuntu?

How to set ANDROID_HOME path in ubuntu? Please provide the steps...

What is the difference between const and readonly in C#?

What is the difference between const and readonly in C#? When would you use one over the other?..

Regular Expression usage with ls

I am trying to use ER (Extended Regular Expressions) with ls like ls .+\..+. I am trying to print all files which contains an extension (I know I could have used ls *.*, but I wanted to try using ER..

C++ "was not declared in this scope" compile error

New to C++. In the following program I'm writing I get this error: g++ -o Blob In function 'int nonrecursivecountcells(color (*)[7], int, int)': error: 'grid' was not dec..

How to get rid of blank pages in PDF exported from SSRS

I have a two-page SSRS report. When I exported it to PDF it was taking 4 pages due to its width, where the 2nd and 4th pages were displaying one of my fields from the table. I tried to set the layout ..

Group by multiple field names in java 8

I found the code for grouping the objects by some field name from POJO. Below is the code for that: public class Temp { static class Person { private String name; private int ag..

What are the alternatives now that the Google web search API has been deprecated?

Google Web Search API has been deprecated and replaced with Custom Search API (see I wanted to search the whole web but it looks like with the new API only cu..

django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb

The problem Im facing while trying to connect to database for mysql. I have also given the database settings that i have used. Traceback (most recent call last): File "", line 10, in <m..

Trim leading and trailing spaces from a string in awk

I'm trying to remove leading and trailing space in 2nd column of the below input.txt: Name, Order   Trim, working cat,cat1 I have used the below awk to remove leading and trailing space in 2nd col..

Connection refused to MongoDB errno 111

I have a Linode server running Ubuntu 12.04 LTS and MongoDB instance (service is running and CAN connect locally) that I can't connect to from an outside source. I have added these two rules to my IP..

What is the Java ?: operator called and what does it do?

I have been working with Java a couple of years, but up until recently I haven't run across this construct: int count = isHere ? getHereCount(index) : getAwayCount(index); This is probably a very s..

Passing multiple argument through CommandArgument of Button in

I have a gridview with multiple rows, each has a Update button and I need to pass 2 values when someone clicks on Update button. Aside from packing the arguments inside CommandArgument separated by c..

How to determine if a point is in a 2D triangle?

Is there an easy way to determine if a point is inside a triangle? It's 2D, not 3D...

Showing data values on stacked bar chart in ggplot2

I'd like to show data values on stacked bar chart in ggplot2. Here is my attempted code Year <- c(rep(c("2006-07", "2007-08", "2008-09", "2009-10"), each = 4)) Category <- c(rep(c("A", "B..

Count records for every month in a year

I have a table with total no of 1000 records in it.It has the following structure: EMP_ID EMP_NAME PHONE_NO ARR_DATE 1 A 545454 2012/03/12 I want to calculate no of records for ever..

Real time face detection OpenCV, Python

I am trying to make a basic program for a real time face detection. Here's my code (I am a newbie in OpenCV) : import numpy as np import cv2 cam = cv2.VideoCapture(0) name = 'detect' face_cascade = c..

How to compare two files in Notepad++ v6.6.8

I want to compare values from two different files. In Notepad++ version 5.0.3 we had shortcut button Alt+d but in version 6.6.8 I cannot find any option to compare. Also let me know which version is ..

How to get a path to a resource in a Java JAR file

I am trying to get a path to a Resource but I have had no luck. This works (both in IDE and with the JAR) but this way I can't get a path to a file, only the file contents: ClassLoader classLoader..

Selecting multiple classes with jQuery

I’ve had a good look and can’t seem to find out how to select all elements matching certain classes in one jQuery selector statement such as this: $('.myClass', '.myOtherClass').removeClass('thec..

CSS animation delay in repeating

I've recently discovered how to "properly" use CSS animations (previously I dismissed them as not being able to make complex sequences like you could in JavaScript). So now I'm learning about them. F..

Remove/ truncate leading zeros by javascript/jquery

Suggest solution for removing or truncating leading zeros from number(any string) by javascript,jquery...

Splitting a Java String by the pipe symbol using split("|")

The Java official documentation states: The string "boo:and:foo", for example, yields the following results with these expressions Regex Result : { "boo", "and", "foo" }" And that's the way ..

How to check the installed version of React-Native

I'm going to upgrade react-native but before I do, I need to know which version I'm upgrading from to see if there are any special notes about upgrading from my version. How do I find the version of..

How to develop a soft keyboard for Android?

I would like to play around with some ideas and develop a soft keyboard for Android to replace the default one. Is there any general information about soft keyboard development for Android out there..

Maximum number of rows of CSV data in excel sheet

It is known that Excel sheets can display a maximum of 1 million rows. Is there any row limit for csv data, i.e. does Excel allow more than 1 million rows in csv format? One more question: About this..

How to get the values of a ConfigurationSection of type NameValueSectionHandler

I'm working with C#, Framework 3.5 (VS 2008). I'm using the ConfigurationManager to load a config (not the default app.config file) into a Configuration object. Using the Configuration class, I was ..

Mail multipart/alternative vs multipart/mixed

When creating email messages you are supposed to set the Content-Type to multipart/alternative when sending HTML and TEXT or multipart/mixed when sending TEXT and attachments. So what do you do if yo..

load iframe in bootstrap modal

I want to load an iframe into a bootstrap modal and show a loader before the iframe is loaded. I am using a simple jquery click function, but it is not working. I do not understand why it is not worki..

What does "hashable" mean in Python?

I tried searching internet but could not find the meaning of hashable. When they say objects are hashable or hashable objects what does it mean?..

How to check if a std::thread is still running?

How can I check if a std::thread is still running (in a platform independent way)? It lacks a timed_join() method and joinable() is not meant for that. I thought of locking a mutex with a std::lock_g..

Calling one Bash script from another Script passing it arguments with quotes and spaces

I made two test bash scripts on Linux to make the problem clear. TestScript1 looks like: echo "TestScript1 Arguments:" echo "$1" echo "$2" echo "$#" ./testscript2 $1 $2 TestScr..

rails simple_form - hidden field - create?

How can you have a hidden field with simple form? The following code: = simple_form_for @movie do |f| = f.hidden :title, "some value" = f.button :submit results in this error: undefined metho..

How do I determine the dependencies of a .NET application?

How do I determine the dependencies of a .NET application? Does Dependency Walker work with managed apps? I've downloaded the latest and tried profiling the app, but it just exits without much of an e..

How to unset (remove) a collection element after fetching it?

I have a collection which I want to iterate and modify while I fetch some of its elements. But I could't find a way or method to remove that fetched element. $selected = []; foreach ($collection as..

Show ImageView programmatically

How can I make an ImageView appear in the middle of the screen when the user clicks a button? I have placed the image in the res/drawable-folder. I've been trying with the code below but I don't know..

Is there a library function for Root mean square error (RMSE) in python?

I know I could implement a root mean squared error function like this: def rmse(predictions, targets): return np.sqrt(((predictions - targets) ** 2).mean()) What I'm looking for if this rmse fu..

keyCode values for numeric keypad?

Do the numbers on a numeric keypad have a different keycode than the numbers at the top of a keyboard? Here is some JavaScript that is supposed to run on the keyup event, but only if the keycode is b..

Testing javascript with Mocha - how can I use console.log to debug a test?

I am using the javascript test-runner "Mocha". I have a test that is failing, so I would to debug it using console.log. But when the tests are run, there is no output (only the test results from Moc..

Freemarker iterating over hashmap keys

Freemarker has two collection datatypes, lists and hashmaps Is there a way to iterate over hashmap keys just as we do with lists? So if I have a var with data lets say: user : { name : "user" em..

How can I shuffle the lines of a text file on the Unix command line or in a shell script?

I want to shuffle the lines of a text file randomly and create a new file. The file may have several thousands of lines. How can I do that with cat, awk, cut, etc?..

Fastest way to determine if an integer's square root is an integer

I'm looking for the fastest way to determine if a long value is a perfect square (i.e. its square root is another integer): I've done it the easy way, by using the built-in Math.sqrt() function, bu..

How to configure Fiddler to listen to localhost?

I want to monitor HTTP traffic between a process on my local machine and another (server) process, also running on my local machine. How can I configure Fiddler to listen to traffic to and from loc..

Bad operand type for unary +: 'str'

I cannot figure out a problem I am having with code written in Python 2.7. I am converting the references to ints, but I keep getting a type exception bad operand type for unary +: 'str'. Can anyone a..

Git Diff with Beyond Compare

I have succeeded in getting git to start Beyond Compare 3 as a diff tool however, when I do a diff, the file I am comparing against is not being loaded. Only the latest version of the file is loaded ..

Is there a difference between /\s/g and /\s+/g?

When we have a string that contains space characters: var str = ' A B C D EF '; and we want to remove the spaces from the string (we want this: 'ABCDEF'). Both this: str.replace(/\s/g, '') ..

What is the best collation to use for MySQL with PHP?

I'm wondering if there is a "best" choice for collation in MySQL for a general website where you aren't 100% sure of what will be entered? I understand that all the encodings should be the same, such ..

How to align a div to the top of its parent but keeping its inline-block behaviour?

See: Q: How can you make box1 and box3 align to the top of the parent div boxContainer? #boxContainerContainer { background: #fdd; text-align: center; } #boxContain..

How to use subList()

I have a JSF page which displays list of Glassfish log files. I use lazy loading for pagination. I keep the list of the log files names into Java List. private List<directoryListObj> dataList =..

Submitting form and pass data to controller method of type FileStreamResult

I have an mvc form (made from a model) which when submitted, I want to get a parameter I have the code to set the form and get the parameter using (@Html.BeginForm("myMethod", "Home", FormMethod.Get,..

jQuery - on change input text

I am trying to make a function which will execute when the value of a text input field is changed. The value of the field changes when a table cell is clicked, not on keyup, nor paste. I tried it like..

make an ID in a mysql table auto_increment (after the fact)

I acquired a database from another developer. He didn't use auto_incrementers on any tables. They all have primary key ID's, but he did all the incrementing manually, in code. Can I turn those into..

Remove carriage return from string

I would like to insert the following into a string <p>some text here</p> <p>some text here</p> <p>some text here</p> I want it to go into a string as follows &l..

How to recompile with -fPIC

I was trying to reinstall my ffmpeg, following this guide, on my ARM Ubuntu machine. Unfortunately, when I compile a program which uses this lib I get the following failure: /usr/bin/ld: /usr/local/l..

How can I do factory reset using adb in android?

How can I do the factory reset in android using ADB command? I had used adb reboot recovery command to get reset. But third party applications couldn't be cleared somehow.Is it correct way to achieve ..

How to get local server host and port in Spring Boot?

I'm starting up a Spring Boot application with mvn spring-boot:run. One of my @Controllers needs information about the host and port the application is listening on, i.e. localhost:8080 (or 127.x.y.z..

target input by type and name (selector)

I need to change some checkbox inputs to hidden inputs for some but not all inputs on a page. <input type="checkbox" name="ProductCode"value="396P4"> <input type="checkbox" name="ProductCo..

Problems with Android Fragment back stack

I've got a massive problem with the way the android fragment backstack seems to work and would be most grateful for any help that is offered. Imagine you have 3 Fragments [1] [2] [3] I want the use..

angularjs ng-style: background-image isn't working

I'm trying to apply a background image to a div by using the angular ng-style ( I tried a custom directive before with the same behaviour ), but it doesn't seem to be working. <nav class="navi..

Forcing label to flow inline with input that they label

I need the label to stay on the same line as the input field they are labeling. I want these elements to flow like they normally would when the window resizes, i just want the label to stick to the le..

HTTP 404 when accessing .svc file in IIS

I recently created a WCF service that works fine when tested from Visual Studio 2008. but when I deploy the project to IIS and I try to access the .svc file from IIS, I get this error : "Server Error..

How to get a list of programs running with nohup

I am accessing a server running CentOS (linux distribution) with an SSH connection. Since I can't always stay logged in, I use "nohup [command] &" to run my programs. I couldn't find how to get a..

How do I change the JAVA_HOME for ant?

I'm doing java work on a class server where I don't have root. Whenever I try to compile using ant, it points to the wrong directory (/usr/tomcat instead of /usr/tomcat/jre ). One of the things we w..

Seaborn plots not showing up

I'm sure I'm forgetting something very simple, but I cannot get certain plots to work with Seaborn. If I do: import seaborn as sns Then any plots that I create as usual with matplotlib get the Se..

Spring Boot - Loading Initial Data

I'm wondering what the best way to load initial database data before the application starts? What I'm looking for is something that will fill my H2 database with data. For example, I have a domain mo..

What is the correct way to create a single-instance WPF application?

Using C# and WPF under .NET (rather than Windows Forms or console), what is the correct way to create an application that can only be run as a single instance? I know it has something to do with some..

How to tell if a string contains a certain character in JavaScript?

I have a page with a textbox where a user is supposed to enter a 24 character (letters and numbers, case insensitive) registration code. I used maxlength to limit the user to entering 24 characters. ..

git push rejected

I give up! Whenever I try to push I get a stupid: ! [rejected] master -> master (non-fast forward) error: failed to push some refs to '[email protected]:companyX/projectX.git' Our team has ..

Bootstrap Dropdown menu is not working

I am having trouble getting my dropdowns to work. I can get the navbar to show up perfectly, but when I click on "Dropdown" (either of them) it does not display the dropdown menu. I have tried looking..

OSError: [Errno 2] No such file or directory while using python subprocess in Django

I am trying to run a program to make some system calls inside Python code using which throws the following error: Traceback (most recent call last): File "<console>", li..

div inside table

Can somebody tell me whether div inside a table is allowed or not according to w3c ..

How to use sudo inside a docker container?

Normally, docker containers are run using the user root. I'd like to use a different user, which is no problem using docker's USER directive. But this user should be able to use sudo inside the contai..

How to create EditText with rounded corners?

Is there any way to create EditText that has rounded corners?..

Fancybox doesn't work with jQuery v1.9.0 [ f.browser is undefined / Cannot read property 'msie' ]

Fancybox breaks with the new jQuery v1.9.0. It affects both, Fancybox v1.3.4 and below - and - v2.1.3 and below. The errors shown are : v1.3.4 : Timestamp: 15/01/2013 10:03:28 AM Error: TypeError:..

Draw horizontal rule in React Native

I've tried react-native-hr package - doesn't work for me nor on Android nor on iOS. Following code is also not suitable because it renders three dots at the end <Text numberOfLines={1}}> ..

curl usage to get header

Why does this not work: curl -X HEAD But these both work just fine: curl -I curl -X GET ..

Return an empty Observable

The function more() is supposed to return an Observable from a get request export class Collection{ public more = (): Observable<Response> => { if (this.hasMore()) { re..

Exact difference between CharSequence and String in java

I read this previous post. Can any one say what the exact difference between CharSequence and String is, other than the fact that String implements CharSequence and that String is a sequence of charac..

SQL grammar for SELECT MIN(DATE)

I have a table with structure: id(INT PK), title(VARCHAR), date(DATE) How do I select all distinct titles with their earliest date? Apparently, SELECT DISTINCT title, MIN(date) FROM table doesn't wo..

How to set the context path of a web application in Tomcat 7.0

I know that I can rename my webapp (or it's WAR file) to ROOT but this is a terrible way to do it, IMHO. Now I checked out the tomcat doc & it says It is NOT recommended to place elements di..

Memory errors and list limits?

I need to produce large and big (very) matrices (Markov chains) for scientific purposes. I perform calculus that I put in a list of 20301 elements (=one row of my matrix). I need all those data in mem..

Change URL and redirect using jQuery

I have some code like this, <form id="abc"> <input type="text" id="txt" /> </form> and now I want to redirect like this, var temp = $("#txt").val(); url = ""..

Logger slf4j advantages of formatting with {} instead of string concatenation

Is there any advantage of using {} instead of string concatenation? An example from slf4j logger.debug("Temperature set to {}. Old temperature was {}.", t, oldT); instead of logger.debug("Tempera..

How do I use Join-Path to combine more than two strings into a file path?

If I want to combine two strings into a file path, I use Join-Path like this: $path = Join-Path C: "Program Files" Write-Host $path That prints "C:\Program Files". If I want to do this for more tha..

CSS: image link, change on hover

I have an image that is a link. I want to show a different image when the user hovers over the link. Currently I'm using this code: <a href="" title="Twitter link"> <d..

Differences between action and actionListener

What is the difference between action and actionListener, and when should I use action versus actionListener?..

How do I get interactive plots again in Spyder/IPython/matplotlib?

I upgraded from Python(x,y) to in Windows 7 (and was happy to see that I can finally type function_name? and see the docstring in the Object Inspector again) but now the plotting doesn..

Opencv - Grayscale mode Vs gray color conversion

I am working in opencv(2.4.11) python(2.7) and was playing around with gray images. I found an unusual behavior when loading image in gray scale mode and converting image from BGR to GRAY. Following i..

LEFT function in Oracle

I am looking in an Oracle (10g) stored procedure and come across the following LEFT/RIGHTfunction. TO_DATE(LEFT('01-Jun-1201',9)) In the Toad editor, I am not able to run this function and have to ..

Changing button color programmatically

Is there a way to change the color of a button, or at least the color of the button label programmatically? I can change the label itself with document.getElementById("button")

How to join (merge) data frames (inner, outer, left, right)

Given two data frames: df1 = data.frame(CustomerId = c(1:6), Product = c(rep("Toaster", 3), rep("Radio", 3))) df2 = data.frame(CustomerId = c(2, 4, 6), State = c(rep("Alabama", 2), rep("Ohio", 1))) ..

How can I debug a HTTP POST in Chrome?

I would like to view HTTP POST data that was sent in Chrome. The data is in memory now, and I have the ability to resubmit the form. I know that if I resubmit the server will throw an error. Is there ..

Completely removing phpMyAdmin

I installed virtualmin and phpmyadmin separately using the apt-get command. phpMyAdmin didn't work because of Virtualmin's security settings (suexec). When I visit, it would do..

Deserialize JSON to Array or List with HTTPClient .ReadAsAsync using .NET 4.0 Task pattern

I'm trying to deserialize the JSON returned from using the .NET 4.0 Task pattern. It returns this JSON ('Load JSON data' @ http://jsonviewer.sta..

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

Given the lat/long coordinates, how can we find out the city/country?

For example if we have these set of coordinates "latitude": 48.858844300000001, "longitude": 2.2943506, How can we find out the city/country?..

ORA-01008: not all variables bound. They are bound

I have come across an Oracle problem for which I have so far been unable to find the cause. The query below works in Oracle SQL developer, but when running in .NET it throws: ORA-01008: not all va..

How do I import a specific version of a package using go get?

coming from a Node environment I used to install a specific version of a vendor lib into the project folder (node_modules) by telling npm to install that version of that lib from the package.json or e..

How to set background color in jquery

How to set background color of td in jQuery? e.g $(this).css({**BackgroundColor:Red**}) Thanks..

Pandas - Compute z-score for all columns

I have a dataframe containing a single column of IDs and all other columns are numerical values for which I want to compute z-scores. Here's a subsection of it: ID Age BMI Risk Factor PT 6..

MySQL/SQL: Group by date only on a Datetime column

Having a table with a column like: mydate DATETIME ... I have a query such as: SELECT SUM(foo), mydate FROM a_table GROUP BY a_table.mydate; This will group by the full datetime, including hours a..

Error in <my code> : object of type 'closure' is not subsettable

I was finally able to work out the code for my scraping. It seemed to be working fine and then all of a sudden when I ran it again, I got the following error message: Error in url[i] = paste("http://..

Get current cursor position

I want to get the current mouse position of the window, and assign it to 2 variables x and y (co-ordinates relative to the window, not to the screen as a whole). I'm using Win32 and C++. And a quick..

What is the best way to generate a unique and short file name in Java

I don't necessarily want to use UUIDs since they are fairly long. The file just needs to be unique within its directory. One thought which comes to mind is to use File.createTempFile(String prefix, ..

SQL: Insert all records from one table to another table without specific the columns

I want to insert all the record from the back up table foo_bk into foo table without specific the columns. if i try this query INSERT INTO foo SELECT * FROM foo_bk i'll get error "Insert Error: C..

How to change the height of a <br>?

I have a big paragraph of text that is divided into subparagraphs with <br>'s: <p> Blah blah blah. <br/> Blah blah blah. Blah blah blah. Blah blah blah. <br/> Blah b..

How To Include CSS and jQuery in my WordPress plugin?

How To Include CSS and jQuery in my WordPress plugin ?..

Is it possible to use an input value attribute as a CSS selector?

Is it possible to use a CSS selector to target an input that has a specific value? Example: How can I target the input below based on the value="United States" <input type="text" value="United St..

How to clear Flutter's Build cache?

There seems to be a problem with flutter's build. I always need to perform RUN > Flutter Full Restart everytime I run the app to an emulator or device. Otherwise, the app loads a scaffold body which..

How do I POST a x-www-form-urlencoded request using Fetch?

I have some parameters that I want to POST form-encoded to my server: { 'userName': '[email protected]', 'password': 'Password!', 'grant_type': 'password' } I'm sending my request (current..

Execute PHP script in cron job

In our centos6 server. I would like to execute a php script in cron job as apache user but unfortunately it does not work. here is the edition of crontab (crontab -uapache -e) 24 17 * * * php /opt/t..

Can we install Android OS on any Windows Phone and vice versa, and same with iPhone and vice versa?

I have 3 smartphones with me , one running Windows Mobile OS , another one running Android OS , and 3rd one running iOS. I am wondering if i can load/install Android OS on any Windows Phone and vice ..

SQL Greater than, Equal to AND Less Than

I want to create a query like the following, But im unsure of how to code it correctly, I want it to return all bookings within 1 hour of a StartTime, Here is what i came up with: SELECT BookingId, ..

append new row to old csv file python

I am trying to add a new row to my old csv file. Basically, it gets updated each time I run the Python script. Right now I am storing the old csv rows values in a list and then deleting the csv file..

Get the last non-empty cell in a column in Google Sheets

I use the following function =DAYS360(A2, A35) to calculate the difference between two dates in my column. However, the column is ever expanding and I currently have to manually change 'A35' as I ..

$(document).ready(function() is not working

I am using Jquery for getting a json object from a solr server. When I run my html file with Tomcat it is runns fine but when I embed it with my project which is running on weblogic it gets this erro..

XPath: difference between dot and text()

My question is about specifics of using dot and text() in XPath. For example, following find_element lines returns same element: driver.get('') driver.find_element_by_xpath(..

How stable is the git plugin for eclipse?

I was intending to have a play with git, and was wondering if anyone had used the git plugin for eclipse I see it's at version 0.3.1, and was wondering if anyone knew how stable it was / any gotchas?..