Questions Tagged with #Summary

How to analyze a JMeter summary report?

I get the following result when I run a load test. Can any one help me to read the report? the number of thread = '500 ' ramp up period = '1' Sample = '500' Avg = '20917' min ..

Read all files in a folder and apply a function to each data frame

I am doing a relatively simple piece of analysis which I have put into a function, on all the files in a particular folder. I was wondering whether anyone had any tips to help me automate the process..

At runtime, find all classes in a Java application that extend a base class

I want to do something like this: List<Animal> animals = new ArrayList<Animal>(); for( Class c: list_of_all_classes_available_to_my_app() ) if (c is Animal) animals.add( new c()..

Object array initialization without default constructor

#include <iostream> class Car { private: Car(){}; int _no; public: Car(int no) { _no=no; } void printNo() { std::cout<<_no<<std::endl; } }; void printCarNumbe..

Which HTTP methods match up to which CRUD methods?

In RESTful style programming, we should use HTTP methods as our building blocks. I'm a little confused though which methods match up to the classic CRUD methods. GET/Read and DELETE/Delete are obvious..

How do I get the last word in each line with bash

For example i have a file: $ cat file i am the first example. i am the second line. i do a question about a file. and i need: example, line, file i intent with "awk" but the problem is that t..

MS SQL Date Only Without Time

Question Hello All, I've had some confusion for quite some time with essentially flooring a DateTime SQL type using T-SQL. Essentially, I want to take a DateTime value of say 2008-12-1 14:30:12 and..

TypeError: 'dict_keys' object does not support indexing

def shuffle(self, x, random=None, int=int): """x, random=random.random -> shuffle list x in place; return None. Optional arg random is a 0-argument function returning a random float in..

Creating random colour in Java?

I want to draw random coloured points on a JPanel in a Java application. Is there any method to create random colours?..

on change event for file input element

I have 4 file inputs that I want them trigger upload proccess when their value is changed. I mean when you select a picture and click open on select image dialog, the script to upload the picture be t..

Laravel: Error [PDOException]: Could not Find Driver in PostgreSQL

I'm trying to connect with PostgreSQL database through Laravel in order to do a php artisan migrate but doesn't seem to be directed since it's reading the database name of MySQL. Here are the comman..

Abstract variables in Java?

I am coming from c# where this was easy, and possible. I have this code: public abstract class clsAbstractTable { public abstract String TAG; public abstract void init(); } but Eclipse t..

What's the best way to trim std::string?

I'm currently using the following code to right-trim all the std::strings in my programs: std::string s; s.erase(s.find_last_not_of(" \n\r\t")+1); It works fine, but I wonder if there are some end-..

INNER JOIN vs INNER JOIN (SELECT . FROM)

Is there any difference in terms of performance between these two versions of the same query? --Version 1 SELECT p.Name, s.OrderQty FROM Product p INNER JOIN SalesOrderDetail s on p.ProductID = s.Pro..

WCF Service Client: The content type text/html; charset=utf-8 of the response message does not match the content type of the binding

I've got a WCF Service running on my local IIS server. I've added it as a service reference to a C# Website Project and it adds fine and generates the proxy classes automatically. However, when I try..

Connect to mysql on Amazon EC2 from a remote server

I want to connect to db on EC2 from my local machine, I am not able to do and have tried everything- I am using this command to connect to EC2: mysql -uUSERNAME -hEC2_IP -pPASSWORD This error is g..

How to find the unclosed div tag

A unclosed div problem almost make me crazy. It is very difficult to track especially when the page is long and complex. Any suggestions?..

Android Fragment handle back button press

I have some fragments in my activity [1], [2], [3], [4], [5], [6] And on Back Button Press I must to return from [2] to [1] if current active fragment is [2], or do nothing otherwise. What is the ..

What does the Java assert keyword do, and when should it be used?

What are some real life examples to understand the key role of assertions?..

Custom designing EditText

I have custom designed EditText search_page.xml <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:p..

Keyboard shortcut for Jump to Previous View Location (Navigate back/forward) in IntelliJ IDEA

I know Ctrl+Shift+Backspace is used to go to the location of the last edit. But I want to jump to whichever location I was most recently at, not necessarily one where I edited anything. For example,..

How can I get the first two digits of a number?

I want to check the first two digits of a number in Python. Something like this: for i in range(1000): if(first two digits of i == 15): print("15") elif(first two digits of i == 16)..

Close Android Application

Please suggest how I may close my whole Android Application with one line code...

IF...THEN...ELSE using XML

I have a program that uses XML formatted rules to create executable code for run-time. I have to define some actions and logical constructs using my own dialect. I have OR, AND, and NOT constructs and..

JSON and XML comparison

I want to know which is faster: XML and JSON? When to use which one ?..

HTML form with side by side input fields

I have a html form that is basically vertical but i really have no idea how to make two text fields on the same line. For example the following form below i want the First and Last name on the same li..

Best way to get the max value in a Spark dataframe column

I'm trying to figure out the best way to get the largest value in a Spark dataframe column. Consider the following example: df = spark.createDataFrame([(1., 4.), (2., 5.), (3., 6.)], ["A", "B"]) df...

How to change ViewPager's page?

I'm using ViewPager in my app and define it in the main Activity. Inside onCreate method I load some number of pages from SharedPreferences and then pass it to PagerAdapter: @Override public int getC..

AWS Lambda import module error in python

I am creating a AWS Lambda python deployment package. I am using one external dependency requests . I installed the external dependency using the AWS documentation http://docs.aws.amazon.com/lambda/la..

How to flip background image using CSS?

How to flip any background image using CSS? Is it possible? currenty I'm using this arrow image in a background-image of li in css On :visited I need to flip this arrow horizontally. I can do this..

Python Graph Library

I'm writing a python application that will make heavy use of a graph data structure. Nothing horribly complex, but I'm thinking some sort of graph/graph-algorithms library would help me out. I've goog..

How to use log4net in Asp.net core 2.0

I configure log4net in my asp.net core 2.0 application as mentioned in this article LINK program.cs public static void Main(string[] args) { var logRepository = LogManager.GetRepository(Assembl..

Determining the path that a yum package installed to

I've installed ffmpeg using yum under Redhat, and I'm having difficulty figuring out where (what path) it installed the package to. Is there an easy way of determining this without resorting to findin..

Changing cursor to waiting in javascript/jquery

How would i get my cursor to change to this loading icon when a function is called and how would i change it back to a normal cursor in javascript/jquery..

How to break a while loop from an if condition inside the while loop?

I want to break a while loop of the format below which has an if statement. If that if statement is true, the while loop also must break. Any help would be appreciated. while(something.hasnext()) { ..

MIN and MAX in C

Where are MIN and MAX defined in C, if at all? What is the best way to implement these, as generically and type safely as possible? (Compiler extensions/builtins for mainstream compilers preferred.)..

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

How can I close a window with Javascript on Mozilla Firefox 3?

I need to close the tab which displays my webpage, by the click of a button. But firefox does not allow to close the window by javascript as long as it is not opened by javascript. If I set the value ..

How to sort a dataframe by multiple column(s)

I want to sort a data.frame by multiple columns. For example, with the data.frame below I would like to sort by column z (descending) then by column b (ascending): dd <- data.frame(b = factor(c("..

Heap space out of memory

My application currently consumes quite a lot of memory because it is running physics simulations. The issue is that consistently, at the 51st simulation, Java will throw an error usually because of a..

Populating a ComboBox using C#

I would like to populate a combobox with the following: Visible item / Item Value English / En Italian / It Spainish / Sp etc.... Any help please? Also it is possible that after populating th..

@HostBinding and @HostListener: what do they do and what are they for?

In my meanderings around the world wide interweb, and now especially the angular.io style docs, I find many references to @HostBinding and @HostListener. It seems they are quite fundamental, but unfor..

What is the difference between ports 465 and 587?

These ports 465 and 587 are both used for sending mail (submitting mail) but what is the real difference between them? ..

TSQL: How to convert local time to UTC? (SQL Server 2008)

We are dealing with an application that needs to handle global time data from different time zones and daylight savings time settings. The idea is to store everything in UTC format internally and only..

Using Java 8 to convert a list of objects into a string obtained from the toString() method

There are a lot of useful new things in Java 8. E.g., I can iterate with a stream over a list of objects and then sum the values from a specific field of the Object's instances. E.g. public class ACl..

What does "int 0x80" mean in assembly code?

Can someone explain what the following assembly code does? int 0x80 ..

Apple Mach-O Linker Error when compiling for device

I've just upgraded to xcode 4.0 and I can no longer deploy to iPhone, I get a Apple Mach-O Linker Error, it still works for the simulator though. Ld /Users/yveswheeler/Library/Developer/Xcode/Der..

Authentication failed to bitbucket

I'm trying to push my project via the https protocol on bitbucket using sourcetree. But I can't connect to bitbucket with my login and password (which work on the website), I have a fatal error : "Aut..

Change Select List Option background colour on hover in html

Is it possible to change the default background color of the select list option on hover? HTML: <select id="select"> <option value="1">One</option> <option value="2">..

Create Test Class in IntelliJ

I'm working within the traditional Maven Java project structure inside IntelliJ, e.g. main/java/com/x/y test/java/com/x/y When I create a class called Foo in main/java/com/x/y using IntelliJ I woul..

how to get the current working directory's absolute path from irb

I'm running Ruby on Windows though I don't know if that should make a difference. All I want to do is get the current working directory's absolute path. Is this possible from irb? Apparently from a..

How do I perform HTML decoding/encoding using Python/Django?

I have a string that is HTML encoded: '''&lt;img class=&quot;size-medium wp-image-113&quot;\ style=&quot;margin-left: 15px;&quot; title=&quot;su1&quot;\ src=&quot;h..

Using Gulp to Concatenate and Uglify files

I'm trying to use Gulp to: Take 3 specific javascript files, concatenate them, then save the result to a file (concat.js) Take this concatenated file and uglify/minify it, then save the result to an..

How can I make this try_files directive work?

I am trying to understand how Nginx's try_files directive works. Nginx is running on my server and serving up the default page located at /usr/share/nginx/html/index.html. However, I have a simple HT..

Modifying the "Path to executable" of a windows service

I'd like to modify the path to my application, but doing so breaks it because the service still points to the old location. By going to Administrative Tools > Services you can open a properties d..

Nodejs send file in response

Expressjs framework has a sendfile() method. How can I do that without using a whole framework. I am using node-native-zip to create an archive and I want to send that to the user...

Remove numbers from string sql server

I have a large database in which I want to do a part string search. The user will enter characters: JoeBloggs. For arguments sake if I had a name Joe 23 Blo Ggs 4 in the database. I want to remove ev..

time.sleep -- sleeps thread or process?

In Python for *nix, does time.sleep() block the thread or the process?..

Reverse a string without using reversed() or [::-1]?

I came across a strange Codecademy exercise that required a function that would take a string as input and return it in reverse order. The only problem was you could not use the reversed method or the..

Accessing AppDelegate from framework?

I'm creating my first framework in Objective-C that wraps the facebook SDK in a more intuitive way. There are several points in my framework where I'd like to reference the AppDelegate, but there is n..

Do you have to put Task.Run in a method to make it async?

I'm trying to understand async await in the simplest form. I want to create a very simple method that adds two numbers for the sake of this example, granted, it's no processing time at all, it's just..

Python 'If not' syntax

I'm a bit confused about how/why so many python developers use if not in their conditional statements. for example, lets say we had a function, def foo(bar = None): if not bar: bar = 2..

Can you split a stream into two streams?

I have a data set represented by a Java 8 stream: Stream<T> stream = ...; I can see how to filter it to get a random subset - for example Random r = new Random(); PrimitiveIterator.OfInt coi..

Access to file download dialog in Firefox

Is there any kind of API that can allow me to manipulate a file download dialog in Firefox? (I want to access the one that appears when user does something, not initiate one myself). What I want to d..

Replace deprecated preg_replace /e with preg_replace_callback

$result = preg_replace( "/\{([<>])([a-zA-Z0-9_]*)(\?{0,1})([a-zA-Z0-9_]*)\}(.*)\{\\1\/\\2\}/iseU", "CallFunction('\\1','\\2','\\3','\\4','\\5')", $result ); The above code gives a..

How to populate a dropdownlist with json data in jquery?

I am developing a country state cascading dropdown list... I returned json result based on countryId but I don't know how to populate/fill it in a new dropdown listbox... Here is what I am using, fu..

select2 - hiding the search box

For my more significant selects, the search box in Select2 is wonderful. However, in one instance, I have a simple selection of 4 hard-coded choices. In this case, the search box is superfluous and lo..

Use ssh from Windows command prompt

Question: How to use ssh & scp from the Windows command prompt? I remember I installed a program in the past that let me do this but can't remember now what it was. Note: I do not want to use p..

ASP.NET Core Identity - get current user

To get the currently logged in user in MVC5, all we had to do was: using Microsoft.AspNet.Identity; [Authorize] public IHttpActionResult DoSomething() { string currentUserId = User.Identity.GetUs..

How to initialise memory with new operator in C++?

I'm just beginning to get into C++ and I want to pick up some good habits. If I have just allocated an array of type int with the new operator, how can I initialise them all to 0 without looping throu..

Why can't I make a vector of references?

When I do this: std::vector<int> hello; Everything works great. However, when I make it a vector of references instead: std::vector<int &> hello; I get horrible errors like ..

How to solve SyntaxError on autogenerated manage.py?

I'm following the Django tutorial https://docs.djangoproject.com/es/1.10/intro/tutorial01/ I've created a "mysite" dummy project (my very first one) and try to test it without altering it. django-a..

How does bitshifting work in Java?

I have this statement: Assume the bit value of byte x is 00101011. what is the result of x>>2? How can I program it and can someone explain me what is doing?..

When to use AtomicReference in Java?

When do we use AtomicReference? Is it needed to create objects in all multithreaded programs? Provide a simple example where AtomicReference should be used...

How do I drop a foreign key in SQL Server?

I have created a foreign key (in SQL Server) by: alter table company add CountryID varchar(3); alter table company add constraint Company_CountryID_FK foreign key(CountryID) references Country; I ..

RabbitMQ / AMQP: single queue, multiple consumers for same message?

I am just starting to use RabbitMQ and AMQP in general. I have a queue of messages I have multiple consumers, which I would like to do different things with the same message. Most of the RabbitMQ..

PHP call Class method / function

How can I call following Class method or function? Let say I have this params get from url: $var = filter($_GET['params']); Class: class Functions{ public function filter($data){ $da..

How to show/hide JPanels in a JFrame?

The application I am developing is a game. What I want to do is have JPanels that appear in the JFrame, like a text or message window, and then disappear when they are no longer used. I have designe..

Where is Python language used?

I am a web developer and usually use PHP, JavaScript or MySQL. I have heard lot about Python. But I have no idea where it is used and why it is used. Just like PHP, ASP, ColdFusion, .NET are used to..

PHP: How to handle <![CDATA[ with SimpleXMLElement?

I noticed that when using SimpleXMLElement on a document that contains those CDATA tags, the content is always NULL. How do I fix this? Also, sorry for spamming about XML here. I have been trying to ..

Hibernate table not mapped error in HQL query

I have a web application that use Hibernate to make CRUD operations over a database. I got an error saying that the table is not mapped. See the Java files: Error message: org.springframework.orm.hi..

How to Ping External IP from Java Android

I am developing a Ping application for Android 2.2. I try my code and it works, but only in local IPs, that's my problem I want to do ping to external servers too. Here is my code: private OnClic..

for each inside a for each - Java

for (Tweet tweet : tweets) { for(long forId : idFromArray){ long tweetId = tweet.getId(); if(forId != tweetId){ String twitterString = tweet.getText(); ..

How to add bootstrap in angular 6 project?

I have tried to add styles dependency in angular.json package but showing that the module not found. adding two of the bootstrap files. here is the screenshot of both the files the angular.json..

Android global variable

How can I create global variable keep remain values around the life cycle of the application regardless which activity running...

Difference between number and integer datatype in oracle dictionary views

I used oracle dictionary views to find out column differences if any between two schema's. While syncing data type discrepancies I found that both NUMBER and INTEGER data types stored in all_tab_colum..

Change name of folder when cloning from GitHub?

When I clone something from Github, it creates a folder with the same name as the app on my computer. Is there a way to change the name? For example, doing this clone creates a long "sign-in-with..

Difference between Ctrl+Shift+F and Ctrl+I in Eclipse

I have been used Ctrl+Shift+F to correct indentation but I heard there is another shortcut to do that: Ctrl+I According a reference found in google, Ctrl+Shift+F is Reformat and Ctrl+I is Correct ind..

Simple and clean way to convert JSON string to Object in Swift

I have been searching for days to convert a fairly simple JSON string to an object type in Swift but with no avail. Here is the code for web service call: func GetAllBusiness() { Alamofire..

How to extract a string using JavaScript Regex?

I'm trying to extract a substring from a file with JavaScript Regex. Here is a slice from the file : DATE:20091201T220000 SUMMARY:Dad's birthday the field I want to extract is "Summary". Here is th..

TypeError: p.easing[this.easing] is not a function

When trying to show a div element with jQuery, i got this error: [23:50:35.971] TypeError: p.easing[this.easing] is not a function @ file:///D:/html5%20puzzle/jquery.js:2 The relevant function is t..

Check whether a string is not null and not empty

How can I check whether a string is not null and not empty? public void doStuff(String str) { if (str != null && str != "**here I want to check the 'str' is empty or not**") { ..

How to switch between frames in Selenium WebDriver using Java

I am using java with WebDriver.I have to switch between two frames. I have recorded the test case in selenium IDE and in that I got the values as selectFrame relative=top select Frame=middle Frame Bu..

Python Anaconda - How to Safely Uninstall

I installed Python Anaconda on Mac (OS Mavericks). I wanted to revert to the default version of Python on my Mac. What's the best way to do this? Should I delete the ~/anaconda directory? Any other ch..

How to check if an Object is a Collection Type in Java?

By using java reflection, we can easily know if an object is an array. What's the easiest way to tell if an object is a collection(Set,List,Map,Vector...)?..

Write-back vs Write-Through caching?

My understanding is that the main difference between the two methods is that in "write-through" method data is written to the main memory through the cache immediately, while in "write-back" data is w..

How to get a vCard (.vcf file) into Android contacts from website

I'm trying to add a vCard from a web link to the user's contact list on Android 2.2. When I direct the user to .vcf file, all I get is text output in the mobile browser. I have confirmed that the fi..

IE throws JavaScript Error: The value of the property 'googleMapsQuery' is null or undefined, not a Function object (works in other browsers)

I'm having a real problem with JavaScript scope in IE 9. This is inside the body of my document (yes, I realize script should go in the head for proper HTML, but I've never had it break a script befo..

How to read from standard input in the console?

I would like to read standard input from the command line, but my attempts have ended with the program exiting before I'm prompted for input. I'm looking for the equivalent of Console.ReadLine() in C#..

Get 2 Digit Number For The Month

I have an integer column "Month" I would like to get 2 digit number for month. This is what I have tried: DATEPART(mm, @Date) It returns one digit for months January to September I am using SQL Serv..

What's the reason I can't create generic array types in Java?

What's the reason why Java doesn't allow us to do private T[] elements = new T[initialCapacity]; I could understand .NET didn't allow us to do that, as in .NET you have value types that at run-time..

header('HTTP/1.0 404 Not Found'); not doing anything

I have a 404.php file in my site's main directory and I was using header('Location: 404.php'); for a while until someone said that you should use header('HTTP/1.0 404 Not Found'); instead. So I replac..

Why does IE9 switch to compatibility mode on my website?

I have just installed IE9 beta and on a specific site I created (HTML5) IE9 jumps to compatibility mode unless I manually tell it not to. I have tried removing several parts of the website but no chan..

Browser back button handling

I am trying to handle browser back button event but i could not find any solution. I want to ask user if he clicks on browser back button using "confirm box" if he chooses ok i have to allow back bu..

Android: how to get the current day of the week (Monday, etc...) in the user's language?

I want to know what the current day of the week is (Monday, Tuesday...) in the user's local language. For example, "Lundi" "Mardi" etc... if the user is French. I have read this post, it but it only..

How do I resolve ClassNotFoundException?

I am trying to run a Java application, but getting this error: java.lang.ClassNotFoundException: After the colon comes the location of the class that is missing. However, I know that that location..

$(form).ajaxSubmit is not a function

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

How to view .img files?

I'm trying find software to view the .img files.But its not expected. .img file its not all images, it contains some values too.So i would like to view the .img file.Please advise any software like th..

How to use SQL LIKE condition with multiple values in PostgreSQL?

Is there any shorter way to look for multiple matches: SELECT * from table WHERE column LIKE "AAA%" OR column LIKE "BBB%" OR column LIKE "CCC%" This questions applies to PostgreSQL 9..

Sending data back to the Main Activity in Android

I have two activities: main activity and child activity. When I press a button in the main activity, the child activity is launched. Now I want to send some data back to the main screen. I used the ..

Preloading images with JavaScript

Is the function I wrote below enough to preload images in most, if not all, browsers commonly used today? function preloadImage(url) { var img=new Image(); img.src=url; } I have an array of..

Fixed digits after decimal with f-strings

Is there an easy way with Python f-strings to fix the number of digits after the decimal point? (Specifically f-strings, not other string formatting options like .format or %) For example, let's say ..

html/css buttons that scroll down to different div sections on a webpage

Can someone help me I'm searching for css/html code example: I have a webpage with 3 buttons(top, middle, bottom) each specified to 1 div section on my page, lets say my first div section is in the m..

How to get form input array into PHP array

I have a form like the one below which is posted to contacts.php, and the user can dynamically add more with jquery. <input type="text" name="name[]" /> <input type="text" name="email[]" /&g..

Practical uses of different data structures

There's a lot of talk about data structures, but I can't find a simple list of data structures and their practical use out there. I'm trying to study for an interview and I think this would help me o..

Using Rsync include and exclude options to include directory and file by pattern

I'm having problems getting my rsync syntax right and I'm wondering if my scenario can actually be handled with rsync. First, I've confirmed that rsync is working just fine between my local host and m..

Error:Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException

Error:Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_40\bin..

Docker: unable to prepare context: unable to evaluate symlinks in Dockerfile path: GetFileAttributesEx

I just downloaded Docker Toolbox for Windows 10 64bit today. I'm going through the tutorial. I'm receving the following error when trying to build an image using a Dockerfile. Steps: Launched Doc..

Assert equals between 2 Lists in Junit

How can I make an equality assertion between lists in a JUnit test case? Equality should be between the content of the list. For example: List<String> numbers = Arrays.asList("one", "two", "th..

Count immediate child div elements using jQuery

I have the following HTML node structure: <div id="foo"> <div id="bar"></div> <div id="baz"> <div id="biz"></div> </div> <span></span>..

Counting the Number of keywords in a dictionary in python

I have a list of words in a dictionary with the value = the repetition of the keyword but I only want a list of distinct words so I wanted to count the number of keywords. Is there a way to count the ..

Read/Write String from/to a File in Android

I want to save a file to the internal storage by getting the text inputted from EditText. Then I want the same file to return the inputted text in String form and save it to another String which is to..

jQuery - Follow the cursor with a DIV

How can I use jQuery to follow the cursor with a DIV?..

Simple pthread! C++

I have no idea why this doesn't work #include <iostream> #include <pthread.h> using namespace std; void *print_message(){ cout << "Threading\n"; } int main() { pthread..

Disabling radio buttons with jQuery

I'm trying to disable these radio buttons when a the loadActive link is clicked but for some reason it only disables the first in the order and then skips the rest. <form id="chatTickets" method="..

How to split a file into equal parts, without breaking individual lines?

I was wondering if it was possible to split a file into equal parts (edit: = all equal except for the last), without breaking the line? Using the split command in Unix, lines may be broken in half. Is..

How do I make a file:// hyperlink that works in both IE and Firefox?

In my documentation web pages, I often need to provide links to locations, files and applications (.xbap) stored on the intranet. In IE, this works fine with URLs formatted like this: <a href="f..

Python initializing a list of lists

Possible Duplicate: List of lists changes reflected across sublists unexpectedly I intend to initialize a list of list with length of n. x = [[]] * n However, this somehow links the lists together..

How to open a txt file and read numbers in Java

How can I open a .txt file and read numbers separated by enters or spaces into an array list?..

Today`s date in an excel macro

I am trying to add a today`s date to column A in sheet2 each time my macro paste my selection of sheet1 in column B of the new row of the sheet2. My script work to add the new row and paste my selec..

Java - using System.getProperty("user.dir") to get the home directory

I was wondering if using: System.getProperty("user.dir"); to get the absolute path of a folder is the best way to go about it? I am looking to pass my application onto other computers and I need a ..

Validate email address textbox using JavaScript

I have a requirement to validate an email address entered when a user comes out from the textbox. I have googled for this but I got form validation JScript; I don't want form validation. I want textb..

Android background music service

I am developing an entertainment app in android. I want to play background music, and I want to use service for that. App have 3 activities and music must be played across all activities. Also, when a..

How to parse my json string in C#(4.0)using Newtonsoft.Json package?

I am new to JSON.In my asp.net application i want to parse the json string.So, i have used Newtonsoft.Json package for reading and writing json data.Now, i can able to parse the simple json data.But n..

How can I access each element of a pair in a pair list?

I have a list called pairs. pairs = [("a", 1), ("b", 2), ("c", 3)] And I can access elements as: for x in pairs: print x which gives output like: ('a', 1) ('b', 2) ('c', 3) But I want to ..

How to change active class while click to another link in bootstrap use jquery?

I have a html as sidebar, and use Bootstrap. <ul class="nav nav-list"> <li class="active"><a href="/">Link 1</a></li> <li><a href="/link2">Link 2<..

How do I download the Android SDK without downloading Android Studio?

As of the moment, I am running a Windows 8.1 PC that does not have the storage or the RAM for a IDE like Android Studio or Eclipse. I want to download the Android SDK tools, without the IDE. How can t..

Display image as grayscale using matplotlib

I'm trying to display a grayscale image using matplotlib.pyplot.imshow(). My problem is that the grayscale image is displayed as a colormap. I need the grayscale because I want to draw on top of the..

Check if an array item is set in JS

I've got an array var assoc_pagine = new Array(); assoc_pagine["home"]=0; assoc_pagine["about"]=1; assoc_pagine["work"]=2; I tried if (assoc_pagine[var] != "undefined") { bu..

Check number of arguments passed to a Bash script

I would like my Bash script to print an error message if the required argument count is not met. I tried the following code: #!/bin/bash echo Script name: $0 echo $# arguments if [$# -ne 1]; t..

How do you know a variable type in java?

Let's say I declare a variable: String a = "test"; And I want to know what type it is, i.e., the output should be java.lang.String How do I do this?..

JavaScript console.log causes error: "Synchronous XMLHttpRequest on the main thread is deprecated..."

I have been adding logs to the console to check the status of different variables without using the Firefox debugger. However, in many places in which I add a console.log in my main.js file, I recei..

Angular2 If ngModel is used within a form tag, either the name attribute must be set or the form

I am getting this error from Angular 2 core.umd.js:5995 EXCEPTION: Uncaught (in promise): Error: Error in app/model_exposure_currencies/model_exposure_currencies.component.html:57:18 caused by: If ng..

Guzzle 6: no more json() method for responses

Previously in Guzzle 5.3: $response = $client->get('http://httpbin.org/get'); $array = $response->json(); // Yoohoo var_dump($array[0]['origin']); I could easily get a PHP array from a JSON r..

unix sort descending order

I want to sort a tab limited file in descending order according to the 5th field of the records. I tried sort -r -k5n filename But it didn't work...

How to uninstall a Windows Service when there is no executable for it left on the system?

How do I uninstall a Windows Service when there is no executable for it left on the system? I can not run installutil -u since there is not executable left on the system. I can still see an entry for ..

Compare two MySQL databases

I'm currently developing an application using a MySQL database. The database-structure is still in flux and changes while development progresses (I change my local copy, leaving the one on the test-s..

Invoking a jQuery function after .each() has completed

In jQuery, is it possible to invoke a callback or trigger an event after an invocation of .each() (or any other type of iterative callback) has completed. For example, I would like this "fade and rem..

Cannot open include file: 'unistd.h': No such file or directory

After having installed libpng into my computer, I've included it into my project using #include <png.h> on a Windows 7 SP1 plateform and using Visual Studio Ultimate 2013. But at build time, I'..

How to set a default entity property value with Hibernate

How do I set a default value in Hibernate field?..

How to create checkbox inside dropdown?

I want to create a multiple selection dropbox list. Actually I have to select more than one option using a dropdown menu. When I simply do this as shown bellow: <select> <option><inpu..

How to change webservice url endpoint?

I generated a web-service client using JBoss utils (JAX-WS compatible) using Eclipse 'web service client from a wsdl'. So, the only thing I provided was a url to a web-service WSDL. Now, the web ser..

How can I rollback an UPDATE query in SQL server 2005?

How can I rollback an UPDATE query in SQL server 2005? I need to do this in SQL, not through code...

How to pause javascript code execution for 2 seconds

I want to stop execution for 2 seconds. So is this, but now follows a code block: <html> <head> <title> HW 10.12 </title> <script type="text/javascript"> ..

How long do browsers cache HTTP 301s?

I am debugging a problem with a HTTP 301 Permanent Redirect. After a quick test, it seems that Safari clears its cache of 301s when it is restarted, but Firefox does not. When do IE, Chrome, Firefox ..

Make TextBox uneditable

I want to make some TextBoxes on my form uneditable, but I want the text to be clear (black not gray) and that's why I do not want to use myTextBox.Enabled = false; Somehow I want it to be disable..

How do I auto-resize an image to fit a 'div' container?

How do you auto-resize a large image so that it will fit into a smaller width div container whilst maintaining its width:height ratio? Example: stackoverflow.com - when an image is inserted onto th..

What's the UIScrollView contentInset property for?

Can someone explain to me what the contentInset property in a UIScrollView instance is used for? And maybe provide an example?..

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

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

Gradle project refresh failed after Android Studio update

Here's the output: 11:57:04 AM Gradle 'KeddreaderProject' project refresh failed: Cause: org.gradle.internal.service.ServiceLocator.([Ljava/lang/ClassLoader;)V: I've tried to remove .gradle fo..

How can I combine hashes in Perl?

What is the best way to combine both hashes into %hash1? I always know that %hash2 and %hash1 always have unique keys. I would also prefer a single line of code if possible. $hash1{'1'} = 'red'; ..

Function or sub to add new row and data to table

I want to create a Sub that basically allows me to target an Excel table with a specific name and then insert a new row at the bottom and add data to that row at the same time. Then exit the sub. And ..

Mongoose, update values in array of objects

Is there a way to update values in an object? { _id: 1, name: 'John Smith', items: [{ id: 1, name: 'item 1', value: 'one' },{ id: 2, name: 'item 2', value: 'two'..

Get the cartesian product of a series of lists?

How can I get the Cartesian product (every possible combination of values) from a group of lists? Input: somelists = [ [1, 2, 3], ['a', 'b'], [4, 5] ] Desired output: [(1, 'a', 4), (1, ..

Capturing a single image from my webcam in Java or Python

I want to capture a single image from my webcam and save it to disk. I want to do this in Java or Python (preferably Java). I want something that will work on both 64-bit Win7 and 32-bit Linux. EDI..

Functions that return a function

I'm stuck with this concept of 'Functions that return functions'. I'm referring the book 'Object Oriented Javascript' by Stoyan Stefanov. Snippet One: _x000D_ _x000D_ function a() {_x000D_ ..

sorting a vector of structs

I have a vector<data> info where data is defined as: struct data{ string word; int number; }; I need to sort info by the length of the word strings. Is there a quick and simple way to..

How to get margin value of a div in plain JavaScript?

I can get height in jQuery with $(item).outerHeight(true); but how do I with JS? I can get the height of the li with document.getElementById(item).offsetHeight but i will always get "" when I..

How to resolve conflicts in EGit

I am using EGit on Eclipse v4.3 (Kepler). I want to commit and push my changes. I do a pull first and one file is conflicting. After manually resolving the conflict (local and remote are the same..

How to get element by innerText

How to get tag in html page, if I know what text tag contains. E.g.: <a ...>SearchingText</a> ..

Incrementing a date in JavaScript

I need to increment a date value by one day in JavaScript. For example, I have a date value 2010-09-11 and I need to store the date of the next day in a JavaScript variable. How can I increment a da..

CMake: Print out all accessible variables in a script

I'm wondering if there is a way to print out all accessible variables in CMake. I'm not interested in the CMake variables - as in the --help-variables option. I'm talking about my variables that I def..

Can't accept license agreement Android SDK Platform 24

I'm getting the following error when trying to install an android platform on a Cordova project. I've been following this guide: https://cordova.apache.org/docs/en/latest/guide/cli/ Error occurs when..

Converting a String to DateTime

How do you convert a string such as 2009-05-08 14:40:52,531 into a DateTime?..

Readably print out a python dict() sorted by key

I would like to print a python dictionary to a file using PrettyPrinter (for human readability) but have the dictionary be sorted by key in the output file to further improve readability. So: mydict ..

How to change the time format (12/24 hours) of an <input>?

I am using HTML5 input element with type=time. The problem is it shows time with 12 hours but I want it to show it in 24 hours a day. How can I make it to 24 hours? Here is my input field: _x000D_ _x0..

Understanding Python super() with __init__() methods

I'm trying to understand the use of super(). From the looks of it, both child classes can be created, just fine. I'm curious to know about the actual difference between the following 2 child classes..

CSS how to make scrollable list

I am trying to create a webpage which is made up of a header and bellow the header a list of items. I want the list of items to be vertically scrollable. I also would like the webpage to take up the e..

How to detect DIV's dimension changed?

I've the following sample html, there is a DIV which has 100% width. It contains some elements. While performing windows re-sizing, the inner elements may be re-positioned, and the dimension of the di..

Spring: Returning empty HTTP Responses with ResponseEntity<Void> doesn't work

We are implementing a REST API with Spring (4.1.1.). For certain HTTP requests, we would like to return a head with no body as a response. However, using ResponseEntity<Void> doesn't seem to wor..

How to convert the background to transparent?

I have no experience with any image processing/editing tools. I am doing a project which requires me to convert the images(small icon) with background colour(red/blue/white) to transparent for the web..

"Large data" workflows using pandas

I have tried to puzzle out an answer to this question for many months while learning pandas. I use SAS for my day-to-day work and it is great for it's out-of-core support. However, SAS is horrible a..

java.sql.SQLException: No suitable driver found for jdbc:microsoft:sqlserver

I'm getting this exception when I try to run this program. It's one of the Microsoft examples. I've added the sqljdbc4.jar to the classpath in netbeans for both compile and Run, via the project proper..

Add characters to a string in Javascript

I need to add in a For Loop characters to an empty string. I know that you can use the function concat in Javascript to do concats with strings var first_name = "peter"; var last_name = "jones"; v..

jQuery get text as number

This code doesn't work: var number = $(this).find('.number').text(); var current = 600; if (current > number){ // do something } HTML: <div class="number">400</div> Seems the..

Creating an empty bitmap and drawing though canvas in Android

I'd like to create an empty bitmap and set a canvas to that bitmap and then draw any shape on the bitmap...

Design Documents (High Level and Low Level Design Documents)

What actually goes into the high level and low level design documents? (I specifically wish to know which diagrams are drawn in both the documents). I've gone through a lot of resources but I'm a lit..

How to prevent form from submitting multiple times from client side?

Sometimes when the response is slow, one might click the submit button multiple times. How to prevent this from happening?..

MongoDB/Mongoose querying at a specific date?

Is it possible to query for a specific date ? I found in the mongo Cookbook that we can do it for a range Querying for a Date Range Like that : db.posts.find({"created_on": {"$gte": start, "$lt": en..

MessageBox Buttons?

How would I say if the yes button on the messagebox was pressed do this,that and the other? In C#...

How to show only next line after the matched one?

grep -A1 'blah' logfile Thanks to this command for every line that has 'blah' in it, I get the output of the line that contains 'blah' and the next line that follows in the logfile. It might be a si..

Export specific rows from a PostgreSQL table as INSERT SQL script

I have a database schema named: nyummy and a table named cimory: create table nyummy.cimory ( id numeric(10,0) not null, name character varying(60) not null, city character varying(50) not null..

Rails: Adding an index after adding column

Suppose I created a table table in a Rails app. Some time later, I add a column running: rails generate migration AddUser_idColumnToTable user_id:string. Then I realize I need to add user_id as an..

PHP find difference between two datetimes

I'm trying to get the difference between two datetimes and return it as a datetime. I've found examples using diff but I can't seem to get it right. $timein = date("Y-m-d H:i:s"); $timeout = date("Y-..

Does a valid XML file require an XML declaration?

I am parsing an XML file using Sax Parser of Xerces. Is the XML declaration <?xml version="1.0" encoding="UTF-8"?> required?..

Getting a list item by index

I've recently started using c# moving over from Java. I can't seem to find how to get a list item by index. In java to get the first item of the list it would be: list1.get(0); What is the equivale..

Adding external library into Qt Creator project

How can I add external library into a project built by Qt Creator RC1 (version 0.9.2)? For example, the win32 function EnumProcesses() requires Psapi.lib to be added in the project to build...

mysqli_fetch_array while loop columns

Should be pretty basic, but I can't get it to work. I have this code to iterate over a mysqli query: while($row = mysqli_fetch_array($result)) { $posts[] = $row['post_id'].$row['post_title'].$row..

how to change the dist-folder path in angular-cli after 'ng build'

I would like to use angular-cli with asp.net core and I need to know how I can change the path of the dist folder..

Bind event to right mouse click

How can I trigger some action with right click after disabling the browser context menu ? I tried this . . . $(document).ready(function(){ $(document).bind("contextmenu",function(e){ $(..

How to open/run .jar file (double-click not working)?

I can't open or run my .jar file. I just installed java, but I tried to open the .jar with other programs first, so the double-click defaults to something else and I can't change it back. java -jar ..

How to browse for a file in java swing library?

I was wondering if there was some kind of J tool in the java swing library that opens up a file browser window and allows a user to choose a file. Then the ouput of the file would be the absolute path..