Questions Tagged with #Google talk

is an XMPP based web chat service provided by Google and the name of its official client.

How to convert an integer to a string in any base?

Python allows easy creation of an integer from a string of a given base via int(str, base). I want to perform the inverse: creation of a string from an integer, i.e. I want some function int2bas..

JQuery: How to get selected radio button value?

How do I default the value of a non-selected radio button to 0? I have the following HTML: <input type="radio" name="myradiobutton" value="1" />1 <input type="radio" name="myradiobutton" va..

How can I add new keys to a dictionary?

Is it possible to add a key to a Python dictionary after it has been created? It doesn't seem to have an .add() method...

How do I set <table> border width with CSS?

Why does this work? <table border=1> And this doesn't? <table style="border-width:1px;border-color:black"> I get the same result in Chrome and in IE9...

How to choose an AES encryption mode (CBC ECB CTR OCB CFB)?

Which of them are preferred in which circumstances? I'd like to see the list of evaluation crtieria for the various modes, and maybe a discussion of the applicability of each criterion. For exampl..

Difference between Relative path and absolute path in javascript

Have small clarifications, As of my knowledge these are the relative and absolute paths, Completely relative: <img src="kitten.png"/> Absolute in all respects: <img src="http://www.foo.c..

Validate phone number with JavaScript

I found this code in some website, and it works perfectly. It validates that the phone number is in one of these formats: (123) 456-7890 or 123-456-7890 The problem is that my client (I don't know ..

Accessing elements by type in javascript

A while ago I was making some test in Javascript, and played with a code to get the text of all elements with a certain class, Now I was trying to make something like this but obtain all elements by..

Simplest two-way encryption using PHP

What is the simplest way of doing two way encryption in common PHP installs? I need to be able to encrypt data with a string key, and use the same key to decrypt on the other end. The security isn't..

Add leading zeroes to number in Java?

Is there a better way of getting this result? This function fails if num has more digits than digits, and I feel like it should be in the library somewhere (like Integer.toString(x,"%3d") or something..

How can I convert NSDictionary to NSData and vice versa?

I am sending NSString and UIImage using bluetooth. I decided to store both in a NSDictionary and then convert the dictionary to NSData. My question is how to convert NSDictionary to NSData and visa v..

Deleting an object in C++

Here is a sample code that I have: void test() { Object1 *obj = new Object1(); . . . delete obj; } I run it in Visual Studio, and it crashes at the line with 'delete obj;'. Isn't thi..

Show current assembly instruction in GDB

I'm doing some assembly-level debugging in GDB. Is there a way to get GDB to show me the current assembly instruction in the same way that it shows the current source line? The default output after ev..

How to change xampp localhost to another folder ( outside xampp folder)?

How can I change my default xampp localhost c:xampp/htdoc to another folder i.e. c:/alan? When I use the IP address I should be able to view my website file in C:/alan. Thanks for helping me...

Using SQL LOADER in Oracle to import CSV file

I'm pretty new to databases and programming. I'm not very good with the computer lingo so stick with me. I have a csv file that I'm trying to load into my Oracle database. It contains account informat..

CodeIgniter - return only one row?

At the moment if I am doing a query on the database that should only return one row, using: ...query stuff... $query = $this->db->get(); $ret = $query->result(); return $ret[0]->campaign_..

Convert SQL Server result set into string

I am getting the result in SQL Server as SELECT StudentId FROM Student WHERE condition = xyz I am getting the output like StudentId 1236 7656 8990 ........ The output parameter of the stored..

Postgresql Select rows where column = array

This is a summary of what I am trying to do: $array[0] = 1; $array[1] = 2; $sql = "SELECT * FROM table WHERE some_id = $array" Obviously, there are some syntax issues, but this is what I want to d..

iPhone viewWillAppear not firing

I've read numerous posts about people having problems with viewWillAppear when you do not create your view hierarchy just right. My problem is I can't figure out what that means. If I create a RootVi..

"Undefined reference to" template class constructor

I have no idea why this is happenning, since I think I have everything properly declared and defined. I have the following program, designed with templates. It's a simple implementation of a queue, w..

How do you check if a variable is an array in JavaScript?

I would like to check whether a variable is either an array or a single value in JavaScript. I have found a possible solution... if (variable.constructor == Array)... Is this the best way this can..

Javascript : calling function from another file

I'm just new comer at Javascript so when I read a Javascript document, and there're many complex structures that I cannot follow. Here is the short explanation of Javascript code that I'm reading : i..

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

Conda command is not recognized on Windows 10

I installed Anaconda 4.4.0 (Python 3.6 version) on Windows 10 by following the instructions here: https://www.continuum.io/downloads. However, when I open the Command prompt window and try to write ..

Delete specific values from column with where condition?

I want to delete specific values/data from one column with the WHERE condition. Putting in another way, I don't want to delete the complete row. Is it possible?..

Remove all files in a directory

Trying to remove all of the files in a certain directory gives me the follwing error: OSError: [Errno 2] No such file or directory: '/home/me/test/*' The code I'm running is: import os test = "..

Optional Parameters in Web Api Attribute Routing

I want to handle POST of the following API-Call: /v1/location/deviceid/appid Additional Parameter are coming from the Post-Body. This all works fine for me. Now I wnat to extend my code by allowing..

How to use string.replace() in python 3.x

The string.replace() is deprecated on python 3.x. What is the new way of doing this?..

How to handle AssertionError in Python and find out which line or statement it occurred on?

I want to handle AssertionErrors both to hide unnecessary parts of the stack trace from the user and to print a message as to why the error occurred and what the user should do about it. Is there any..

What is a mixin, and why are they useful?

In "Programming Python", Mark Lutz mentions "mixins". I'm from a C/C++/C# background and I have not heard the term before. What is a mixin? Reading between the lines of this example (which I've link..

MySQL OPTIMIZE all tables?

MySQL has an OPTIMIZE TABLE command which can be used to reclaim unused space in a MySQL install. Is there a way (built-in command or common stored procedure) to run this optimization for every table..

How do I revert my changes to a git submodule?

I have a git submodule (RestKit) which I have added to my repo. I accidentally changed some files in there and I'd like to go back to the source version. In order to do that, I tried to run Mac:app..

How to open the Google Play Store directly from my Android application?

I have open the Google Play store using the following code Intent i = new Intent(android.content.Intent.ACTION_VIEW); i.setData(Uri.parse("https://play.google.com/store/apps/details?id=my packagenam..

How do you set up use HttpOnly cookies in PHP

How can I set the cookies in my PHP apps as HttpOnly cookies?..

Calling another different view from the controller using ASP.NET MVC 4

I have a view (Index.cshtml) with a submit button. When the submit button is clicked, it calls an action (Action01) within the controller (TestController.cs) so at the end of the action I want to retu..

change the date format in laravel view page

I want to change the date format which is fetched from database. now I got 2016-10-01{{$user->from_date}} .I want to change the format 'd-m-y' in laravel 5.3 {{ $user->from_date->format('d/..

PHP: How do I display the contents of a textfile on my page?

I have a .txt file on my web server (locally) and wish to display the contents within a page (stored on the same server) via PHP echo. The .txt file contains a number that is updated by another scrip..

How to implement OnFragmentInteractionListener

I have a wizard generated app with navigation drawer in android studio 0.8.2 I have created a fragment and added it with newInstance() and I get this error: com.domain.myapp E/AndroidRuntime? FAT..

How do I decode a base64 encoded string?

I am trying to "decode" this following Base64 string: OBFZDTcPCxlCKhdXCQ0kMQhKPh9uIgYIAQxALBtZAwUeOzcdcUEeW0dMO1kbPElWCV1ISFFKZ0kdWFlLAURPZhEFQVseXVtPOUUICVhMAzcfZ14AVEdIVVgfAUIBWVpOUlAeaUVMXFlKIy..

How to set menu to Toolbar in Android

I want use ToolBar instead of ActionBar, but don't show me menu in toolbar!!! i want set menu such as Refresh or Setting buttons in ActionBar. Toolbar.xml code : <?xml version="1.0" encoding="u..

How to upload a file from Windows machine to Linux machine using command lines via PuTTy?

I'm running Windows on my laptop at the moment and I want to upload files from my laptop to my uni's general purpose server, which runs both Linux and MacOSX. So, I already opened up a connection to ..

Can we have multiple <tbody> in same <table>?

Can we have multiple <tbody> tags in same <table>? If yes then in what scenarios should we use multiple <tbody> tags?..

Log to the base 2 in python

How should I compute log to the base two in python. Eg. I have this equation where I am using log base 2 import math e = -(t/T)* math.log((t/T)[, 2]) ..

Getting "error": "unsupported_grant_type" when trying to get a JWT by calling an OWIN OAuth secured Web Api via Postman

I have followed this article to implement an OAuth Authorization server. However when I use post man to get a token, I get an error in the response: "error": "unsupported_grant_type" I read some..

Managing jQuery plugin dependency in webpack

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

Populating VBA dynamic arrays

The following code gives me error 9 "subscript out of range". I meant to declare a dynamic array so that the dimension changes as I add elements to it. Do I have to create a "spot" on the array before..

Count all values in a matrix greater than a value

I have to count all the values in a matrix (2-d array) that are greater than 200. The code I wrote down for this is: za=0 p31 = numpy.asarray(o31) for i in range(o31.size[0]): for j in ..

How to debug JavaScript / jQuery event bindings with Firebug or similar tools?

I need to debug a web application that uses jQuery to do some fairly complex and messy DOM manipulation. At one point, some of the events that were bound to particular elements, are not fired and simp..

How to host a Node.Js application in shared hosting

How to host a Node.Js application in a shared hosting I want to host a node.js application in shared hosting. Does anyone have any reference or documentation to refer to?..

How to convert date in to yyyy-MM-dd Format?

Sat Dec 01 00:00:00 GMT 2012 I have to convert above date into below format 2012-12-01 How can i? i have tried with following method but its not working public Date ConvertDate(Date date..

No signing certificate "iOS Distribution" found

I am trying to sign an app with my client's certificates. I have received the following file from the client I tried installing the ios_distribution certificate and the key (.p12). Also I have inst..

MYSQL into outfile "access denied" - but my user has "ALL" access.. and the folder is CHMOD 777

Any ideas? SELECT * INTO OUTFILE '/home/myacnt/docs/mysqlCSVtest.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '*' LINES TERMINATED BY '\n' FROM tbl_property WHERE managerGroupID = {$manager..

How do I make a placeholder for a 'select' box?

I'm using placeholders for text inputs which is working out just fine. But I'd like to use a placeholder for my selectboxes as well. Of course I can just use this code: <select> <option ..

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

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

display Java.util.Date in a specific format

I have the following scenario : SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); System.out.println(dateFormat.parse("31/05/2011")); gives an output Tue May 31 00:00:00 SGT 2011 ..

Easiest way to flip a boolean value?

I just want to flip a boolean based on what it already is. If it's true - make it false. If it's false - make it true. Here is my code excerpt: switch(wParam) { case VK_F11: if (flipVal == true) ..

MongoDB: How to find the exact version of installed MongoDB

I have mongoDB 3.2 installed locally for Windows 7. I would like to find out its specific version (like is it 3.2.1, or 3.2.3 or...). How could I find it? If I open the database shell (mongo.exe), I c..

How to convert comma separated string into numeric array in javascript

I have a one-dimensional array of integer in JavaScript that I'd like to add data from comma separated string, Is there a simple way to do this? e.g : var strVale = "130,235,342,124 ";..

How to assign more memory to docker container

As the title reads, I'm trying to assign more memory to my container. I'm using an image from docker hub called "aallam/tomcat-mysql" in case that's relevant. When I start it normally without any spe..

Created Button Click Event c#

I have made a button using Button buttonOk = new Button(); along with other code, how can I detect if the created button has been clicked? And make it that if clicked the Form will close?..

The filename, directory name, or volume label syntax is incorrect inside batch

When I am running the following inside batch.... set PATH='C:\Users\DEB\Downloads\10.1.1.0.4' cd !PATH! I get error "The filename, directory name, or volume label syntax is incorrect" Update: The..

How can I execute PHP code from the command line?

I would like to execute a single PHP statement like if(function_exists("my_func")) echo 'function exists'; directly with the command line without having to use a separate PHP file. How is it..

SQL SELECT from multiple tables

How can I get all products from customers1 and customers2 include their customer names? customer1 table cid name1 1 john 2 joe customer2 table cid name2 p1 sandy p2 linda product table pid ci..

How to round each item in a list of floats to 2 decimal places?

I have a list which consists of float values but they're too detailed to proceed. I know we can shorten them by using the ("%.f" % variable) operator, like: result = [359.70000000000005] result = "%...

How to know which is running in Jupyter notebook?

I use Jupyter notebook in a browser for Python programming, I have installed Anaconda (Python 3.5). But I'm quite sure that Jupyter in running my python commands with the native python interpreter and..

Background color not showing in print preview

I am trying to print a page. In that page I have given a table a background color. When I view the print preview in chrome its not taking on the background color property... So I tried this property:..

How to run different python versions in cmd

How can I configure windows command dialog to run different python versions in it? For example when I type python2 it runs python 2.7 and when I type python3 it runs python 3.3? I know how to configur..

How do you uninstall a python package that was installed using distutils?

Can you simply delete the directory from your python installation, or are there any lingering files that you must delete?..

Get int value from enum in C#

I have a class called Questions (plural). In this class there is an enum called Question (singular) which looks like this. public enum Question { Role = 2, ProjectFunding = 3, TotalEmploy..

How do I delete multiple rows in Entity Framework (without foreach)

I'm deleting several items from a table using Entity Framework. There isn't a foreign key / parent object so I can't handle this with OnDeleteCascade. Right now I'm doing this: var widgets = context..

How to make a UILabel clickable?

I would like to make a UILabel clickable. I have tried this, but it doesn't work: class DetailViewController: UIViewController { @IBOutlet weak var tripDetails: UILabel! override func view..

MySQL selecting yesterday's date

How can I display and count the values whose dates are yesterday? I used time() to insert date in the database. Example: URL: google.com youtube.com google.com youtube.com test.com youtube.com DateVi..

Counting unique values in a column in pandas dataframe like in Qlik?

If I have a table like this: df = pd.DataFrame({ 'hID': [101, 102, 103, 101, 102, 104, 105, 101], 'dID': [10, 11, 12, 10, 11, 10, 12, 10], 'uID': ['James', 'Henry', 'Abe'..

Show/hide div if checkbox selected

I need a page with checkboxes and visible div if at minimum 1 is checked. Here I got page that if i check checkbox, the div will show. It's okay and works correctly. When I check 3 checkboxes and ..

How should I read a file line-by-line in Python?

In pre-historic times (Python 1.4) we did: fp = open('filename.txt') while 1: line = fp.readline() if not line: break print line after Python 2.1, we did: for line in open('fil..

Shrink a YouTube video to responsive width

I have a YouTube video embedded on our website and when I shrink the screen to tablet or phone sizes it stops shrinking at around 560px in width. Is this standard for YouTube videos or is there someth..

Add objects to an array of objects in Powershell

I have this script where I want to add an object to an array called $Target in every foreach. foreach ($Machine in $Machines) { $TargetProperties = @{Name=$Machine} $TargetObject = New-Object P..

How do I declare a global variable in VBA?

I wrote the following code: Function find_results_idle() Public iRaw As Integer Public iColumn As Integer iRaw = 1 iColumn = 1 And I get the error message: "invalid attribute i..

DLL References in Visual C++

I have had C++ experience but not MSVC. What I am trying to do is incorporate a .dll from an open source project into my project. The code is available and I have built it. I have the .dll as well as..

Why is "cursor:pointer" effect in CSS not working

HTML: <div id="firstdiv"> <div id="intro"> <h1 id="name">YOU CHIA LAI</h1> <ul> <li class="about"..

Use of Greater Than Symbol in XML

I had created the xml document with xml version="1.0". In that document I need to use the greater than symbol > and less than symbol <. How should I include those symbols? It's not working. &..

What's the difference between "static" and "static inline" function?

IMO both make the function to have a scope of the translation unit only. What's the difference between "static" and "static inline" function? Why should inline be put in a header file, not in .c fil..

CSS Styling for a Button: Using <input type="button> instead of <button>

I'm trying to style a button using <input type="button"> instead of just <button>. With the code I have, the button extends all the way across the screen. I just want to be able to fit it ..

Postgresql - select something where date = "01/01/11"

I have a datetime field in my Postgresql, named "dt". I'd like to do something like SELECT * FROM myTable WHERE extract (date from dt) = '01/01/11' What is the right syntax to do that? Thanks!..

When do you use map vs flatMap in RxJava?

When do you use map vs flatMap in RxJava? Say, for example, we want to map Files containing JSON into Strings that contain the JSON-- Using map, we have to deal with the Exception somehow. But how?:..

Error handling with try and catch in Laravel

I want to implement a good error handling in my app, I have forced this file for catching the error. App\Services\PayUService try { $this->buildXMLHeader; // Should be $this->buildXMLHeader(..

Differences between action and actionListener

What is the difference between action and actionListener, and when should I use action versus actionListener?..

Fastest way to check if a string matches a regexp in ruby?

What is the fastest way to check if a string matches a regular expression in Ruby? My problem is that I have to "egrep" through a huge list of strings to find which are the ones that match a regexp t..

Error: invalid operands of types ‘const char [35]’ and ‘const char [2]’ to binary ‘operator+’

At the top of my file I have #define AGE "42" Later in the file I use ID multiple times including some lines that look like 1 std::string name = "Obama"; 2 std::string str = "Hello " + name + " yo..

Get and Set a Single Cookie with Node.js HTTP Server

I want to be able to set a single cookie, and read that single cookie with each request made to the nodejs server instance. Can it be done in a few lines of code, without the need to pull in a third p..

How to unzip a list of tuples into individual lists?

Possible Duplicate: A Transpose/Unzip Function in Python I have a list of tuples, where I want to unzip this list into two independent lists. I'm looking for some standardized operation in ..

Streaming Audio from A URL in Android using MediaPlayer?

I've been trying to stream mp3's over http using Android's built in MediaPlayer class. The documentation would suggest to me that this should be as easy as : MediaPlayer mp = new MediaPlayer(); mp.se..

How to count the number of files in a directory using Python

I need to count the number of files in a directory using Python. I guess the easiest way is len(glob.glob('*')), but that also counts the directory itself as a file. Is there any way to count only t..

How-to turn off all SSL checks for postman for a specific site

Please read this carefully. Please do not send me a link on how to import a certificate. I I am using Postman for QA and testing work. I have a test system I frequently rebuild myself and so it is co..

Extreme wait-time when taking a SQL Server database offline

I'm trying to perform some offline maintenance (dev database restore from live backup) on my dev database, but the 'Take Offline' command via SQL Server Management Studio is performing extremely slowl..

Printing with "\t" (tabs) does not result in aligned columns

I have a very weird problem. After writing this: for (File f : currentFile.listFiles()) { if (f.isDirectory()){ System.out.println(f.getName()+"\t"+"Dir\t"+Command.getpremiss..

jQuery: Get height of hidden element in jQuery

I need to get height of an element that is within a div that is hidden. Right now I show the div, get the height, and hide the parent div. This seems a bit silly. Is there a better way? I'm using jQu..

Removing double quotes from variables in batch file creates problems with CMD environment

Can anybody help with effective and safe way of removing quotes from batch variables? I have written a batch file which successfully imports a list of parameters %1, %2, %3 etc. and places them into n..

Parsing JSON in Java without knowing JSON format

I am trying to parse JSON strings in Java and find the key-value pairs so that I can determine the approximate structure of the JSON object since object structure of JSON string is unknown. For examp..

How to get a variable value if variable name is stored as string?

How can I retrieve a bash variable value if I have the variable name as string? var1="this is the real value" a="var1" Do something to get value of var1 just using variable a. Con..

How to switch from the default ConstraintLayout to RelativeLayout in Android Studio

I have the latest android Studio (2.3 beta 3) and it seems ConstraintLayout is the default when creating a project. How can I make Android Studio use the RelativeLayout as the default layout element f..

Execute a SQL Stored Procedure and process the results

In VB.NET, how do I do the following? Execute a Stored Procedure Read through the DataTable returned ..

How do you clone a Git repository into a specific folder?

Executing the command git clone [email protected]:whatever creates a directory in my current folder named whatever, and drops the contents of the Git repository into that folder: /httpdocs/whatever/publ..

Angular HttpPromise: difference between `success`/`error` methods and `then`'s arguments

According to AngularJS doc, calls to $http return the following: Returns a promise object with the standard then method and two http specific methods: success and error. The then method takes two ..

Facebook API - How do I get a Facebook user's profile image through the Facebook API (without requiring the user to "Allow" the application)

I'm working on a CMS that fetches a user's profile image from their Facebook URL (that is, http://facebook.com/users_unique_url). How can I accomplish this? Is there a Faceboook API call that fetches ..

How can I make a div not larger than its contents?

I have a layout similar to: <div> <table> </table> </div> I would like for the div to only expand to as wide as my table becomes...

cc1plus: error: unrecognized command line option "-std=c++11" with g++

I'm trying to compile using g++ and either the -std=c++11 or c++0x flags. However, I get this error cc1plus: error: unrecognized command line option "-std=c++11" g++ --version g++ (GCC) 4.1.2 20..

Building a complete online payment gateway like Paypal

So this question isn't about integrating an existing payment gateway into my site. This is more of a architectural question. I want to build a system similar to Paypal. Now I understand that Paypal o..

How can I convert string date to NSDate?

I want to convert "2014-07-15 06:55:14.198000+00:00" this string date to NSDate in Swift...

heroku - how to see all the logs

I have a small app on heroku. Whenever I want to see the logs I go to the command line and do heroku logs That only shows me about 100 lines. Is there not a way to see complete logs for our appl..

Git undo changes in some files

While coding I added print statements into some files to keep track of what was going on. When I am done, is it possible to revert changes in some files, but commit the file I actually worked on? S..

Passing headers with axios POST request

I have written an axios POST request as recommended from the npm package documentation like: var data = { 'key1': 'val1', 'key2': 'val2' } axios.post(Helper.getUserAPI(), data) .then((..

What version of Java is running in Eclipse?

How do I know what version of Java is being run in Eclipse? Is there a way to write code to find out? Is "JRE System Library [JavaSE-1.6]" in "Package Explorer" the right version?..

AWS CLI S3 A client error (403) occurred when calling the HeadObject operation: Forbidden

I'm trying to setup a Amazon Linux AMI(ami-f0091d91) and have a script that runs a copy command to copy from a S3 bucket. aws --debug s3 cp s3://aws-codedeploy-us-west-2/latest/codedeploy-agent.noar..

Linux Script to check if process is running and act on the result

I have a process that fails regularly & sometimes starts duplicate instances.. When I run: ps x |grep -v grep |grep -c "processname" I will get: 2 This is normal as the process runs with a recove..

Which loop is faster, while or for?

You can get the same output with for and while loops: While: $i = 0; while ($i <= 10){ print $i."\n"; $i++; }; For: for ($i = 0; $i <= 10; $i++){ print $i."\n"; } But which one is f..

Stop Visual Studio from launching a new browser window when starting debug?

I already have a window open with the web site I'm debugging. I don't need VS to launch another one for me every time I need to debug. Is there a way to stop this behavior?..

Python extract pattern matches

Python 2.7.1 I am trying to use python regular expression to extract words inside of a pattern I have some string that looks like this someline abc someother line name my_user_name is valid some mor..

How do I remove lines between ListViews on Android?

I'm using two ListViews like this: <ListView android:id="@+id/ListView" android:text="@string/Website" android:layout_height="30px" android:layout_width="150px" android:scrollbars="..

Strip Leading and Trailing Spaces From Java String

Is there a convenience method to strip any leading or trailing spaces from a Java String? Something like: String myString = " keep this "; String stripppedString = myString.strip(); System.out.pri..

What does "while True" mean in Python?

def play_game(word_list): hand = deal_hand(HAND_SIZE) # random init while True: cmd = raw_input('Enter n to deal a new hand, r to replay the last hand, or e to end game: ') if ..

Javascript dynamic array of strings

Is there a way to create a dynamic array of strings on Javascript? What I mean is, on a page the user can enter one number or thirty numbers, then he/she presses the OK button and the next page shows ..

pandas create new column based on values from other columns / apply a function of multiple columns, row-wise

I want to apply my custom function (it uses an if-else ladder) to these six columns (ERI_Hispanic, ERI_AmerInd_AKNatv, ERI_Asian, ERI_Black_Afr.Amer, ERI_HI_PacIsl, ERI_White) in each row of my datafr..

Include another JSP file

I am currently trying to learn JSP. My question is, at present I used to include the header and footer of the page using: <%@include file="includes/header.jsp" %> and <%@include file="in..

How do I specify "close existing connections" in sql script

I'm doing active development on my schema in SQL Server 2008 and frequently want to rerun my drop/create database script. When I run USE [master] GO IF EXISTS (SELECT name FROM sys.databases WHERE..

Import existing Gradle Git project into Eclipse

I've installed eclipse gradle plugin from here http://kaczanowscy.pl/tomek/2010-03/gradle-ide-integration-eclipse-plugin Is there a simple way to import into eclipse gradle project using gui, not d..

AngularJS : Factory and Service?

EDIT Jan 2016: Since this still gets attention. Since asking this I've completed a few AngularJS projects, and for those I mostly used factory, built up an object and returned the object at the end. M..

What is the error "Every derived table must have its own alias" in MySQL?

I am running this query on MySQL SELECT ID FROM ( SELECT ID, msisdn FROM ( SELECT * FROM TT2 ) ); and it is giving this error: Every derived table must have its own alias. ..

What does on_delete do on Django models?

I'm quite familiar with Django, but I recently noticed there exists an on_delete=models.CASCADE option with the models. I have searched for the documentation for the same, but I couldn't find anything..

Prevent cell numbers from incrementing in a formula in Excel

I have a formula in Excel that needs to be run on several rows of a column based on the numbers in that row divided by one constant. When I copy that formula and apply it to every cell in the range, a..

batch file Copy files with certain extensions from multiple directories into one directory

I'm a newbie, so bear with me... I am trying to copy all .doc files that I have scattered throughout several subdirectories of one main directory into another directory using a batch file. I have ma..

How to draw a rectangle around a region of interest in python

I'm having trouble with import cv in my python code. My issue is I need to draw a rectangle around regions of interest in an image. How can this be done in python? I'm doing object detection and woul..

Bubble Sort Homework

In class we are doing sorting algorithms and, although I understand them fine when talking about them and writing pseudocode, I am having problems writing actual code for them. This is my attempt in ..

How to add background-image using ngStyle (angular2)?

How to use ngStyle to add background-image? My code doesn't work: this.photo = 'http://dl27.fotosklad.org.ua/20121020/6d0d7b1596285466e8bb06114a88c903.jpg'; <div [ngStyle]="{'background-image': u..

How to find all positions of the maximum value in a list?

I have a list: a = [32, 37, 28, 30, 37, 25, 27, 24, 35, 55, 23, 31, 55, 21, 40, 18, 50, 35, 41, 49, 37, 19, 40, 41, 31] max element is 55 (two elements on position 9 and 12) I need to..

PHP, getting variable from another php-file

So I wonder if it is possible to get a variable from a specific php-file when the variable-name is used in multiple php-file. An example is this: <header> <title> <?php echo $var1; ..

Write values in app.config file

can anyone please help me how can I set/store values in the app.config file using c#, is it possible at all?..

Passing an array as a function parameter in JavaScript

I'd like to call a function using an array as parameters: const x = ['p0', 'p1', 'p2']; call_me(x[0], x[1], x[2]); // I don't like it function call_me (param0, param1, param2 ) { // ... } Is the..

How to call python script on excel vba?

trying to call a python script on Vba and I am a newb. I tried converting the main script to an exe using py2exe and then calling it from VBA (shell) but the main script calls other scripts therefore ..

how to create a login page when username and password is equal in html

How do I create a login page that goes to the next screen if the password is correct? <html> <p> Enter Username and Password </p> <FORM action="file:///android_asset/www/Browse.h..

create unique id with javascript

I have a form where a user can add multiple select boxes for multiple cities. The problem is that each newly generated select box needs to have a unique id. Can this be done is JavaScript? UPDATE: he..

Why do you have to link the math library in C?

If I include <stdlib.h> or <stdio.h> in a C program I don't have to link these when compiling but I do have to link to <math.h>, using -lm with gcc, for example: gcc test.c -o test ..

java.lang.UnsatisfiedLinkError no *****.dll in java.library.path

How can I load a custom dll file in my web application? I've tried the following: Copied all required dlls in system32 folder and tried to load one of them in Servlet constructor System.loadLibrary C..

Android How to adjust layout in Full Screen Mode when softkeyboard is visible

I have researched a lot to adjust the layout when softkeyboard is active and I have successfully implemented it but the problem comes when I use android:theme="@android:style/Theme.NoTitleBar.Fullscre..

When to use %r instead of %s in Python?

On Learn Python the Hard Way page 21, I see this code example: x = "There are %d types of people." % 10 ... print "I said: %r." % x Why is %r used here instead of %s? When would you use %r, and wh..

CSS Grid Layout not working in IE11 even with prefixes

I'm using following HTML markup for my grid. <section class="grid"> <article class="grid-item width-2x height-2x">....</article> <article class="grid-item">....</ar..

Why not use Double or Float to represent currency?

I've always been told never to represent money with double or float types, and this time I pose the question to you: why? I'm sure there is a very good reason, I simply do not know what it is...

How to create <input type=“text”/> dynamically

I want to create an input type text in my web form dynamically. More specifically, I have a textfield where the user enters the number of desired text fields; I want the text fields to be generated dy..

Find ALL tweets from a user (not just the first 3,200)

With https://dev.twitter.com/docs/api/1/get/statuses/user_timeline I can get 3,200 most recent tweets. However, certain sites like http://www.mytweet16.com/ seems to bypass the limit, and my browse th..

Does .NET provide an easy way convert bytes to KB, MB, GB, etc.?

Just wondering if .NET provides a clean way to do this: int64 x = 1000000; string y = null; if (x / 1024 == 0) { y = x + " bytes"; } else if (x / (1024 * 1024) == 0) { y = string.Format("{0:n..

svn: E155004: ..(path of resource).. is already locked

I'm getting an error when trying to commit a change to a repository. I'm sure that my resources (classes) are not locked but it still gives me the error: Some resources were not updated. svn: E1550..

Count distinct values

I have a data set asking a customer how many pets they have for example. Is there a way with one query I can count the distinct values (1,2,3, etc)? Thanks! +----------+------+ | Customer | Pets | +-..

Loop through an array php

I have this array... how do you print each of the filepath and filename? What is the best way to do this? Array ( [0] => Array ( [fid] => 14 [list] => 1 ..

What is the largest TCP/IP network port number allowable for IPv4?

What is the highest port number one can use?..

How do I create a MongoDB dump of my database?

What command do I use and run?..

How to continue the code on the next line in VBA

I would like to type the mathematical forumla in VBA code which many lines. I would like to split it into many lines. How do I do it? For example: U_matrix(i, j, n + 1) = k * b_xyt(xi, yi, tn) / (4 ..

How to generate .NET 4.0 classes from xsd?

What are the options to generate .NET 4.0 c# classes (entities) from an xsd file, using Visual Studio 2010?..

C++ - unable to start correctly (0xc0150002)

I'm trying to run an OpenCV application through Microsoft Visual C++ 2010 Express, and get the following message: How can I solve this issue?..

What is the difference between cache and persist?

In terms of RDD persistence, what are the differences between cache() and persist() in spark ? ..

Can two Java methods have same name with different return types?

Can two Java methods have the same name with different return type? The return type of the methods are different and they are declared with the same method's name. Is that allowed?..

Correct owner/group/permissions for Apache 2 site files/folders under Mac OS X?

It's hard to find Mac-specific answers to this question on the web, so I'm hoping someone out there can put this one to rest for me? My permissions are screwed up on my sites and I'm not sure how to f..

How to make custom error pages work in ASP.NET MVC 4

I want a custom error page shown for 500, 404 and 403. Here's what I have done: Enabled custom errors in the web.config as follows: <customErrors mode="On" defaultRedirect="~/View..

select records from postgres where timestamp is in certain range

I have arrival column of type timestamp in table reservations ( I'm using postgres ). How would I select all dates within this year for example? I know I could do something like this: select * FROM ..

Check whether a table contains rows or not sql server 2005

How to Check whether a table contains rows or not sql server 2005?..

How to generate random colors in matplotlib?

What's the trivial example of how to generate random colors for passing to plotting functions? I'm calling scatter inside a loop and want each plot a different color. for X,Y in data: scatter(X, ..

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

How to switch to the new browser window, which opens after click on the button?

I have situation, when click on button opens the new browser window with search results. Is there any way to connect and focus to new opened browser window? And work with it, then return back to or..

What is a faster alternative to Python's http.server (or SimpleHTTPServer)?

Python's http.server (or SimpleHTTPServer for Python 2) is a great way of serve the contents of the current directory from the command line: python -m http.server However, as far as web servers go, i..

Raise an error manually in T-SQL to jump to BEGIN CATCH block

Is it possible to raise an error in a stored procedure manually to stop execution and jump to BEGIN CATCH block? Some analog of throw new Exception() in C#. Here is my stored procedure's body: BEGIN..

How to create named and latest tag in Docker?

Supposed I have an image that I want to tag as 0.10.24 (in my case it's an image containing Node.js 0.10.24). I built that image using a Dockerfile and executing docker build and by providing a tag us..

Programmatically go back to previous ViewController in Swift

I send the user over to a page on a button click. This page is a UITableViewController. Now if the user taps on a cell, I would like to push him back to the previous page. I thought about something..

What’s the best way to reload / refresh an iframe?

I would like to reload an <iframe> using JavaScript. The best way I found until now was set the iframe’s src attribute to itself, but this isn’t very clean. Any ideas?..

Sticky Header after scrolling down

I saw this sticky header on this website: http://dunked.com/ (no longer active, view archived site) When you scroll down the sticky header comes down from the top. I looked at the code, but it looks..

ReactJS: Maximum update depth exceeded error

I am trying to toggle the state of a component in ReactJS but I get an error stating: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWill..

what is the difference between XSD and WSDL

What is the difference between an XML Schema and WSDL? The difference I noticed is that WSDL contains XSD and in WSDL we can declare operations, but not in XSD. Is that correct?..

How can I fetch all items from a DynamoDB table without specifying the primary key?

I have a table called products with primary key Id. I want to select all items in the table. This is the code is I'm using: $batch_get_response = $dynamodb->batch_get_item(array( 'RequestItems..

Convert a file path to Uri in Android

I have an app where I capture a video using the camera. I can get the video's file path, but I need it as a Uri. The file path I'm getting: /storage/emulated/0/DCIM/Camera/20141219_133139.mp4 What..

What causes the error "_pickle.UnpicklingError: invalid load key, ' '."?

I'm trying to storage 5000 data elements on an array. This 5000 elements are storage on an existent file (therefore it's not empty). But I'm getting an error and I don't know what is causing it. I..

Any free WPF themes?

I'm not a designer, so I'm looking for some free WPF themes. Any suggestions?..

How do I select the "last child" with a specific class name in CSS?

<ul> <li class="list">test1</li> <li class="list">test2</li> <li class="list">test3</li> <li>test4</li> </ul> How do I sel..

What is Persistence Context?

I am new to the Java world and JPA. I was studying JPA and came across many new terms like Entity, persistence. While reading, I could not understand the exact definition for Persistence Context. Can..

Provide static IP to docker containers via docker-compose

I'm trying to provide static IP address to containers. I understand that I have to create a custom network. I create it and the bridge interface is up on the host machine (Ubuntu 16.x). The containers..

Initializing C dynamic arrays

How do I initialize a dynamic array allocated with malloc? Can I do this: int *p; p = malloc(3 * sizeof(*p)); p = {0, 1, 2}; ... free(p); Or do I need to do something like this: int *p, x; p = m..

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

jQuery or CSS selector to select all IDs that start with some string

How can I select all elements whose id starts with "player_"? I have multiple elements like this: <div id="player_290x3dfda">text</div> Every id has a unique stamp on it. How can I sel..

Combine [NgStyle] With Condition (if..else)

I have read NgStyle Documentation For Angular 2, and it is a little bit confusing for me. How do I use NgStyle with condition like (if...else) to set background image of any element? ..

Bootstrap trying to load map file. How to disable it? Do I need to do it?

I'm recently playing with bootsrap3. I compiled it from sources and included distr js and css to my project. The thing is, I see in GH dev tools, that it's trying to get .map.css file. Why does it wan..

I need to know how to get my program to output the word i typed in and also the new rearranged word using a 2D array

I have a working program which takes the first letter of a word then switches it to the back of the word and adds "ay to the end. It works fine but I am trying to store the original word and the newW..

How can I auto increment the C# assembly version via our CI platform (Hudson)?

Myself and my group are horrendous at incrementing assembly version numbers and we frequently ship assemblies with 1.0.0.0 versions. Obviously, this causes a lot of headaches. We're getting a lot be..

SQLite - getting number of rows in a database

I want to get a number of rows in my table using max(id). When it returns NULL - if there are no rows in the table - I want to return 0. And when there are rows I want to return max(id) + 1. My rows ..

Is there any simple way to convert .xls file to .csv file? (Excel)

Is there any simple way to convert .xls file to .csv file ? (Excel) in C# code ? i mean to take an existing .xls file and convert them to .csv file Thanks in advance..

How to check that an element is in a std::set?

How do you check that an element is in a set? Is there a simpler equivalent of the following code: myset.find(x) != myset.end() ..

How to run Selenium WebDriver test cases in Chrome

I tried this WebDriver driver = new ChromeDriver(); But I'm getting the error as Failed tests: setUp(com.TEST): The path to the driver executable must be set by the webdriver.chrome.driver system ..

PHP salt and hash SHA256 for login password

I've made encrypting of the password in my register script and they are stored in the database, and I have to use them to login, so I would want to use the unencrypted ones to login. I've read some of..

Test if number is odd or even

What is the simplest most basic way to find out if a number/variable is odd or even in PHP? Is it something to do with mod? I've tried a few scripts but.. google isn't delivering at the moment...

What is the difference/usage of homebrew, macports or other package installation tools?

I've just recently switched to a Mac from Ubuntu. I was disappointed that mac doesn't have the convenient sudo apt-get in Ubuntu. I've heard that I should use homebrew but I'm not exactly sure what ho..

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

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

Function to return only alpha-numeric characters from string?

I'm looking for a php function that will take an input string and return a sanitized version of it by stripping away all special characters leaving only alpha-numeric. I need a second function that d..

How do I execute cmd commands through a batch file?

I want to write a batch file that will do following things in given order: Open cmd Run cmd command cd c:\Program files\IIS Express Run cmd command iisexpress /path:"C:\FormsAdmin.Site" /port:8088 /..

How to define custom exception class in Java, the easiest way?

I'm trying to define my own exception class the easiest way, and this is what I'm getting: public class MyException extends Exception {} public class Foo { public bar() throws MyException { th..