Questions Tagged with #Post build

Post Build exited with code 1

I have a project with a post build event: copy $(ProjectDir)DbVerse\Lunaverse.DbVerse.*.exe $(TargetDir) It works fine every time on my machine. I have a new developer who always gets the "exited..

Making a Sass mixin with optional arguments

I am writing a mixin like this: @mixin box-shadow($top, $left, $blur, $color, $inset:"") { -webkit-box-shadow: $top $left $blur $color $inset; -moz-box-shadow: $top $left $blur $color $inset;..

Convert timestamp to readable date/time PHP

I have a timestamp stored in a session (1299446702). How can I convert that to a readable date/time in PHP? I have tried srttotime, etc. to no avail...

PHP Error: Cannot use object of type stdClass as array (array and object issues)

I was trying to copy this code: <?php foreach ($products as $product) { $id = $product['id']; $name = $product['name']; $description = $product['description']; $pri..

StringStream in C#

I want to be able to build a string from a class that I create that derives from Stream. Specifically, I want to be able to write code like this: void Print(Stream stream) { // Some code that ope..

jQuery How do you get an image to fade in on load?

All I want to do is fade my logo in on the page loading. I am new today to jQuery and I can't managed to fadeIn on load please help. Sorry if this question has already been answered I have had a look ..

How to fix Error: laravel.log could not be opened?

I'm pretty new at laravel, in fact and I'm trying to create my very first project. for some reason I keep getting this error (I haven't even started coding yet) Error in exception handler: The stream..

ssh-copy-id no identities found error

I have few client systems where I need to push the ssh key and login from my server without authentication prompts. First, on the server, I created ssh key as below which was successful ]# ssh-keyg..

Merge two json/javascript arrays in to one array

I have two json arrays like var json1 = [{id:1, name: 'xxx' ...}] var json2 = [{id:2, name: 'xyz' ...}] I want them merge in to single arrays var finalObj = [{id:1, name: 'xxx' ...},{id:2, name: '..

How can I get a resource content from a static context?

I want to read strings from an xml file before I do much of anything else like setText on widgets, so how can I do that without an activity object to call getResources() on?..

How to use Git Revert

How is git revert used? This might sound like a duplicate question but when people ask it, the response is often, use git reset as per Revert to a commit by a SHA hash in Git? Then when someone asks..

Checking if output of a command contains a certain string in a shell script

I'm writing a shell script, and I'm trying to check if the output of a command contains a certain string. I'm thinking I probably have to use grep, but I'm not sure how. Does anyone know?..

How do you generate a random double uniformly distributed between 0 and 1 from C++?

How do you generate a random double uniformly distributed between 0 and 1 from C++? Of course I can think of some answers, but I'd like to know what the standard practice is, to have: Good standard..

Simple way to read single record from MySQL

What's the best way with PHP to read a single record from a MySQL database? E.g.: SELECT id FROM games I was trying to find an answer in the old questions, but had no luck...

Rails formatting date

I am posting a date to an API and the required format is as follows: 2014-12-01T01:29:18 I can get the date from the model like so: Model.created_at.to_s That returns: 2014-12-01 01:29:18 -0500..

Format string to a 3 digit number

Instead of doing this, I want to make use of string.format() to accomplish the same result: if (myString.Length < 3) { myString = "00" + 3; } ..

How can I define an array of objects?

I am creating an array of objects in TypeScript: userTestStatus xxxx = { "0": { "id": 0, "name": "Available" }, "1": { "id": 1, "name": "Ready" }, "2": { "id": 2, "name": "Started" } };..

This action could not be completed. Try Again (-22421)

I am trying to upload an Apple TV App to the App Store for testing purposes, but I got the issue: This Action could not be completed. Try Again (-22421) as in the below image: So what can I do?..

Merging 2 branches together in GIT

I've only just started to use GIT and think its wonderful, however I'm a little confused over what the merge command does. Let us say we have a working project in the branch "A". I go home and make ..

AngularJS Error: Cross origin requests are only supported for protocol schemes: http, data, chrome-extension, https

I have three files of a very simple angular js application index.html <!DOCTYPE html> <html ng-app="gemStore"> <head> <script src='

Remove specific commit

I was working with a friend on a project, and he edited a bunch of files that shouldn't have been edited. Somehow I merged his work into mine, either when I pulled it, or when I tried to just pick the..

how to auto select an input field and the text in it on page load

Upon page load I want to move the cursor to a particular field. No problem. But I also need to select and highlight the default value that is placed in that text field...

How to deal with SQL column names that look like SQL keywords?

One of my columns is called from. I can't change the name because I didn't make it. Am I allowed to do something like SELECT from FROM TableName or is there a special syntax to avoid the SQL Server be..

How to print a number with commas as thousands separators in JavaScript

I am trying to print an integer in JavaScript with commas as thousands separators. For example, I want to show the number 1234567 as "1,234,567". How would I go about doing this? Here is how I am do..

how to clear the screen in python

Possible Duplicates: clear terminal in python How to clear python interpreter console? I'm trying to write a program in Python but I don't know how to clear the screen. I use both Windows..

HTML5 Dynamically create Canvas

Hi there I have a question about dynamically creating a canvas using javascript. I create a canvas like this: var canvas = document.createElement('canvas'); = "CursorLayer"; canvas.wid..

Retrieving a random item from ArrayList

I'm learning Java and I'm having a problem with ArrayList and Random. I have an object called catalogue which has an array list of objects created from another class called item. I need a method in ..

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

How can I output the value of an enum class in C++11

How can I output the value of an enum class in C++11? In C++03 it's like this: #include <iostream> using namespace std; enum A { a = 1, b = 69, c= 666 }; int main () { A a = A::c; ..

c# datatable insert column at position 0

does anyone know the best way to insert a column in a datatable at position 0?..

How to call Stored Procedures with EntityFramework?

I have generated an EF4 Model from a MySQL database and I have included both StoredProcedures and Tables. I know how to make regular instert/update/fetch/delete operations against the EF but I can't ..

Saving lists to txt file

I'm trying to save a list to a text file. This is my code: public void button13_Click(object sender, EventArgs e) { TextWriter tw = new StreamWriter("SavedLists.txt"); tw.WriteLine(

SQLite Reset Primary Key Field

I have a few tables in SQLite and I am trying to figure out how to reset the auto-incremented database field. I read that DELETE FROM tablename should delete everything and reset the auto-incrememen..

Changing fonts in ggplot2

Once upon a time, I changed my ggplot2 font using using windowsFonts(Times=windowsFont("TT Times New Roman")) to change it. Now I can't get it off of this. In trying to set family="" in ggplot2 them..

Pass data to layout that are common to all pages

I have a website which have a layout page. However this layout page have data which all pages model must provide such page title, page name and the location where we actually are for an HTML helper I ..

How to set DataGrid's row Background, based on a property value using data bindings

In my XAML code, I want to set the Background color of each row, based on a value of the object in one specific row. I have an ObservableCollection of z, and each of the z has a property called State...

VBScript How can I Format Date?

I want the date to look like MM-DD-YYYY instead of MM/DD/YYYY...

Can someone explain Microsoft Unity?

I've been reading the articles on MSDN about Unity (Dependency Injection, Inversion of Control), but I think I need it explained in simple terms (or simple examples). I'm familiar with the MVPC patter..

How can I initialize an ArrayList with all zeroes in Java?

It looks like arraylist is not doing its job for presizing: // presizing ArrayList<Integer> list = new ArrayList<Integer>(60); Afterwards when I try to access it: list.get(5) Inst..

How do I rotate the Android emulator display?

How can I rotate the Android emulator display to see it in landscape mode?..

Using CSS td width absolute, position

Please see this JSFIDDLE td.rhead { width: 300px; } Why doesn't the CSS width work? <table> <thead> <tr> <td class="rhead">need 300px</td> <td colspan="7">Week ..

CSS On hover show another element

I want to use CSS to show div id='b' when I hover over div id='a', but I cannot figure out how to do it because the div 'a' is inside another div that div 'b' is not in. <div id='content'> ..

What is a predicate in c#?

I am very new to using predicates and just learned how to write: Predicate<int> pre = delegate(int a){ a %2 == 0 }; What will the predicate return, and how is it useful when programming?..

Default value of function parameter

1. int Add (int a, int b = 3); int Add (int a, int b) { } 2. int Add (int a, int b); int Add (int a, int b = 3) { } Both work; which is the standard way and why?..

Your project contains error(s), please fix it before running it

I am developing a simple Android application. But when I run Eclipse, it shows the following error: Your project contains error(s), please fix it before running it. I can't find any error in my ..

ln (Natural Log) in Python

In this assignment I have completed all the problems except this one. I have to create a python script to solve an equation (screenshot). Unfortunately, in my research all over the internet I cannot ..

How to find index of list item in Swift?

I am trying to find an item index by searching a list. Does anybody know how to do that? I see there is list.StartIndex and list.EndIndex but I want something like python's list.index("text")...

How can I rollback a git repository to a specific commit?

My repo has 100 commits in it right now. I need to rollback the repository to commit 80, and remove all the subsequent ones. Why? This repo is supposed to be for merging from miscellaneous users. A bu..

Bash: infinite sleep (infinite blocking)

I use startx to start X which will evaluate my .xinitrc. In my .xinitrc I start my window manager using /usr/bin/mywm. Now, if I kill my WM (in order to f.e. test some other WM), X will terminate too ..

How to get current working directory using vba?

I am using MS Excel 2010 and trying to get the current directory using the below code, path = ActiveWorkbook.Path But ActiveWorkbook.Path returns blank...

Should I use the Reply-To header when sending emails as a service to others?

Suppose we have an application that acts as a middleman, allowing Company A to send reports to their customers. Company A --> Company B (me)--> Company A's customers After getting the report we ..

Bootstrap tooltips not working

I'm going mad here. I've got the following HTML: <a href="#" rel="tooltip" title="A nice tooltip">test</a> And the Bootstrap style tooltip refuses to display, just a normal tooltip. ..

SQL MAX of multiple columns?

How do you return 1 value per row of the max of several columns: TableName [Number, Date1, Date2, Date3, Cost] I need to return something like this: [Number, Most_Recent_Date, Cost] Query?..

How to scroll to the bottom of a UITableView on the iPhone before the view appears

I have a UITableView that is populated with cells of a variable height. I would like the table to scroll to the bottom when the view is pushed into view. I currently have the following function NSIn..

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

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

How can I extract the folder path from file path in Python?

I would like to get just the folder path from the full path to a file. For example T:\Data\DBDesign\DBDesign_93_v141b.mdb and I would like to get just T:\Data\DBDesign (excluding the \DBDesign_93_v141..

How to convert seconds to HH:mm:ss in moment.js

How can I convert seconds to HH:mm:ss? At the moment I am using the function below render: function (data){ return new Date(data*1000).toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1");; ..

Are PHP short tags acceptable to use?

Here's the information according to the official documentation: There are four different pairs of opening and closing tags which can be used in PHP. Two of those, <?php ?> and <scri..

How does a hash table work?

I'm looking for an explanation of how a hash table works - in plain English for a simpleton like me! For example, I know it takes the key, calculates the hash (I am looking for an explanation how) a..

Is there an upper bound to BigInteger?

Possible Duplicate: What does BigInteger having no limit mean? The Javadoc for BigInteger does not define any maximum or minimum. However, it does say: (emphasis added) Immutable arbi..

How to get the pure text without HTML element using JavaScript?

I have the 1 button and some text in my HTML like the following: function get_content(){ // I don't know how to do in here!!! } <input type="button" onclick="get_content()" value="Get Content"..

Remove style attribute from HTML tags

I'm not too good with regular expressions, but with PHP I'm wanting to remove the style attribute from HTML tags in a string that's coming back from TinyMCE. So change <p style="...">Text</p..

Get the first element of an array

I have an array: array( 4 => 'apple', 7 => 'orange', 13 => 'plum' ) I would like to get the first element of this array. Expected result: string apple One requirement: it cannot be don..

'react-scripts' is not recognized as an internal or external command

I've got a maven project, within which is JavaScript project cloned as a git sub-module. So the directory structure looks like mavenapp/src/main/javascript/[npm project files] Inside my package.json, ..

How do I enable index downloads in Eclipse for Maven dependency search?

I am using Eclipse Luna with the m2e plug-in. When I search for dependencies, I get the following warning (also see the screenshot after): Index downloads are disabled, search result may be incomp..

How to call one shell script from another shell script?

I have two shell scripts, and How can I call from within the shell script

CURL ERROR: Recv failure: Connection reset by peer - PHP Curl

I'm having this strange error, CURL ERROR: Recv failure: Connection reset by peer This is how it happens, if I did not connect to the server and all of a sudden trying to connect to the server via CU..

Executing Javascript from Python

I have HTML webpages that I am crawling using xpath. The etree.tostring of a certain node gives me this string: <script> <!-- function escramble_758(){ var a,b,c a='+1 ' b='84-' a+='..

UITableView - change section header color

How can I change color of a section header in UITableView? EDIT: The answer provided by DJ-S should be considered for iOS 6 and above. The accepted answer is out of date...

Finding an element in an array in Java

Does Java have a built-function to allow me to linearly search for an element in an array or do I have to just use a for loop?..

How can you change Network settings (IP Address, DNS, WINS, Host Name) with code in C#

I am developing a wizard for a machine that is to be used as a backup of other machines. When it replaces an existing machine, it needs to set its IP address, DNS, WINS, and host name to match the ma..

Which passwordchar shows a black dot (•) in a winforms textbox?

Short question here: In .Net 4.0 Winforms, how do I use the PasswordChar property of a Textbox to show a common black dot as a character? Is there perhaps some font I can use that has this as a chara..

Is there a better way to compare dictionary values

I am currently using the following function to compare dictionary values. Is there a faster or better way to do it? match = True for keys in dict1: if dict1[keys] != dict2[keys]: match = ..

Android Fragment no view found for ID?

I have a fragment I am trying to add into a view. FragmentManager fragMgr=getSupportFragmentManager(); feed_parser_activity content = (feed_parser_activity)fragMgr ..

Verilog generate/genvar in an always block

I'm trying to get a module to pass the syntax check in ISE 12.4, and it gives me an error I don't understand. First a code snippet: parameter ROWBITS = 4; reg [ROWBITS-1:0] temp; genvar c; generate..

Passing variable number of arguments around

Say I have a C function which takes a variable number of arguments: How can I call another function which expects a variable number of arguments from inside of it, passing all the arguments that got i..

Array inside a JavaScript Object?

I've tried looking to see if this is possible, but I can't find my answer. I'm trying to get the following to work: var defaults = { 'background-color': '#000', color: '#fff', weekdays: {['sun','..

Change / Add syntax highlighting for a language in Sublime 2/3

I want to change / add syntax highlighting for a language in Sublime 2/3. For example I want the keyword this colored in JavaScript. How can I do that? I know that there is a preference JavaScript ..

CSS, Images, JS not loading in IIS

My all applications were working fine but suddenly all sites under IIS are not loading css, images, scripts. It redirect to login page. If i login it works fine. e.g.

Seeing the underlying SQL in the Spring JdbcTemplate?

I am learning about the wonders of JdbcTemplate and NamedParameterJdbcTemplate. I like what I see, but is there any easy way to see the underlying SQL that it ends up executing? I'd like to see this f..

Correct way to find max in an Array in Swift

I've so far got a simple (but potentially expensive) way: var myMax = sort(myArray,>)[0] And how I was taught to do it at school: var myMax = 0 for i in 0..myArray.count { if (myArray[i] &g..

Where to find "Microsoft.VisualStudio.TestTools.UnitTesting" missing dll?

I am getting following error in my C# visual studio project: The type or namespace name 'VisualStudio' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) I also..

Convert a matrix to a 1 dimensional array

I have a matrix (32X48). How can I convert the matrix into a single dimensional array?..

UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples

I'm getting this weird error: UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples. 'precision', 'predicted', average, warn_..

Convert a numpy.ndarray to string(or bytes) and convert it back to numpy.ndarray

I'm having a little trouble here, I'm trying to convert a numpy.ndarray to string, I've already done that like this: randomArray.tostring() It works, but I'm wondering if I can transform it back t..

How to prevent a double-click using jQuery?

I have a button as such: <input type="submit" id="submit" value="Save" /> Within jQuery I am using the following, but it still allows for double-clicks: <script type="text/javascript">..

Git copy file preserving history

I have a somewhat confusing question in Git. Lets say, I have a file dir1/A.txt committed and git preserves a history of commits Now I need to copy the file into dir2/A.txt (not move, but copy). I kno..

What is the best way to modify a list in a 'foreach' loop?

A new feature in C# / .NET 4.0 is that you can change your enumerable in a foreach without getting the exception. See Paul Jackson's blog entry An Interesting Side-Effect of Concurrency: Removing Item..

Class has been compiled by a more recent version of the Java Environment

While running selenium script, I am getting the following error message in Eclipse console: Class has been compiled by a more recent version of the Java Environment (class file version 53.0), this..

Why does visual studio 2012 not find my tests?

I have some tests that use the built in Microsoft.VisualStudio.TestTools.UnitTesting, but can not get them to run. I am using visual studio 2012 ultimate. I have a solution of two projects; One has ..

How to add data to DataGridView

I'm having a Structure like X={ID="1", Name="XX", ID="2", Name="YY" }; How to dump this data to a DataGridView of two columns The gridView is like ID | Name Can we use LINQ to do this...

R ggplot2: stat_count() must not be used with a y aesthetic error in Bar graph

I am getting this error while plotting a bar graph and I am not able to get rid of it, I have tried both qplot and ggplot but still the same error. Following is my code: library(dplyr) library(ggp..

Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $

What is this error ? How can I fix this? My app is running but can't load data. And this is my Error: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $ This is my frag..

How to send json data in the Http request using NSURLRequest

I'm new to objective-c and I'm starting to put a great deal of effort into request/response as of recent. I have a working example that can call a url (via http GET) and parse the json returned. The..

IntelliJ IDEA "The selected directory is not a valid home for JDK"

I just installed IntelliJ IDEA and I'm trying to set it up. I've gotten to the part where I need to select my home directory for my JDK. I tried navigating to my Java installation, C:\Program Files (..

Html ordered list 1.1, 1.2 (Nested counters and scope) not working

I use nested counters and scope to create an ordered list: _x000D_ _x000D_ ol {_x000D_ counter-reset: item;_x000D_ padding-left: 10px;_x000D_ }_x000D_ li {_x000D_ display: block_x000D_ }_..

Embedding JavaScript engine into .NET

just wondering if anyone has ever tried embedding and actually integrating any js engine into the .net environment. I could find and actually use (after a LOT of pain and effort, since it's pretty out..

How to use order by with union all in sql?

I tried the sql query given below: SELECT * FROM (SELECT * FROM TABLE_A ORDER BY COLUMN_1)DUMMY_TABLE UNION ALL SELECT * FROM TABLE_B It results in the following error: The ORDER BY clause ..

Using Custom Domains With IIS Express

Traditionally I use custom domains with my localhost development server. Something along the lines of: This has provided me a ton of flexibility when working wit..

Converting from IEnumerable to List

I want to convert from IEnumerable<Contact> to List<Contact>. How can I do this?..

PHP multidimensional array search by value

I have an array where I want to search the uid and get the key of the array. Examples Assume we have the following 2-dimensional array: $userdb = array( array( 'uid' => '100', ..

SQL Server - boolean literal?

How to write literal boolean value in SQL Server? See sample use: select * from SomeTable where PSEUDO_TRUE another sample: if PSEUDO_TRUE begin select 'Hello, SQL!' end Note: The query above..

What is a "static" function in C?

The question was about plain c functions, not c++ static methods, as clarified in comments. I understand what a static variable is, but what is a static function? And why is it that if I declare a f..

What does functools.wraps do?

In a comment on this answer to another question, someone said that they weren't sure what functools.wraps was doing. So, I'm asking this question so that there will be a record of it on StackOverflow ..

How to set image on QPushButton?

I want to set an image on QPushButton, and the size of QPushButton should depend on the size of the image. I am able to do this when using QLabel, but not with QPushButton. So, if anyone has a soluti..

Extract a substring according to a pattern

Suppose I have a list of string: string = c("G1:E001", "G2:E002", "G3:E003") Now I hope to get a vector of string that contains only the parts after the colon ":", i.e substring = c(E001,E002,E003)..

Http Post request with content type application/x-www-form-urlencoded not working in Spring

Am new to spring currently am trying to do HTTP POST request application/x-www-form-url encoded but when i keep this in my headers then spring not recognizing it and saying 415 Unsupported Media Type ..

What is the best way to create a string array in python?

I'm relatively new to Python and it's libraries and I was wondering how I might create a string array with a preset size. It's easy in java but I was wondering how I might do this in python. So far ..

Test if object implements interface

This has probably been asked before, but a quick search only brought up the same question asked for C#. See here. What I basically want to do is to check wether a given object implements a given inte..

How to get the real and total length of char * (char array)?

For a char [], I can easily get its length by: char a[] = "aaaaa"; int length = sizeof(a)/sizeof(char); // length=6 However, I cannot do like this to get the length of a char * by: char *a = new c..

How to get just the responsive grid from Bootstrap 3?

I need to add responsive design features to my web application using Twitter Bootstrap. I just want the responsive behavior, I'm not interested in the typography, components or any other stuff include..

Check if a Windows service exists and delete in PowerShell

I am currently writing a deployment script that installs a number of Windows services. The services names are versioned, so I want to delete the prior Windows service version as part of the installs ..

How to Populate a DataTable from a Stored Procedure

Possible Duplicate: How can i retrieve a table from stored procedure to a datatable I am trying to populate my datatable. I have created a datatable tmpABCD but i need to populate this with..

How to implement class constructor in Visual Basic?

I just would like to know how to implement class constructor in this language...

Access mysql remote database from command line

I have a server with Rackspace. I want to access the database from my local machine command line. I tried like: mysql -u username -h -ppassword But it gives an error: ERROR 2003 (..

How do I enable NuGet Package Restore in Visual Studio?

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

Why does GitHub recommend HTTPS over SSH?

On the GitHub site there is a link... ... and it states... If you have decided not to use the recommended HTTPS method, we can use SSH keys..

Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_151 contains a valid JDK installation

Even though I manually configured JDK project structure file/Project structure it still shows this error FAILURE: Build failed with an exception. `What went wrong: Execution failed for task ':sample..

Easiest way to open a download window without navigating away from the page

What is the best cross browser way to open a download dialog (let's assume we can set content-disposion:attachment in the headers) without navigating away from the current page, or opening popups, whi..

How do I flush the cin buffer?

How do I clear the cin buffer in C++?..

How to use AND in IF Statement

I want to check: IF cells (i,"A") contains the text 'Miami' AND (i,"D") contains the text 'Florida' THEN change value of cell (i,"C") to BA. Sub ABC() Dim wsh As Worksheet, i As Long, lngEndRowInv A..

Generating a SHA-256 hash from the Linux command line

I know the string "foobar" generates the SHA-256 hash c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2 using However the command line s..

socket.emit() vs. socket.send()

What's the difference between these two? I noticed that if I changed from socket.emit to socket.send in a working program, the server failed to receive the message, although I don't understand why. ..

How to find the installed pandas version

I am having trouble with some of pandas functionalities. How do I check what is my installation version?..

Check whether a path is valid in Python without creating a file at the path's target

I have a path (including directory and file name). I need to test if the file-name is a valid, e.g. if the file-system will allow me to create a file with such a name. The file-name has some unicode c..

Difference between binary semaphore and mutex

Is there any difference between a binary semaphore and mutex or are they essentially the same?..

How to get the first line of a file in a bash script?

I have to put in a bash variable the first line of a file. I guess it is with the grep command, but it is any way to restrict the number of lines?..

How to get random value out of an array?

I have an array called $ran = array(1,2,3,4); I need to get a random value out of this array and store it in a variable, how can I do this?..

Angular 2 two way binding using ngModel is not working

Can't bind to 'ngModel' since it isn't a know property of the 'input' element and there are no matching directives with a corresponding property Note: im using alpha.31 import { Component, View, boo..

Eclipse: Error ".. overlaps the location of another project.." when trying to create new project

I keep getting an error message in Eclipse when creating a new project. I have created a workspace at the level C:\Users\Martin\Java\Counter Inside Counter there are no files but there is a dir..

PHP Warning: Module already loaded in Unknown on line 0

On Mac OSX Mavericks using homebrew php55 whenever I run a a php command I get the following error message (everything runs fine it's just annoying) PHP Warning: Module 'intl' already loaded in Unkn..

What is the difference between Document style and RPC style communication?

Can somebody explain to me the differences between Document and RPC style webservices? Apart from JAX-RPC, the next version is JAX-WS, which supports both Document and RPC styles. I also understand d..

Powershell send-mailmessage - email to multiple recipients

I have this powershell script to sending emails with attachments, but when I add multiple recipients, only the first one gets the message. I've read the documentation and still can't figure it out. Th..

SQL Server dynamic PIVOT query?

I've been tasked with coming up with a means of translating the following data: date category amount 1/1/2012 ABC 1000.00 2/1/2012 DEF 500.00 2/1/2012 G..

How to include bootstrap css and js in reactjs app?

I am newb to reactjs, I want to include bootstrap in my react app I have installed bootstrap by npm install bootstrap --save Now, want to load bootstrap css and js in my react app. I am using webpa..

Where can I find documentation on formatting a date in JavaScript?

I noticed that JavaScript's new Date() function is very smart in accepting dates in several formats. Xmas95 = new Date("25 Dec, 1995 23:15:00") Xmas95 = new Date("2009 06 12,12:52:39") Xmas95 = new D..

C# - Winforms - Global Variables

I want some variables to be global across the project and accessible in every form. How can I do this?..

Grant execute permission for a user on all stored procedures in database?

I generated script from old database, created a new database and imported all data from old database. So far so good, however, no user has execute rights for stored procedures. I know I can use GRAN..

how to use jQuery ajax calls with node.js

This is similar to Stream data with Node.js, but I don't feel that question was answered sufficiently. I'm trying to use a jQuery ajax call (get, load, getJSON) to transfer data between a page and a ..

What's the difference between Invoke() and BeginInvoke()

Just wondering what the difference between BeginInvoke() and Invoke() are? Mainly what each one would be used for. EDIT: What is the difference between creating a threading object and calling invok..

Python - A keyboard command to stop infinite loop?

Possible Duplicate: Why can't I handle a KeyboardInterrupt in python? I was playing around with some Python code and created an infinite loop: y = 0 x = -4 itersLeft = x while(itersLe..

Is java.sql.Timestamp timezone specific?

I have to store UTC dateTime in DB. I have converted the dateTime given in specific timezone to UTC. for that I followed the below code. My input dateTime is "20121225 10:00:00 Z" timezone is "Asia/Ca..

Send POST request with JSON data using Volley

I would like to send a new JsonObjectRequest request: I want to receive JSON data (response from server): OK I want to send JSON formatted data with this request to the server JsonObjectRequest re..

How to create a remote Git repository from a local one?

I have a local Git repository. I would like to make it available on a remote, ssh-enabled, server. How do I do this?..

MVC - Set selected value of SelectList

How can I set the selectedvalue property of a SelectList after it was instantiated without a selectedvalue; SelectList selectList = new SelectList(items, "ID", "Name"); I need to set the selected v..

Creating a ZIP archive in memory using System.IO.Compression

I'm trying to create a ZIP archive with a simple demo text file using a MemoryStream as follows: using (var memoryStream = new MemoryStream()) using (var archive = new ZipArchive(memoryStream , ZipAr..

Django values_list vs values

In Django, what's the difference between the following two: Article.objects.values_list('comment_id', flat=True).distinct() vs Article.objects.values('comment_id').distinct() My goal is to get ..

Decoding base64 in batch

I am trying to make an installer using batch. Of course, an installer needs to consist of files that will be installed, so I'm thinking of encoding the files in base64, and simply decode them and writ..

JavaScript: changing the value of onclick with or without jQuery

I'd like to change the value of the onclick attribute on an anchor. I want to set it to a new string that contains JavaScript. (That string is provided to the client-side JavaScript code by the server..

Find the similarity metric between two strings

How do I get the probability of a string being similar to another string in Python? I want to get a decimal value like 0.9 (meaning 90%) etc. Preferably with standard Python and library. e.g. simil..

changing the owner of folder in linux

I have a folder in my subdomain which is created through WHM so the owner of that subdomain is not the owner of main domain. I want to change the owner of one of the folders of subdomain to domain o..

Finding CN of users in Active Directory

I'm trying to find the Base DN of the user that can access or controls all the users in Active Directory so I can put it in my LDAP. Usually someone will give me this, and it looks like DC=domain,DC=..

Most efficient way to remove special characters from string

I want to remove all special characters from a string. Allowed characters are A-Z (uppercase or lowercase), numbers (0-9), underscore (_), or the dot sign (.). I have the following, it works but I su..

Convert a list to a data frame

I have a nested list of data. Its length is 132 and each item is a list of length 20. Is there a quick way to convert this structure into a data frame that has 132 rows and 20 columns of data? Here is..

Check if application is on its first run

I am new to android development and and I want to setup some of application's attributes based on Application first run after installation. Is there any way to find that the application is running for..

HTTP Basic: Access denied fatal: Authentication failed

I use GitLab Community Edition 9.1.3 2e4e522 on Windows 10 Pro x64. With Git client. Error Cloning into 'project_name'... remote: HTTP Basic: Access denied fatal: Authentication failed for 'http://m..

ASP.NET 5 MVC: unable to connect to web server 'IIS Express'

What I'm doing: Opening Visual Studio Community 2015 File -> New -> Project Under Visual C#: Web -> ASP.NET Web Application Web Application And press f5 for the popup error "unable to connect to web..

avoid page break inside row of table

I want to avoid page break inside row of table in html, when I convert html to PDF by wkhtmltopdf. I use page-break-inside:avoid with table- its works, but I have so many rows, then not work. If set ..

Storing files in SQL Server

It's an old question I know, but with SQL Server 2012 is it finally ok to store files in the database, or should they really be kept in the filesystem with only references to them in the database? If..

How to set cookies in laravel 5 independently inside controller

I want to set cookies in Laravel 5 independently i.e., Don't want to use return response($content)->withCookie(cookie('name', 'value')); I just want to set cookie in some page and retrieve in s..

Convert wchar_t to char

I was wondering is it safe to do so? wchar_t wide = /* something */; assert(wide >= 0 && wide < 256 &&); char myChar = static_cast<char>(wide); If I am pretty sure the w..

Convert MySql DateTime stamp into JavaScript's Date format

Does anyone know how I can take a MySQL datetime data type value, such as YYYY-MM-DD HH:MM:SS and either parse it or convert it to work in JavaScript's Date() function, for example:- Date('YYYY, MM, D..


I am getting the following error: Exception in thread Thread-3: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/", line 810, in ..

Exception: "URI formats are not supported"

I have an absolute local path pointing to a dir: "file:\\C:\\Users\\john\\documents\\visual studio 2010\\Projects\\proj" But when I try to throw it into DirectoryInfo's ctor I get the "URI formats ar..

In SQL how to compare date values?

Using MySQL syntax and having a table with a row like: mydate DATETIME NULL, Is there a way to do something like: ... WHERE mydate<='2008-11-25'; I'm trying but not really getting it to work...

Convert Uppercase Letter to Lowercase and First Uppercase in Sentence using CSS

How to convert UPPERCASE letter to lowercase and first letter Uppercase for each sentences like below only by using CSS? From: THIS IS AN EXAMPLE SENTENCE. To: This is an example sentence. Update:..

Refresh DataGridView when updating data source

What is the best way to refresh a DataGridView when you update an underlying data source? I'm updating the datasource frequently and wanted to display the outcome to the user as it happens. I've got..

(13: Permission denied) while connecting to upstream:[nginx]

I am working with configuring Django project with Nginx and Gunicorn. While I am accessing my port gunicorn mysite.wsgi:application --bind= in Nginx server, I am getting the following e..

Is there a job scheduler library for node.js?

Is there some cron like library that would let me schedule some function to be ran at certain time (15:30 for example, not x hours from now etc)? If there isn't this kind of library how this should be..

How to detect chrome and safari browser (webkit)

I am trying to detect the chrome and safari browser using jquery or javascript. I thought we are not supposed to use jQuery.browser. Are there any suggestions here? Thanks a lot!..

Break string into list of characters in Python

Essentially I want to suck a line of text from a file, assign the characters to a list, and create a list of all the separate characters in a list -- a list of lists. At the moment, I've tried this: ..

How do I find the date a video (.AVI .MP4) was actually recorded?

properties> date created... I thought this meant the date the video was created, but finally realized that date changes every time I move, reorganize, even open a file. often, the date modified is ..

TypeError: unhashable type: 'list' when using built-in set function

I have a list containing multiple lists as its elements eg: [[1,2,3,4],[4,5,6,7]] If I use the built in set function to remove duplicates from this list, I get the error TypeError: unhashable type..

Get yesterday's date in bash on Linux, DST-safe

I have a shell script that runs on Linux and uses this call to get yesterday's date in YYYY-MM-DD format: date -d "1 day ago" '+%Y-%m-%d' It works most of the time, but when the script ran yesterda..

Identifier is undefined

I wrote the following code in C++ using VS2012 Express. void ac_search( uint num_patterns, uint pattern_length, const char *patterns, uint num_records, uint record_length, const char *reco..

Using new line(\n) in string and rendering the same in HTML

I have a string say string display_txt = "1st line text" +"\n" + "2nd line text"; in Jquery, I am trying to use ('#somediv').html(display_txt).css("color", "green") quite clearly I am expecting..

How return error message in spring mvc @Controller

I am using methods like this @RequestMapping(method = RequestMethod.GET) public ResponseEntity<UserWithPhoto> getUser(@RequestHeader(value="Access-key") String accessKey, ..

How can I modify the size of column in a MySQL table?

I have created a table and accidentally put varchar length as 300 instead of 65353. How can I fix that? An example would be appreciated...

Apply Calibri (Body) font to text

I have a div and in this div I want to display some text in Calibri (Body) font. How can I do this? This is the css I have been given : .an_account_join_1 { float:left; width:100%; colo..

How to add multiple font files for the same font?

I'm looking at the MDC page for the @font-face CSS rule, but I don't get one thing. I have separate files for bold, italic and bold + italic. How can I embed all three files in one @font-face rule? Fo..

Converting string into datetime

I've got a huge list of date-times like this as strings: Jun 1 2005 1:33PM Aug 28 1999 12:00AM I'm going to be shoving these back into proper datetime fields in a database so I need to magic them ..

CSS full screen div with text in the middle

I have a css class defined so I can make a div to use all the browser's viewport, the rule is the following: .fullscreenDiv { background-color: #e8e8e8; width: 100%; height: auto; bot..

HTML 5 Video "autoplay" not automatically starting in CHROME

I have the following code: <video controls autoplay> <source src="video/myVideo.mp4" type="video/mp4"> <source src="video/myVideo.webm" type="video/webm"> <source src="vid..

Bitbucket git credentials if signed up with Google

I have an account on that I created by signing up with my Google account. Now everytime I log in I just click "Log in with Google" and that's fine. How can I access my repos from git co..

How to give Jenkins more heap space when it´s started as a service under Windows?

I want to increase the available heap space for Jenkins. But as it is installed as a service I don´t know how to do it...

What do multiple arrow functions mean in javascript?

I have been reading a bunch of react code and I see stuff like this that I don't understand: handleChange = field => e => { e.preventDefault(); /// Do something here } ..

Java: Rotating Images

I need to be able to rotate images individually(in java). The only thing I have found so far is g2d.drawImage(image, affinetransform, ImageObserver ). Unfortunately, I need to draw the image at a spec..

Find a class somewhere inside dozens of JAR files?

How would you find a particular class name inside lots of jar files? (Looking for the actual class name, not the classes that reference it.)..

How do I target only Internet Explorer 10 for certain situations like Internet Explorer-specific CSS or Internet Explorer-specific JavaScript code?

How do I target only Internet Explorer 10 for certain situations like Internet Explorer-specific CSS or Internet Explorer-specific JavaScript code? I tried this, but it doesn't work: <!--[if IE 1..

Access to the requested object is only available from the local network phpmyadmin

I just installed xampp 1.8.0 for linux and when I opened phpmyadmin I got this error Access Forbidden!! New XAMPP security concept: Access to the requested object is only available from the local n..

Adding to an ArrayList Java

I am a beginner to java, and need some help. I am trying to convert an Abstract Data type Foo which is an associated list to an Arraylist of the strings B. How do you loop through the list and add ea..

Installation failed with message Invalid File

Installation failed with message Invalid File: K:\project\app\build\intermediates\split-apk\with_ImageProcessor\debug\slices\slice_0.apk. It is possible that this issue is resolved by uninstall..

Android: Remove all the previous activities from the back stack

When i am clicking on Logout button in my Profile Activity i want to take user to Login page, where he needs to use new credentials. Hence i used this code: Intent intent = new Intent(ProfileActivit..

How many socket connections possible?

Has anyone an idea how many tcp-socket connections are possible on a modern standard root server? (There is in general less traffic on each connection, but all the connections have to be up all the ti..

Loop through files in a directory using PowerShell

How can I change the following code to look at all the .log files in the directory and not just the one file? I need to loop through all the files and delete all lines that do not contain "step4" or ..


I want to create a new table with properties of an old table and without duplicates. I want to do something like this: CREATE TABLE New_Users LIKE Old_Users, AS (SELECT * FROM Old_Users GROUP BY ID..

Found conflicts between different versions of the same dependent assembly that could not be resolved

When I clean and then build my solution that has several projects, the output window reports that the build succeeded. However, when I view the Error List Window, it shows me this warning: Found c..

Common CSS Media Queries Break Points

I am working on a Responsive Web Site with CSS Media Queries. Is the following a good organization for devices? Phone, Ipad (Landscape & Portrait), Desktop and Laptop, Large Screen What are the ..

Android Studio: Can't start Git

When I start Android Studio there's a message Can't start Git: C:\Program Files (x86)\Git\cmd\git.cmd Probably the path to Git executable is not valid. Fix it. But I can see that the git.cmd I..

How can I stop redis-server?

I apparently have a redis-server instance running because when I try to start a new server by entering redis-server, I'm greeted with the following: Opening port: bind: Address already in use I can..

Execute JavaScript using Selenium WebDriver in C#

How is this achieved? Here it says the java version is: WebDriver driver; // Assigned elsewhere JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScript("return document.title"); But I..