Questions Tagged with #Smack

Smack is an XMPP (Jabber) client library written in Java for Android and Java SE. It provides a simple API allowing developers to write clients for XMPP services.

Error:Execution failed for task ':app:compileDebugKotlin'. > Compilation error. See log for more details

Error:Execution failed for task ':app:compileDebugKotlin'. > Compilation error. See log for more details build:gradle(Module:app) buildscript { repositories { maven { url '..

Gradle DSL method not found: 'runProguard'

I get an error after updating from my last project. Not a problem in my code but I'm having trouble with build.gradle. How can I fix it? build.gradle code here: apply plugin: 'android' android { ..

Delayed function calls

Is there a nice simple method of delaying a function call whilst letting the thread continue executing? e.g. public void foo() { // Do stuff! // Delayed call to bar() after x number of ms ..

Default string initialization: NULL or Empty?

I have always initialized my strings to NULL, with the thinking that NULL means the absence of a value and "" or String.Empty is a valid value. I have seen more examples lately of code wher..

Set the value of an input field

How would you set the default value of a form <input> text field in JavaScript?..

Node.js Logging

Is there any library which will help me to handle logging in my Node.Js application? All I want to do is, I want to write all logs into a File and also I need an options like rolling out the file afte..

How do I convert a long to a string in C++?

How do I convert a long to a string in C++?..

Angular/RxJs When should I unsubscribe from `Subscription`

When should I store the Subscription instances and invoke unsubscribe() during the NgOnDestroy life cycle and when can I simply ignore them? Saving all subscriptions introduces a lot of mess into comp..

Remove privileges from MySQL database

Before you think this is a duplicate question, I believe I have a unique, even if it is somewhat dim-witted, case. A few days ago, I upgraded the version of MySQL on my Ubuntu 10.04 server to 5.3.3 (..

RegEx for valid international mobile phone number

I use Clickatell to send SMSes to clients' mobile phones. Is there a standardised regular expression for all valid mobile phone numbers, e.g. +27 123 4567? I'd roll my own, but I'm worried about miss..

Why am I seeing an "origin is not allowed by Access-Control-Allow-Origin" error here?

I am seeing the following error: Origin http://localhost:8080 is not allowed by Access-Control-Allow-Origin with this code: var http = new getXMLHttpRequestObject(); var url = "http://gdata.youtub..

HTML button calling an MVC Controller and Action method

I know this isn't right, but for the sake of illustration I'd like to do something like this: <%= Html.Button("Action", "Controller") %> My goal is to make an HTML button that will call my MV..

Remove last item from array

I have the following array. var arr = [1,0,2]; I would like to remove the last element i.e. 2. I used arr.slice(-1); but it doesn't remove the value...

How to switch between python 2.7 to python 3 from command line?

I'm trying to find the best way to switch between the two python compilers, 2.7 to 3.3. I ran the python script from the cmd like this: python Where do I set the "python" environment in t..

How do I stop a web page from scrolling to the top when a link is clicked that triggers JavaScript?

When I have a link that is wired-up with a jQuery or JavaScript event such as: <a href="#">My Link</a> How do I prevent the page from scrolling to the top? When I remove the href attri..

jQuery textbox change event

Does text input element not have a change event? When I attach a change event handler to a text input it is not being fired. Keyup is fired, but keyup is not sufficient for detecting a change as there..

What does += mean in Python?

I see code like this for example in Python: if cnt > 0 and len(aStr) > 1: while cnt > 0: aStr = aStr[1:]+aStr[0] cnt += 1 What does th..

Batch command to move files to a new directory

I want to write a batch job that when executed will grab all the files in the C:\Test\Log folder and move them to a new directory in the C:\Test. This new directory will have a name called "Backup-" a..

Read a HTML file into a string variable in memory

If I have a HTML file on disk, How can I read it all at once in to a String variable at run time? Then I need to do some processing on that string variable. Some html file like this: <html> ..

Is null reference possible?

Is this piece of code valid (and defined behavior)? int &nullReference = *(int*)0; Both g++ and clang++ compile it without any warning, even when using -Wall, -Wextra, -std=c++98, -pedantic, -W..

How do you underline a text in Android XML?

How do you underline a text in an XML file? I can't find an option in textStyle...

Android Studio cannot resolve R in imported project?

I'm trying the new Android Studio. I've exported a project from eclipse, using the build gradle option. I've then imported it in Android Studio. The file under gen has a j in a little red circl..

Check if a Python list item contains a string inside another string

I have a list: my_list = ['abc-123', 'def-456', 'ghi-789', 'abc-456'] and want to search for items that contain the string 'abc'. How can I do that? if 'abc' in my_list: would check if 'abc' exi..

Increasing nesting function calls limit

There is one very bad limit in PHP: if you call some function a1() that calls a2(), that calls a3... so when a99() will call a100() you will see Fatal error: Maximum function nesting level of '100..

Most efficient T-SQL way to pad a varchar on the left to a certain length?

As compared to say: REPLICATE(@padchar, @len - LEN(@str)) + @str ..

What does the following Oracle error mean: invalid column index

I got the following error while testing some code: SQLException: Invalid column index What exactly does that mean? Is there an online document explaining what all the Oracle error codes and s..

importing pyspark in python shell

This is a copy of someone else's question on another forum that was never answered, so I thought I'd re-ask it here, as I have the same issue. (See

How to use jQuery in AngularJS

I am trying to use simple jQuery UI. I've included everything and I have this simple script: <script> $(function() { $( "#slider" ).slider(); }); </script> and <div id="slid..

how to send a post request with a web browser

how to send a post request with a web browser?..

How to display multiple notifications in android

I am receiving only one notification and if there comes another notification, it replaces the previous one and here is my code private static void generateNotification(Context context, String message..

Changing Placeholder Text Color with Swift

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

Spring Hibernate - Could not obtain transaction-synchronized Session for current thread

I created an application with spring + hibernate, but I always get this error. This is my first application with hibernate, I read some guides but I can not solve this problem. Where am I doing wrong?..

How do I pass a class as a parameter in Java?

Is there any way to pass class as a parameter in Java and fire some methods from that class? void main() { callClass(that.class) } void callClass(???? classObject) { classObject.somefunction..

How to add jQuery to an HTML page?

I was given this chunk of code to place in my html page but I know nothing about javascript so I have no idea where to place it and what kind of tag to place it in. $('input[type=radio]').change(func..

Compare two objects in Java with possible null values

I want to compare two strings for equality when either or both can be null. So, I can't simply call .equals() as it can contain null values. The code I have tried so far : boolean compare(String str1,..

Simplest Way to Test ODBC on WIndows

With unixODBC you can use a simple command line utility called "isql" to test your connection and permissions of some queries. Without having to write extra code or install libs or bloated programs, i..

Edit a text file on the console using Powershell

I'm trying to figure out the easiest way to edit text files in the console (PowerShell in my case). I'm using Windows 7 64 bit. It galls me that I can't just type edit filename.txt to edit a file. T..

Change input text border color without changing its height

Let's say I have a default text input without any CSS <input type="text" /> I want to change its border color to red so I add an style <input type="text" style="border-color:red" /> ..

Simple search MySQL database using php

I currently have a small php script that searches a database based on user input. There is an html file that has one field that is used for entry of search strings into the database. Essentially, you ..

Definitive way to trigger keypress events with jQuery

I've read all the answers on to this questions and none of the solutions seem to work. Also, I am getting the vibe that triggering keypress with special characters does not work at all. Can someone ..

How to connect android emulator to the internet

How can I connect my Android emulator to the internet, e.g. to use the browser? I've found lots of advice on what do to when your connected through a proxy, but that's not the case here, my machine (W..

javascript get child by id

<div onclick="test(this)"> Test <div id="child">child</div> </div> I want to change the style of the child div when the parent div is clicked. How do I reference it?..

"Debug certificate expired" error in Eclipse Android plugins

I am using Eclipse Android plugins to build a project, but I am getting this error in the console window: [2010-02-03 10:31:14 - androidVNC]Error generating final archive: Debug certificate expired o..

dataframe: how to groupBy/count then filter on count in Scala

Spark 1.4.1 I encounter a situation where grouping by a dataframe, then counting and filtering on the 'count' column raises the exception below import sqlContext.implicits._ import org.apache.spark..

How to extract an assembly from the GAC?

There is a package I have to deal with which installs assemblies straight into the GAC (e.g. somewhere deep in %windows%/assembly). How do I exorcise the actual assembly (the DLL) from the GAC into..

How to compare datetime with only date in SQL Server

Select * from [User] U where U.DateCreated = '2014-02-07' but in the database the user was created on 2014-02-07 12:30:47.220 and when I only put '2014-02-07' It does not show any data..

Android: remove notification from notification bar

I have created an application and with an event I manage to add notification in android notification bar. Now I need sample how to remove that notification from notification bar on an event ?? ..

How to make a <div> or <a href="#"> to align center

I'm using the following code in body section. <center><a href="contact.html" class="button large hpbottom">Get Started</a></center> Is there any alternative for <center>..

how do I get the bullet points of a <ul> to center with the text?

When I try to center a <ul> the text in the <li> centers but the bullet points stay on the far left of the page. Is there any way to get the bullet points to stay with the text when it is ..

Kotlin: How to get and set a text to TextView in Android using Kotlin?

I'm newbie. I want to change text of TextView While click on it. My code: val text: TextView = findViewById( as TextView text.setOnClickListener { text.setText(g..

Google Maps V3 marker with label

How can I add label to my marker if my markers are populated on ajax success each result. map.gmap('addMarker', { 'position': new google.maps.LatLng(result.latitude, result.longitude) }); I tried l..

Confusing "duplicate identifier" Typescript error message

Why am I getting this and many more errors of this kind? I am adding a link to the repo as well as key code snippets below. I think I have a basic misunderstanding of how the dependency and "include" ..

Error in data frame undefined columns selected

I've been working on an assignment where I have to read in some csv files from a directory "specdata". The files are very similar in that there are 332 titled 001.csv - 332.csv. They have consistent c..

Using ORDER BY and GROUP BY together

My table looks like this (and I'm using MySQL): m_id | v_id | timestamp ------------------------ 6 | 1 | 1333635317 34 | 1 | 1333635323 34 | 1 | 1333635336 6 | 1 | 1333635343 6 ..

Creating an array from a text file in Bash

A script takes a URL, parses it for the required fields, and redirects its output to be saved in a file, file.txt. The output is saved on a new line each time a field has been found. file.txt A Cat..

Adding two Java 8 streams, or an extra element to a stream

I can add streams or extra elements, like this: Stream stream = Stream.concat(stream1, Stream.concat(stream2, Stream.of(element)); And I can add new stuff as I go, like this: Stream stream = Strea..

Query for documents where array size is greater than 1

I have a MongoDB collection with documents in the following format: { "_id" : ObjectId("4e8ae86d08101908e1000001"), "name" : ["Name"], "zipcode" : ["2223"] } { "_id" : ObjectId("4e8ae86d08101..

Batch file to copy files from one folder to another folder

I have a storage folder on a network in which all users will store their active data on a server. Now that server is going to be replaced by a new one due to place problem so I need to copy sub folder..

Get child node index

In straight up javascript (i.e., no extensions such as jQuery, etc.), is there a way to determine a child node's index inside of its parent node without iterating over and comparing all children nodes..

how can I login anonymously with ftp (/usr/bin/ftp)?

I'm trying to connect to an FTP server which allows anonymous access, I don't know how to specify the appropriate username/password required to do this though. I've tried using anonymous/anonymous as..

Print content of JavaScript object?

Typically if we just use alert(object); it will show as [object Object]. How to print all the content parameters of an object in JavaScript?..

What is the correct format to use for Date/Time in an XML file

What format do I use for Date/Time when writing to an XML file using .NET? Do I simply use DateTime.ToString(), or do I have to use a specific format?..

Angular CLI SASS options

I'm new to Angular and I'm coming from the Ember community. Trying to use the new Angular-CLI based off of Ember-CLI. I need to know the best way to handle SASS in a new Angular project. I tried usi..

How to get the path of running java program

Is there a way to get the path of main class of the running java program. structure is D:/ |---Project |------bin |------src I want to get the path as D:\Project\bin\. I tried Syste..

How to get a barplot with several variables side by side grouped by a factor

I have a dataset which looks like this one below. I am trying to make a barplot with the grouping variable gender, with all the variables side by side on the x axis (grouped by gender as filler with d..

How to compare two NSDates: Which is more recent?

I am trying to achieve a dropBox sync and need to compare the dates of two files. One is on my dropBox account and one is on my iPhone. I came up with the following, but I get unexpected results. I ..

PostgreSQL: Drop PostgreSQL database through command line

I'm trying to drop my database and create a new one through the command line. I log in using psql -U username and then do a \connect template1, followed by a DROP DATABASE databasename;. I get the e..

How to resize the jQuery DatePicker control

I'm using the jQuery DatePicker control for the first time. I've got it working on my form, but it's about twice as big as I would like, and about 1.5 times as big as the demo on the jQuery UI page. I..

Java - using System.getProperty("user.dir") to get the home directory

I was wondering if using: System.getProperty("user.dir"); to get the absolute path of a folder is the best way to go about it? I am looking to pass my application onto other computers and I need a ..

How to Resize a Bitmap in Android?

I have a bitmap taken of a Base64 String from my remote database, (encodedImage is the string representing the image with Base64): profileImage = (ImageView)findViewById(; byte[] i..

How to refer to Excel objects in Access VBA?

What declarations I have to make in order to be able to use Excel objects and constants from my Access 2007 VBA script? Dim wb As Workbook or Set objExcelApp = New Excel.Application or .Border..

Escaping single quotes in JavaScript string for JavaScript evaluation

I have a project, in which some JavaScript var is evaluated. Because the string needs to be escaped (single quotes only), I have written the exact same code in a test function. I have the following bi..

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

Arithmetic operation resulted in an overflow. (Adding integers)

I can't understand this error: In this call to method SetVolume, Volume = 2055786000 and size = 93552000. Volume is an Integer property, and size is also Integer, as you can see. The class is a pa..

Easiest way to develop simple GUI in Python

I'm done with my class project which I coded using Python. I'm working on the extra credit part i.e. GUI development - Windows platform. I need something simple, easy to use, possibly drag-and-drop G..

How do you get the magnitude of a vector in Numpy?

In keeping with the "There's only one obvious way to do it", how do you get the magnitude of a vector (1D array) in Numpy? def mag(x): return math.sqrt(sum(i**2 for i in x)) The above works, b..

What is the difference between range and xrange functions in Python 2.X?

Apparently xrange is faster but I have no idea why it's faster (and no proof besides the anecdotal so far that it is faster) or what besides that is different about for i in range(0, 20): for i in xr..

Cast Int to enum in Java

What is the correct way to cast an Int to an enum in Java given the following enum? public enum MyEnum { EnumValue1, EnumValue2 } MyEnum enumValue = (MyEnum) x; //Doesn't work??? ..

Determine direct shared object dependencies of a Linux binary?

How can I easily find out the direct shared object dependencies of a Linux binary in ELF format? I'm aware of the ldd tool, but that appears to output all dependencies of a binary, including the depe..

git remote prune – didn't show as many pruned branches as I expected

From the man page: Deletes all stale tracking branches under <name>. These stale branches have already been removed from the remote repository referenced by <name>, but are still locally..

Handler "ExtensionlessUrlHandler-Integrated-4.0" has a bad module "ManagedPipelineHandler" in its module list

To be honest, I've tried to turn a dirty trick on IIS and just when I thought that I was going to get away with it, I realized my workaround doesn't work. Here's what I've tried to do: 1) I have ASP...

Vue.js redirection to another page

I'd like to make a redirection in Vue.js similar to the vanilla javascript window.location.href = 'some_url' How could I achieve this in Vue.js?..

End of File (EOF) in C

I am currently reading the book C Programming Language by Ritchie & Kernighan. And I am pretty confused about the usage of EOF in the getchar() function. First, I want to know why the value of E..

Losing Session State

I have an application where Users aren't able to successfully complete certain actions, for reasons, I'm assuming, can only be related to losing their session (which is where I maintain their ..

"The file "" couldn't be opened because you don't have permission to view it" when running app in Xcode 6 Beta 4

Whenever I try to run my app in Xcode 6 Beta 4 I am getting the error: The file "" couldn't be opened because you don't have permission to view it. This error appears no matter what simula..

How to implement "Access-Control-Allow-Origin" header in

Is it possible to implement "Access-Control-Allow-Origin" header in

Finding what branch a Git commit came from

Is there a way to find out what branch a commit comes from given its SHA-1 hash value? Bonus points if you can tell me how to accomplish this using Ruby Grit...

What is declarative programming?

I keep hearing this term tossed around in several different contexts. What is it?..

How to fix 'sudo: no tty present and no askpass program specified' error?

I am trying to compile some sources using a makefile. In the makefile there is a bunch of commands that need to be ran as sudo. When I compile the sources from a terminal all goes fine and the make ..

How to connect android wifi to adhoc wifi?

I'm new on the android system. Is this correct, the android 2.2.1 WIFI only detects non-ad hoc wireless network? I was wondering if there's a way to connect my android to an ad hoc network set-up from..

How to get the current user in ASP.NET MVC

In a forms model, I used to get the current logged-in user by: Page.CurrentUser How do I get the current user inside a controller class in ASP.NET MVC?..

Get file name from URL

In Java, given a or a String in the form of , what is the easiest way to get the file name, minus the extension? So, in this example, I'm lo..

How to convert binary string value to decimal

How to convert a binary String such as String c = "110010"; // as binary to the value in decimal in Java? (expected result in the example is 50)..

How to check if an excel cell is empty using Apache POI?

I am taking input from an excel sheet using Poi.jar and wanted to know how to check if a cell is empty or not. Right now I m using the below code. cell = myRow.getCell(3); if (cell != null) { ce..

fastest way to export blobs from table into individual files

What is the fastest way to export files (blobs) stored in a SQL Server table into a file on the hard drive? I have over 2.5 TB of files (90 kb avg) stored as varbinary and I need to extract each one ..

Disable EditText blinking cursor

Does anyone know how to disable the blinking cursor in an EditText view?..

ImportError: No module named pip

OS: Mac OS X 10.7.5 Python Ver: 2.7.5 I have installed setuptools 1.0 with from Then I download pip.1.4.1 pkg from

Delete terminal history in Linux

When you use the up key in a Linux terminal, you can use previous commands again. Great feature. However, I started logging mysql into mysql with the sensitive details in the command. How can I delet..

Extension methods must be defined in a non-generic static class

I'm getting the error: Extension methods must be defined in a non-generic static class On the line: public class LinqHelper Here is the helper class, based on Mark Gavells code. I'm really c..

Python Array with String Indices

Is it possible to use strings as indices in an array in python? For example: myArray = [] myArray["john"] = "johns value" myArray["jeff"] = "jeffs value" print myArray["john"] ..

How do I declare class-level properties in Objective-C?

Maybe this is obvious, but I don't know how to declare class properties in Objective-C. I need to cache per-class a dictionary and wonder how put it in the class...

How to create a stopwatch using JavaScript?

if(stopwatch >= track[song].duration) track[song].duration finds the duration of a soundcloud track. I am looking to create a stopwatch function that starts counting milliseconds when you click ..

YouTube Video Embedded via iframe Ignoring z-index?

I'm trying to implement a horizontal multilevel dropdown navigation menu. Immediately below (vertically) the menu, I've got a YouTube video embedded via iframe. If I hover over one of the main level n..

How to check all checkboxes using jQuery?

I am not expert with jQuery but I have tried to create a little script for my application. I want to check all checkboxes but it isn't working correctly. First I tried to use attr and after that I tr..

Reading CSV files using C#

I'm writing a simple import application and need to read a CSV file, show result in a DataGrid and show corrupted lines of the CSV file in another grid. For example, show the lines that are shorter th..

How to send multiple data fields via Ajax?

I'm stuck: I'm trying to submit a form using AJAX, but I can't find a way to send multiple data fields via my AJAX call. $(document).ready(function() { $("#btnSubmit").click(function() { var s..

how to get param in method post spring mvc?

I'm using spring mvc. And I can't get param from url when method = post. But when I change method to GET, so I can get all param. This is my form: <form method="POST" action="http://localhost:808..

How do I open phone settings when a button is clicked?

I am trying to implement a feature in an App that shows an alert when the internet connection is not available. The alert has two actions (OK and Settings), whenever a user clicks on settings, I want ..

mingw-w64 threads: posix vs win32

I'm installing mingw-w64 on Windows and there are two options: win32 threads and posix threads. I know what is the difference between win32 threads and pthreads but I don't understand what is the diff..

How to make audio autoplay on chrome

Audio autoplay is working in Mozilla, Microsoft Edge and old Google Chrome as well but not in new Google Chrome. They have blocked the autoplay. is there any way to make it audio autoplay in Google Ch..

Multiple axis line chart in excel

I'm looking for a multiple axis line chart similar to the one in the image below, (which is a javascript chart made by amcharts). Does excel have an option to draw charts line these? Note there are 3..

The matching wildcard is strict, but no declaration can be found for element 'context:component-scan

I am getting the following errors while trying my first spring project: Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be fo..

Determine SQL Server Database Size

SQL Server 2005/2008 Express edition has the limitation of 4 GB per database. As far as I known the database engine considers data only, thus excluding log files, unused space, and index size. Gettin..

Oracle row count of table by count(*) vs NUM_ROWS from DBA_TABLES

Looks like count(*) is slower than NUM_ROWS. Can experts in this area throw some light on this...

How to convert TimeStamp to Date in Java?

How do I convert 'timeStamp' to date after I get the count in java? My current code is as follows: public class GetCurrentDateTime { public int data() { int count = 0; java.sql...

Converting double to integer in Java

In Java, I want to convert a double to an integer, I know if you do this: double x = 1.5; int y = (int)x; you get y=1. If you do this: int y = (int)Math.round(x); You'll likely get 2. However, I..

What is the best way to get the count/length/size of an iterator?

Is there a "computationally" quick way to get the count of an iterator? int i = 0; for ( ; some_iterator.hasNext() ; ++i ); ... seems like a waste of CPU cycles...

How to reduce a huge excel file

I have a small and simple file in *.XLS with only one sheet, on this sheet just many cells with small text on number. (file size 24Kb) But I made a lot of changes, copy and paste, extend formula, sav..

NullPointerException in Java with no StackTrace

I've had instances of our Java code catch a NullPointerException, but when I try to log the StackTrace (which basically ends up calling Throwable.printStackTrace() ), all I get is: java.lang.NullPoin..

How can I print out just the index of a pandas dataframe?

I'm trying to make a table, and the way Pandas formats its indices is exactly what I'm looking for. That said, I don't want the actual data, and I can't figure out how to get Pandas to print out just ..

How to split a string of space separated numbers into integers?

I have a string "42 0" (for example) and need to get an array of the two integers. Can I do a .split on a space?..

Is there a php echo/print equivalent in javascript

Say I want to print html from inside a script tag. A source like this <div>foo</div> <script> print('<div>Print this after the script tag</div>'); </script> <d..

Android Studio Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

I am new in Android Studio. After setup, When I am trying to import an application I am getting that error So that gradle not able to build. Error:Could not initialize class org.codehaus.groovy.runt..

How do I make entire div a link?

I have a div like this <div class="xyz"></div> and all the content in that div is in the css. How do I make that div into a link? I tried wrapping the a tag around it, but that didn't see..

WPF Timer Like C# Timer

Where can I find a control which is like the C# Timer Control in WPF?..

Inline elements shifting when made bold on hover

I created a horizontal menu using a HTML lists and CSS. Everything works as it should except when you hover over the links. You see, I created a bold hover state for the links, and now the menu links ..

How to test if a dictionary contains a specific key?

What's the cleanest way to test if a dictionary contains a key? x = {'a' : 1, 'b' : 2} if (x.contains_key('a')): .... ..

Best way to get user GPS location in background in Android

In my android app i want to get user current location every few minute interval and update in to my center server using web service. Currently i am using Fused Location Provide for get user current lo..


I'm trying to chose between REST and JSON-RPC for developing an API for a web application. How do they compare? Update 2015: I have found REST easier to develop and use for an API which is served ..

Android, getting resource ID from string?

I need to pass a resource ID to a method in one of my classes. It needs to use both the id that the reference points to and also it needs the string. How should I best achieve this? For example: R.d..

How many socket connections possible?

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

array_push() with key value pair

I have an existing array to which I want to add a value. I'm trying to achieve that using array_push() to no avail. Below is my code: $data = array( "dog" => "cat" ); array_push($data['cat'..

PHP : send mail in localhost

I would like to send email through php code hosted locally. <?php $email = "[email protected]"; $titre = "My subject"; $message = "Text message !"; mail($email, $titre, $message); ?> ..

Why is it not advisable to have the database and web server on the same machine?

Listening to Scott Hanselman's interview with the Stack Overflow team (part 1 and 2), he was adamant that the SQL server and application server should be on separate machines. Is this just to make su..

Eclipse - Installing a new JRE (Java SE 8 1.8.0)

I am trying to install Java 8. What I have done so far: installed the latest version of Eclipse downloaded and installed Java SE Runtime Environment 8

Git push hangs when pushing to Github?

Git push hangs everytime I try to push to github. I am using Cygwin and Windows 7. Git functions fine locally tracking branches, providing status, setting global and and allowing ..

How to get the employees with their managers

This is what I want the output to look like: Employee Emp# Manager Mgr# BLAKE 7698 KING 7839 CLARK 7782 KING 7839 JONES 7566 KING 7839 MARTIN 7654 BLAKE 7698 A..

How to add/subtract time (hours, minutes, etc.) from a Pandas DataFrame.Index whos objects are of type datetime.time?

I've got a DataFrame who's index is just datetime.time and there's no method in DataFrame.Index and datetime.time to shift the time. datetime.time has replace but that'll only work on individual item..

New line in JavaScript alert box

How do you put in a new line into a JavaScript alert box? ..

python: restarting a loop

i have: for i in range(2,n): if(something): do something else: do something else i = 2 **restart the loop But that doesn't seem to work. Is there a way to restart that ..

How do I use jQuery to redirect?

I am using a HTML form to submit to a jQuery validation which then sends information to a PHP processing page through ajax. Everything works 100% apart from when everything comes back true I can't ge..

Vertical Alignment of text in a table cell

Here's a portion of my table (it's a form): Those are just two <td>'s in a <tr>. I'm trying to get Description up top, to the top of the table cell, rather than resting on the bottom. ..

How to get the location of the DLL currently executing?

I have a config file that I need to load as part of the execution of a dll I am writing. The problem I am having is that the place I put the dll and config file is not the "current location" when the..

The input is not a valid Base-64 string as it contains a non-base 64 character

I have a REST service that reads a file and sends it to another console application after converting it to Byte array and then to Base64 string. This part works, but when the same stream is received a..

How to center an unordered list?

I need to center an unordered list of unknown width, while still keeping the list-items left aligned. Achieve the same result as this: HTML <div> <ul> <li></li> ..

Regex to get NUMBER only from String

I recieve "7+" or "5+" or "+5" from XML and wants to extract only the number from string using Regex. e.g Regex.Match() function stringThatHaveCharacters = stringThatHaveCharacters.Trim(); ..

Is it possible to get multiple values from a subquery?

Is there any way to have a subquery return multiple columns in oracle db? (I know this specific sql will result in an error, but it sums up what I want pretty well) select a.x, ( select b.y, ..

Anaconda Installed but Cannot Launch Navigator

Anaconda (listed as "Python 3.6.0 (Anaconda 4.3.1 64 bit)" ) is in my programs and features list, but there is seeming no Anaconda Navigator desktop app, as their seems to be no icon on my desktop and..

MySQL duplicate entry error even though there is no duplicate entry

I am using MySQL 5.1.56, MyISAM. My table looks like this: CREATE TABLE IF NOT EXISTS `my_table` ( `number` int(11) NOT NULL, `name` varchar(50) NOT NULL, `money` int(11) NOT NULL, PRIMARY KE..

Log4j2 configuration - No log4j2 configuration file found

Lately I decided to learn how to use the log4j2 logger. I downloaded required jar files, created library, xml comfiguration file and tried to use it. Unfortunately i get this statement in console (Ecl..

How do I get the time of day in javascript/Node.js?

I want to get 1 to 24, 1 being 1am Pacific Time. How can I get that number in Node.JS? I want to know what time it is in Pacific time right now...

ValueError: unconverted data remains: 02:05

I have some dates in a json files, and I am searching for those who corresponds to today's date : import os import time from datetime import datetime from pytz import timezone input_file = file(FI..

How to Force New Google Spreadsheets to refresh and recalculate?

There were some codes written for this purpose but with the new add-ons they are no longer applicable...

How to quit a java app from within the program

What's the best way to quit a Java application with code?..

Navigation drawer: How do I set the selected item at startup?

My code works perfectly: every time an item in Navigation Drawer is clicked the item is selected. Of course I want to start the app with a default fragment (home), but Navigation Drawer doesn't have ..

How to check if a radiobutton is checked in a radiogroup in Android?

I need to set validation that user must fill / select all details in a page. If any fields are empty wanna show Toast message to fill. Now I need set validation for RadioButton in the RadioGroup. I tr..

When should I use File.separator and when File.pathSeparator?

In the File class there are two strings, separator and pathSeparator. What's the difference? When should I use one over the other?..

SQL Server : fetching records between two dates?

In SQL I write a SELECT statement to fetch data between two dates, using between and Ex: select * from xxx where dates between '2012-10-26' and '2012-10-27' But the rows returned are for 26th o..

Boolean vs tinyint(1) for boolean values in MySQL

What column type is best to use in a MySQL database for boolean values? I use boolean but my colleague uses tinyint(1)...

jQuery Uncaught TypeError: Cannot read property 'fn' of undefined (anonymous function)

All, I'm getting an error from some of my code that I downloaded. Here is the code: /*----------------------------------------------------------------------*/ /* wl_Alert v 1.1 /* description: Handl..

How can we dynamically allocate and grow an array

I am working on a project, but I cannot use any existing java data structures (ie, ArraysList, trees, etc) I can only use arrays. Therefore, I need to dynamically update an array with new memory. I ..

SQL Server Management Studio missing

i just installed sql server 2008 r2 and SQL Server Management Studio. After installation i found that the SQL Server Management Studio has not been installed. i wanted to install SQL Server Managemen..

Sniff HTTP packets for GET and POST requests from an application

I am coding an SEO tool in C# for doing keyword research. I need to make calls to Google Adword keyword tool. Now I know some tools which are doing the same already. I just need to decipher what they..

Live video streaming using Java?

Are there any good libraries for streaming live video using Java? Ideally both ends of the pipe should be written in Java but I am mostly concerned about the video player. What software would you reco..

How to call a .NET Webservice from Android using KSOAP2?

I have a problem while calling a webservice. I have a .NET web service on the server, and I am using KSOAP2 (ksoap2-j2se-full-2.1.2) in Android. While running the program I got an runtime exception li..

How to take input in an array + PYTHON?

I am new to Python and want to read keyboard input into an array. The python doc does not describe arrays well. Also I think I have some hiccups with the for loop in Python. I am giving the C code sn..

How can I extract audio from video with ffmpeg?

I tried the following command to extract audio from video: ffmpeg -i Sample.avi -vn -ar 44100 -ac 2 -ab 192k -f mp3 Sample.mp3 but I get the following output libavutil 50.15. 1 / 50.15. 1 liba..

Scanner doesn't read whole sentence - difference between next() and nextLine() of scanner class

I'm writing a program which allows the user to input his data then outputs it. Its 3/4 correct but when it arrives at outputting the address it only prints a word lets say only 'Archbishop' from 'Arch..

How do I convert a column of text URLs into active hyperlinks in Excel?

I have a column in excel, wherein I have all the website url values. My question is I want to turn the url values to active links. There are about 200 entries in that column with different urls in all..

Django Model() vs Model.objects.create()

What it the difference between running two commands: foo = FooModel() and bar = BarModel.objects.create() Does the second one immediately create a BarModel in the database, while for FooModel, t..

Can't find System.Windows.Media namespace?

I'm using an object from a 3rd party API that has a property of type System.Windows.Media.ImageSource, yet I can't seem to find the System.Windows.Media namespace anywhere. If I try to add a reference..

Clean up a fork and restart it from the upstream

I have forked a repository, then I made some changes and it looks like I've messed up everything. I wish to start it again from scratch, using the current upstream/master as the base for my work. S..

How to create a directory and give permission in single command

How to create a directory and give permission in single command in Linux? I have to create lots of folder with full permission 777. Commands mkdir path/foldername chmod 777 path/foldername I don't l..

load Js file in HTML

My first PhoneGap application includes 2 HTML files. The first one is named index.html which uses index.js. This file will display a list item. When I click an item in that list, it brings me to det..

How to solve "Fatal error: Class 'MySQLi' not found"?

I am doing a tutorial and am getting this error: Fatal error: Class 'MySQLi' not found (LONG URL) on line 8 The code on line 8 is: $mysqli = new MySQLi($db_server, $db_user, $db_pass, $db_name)..

Add (insert) a column between two columns in a data.frame

I have a data frame that has columns a, b, and c. I'd like to add a new column d between b and c. I know I could just add d at the end by using cbind but how can I insert it in between two columns? ..

How to enable CORS in AngularJs

I have created a demo using JavaScript for Flickr photo search API. Now I am converting it to the AngularJs. I have searched on internet and found below configuration. Configuration: myApp.config(..

If "0" then leave the cell blank

I am trying to create a simple ledger and on the far right of the "Book" it totals any debit/credit that I input. But instead of leaving the unused rows blank, it keeps repeating the latest total to t..

Jinja2 template not rendering if-elif-else statement properly

I am trying to set the text color using css in a jinja2 template. In the following code I want to set the output string to print in a specific font color if the variable contains a string. Everytim..

Asus Zenfone 5 not detected by computer

I have an Asus Zenfone 5. I enabled USB debugging but on conne?ting my phone to the computer, it shows no Android device could be detected. What can I do?..

How to remove lines in a Matplotlib plot

How can I remove a line (or lines) of a matplotlib axes in such a way as it actually gets garbage collected and releases the memory back? The below code appears to delete the line, but never releases..

How do I get cURL to not show the progress bar?

I'm trying to use cURL in a script and get it to not show the progress bar. I've tried the -s, -silent, -S, and -quiet options, but none of them work. Here's a typical command I've tried: curl -s ..

JSON date to Java date?

I could not find this anywhere. I fetch some JSON from an API that returns standard JSON dates. You can see the format by running this code in a JavaScript console: > new Date().toJSON(); "2010-10..

Compiling simple Hello World program on OS X via command line

I've got a simple hello world example that I'm trying to compile on OS X, named hw.cpp: #include <iostream> #include <string> using namespace std; int main() { cout << "Hello worl..

Get specific line from text file using just shell script

I am trying to get a specific line from a text file. So far, online I have only seen stuff like sed, (I can only use the sh -not bash or sed or anything like that). I need to do this only using a bas..

Bootstrap modal link

How can I make button become a link only and have a popup in bootstrap 3? code <a href="" data-toggle="modal" data-target=".bannerformmodal">Load me</a> <div class="modal fade banne..

Failed to install android-sdk: "java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema"

When installing the android sdk tools the following error is emitted: java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema Why is this happening and how can it be fixed? Debug ou..

Combining CSS Pseudo-elements, ":after" the ":last-child"

I want to make "grammatically correct" lists using CSS. This is what I have so far: The <li> tags are displayed horizontally with commas after them. li { display: inline; list-style-type: none..

CardView Corner Radius

Is there a way to make CardView only have corner radius at the top? < xmlns:android="" xmlns:tools="http://schem..

Running Python in PowerShell?

I am attempting to learn the very basics of Python using the guide "Learn Python the hard way" by Zed A. Shaw. The problem that I am having is that I can run Python scripts, but only when using .\ in ..

Mount current directory as a volume in Docker on Windows 10

Description I am using Docker version 1.12.5 on Windows 10 via Hyper-V and want to use container executables as commands in the current path. I built a Docker image that is running fine, but I have a..

Hiding axis text in matplotlib plots

I'm trying to plot a figure without tickmarks or numbers on either of the axes (I use axes in the traditional sense, not the matplotlib nomenclature!). An issue I have come across is where matplotlib ..

Difference between sh and bash

When writing shell programs, we often use /bin/sh and /bin/bash. I usually use bash, but I don't know what's the difference between them. What's main difference between bash and sh? What do we need..

How to start debug mode from command prompt for apache tomcat server?

I want to start debug mode for my application. But I need to start the debug mode from command prompt. Is it possible ? And will the procedure vary between tomcat 5.5 to tomcat 6.?..

SSL Error: CERT_UNTRUSTED while using npm command

I am trying to install express framework using npm command but getting following error. error message is E:\myFindings\nodejs_programs\node>npm install -g express npm http GET https://registry..

How to use OR condition in a JavaScript IF statement?

I understand that in JavaScript you can write: if (A && B) { do something } But how do I implement an OR such as: if (A OR B) { do something } ..

How do I insert an image in an activity with android studio?

I am very new to android development, and have only read and completed the first guide in the android development site. The problem I have been having is that I can not put a picture in an activity. I..

test if display = none

This does not work, should it? Or can you stop the error if another line could do the same: function doTheHighlightning(searchTerms) { // loop through input array of search terms myArray = se..

How does System.out.print() work?

I have worked with Java for a quite a long time, and I was wondering how the function System.out.print() works. Here is my doubt: Being a function, it has a declaration somewhere in the io package. ..

How to get a list of installed android applications and pick one to run

I asked a similar question to this earlier this week but I'm still not understanding how to get a list of all installed applications and then pick one to run. I've tried: Intent intent = new Inten..

Why does IE9 switch to compatibility mode on my website?

I have just installed IE9 beta and on a specific site I created (HTML5) IE9 jumps to compatibility mode unless I manually tell it not to. I have tried removing several parts of the website but no chan..

IIS: Where can I find the IIS logs?

I'm trying to set up an application from a third party, which requires a supporting website hosted in my local IIS. I've created a website exactly as explained in their install guide, but am having so..

How to secure MongoDB with username and password

I want to set up user name & password authentication for my MongoDB instance, so that any remote access will ask for the user name & password. I tried the tutorial from the MongoDB site and d..

How can I get browser to prompt to save password?

Hey, I'm working on a web app that has a login dialog that works like this: User clicks "login" Login form HTML is loaded with AJAX and displayed in DIV on page User enters user/pass in fields and c..