Questions Tagged with #Apache shindig

Apache Shindig is an OpenSocial container and helps you to start hosting OpenSocial apps quickly by providing the code to render gadgets, proxy requests, and handle REST and RPC requests.

Passing Objects By Reference or Value in C#

In C#, I have always thought that non-primitive variables were passed by reference and primitive values passed by value. So when passing to a method any non-primitive object, anything done to the obj..

Vagrant error : Failed to mount folders in Linux guest

I have some issues with Vagrant shared folders, my base system is Ubuntu 13.10 desktop. I do not understand why I have this error is something that is not right configured ? Is a NFS issue or Virtual..

How to close TCP and UDP ports via windows command line

Does somebody knows how to close a TCP or UDP socket for a single connection via windows command line? Googling about this, I saw some people asking the same thing. But the answers looked like a manu..

How to find if a file contains a given string using Windows command line

I am trying to create a batch (.bat) file for windows XP to do the following: If (file.txt contains the string 'searchString') then (ECHO found it!) ELSE(ECHO not found) So far, I have found a way..

What is lexical scope?

What is a brief introduction to lexical scoping?..

Format output string, right alignment

I am processing a text file containing coordinates x, y, z 1 128 1298039 123388 0 2 .... every line is delimited into 3 items using words = line.split() After processing..

Playing m3u8 Files with HTML Video Tag

I am trying to use HTTP Live Streaming (HLS) to stream video to my computers and my iPhone. After reading through the Apple 'HTTP Live Streaming Overview' as well as 'Best Practices for Creating and ..

Android: Flush DNS

We recently released an android application that pulls information from an external server. Last week we moved from shared hosting to a dedicated server, that went smoothly up until we started gettin..

React PropTypes : Allow different types of PropTypes for one prop

I have a component that receives a prop for its size. The prop can be either a string or a number ex: "LARGE" or 17. Can I let React.PropTypes know that this can be either one or the other in the pro..

How to map a composite key with JPA and Hibernate?

In this code, how to generate a Java class for the composite key (how to composite key in hibernate): create table Time ( levelStation int(15) not null, src varchar(100) not null, dst ..

C# error: Use of unassigned local variable

I'm not sure why I'm getting this error, but shouldn't this code compile, since I'm already checking to see if queue is getting initialized? public static void Main(String[] args) { Byte maxSize..

What is an MDF file?

Is this like an “embedded” database of sorts? A file containing a built in database?..

Change project name on Android Studio

I want to change the name of my project and module. But if I try to rename them Android Studio notify me some errors... e.g. I want to change the name from "MyApplication" to "AndroidApp" as shown in ..

Refused to apply inline style because it violates the following Content Security Policy directive

So, in about 1 hour my extensions failed hard. I was doing my extension and it was doing what I pretended. I made some changes, and as I didnt liked I deleted them, and now my extension is throwing e..

Maximum size of an Array in Javascript

Context: I'm building a little site that reads an rss feed, and updates/checks the feed in the background. I have one array to store data to display, and another which stores ID's of records that have..

JetBrains / IntelliJ keyboard shortcut to collapse all methods

I'm working on some legacy code that has a class that is 10,000+ lines of code and has 100s of methods. Is there a shortcut for any JetBrains IDE (since the shortcut would likely be shared across all ..

How to make a script wait for a pressed key?

I want my script to wait until the user presses any key. How do I do that?..

How to convert 2D float numpy array to 2D int numpy array?

How to convert real numpy array to int numpy array? Tried using map directly to array but it did not work...

Rails: Can't verify CSRF token authenticity when making a POST request

I want to make POST request to my local dev, like this:'http://localhost:3000/fetch_heroku', :body => {:type => 'product'},) However, from the server console ..

How to remove "href" with Jquery?

<a id="a$id" onclick="check($id,1)" href="javascript:void(0)" class="black">Qualify</a> After "href" is removed, is "Qualify" still clickable?..

#1146 - Table 'phpmyadmin.pma_recent' doesn't exist

Solution Guys... FYI i am using xampp to use phpmyadmin. and this error happens during the process of creating a database on localhost. Below is the code for file under phpmyadmin director..

What does value & 0xff do in Java?

I have the following Java code: byte value = 0xfe; // corresponds to -2 (signed) and 254 (unsigned) int result = value & 0xff; The result is 254 when printed, but I have no idea how this code w..

How to write trycatch in R

I want to write trycatch code to deal with error in downloading from the web. url <- c( "", "

How do I set ANDROID_SDK_HOME environment variable?

I'm working with Eclipse on Windows 7, x64. I'm getting an error when running ADT bundle of android development: Error: Error parsing the AVDs Unable to get the Android SDK home directory. Make sure ..

How come I can't remove the blue textarea border in Twitter Bootstrap?

In Chrome, there is a blue border around the textarea. How come I can't remove it? textarea:hover, input:hover, textarea:active, input:active, textarea:focus, input:focus { outline:0px !impo..

How do you revert to a specific tag in Git?

I know how to revert to older commits in a Git branch, but how do I revert back to a branch's state dictated by a tag? I envision something like this: git revert -bytag "Version 1.0 Revision 1.5" I..

How to include external Python code to use in other files?

If you have a collection of methods in a file, is there a way to include those files in another file, but call them without any prefix (i.e. file prefix)? So if I have: [] def Calculate ( num..

Read a text file using Node.js?

I need to pass in a text file in the terminal and then read the data from it, how can I do this? node server.js file.txt How do I pass in the path from the terminal, how do I read that on the other..

How to fix the Eclipse executable launcher was unable to locate its companion shared library for windows 7?

I am getting the following error, while launching Eclipse: The eclipse executable launcher was unable to locate its companion shared library. Previously Eclipse was working fine when I had jre6 ..

What are the complexity guarantees of the standard containers?

Apparently ;-) the standard containers provide some form of guarantees. What type of guarantees and what exactly are the differences between the different types of container? Working from the SGI pa..

How to create custom config section in app.config?

I want to add a custom configuration section in my app.config file. Is there a way to do it and how can I access these settings in my program. Following is the config section I want to add to my app.c..

What is the simplest way to convert a Java string from all caps (words separated by underscores) to CamelCase (no word separators)?

The title pretty much says it all. What's the simplest/most elegant way that I can convert, in Java, a string from the format "THIS_IS_AN_EXAMPLE_STRING" to the format "ThisIsAnExampleString"? I figur..

Getting an Embedded YouTube Video to Auto Play and Loop

I am trying to get a basic Youtube video to auto play and auto loop embedded on a page, but I'm having no luck. <div style="text-align: center; margin: auto"><object type="application/x-shoc..

Where can I find the Tomcat 7 installation folder on Linux AMI in Elastic Beanstalk?

I have a elastic beanstalk linux-tomcat ami instance with the sample application installed and working off the public dns. I'm able to ssh into the instance but cannot find where tomcat 7 lives (ie. ..

Python: instance has no attribute

I have a problem with list within a class in python. Here's my code : class Residues: def setdata(self, name): = name self.atoms = list() a = atom C = Residues() C.atom..

What does .shape[] do in "for i in range(Y.shape[0])"?

I'm trying to break down a program line by line. Y is a matrix of data but I can't find any concrete data on what .shape[0] does exactly. for i in range(Y.shape[0]): if Y[i] == -1: This program..

configure: error: C compiler cannot create executables

I've checked a number of similar questions on stackoverflow but haven't found an answer yet. I'm trying to install memcached on Lion OSX as shown here. Here's what I'm getting: j-court-demones-macb..

How can I reference a dll in the GAC from Visual Studio?

This assembly is in the GAC: Microsoft.SqlServer.Management.RegisteredServers.dll How can I add a reference to this assembly in Visual Studio? I can view the file in c:\windows\assembly\..

Spring Rest POST Json RequestBody Content type not supported

When I try to post new object with post method. RequestBody could not recognize contentType. Spring is already configured and POST could work with others objects, but not this specific one. org.sprin..

Is there an ignore command for git like there is for svn?

I am a new user to git and I am starting a new project. I have a bunch of dot files that I would like to ignore. Is there an ignore command for git like there is for svn?..

Java heap terminology: young, old and permanent generations?

I'm trying to understand What the concepts of young, old and permanent generations are in the Java heap terminology, and more specifically the interactions between the three generations. My questions..

Get the current language in device

How can we get the current language selected in the Android device?..

Why does ASP.NET webforms need the Runat="Server" attribute?

Why do I have to specify runat="server" on all my ASP.NET controls when it is a mandatory attribute and server is the only option available in my limited knowledge of ASP.NET, and I get an error if I ..

Create list of single item repeated N times

I want to create a series of lists, all of varying lengths. Each list will contain the same element e, repeated n times (where n = length of the list). How do I create the lists, without using a list..

What does the 'export' command do?

I am a little new to Linux, and I happen to run some commands blindly, in order to get things done. I thought that it will not be a waste of asking these type of questions, since more new people would..

How to make a query with group_concat in sql server

I know that in sql server we cannot use Group_concat function but here is one issue i have in which i need to Group_Concat my query.I google it found some logic but not able to correct it.My sql query..

Volatile boolean vs AtomicBoolean

What does AtomicBoolean do that a volatile boolean cannot achieve?..

Angularjs simple file download causes router to redirect

HTML: <a href="" download="foo.pdf"> Uploads get a unique file name while there real name is kept in database. I want to realize a simple file download. But th..

Where is the itoa function in Linux?

itoa() is a really handy function to convert a number to a string. Linux does not seem to have itoa(), is there an equivalent function or do I have to use sprintf(str, "%d", num)?..

Number format in excel: Showing % value without multiplying with 100

When I set format of a cell as %, it automatically multiply the value with 100 & show the value. So 5.66 becomes 566 %. I want to apply % format on a column but want to keep the values same as be..

PHP sessions default timeout

Do PHP sessions timeout by default - ie without any coding on my part would a user eventually be "logged out" after some time of inactivity?..

Calling a class function inside of __init__

I'm writing some code that takes a filename, opens the file, and parses out some data. I'd like to do this in a class. The following code works: class MyClass(): def __init__(self, filename): ..

Do a "git export" (like "svn export")?

I've been wondering whether there is a good "git export" solution that creates a copy of a tree without the .git repository directory. There are at least three methods I know of: git clone followed ..

How to get current PHP page name

I've a file called demo.php where I don't have any GET variables in the URL, so if I want to hide a button if am on this page I can't use something like this: if($_GET['name'] == 'value') { //Hide ..

ModuleNotFoundError: What does it mean __main__ is not a package?

I am trying to run a module from the console. The structure of my directory is this: I am trying to run the module, from the problem_set_02 directory using: $ python..

How to solve Error?

I connected with VPN to setup the inventory API to get product list and it works fine. Once I get the result from the web-service and i bind to UI. And also I integrated PayPal with my application for..

How to declare local variables in postgresql?

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

How are "mvn clean package" and "mvn clean install" different?

What exactly are the differences between mvn clean package and mvn clean install? When I run both of these commands, they both seem to do the same thing. ..

C++ initial value of reference to non-const must be an lvalue

I'm trying to send value into function using reference pointer but it gave me a completely non-obvious error to me #include "stdafx.h" #include <iostream> using namespace std; void test(float..

Setting Authorization Header of HttpClient

I have an HttpClient that I am using for a REST API. However I am having trouble setting up the Authorization header. I need to set the header to the token I received from doing my OAuth request. I sa..

Using IS NULL or IS NOT NULL on join conditions - Theory question

Theory question here: Why does specifying table.field IS NULL or table.field IS NOT NULL not work on a join condition (left or right join for instance) but only in the where condition? Non working E..

SQL Server stored procedure creating temp table and inserting value

I am trying to select values from different table and inset it in to the temporary table. I need a identity field in the temporary table. When I try to execute the following code it throws an error: ..

Angular - POST uploaded file

I'm using Angular, TypeScript to send a file, along with JSON Data to a server. Below is my code: import {Component, View, NgFor, FORM_DIRECTIVES, FormBuilder, ControlGroup} from 'angular2/angular2'..

Save multiple sheets to .pdf

I have a reporting spreadsheet that grabs some data from a database and forms three sheets of summary report information. I want to run the spreadsheet automatically from the command line, and have it..

What is the difference between HTTP 1.1 and HTTP 2.0?

HTTP/1.1 has served the Web well for more than fifteen years, but its age is starting to show. Can anybody explain what is the main difference between HTTP 1.1 and 2.0? Is there any change in ..

Python Pandas : pivot table with aggfunc = count unique distinct

df2 = pd.DataFrame({'X' : ['X1', 'X1', 'X1', 'X1'], 'Y' : ['Y2','Y1','Y1','Y1'], 'Z' : ['Z3','Z1','Z1','Z2']}) X Y Z 0 X1 Y2 Z3 1 X1 Y1 Z1 2 X1 Y1 Z1 3 X1 Y1 Z2 g=df2.groupby('X'..

How to run .APK file on emulator

Possible Duplicate: How do you install an APK file in the Android emulator? I download an APK file and I want to run it on an Android emulator but I don't know how. Please help me. Thanks..

Update an outdated branch against master in a Git repo

I have a Git repository that has branch (local and remote) that has become outdated. I would like to bring this branch up to date with the master branch, but I don't know how to do this. There will al..

How to resolve the "EVP_DecryptFInal_ex: bad decrypt" during file decryption

I have the following query.Could any one please suggest me a solution. I'm working on encryption and decryption of file for first time. I have encrypted file through command prompt using the command..

How to append strings using sprintf?

I am facing a serious issue with sprintf. Suppose my code snippet is: sprintf(Buffer,"Hello World"); sprintf(Buffer,"Good Morning"); sprintf(Buffer,"Good Afternoon"); . ...

Python-equivalent of short-form "if" in C++

Possible Duplicate: Python Ternary Operator Is there a way to write this C/C++ code in Python? a = (b == true ? "123" : "456" )..

How do I format my oracle queries so the columns don't wrap?

I've tried this, but it doesn't work: col * format a20000 Do I really have to list every column specifically? That is a huge pain in the arse...

Can I set state inside a useEffect hook

Lets say I have some state that is dependent on some other state (eg when A changes I want B to change). Is it appropriate to create a hook that observes A and sets B inside the useEffect hook? Wi..

How to make sure that a certain Port is not occupied by any other process

I am working on a Java EE Application in a Windows environment. (I am using Windows 7) I am using Tomcat Server, unfortunately port number 8080 is busy (used by Oracle). Now I want to assign a differ..

JavaScript Extending Class

I have a base class: function Monster() { = 100; } Monster.prototype.growl = function() { console.log("Grr!"); } That I want to extend and create another class with: function M..

How to run H2 database in server mode?

How to start H2 database in server mode. I need to start it from my application.I tried the following code: server = Server.createTcpServer().start(); Here is the properties for the connection: ja..

Split a large dataframe into a list of data frames based on common value in column

I have a data frame with 10 columns, collecting actions of "users", where one of the columns contains an ID (not unique, identifying user)(column 10). the length of the data frame is about 750000 rows..

How can I divide two integers stored in variables in Python?

I've got two numbers stored in varibles, a and b, and i'd like to see of the ratio of those two is an integer or not in python. However when I try result = a./b it gives me a SyntaxError: invali..

Reverse of JSON.stringify?

I'm stringyfing an object like {'foo': 'bar'} How can I turn the string back to an object?..

Clear data in MySQL table with PHP?

How do I clear all the entries from just one table in MySQL with PHP?..

Show a number to two decimal places

What's the correct way to round a PHP string to two decimal places? $number = "520"; // It's a string from a database $formatted_number = round_to_2dp($number); echo $formatted_number; The output..

Format y axis as percent

I have an existing plot that was created with pandas like this: df['myvar'].plot(kind='bar') The y axis is format as float and I want to change the y axis to percentages. All of the solutions I fo..

Proper usage of .net MVC Html.CheckBoxFor

All I want to know is the proper syntax for the Html.CheckBoxFor HTML helper in ASP.NET MVC. What I'm trying to accomplish is for the check-box to be initially checked with an ID value so I can refer..

Can't push to GitHub because of large file which I already deleted

Currently I have Empty GitHub repo SSH server repo (main) Local Repo SSH server repo was the most up-to-date repo (production site) so I did a Git clone from there to local. I then tried to do a g..

Console.log not working at all

A bunch of code isn't working and I'm trying to identify where the problem lies but console.log() isn't logging any results in Chrome Dev tools, am I doing it correctly? $(window).scroll(function() {..

Task not serializable: when calling function outside closure only on classes not objects

Getting strange behavior when calling function outside of a closure: when function is in a object everything is working when function is in a class get : Task not serializable:

Encode a FileStream to base64 with c#

I know how to encode / decode a simple string to / from base64. But how would I do that if the data is already been written to a FileStream object. Let's say I have only access to the FileStream obj..

How do I navigate to a parent route from a child route?

My problem is quite classic. I have a private part of an application which is behind a login form. When the login is successful, it goes to a child route for the admin application. My problem is that..

Why is pydot unable to find GraphViz's executables in Windows 8?

I have GraphViz 2.32 installed in Windows 8 and have added C:\Program Files (x86)\Graphviz2.32\bin to the System PATH variable. Still pydot is unable to find its executables. Traceback (most recent c..

Python: Generate random number between x and y which is a multiple of 5

I've read the manual for pseudo-randomness in Python, and to my knowledge, you can only generate numbers up to a given maximum value, i.e. 0-1, 0-30, 0-1000, etc. I want to: a) Generate a number be..

How to execute a file within the python interpreter?

I'm trying to execute a file with python commands from within the interpreter. EDIT: I'm trying to use variables and settings from that file, not to invoke a separate process...

Sort an array in Java

I'm trying to make a program that consists of an array of 10 integers which all has a random value, so far so good. However, now I need to sort them in order from lowest to highest value and then pri..

Creating .pem file for APNS?

How do I create a .pem file to be stored in the hosting server for APN payload data?..

Format of the initialization string does not conform to specification starting at index 0

I have an ASP.NET application which runs fine on my local development machine. When I run this application online, it shows the following error: Format of the initialization string does not conform t..

Remove all constraints affecting a UIView

I have a UIView which is placed on the screen via several constraints. Some of the constraints are owned by the superview, others are owned by other ancestors (e.g. perhaps the view property of a UIVi..

The intel x86 emulator accelerator (HAXM installer) revision 6.0.5 is showing not compatible with windows

This a screenshot of the sdk manager message showing the emulator as incompatible with windows: I am using android studio, currently version 2.2.3. Is there an other or older version of the emulato..

MetadataException: Unable to load the specified metadata resource

All of a sudden I keep getting a MetadataException on instantiating my generated ObjectContext class. The connection string in App.Config looks correct - hasn't changed since last it worked - and I've..

Prevent form redirect OR refresh on submit?

I've searched through a bunch of pages, but can't find my problem, so I had to make a post. I have a form that has a submit button, and when submitted I want it to NOT refresh OR redirect. I just wan..

Regex in JavaScript for validating decimal numbers

I want a regex in JavaScript for validating decimal numbers. It should allow only up to two decimal places. For example, it should allow 10.89 but not 10.899. It should also allow only one period (..

ReactJS - Get Height of an element

How can I get the Height of an element after React renders that element? HTML <div id="container"> <!-- This element's contents will be replaced with your component. --> <p> jnknwq..

Applications are expected to have a root view controller at the end of application launch

I get the following error in my console: Applications are expected to have a root view controller at the end of application launch Below is my application:didFinishLaunchWithOptions method: - (..

How to make `setInterval` behave more in sync, or how to use `setTimeout` instead?

I am working on a music program that requires multiple JavaScript elements to be in sync with another. I’ve been using setInterval, which works really well initially. However, over time the elements..

How to open Atom editor from command line in OS X?

I have the Atom editor and was wondering how you can open a file or folder from the terminal in Atom. I am using a Mac. I am looking for a way to do this: atom . (opens folder) atom file.js (opens f..

How to find if an array contains a string

Possible Duplicate: How to search for string in MS Access VBA array I am currently working on an Excel macro, and I could not find a way to do like if array.contains(mystring) I wrote the ..

How to print VARCHAR(MAX) using Print Statement?

I have a code which is: DECLARE @Script VARCHAR(MAX) SELECT @Script = definition FROM manged.sys.all_sql_modules sq where sq.object_id = (SELECT object_id from managed.sys.objects Where type = 'P' ..

Check if list<t> contains any of another list

I have a list of parameters like this: public class parameter { public string name {get; set;} public string paramtype {get; set;} public string source {get; set;} } IEnumerable<Param..

C# nullable string error

private string? typeOfContract { get { return (string?)ViewState["typeOfContract"]; } set { ViewState["typeOfContract"] = value; } } Later in the code I use it like this: typeOfContract = Reque..

Bootstrap button - remove outline on Chrome OS X

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

How to find length of dictionary values

I am pretty new to all of this so this might be a noobie question.. but I am looking to find length of dictionary values... but I do not know how this can be done. So for example, d = {'key':['hello..

How to get value at a specific index of array In JavaScript?

I have an array and simply want to get the element at index 1. var myValues = new Array(); var valueAtIndex1 = myValues.getValue(1); // (something like this) How can I get the value at the 1st inde..

What does @media screen and (max-width: 1024px) mean in CSS?

I found this piece of code in a CSS file I inherited, but I can't make any sense out of it: @media screen and (max-width: 1024px){ { left: 50%; margin-left: -512px; } } S..

jQuery UI dialog positioning

I am trying to use the jQuery dialog UI library in order to position a dialog next to some text when it is hovered over. The jQuery dialog takes a position parameter which is measured from the top le..

Remove columns from DataTable in C#

I have a DataSet which I get a DataTable from that I am being passed back from a function call. It has 15-20 columns, however I only want 10 columns of the data. Is there a way to remove those column..

Can a website detect when you are using Selenium with chromedriver?

I've been testing out Selenium with Chromedriver and I noticed that some pages can detect that you're using Selenium even though there's no automation at all. Even when I'm just browsing manually just..

Entity Framework: table without primary key

I have an existing DB with which I would like to build a new app using EF4.0 Some tables do not have primary keys defined so that when I create a new Entity Data Model, I get the following message: Th..

How can I force a long string without any blank to be wrapped?


How to extract multiple JSON objects from one file?

I am very new to Json files. If I have a json file with multiple json objects such as following: {"ID":"12345","Timestamp":"20140101", "Usefulness":"Yes", "Code":[{"event1":"A","result":"1"},…]} {..

ReferenceError: describe is not defined NodeJs

I am trying to define some endpoints and do a test using nodejs. In server.js I have: var express = require('express'); var func1 = require('./func1.js'); var port = 8080; var server = express(); se..

How do I print colored output to the terminal in Python?

Is there a Python equivalent of Perl's print color 'red'; print <something>; print color 'reset'; available? I am using this approach: "\x1b[1;%dm" % (<color code>) + "ERRO..

How to set-up a favicon?

I am trying to do a very simple preliminary exercise to setting up a website which is creating a favicon. This is the code I am using: <!DOCTYPE html > <html lang="en-US"> <head prof..

EntityType 'IdentityUserLogin' has no key defined. Define the key for this EntityType

I am working with Entity Framework Code First and MVC 5. When I created my application with Individual User Accounts Authentication I was given an Account controller and along with it all the required..

How do I obtain the frequencies of each value in an FFT?

I have an FFT result. These are stored in two double arrays: a real part array and an imaginary part array. How do I determine the frequencies that correspond to each element in these arrays? In othe..

Can "git pull --all" update all my local branches?

I often have at least 3 remote branches: master, staging and production. I have 3 local branches that track those remote branches. Updating all my local branches is tedious: git fetch --all git reba..

What's the difference between returning value or Promise.resolve from then()

What is the difference between: _x000D_ _x000D_ new Promise(function(res, rej) {_x000D_ res("aaa");_x000D_ })_x000D_ .then(function(result) {_x000D_ return "bbb";_x000D_ })_x000D_ .th..

Changing an element's ID with jQuery

I need to change an element's ID using jQuery. Apparently these don't work: jQuery(this).prev("li").attr("id")="newid" jQuery(this).prev("li")="newid" I found out that I can make it happen with ..

Replace a string in shell script using a variable

I am using the below code for replacing a string inside a shell script. echo $LINE | sed -e 's/12345678/"$replace"/g' but it's getting replaced with $replace instead of the value of that variable. ..

How to load/edit/run/save text files (.py) into an IPython notebook cell?

I've recently moved over to using IPython notebooks as part of my workflow. However, I've not been successful in finding a way to import .py files into the individual cells of an open IPython noteboo..

android.view.InflateException: Binary XML file: Error inflating class fragment

I have a very frustrating error that I cannot explain. I created an Android application that uses Android AppCompat to make it compatible with older versions. Here is my main activity layout file: &l..

Does Go have "if x in" construct similar to Python?

Without iterating over the entire array, how can I check if x in array using Go? Does the language have a construct? Like Python: if "x" in array: .....

Setting an HTML text input box's "default" value. Revert the value when clicking ESC

When a web form is written to the browser, the browsers remembers what the initial values are of a text INPUT box. ie. when it receives HTML like this: <input type="text" value="something"> T..

Creating columns in listView and add items

I'm learning how to use the listView in a windowsForm and I have some problems that I hope to solve here. The first thing is when I'm creating the columns with the code below: private void initListVi..

What's the fastest way to delete a large folder in Windows?

I want to delete a folder that contains thousands of files and folders. If I use Windows Explorer to delete the folder it can take 10-15 minutes (not always, but often). Is there a faster way in Windo..

How to add constraints programmatically using Swift

I'm trying to figure this out since last week without going any step further. Ok, so I need to apply some constraints programmatically in Swift to a UIView using this code: var new_view:UIView! = UIV..

How does C#'s random number generator work?

I was just wondering how the random number generator in C# works. I was also curious how I could make a program that generates random WHOLE INTEGER numbers from 1-100...

How to parse a String containing XML in Java and retrieve the value of the root node?

I have XML in the form of a String that contains <message>HELLO!</message> How can I get the String "Hello!" from the XML? It should be ridiculously easy but I am lost. The XML isn't ..

Fixed height and width for bootstrap carousel

I am using the bootstrap carousel but I want a fixed width and height so that all my images will auto fit to the defined height and width. Can someone please help me on achieving this. <div class=..

How to repeat a string a variable number of times in C++?

I want to insert 'n' spaces (or any string) at the beginning of a string in C++. Is there any direct way to do this using either std::strings or char* strings? E.g. in Python you could simply do >..

JS how to cache a variable

What I want to do is to be able to create a variable, give it a value, close and reopen the window, and be able to retrieve the value I set in the last session. What is the simplest way to do that? JQ..

How does += (plus equal) work?

I'm a bit confused with the += sign. How does it work? 1 += 2 // equals ? and this var data = [1,2,3,4,5]; var sum = 0; data.forEach(function(value) { sum += value; }); sum = ? ..

Array to Hash Ruby

Okay so here's the deal, I've been googling for ages to find a solution to this and while there are many out there, they don't seem to do the job I'm looking for. Basically I have an array structured..

Exit a Script On Error

I'm building a Shell Script that has a if function like this one: if jarsigner -verbose -keystore $keyst -keystore $pass $jar_file $kalias then echo $jar_file signed sucessfully else echo ERR..

Cheap way to search a large text file for a string

I need to search a pretty large text file for a particular string. Its a build log with about 5000 lines of text. Whats the best way to go about doing that? Using regex shouldn't cause any problems s..

jQuery "on create" event for dynamically-created elements

I need to be able to dynamically create <select> element and turn it into jQuery .combobox(). This should be element creation event, as opposed to some "click" event in which case I could just u..

How do I force git pull to overwrite everything on every pull?

I have a CENTRAL bare repository that has three developer repositories pulling and pushing to it normally. I also have two other repositories that pull from the CENTRAL bare repo: one is the live ser..

jquery 3.0 url.indexOf error

I am getting following error from jQuery once it has been updated to v3.0.0. jquery.js:9612 Uncaught TypeError: url.indexOf is not a function Any Idea why?..

Is there any sizeof-like method in Java?

Is there any built-in method in Java to find the size of any datatype? Is there any way to find size?..

Why doesn't Java offer operator overloading?

Coming from C++ to Java, the obvious unanswered question is why didn't Java include operator overloading? Isn't Complex a, b, c; a = b + c; much simpler than Complex a, b, c; a = b.add(c);? Is there..

How to change the size of the font of a JLabel to take the maximum size

I have a JLabel in a Container. The defaut size of the font is very small. I would like that the text of the JLabel to take the maximum size. How can I do that?..

How to merge lists into a list of tuples?

What is the Pythonic approach to achieve the following? # Original lists: list_a = [1, 2, 3, 4] list_b = [5, 6, 7, 8] # List of tuples from 'list_a' and 'list_b': list_c = [(1,5), (2,6), (3,7), (4..

Javascript: Uncaught TypeError: Cannot call method 'addEventListener' of null

I'm trying to do something fairly simple, but for the reason of me probably not being good enough to search documentation, I can't get this to work. I have a functioning inline JS that looks like thi..

What is the default Jenkins password?

I'm using a EC2 server instance. Used the following to install Jenkins: wget -q -O - | sudo apt-key add - sudo sh -c 'echo deb http://pkg.jenkins-c..

Get user info via Google API

Is it possible to get information from user's profile via Google API? If it is possible, which API should I use? I'm interesting in such information: Url to the user profile (e.g. https://profiles..

How do I make a matrix from a list of vectors in R?

Goal: from a list of vectors of equal length, create a matrix where each vector becomes a row. Example: > a <- list() > for (i in 1:10) a[[i]] <- c(i,1:5) > a [[1]] [1] 1 1 2 3 4 5 [..

What is the difference between logical data model and conceptual data model?

What is the difference between logical data model and conceptual data model?..

How do I push amended commit to the remote Git repository?

When I've worked a bit with my source code, I did my usual thing commit and then I pushed to a remote repository. But then I noticed I forgot to organize my imports in the source code. So I do the ame..

Is nested function a good approach when required by only one function?

Let's say that a function A is required only by function B, should A be defined inside B? Simple example. Two methods, one called from another: def method_a(arg): some_data = method_b(arg) def me..

C# winforms combobox dynamic autocomplete

My problem is similar to this one: How can I dynamically change auto complete entries in a C# combobox or textbox? But I still don't find solution. The problem briefly: I have an ComboBox and a larg..

jQuery window scroll event does not fire up

I'm trying to implement a simple "stay inside the viewport" behaviour to a div via jquery. For that i need to bind a function to the scroll event of the window, but i can't seem to get it to fire up: ..

Throwing exceptions from constructors

I'm having a debate with a co-worker about throwing exceptions from constructors, and thought I would like some feedback. Is it OK to throw exceptions from constructors, from a design point of view? ..

WAMP server, localhost is not working

My WAMP server localhost was broken when my Windows 7 updates automatically. My port 80 is already used by IIS server. I searched on website, many people suggested that I need to change the port 80..

jQuery UI: Datepicker set year range dropdown to 100 years

Using the Datepicker the year drop down by default shows only 10 years. The user has to click the last year in order to get more years added. How can we set the initial range to be 100 years so that ..

SQL Server 2012 column identity increment jumping from 6 to 1000+ on 7th entry

I have a strange scenario in which the auto identity int column in my SQL Server 2012 database is not incrementing properly. Say I have a table which uses an int auto identity as a primary key it is ..

VB.NET: how to prevent user input in a ComboBox

How do you prevent user input in a ComboBox so that only one of the items in the defined list can be selected by the user?..

What Java FTP client library should I use?

Since I received no positives answers to my last question. I will try to write a Java FTP upload applet myself. My question is: "Can you recommend a Java FTP client library for me to use?" I want it..

changing default x range in histogram matplotlib

I would like to change the default x range for the histogram plot. The range of the data is from 7 to 12. However, by default the histogram starts right at 7 and ends at 13. I want it to start at 6.5 ..

Read MS Exchange email in C#

I need the ability to monitor for and read e-mail from a particular mailbox on a MS Exchange Server (internal to my company). I also need to be able to read the sender's e-mail address, subject, messa..

Java, How to specify absolute value and square roots

How do you specify in java how to make a square root and absolute value? Here is what I have: if(variable < 0){ variable = variable + variable2; } But is there an easier way to get the abso..

How can I open a .tex file?

I'm trying to open a .tex file. I'm not sure I've got to the bottom of the (possibly) surprisingly complex process. I was told I could do it with Notepad++, which I proceeded to download. Here is the..

Try-Catch-End Try in VBScript doesn't seem to work

I'm trying the following code: Try ' DOESN'T WORK Throw 2 ' How do I throw an exception? Catch ex 'What do I do here? End Try but I'm getting the error Statement expected in the catch claus..

Google Play app description formatting

I've made an Android application that is available on Google Play. Now I want to add some more formatting to my app description (eg. indent, links, lists..). But I cannot find any website where possib..

The specified type member is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported

var result = (from bd in context.tblBasicDetails from pd in context.tblPersonalDetails.Where(x => x.UserId == bd.UserId).DefaultIfEmpty() from opd in context.tblOtherPersonalDetails.W..

start MySQL server from command line on Mac OS Lion

I installed mySQL for my Mac. Beside starting the SQL server with mySQL.prefPane tool installed in System Preference, I want to know the instruction to start from command-line. I do as follow: After ..

Two-way SSL clarification

I am somewhat confused as to how two-way SSL works. How does the client create its certificate to send to the server? Is it generated from the server and distributed to the client? Also, what is th..

For-loop vs while loop in R

I have noticed a curious thing whilst working in R. When I have a simple program that computes squares from 1 to N implemented using for-loop and while-loop the behaviour is not the same. (I don't car..

Angular2 Routing with Hashtag to page anchor

I wish to add some links on my Angular2 page, that when click, will jump to specific positions within that page, like what normal hashtags do. So the links would be something like /users/123#userInfo..

GLYPHICONS - bootstrap icon font hex value

I'd like to use Glyphicons icon font and I would need the hex value of each icon. I can't seem to find any resources on this on the Bootstrap website nor the Glyphicons website. I'd like to know how ..

@RequestParam vs @PathVariable

What is the difference between @RequestParam and @PathVariable while handling special characters? + was accepted by @RequestParam as space. In the case of @PathVariable, + was accepted as +...

Select2 doesn't work when embedded in a bootstrap modal

When I use a select2 (input) in bootstrap modal, I can't type anything into it. It's like disabled? Outside the modal select2 works fine. Working example: code: <!-..

Create a table without a header in Markdown

Is it possible to create a table without a header in Markdown? The HTML would look like this: <table> <tr> <td>Key 1</td> <td>Value 1</td> </tr> <..

How can I create a dropdown menu from a List in Tkinter?

I am creating a GUI that builds information about a person. I want the user to select their birth month using a drop down bar, with the months configured earlier as a list format. from tkinter impor..

git add only modified changes and ignore untracked files

I ran "git status" and listed below are some files that were modified/or under the heading "changes not staged for commit". It also listed some untracked files that I want to ignore (I have a ".gitign..

C# WinForms - custom button unwanted border when form unselected

I'm having a problem with a custom button I have created in c# win forms.. The button appears fine when the form is selected but as soon as I click away from the form a border appears on the button. A..

How to add an image in Tkinter?

How do I add an image in Tkinter? This gave me a syntax error: root = tk.Tk() img = ImageTk.PhotoImage( panel = tk.Label(root, image = img) panel.pack(side = "bottom", fill = "both"..

How to animate button in android?

I am making an android app, and I have a button which leads to a messaging place. On the activity with the button, I check if there is any unread messages, and if so I want to do something to the butt..

Isn't the size of character in Java 2 bytes?

I used RandomAccessFile to read a byte from a text file. public static void readFile(RandomAccessFile fr) { byte[] cbuff = new byte[1];,0,1); System.out.println(new String(c..

How do I get my page title to have an icon?

I would like to have my site’s logo shown in the icon area of the title rather than the default white document. Exactly as Stack Overflow has it...

How to make return key on iPhone make keyboard disappear?

I have two UITextFields (e.g. username and password) but I cannot get rid of the keyboard when pressing the return key on the keyboard. How can I do this? ..

How can I generate a list of files with their absolute path in Linux?

I am writing a shell script that takes file paths as input. For this reason, I need to generate recursive file listings with full paths. For example, the file bar has the path: /home/ken/foo/bar b..

How do I change an HTML selected option using JavaScript?

I have option menu like this: <form name="AddAndEdit"> <select name="list" id="personlist"> <option value="11">Person1</option> <option value="27">Person2..

How do I protect Python code?

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

Eclipse cannot load SWT libraries

Every time I try to open Eclipse in Ubuntu 12.04 I get an Unsatisfied Link Error and it will not open. I have recently installed the java JDK and Android SDK, could this be the problem? I followed thi..

How to send an HTTP request with a header parameter?

I'm very new to javascript and web programming in general and I need some help with this. I have an HTTP request that I need to send through javascript and get need to store the output in a variable. ..

Open an html page in default browser with VBA?

How do I open an HTML page in the default browser with VBA? I know it's something like: Shell "" But I think I have to reference the program which will open the page...

How to use Javascript to read local text file and read line by line?

I have a web page made by html+javascript which is demo, I want to know how to read a local csv file and read line by line so that I can extract data from the csv file...

How to launch multiple Internet Explorer windows/tabs from batch file?

I would like a batch file to launch two separate programs then have the command line window close. Actually, to clarify, I am launching Internet Explorer with two different URLs. So far I have someth..

Uncaught SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>)

I need some help with this error : Uncaught SyntaxError: Unexpected end of JSON input at JSON.parse () at Object.success (dashboard.js:22) at fire (jquery-3.3.1.js:3268) at..

How to compare two Carbon Timestamps?

I have two timestamps, edited_at which I created and created_at (Laravel's)... In database, both have type timestamp and default value 0000-00-00 00:00:00... But var_dump(edited_at variable) is giv..

Difference between and logger.debug

What is the difference between logger.debug and ? When will logger.debug be printed?..

Access denied for root user in MySQL command-line

I've just installed xampp, and am using command line to write mySQL. I am using 'root' with no password and can connect to mysql but cannot CREATE DATABASE as I get the error 1044 access denied for us..

How to use session in JSP pages to get information?

I have a JSP page used for editing some user's info. When a user logins to the website, I keep the information in the session, then in my edit page I try the following: <%! String username=session..