Questions Tagged with #Mouseout

A mouseout is an event that occurs on an element when the user removes the cursor from that element

Change background color on mouseover and remove it after mouseout

I have table which class is forum. My jquery code: <script type="text/javascript"> $(document).ready(function() { $('.forum').bind("mouseover", function(){ var color = ..

How to check if BigDecimal variable == 0 in java?

I have the following code in Java; BigDecimal price; // assigned elsewhere if (price.compareTo(new BigDecimal("0.00")) == 0) { return true; } What is the best way to write the if condition?..

Monad in plain English? (For the OOP programmer with no FP background)

In terms that an OOP programmer would understand (without any functional programming background), what is a monad? What problem does it solve and what are the most common places it's used? Update To c..

Open window in JavaScript with HTML inserted

How would I open a new window in JavaScript and insert HTML data instead of just linking to an HTML file?..

How to add image for button in android?

How can I add an image to a button, rather than text?..

How can I check for existence of element in std::vector, in one line?

Possible Duplicate: How to find an item in a std::vector? This is what I'm looking for: #include <vector> std::vector<int> foo() { // to create and return a vector return std::vecto..

How to select a radio button by default?

I have some radio buttons and I want one of them to be set as selected by default when the page is loaded. How can I do that? <input type="radio" name="imgsel" value="" /> ..

How to Set a Custom Font in the ActionBar Title?

How (if possible) could I set a custom font in a ActionBar title text(only - not the tab text) with a font in my assets folder? I don't want to use the android:logo option. ..

Python memory usage of numpy arrays

I'm using python to analyse some large files and I'm running into memory issues, so I've been using sys.getsizeof() to try and keep track of the usage, but it's behaviour with numpy arrays is bizarre...

Overriding the java equals() method - not working?

I ran into an interesting (and very frustrating) issue with the equals() method today which caused what I thought to be a well tested class to crash and cause a bug that took me a very long time to tr..

Replace all non-alphanumeric characters in a string

I have a string with which i want to replace any character that isn't a standard character or number such as (a-z or 0-9) with an asterisk. For example, "h^&ell`.,|o w]{+orld" is replaced with "h*..

Add a property to a JavaScript object using a variable as the name?

I'm pulling items out of the DOM with jQuery and want to set a property on an object using the id of the DOM element. Example const obj = {} jQuery(itemsFromDom).each(function() { const element ..

Aggregate function in SQL WHERE-Clause

In a test at university there was a question; is it possible to use an aggregate function in the SQL WHERE clause. I always thought this isn't possible and I also can't find any example how it would..

How to Specify "Vary: Accept-Encoding" header in .htaccess

Google PageSpeed says I should "Specify a Vary: Accept-Encoding header" for JS and CSS. How do I do this in .htaccess?..

Pandas count(distinct) equivalent

I am using pandas as a db substitute as I have multiple databases (oracle, mssql, etc) and I am unable to make a sequence of commands to a SQL equivalent. I have a table loaded in a DataFrame with so..

Check if a file exists with wildcard in shell script

I'm trying to check if a file exists, but with a wildcard. Here is my example: if [ -f "xorg-x11-fonts*" ]; then printf "BLAH" fi I have also tried it without the double quotes...

Populate one dropdown based on selection in another

I need to change the contents of dropdown B based on the selection in dropdown A using javascript. There are no db queries involved--I know beforehand what the contents of B should be given the choic..

Using Axios GET with Authorization Header in React-Native App

I'm trying to use axios for a GET request with an API which requires an Authorization header. My current code: const AuthStr = 'Bearer ' + USER_TOKEN; where USER_TOKEN is the access token needed. ..

Convert SVG to PNG in Python

How do I convert an svg to png, in Python? I am storing the svg in an instance of StringIO. Should I use the pyCairo library? How do I write that code?..

What does void mean in C, C++, and C#?

Looking to get the fundamentals on where the term "void" comes from, and why it is called void. The intention of the question is to assist someone who has no C experience, and is suddenly looking at a..

Why is there no Constant feature in Java?

I was trying to identify the reason behind constants in Java I have learned that Java allows us to declare constants by using final keyword. My question is why didn't Java introduce a Constant (const..

How can I specify a display?

When I run some programs over SSH, such as firefox &, I get an error Error: no display specified I would like to open many displays, still showing the stdout of each program. Initial Questi..

How to link to specific line number on github

I know I can link to a specific line number on a file on a github repo (I'm sure I've seen this before)... Can someone tell me how to do this?..

How to construct a relative path in Java from two absolute paths (or URLs)?

Given two absolute paths, e.g. /var/data/stuff/xyz.dat /var/data How can one create a relative path that uses the second path as its base? In the example above, the result should be: ./stuff/xyz.da..

How to call a C# function from JavaScript?

I want to call CsharpFunction, a C# function in code-behind, from JavaScript. I tried the code below but whether the JavaScript condition is True or False, CsharpFunction was called regardless! JavaS..

What is the use of a cursor in SQL Server?

I want to use a database cursor; first I need to understand what its use and syntax are, and in which scenario we can use this in stored procedures? Are there different syntaxes for different versions..

What is size_t in C?

I am getting confused with size_t in C. I know that it is returned by the sizeof operator. But what exactly is it? Is it a data type? Let's say I have a for loop: for(i = 0; i < some_size; i++) ..

error: invalid type argument of ‘unary *’ (have ‘int’)

I have a C Program: #include <stdio.h> int main(){ int b = 10; //assign the integer 10 to variable 'b' int *a; //declare a pointer to an integer 'a' a=(int *..

Ruby get object keys as array

I am new to Ruby, if I have an object like this {"apple" => "fruit", "carrot" => "vegetable"} How can I return an array of just the keys? ["apple", "carrot"] ..

Access an arbitrary element in a dictionary in Python

If a mydict is not empty, I access an arbitrary element as: mydict[mydict.keys()[0]] Is there any better way to do this?..

How to trim leading and trailing white spaces of a string?

Which is the effective way to trim the leading and trailing white spaces of string variable in Go?..

Serialize Class containing Dictionary member

Expanding upon my earlier problem, I've decided to (de)serialize my config file class which worked great. I now want to store an associative array of drive letters to map (key is the drive letter, v..

Python pandas insert list into a cell

I have a list 'abc' and a dataframe 'df': abc = ['foo', 'bar'] df = A B 0 12 NaN 1 23 NaN I want to insert the list into cell 1B, so I want this result: A B 0 12 NaN 1 23 ['foo',..

Using switch statement with a range of value in each case?

In Java, is it possible to write a switch statement where each case contains more than one value? For example (though clearly the following code won't work): switch (num) { case 1 .. 5: S..

Remove blank values from array using C#

How can I remove blank values from an array? For example: string[] test={"1","","2","","3"}; in this case, is there any method available to remove bl..

Get the latest date from grouped MySQL data

I have the following data in my database: |NO | model | date | +---+-------+----------+ |1 | bee |2011-12-01| |2 | bee |2011-12-05| |3 | bee |2011-12-12| |4 | tar |2011-12-13| I wa..

How to make a countdown timer in Android?

I have two EditTexts in XML. In one EditText, the user can put a number as minutes and in another EditText, a number as seconds. After clicking the finish button, the seconds EditText should start to ..

Disable output buffering

Is output buffering enabled by default in Python's interpreter for sys.stdout? If the answer is positive, what are all the ways to disable it? Suggestions so far: Use the -u command line switch Wr..

Saving an image in OpenCV

I am new to OpenCV, and trying to capture an image, and then save it to a file. I am posting the code for your reference, below. The jpg file is being saved, but it is black. // Capture the Image fr..

Swift presentViewController

I programatically have multiple View Controllers in an iOS Swift Project. I do not have the storyboards and would like to avoid them if possible. Is there a way to switch to another viewcontroller.swi..

How to place two divs next to each other?

Consider the following code: _x000D_ _x000D_ #wrapper {_x000D_ width: 500px;_x000D_ border: 1px solid black;_x000D_ }_x000D_ #first {_x000D_ width: 300px;_x000D_ border: 1px solid red..

git pull while not in a git directory

Let's say I have a directory, /X/Y, which is a git repository. Is it possible to somehow call a command like git pull from inside /X, but targeting the /X/Y directory? EDIT: I guess I was wondering s..

Python Progress Bar

How do I use a progress bar when my script is doing some task that is likely to take time? For example, a function which takes some time to complete and returns True when done. How can I display a pr..

How can I put an icon inside a TextInput in React Native?

I am thinking of having something like this where you have icon that you press to show password as plaintext, not as dots. However, I was unable to find any ..

Getting RSA private key from PEM BASE64 Encoded private key file

I have a private key file (PEM BASE64 encoded). I want to use it else where to decrypt some other data.Using Java i tried to read the file and decode the BASE64 encoded data in it... This is the code ..

Cursor inside cursor

Main problem is about changing the index of rows to 1,2,3.. where contact-id and type is the same. but all columns can contain exactly the same data because of some ex-employee messed up and update al..

Add a string of text into an input field when user clicks a button

Basically just trying to add text to an input field that already contains a value.. the trigger being a button.. Before we click button, form field would look like.. (user inputted some data) [This ..

Failing to run jar file from command line: “no main manifest attribute”

I am trying to run a jar file from the console: java -jar ScrumTimeCaptureMaintenence.jar And am getting the error: Can't execute jar- file: “no main manifest attribute” As you can see I ..

How to use mod operator in bash?

I'm trying a line like this: for i in {1..600}; do wget $i % 5; done; What I'm trying to get as output is: wget wget http://example.c..

AngularJS does not send hidden field value

For a specific use case I have to submit a single form the "old way". Means, I use a form with action="". The response is streamed, so I am not reloading the page. I am completely aware that a typical..

Including all the jars in a directory within the Java classpath

Is there a way to include all the jar files within a directory in the classpath? I'm trying java -classpath lib/*.jar:. my.package.Program and it is not able to find class files that are certainly in..

Storing Data in MySQL as JSON

I thought this was a n00b thing to do. And, so, I've never done it. Then I saw that FriendFeed did this and actually made their DB scale better and decreased latency. I'm curious if I should do this. ..

C++ Get name of type in template

I'm writing some template classes for parseing some text data files, and as such it is likly the great majority of parse errors will be due to errors in the data file, which are for the most part not ..

What's an object file in C?

I am reading about libraries in C but I have not yet found an explanation on what an object file is. What's the real difference between any other compiled file and an object file? I would be glad if s..

How to get the size of a range in Excel

Using VBA, is it possible to get the size of a given range in terms of pixels or units? (I don't care which unit as I am only using it to relate to other measurements with the same unit). Thanks...

How to do a LIKE query with linq?

How can i perform an LIKE query within Linq? I have the following query i would like to execute. var results = from c in db.costumers where c.FullName LIKE "%"+FirstName+"%,"+LastName ..

Setting up redirect in web.config file

I'm trying to redirect some unfriendly urls with more descriptive ones. These urls end in .aspx?cid=3916 with the last digits being different for each category name page. I want it to instead redirect..

Append a tuple to a list - what's the difference between two ways?

I wrote my first "Hello World" 4 months ago. Since then, I have been following a Coursera Python course provided by Rice University. I recently worked on a mini-project involving tuples and lists. The..

VB.Net .Clear() or txtbox.Text = "" textbox clear methods

Not far into programming and just joined this forum of mighty company so this is a silly question, but what is the best way to clear textboxes in VB.Net and what is the difference between the two meth..

What is /dev/null 2>&1?

I found this piece of code in /etc/cron.daily/apf #!/bin/bash /etc/apf/apf -f >> /dev/null 2>&1 /etc/apf/apf -s >> /dev/null 2>&1 It's flushing and reloading the..

Set up Python simpleHTTPserver on Windows

I want to set up Python SimpleHTTPServer on Windows XP. I have Python installed on my computer. I am executing the following command: python -m SimpleHTTPServer 8888 But I am getting the error: C:..

How to get previous month and year relative to today, using strtotime and date?

I need to get previous month and year, relative to current date. However, see following example. // Today is 2011-03-30 echo date('Y-m-d', strtotime('last month')); // Output: 2011-03-02 This beh..

Truncate all tables in a MySQL database in one command?

Is there a query (command) to truncate all the tables in a database in one operation? I want to know if I can do this with one single query...

Better way to sort array in descending order

I have a array of int which I have to sort by descending. Since I did not find any method to sort the array in descending order.Currently I am sorting the array in descending order as below int[] a..

How to connect mySQL database using C++

I'm trying to connect the database from my website and display some rows using C++. So bascily I'm trying to make an application that does a select query from a table from my site database. Now, this ..

Set up a scheduled job?

I've been working on a web app using Django, and I'm curious if there is a way to schedule a job to run periodically. Basically I just want to run through the database and make some calculations/upd..

Jquery href click - how can I fire up an event?

I have this anchor and on click I would like to popup something. This href is within a page that has other hrefs. <a class="sign_new" href="#sign_up">Sign up</a> jQuery: $(document).re..

powershell - list local users and their groups

I'd like to have a report with all the local users and their relative groups (users, power users, administrators and so on. I get the users in this way: $adsi = [ADSI]"WinNT://." $adsi.psbase.childr..

Passing a variable to a powershell script via command line

I am new to powershell, and trying to teach myself the basics. I need to write a ps script to parse a file, which has not been too difficult. Now I want to change it to pass a variable to the script..

Run function from the command line

I have this code: def hello(): return 'Hi :)' How would I run this directly from the command line?..

Replace a string in a file with nodejs

I use the md5 grunt task to generate MD5 filenames. Now I want to rename the sources in the HTML file with the new filename in the callback of the task. I wonder what's the easiest way to do this...

Use superscripts in R axis labels

Using base graphics in R, how can I add superscripts to axis labels, as one might want to when plotting latitude and longitude axes on a map. Consider this example: plot(-100:-50, 50:100, type="n", ..

How to make an element width: 100% minus padding?

I have an html input. The input has padding: 5px 10px; I want it to be 100% of the parent div's width(which is fluid). However using width: 100%; causes the input to be 100% + 20px how can I get aro..

Object Required Error in excel VBA

Dim g1val, g2val As Integer Set g1val = 0 Set g2val = 0 For i = 3 To 18 If g1val > Cells(33, i).Value Then g1val = g1val Else g1val = Cells(33, i).Value End If Next i ..

How to solve “Microsoft Visual Studio (VS)” error “Unable to connect to the configured development Web server”

PROBLEM If you start using "Microsoft Internet Information Services Express (IIS)" from "Microsoft Visual Studio (VS)" you may get when you run Build this error message Unable to connect to the con..

Best way to unselect a <select> in jQuery?

<select size="2"> <option selected="selected">Input your option</option> <option>Input your option</option> </select> What is the best way, using jQuery, to elega..

How to check if multiple array keys exists

I have a variety of arrays that will either contain story & message or just story How would I check to see if an array contains both story and message? array_key_exists() only looks for th..

How to join multiple collections with $lookup in mongodb

I want to join more than two collections in MongoDB using the aggregate $lookup. Is it possible to join? Give me some examples. Here I have three collections: users: { "_id" : ObjectId("568..

is it possible to evenly distribute buttons across the width of an android linearlayout

I have a linear layout (oriented horizontally) that contains 3 buttons. I want the 3 buttons to have a fixed width and be evenly distributed across the width of the linear layout. I can manage this ..

Can I invoke an instance method on a Ruby module without including it?

Background: I have a module which declares a number of instance methods module UsefulThings def get_file; ... def delete_file; ... def format_text(x); ... end And I want to call some of the..

Clearing an input text field in Angular2

Why is this method not working when I try to clear the text field? <div> <input type="text" placeholder="Search..." [value]="searchValue"> <button (click)="clearSearch()"&g..

What does DIM stand for in Visual Basic and BASIC?

What does DIM stand for in Visual Basic? ..

how can I debug a jar at runtime?

I'm into a quite strange position (from my java-newbie point of view): using Eclipse I wrote a "java program" (some .java files with classes into) which essentially (batch) reads a text *.csv file, ..

How do I hide a menu item in the actionbar?

I have an action bar with a menuitem. How can I hide/show that menu item? This is what I'm trying to do: MenuItem item = (MenuItem) findViewById(; item.setVisible(false); this.invalid..

Didn't Java once have a Pair class?

Am I remembering incorrectly, or did Java, once upon a time, provide a Pair class as part of its API?..

How to return XML in ASP.NET?

I have encountered many half-solutions to the task of returning XML in ASP.NET. I don't want to blindly copy & paste some code that happens to work most of the time, though; I want the right code,..

Git Diff with Beyond Compare

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

Making an array of integers in iOS

If you want to make an array of integers, can you use NSInteger? Do you have to use NSNumber? If so, then why?..

cmake and libpthread

I'm running RHEL 5.1 and use gcc. How I tell cmake to add -pthread to compilation and linking?..

React Native Error: ENOSPC: System limit for number of file watchers reached

I have setup a new blank react native app. After installing few node modules I got this error. Running application on PGN518. internal/fs/watchers.js:173 throw error; ^ Error: ENOSPC: System l..

How can I count text lines inside an DOM element? Can I?

I'm wondering if there's a way to count lines inside a div for example. Say we have a div like so: <div id="content">hello how are you?</div> Depending on many factors, the div can have..

Relative div height

I want to split up the view in four parts. A header at the top, using full page width and fixed height. The remaining page is split up in two blocks of the same height, the upper of them contains two..

Where do I download JDBC drivers for DB2 that are compatible with JDK 1.5?

Where do I download JDBC drivers for DB2 that are compatible with JDK 1.5? They seem to be very elusive and I hit many dead-ends at IBM's website. I managed to find versions of the driver bundled with..

Could not resolve '...' from state ''

This is first time i am trying to use ui-router. Here is my app.js angular.module('myApp', ['ionic']) .run(function($ionicPlatform) { $ionicPlatform.ready(function() { // Hide the accessory b..

css rotate a pseudo :after or :before content:""

anyway to make a rotation work on the pseudo content:"\24B6"? I'm trying to rotate a unicode symbol...

Spring Boot Adding Http Request Interceptors

What is the right way to add HttpRequest interceptors in spring boot application? What I want to do is log requests and responses for every http request. Spring boot documentation does not cover this..

Simple (I think) Horizontal Line in WPF?

Creating a relatively simple data entry form, and just want to separate certain sections with a horizontal line (not unlike an HR tag in HTML) that stretches the full length of the form. I have tried..

How to list all tags along with the full message in git?

I want git to list all tags along with the full annotation or commit message. Something like this is close: git tag -n5 This does exactly what I want except that it will only show up to the first 5..

get an element's id

Is there another way to get an DOM element's ID? element.getAttribute('id') ..

Skip certain tables with mysqldump

Is there a way to restrict certain tables from the mysqldump command? For example, I'd use the following syntax to dump only table1 and table2: mysqldump -u username -p database table1 table2 > d..

Php - Your PHP installation appears to be missing the MySQL extension which is required by WordPress

How do I fix the error below? Your PHP installation appears to be missing the MySQL extension which is required by WordPress. I use my NAS with a telnet connection. I installed FFP 0.7 My php...

How to print struct variables in console?

How can I print (in the console) the Id, Title, Name, etc. of this struct in Golang? type Project struct { Id int64 `json:"project_id"` Title string `json:"title"` Name strin..

How can I count the number of characters in a Bash variable

How can I count all characters in a bash variable? For instance, if I had "stackoverflow" the result should be "13" ..

Is there a MySQL option/feature to track history of changes to records?

I've been asked if I can keep track of the changes to the records in a MySQL database. So when a field has been changed, the old vs new is available and the date this took place. Is there a feature or..

Is Google Play Store supported in avd emulators?

After googling quite a bit I am unable to find the answer to this question. Is google play store officially support in avd emulators. I know it was once stopped , then I hear that it was brought bac..

Retrieve the maximum length of a VARCHAR column in SQL Server

I want to find the longest VARCHAR in a specific column of a SQL Server table. Here's an example: ID = INT IDENTITY DESC = VARCHAR(5000) ID | Desc ---|----- 1 | a 2 | aaa 3 | aa What's the SQL..

How to make circular background using css?

I need make something like this. and I want to do it for a <div></div> which has width in % I can do this by using an image and adding another div inside and z-index. But I want to kno..

How to install PyQt4 on Windows using pip?

I'm using Python 3.4 on Windows. When I run a script, it complains ImportError: No Module named 'PyQt4' So I tried to install it, but pip install PyQt4 gives Could not find any downloads that s..

Woocommerce, get current product id

I'm currently working on a WooCommerce theme and attempting to add a sidebar to the product detail page. I've been able to get the sidebar added (specifically, this one:

Get first row of dataframe in Python Pandas based on criteria

Let's say that I have a dataframe like this one import pandas as pd df = pd.DataFrame([[1, 2, 1], [1, 3, 2], [4, 6, 3], [4, 3, 4], [5, 4, 5]], columns=['A', 'B', 'C']) >> df A B C 0 1 2..

Cannot ignore .idea/workspace.xml - keeps popping up

Using PHPStorm, I am trying to ignore the workspace.xml which pops up every-time I try to make a git commit. My .gitignore looks like: /.idea/ .idea/workspace.xml Because at a point the file was c..

Component is part of the declaration of 2 modules

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

How to disable the back button in the browser using JavaScript

I want to disable the back button for a website. Whenever the person clicks on the browser back button it should not be able to go on the page the user visited before...

Javascript call() & apply() vs bind()?

I already know that apply and call are similar functions which setthis (context of a function). The difference is with the way we send the arguments (manual vs array) Question: But when should I us..

How to include js and CSS in JSP with spring MVC

I want to include js and css files in my jsp, but I'm not able to do so. I'm new to the concept of spring MVC. For a long time, I've been working on this same topic. My index Page is like this <!D..

How can I determine the sector size in windows?

How can I determine the Physical Sector Size (e.g. if i have an Advanced Format drive with 4,096 byte sectors rather than the legacy 512 byte sectors) in Windows 7? I know that by clicking on a file ..

Get child node index

In straight up javascript (i.e., no extensions such as jQuery, etc.), is there a way to determine a child node's index inside of its parent node without iterating over and comparing all children nodes..

How to sort the letters in a string alphabetically in Python

Is there an easy way to sort the letters in a string alphabetically in Python? So for: a = 'ZENOVW' I would like to return: 'ENOVWZ' ..

Inline instantiation of a constant List

I try to do something like this: public const List<String> METRICS = new List<String>() { SourceFile.LOC, SourceFile.MCCABE, SourceFile.NOM, ..

Running a command as Administrator using PowerShell?

You know how if you're the administrative user of a system and you can just right click say, a batch script and run it as Administrator without entering the administrator password? I'm wondering how ..

positional argument follows keyword argument

I am a calling a function like this in python . order_id = kite.order_place(self, exchange, tradingsymbol, transaction_type, quantity, price, product, order_type, validity, disclosed_quantity=None,..

What does localhost:8080 mean?

What is the difference between localhost/web vs. localhost:8080/web?..

How can I style the border and title bar of a window in WPF?

We are developing a WPF application which uses Telerik's suite of controls and everything works and looks fine. Unfortunately, we recently needed to replace the base class of all our dialogs, changing..

Convert object string to JSON

How can I convert a string that describes an object into a JSON string using JavaScript (or jQuery)? e.g: Convert this (NOT a valid JSON string): var str = "{ hello: 'world', places: ['Africa', 'A..

Regular expression to search multiple strings (Textpad)

I'm a bit new to regex and am looking to search for multiple lines/instaces of some wildcard strings such as *8768, *9875, *2353. I would like to pull all instances of these (within one file) rather ..

How to delete node from XML file using C#

Possible Duplicate: How to remove an XmlNode from XmlNodeList Hi, How can i delete a set of nodes from an XML file.? Here is a code snippet. string path = @"C:\Documents and Settings\e45493..

How can compare-and-swap be used for a wait-free mutual exclusion for any shared data structure?

Being new to multi-threading and mutexes I was going through the wikipedia for starters. I came across this portion: CAS can be used to achieve wait-free mutual exclusion for any shared data struc..

How can I increase the JVM memory?

HI, I like to know can I increase the memory of the JVM depending on my application.If yes how can I increase the JVM memory? And how can I know the size of JVM?..

How to fetch JSON file in Angular 2

as I am new to the Angular, can anyone please give a simple solution on loading the JSON file data using angular 2. My code is like below Index.html _x000D_ _x000D_ <html>_x000D_ <head&..

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

Nested rows with bootstrap grid system?

I want 1 larger image with 4 smaller images in a 2x2 format like this: My initial thought was to house everything in one row. Then create two columns, and, in the second column, create two rows an..

Proper use of 'yield return'

The yield keyword is one of those keywords in C# that continues to mystify me, and I've never been confident that I'm using it correctly. Of the following two pieces of code, which is the preferred a..

Can I have multiple Xcode versions installed?

Is it possible to have more than one version of Xcode installed at the same time? If so, please post any tip, tricks, or potential issues to watch out for. EDIT: The reason I want to install multi..

How to remove leading and trailing white spaces from a given html string?

I've the following HTML string. What would be sample code in JavaScript to remove leading and trailing white spaces from this string? <p>&nbsp;&nbsp;</p> <div>&nbsp;<..

How do I clear a search box with an 'x' in bootstrap 3?

Having some trouble with bootstrap, so some help would be awesome. Thanks What I would like:(top part) My current code: <div class="form-group"> <input type="text" class=..

MIME types missing in IIS 7 for ASP.NET - 404.17

When getting a newly configured Windows 7 box, I noticed that ASP.NET was turned off by default. So was classical ASP. I was getting a 404.17 error for a web application. I think it's because I don..

ES6 modules in the browser: Uncaught SyntaxError: Unexpected token import

I'm new to ES6 (ECMAScript 6), and I'd like to use its module system in the browser. I read ES6 is supported by Firefox and Chrome, but I'm getting the following error using export Uncaught SyntaxErr..

Pandas DataFrame Groupby two columns and get counts

I have a pandas dataframe in the following format: df = pd.DataFrame([[1.1, 1.1, 1.1, 2.6, 2.5, 3.4,2.6,2.6,3.4,3.4,2.6,1.1,1.1,3.3], list('AAABBBBABCBDDD'), [1.1, 1.7, 2.5, 2.6, 3.3, 3.8,4.0,4.2,4.3..

How to get relative path from absolute path

There's a part in my apps that displays the file path loaded by the user through OpenFileDialog. It's taking up too much space to display the whole path, but I don't want to display only the filename ..

PHP: Get the key from an array in a foreach loop

print_r($samplearr) prints the following for my array containing 3 items: Array ( [4722] => Array ( [value1] => 52 [value2] => 46 ) Array ( [4922] => Array ( [value1] => 22 [value2] =&..

Why did I get the compile error "Use of unassigned local variable"?

My code is the following int tmpCnt; if (name == "Dude") tmpCnt++; Why is there an error "Use of unassigned local variable tmpCnt"? I know I didn't explicitly initialize ..

Website screenshots

Is there any way of taking a screenshot of a website in PHP, then saving it to a file?..

Refresh Page and Keep Scroll Position

Can someone show me what i'm doing wrong? I need my page to refresh after a certain period of time, but it refreshes to the top of the page, I need it to not change the page location!So this is what ..

How can I check the size of a file in a Windows batch script?

I want to have a batch file which checks what the filesize is of a file. If it is bigger than %somany% kbytes, it should redirect with GOTO to somewhere else. Example: [check for filesize] IF %file..

add maven repository to build.gradle

I added a custom maven repository to build.gradle in Android Studio but the dependency is not being found Maven repository and dependency <repository> <id>achartengine</id> ..

How to empty/destroy a session in rails?

I can't seem to find it anywhere... How do I delete/destroy/reset/empty/clear a user's session in Rails? Not just one value but the whole thing....

What is the most effective way to get the index of an iterator of an std::vector?

I'm iterating over a vector and need the index the iterator is currently pointing at. AFAIK this can be done in two ways: it - vec.begin() std::distance(vec.begin(), it) What are the pros and cons..

Equivalent of .bat in mac os

I currently use a .bat file that is utilized to invoke a java file. If I wanted to utilize the same functionality on Mac OS what format changes would I make? (unless the .bat equivalent on Mac OS is t..

What is causing this error - "Fatal error: Unable to find local grunt"

I removed the old version of grunt first, then I installed the new grunt version, and then I got this error: D:\www\grunt-test\grunt grunt-cli: The grunt command line interface. (v0.1.4) Fa..

What is the difference between Sublime text and Github's Atom

Github announced Atom which is very similar to Sublime. Even some keyboard shortcuts like ? + P, ? + Shift + P etc. are same. How is Atom different from Sublime? Does it include IDE features lik..

How to force a html5 form validation without submitting it via jQuery

I have this form in my app and I will submit it via AJAX, but I want to use HTML5 for client-side validation. So I want to be able to force the form validation, perhaps via jQuery. I want to trigger ..

How to set python variables to true or false?

I want to set a variable in Python to true or false. But the words true and false are interpreted as undefined variables: #!/usr/bin/python a = true; b = true; if a == b: print("same");..

Replace substring with another substring C++

How could I replace a substring in a string with another substring in C++, what functions could I use? eg: string test = "abc def abc def"; test.replace("abc", "hij").replace("def", "klm"); //replac..

List View Filter Android

I have created a list view in android and I want to add edit text above the list and when the user enter text the list will be filtered according to user input can anyone tell me please if there is a..

Regular expression for address field validation

I am trying to write a regular expression that facilitates an address, example 21-big walk way or 21 St.Elizabeth's drive I came up with the following regular expression but I am not too keen to how t..

Adding an identity to an existing column

I need to change the primary key of a table to an identity column, and there's already a number of rows in table. I've got a script to clean up the IDs to ensure they're sequential starting at 1, wo..

Mongodb find() query : return only unique values (no duplicates)

I have a collection of documents : { "networkID": "myNetwork1", "pointID": "point001", "param": "param1" } { "networkID": "myNetwork2", "pointID": "point002", "param": "param2..

Send a base64 image in HTML email

Using a rich-text editor, our users can drag and drop a saved image from their desktop to the editor. The image appears and displays properly in the web page after they submit. Since the image is not..

Fit image into ImageView, keep aspect ratio and then resize ImageView to image dimensions?

How to fit an image of random size to an ImageView? When: Initially ImageView dimensions are 250dp * 250dp The image's larger dimension should be scaled up/down to 250dp The image should keep its a..

Code for a simple JavaScript countdown timer?

I want to use a simple countdown timer starting at 30 seconds from when the function is run and ending at 0. No milliseconds. How can it be coded?..

IF/ELSE Stored Procedure

Can anyone please point out what im doing wrong with this Stored Procedure please. I cant get it to compile and my software isnt giving any useful clues as to what is wrong with it. CREATE PROCEDURE ..

Java Generics With a Class & an Interface - Together

I want to have a Class object, but I want to force whatever class it represents to extend class A and implement interface B. I can do: Class<? extends ClassA> Or: Class<? extends Interfa..

Sql Server equivalent of a COUNTIF aggregate function

I'm building a query with a GROUP BY clause that needs the ability to count records based only on a certain condition (e.g. count only records where a certain column value is equal to 1). SELECT UID..

MySQL Data - Best way to implement paging?

My iPhone app connects to my PHP web service to retrieve data from a MySQL database. A request can return 500 results. What is the best way to implement paging and retrieve 20 items at a time? Let's..

POST Multipart Form Data using Retrofit 2.0 including image

I am trying to do a HTTP POST to server using Retrofit 2.0 MediaType MEDIA_TYPE_TEXT = MediaType.parse("text/plain"); MediaType MEDIA_TYPE_IMAGE = MediaType.parse("image/*"); ByteArrayOutputStream b..

image size (drawable-hdpi/ldpi/mdpi/xhdpi)

Study android, now I've some images to put into drawable dirs (hdpi/ldpi/mdpi/xhdpi). I read a lot but again I don't understand. Which size should be an image for every directories?..

How to declare local variables in postgresql?

There is an almost identical, but not really answered question here. I am migrating an application from MS SQL Server to PostgreSQL. In many places in code I use local variables so I would like to go..

Writing a dictionary to a csv file with one line for every 'key: value'

I've got a dictionary: mydict = {key1: value_a, key2: value_b, key3: value_c} I want to write the data to a file dict.csv, in this style: key1: value_a key2: value_b key3: value_c I wrote: impo..

How do you do exponentiation in C?

I tried "x = y ** e", but that didn't work...

Styling Google Maps InfoWindow

I've been attempting to style my Google Maps InfoWindow, but the documentation is very limited on this topic. How do you style an InfoWindow?..

Get the index of a certain value in an array in PHP

I have an array: $list = array('string1', 'string2', 'string3'); I want to get the index for a given value (i.e. 1 for string2 and 2 for string3) All I want is the position of the strings in the a..

WordPress query single post by slug

For the moment when I want to show a single post without using a loop I use this: <?php $post_id = 54; $queried_post = get_post($post_id); echo $queried_post->post_title; ?> The problem is..

Bufferedimage resize

I am trying to resized a bufferedimage. I am able to store it and show up on a jframe no problems but I can't seem to resize it. Any tips on how I can change this to make it work and show the image as..

PHP __get and __set magic methods

Unless I'm completely mistaken, the __get and __set methods are supposed to allow overloading of the → get and set. For example, the following statements should invoke the __get method: echo $..

'gulp' is not recognized as an internal or external command

I am trying to use Gulp and Node.Js to stream my process for minifying and concatenating CSS/JS files for production. Here is what I have done. I installed Node.Js on my Windows 7 machine. Installe..

Rails 2.3.4 Persisting Model on Validation Failure

I have a standard html form post that is being persisted and validated with a rails model on the server side. For the sake of discussion, lets call this a "car" model. When is invoked ..

How do I remove link underlining in my HTML email?

<td width="110" align="center" valign="top" style="color:#000000;"> <a href="" target="_blank" style="color:#000000; text-decoration:none;">BOOK NOW </..

How to directly move camera to current location in Google Maps Android API v2?

Without clicking any button, how to directly get the current location and move the camera to it. Also, I found that there is a button on the right top of the map. When click on it, it will go to curre..

What are projection and selection?

What is the difference between projection and selection? Is it: Projection --> for selecting the columns of table; and Selection ---> to select the rows of table? So are projection and selection v..

Check if AJAX response data is empty/blank/null/undefined/0

What I have: I have jQuery AJAX function that returns HTML after querying a database. Depending on the result of the query, the function will either return HTML code or nothing (i.e. blank) as desire..

How do I control how Emacs makes backup files?

Emacs puts backup files named foo~ everywhere and I don't like having to remember to delete them. Also, if I edit a file that has a hard link somewhere else in the file system, the hard link points t..

SQL Server Case Statement when IS NULL

I'm trying to do an IF statement type function in SQL server. Where there is a NULL in the field, I want it to take a field from one of the tables and add 10 days to it. And if possible create anoth..

How to build query string with Javascript

Just wondering if there is anything built-in to Javascript that can take a Form and return the query parameters, eg: "var1=value&var2=value2&arr[]=foo&arr[]=bar..." I've been wondering th..

Python handling socket.error: [Errno 104] Connection reset by peer

When using Python 2.7 with urllib2 to retrieve data from an API, I get the error [Errno 104] Connection reset by peer. Whats causing the error, and how should the error be handled so that the script d..

When to use Interface and Model in TypeScript / Angular

I recently watched a Tutorial on Angular 2 with TypeScript, but unsure when to use an Interface and when to use a Model for data structures. Example of interface: export interface IProduct { Produ..

How to validate phone numbers using regex

I'm trying to put together a comprehensive regex to validate phone numbers. Ideally it would handle international formats, but it must handle US formats, including the following: 1-234-567-8901 1-23..

How to use sed to extract substring

I have a file containing the following lines: <parameter name="PortMappingEnabled" access="readWrite" type="xsd:boolean"></parameter> <parameter name="PortMappingLeaseDuration" acc..

The shortest possible output from git log containing author and date

How can I show a git log output with (at least) this information: * author * commit date * change I want it compressed to one line per log entry. What's the shortest possible format for that? (tr..

Adding one day to a date

My code to add one day to a date returns a date before day adding: 2009-09-30 20:24:00 date after adding one day SHOULD be rolled over to the next month: 1970-01-01 17:33:29 <?php //add day ..

Recommendations of Python REST (web services) framework?

Is there a list somewhere of recommendations of different Python-based REST frameworks for use on the serverside to write your own RESTful APIs? Preferably with pros and cons. Please feel free to add..

How to read pdf file and write it to outputStream

I need to read a pdf file with filepath "C:\file.pdf" and write it to outputStream. What is the easiest way to do that? @Controller public class ExportTlocrt { @Autowired private PhoneBookService ph..

Spring not autowiring in unit tests with JUnit

I test the following DAO with JUnit: @Repository public class MyDao { @Autowired private SessionFactory sessionFactory; // Other stuff here } As you can see, the sessionFactory is au..

How do I convert a TimeSpan to a formatted string?

I have two DateTime vars, beginTime and endTime. I have gotten the difference of them by doing the following: TimeSpan dateDifference = endTime.Subtract(beginTime); How can I now return a string of..

Vue.js - How to properly watch for nested data

I'm trying to understand how to properly watch for some prop variation. I have a parent component (.vue files) that receive data from an ajax call, put the data inside an object and use it to render ..

How to copy data from another workbook (excel)?

I already have a macro that creates sheets and some other stuff. After a sheet has been created do I want to call another macro that copies data from a second excel (its open) to first and active exce..

Oracle 12c Installation failed to access the temporary location

I have Windows 8.1 64-bit OS running on 64-bit architecture. I am installing a fresh copy of Oracle 12C, means I haven't installed any version before on my system. During the installation, I encounte..

Vuejs and Vue.set(), update array

I'm new to Vuejs. Made something, but I don't know it's the simple / right way. what I want I want some dates in an array and update them on a event. First I tried Vue.set, but it dind't work out. N..

KeyListener, keyPressed versus keyTyped

I have a JFrame (well, a class which extends JFrame) and I want to do an action when I press the F5 key. So, I made the class implement KeyListener. And with that, came three methods, keyPressed, keyR..

Multiline strings in VB.NET

Is there a way to have multiline strings in VB.NET like Python a = """ multi line string """ or PHP? $a = <<<END multi line string END; Of course something that is not "multi" & _ ..

MySQL connection not working: 2002 No such file or directory

I'm trying to set up WordPress. I have Apache and MySQL running, and the accounts and database are all set up. I tried to make a simple connection: <?php $conn = mysql_connect('localhost', 'US..

how to avoid extra blank page at end while printing?

I'm using a CSS property, If I use page-break-after: always; => It prints an extra blank page before If I use page-break-before: always; => It prints an extra blank page after. How to avoid this? &..