Questions Tagged with #Sos

SOS is an extension DLL that allows debugging of managed .NET code using the debuggers from Debugging Tools for Windows, such as WinDbg.

how to format date in Component of angular 5

I am new to angular and looking to format date in component ngOnInit method. I have seen some example where pipe operator are used to format the data but i dont know how to format date in component fi..

How to set 00:00:00 using moment.js

I want to get current date but time should be 00:00:00.000 I've try this: var m = moment(); m.set({hour:0,minute:0,second:0,millisecond:0}); console.log(m.toISOString()); but I've got: 2016-01-12T..

SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) symfony2

When I try to login I get an error: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) parametrs.yml: This file is auto-generated during the composer install pa..

How to download a file using a Java REST service and a data stream

I have 3 machines: server where the file is located server where REST service is running ( Jersey) client(browser) with access to 2nd server but no access to 1st server How can I directly (withou..

How to configure Docker port mapping to use Nginx as an upstream proxy?

Update II It's now July 16th, 2015 and things have changed again. I've discovered this automagical container from Jason Wilder: and it solves this prob..

Python Pip install Error: Unable to find vcvarsall.bat. Tried all solutions

I tried to install Scrapy for Python 2.7.8 (anaconda 2.1.0) 32-bit using pip install scrapy And I got this error error: Microsoft Visual C++ 10.0 is required (Unable to find vcvarsall.bat). I..

What's the difference between Apache's Mesos and Google's Kubernetes

What exactly is the difference between Apache's Mesos and Google's Kubernetes? I understand both are server cluster management software. Can anyone elaborate where the main differences are - when woul..

Exporting PDF with jspdf not rendering CSS

I am using jspdf.debug.js to export different data from a website but there are a few problems, I can't get it to render the CSS in the exported PDF and if I have an image in the page I am exporting, ..

pip is not able to install packages correctly: Permission denied error

I am trying to install lxml to install scrapy on my Mac (v 10.9.4) [email protected] ~ ?-? pip install lxml Downloading/unpacking lxml Downloading lxml-3.4.0.tar.gz (3.5MB):..

How to turn off INFO logging in Spark?

I installed Spark using the AWS EC2 guide and I can launch the program fine using the bin/pyspark script to get to the spark prompt and can also do the Quick Start quide successfully. However, I cann..

How to force DNS refresh for a website?

I'm moving my web application to another server and in the next few days I'll refresh the DNS to point to the new IP location. Unfortunately some browsers and SOs keep a DNS cache that will make user..

Where can I find a NuGet package for upgrading to System.Web.Http v5.0.0.0?

Just upgraded an ASP.NET MVC4 project to use Unity.WebApi version and it requires System.Web.Http v as per the following error: Assembly 'Unity.WebApi, Version=, Culture=neutral..

Python UTC datetime object's ISO format doesn't include Z (Zulu or Zero offset)

Why python 2.7 doesn't include Z character (Zulu or zero offset) at the end of UTC datetime object's isoformat string unlike JavaScript? >>> datetime.datetime.utcnow().isoformat() '2013-10-2..

Jquery to get the id of selected value from dropdown

I have a drop down list that fetches values from db as follows $.get('/getJobs', function (jobs) { seljobs = jobs; var i = 0; jobs.forEach(function (n) { ..

Include .so library in apk in android studio

I am trying my hands on developing a simple android application in which I am trying to use sqlcipher, which uses .so libraries internally. I have read the documentation on how to use sqlcipher with a..

AngularJS: ng-model not binding to ng-checked for checkboxes

I referred to this before asking this question. AngularJs doesn't bind ng-checked with ng-model If ng-checked is evaluated to true on the html side, the ng-model is not updated. I can't ng-repea..

SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: YES) Symfony2

I tried to create my DB with Symfony2 typing the command below: php app/console doctrine:create:database The result is: Could not create database for connection named jobeet SQLSTATE[280..

How to Sort Date in descending order From Arraylist Date in android?

I have an ArrayList which stores Dates and I sorted them in descending order. Now I want to display them in a ListView. This is what I did so far: spndata.setOnItemSelectedListener(new OnItemSelecte..

Error Microsoft.Web.Infrastructure, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35

I have a small web application. Which was working fine until I added two genericHandler in my application. I have made the following changes for the http handler <system.web> <authent..

javascript toISOString() ignores timezone offset

I am trying to convert Twitter datetime to a local iso-string (for prettyDate) now for 2 days. I'm just not getting the local time right.. im using the following function: function getLocalISOTime(t..

__proto__ VS. prototype in JavaScript

This figure again shows that every object has a prototype. Constructor function Foo also has its own __proto__ which is Function.prototype, and which in turn also references via its __proto__ p..

Target a css class inside another css class

Hi I am having problems with some css classes in joomla. I have two divs in a module, one is the wrapper class="wrapper", the other is the content class="content" . Content is inside wrapper. What I a..

Check if string has space in between (or anywhere)

Is there a way to determine if a string has a space(s) in it? sossjjs sskkk should return true, and sskskjsk should return false. "sssss".Trim().Length does not seem to work...

How to format a number as percentage in R?

One of the things that used to perplex me as a newby to R was how to format a number as a percentage for printing. For example, display 0.12345 as 12.345%. I have a number of workarounds for this, b..

Use of exit() function

I want to know how and when can I use the exit() function like the program in my book: #include<stdio.h> void main() { int goals; printf("enter number of goals scored"); scanf("%d"..

Tricks to manage the available memory in an R session

What tricks do people use to manage the available memory of an interactive R session? I use the functions below [based on postings by Petr Pikal and David Hinds to the r-help list in 2004] to list (a..

Python: List vs Dict for look up table

I have about 10million values that I need to put in some type of look up table, so I was wondering which would be more efficient a list or dict? I know you can do something like this for both: if so..

WPF TabItem Header Styling

I'm trying to style a TabControl and have got 75% of the way there, but I'm having difficulty styling the actual TabItems: What I am trying to achieve is remove the default ContentPresenter so that..

How do I setup a SSL certificate for an express.js server?

Before, in an older version of express, I could do this: express.createServer({key:'keyFile', cert:'certFile'}); However, in newer versions of express this no longer works: var app = express(); ..

Passing arrays as parameters in bash

How can I pass an array as parameter to a bash function? Note: After not finding an answer here on Stack Overflow, I posted my somewhat crude solution myself. It allows for only one array being passed..

Get access to parent control from user control - C#

How do I get access to the parent controls of user control in C# (winform). I am using the following code but it is not applicable on all types controls such as ListBox. Control[] Co = this.TopLevelC..

Using a dictionary to count the items in a list

I'm new to Python and I have a simple question, say I have a list of items: ['apple','red','apple','red','red','pear'] Whats the simpliest way to add the list items to a dictionary and count how ma..

How to set custom ActionBar color / style?

I am using Android Navigation bar in my project, I want to change the top color in action bar to something red, How can i do that? I have something like this, and i want something like this, how can..

How to get 30 days prior to current date?

I have a start calendar input box and an end calendar input box. We want defaults start calendar input box 30 days prior to current date and the end calendar input box to be the current date. Here is ..

How to check if a string contains a substring in Bash

I have a string in Bash: string="My string" How can I test if it contains another string? if [ $string ?? 'foo' ]; then echo "It's there!" fi Where ?? is my unknown operator. D..

How to get a Docker container's IP address from the host

Is there a command I can run to get the container's IP address right from the host after a new container is created? Basically, once Docker creates the container, I want to roll my own code deploymen..

How to get the current time in Google spreadsheet using script editor?

There is an option to write a script and bind it to a trigger. The question is, how to get the current time in the script body? function myFunction() { var currentTime = // <<??? } ..

How to use XMLReader in PHP?

I have the following XML file, the file is rather large and i haven't been able to get simplexml to open and read the file so i'm trying XMLReader with no success in php <?xml version="1.0" encodi..

ProcessBuilder: Forwarding stdout and stderr of started processes without blocking the main thread

I'm building a process in Java using ProcessBuilder as follows: ProcessBuilder pb = new ProcessBuilder() .command("somecommand", "arg1", "arg2") .redirectErrorStream(true); Process p ..

Password hash function for Excel VBA

I need a function written in Excel VBA that will hash passwords using a standard algorithm such as SHA-1. Something with a simple interface like: Public Function CreateHash(Value As String) As Strin..

What does InitializeComponent() do, and how does it work in WPF?

What does InitializeComponent() do, and how does it work in WPF? In general first, but I would especially be interested to know the gory details of order of construction, and what happens when there ..

Java Set retain order?

Does a Java Set retain order? A method is returning a Set to me and supposedly the data is ordered but iterating over the Set, the data is unordered. Is there a better way to manage this? Does the m..

Configuring Log4j Loggers Programmatically

I am trying to use SLF4J (with log4j binding) for the first time. I would like to configure 3 different named Loggers that can be returned by a LoggerFactory which will log different levels and push ..

Dynamically create checkbox with JQuery from text input

In my cms I have a checkbox group for categories. I would like to have a text input below that where the user can input the name of a new category and it will dynamically add a new checkbox with the p..

How to detect READ_COMMITTED_SNAPSHOT is enabled?

In MS SQL Server is there a way to detect whether a database has had its isolation level set via the T-SQL command ALTER DATABASE <database> SET READ_COMMITTED_SNAPSHOT ON; I cannot find a simp..

Passing vector by reference

Using normal C arrays I'd do something like that: void do_something(int el, int **arr) { *arr[0] = el; // do something else } Now, I want to replace standard array with vector, and achieve th..

get name of a variable or parameter

I would like to get the name of a variable or parameter: For example if I have: var myInput = "input"; var nameOfVar = GETNAME(myInput); // ==> nameOfVar should be = myInput void testName([Typ..

Execute a large SQL script (with GO commands)

I need to execute a large set of SQL statements (creating a bunch of tables, views and stored procedures) from within a C# program. These statements need to be separated by GO statements, but SqlComm..

wampserver doesn't go green - stays orange

I am trying to install wampserver on a win7-32bit. The installation goes smoothly but the icon doesn't turn green. It stays orange saying "Server online". I've trying different solutions nothing worke..

How to uninstall a package installed with pip install --user

There is a --user option for pip which can install a Python package per user: pip install --user [python-package-name] I used this option to install a package on a server for which I do not have ro..

Programmatically add custom event in the iPhone Calendar

Is there any way to add iCal event to the iPhone Calendar from the custom App?..

Pandas conditional creation of a series/dataframe column

I have a dataframe along the lines of the below: Type Set 1 A Z 2 B Z 3 B X 4 C Y I want to add another column to the dataframe (o..

Getting attribute using XPath

Given an XML structure like so: <?xml version="1.0" encoding="ISO-8859-1"?> <bookstore> <book> <title lang="eng">Harry Potter</title> <price>29.99</price&..

Showing the stack trace from a running Python application

I have this Python application that gets stuck from time to time and I can't find out where. Is there any way to signal Python interpreter to show you the exact code that's running? Some kind of on..

Implementing SearchView in action bar

I need to create SearchView from my arrayList<String> and show the suggestions in the drop-down list same this I look for tutorials that explain step by step how to build a SearchView in a ..

Replacement for deprecated sizeWithFont: in iOS 7?

In iOS 7, sizeWithFont: is now deprecated. How do I now pass in the UIFont object into the replacement method sizeWithAttributes:?..

Python popen command. Wait until the command is finished

I have a script where I launch with popen a shell command. The problem is that the script doesn't wait until that popen command is finished and go continues right away. om_points = os.popen(command, ..

GROUP BY + CASE statement

I have a working query that is grouping data by hardware model and a result, but the problem is there are many "results". I have tried to reduce that down to "if result = 0 then keep as 0, else set ..

How to increase Bootstrap Modal Width?

i've tried this but gone wrong here's the css body .modal-ku { width: 750px; } and here's the failed result ..

How do I keep two side-by-side divs the same height?

I have two divs side by side. I'd like the height of them to be the same, and stay the same if one of them resizes. I can't figure this one out though. Ideas? To clarify my confusing question, I'd li..

How to set focus on an input field after rendering?

What's the react way of setting focus on a particular text field after the component is rendered? Documentation seems to suggest using refs, e.g: Set ref="nameInput" on my input field in the render ..

How to rename JSON key

I have a JSON object with the following content: [ { "_id":"5078c3a803ff4197dc81fbfb", "email":"[email protected]", "image":"some_image_url", "name":"Name 1" }, { "_id":"5078c..

jQuery AJAX Call to PHP Script with JSON Return

I've been smashing my head against a brick wall with this one, i've tried loads of the solutions on stackoverflow but can't find one that works! Basically when I POST my AJAX the PHP returns JSON bu..

sql searching multiple words in a string

What is the most efficient and elegant SQL query looking for a string containing the words "David", "Moses" and "Robi". Assume the table is named T and the column C...

How can I read inputs as numbers?

Why are x and y strings instead of ints in the below code? (Note: in Python 2.x use raw_input(). In Python 3.x use input(). raw_input() was renamed to input() in Python 3.x) play = True while play:..

How to validate an email address in JavaScript

Is there a regular expression to validate an email address in JavaScript?..

How to install a specific version of package using Composer?

I am trying to install a specific version of a package using Composer. I tried composer install and composer require but they are installing the latest version of the package. What if I want an older ..

How do I access properties of a javascript object if I don't know the names?

Say you have a javascript object like this: var data = { foo: 'bar', baz: 'quux' }; You can access the properties by the property name: var foo =; var baz = data["baz"]; But is it possi..

Upload files with FTP using PowerShell

I want to use PowerShell to transfer files with FTP to an anonymous FTP server. I would not use any extra packages. How? There must be no risk that the script hangs or crashes...

List<Object> and List<?>

I have two questions, actaully... First off, Why cant I do this: List<Object> object = new List<Object>(); And second, I have a method that returns a List<?>, how would I turn tha..

Getting a count of objects in a queryset in django

How can I add a field for the count of objects in a database. I have the following models: class Item(models.Model): name = models.CharField() class Contest(models.Model); name = models.Char..

How to dump a table to console?

I'm having trouble displaying the contents of a table which contains nested tables (n-deep). I'd like to just dump it to std out or the console via a print statement or something quick and dirty but I..

How can I play sound in Java?

I want to be able to play sound files in my program. Where should I look?..

Visual Studio 2013 Install Fails: Program Compatibility Mode is on (Windows 10)

I want to install Visual Studio Ultimate 2013 on my Windows 10 but I have this error: I have done these two things (they have solved the problem on Windows 8) but still I cannot install it. ..

When should I use nil and NULL in Objective-C?

This is sample code: NSDictionary *myDictionary = [NSDictionary dictionary]; NSNumber *myNumber = [myDictionary valueForKey: @"MyNumber"]; NSLog(@"myNumber = %@", myNumber); // output myNumber = (nul..

Get type of all variables

In R, I'd like to retrieve a list of global variables at the end of my script and iterate over them. Here is my code #declare a few sample variables a<-10 b<-"Hello world" c<-data.frame() #..

How to detect the swipe left or Right in Android?

I have an EditText view in android. On this I want to detect swipe left or right. I am able to get it on an empty space using the code below. But this does not work when I swipe on an EditText. How do..

Return row number(s) for a particular value in a column in a dataframe

I have a data frame (df) and I was wondering how to return the row number(s) for a particular value (2585) in the 4th column (height_chad1) of the same data frame? I've tried: row(mydata_2$height_..

Check if a string contains an element from a list (of strings)

For the following block of code: For I = 0 To listOfStrings.Count - 1 If myString.Contains(lstOfStrings.Item(I)) Then Return True End If Next Return False The output is: Case 1: m..

The network path was not found

I'm running my code and getting this error. But what does it mean? The network path was not found Description: An unhandled exception occurred during the execution of the current web request. P..

Delete specific line from a text file?

I need to delete an exact line from a text file but I cannot for the life of me workout how to go about doing this. Any suggestions or examples would be greatly appreciated? Related Questions Effic..

Swift add icon/image in UITextField

I would like to add icon/image in UITextField. The icon/image should be left to placeholder. I tried this: var imageView = UIImageView(); var image = UIImage(named: "email.png"); imageView.image =..

Can't access RabbitMQ web management interface after fresh install

I've installed the latest RabbitMQ server (rabbitmq-server-3.3.0-1.noarch.rpm) on a fresh Centos 5.10 VM according to the instructions on the official site. I've done this many times before during de..

How do I delete a Git branch locally and remotely?

I want to delete a branch both locally and remotely. Failed Attempts to Delete a Remote Branch $ git branch -d remotes/origin/bugfix error: branch 'remotes/origin/bugfix' not found. $ git branch -d o..

Why is there still a row limit in Microsoft Excel?

Until Office 2007, Excel has a maximum of 65,000 rows. Office 2007 bumped that up to a max of 1 million rows, which is nicer of course; but I'm curious -- why is there a limit at all? Obviously, perfo..

How to set a:link height/width with css?

I just can't set the height and width of a elements of my navigation. #header div#snav div a{ width:150px; height:77px; } #header div#snav div a:link{ width:150px; height:77px; } #..

Python No JSON object could be decoded

I am having an issue with JSON, I can't seem to figure out why this is not working. This is supposed to output JSON. Here is my code #!/usr/bin/env python import socket import struct import json d..

How can I find the OWNER of an object in Oracle?

I want to find the foreign keys of a table but there may be more than one user / schema with a table with the same name. How can I find the one that the currently logged user is seeing? Is there a fun..

Force IE9 to emulate IE8. Possible?

Is this possible at all? I tried adding this to the page but it didn't change a thing. <meta http-equiv="X-UA-Compatible" content="IE=8"> UPDATE- I'm trying to do this because our site has so..

Can't find bundle for base name /Bundle, locale en_US

I'm using a library that has a dependency on JSF. When I try to run my project, it show following exception massage.. java.util.MissingResourceException: Can't find bundle for base name /Bundle, lo..

The model backing the <Database> context has changed since the database was created

The error message : "The model backing the 'AddressBook' context has changed since the database was created. Either manually delete/update the database, or call Database.SetInitializer with an ID..

Comparing two byte arrays in .NET

How can I do this fast? Sure I can do this: static bool ByteArrayCompare(byte[] a1, byte[] a2) { if (a1.Length != a2.Length) return false; for (int i=0; i<a1.Length; i++) ..

Changing Placeholder Text Color with Swift

I have a design that implements a dark blue UITextField, as the placeholder text is by default a dark grey colour I can barely make out what the place holder text says. I've googled the problem of co..

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

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

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

Immediate exit of 'while' loop in C++

How do I exit a while loop immediately without going to the end of the block? For example, while (choice != 99) { cin >> choice; if (choice == 99) //Exit here and don't get add..

Using Bootstrap Tooltip with AngularJS

I am trying to use the Bootstrap tooltip in an app of mine. My app is using AngularJS Currently, I have the following: <button type="button" class="btn btn-default" data-toggle="tooltip" ..

Merge or combine by rownames

In the example below I have two datasets (Z and A). I want to merge or combine these sets by the ILMN numbers. If there is no match, fill in NA. z <- matrix(c(0,0,1,1,0,0,1,1,0,0,0,0,1,0,1,1,0,1,..

Java Error opening registry key

I get this error when I try to do anything with Java in command prompt: Error opening registry key 'Software\JavaSoft\Java Runtime Environment.3' Error: could not find Java.dll Error: could not find ..

How to prompt for user input and read command-line arguments

How do I have a Python script that a) can accept user input and how do I make it b) read in arguments if run from the command line?..

How to redirect a URL path in IIS?

In IIS 6.0, is there an easy way to re-direct requests to a folder to another folder, while preserving the rest of the path. e.g. If I have moved the content from: to stuff.mysit..

Scrolling a div with jQuery

I am attempting to create a div in a container within a container which is scrollable with up and down arrows in jQuery. The only thing I can find which I wish to use was

Clone contents of a GitHub repository (without the folder itself)

I'd like to git clone the contents of a repository I have on GitHub. When I git clone (git@github:me/name.git...) I get a folder called name/ and inside name I have my contents... How do I get JUST th..

Access IP Camera in Python OpenCV

How do I access my IP Camera stream? Code for displaying a standard webcam stream is import cv2 import numpy as np cap = cv2.VideoCapture(0) while(True): ret, frame = cv2.imshow('..

PHP Undefined Index

This is going to sound really stupid, but I cannot figure out why I am getting this error. I have created a selection box, named "query_age" in my html form: <form method="get" action="user_list...

Warning: DOMDocument::loadHTML(): htmlParseEntityRef: expecting ';' in Entity,

$html = file_get_contents(""); $dom = new DOMDocument(); $dom->loadHTML($html); echo $dom; throws Warning: DOMDocument::loadHTML(): htmlParseEntityRef: expecting ';' in..

Difference between jQuery’s .hide() and setting CSS to display: none

Which am I better off doing? .hide() is quicker than writing out .css("display", "none"), but what’s the difference and what are both of them actually doing to the HTML element?..

Redirecting to another page in ASP.NET MVC using JavaScript/jQuery

I want to redirect from one page to another page in ASP.NET MVC 3.0 using JavaScript/jQuery/Ajax. On button click event I have written JavaScript code like below. function foo(id) { $.post('/Bran..

jQuery Popup Bubble/Tooltip

I'm trying to make a "bubble" that can popup when the onmouseover event is fired and will stay open as long as the mouse is over the item that threw the onmouseover event OR if the mouse is moved into..

addID in jQuery?

Is there any method available to add IDs like there is for adding a class - addClass()?..

Remove a JSON attribute

if I have a JSON object say: var myObj = {'test' : {'key1' : 'value', 'key2': 'value'}} can I remove 'key1' so it becomes: {'test' : {'key2': 'value'}} ..

Python logging not outputting anything

In a python script I am writing, I am trying to log events using the logging module. I have the following code to configure my logger: ERROR_FORMAT = "%(levelname)s at %(asctime)s in %(funcName)s in ..

How to retrieve a module's path?

I want to detect whether module has changed. Now, using inotify is simple, you just need to know the directory you want to get notifications from. How do I retrieve a module's path in python?..

Android Studio - Emulator - eglSurfaceAttrib not implemented

I have created an application with android studio, never change a single word in any file. when trying to run it on the emulator I got the following error: W/EGL_emulation? eglSurfaceAttrib not imp..

In Python, what does dict.pop(a,b) mean?

class a(object): data={'a':'aaa','b':'bbb','c':'ccc'} def pop(self, key, *args): return, *args)#what is this mean. b=a() print b.pop('a',{'b':'bbb'}) print b.dat..

Delete column from SQLite table

I have a problem: I need to delete a column from my SQLite database. I wrote this query alter table table_name drop column column_name but it does not work. Please help me...

PowerShell script to return versions of .NET Framework on a machine?

What would a PowerShell script be to return versions of the .NET Framework on a machine? My first guess is something involving WMI. Is there something better? It should be a one-liner to return only..

How to change the font size on a matplotlib plot

How does one change the font size for all elements (ticks, labels, title) on a matplotlib plot? I know how to change the tick label sizes, this is done with: import matplotlib matplotlib.rc('xtick'..

How to assign the output of a Bash command to a variable?

I have a problem putting the content of pwd command into a shell variable that I'll use later. Here is my shell code (the loop doesn't stop): #!/bin/bash pwd= `pwd` until [ $pwd = "/" ] do ..

How do I turn a String into a InputStreamReader in java?

How can I transform a String value into an InputStreamReader?..

How to get my activity context?

I don't really get the idea behind how this whole thing works really, so if I have some class A that need the context of a class B which extends Activity, how do i get that context? I'm searching for..

Are there any SHA-256 javascript implementations that are generally considered trustworthy?

I am writing a login for a forum, and need to hash the password client side in javascript before sending it on to the server. I'm having trouble figuring out which SHA-256 implementation I can actuall..

Converting a string to JSON object

How do you make JS think that a string is JSON ? I have a function which only works if JSON object is passed to it. If I pass a string to it, with same format as JSON, it doesn't work. So I want to m..

HTML Input - already filled in text

I was wondering, is there a way to put text into an input field? What i've got now is a placeholder, but that's actually an empty inputfield. So that's not what i'm looking for. I'm looking for an (ki..

The best way to remove duplicate values from NSMutableArray in Objective-C?

The best way to remove duplicate values (NSString) from NSMutableArray in Objective-C? Is this the easiest and right way to do it? uniquearray = [[NSSet setWithArray:yourarray] allObjects]; ..

How would I extract a single file (or changes to a file) from a git stash?

I'd like to know if it is possible to extract a single file or diff of a file from a git stash without popping the stash changeset off. Might anyone be able to provide some suggestions/ideas about th..

getFilesDir() vs Environment.getDataDirectory()

I want to replace one context method with Environment variable. But not sure if they mean the same. What is the difference between getFilesDir() and Environment.getDataDirectory() ? How can I get d..

Find a string within a cell using VBA

I have been driving myself mad with this for a day, searched high and low, and am probably trying to be too cute so am totally stuck. I am trying to run a simple if then If a cell contains "%" I'd l..

How can I find the number of elements in an array?

I have an int array and I need to find the number of elements in it. I know it has something to do with sizeof but I'm not sure how to use it exactly...

How do you get the current page number of a ViewPager for Android?

I want to know the current page position of the ViewPager. I create an adapter and set this adapter to the ViewPager. Now I want to know the current page number or position of the current view, becaus..

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

I'm using Angular 4 and I am getting an error in the console: Can't bind to 'ngModel' since it isn't a known property of 'input' How can I resolve this?..

How to redirect back to form with input - Laravel 5

How do I redirect back to my form page, with the given POST params, if my form action throws an exception?..

Unknown Column In Where Clause

I have a simple query: SELECT u_name AS user_name FROM users WHERE user_name = "john"; I get Unknown Column 'user_name' in where clause. Can I not refer to 'user_name' in other parts of the statem..

How do I run a PowerShell script when the computer starts?

I have a PowerShell script that monitors an image folder. I need to find a way to automatically run this script after the computer starts. I already tried the following methods, but I couldn't get it..

Check if element is visible on screen

Possible Duplicate: jQuery - Check if element is visible after scroling I'm trying to determine if an element is visible on screen. In order to to this, I'm trying to find the element's ver..

Best way to use multiple SSH private keys on one client

I want to use multiple private keys to connect to different servers or different portions of the same server (my uses are system administration of server, administration of Git, and normal Git usage w..

Node - was compiled against a different Node.js version using NODE_MODULE_VERSION 51

I am running a node application on terminal. Have recently upgraded to node v8.5.0, but am getting this error: Error: The module '/tidee/tidee-au/packages/tidee-au-server/node_modules/bcrypt/lib/bind..

How to check if a string starts with "_" in PHP?

Example: I have a $variable = "_foo", and I want to make absolutely sure that $variable does not start with an underscore "_". How can I do that in PHP? Is there some access to the char array behind t..

How to change cursor from pointer to finger using jQuery?

This is probably really easy, but I've never done it before. How do you change your cursor to the finger (like for clicking on links) instead of the regular pointer? And how to do this with jQuery si..

Managing jQuery plugin dependency in webpack

I'm using Webpack in my application, in which I create two entry points - bundle.js for all my JavaScript files/codes, and vendors.js for all libraries like jQuery and React. What do I do in order to ..

Simple example for Intent and Bundle

I'm new to android with almost no knowledge about Java and XML. I'm learning it through pdfs that i'm getting on net. I have learnt about Toast, a bit about Intents but me not able to understand anyth..

How to embed fonts in HTML?

I'm trying to figure out a decent solution (especially from the SEO side) for embedding fonts in web pages. So far I have seen the W3C solution, which doesn't even work on Firefox, and this pretty coo..

Link to a section of a webpage

I want to make a link that when clicked, sends you to a certain line on the page (or another page). I know this is possible, but how do I do it?..

Add a thousands separator to a total with Javascript or jQuery?

I have a function that sums a column of data in an html table. It does so admirably only I would like to have it put the commas in there that are needed to separate the thousands. Initially, you'll no..

How to use 'hover' in CSS

I used the code below in order to fulfill this target: When mouse hover on the anchor, the underline comes out, but it failed to work, <a class="hover">click</a> a .hover :hove..

How to convert a string into double and vice versa?

I want to convert a string into a double and after doing some math on it, convert it back to a string. How do I do this in Objective-C? Is there a way to round a double to the nearest integer too?..

Timing a command's execution in PowerShell

Is there a simple way to time the execution of a command in PowerShell, like the 'time' command in Linux? I came up with this: $s=Get-Date; .\do_something.ps1 ; $e=Get-Date; ($e - $s).TotalSeconds ..

How to change title of Activity in Android?

I am using Window w = getWindow(); w.setTitle("My title"); to change title of my current Activity but it does not seem to work. Can anyone guide me on how to change this?..

Pointers in JavaScript?

Can we pass a reference of a variable that is immutable as argument in a function? Example: var x = 0; function a(x) { x++; } a(x); alert(x); //Here I want to have 1 instead of 0 ..

How do I format a number to a dollar amount in PHP

How do you convert a number to a string showing dollars and cents? eg: 123.45 => '$123.45' 123.456 => '$123.46' 123 => '$123.00' .13 => '$0.13' .1 => '$0.10' 0 ..

href image link download on click

I generate normal links like: <a href="/path/to/image"><img src="/path/to/image" /></a> in a web app. When I click on the link, it displays the picture in a new page. If you want to..

How do you round a float to 2 decimal places in JRuby?

How do you round a float to 2 decimal places in JRuby(1.6.x)? number = 1.1164 number.round(2) # The above shows the following error # wrong number of arguments (1 for 0) ..

How can I make SMTP authenticated in C#

I create new ASP.NET web application that use SMTP to send message. The problem is the smtp was not authenticated from who send the message. How can I make SMTP authenticated in my program? does C..

Android Button setOnClickListener Design

I am building an Android Application. I've noticed that I am creating many repetitions of code similar to this in each of my classes: Button buttonX = (Button)findViewById(; // Regis..

oracle - what statements need to be committed?

What are the list of statements that need to be committed before further action on the table in order to avoid a lock? I am not talking about full transactions with multiple statements and transaction..

Android Studio Gradle Already disposed Module

I have installed Android Studio version 1.0.1. I have imported my projects from eclipse and it works fine. Then I deleted a module and reimported it into my Android Studio project. The gradle build sa..

How can I insert data into Database Laravel?

I'm new to programming. I have created a basic form inside views/register.blade.php like this @section('content') <h1>Registration Form</h1><hr> <h3>Ple..

Using File.listFiles with FileNameExtensionFilter

I would like to get a list of files with a specific extension in a directory. In the API (Java 6), I see a method File.listFiles(FileFilter) which would do this. Since I need a specific extension, I ..

Get variable from PHP to JavaScript

I want to use a PHP variable in JavaScript. How is it possible?..

JQuery add class to parent element

I have to set a class name on a (li) element. This script find all the (a) elements in the list, and creates a click event. jQuery("#" + ElementID).find(TagName).click(function () { GetPageByUrl..

Proper MIME media type for PDF files

When working with PDFs, I've run across the MIME types application/pdf and application/x-pdf among others. Is there a difference between these two types, and if so what is it? Is one preferred over ..

Create a new cmd.exe window from within another cmd.exe prompt

I am in the process of setting up CruiseControl.NET. The problem I am having is that I am running CC as a console application and when my build completes successfully and executes (using exec) it laun..

SQL Server tables: what is the difference between @, # and ##?

In SQL Server, what is the difference between a @ table, a # table and a ## table?..

How to call loading function with React useEffect only once

The useEffect React hook will run the passed in function on every change. This can be optimized to let it call only when the desired properties change. What if I want to call an initialization functi..

Using "Object.create" instead of "new"

Javascript 1.9.3 / ECMAScript 5 introduces Object.create, which Douglas Crockford amongst others has been advocating for a long time. How do I replace new in the code below with Object.create? var Us..

How to achieve pagination/table layout with Angular.js?

Let's say I receive an object literal with 15+ objects and I need to display them in a nice layout (not all in a row), what is the most efficient method for controlling when the line should break/page..

How can I map True/False to 1/0 in a Pandas DataFrame?

I have a column in python pandas DataFrame that has boolean True/False values, but for further calculations I need 1/0 representation. Is there a quick pandas/numpy way to do that?..

Changing font size and direction of axes text in ggplot2

I am plotting a graph with a categorical variable on the x axis and a numerical variable on the y axis. For the x axis, given that there are many data points, the default text formatting causes the l..

How to make Java honor the DNS Caching Timeout?

We use GSLB for geo-distribution and load-balancing. Each service is assigned a fixed domain name. Through some DNS magic, the domain name is resolved into an IP that's closest to the server with leas..

How to pass a Javascript Array via JQuery Post so that all its contents are accessible via the PHP $_POST array?

How can I pass a Javascript Array via JQuery Post so that all its contents are accessible via the PHP $_POST array? Please show an example of code that would do the trick. Thanks!..

How to gettext() of an element in Selenium Webdriver

I am finding a textbox by its ID. I need to get the content which is already there inside the text box. For that I am using the gettext() method, but it is returning the ID value. The content in the t..

How can I uninstall npm modules in Node.js?

As commonly known, any npm module can be installed by running a simple command: npm install <module_name>. I have installed a few modules that I do not use any more and I just want to get them o..

bind/unbind service example (android)

can you give me a simple example of an application with background service which uses bind/unbind methods to start and stop it? I was googling for it for a half-hour, but those examples use startServi..

Convert System.Drawing.Color to RGB and Hex Value

Using C# I was trying to develop the following two. The way I am doing it may have some problem and need your kind advice. In addition, I dont know whether there is any existing method to do the same...

Get int from String, also containing letters, in Java

How can I get the int value from a string such as 423e - i.e. a string that contains a number but also maybe a letter? Integer.parseInt() fails since the string must be entirely a number...

How to loop over files in directory and change path and add suffix to filename

I need to write a script that starts my program with different arguments, but I'm new to Bash. I start my program with: ./MyProgram.exe Data/data1.txt [Logs/data1_Log.txt]. Here is the pseudocode fo..

How do I set the background color of Excel cells using VBA?

As part of a VBA program, I have to set the background colors of certain cells to green, yellow or red, based on their values (basically a health monitor where green is okay, yellow is borderline and ..

Error in finding last used cell in Excel with VBA

When I want to find the last used cell value, I use: Dim LastRow As Long LastRow = Range("E4:E48").End(xlDown).Row Debug.Print LastRow I'm getting the wrong output when I put a single ele..

How to trigger a click on a link using jQuery

I have a link: <ul id="titleee" class="gallery"> <li> <a href="#inline" rel="prettyPhoto">Talent</a> </li> </ul> and I am trying to trigger it by using: ..

How to check if a column exists before adding it to an existing table in PL/SQL?

How do I add a simple check before adding a column to a table for an oracle db? I've included the SQL that I'm using to add the column. ALTER TABLE db.tablename ADD columnname NVARCHAR2(30); ..

Internet Explorer 11- issue with security certificate error prompt

I am testing a website in IE11. It has mixed content (http and https). In previous versions, there is a prompt which asks which we should allow the content with security certificate error. However no ..

User Control - Custom Properties

I have developed a User Control in Visual Studio (WinForms C#) and have a question. I need the user of my User Control to be able to change certain string values and I would like them to be able to a..

Best way for storing Java application name and version properties

Using Eclipse IDE. I need to store my application's name and version as they are used by the app itself. I could hard-code them as static final fields somewhere in the codebase. A better solution I k..

How to sort a dataframe by multiple column(s)

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

Using moment.js to convert date to string "MM/dd/yyyy"

I need to take the date value from jquery datepicker turn it into string format "MM/dd/yyyy" so it can do the right ajax post. When the page loads or upon changing the datepicker, a jquery ajax call i..

How to tell bash that the line continues on the next line

In a bash script I got from another programmer, some lines exceeded 80 columns in length. What is the character or thing to be added to the line in order to indicate that the line continues on the nex..

How to force keyboard with numbers in mobile website in Android

I have a mobile website and it has some HTML input elements in it, like this: <input type="text" name="txtAccessoryCost" size="6" /> I have embedded the site into a WebView for possible Andro..

PHP Date Time Current Time Add Minutes

Simple question but this is killing my time. Any simple solution to add 30 minutes to current time in php with GMT+8?..

Disable Button in Angular 2

I want if the input 'Contract type' is empty, the button 'Save' is not clickable Save button: <div class="col-md-4"> <cic-textbox [control]="formGroup.get('contractType')"></..

Merge PDF files

Is it possible, using Python, to merge separate PDF files? Assuming so, I need to extend this a little further. I am hoping to loop through folders in a directory and repeat this procedure. And..

How to convert a factor to integer\numeric without loss of information?

When I convert a factor to a numeric or integer, I get the underlying level codes, not the values as numbers. f <- factor(sample(runif(5), 20, replace = TRUE)) ## [1] 0.0248644019011408 0.0248644..

How to set child process' environment variable in Makefile

I would like to change this Makefile: SHELL := /bin/bash PATH := node_modules/.bin:$(PATH) boot: @supervisor \ --harmony \ --watch etc,lib \ --extensions..

How do I print my Java object without getting "SomeType@2f92e0f4"?

I have a class defined as follows: public class Person { private String name; // constructor and getter/setter omitted } I tried to print an instance of my class: System.out.println(myPerson)..

Programmatically trigger "select file" dialog box

I have a hidden file input element. Is it possible to trigger its select file dialog box from a button's click event?..

How can I inspect the file system of a failed `docker build`?

I'm trying to build a new Docker image for our development process, using cpanm to install a bunch of Perl modules as a base image for various projects. While developing the Dockerfile, cpanm returns..

Hibernate - A collection with cascade=”all-delete-orphan” was no longer referenced by the owning entity instance

I'm having the following issue when trying to update my entity: "A collection with cascade=”all-delete-orphan” was no longer referenced by the owning entity instance". I have a parent entity an..

How do I get and set Environment variables in C#?

How can I get Environnment variables and if something is missing, set the value?..

Datanode process not running in Hadoop

I set up and configured a multi-node Hadoop cluster using this tutorial. When I type in the command, it shows all the processes initializing properly as follows: starting namenode, logg..

Create Directory if it doesn't exist with Ruby

I am trying to create a directory with the following code: Dir.mkdir("/Users/Luigi/Desktop/Survey_Final/Archived/Survey/test") unless File.exists?("/Users/Luigi/Desktop/Survey_Final/Archived/Surv..

How to output a comma delimited list in jinja python template?

If I have a list of users say ["Sam", "Bob", "Joe"], I want to do something where I can output in my jinja template file: {% for user in userlist %} <a href="/profile/{{ user }}/">{{ user }..

How to write console output to a txt file

I have tried to write the console output to a txt file using this code suggestion ( however I was not successful. What's wrong? try { //create a ..

SQL Server: combining multiple rows into one row

I have a SQL query like this; SELECT * FROM Jira.customfieldvalue WHERE CUSTOMFIELD = 12534 AND ISSUE = 19602 And that's the results; What I want is; showing in one row (cell) combined all STRI..

SQL Last 6 Months

I have table containing one datetime column. I need to return rows for only last 6 months. This can be done by where datetime_column > DATEADD(m, -6, current_timestamp) But how to extend this o..

What are Java command line options to set to allow JVM to be remotely debugged?

I know there's some JAVA_OPTS to set to remotely debug a Java program. What are they and what do they mean ?..

Pythonic way to check if something exists?

This is pretty basic but I was coding and started wondering if there was a pythonic way to check if something does not exist. Here's how I do it if its true: var = 1 if var: print 'it exists' ..

When are static variables initialized?

I am wondering when static variables are initialized to their default values. Is it correct that when a class is loaded, static vars are created (allocated), then static initializers and initializatio..

Python Inverse of a Matrix

How do I get the inverse of a matrix in python? I've implemented it myself, but it's pure python, and I suspect there are faster modules out there to do it...

Sending and Parsing JSON Objects in Android

I would like to send messages in the form of JSON objects to a server and parse the JSON response from the server. Example of JSON object { "post": { "username": "John Doe", "message": "te..

Remove all occurrences of char from string

I can use this: String str = "TextX Xto modifyX"; str = str.replace('X','');//that does not work because there is no such character '' Is there a way to remove all occurrences of character X from a..

What is polymorphism, what is it for, and how is it used?

What is polymorphism, what is it for, and how is it used?..

How can I match multiple occurrences with a regex in JavaScript similar to PHP's preg_match_all()?

I am trying to parse url-encoded strings that are made up of key=value pairs separated by either & or &amp;. The following will only match the first occurrence, breaking apart the keys and v..

How to "perfectly" override a dict?

How can I make as "perfect" a subclass of dict as possible? The end goal is to have a simple dict in which the keys are lowercase. It would seem that there should be some tiny set of primitives I can..

How to call codeigniter controller function from view

How to call codeigniter controller function from view? When i call the function in a controller, get a 404 page...

Streaming video from Android camera to server

I've seen plenty of info about how to stream video from the server to an android device, but not much about the other way, ala Qik. Could someone point me in the right direction here, or give me some..

Execute a PHP script from another PHP script

How would I make my server run a php script by triggering it manually using php? Basically I have a pretty big cronjob file that is ran every 2 hours, but I want to be able to trigger the file manuall..

How to open a link in new tab (chrome) using Selenium WebDriver?

System.setProperty("", "D:\\softwares\\chromedriver_win32\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SEC..

Getting Date or Time only from a DateTime Object

I have a DateTime instance that has a Date and a Time. How do I extract only the date or only the time?..

How to trigger click event on href element

I am trying to trigger click event on hyperlink with jQuery like the way below. Hyperlink does not have any id but it does have cssclass $(document).ready(function () { $('.cssbuttongo').trigger('c..

Multiple inputs with same name through POST in php

Is it possible to get multiple inputs of the same name to post and then access them from PHP? The idea is this: I have a form that allows the entry of an indefinite number of physical addresses along..

JOptionPane YES/No Options Confirm Dialog Box Issue

I've created a JOptionPane and it only has two buttons YES_NO_OPTION . After JOptionPane.showConfirmDialog pops out , I want to click YES BUTTON to continue opening the JFileChooser and if I clicked ..

How can I convert a .jar to an .exe?

I want to convert a .jar to an .exe for microsoft. Is there any program converter for this? Also if there's one for Mac and Linux I would appreciate suggestions for those too...

how to "execute" make file

I tried to use a make file in code::blocks but I am doing it wrong. I have the version installed with the compilers included.

Why is the time complexity of both DFS and BFS O( V + E )

The basic algorithm for BFS: set start vertex to visited load it into queue while queue not empty for each edge incident to vertex if its not visited load into queue ..

UIScrollView scroll to bottom programmatically

How can I make a UIScrollView scroll to the bottom within my code? Or in a more generic way, to any point of a subview?..

How to set textColor of UILabel in Swift

When I try setting the color of a UILabel to the color of another UILabel using the code myLabel.textColor = otherLabel.textColor It doesn't change the color. When I use this code, however, myLab..

Shortest way to check for null and assign another value if not

I am pulling varchar values out of a DB and want to set the string I am assigning them to as "" if they are null. I'm currently doing it like this: if (string.IsNullOrEmpty(planRec.approved_by) == tr.. has key method?

If my response has key "error" I need to process error and show warning box. Is there "haskey" method exists in Like: var x= JObject.Parse(string_my); if(x.HasKey["error_msg"]) Messag..