Questions Tagged with #Nsproxy

Searching a string in eclipse workspace

How to search for a string in the complete eclipse workspace? I was not able to locate a text in the eclipse workspace however I could not find the specified string in the workspace...

Delete all lines beginning with a # from a file

All of the lines with comments in a file begin with #. How can I delete all of the lines (and only those lines) which begin with #? Other lines containing #, but not at the beginning of the line shoul..

How to calculate DATE Difference in PostgreSQL?

Here I need to calculate the difference of the two dates in the PostgreSQL. In SQL Server: Like we do in SQL Server its much easier. DATEDIFF(Day, MIN(joindate), MAX(joindate)) AS DateDifference;..

Meaning of tilde in Linux bash (not home directory)

First off, I know that ~/ is the home directory. CDing to ~ or ~/ takes me to the home directory. However, cd ~X takes me to a special place, where X seems to be anything. In bash, if I hit "cd ~" a..

How to generate JAXB classes from XSD?

I'm a total newbie with XML. I'm doing a Java EE project REST implementation and we return a lot of XML. With this we decided to use JAXB. So far, we manually coded the Models for the XML. But there ..

Determine if a String is an Integer in Java

I'm trying to determine if a particular item in an Array of strings is an integer or not. I am .split(" ")'ing an infix expression in String form, and then trying to split the resultant array into tw..

How to clear jQuery validation error messages?

I am using the jQuery validation plugin for client side validation. Function editUser() is called on click of 'Edit User' button, which displays error messages. But I want to clear error messages on ..

hide/show a image in jquery

How to show/hide the image on clicking the hyperlink? <script> function getresource(id) { if(id==4) { //show image } else if(id==5) { //hide image } ..

Get Category name from Post ID

Is it possible to get the category name of a category given the Post ID, the following code works to get the Category Id, but how can I get the name? <?php $post_categories = wp_get_post_categorie..

How to get HttpRequestMessage data

I have an MVC API controller with the following action. I don't understand how to read the actual data/body of the Message? [HttpPost] public void Confirmation(HttpRequestMessage request) { var..

What are the differences between char literals '\n' and '\r' in Java?

In Java, the newline and carriage return characters are both seem to be showing same effect. What are the actual differences between char literals \n and \r in Java? Note that the above asks about..

Allow multi-line in EditText view in Android?

How to allow multi-line in Android's EditText view?..

How to list running screen sessions?

I have a bunch of servers, on which I run experiments using screen. The procedure is the following : ssh to server XXX launch screen start experiments in a few tabs detach screen disconnect from the..

Process all arguments except the first one (in a bash script)

I have a simple script where the first argument is reserved for the filename, and all other optional arguments should be passed to other parts of the script. Using Google I found this wiki, but it pr..

Javascript document.getElementById("id").value returning null instead of empty string when the element is an empty text box

I have a text box element whose value I am trying to access using document.getElementById("id-name").value. I find that the call is returning a null instead of empty string. The data-type of the retur..

Random number from a range in a Bash Script

I need to generate a random port number between 2000-65000 from a shell script. The problem is $RANDOM is a 15-bit number, so I'm stuck! PORT=$(($RANDOM%63000+2001)) would work nicely if it wasn't fo..

How to JUnit test that two List<E> contain the same elements in the same order?

Context I am writing a simple JUnit test for the MyObject class. A MyObject can be created from a static factory method that takes a varargs of String. MyObject.ofComponents("Uno", "Dos", "Tres"); ..

Command Line Tools not working - OS X El Capitan, Sierra, High Sierra, Mojave

I just upgraded from Yosemite to El Capitan (and replicated the problem upgrading from El Capitan to Sierra), and when I try to type for example git status inside a terminal, I get the following error..

"ImportError: No module named" when trying to run Python script

I'm trying to run a script that launches, amongst other things, a python script. I get a ImportError: No module named ..., however, if I launch ipython and import the same module in the same way thro..

Selenium Web Driver & Java. Element is not clickable at point (x, y). Other element would receive the click

I used explicit waits and I have the warning: org.openqa.selenium.WebDriverException: Element is not clickable at point (36, 72). Other element would receive the click: ... Command duratio..

Regular expression matching a multiline block of text

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

How can I create and style a div using JavaScript?

How can I use JavaScript to create and style (and append to the page) a div, with content? I know it's possible, but how?..

Microsoft.WebApplication.targets was not found, on the build server. What's your solution?

Trying to build my project on the build server gives me the following error: Microsoft (R) Build Engine Version 4.0.30319.1 error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microso..

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

How to get html to print return value of javascript function?

What is the preferred syntax to get html to print return value of javascript function? function produceMessage(){ var msg= 'Hello<br />'; return msg; } EDIT: Yikes, too many answers w..

How to filter Pandas dataframe using 'in' and 'not in' like in SQL

How can I achieve the equivalents of SQL's IN and NOT IN? I have a list with the required values. Here's the scenario: df = pd.DataFrame({'country': ['US', 'UK', 'Germany', 'China']}) countries_to_kee..

Iterating over and deleting from Hashtable in Java

I have a Hashtable in Java and want to iterate over all the values in the table and delete a particular key-value pair while iterating. How may this be done?..

Named tuple and default values for optional keyword arguments

I'm trying to convert a longish hollow "data" class into a named tuple. My class currently looks like this: class Node(object): def __init__(self, val, left=None, right=None): self.val = ..

How to avoid "RuntimeError: dictionary changed size during iteration" error?

I have checked all of the other questions with the same error yet found no helpful solution =/ I have a dictionary of lists: d = {'a': [1], 'b': [1, 2], 'c': [], 'd':[]} in which some of the value..

What is PAGEIOLATCH_SH wait type in SQL Server?

I have a query that is taking a long time in the middle of a transaction. When I get the wait_type of the process it is PAGEIOLATCH_SH. What does this wait type mean and how can this be resolved?..

Set Session variable using javascript in PHP

Is it possible to set PHP session variables using Javascript?..

How to overwrite the output directory in spark

I have a spark streaming application which produces a dataset for every minute. I need to save/overwrite the results of the processed data. When I tried to overwrite the dataset

How to embed images in html email

I'm trying to implement a code to send HTML email with embedded image. I already tried for simple HTML email with image but this image is taken from server...

gitx How do I get my 'Detached HEAD' commits back into master

Using Git X and must have fumbled royally on something. Looks like a few days ago I created a branch called detached HEAD and have been committing to it. My normal process is to commit to master and..

How can I make directory writable?

How can I make a directory writable, from the OS X terminal?..

How to extract Month from date in R

I am using the lubridate package and applying the month function to extract month from date. I ran the str command on date field and I got Factor w/ 9498 levels "01/01/1979","01/01/1980",..: 5305 1 ..

This application has no explicit mapping for /error

I used maven to do the tutorial All the codes I used was copied. The Application can run, but I get the error: Whitelabel Error Page This application ..

Get distance between two points in canvas

I have canvas drawing tab and want lineWidth to be based on distance between two last mousemove coordinate updates. I will make translation of distance to width myself, I just need to know how to get ..

PHP cURL error code 60

Whilst trying to setup a php environment on windows (using wamp) to use the Amazon PHP SDK, when i try to run a sample test I get the following error: Fatal error: Uncaught exception 'cURL_Exception'..

Second line in li starts under the bullet after CSS-reset

I'm having some problems with my ul-list after using applying CSS-reset. When the text in the li is long and it breaks to a second line, the text begins under the bullet. I'd like it to start with the..

Is there any quick way to get the last two characters in a string?

Wondering how to substring the last two characters quickly in Java? ..

"The transaction log for database is full due to 'LOG_BACKUP'" in a shared host

I have an Asp.Net MVC 5 website with EntityFramework codefirst approach in a shared hosting plan. It uses the open source WebbsitePanel for control panel and its SQL Server panel is somewhat limited. ..

Unit Tests not discovered in Visual Studio 2017

I have been struggling with VS 2017 since I installed it. Now it seems Unit Tests will only run from the command line "dotnet test." My project is .NET Core 1.1.1. I have the SDK and the framework up..

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

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

How do I copy a version of a single file from one git branch to another?

I've got two branches that are fully merged together. However, after the merge is done, I realise that one file has been messed up by the merge (someone else did an auto-format, gah), and it would ju..

How to place Text and an Image next to each other in HTML?

I want the text and the image to be next to each other but I want the image to be on the far left of the screen and I want the text to be on the far right of the screen. This is what I currently have...

How to set top-left alignment for UILabel for iOS application?

I have added one label in my nib file, then its required to have top-left alignment for that lable. As I am providing text at runtime so its not sure that how much lines there are. So if text contains..

Free c# QR-Code generator

I'm looking for a free to use c# library/code to create barcodes. Secifically I need to be able to create QR-Code type barcodes. I'm looking for free to use (Open Source or just Free, etc.) not pay to..

MISCONF Redis is configured to save RDB snapshots

During writes to Redis ( SET foo bar ) I am getting the following error: MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify..

Changing the highlight color when selecting text in an HTML text input

I've been looking for this throughout the web and can't even find anyone else even asking this, let alone a solution... Is there a way to change the color of the highlight area within a text input wh..

400 BAD request HTTP error code meaning?

I have a JSON request which I'm posting to a HTTP URL. Should this be treated as 400 where requestedResource field exists but "Roman" is an invalid value for this field? [{requestedResource:"Roman..

How do I resolve the " Address already in use: JVM_Bind" error?

In Eclipse, I got this error: run: [java] Error creating the server socket. [java] Oct 04, 2012 5:31:38 PM cascadas.ace.AceFactory bootstrap [java] SEVERE: Failed to create world : jav..

How to run a cronjob every X minutes?

I'm running a PHP script in a cronjob and I want to send emails every 5 minutes My current (crontab) cronjob: 10 * * * * /usr/bin/php / > /dev/null 2>&1 The cronma..

How to use python numpy.savetxt to write strings and float number to an ASCII file?

I have a set of lists that contain both strings and float numbers, such as: import numpy as num NAMES = num.array(['NAME_1', 'NAME_2', 'NAME_3']) FLOATS = num.array([ 0.5 , 0.2 , 0.3 ]) ..

How to convert a PIL Image into a numpy array?

Alright, I'm toying around with converting a PIL image object back and forth to a numpy array so I can do some faster pixel by pixel transformations than PIL's PixelAccess object would allow. I've fi..

MySQL Server has gone away when importing large sql file

I tried to import a large sql file through phpMyAdmin...But it kept showing error 'MySql server has gone away' What to do?..

How can I use onItemSelected in Android?

package org.example.mbtiapplication; import android.os.Bundle; import; import android.view.Menu; import android.view.View; import android.widget.AdapterView; import android.widge..

CSV parsing in Java - working example..?

I want to write a program for a school java project to parse some CSV I do not know. I do know the datatype of each column - although I do not know the delimiter. The problem I do not even marginally..

How do I remove the first characters of a specific column in a table?

In SQL, how can I remove the first 4 characters of values of a specific column in a table? Column name is Student Code and an example value is ABCD123Stu1231. I want to remove first 4 chars from my t..

Check if value already exists within list of dictionaries?

I've got a Python list of dictionaries, as follows: a = [ {'main_color': 'red', 'second_color':'blue'}, {'main_color': 'yellow', 'second_color':'green'}, {'main_color': 'yellow', 'second_..

Compare objects in Angular

Is it possible to do a "deep" comparison of two object in Angular? What I would like to do is compare each key/value pair. For example: Object 1 { key1: "value1", key2: "value2", key3: "val..

How do I get the current mouse screen coordinates in WPF?

How to get current mouse coordination on the screen? I know only Mouse.GetPosition() which get mousePosition of element, but I want to get the coordination without using element...

Convert an array to string

How do I make this output to a string? List<string> Client = new List<string>(); foreach (string listitem in lbClients.SelectedItems) { Client.Add(listitem); } ..

How can I convert a Unix timestamp to DateTime and vice versa?

There is this example code, but then it starts talking about millisecond / nanosecond problems. The same question is on MSDN, Seconds since the Unix epoch in C#. This is what I've got so far: publi..

Div side by side without float

How can I make div 'left' and 'right' look like columns side by side? I know I can use float:left on them and that will work... but on step 5 and 6 in here

Bootstrap button - remove outline on Chrome OS X

I am looking to achieve this: - scroll to the "live Demo" and hit the red popover button, in Chrome on OS X.... It's perfect beautiful Now go her..

How do I enumerate the properties of a JavaScript object?

How do I enumerate the properties of a JavaScript object? I actually want to list all the defined variables and their values, but I've learned that defining a variable actually creates a property of ..

What is ViewModel in MVC?

I am new to ASP.NET MVC. I have a problem with understanding the purpose of a ViewModel. What is a ViewModel and why do we need a ViewModel for an ASP.NET MVC Application? If I get a good example ..

Anaconda version with Python 3.5

I want to install tensorflow with python 3.5 using anaconda but I don't know which anaconda version has python 3.5. When I go to anaconda download page am presented with Anaconda 4.3.1 which has eithe..

How to make a gap between two DIV within the same column

I have two paragraphs. The two paragraphs are located in the same column. Now my question is I need to make the two paragraphs in two separate boxes, down each other. In other words, gap between two b..

Could not find default endpoint element

I've added a proxy to a webservice to a VS2008/.NET 3.5 solution. When constructing the client .NET throws this error: Could not find default endpoint element that references contract 'IMySOAPWebS..

'namespace' but is used like a 'type'

This is my program the class uses it is called Time2 I have the reference added to TimeTest I keep getting the Error 'Time2' is a 'namespace' but is used like a 'type' Could someone please tell me wh..

How to get the value of a variable given its name in a string?

For simplicity this is a stripped down version of what I want to do: def foo(a): # I want to print the value of the variable # the name of which is contained in a I know how to do this in P..

CSS-moving text from left to right

I want to create an animated HTML "marquee" that scrolls back and forth on a website: <div class="marquee">This is a marquee!</div> and the CSS: .marquee { position: absolute; ..

How can I format a list to print each element on a separate line in python?

How can I format a list to print each element on a separate line? For example I have: mylist = ['10', '12', '14'] and I wish to format the list so it prints like this: 10 12 14 so the \n, bracke..

What's the difference between '$(this)' and 'this'?

I am currently working through this tutorial: Getting Started with jQuery For the two examples below: $("#orderedlist").find("li").each(function (i) { $(this).append(" BAM! " + i); }); $("#reset..

Is there a simple way to increment a datetime object one month in Python?

So I am trying to find a way to increment a datetime object by one month. However, it seems this is not so simple, according to this question. I was hoping for something like: import datetime as d..

How do I set path while saving a cookie value in JavaScript?

I am saving some cookie values on an ASP page. I want to set the root path for cookie so that the cookie will be available on all pages. Currently the cookie path is /v/abcfile/frontend/ Please help..

how does unix handle full path name with space and arguments?

How does unix handle full path name with space and arguments ? In windows we quote the path and add the command-line arguments after, how is it in unix? "c:\foo folder with space\foo.exe" -help up..

Select multiple columns in data.table by their numeric indices

How can we select multiple columns using a vector of their numeric indices (position) in data.table? This is how we would do with a data.frame: df <- data.frame(a = 1, b = 2, c = 3) df[ , 2:3] # ..

ImportError: No module named PytQt5

following are my python, qt and sip versions root@thura:~# python -V Python 2.7.3 root@thura:~# qmake --version QMake version 3.0 Using Qt version 5.0.2 in /usr/lib/i386-linux-gnu root@thura:~# sip -..

Error in Swift class: Property not initialized at super.init call

I have two classes, Shape and Square class Shape { var numberOfSides = 0 var name: String init(name:String) { = name } func simpleDescription() -> String { ..

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

How to place the cursor (auto focus) in text box when a page gets loaded without javascript support?

I have a form with some text fields,and I want to place the cursor (auto focus) on first text field of form when page gets loaded. I want to do it without using javascript...

How do I display a MySQL error in PHP for a long query that depends on the user input?

In PHP, I am trying to execute a long MySQL query that depends on the user input. However, my query fails with the following message, "Query Failed". Actually I have printed this message whenever t..

What are NR and FNR and what does "NR==FNR" imply?

I am learning file comparison using awk. I found syntax like below, awk 'NR==FNR{a[$1];next}$1 in a{print $1}' file1 file2 I couldn't understand what is the significance of NR==FNR in this? If I t..

"Port 4200 is already in use" when running the ng serve command

I am learning angular 2 and for the first time I am using the angular CLI project to create a sandbox project. I was able to run the command "ng serve" and it works great. I wanted to stop it from r..

How to add double quotes to a string that is inside a variable?

I have variable like: string title = string.empty; My need is that whatever string is passed to it I have to display the content inside a div with in a double quotes. So I have written something l..

PostgreSQL: How to change PostgreSQL user password?

How do I change the password for PostgreSQL user?..

How to check that Request.QueryString has a specific value or not in ASP.NET?

I have an error.aspx page. If a user comes to that page then it will fetch the error path in page_load() method URL using Request.QueryString["aspxerrorpath"] and it works fine. But if a user direct..

How to check undefined in Typescript

I am using this code to check undefined variable but it's not working. _x000D_ _x000D_ var uemail = localStorage.getItem("useremail");_x000D_ _x000D_ if (typeof uemail === "undefined")_x000D_ {_x000..

How to select all the columns of a table except one column?

How to select all the columns of a table except one column? I have nearly 259 columns I cant mention 258 columns in SELECT statement. Is there any other way to do it?..

How do I protect Python code?

I am developing a piece of software in Python that will be distributed to my employer's customers. My employer wants to limit the usage of the software with a time restricted license file. If we dist..

File Upload in WebView

I have been struggling to upload files from WebView since last few days and there is no progress. I googled and implemented all suggested solutions but none works, like: solutions suggested here, and ..

How to specify the private SSH-key to use when executing shell command on Git?

A rather unusual situation perhaps, but I want to specify a private SSH-key to use when executing a shell (git) command from the local computer. Basically like this: git clone [email protected]:TheUser/T..

convert string to date in sql server

How do I convert YYYY-MM-DD (2012-08-17) to a date in SQL Server? I don't see this format listed on the help page:

How to use KeyListener

I am currently trying to implement a keylistener in my program so that it does an action when I pressed an arrow key, the object in my program either moves left or right. Here is the moving method in..

How can a windows service programmatically restart itself?

I need to write robust code in .NET to enable a windows service (server 2003) to restart itself. What is the best way to so this? Is there some .NET API to do it?..

What is the role of the package-lock.json?

npm@5 has been published, it has a new feature package-lock.json file (after npm install) which confuses me. I want to know, what is the effect of this file?..

What does 'Unsupported major.minor version 52.0' mean, and how do I fix it?

Ok so I loosely understand that 52.0 is Java 8, and that the exceptions means that some code is compiled with one version of java, and some with another. What I can't get my head around is which way ..

Make copy of an array

I have an array a which is constantly being updated. Let's say a = [1,2,3,4,5]. I need to make an exact duplicate copy of a and call it b. If a were to change to [6,7,8,9,10], b should still be [1,2,3..

How to refresh activity after changing language (Locale) inside application

My application users can change the language from the app's settings. Is it possible to change the language inside the application without having effect to general language settings ? This question o..

How to compare times in Python?

I see that date comparisons can be done and there's also datetime.timedelta(), but I'm struggling to find out how to check if the current time ( is earlier, later or the same t..

Can I catch multiple Java exceptions in the same catch clause?

In Java, I want to do something like this: try { ... } catch (/* code to catch IllegalArgumentException, SecurityException, IllegalAccessException, and NoSuchFieldException at t..

Find the PID of a process that uses a port on Windows

My service crash on startup with the classic: java.rmi.server.ExportException: Listen failed on port: 9999 How can I find the process for killing it?..

Customizing Bootstrap CSS template

I am just getting started with Bootstrap from Twitter and am wondering what the ‘best practices’ is for customization. I want to develop a system that will take advantage of all the power of a css..

Downgrade npm to an older version

I tried updating npm to see if it would solve some dependency problems we were having, and now I want to downgrade to the version the rest of the development team is using. How can I install an older ..

Regex empty string or email

I found a lot of Regex email validation in SO but I did not find any that will accept an empty string. Is this possible through Regex only? Accepting either empty string or email only? I want to hav..

How to calculate percentage when old value is ZERO

I need the logic for the following situation. I am clueless in doing this. Consider for January I have 10$ revenue and for February I have 20$ revenue. My growth would be ((20-10)/10)*100% = 100..

Safari 3rd party cookie iframe trick no longer working?

So this is the umteenth revenge of the "how do I get 3rd party cookies to work in Safari" question but I'm asking again because I think the playing field has changed, perhaps after February 2012. One ..

Open directory using C

I am accepting the path through command line input. When I do dir=opendir(args[1]); it doesn' t enter the loop...i.e dir==null... How do I pass the command line input to dir pointer? void main(i..

Golang append an item to a slice

Why does the slice a remain the same? Does append() generate a new slice? package main import ( "fmt" ) var a = make([]int, 7, 8) func Test(slice []int) { slice = append(slice, 100) fm..

How to get the selected date of a MonthCalendar control in C#

How to get the selected date of a MonthCalendar control in C# (Window forms)..

How can you tell if a value is not numeric in Oracle?

I have the following code that returns an error message if my value is invalid. I would like to give the same error message if the value given is not numeric. IF(option_id = 0021) THEN IF((va..

How do I calculate the date in JavaScript three months prior to today?

I Am trying to form a date which is 3 months before the current date. I get the current month by the below code var currentDate = new Date(); var currentMonth = currentDate.getMonth()+1; Can you gu..

How to force a list to be vertical using html css

I have a list i want to add to a <div>. Each listitem contains a <div> which in turn contain an image and a text string. The list must be vertical. I ve tried putting display:block for the..

How to vertically center an image inside of a div element in HTML using CSS?

I have a markup like this: <div> <img /> </div> The div is higher than img: div { height: 100px; } img { height: dynamic-value-smaller-than-100px; } I need the image to ..

Sum values in foreach loop php

foreach($group as $key=>$value) { echo $key. " = " .$value. "<br>"; } For example: doc1 = 8 doc2 = 7 doc3 = 1 I want to count $value, so the result is 8+7+1 = 16. What s..

Adding additional data to select options using jQuery

Very simple question I hope. I have the usual <select> box like this <select id="select"> <option value="1">this</option> <option value="2">that</option> ..

Finding moving average from data points in Python

I am playing in Python a bit again, and I found a neat book with examples. One of the examples is to plot some data. I have a .txt file with two columns and I have the data. I plotted the data just fi..

How can I install packages using pip according to the requirements.txt file from a local directory?

Here is the problem: I have a requirements.txt file that looks like: BeautifulSoup==3.2.0 Django==1.3 Fabric==1.2.0 Jinja2==2.5.5 PyYAML==3.09 Pygments==1.4 SQLAlchemy==0.7.1 South==0.7.3 amqplib==0.6..

Arrays vs Vectors: Introductory Similarities and Differences

What are the differences between an array and a vector in C++? An example of the differences might be included libraries, symbolism, abilities, etc. Array Arrays contain a specific number of elements..

What's the difference between “mod” and “remainder”?

My friend said that there are differences between "mod" and "remainder". If so, what are those differences in C and C++? Does '%' mean either "mod" or "rem" in C?..

How can I read comma separated values from a text file in Java?

I have got this text file with latitude and longitude values of different points on a map. How can I split my string into latitudes and longitudes? What is the general way to do these type of things ..

How do I call one constructor from another in Java?

Is it possible to call a constructor from another (within the same class, not from a subclass)? If yes how? And what could be the best way to call another constructor (if there are several ways to do ..

Text in a flex container doesn't wrap in IE11

Consider the following snippet: _x000D_ _x000D_ .parent {_x000D_ display: flex;_x000D_ flex-direction: column;_x000D_ width: 400px;_x000D_ border: 1px solid red;_x000D_ align-items: center;..

git recover deleted file where no commit was made after the delete

I deleted some files. I did NOT commit yet. I want to reset my workspace to recover the files. I did a git checkout .. But the deleted files are still missing. And git status shows: # On b..

How to add icon to mat-icon-button

I am using Angular with Material <button mat-icon-button><mat-icon svgIcon="thumb-up"></mat-icon>Start Recording</button> I am trying to add an icon to button, but I can't ..

How to Generate a random number of fixed length using JavaScript?

I'm trying to generate a random number that must have a fixed length of exactly 6 digits. I don't know if JavaScript has given below would ever create a number less than 6 digits? Math.floor((Math.r..

How are POST and GET variables handled in Python?

In PHP you can just use $_POST for POST and $_GET for GET (Query string) variables. What's the equivalent in Python?..

Div with horizontal scrolling only

I have a fixed width DIV containing a table with many columns, and need to allow the user to scroll the table horizontally within the DIV. This needs to work on IE6 and IE7 only (internal client appl..

Why do we need boxing and unboxing in C#?

Why do we need boxing and unboxing in C#? I know what boxing and unboxing is, but I can't comprehend the real use of it. Why and where should I use it? short s = 25; object objshort = s; //Boxing ..

Running javascript in Selenium using Python

I am totally new to Selenium. I want to execute a javascript snippet in the following code(as commented in the code), but can't do so. Please help. from selenium import webdriver import selenium from..

Placeholder Mixin SCSS/CSS

I'm trying to create a mixin for placeholders in sass. This is the mixin I've created. @mixin placeholder ($css) { ::-webkit-input-placeholder {$css} :-moz-placeholder {$css} ::-moz..

How to validate white spaces/empty spaces? [Angular 2]

I would like to avoid white spaces/empty spaces in my angular 2 form? Is it possible? How can this be done?..

PHP code is not being executed, instead code shows on the page

I'm trying to execute some PHP code on a project (using Dreamweaver) but the code isn't being run. When I check the source code, the PHP code appears as HTML tags (I can see it in the source code). A..

How to break out from a ruby block?

Here is Bar#do_things: class Bar def do_things Foo.some_method(x) do |x| y = x.do_something return y_is_bad if y.bad? # how do i tell it to stop and return do_things?

Where do I find the line number in the Xcode editor?

In Xcode 3, the line number of the current cursor location was displayed. I don't see this in Xcode 4. Is there a setting that will turn it on? Or a keypress that will give it to me?..

How to get image height and width using java?

Is there any other way besides using to get image height and width? Because I encounter an issue that locks up the thread. at com.sun.medialib.codec.jpeg.Decoder.njpeg_decode(Native Met..

How to use ADB to send touch events to device using sendevent command?

I am trying to send touch events to a device using AndroidDebugBridge, so that I can do some basic automation for UI tests. I have followed the discussion in LINK. I am able to use sendevent to simula..


For simplicity, assume all relevant fields are NOT NULL. You can do: SELECT table1.this, table2.that, table2.somethingelse FROM table1, table2 WHERE table1.foreignkey = table2.primarykey..

How to find which columns contain any NaN value in Pandas dataframe

Given a pandas dataframe containing possible NaN values scattered here and there: Question: How do I determine which columns contain NaN values? In particular, can I get a list of the column names co..

ExtJs Gridpanel store refresh

I am binding ExtJs Gridpanel from database and add "Delete" button below my gridpanel. By using the delete button handler, I have deleted selected record on gridpanel. But, after deleting, the grid do..

Android JSONObject - How can I loop through a flat JSON object to get each key and value

{ "key1": "value1", "key2": "value2", "key3": "value3" } How I can get each item's key and value without knowing the key nor value beforehand?..

Changing all files' extensions in a folder with one command on Windows

How can I use the Windows command line to change the extensions of thousands of files to *****.jpg?..

How can I do a case insensitive string comparison?

How can I make the line below case insensitive? drUser["Enrolled"] = (enrolledUsers.FindIndex(x => x.Username == (string)drUser["Username"]) != -1); I was given some advice earlier today ..

Is it possible to start activity through adb shell?

I want to start activity through adb shell. So that I can launch a specific activity that is needed..

How to check Oracle database for long running queries

My application, which uses an Oracle database, is going slow or appears to have stopped completely. How can find out which queries are most expensive, so I can investigate further?..

check if variable empty

if ($user_id == NULL || $user_name == NULL || $user_logged == NULL) { $user_id = '-1'; $user_name = NULL; $user_logged = NULL; } if ($user_admin == NULL) { $user_admin = NULL; } Is ..

Removing "NUL" characters

I have got characters like that in my notepad++ When i am trying to copy whole line, i am actually copying everything until "NUL": File:1 What i want to do, is replace those null, to be nothing,..

How to make JQuery-AJAX request synchronous

How do i make an ajax request synchronous? I have a form which needs to be submitted. But it needs to be submitted only when the user enters the correct password. Here is the form code: <form na..

Working around MySQL error "Deadlock found when trying to get lock; try restarting transaction"

I have a MySQL table with about 5,000,000 rows that are being constantly updated in small ways by parallel Perl processes connecting via DBI. The table has about 10 columns and several indexes. One ..

Create a .tar.bz2 file Linux

On my Linux machine, I wish to create a .tar.bz2 file of a certain folder. Once I place myself in that folder (in the terminal), what do I type in the terminal command line to place the compressed fol..

How do you create a yes/no boolean field in SQL server?

What is the best practice for creating a yes/no i.e. Boolean field when converting from an access database or in general?..

Jquery: Find Text and replace

<div id="id1"> <p> apple </p> <p> ball </p> <p> cat </p> <p> dogsss </p> </div> How Do I change dogsss to dollsss usin..

How to create a simple map using JavaScript/JQuery

How can you create the JavaScript/JQuery equivalent of this Java code: Map map = new HashMap(); //Doesn't not have to be a hash map, any key/value map is fine map.put(myKey1, myObj1); map.put(myKey2,..

Angular Directive refresh on parameter change

I have an angular directive which is initialized like so: <conversation style="height:300px" type="convo" type-id="{{some_prop}}"></conversation> I'd like it to be smart enough to refre..

bash export command

I am encountering a strange problem with my 64bit Ubuntu - on the export command. Basically, I have got a VM installation on Ubuntu on my Win7, and I am trying to pass commands from my windows to my ..

Integer to IP Address - C

I'm preparing for a quiz, and I have a strong suspicion I may be tasked with implementing such a function. Basically, given an IP address in network notation, how can we get that from a 32 bit integer..

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

What REALLY happens when you don't free after malloc?

This has been something that has bothered me for ages now. We are all taught in school (at least, I was) that you MUST free every pointer that is allocated. I'm a bit curious, though, about the real..

ValueError: all the input arrays must have same number of dimensions

I'm having a problem with np.append. I'm trying to duplicate the last column of 20x361 matrix n_list_converted by using the code below: n_last = [] n_last = n_list_converted[:, -1] n_lists = np.appe..

Change all files and folders permissions of a directory to 644/755

How would I change all files to 644 and all folders to 755 using chmod from the linux command prompt? (Terminal)..

Get program path in VB.NET?

How can I get the absolute path of program I'm running?..

How do I prevent DIV tag starting a new line?

I want to output a single line of text to the browser that contains a tag. When this is rendered it appears that the DIV causes a new line. How can I include the content in the div tag on the same li..

What is Bootstrap?

There are a lot of questions here related to Bootstrap. I see a lot of people using it. So I tried to research it, and I found the official Bootstrap site, but there was only a download section and a ..

<div> cannot appear as a descendant of <p>

I'm seeing this. It's not a mystery what it is complaining about: Warning: validateDOMnesting(...): <div> cannot appear as a descendant of <p>. See ... SomeComponent > p > ... > ..

"google is not defined" when using Google Maps V3 in Firefox remotely

Here's my conundrum: I have a page that uses Google Maps V3 and jQuery. It all worked well locally in FF5, Chrome and Safari. Once I uploaded to a web site, I get a "google is not defined" error on ..

Tools for making latex tables in R

On general request, a community wiki on producing latex tables in R. In this post I'll give an overview of the most commonly used packages and blogs with code for producing latex tables from less stra..

H.264 file size for 1 hr of HD video

I'm looking for an order of magnitude estimate for expected on-disk file size for 1 hour of H.264 encoded HD video transcoded from HDV (HD on a MiniDV tape). I want to archive approximately 100 hours ..

How to create global variables accessible in all views using Express / Node.JS?

Ok, so I have built a blog using Jekyll and you can define variables in a file _config.yml which are accessible in all of the templates/layouts. I am currently using Node.JS / Express with EJS templat..

Combine two or more columns in a dataframe into a new column with a new name

For example if I have this: n = c(2, 3, 5) s = c("aa", "bb", "cc") b = c(TRUE, FALSE, TRUE) df = data.frame(n, s, b) n s b 1 2 aa TRUE 2 3 bb FALSE 3 5 cc TRUE Then how do I combine th..

How to increase Java heap space for a tomcat app

There are lots of questions that ask this or a similar question. They all give the command that has to be executed, what I don't understand is where do I write this command. I want to permanently inc..

Android: android.content.res.Resources$NotFoundException: String resource ID #0x5

I get the exception from the title when I run my app. What it does is it has a .txt file with words for a Hangman game and I think the exception is thrown when accessing the file. My file, cuvinte.txt..

What is the reason for java.lang.IllegalArgumentException: No enum const class even though iterating through values() works just fine?

This question is basically an extension of my previous question . I asked the previous question to be sure that the Enum constants are populated when the class loads . Here's is my class again with th..

Execution failed for task 'app:mergeDebugResources' Crunching Cruncher....png failed

I've added some pictures with the format *.png to my drawable-directory and linked it with the layouts. But every time when I tried to build it, there appears an error "...Crunching Crunsher ...p..

Function for 'does matrix contain value X?'

Is there a built in MATLAB function to find out if a matrix contains a certain value? (ala PHP's in_array())..

adding and removing classes in angularJs using ng-click

I am trying to work how to add a class with ngClick. I have uploaded up my code onto plunker Click here. Looking at the angular documentation i can't figure out the exact way it should be done. Below ..

How can I add an item to a IEnumerable<T> collection?

My question as title above. For example, IEnumerable<T> items = new T[]{new T("msg")}; items.ToList().Add(new T("msg2")); but after all it only has 1 item inside. Can we have a method like ..

PHP if not statements

This may be the way my server is set up, but I'm banging my head against the wall. I'm trying to say that if $action has no value or has a value that is not "add" or "delete" then have an error, else ..

How to convert a set to a list in python?

I am trying to convert a set to a list in Python 2.6. I'm using this syntax: first_list = [1,2,3,4] my_set=set(first_list) my_list = list(my_set) However, I get the following stack trace: Tracebac..

React - changing an uncontrolled input

I have a simple react component with the form which I believe to have one controlled input: import React from 'react'; export default class MyForm extends React.Component { constructor(props) { ..

The following untracked working tree files would be overwritten by merge, but I don't care

On my branch I had some files in .gitignore On a different branch those files are not. I want to merge the different branch into mine, and I don't care if those files are no longer ignored or not. ..

Convert from DateTime to INT

In my SSIS package, I have to converting values from DateTime to a corresponding INTEGER value. The following sample has been provided. Any ideas as to how I can convert these? DATETIME INT ------..

Sys is undefined

I have an ASP.Net/AJAX control kit project that i am working on. 80% of the time there is no problem. The page runs as it should. If you refresh the page it will sometimes show a javascript error "..

Failed to resolve: (Dependency Error)

I am having this issue in Android studio. Error:Failed to resolve: <a href="install.m2.repo">Install Repository and sync project</a><br><a h..

Regex: Specify "space or start of string" and "space or end of string"

Imagine you are trying to pattern match "stackoverflow". You want the following: this is stackoverflow and it rocks [MATCH] stackoverflow is the best [MATCH] i love stackoverflow [MATCH] typo..

How to use __DATE__ and __TIME__ predefined macros in as two integers, then stringify?

Want to use __ DATE __ and __ TIME __ as integer for giving automated version to my code in compile time. #define STRINGIZER(arg) #arg #define STR_VALUE(arg) STRINGIZER(arg) #define DATE_as..

Can HTML be embedded inside PHP "if" statement?

I would like to embed HTML inside a PHP if statement, if it's even possible, because I'm thinking the HTML would appear before the PHP if statement is executed. I'm trying to access a table in a dat..

How can I get a character in a string by index?

I know that I can return the index of a particular character of a string with the indexof() function, but how can I return the character at a particular index?..

Getting a slice of keys from a map

Is there any simpler/nicer way of getting a slice of keys from a map in Go? Currently I am iterating over the map and copying the keys to a slice: i := 0 keys := make([]int, len(mymap)) for k := ran..

Filter data.frame rows by a logical condition

I want to filter rows from a data.frame based on a logical condition. Let's suppose that I have data frame like expr_value cell_type 1 5.345618 bj fibroblast 2 5.195871 bj fibroblast 3 ..

How to print multiple lines of text with Python

If I wanted to print multiple lines of text in Python without typing print('') for every line, is there a way to do that? I'm using this for ASCII art. (Python 3.5.1)..

Set line spacing

How can I set line spacing with CSS, like we can set it in MS Word?..

Extract hostname name from string

I would like to match just the root of a URL and not the whole URL from a text string. Given: htt..

Expected block end YAML error

When pasting this YAML file into an online yaml parser, I got an expected block end error: ADDATTEMPTING: 'Tentative d ajout ' ATTEMPTINGTOGIVE: 'Tenter de donner ' ATTEMPTINGTOSET1: 'Tentative de d�..

Why is textarea filled with mysterious white spaces?

I have a simple text area in a form like this: <textarea style="width:350px; height:80px;" cols="42" rows="5" name="sitelink"> <?php if($siteLink_val) echo $siteLink_val; ?> </tex..

Add Foreign Key relationship between two Databases

I have two tables in two different databases. In table1 (in database1) there is a column called column1 and it is a primary key. Now in table2 (in database2) there is a column called column2 and I wan..

SQL Server default character encoding

By default - what is the character encoding set for a database in Microsoft SQL Server? How can I see the current character encoding in SQL Server?..

What characters do I need to escape in XML documents?

What characters must be escaped in XML documents, or where could I find such a list?..