Questions Tagged with #Autotest

Autotest is a Ruby gem for running tests automatically when source files change.

How to run a single RSpec test?

I have the following file: /spec/controllers/groups_controller_spec.rb What command in terminal do I use to run just that spec and in what directory do I run the command? My gem file: # Test ENVI..

You cannot call a method on a null-valued expression

I am simply trying to create a powershell script which calculates the md5 sum of an executable (a file). My .ps1 script: $answer = Read-Host "File name and extension (ie; file.exe)" $someFilePath = ..

Write to Windows Application Event Log

Is there a way to write to this event log: Or at least, some other Windows default log, where I don't have to register an event source?..

When to use RSpec let()?

I tend to use before blocks to set instance variables. I then use those variables across my examples. I recently came upon let(). According to RSpec docs, it is used to ... to define a memoized h..

Export table from database to csv file

I want to: Export table from sql server database to a comma delimited csv file without using sql Server import export wizard I want to do it using a query because I want to use the query in automatio..

Reverting single file in SVN to a particular revision

I have a file as shown below in an SVN repo that I would like to revert to a previous version. What is the way to do this in SVN? I want only downgrade this particular file to an older version, not th..

How to run a script at the start up of Ubuntu?

I want to run some Java programs in the background when the system boots in Ubuntu. I have tried to add a script in /etc/init.d directory but failed to start a program. i.e programs are not started. W..

Mapping US zip code to time zone

When users register with our app, we are able to infer their zip code when we validate them against a national database. What would be the best way to determine a good potential guess of their time z..

How to drop SQL default constraint without knowing its name?

In Microsoft SQL Server, I know the query to check if a default constraint exists for a column and drop a default constraint is: IF EXISTS(SELECT * FROM sysconstraints WHERE id=OBJECT_ID('SomeTable..

Check if a value is within a range of numbers

I want to check if a value is in an accepted range. If yes, to do something; otherwise, something else. The range is 0.001-0.009. I know how to use multiple if to check this, but I want to know if th..

MySQL export into outfile : CSV escaping chars

I've a database table of timesheets with some common feilds. id, client_id, project_id, task_id, description, time, date There are more but thats the gist of it. I have an export running on that ..

How to change pivot table data source in Excel?

I want to change it from one database to another. There don't appear to be any options to do this on the pivot table context menu..

How can I change the default width of a Twitter Bootstrap modal box?

I tried the following: <div class="modal hide fade modal-admin" id="testModal" style="display: none;"> <div class="modal-header"> <a data-dismiss="modal" class="cl..

round a single column in pandas

Is there a way to round a single column in pandas without affecting the rest of the dataframe? df: item value1 value2 0 a 1.12 1.3 1 a 1.50 2.5 2 a 0.10..

Euclidean distance of two vectors

How do I find the Euclidean distance of two vectors: x1 <- rnorm(30) x2 <- rnorm(30) ..

Change the size of a JTextField inside a JBorderLayout

When I use the code below it doesn't alter the size at all, it still fills the area in the grid. JPanel displayPanel = new JPanel(new GridLayout(4, 2)); JTextField titleText = new JTextField("title"..

What are the different NameID format used for?

In SAML metadata file there are several NameID format defined, for example: <NameIDFormat>urn:mace:shibboleth:1.0:nameIdentifier</NameIDFormat> <NameIDFormat>urn:oasis:names:tc:SAM..

Convert string to date then format the date

I am formatting a string to a date using the code String start_dt = '2011-01-01'; DateFormat formatter = new SimpleDateFormat("YYYY-MM-DD"); Date date = (Date)formatter.parse(start_dt); But how d..

How to know elastic search installed version from kibana?

Currently I am getting these alerts: Upgrade Required Your version of Elasticsearch is too old. Kibana requires Elasticsearch 0.90.9 or above. Can someone tell me if there is a way I can find ..

How to downgrade from Internet Explorer 11 to Internet Explorer 10?

As a developer, I found the new Internet Explorer version to be a complete nightmare. I turned the windows feature off, but I wasn't able to install Internet Explorer 10. It says that i..

Using OpenSSL what does "unable to write 'random state'" mean?

I'm generating a self-signed SSL certificate to protect my server's admin section, and I keep getting this message from OpenSSL: unable to write 'random state' What does this mean? This is on a..

Creating C formatted strings (not printing them)

I have a function that accepts a string, that is: void log_out(char *); In calling it, I need to create a formatted string on the fly like: int i = 1; log_out("some text %d", i); How do I do thi..

How do I resolve "Run-time error '429': ActiveX component can't create object"?

My company has a VB6 application using Crystal Reports 7 which a client has asked to be installed on Windows 7 32 bit. It is currently installed on Windows XP 32bit SP2 machines at the client. Connect..

LEFT INNER JOIN vs. LEFT OUTER JOIN - Why does the OUTER take longer?

We have the query below. Using a LEFT OUTER join takes 9 seconds to execute. Changing the LEFT OUTER to an LEFT INNER reduces the execution time to 2 seconds, and the same number of rows are returned...

How do you count the number of occurrences of a certain substring in a SQL varchar?

I have a column that has values formatted like a,b,c,d. Is there a way to count the number of commas in that value in T-SQL?..

How do I enable NuGet Package Restore in Visual Studio?

There's a similar post on stack but it doesn't help with my issue possibly because I am using Visual Studio 2015. How do I get the "Enable NuGet Package Restore" option to appear in VS2015? I chose ..

Locate the nginx.conf file my nginx is actually using

Working on a client's server where there are two different versions of nginx installed. I think one of them was installed with the brew package manager (its an osx box) and the other seems to have bee..

How to install a specific version of a package with pip?

Possible Duplicate: Installing specific package versions with Pip I am a bit new to pip install and virtualenv in general. I have setup an virtualenv on my server as well as on my local de..

InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately

Tried to perform REST GET through python requests with the following code and I got error. Code snip: import requests header = {'Authorization': 'Bearer...'} url = az_base_url + az_subscription_id +..

Cannot open solution file in Visual Studio Code

I have installed the Visual Studio Code on Windows. When I try to open a solution file in VS Code it opens the solution file, instead of opening all projects in solution. Is there a way to open existi..

PowerShell - Start-Process and Cmdline Switches

I can run this fine: $msbuild = "C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe" start-process $msbuild -wait But when I run this code (below) I get an error: $msbuild = "C:\WINDOWS\Microsof..

Java - Convert integer to string

Given a number: int number = 1234; Which would be the "best" way to convert this to a string: String stringNumber = "1234"; I have tried searching (googling) for an answer but no many seemed ..

macro run-time error '9': subscript out of range

I found a macro on the web to protect a worksheet with a password. It works fine, but when I save the file I get the message: run-time error '9': subscription out of range. I have never programmed ..

How to convert timestamps to dates in Bash?

I need a shell command or script that converts a Unix timestamp to a date. The input can come either from the first parameter or from stdin, allowing for the following usage patterns: ts2date 1267619..

Merge two dataframes by index

I have the following dataframes: > df1 id begin conditional confidence discoveryTechnique 0 278 56 false 0.0 1 1 421 18 false 0.0 ..

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

Kafka consumer list

I need to find out a way to ask Kafka for a list of topics. I know I can do that using the kafka-topics.sh script included in the bin\ directory. Once I have this list, I need all the consumers per to..

When to use: Java 8+ interface default method, vs. abstract method

Java 8 allows for default implementation of methods in interfaces called Default Methods. I am confused between when would I use that sort of interface default method, instead of an abstract class (w..

Pass value to iframe from a window

I need to send a value to an iframe. The iframe is present within the current window. How can I achieve this? I need to do it with javascript in the parent window that contains the iframe...

How to install Java 8 on Mac

I want to do some programming with the latest JavaFX, which requires Java 8. I'm using IntelliJ 13 CE and Mac OS X 9 Mavericks. I ran Oracle's Java 8 installer, and the files look like they ended up a..

How do you get the cursor position in a textarea?

I have a textarea and I would like to know if I am on the last line in the textarea or the first line in the textarea with my cursor with JavaScript. I thought of grabbing the position of the first n..

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 selector to get form by name

I have the following HTML: <form name="frmSave">...</form> Just to know, I am not able to modify the HTML in order to add an id or something else. This is what I tried to get the form ..

Where is Xcode's build folder?

Before Xcode 4 the build used to be created in the root folder of my project. I can no longer find it. Where can i find the build folder?..

What is the difference between .py and .pyc files?

I have noticed .pyc files spontaneously being generated when some .py file of the same name gets run. What is the difference between .py and .pyc files? Also, I find that having .pyc files lying aro..

How to run Unix shell script from Java code?

It is quite simple to run a Unix command from Java. Runtime.getRuntime().exec(myCommand); But is it possible to run a Unix shell script from Java code? If yes, would it be a good practice to run a..

"Series objects are mutable and cannot be hashed" error

I am trying to get the following script to work. The input file consists of 3 columns: gene association type, gene name, and disease name. cols = ['Gene type', 'Gene name', 'Disorder name'] no_header..

Uploading file using POST request in Node.js

I have problem uploading file using POST request in Node.js. I have to use request module to accomplish that (no external npms). Server needs it to be multipart request with the file field containing ..

Difference between applicationContext.xml and spring-servlet.xml in Spring Framework

Are applicationContext.xml and spring-servlet.xml related anyhow in Spring Framework? Will the properties files declared in applicationContext.xml be available to DispatcherServlet? On a related note..

HMAC-SHA256 Algorithm for signature calculation

I am trying to create a signature using the HMAC-SHA256 algorithm and this is my code. I am using US ASCII encoding. final Charset asciiCs = Charset.forName("US-ASCII"); final Mac sha256_HMA..

how do you pass images (bitmaps) between android activities using bundles?

Suppose I have an activity to select an image from the gallery, and retrieve it as a BitMap, just like the example: here Now, I want to pass this BitMap to be used in an ImageView for another activit..

SQL Call Stored Procedure for each Row without using a cursor

How can one call a stored procedure for each row in a table, where the columns of a row are input parameters to the sp without using a Cursor?..

Makefile, header dependencies

Let's say I have a makefile with the rule %.o: %.c gcc -Wall -Iinclude ... I want *.o to be rebuilt whenever a header file changes. Rather than work out a list of dependencies, whenever any header..

What does "<html xmlns="http://www.w3.org/1999/xhtml">" do?

I can't believe what is happening in my website. When I add this line: <html xmlns="http://www.w3.org/1999/xhtml"> <!DOCTYPE html> <html> <head> Everything works fine. And ..

How to play an android notification sound

I was wondering how I could play a notification sound without playing it over the media stream. Right now I can do this via the media player, however I don't want it to play as a media file, I want i..

convert array into DataFrame in Python

import pandas as pd import numpy as np e = np.random.normal(size=100) e_dataframe = pd.DataFrame(e) When I input the code above, I get this answer: But how do I change the column na..

Matching an optional substring in a regex

I'm developing an algorithm to parse a number out of a series of short-ish strings. These strings are somewhat regular, but there's a few different general forms and several exceptions. I'm trying to ..

Stop embedded youtube iframe?

I'm using YouTube iframe to embed videos on my site. <iframe width="100%" height="443" class="yvideo" id="p1QgNF6J1h0" src="http://www.youtube.com/embed/p1QgNF6J1h0?rel=0&control..

Allow access permission to write in Program Files of Windows 7

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

Where to download Microsoft Visual c++ 2003 redistributable

I have an old dll that uses the Microsoft Visual C++ 2003 (7.1) run time package. Unfortunately I don't have that DLL around anymore. Short of reinstalling VS2003, is there another way to get the ru..

Reading HTTP headers in a Spring REST controller

I am trying to read HTTP headers in Spring based REST API. I followed this. But I am getting this error: No message body reader has been found for class java.lang.String, ContentType: applicatio..

How to make a radio button look like a toggle button

I want a group of radio buttons to look like a group of toggle buttons (but still function like radio buttons). It's not necessary that they look exactly like toggle buttons. How can I do this only w..

java how to use classes in other package?

can I import,use class from other package? In Eclipse I made 2 packages one is main other is second main -main (class) second -second (class) and I wanted the main function of main class to call..

ReactJS: "Uncaught SyntaxError: Unexpected token <"

I am trying to get started building a site in ReactJS. However, when I tried to put my JS in a separate file, I started getting this error: "Uncaught SyntaxError: Unexpected token <". I tried addi..

What does the explicit keyword mean?

What does the explicit keyword mean in C++?..

How to debug SSL handshake using cURL?

I would like to troubleshoot per directory authentication with client certificate. I would specially like to find out which acceptable client certificates does server send. How do I debug SSL handsha..

phpMyAdmin access denied for user 'root'@'localhost' (using password: NO)

I am unable to connect to my MySQL in xampp I have this error: MySQL said: Documentation 1045 - Access denied for user 'root'@'localhost' (using password: NO) mysqli_real_connect(): (HY0..

How do I select a random value from an enumeration?

Given an arbitrary enumeration in C#, how do I select a random value? (I did not find this very basic question on SO. I'll post my answer in a minute as reference for anyone, but please feel free to ..

limit text length in php and provide 'Read more' link

I have text stored in the php variable $text. This text can be 100 or 1000 or 10000 words. As currently implemented, my page extends based on the text, but if the text is too long the page looks ugly...

JNZ & CMP Assembly Instructions

Correct me if I am wrong. This is my understanding of JNZ and CMP. JNZ - The jump WILL take place if the Z Flag is NOT zero (1) CMP - If the two values are equal, the Z Flag is set (1) otherwise it..

Configure Log4Net in web application

I have this code and the config file below: ILog log = LogManager.GetLogger(typeof(MyClass)); log.Debug("Testing"); TestProj directory is not created and if I create it, no TestLog.txt file, no log..

Setting href attribute at runtime

What is the best way to set the href attribute of the <a> tag at run time using jQuery? Also, how do you get the value of the href attribute of the <a> tag using jQuery?..

Exit from app when click button in android phonegap?

I am new to phonegap. I have prepared one sample application. My application has 2 pages, the first page has one button, when clicked the second page will open. It is working fine using the following ..

Best way to update data with a RecyclerView adapter

When I have to use a classic adapter with a ListView, I update my data in the ListView like this: myAdapter.swapArray(data); public swapArray(List<Data> data) { clear(); addAll(data); no..

How to do a subquery in LINQ?

Here's an example of the query I'm trying to convert to LINQ: SELECT * FROM Users WHERE Users.lastname LIKE '%fra%' AND Users.Id IN ( SELECT UserId FROM CompanyRolesToUsers ..

What's the best way to test SQL Server connection programmatically?

I need to develop a single routine that will be fired each 5 minutes to check if a list of SQL Servers (10 to 12) are up and running. Is there a way to simply "ping" a SQL Server from C# one..

Add string in a certain position in Python

Is there any function in Python that I can use to insert a value in a certain position of a string? Something like this: "3655879ACB6" then in position 4 add "-" to become "3655-879ACB6"..

Angular2 - Focusing a textbox on component load

I am developing a component in Angular2 (Beta 8). The component has a textbox and a dropdown. I would like to set the focus in textbox as soon as component is loaded or on change event of dropdown. Ho..

CentOS: Enabling GD Support in PHP Installation

How do I go about enabling GD Support in a CentOS Installation?..

Moq, SetupGet, Mocking a property

I'm trying to mock a class, called UserInputEntity, which contains a property called ColumnNames: (it does contain other properties, I've just simplified it for the question) namespace CsvImporter.En..

Java: String - add character n-times

Is there a simple way to add a character or another String n-times to an existing String? I couldn’t find anything in String, Stringbuilder, etc...

Java: Reading a file into an array

I have a file (called "number.txt") which I want to read to an array in Java. How exactly do I go ahead and do this? It is a straight-forward "1-dimensional" file, containing 100 numbers. The problem..

how to put image in center of html page?

Possible Duplicate: How to center div horizontally and vertically I need to put image in center of html page, both vertical and horizontal ... been trying few stuff but seems to work fine. ..

Cannot resolve symbol AppCompatActivity - Support v7 libraries aren't recognized?

I'm trying to figure out why the heck my Android studio isn't recognizing the AppCompat v7 library correctly. The import statement below shows up as gray and says there's no package for support.v7.app..

jQuery 'if .change() or .keyup()'

Using jQuery i would like to run a function when either .change() or .keyup() are raised. Something like this. if ( jQuery(':input').change() || jQuery(':input').keyup() ) { alert( 'something ha..

Get rid of "The value for annotation attribute must be a constant expression" message

I use annotation in my code, and I try to use value which determine in run time. I define my list as static final (lst), and I add to this list some elements. When I use lst.get(i), I get compilatio..

Can a normal Class implement multiple interfaces?

I know that multiple inheritances between Interfaces is possible, e.g.: public interface C extends A,B {...} //Where A, B and C are Interfaces But is it possible to have a regular Class inherit fro..

SQL Server remove milliseconds from datetime

select * from table where date > '2010-07-20 03:21:52' which I would expect to not give me any results... EXCEPT I'm getting a record with a datetime of 2010-07-20 03:21:52.577 how can I make th..

Visual studio - getting error "Metadata file 'XYZ' could not be found" after edit continue

I have stumbled into an issue that is really annoying. When I debug my software, everything runs OK, but if I hit a breakpoint and edit the code, when I try to continue running I get an error: Metadat..

Reference to a non-shared member requires an object reference occurs when calling public sub

I have a Public Class "General" in which is a Public Sub "updateDynamics". When I attempt to reference it in the code-behind for a page like so: updateDynamics(get_prospect.dynamicsID) I get the fo..

AngularJS: Basic example to use authentication in Single Page Application

I am new to AngularJS and gone through their tutorial and got a feel for it. I have a backend for my project ready where each of the REST endpoints needs to be authenticated. What I want to do a.) I..

In Tensorflow, get the names of all the Tensors in a graph

I am creating neural nets with Tensorflow and skflow; for some reason I want to get the values of some inner tensors for a given input, so I am using myClassifier.get_layer_value(input, "tensorName"),..

Java: how to convert HashMap<String, Object> to array

I need to convert a HashMap<String, Object> to an array; could anyone show me how it's done?..

Swing JLabel text change on the running application

I have a Swing window which contains a button a text box and a JLabel named as flag. According to the input after I click the button, the label should change from flag to some value. How to achieve ..

How To Remove Outline Border From Input Button

when click somewhere else the border disappears, tried onfocus none, but didn't help, how to make ugly button border disappear when click on? _x000D_ _x000D_ input[type="button"] {_x000D_ width: 12..

Handle Button click inside a row in RecyclerView

I am using following code for handling row clicks. (source) static class RecyclerTouchListener implements RecyclerView.OnItemTouchListener { private GestureDetector gestureDetector; private ..

What is HTTP "Host" header?

Given that the TCP connection is already established when the HTTP request is sent, the IP address and port are implicitly known -- a TCP connection is an IP + Port. So, why do we need the Host header..

JS map return object

I got this array, var rockets = [ { country:'Russia', launches:32 }, { country:'US', launches:23 }, { country:'China', launches:16 }, { country:'Europe(ESA)', launches:7 }, { coun..

Why catch and rethrow an exception in C#?

I'm looking at the article C# - Data Transfer Object on serializable DTOs. The article includes this piece of code: public static string SerializeDTO(DTO dto) { try { XmlSerializer xmlSe..

Validating email addresses using jQuery and regex

I'm not too sure how to do this. I need to validate email addresses using regex with something like this: [a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-..

How to get a list of MySQL views?

I'm looking for a way to list all views in a database. Initially I found and tried an answer on the MySQL forums: SELECT table_name FROM information_schema.views WHERE information_schema.views.table..

Get name of object or class

Is there any solution to get the function name of an object? function alertClassOrObject (o) { window.alert(o.objectName); //"myObj" OR "myClass" as a String } function myClass () { this.foo ..

How to get client's IP address using JavaScript?

I need to somehow retrieve the client's IP address using JavaScript; no server side code, not even SSI. However, I'm not against using a free 3rd party script/service...

Access HTTP response as string in Go

I'd like to parse the response of a web request, but I'm getting trouble accessing it as string. func main() { resp, err := http.Get("http://google.hu/") if err != nil { // handle er..

Setting default checkbox value in Objective-C?

Okay, this one's making me feel stupid... I'm a feature film editor who's recently started teaching myself Objective-C after many years away from coding. I think the last code I wrote was in Cobol, i..

Ansible: Set variable to file content

I'm using the ec2 module with ansible-playbook I want to set a variable to the contents of a file. Here's how I'm currently doing it. Var with the filename shell task to cat the file use the result..

Check if $_POST exists

I'm trying to check whether a $_POST exists and if it does, print it inside another string, if not, don't print at all. something like this: $fromPerson = '+from%3A'.$_POST['fromPerson']; function ..

Add centered text to the middle of a <hr/>-like line

I'm wondering what options one has in xhtml 1.0 strict to create a line on both sides of text like-so: Section one ----------------------- Next section ----------------------- Section two I've tho..

Is there a way to check if a file is in use?

I'm writing a program in C# that needs to repeatedly access 1 image file. Most of the time it works, but if my computer's running fast, it will try to access the file before it's been saved back to th..

How to reduce the image size without losing quality in PHP

I am trying to develop an image-based web site. I am really confused about the best image type for faster page loading speeds and best compression practices. Please advise me on the best way to compre..

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

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

How to connect Bitbucket to Jenkins properly

Since about 1 week now, Bitbucket doesn't (?) send a request to my Jenkins server. I've set it all up like this: Endpoint http://username:apitoken@jenkinshost/ username = username in Jenkins apito..

Reading a delimited string into an array in Bash

I have a variable which contains a space-delimited string: line="1 1.50 string" I want to split that string with space as a delimiter and store the result in an array, so that the following: echo ..

How to hide action bar before activity is created, and then show it again?

I need to implement splash screen in my honeycomb app. I use this code in activity's onCreate to show splash: setContentView(R.layout.splash); getActionBar().hide(); and this code to show main UI a..

Android Studio: Where is the Compiler Error Output Window?

When I 'Run' my project in Android Studio, in the 'Messages' window, I get: Gradle: FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':play01:compileDebug'. >..

Convert a Unix timestamp to time in JavaScript

I am storing time in a MySQL database as a Unix timestamp and that gets sent to some JavaScript code. How would I get just the time out of it? For example, in HH/MM/SS format...

Get first n characters of a string

How can I get the first n characters of a string in PHP? What's the fastest way to trim a string to a specific number of characters, and append '...' if needed?..

How to implement authenticated routes in React Router 4?

I was trying to implement authenticated routes but found that React Router 4 now prevents this from working: <Route exact path="/" component={Index} /> <Route path="/auth" component={Unauth..

Undo scaffolding in Rails

Is there any way to 'undo' the effects of a scaffold command in Rails?..

Best way to require all files from a directory in ruby?

What's the best way to require all files from a directory in ruby ?..

jquery simple image slideshow tutorial

Where can I find a simple jquery image slideshow tutorial for beginners from scratch (without plugins) without left and right navigation button? thank you...

Which is the fastest algorithm to find prime numbers?

Which is the fastest algorithm to find out prime numbers using C++? I have used sieve's algorithm but I still want it to be faster!..

Is there a NumPy function to return the first index of something in an array?

I know there is a method for a Python list to return the first index of something: >>> l = [1, 2, 3] >>> l.index(2) 1 Is there something like that for NumPy arrays?..

How do I use select with date condition?

In sqlserver, how do I compare dates? For example: Select * from Users where RegistrationDate >= '1/20/2009' (RegistrationDate is datetime type) Thanks..

Printing out a number in assembly language?

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

Parse string to DateTime in C#

I have date and time in a string formatted like that one: "2011-03-21 13:26" //year-month-day hour:minute How can I parse it to System.DateTime? I want to use functions like DateTime.Parse() or Da..

SQL: parse the first, middle and last name from a fullname field

How do I parse the first, middle, and last name out of a fullname field with SQL? I need to try to match up on names that are not a direct match on full name. I'd like to be able to take the full n..

What exactly is Apache Camel?

I don't understand what exactly Camel does. If you could give in 101 words an introduction to Camel: What exactly is it? How does it interact with an application written in Java? Is it something ..

What is the purpose of mvnw and mvnw.cmd files?

When I created a Spring Boot application I could see mvnw and mvnw.cmd files in the root of the project. What is the purpose of these two files?..

Difference between clustered and nonclustered index

I need to add proper index to my tables and need some help. I'm confused and need to clarify a few points: Should I use index for non-int columns? Why/why not I've read a lot about clustered and no..

Twitter Bootstrap hide css class and jQuery

I'm using the hide css class to hide a button on page load. The problem is that when i try to show the button i've previuosly hidden with jQuery the button is smaller. (the same thing doesn't happen..

merge one local branch into another local branch

I have multiple branches which are branched off the master (each in a separate subdirectory). Branch1: new development, not yet completely finished Branch2: hotfix for a problem, but still under tes..

Set transparent background of an imageview on Android

I am using a web view in which I am adding an image view. How can I set the background of this image view to transparent? I have tried this: mImageview.setBackgroundResource(R.color.trans); Where ..

Ruby String to Date Conversion

I am faced with an issue in Ruby on Rails. I am looking to convert a string of format Tue, 10 Aug 2010 01:20:19 -0400 (EDT) to a date object. Is there anyway i could do this. Here is what I've looke..

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 to configure WAMP (localhost) to send email using Gmail?

I want to use the mail() function from my localhost. I have WAMP installed and a Gmail account. I know that the SMTP for Gmail is smtp.gmail.com and the port is 465 (more info from gmail). What I need..

Relative URLs in WordPress

I've always found it frustrating in WordPress that images, files, links, etc. are inserted into WordPress with an absolute URL instead of relative URL. A relative url is much more convenient for switc..

android lollipop toolbar: how to hide/show the toolbar while scrolling?

I'm using the new toolbar widget introduced in the appcompat / support-v7. I would like to hide/show the toolbar depending on if the user is scrolling up/down the page, just like in the new Google's p..

Java Try and Catch IOException Problem

I am trying to use a bit of code I found at the bottom of this page. Here is the code in a class that I created for it: import java.io.LineNumberReader; import java.io.FileReader; import java.io.IOE..

SVG fill color transparency / alpha?

Is it possible to set a transparency or alpha level on SVG fill colours? I've tried adding two values to the fill tag (changing it from fill="#044B94" to fill="#044B9466"), but this doesn't work...

How to set CATALINA_HOME variable in windows 7?

I have downloaded apache-tomcat-7.0.35. My JDK version is jdk1.6.0_27. How do I configure CATALINA_HOME as an environment variable and how do I run Tomcat server under Windows 7?..

Where can I download mysql jdbc jar from?

I installed and tried to use jasper report studio. The first brick wall you hit when you try to create a datasource for your reports is java.lang.ClassNotFoundException: com.mysql.jdbc.Driver The ..

Sorting a DropDownList? - C#, ASP.NET

I'm curious as to the best route (more looking towards simplicity, not speed or efficiency) to sort a DropDownList in C#/ASP.NET - I've looked at a few recommendations but they aren't clicking well ..

How to set the Android progressbar's height?

My activity_main.xml is below, as you see, the height is set 40 dip. And in MyEclipse, it looks like below: But when I run it on my phone, it looks like below: So my question is why the re..

How to fetch Java version using single line command in Linux

I want to fetch the Java version in Linux in a single command. I am new to awk so I am trying something like java -version|awk '{print$3}' But that does not return the version. How would I fe..

Convert Unix timestamp into human readable date using MySQL

Is there a MySQL function which can be used to convert a Unix timestamp into a human readable date? I have one field where I save Unix times and now I want to add another field for human readable date..

Java - Abstract class to contain variables?

Is it good practice to let abstract classes define instance variables? public abstract class ExternalScript extends Script { String source; public abstract void setSource(String file); ..

Cloning an array in Javascript/Typescript

I have array of two objects: genericItems: Item[] = []; backupData: Item[] = []; I am populating my HTML table with genericItemsdata. The table is modifiable. There is a reset button to undo all ch..

PHP cURL not working - WAMP on Windows 7 64 bit

I got my WAMP installed on my windows 7 64bit. cURL is not working, but still I got it enabled from the WAMP tray. I have also uncommented extension=php_curl.dll in php.ini for both the PHP and Apach..

How do I use the Tensorboard callback of Keras?

I have built a neural network with Keras. I would visualize its data by Tensorboard, therefore I have utilized: keras.callbacks.TensorBoard(log_dir='/Graph', histogram_freq=0, ..

How do I rename the android package name?

Pressing Shift+F6 seems only to rename the last directory. For example, in the project com.example.test it will offer to rename test only. The same applies if I navigate to package name in .java or Ma..

When & why to use delegates?

I'm relatively new in C#, & I'm wondering when to use Delegates appropriately. they are widely used in events declaration, but when should I use them in my own code and why are they useful? why no..

Extending an Object in Javascript

I am currently transforming from Java to Javascript, and it's a bit hard for me to figure out how to extend objects the way I want it to do. I've seen several people on the internet use a method call..

Deserialize JSON to ArrayList<POJO> using Jackson

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

Wrap long lines in Python

How do I wrap long lines in Python without sacrificing indentation? For example: def fun(): print '{0} Here is a really long sentence with {1}'.format(3, 5) Suppose this goes over the 79 cha..

git cherry-pick says "...38c74d is a merge but no -m option was given"

I made some changes in my master branch and want to bring those upstream. when I cherry-pick the following commits however I get stuck on fd9f578 where git says: $ git cherry-pick fd9f578 fatal: Comm..

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

Bash write to file without echo?

As an exercise, does a method exist to redirect a string to a file without echo? Currently I am using echo "Hello world" > test.txt I know about cat and printf. I was thinking something like &g..

How to solve java.lang.OutOfMemoryError trouble in Android

Altough I have very small size image in drawable folder, I am getting this error from users. And I am not using any bitmap function in code. At least intentionally :) java.lang.OutOfMemoryError a..

Giving multiple URL patterns to Servlet Filter

I am using a Servlet Filter in my JSF application. I have three groups of Web pages in my application, and I want to check Authentication for these pages in my Servlet Filter: my Folders /Admin/ *...

using mailto to send email with an attachment

How can i send an email with an attachment (either local file or a file in the intranet) using outlook 2010? <a href="mailto:[email protected]?subject=my report&body=see attachment&attachment=c:..

Time in milliseconds in C

Using the following code: #include<stdio.h> #include<time.h> int main() { clock_t start, stop; int i; start = clock(); for(i=0; i<2000;i++) { printf("%d", (..

Zabbix server is not running: the information displayed may not be current

So all of a sudden, after a week of using it, I get an error message on my zabbix server gui (http://localhost/zabbix/.) The error says: Zabbix server is not running: the information displayed may n..

"X does not name a type" error in C++

I have two classes declared as below: class User { public: MyMessageBox dataMsgBox; }; class MyMessageBox { public: void sendMessage(Message *msg, User *recvr); Message receiveMessage(); vec..

How can I force Python's file.write() to use the same newline format in Windows as in Linux ("\r\n" vs. "\n")?

I have the simple code: f = open('out.txt','w') f.write('line1\n') f.write('line2') f.close() Code runs on windows and gives file size 12 bytes, and linux gives 11 bytes The reason is new line In ..

MySQL SELECT only not null values

Is it possible to do a select statement that takes only NOT NULL values? Right now I am using this: SELECT * FROM table And then I have to filter out the null values with a php loop. Is there a w..

Regex for 1 or 2 digits, optional non-alphanumeric, 2 known alphas

I've been bashing my head against the wall trying to do what should be a simple regex - I need to match, eg 12po where the 12 part could be one or two digits, then an optional non-alphanumeric like a ..

How to create JSON post to api using C#

I'm in the process of creating a C# console application which reads text from a text file, turns it into a JSON formatted string (held in a string variable), and needs to POST the JSON request to a we..

When to use margin vs padding in CSS

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

How to use activity indicator view on iPhone?

An activity indicator view is useful in many applications. Any ideas about how to add, activiate and dismiss an activity indicator view on iPhone? All the methods for this are welcomed here...

Get restaurants near my location

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

Recursively counting files in a Linux directory

How can I recursively count files in a Linux directory? I found this: find DIR_NAME -type f ¦ wc -l But when I run this it returns the following error. find: paths must precede expression: ¦..

The located assembly's manifest definition does not match the assembly reference

I am trying to run some unit tests in a C# Windows Forms application (Visual Studio 2005), and I get the following error: System.IO.FileLoadException: Could not load file or assembly 'Utility, Versio..

How to convert int to float in C?

I am trying to solve: int total=0, number=0; float percentage=0.0; percentage=(number/total)*100; printf("%.2f", percentage); If the value of the number is 50 and the total is 100, I should get 50..

Free easy way to draw graphs and charts in C++?

I am doing a little exploring simulation and I want to show the graphs to compare the performance among the algorithms during run-time. What library comes to your mind? I highly prefer those that com..

Function to Calculate a CRC16 Checksum

I'm working on a library to provide simple reliable communication over an RS232 or RS485 connection. Part of this code involves using a CRC16 checksum on the data to detect corruption from line noise..

Java converting int to hex and back again

I have the following code... int Val=-32768; String Hex=Integer.toHexString(Val); This equates to ffff8000 int FirstAttempt=Integer.parseInt(Hex,16); // Error "Invalid Int" int SecondAttempt=Integ..

Exception thrown in catch and finally clause

On a question for Java at the university, there was this snippet of code: class MyExc1 extends Exception {} class MyExc2 extends Exception {} class MyExc3 extends MyExc2 {} public class C1 { pub..

Angular HttpPromise: difference between `success`/`error` methods and `then`'s arguments

According to AngularJS doc, calls to $http return the following: Returns a promise object with the standard then method and two http specific methods: success and error. The then method takes two ..

mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead

An error occurred in script 'C:\xampp\htdocs\framework\connect.php' on line 13: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead ..

"Too many characters in character literal error"

I'm struggling with a piece of code and getting the error: Too many characters in character literal error Using C# and switch statement to iterate through a string buffer and reading tokens, but get..

Concatenating strings doesn't work as expected

I know it is a common issue, but looking for references and other material I don't find a clear answer to this question. Consider the following code: #include <string> // ... // in a method s..

Checkout one file from Subversion

"It is not possible to check out a single file. The finest level of checkouts you can do is at the directory level." How do I get around this issue when using Subversion? We have this folder in Subv..

Excel VBA Run-time error '424': Object Required when trying to copy TextBox

I'm attempting to copy the contents of a text box from one workbook to another. I have no problem copying cell values from the first workbook to the 2nd, but I get an object required error when I att..

Can't start Eclipse - Java was started but returned exit code=13

I am trying to get my first taste of Android development using Eclipse. I ran into this problem when trying to run Eclipse, having installed version 4.2 only minutes ago. After first trying to start ..

Keyboard shortcuts are not active in Visual Studio with Resharper installed

I have Visual Studio 2012 + Resharper 7.1.1000.900 + StyleCop 4.7.44 installed. The problem is that no shortcuts are active since Resharper was installed. For example: I can rename via 'Refactor > ..

Python dictionary: Get list of values for list of keys

Is there a built-in/quick way to use a list of keys to a dictionary to get a list of corresponding items? For instance I have: >>> mydict = {'one': 1, 'two': 2, 'three': 3} >>> myk..

Angular 2 Cannot find control with unspecified name attribute on formArrays

I am trying to iterate over a formArray in my component but I get the following error Error: Cannot find control with unspecified name attribute Here is what the logic looks like on my class file ..

cordova run with ios error .. Error code 65 for command: xcodebuild with args:

This error occur only when I try to cordova run ios --device Even after cordova build ios command executed, non error is reported. Whats I do wrong? And how to debug cordova projects on my iPhone (n..

Show "loading" animation on button click

I want to do something very simple. I have one button in my page. <form action="/process" method="POST"> <input class="btn btn-large btn-primary" type="submit" value='Analyze Topics'> ..

Java dynamic array sizes?

I have a class - xClass, that I want to load into an array of xClass so I the declaration: xClass mysclass[] = new xClass[10]; myclass[0] = new xClass(); myclass[9] = new xClass(); However, I don'..

How to pip or easy_install tkinter on Windows

My Idle is throwing errors that and says tkinter can't be imported. Is there a simple way to install tkinter via pip or easy_install? There seem to be a lot of package names flying around for this... ..

Phonegap + jQuery Mobile, real world sample or tutorial

Does anyone know of a really good tutorial or sample project where Phonegap and jQuery Mobile is used for a real world example? All the examples I found were showing fancy transitions or theming in j..

else & elif statements not working in Python

I'm a newbie to Python and currently learning Control Flow commands like if, else, etc. The if statement is working all fine, but when I write else or elif commands, the interpreter gives me a synta..

Remove from the beginning of std::vector

I have a vector of the following data structure struct Rule { int m_id = -1; std::wstring name; double angle; }; std::vector<Rule>& topPriorityRules; and I am..

How to delete a specific file from folder using asp.net

here's the deal I got a datagridviewer which is called gridview1 and a fileupload1 when i upload a file it updates the gridview1 and table in database with the file name and path and stores the said f..

Rails 3: I want to list all paths defined in my rails application

I want to list all defined helper path functions (that are created from routes) in my rails 3 application, if that is possible. Thanks,..

importing jar libraries into android-studio

android-studio 0.2.7 Fedora 18 Hello, I am trying to add the jtwitter jar to my project. First I tried doing the following: 1) Drag the jtwitter.jar into the root directory of my project explorer..

Get PHP class property by string

How do I get a property in a PHP based on a string? I'll call it magic. So what is magic? $obj->Name = 'something'; $get = $obj->Name; would be like... magic($obj, 'Name', 'something'); $get..

How can I get two form fields side-by-side, with each field’s label above the field, in CSS?

I am stuck on figuring out some css, I need a section of my form to look like the following, I have tried every variation I can think of, I have given the labels a fixed width and floated them l..

proper hibernate annotation for byte[]

I have an application using hibernate 3.1 and JPA annotations. It has a few objects with byte[] attributes (1k - 200k in size). It uses the JPA @Lob annotation, and hibernate 3.1 can read these just..