Stack Overflow

Subscribe to Stack Overflow feed
most recent 30 from 2017-11-22T13:16:57Z
Updated: 9 hours 3 min ago

I am getting the element not visible message in selenium webdriver

Mon, 11/20/2017 - 12:36
@FindBy(id="isRfid-checkbox") WebElement togglebutton_RFID;

This my element, have passed this element like below,

public void clickToggleButton() { inAction.waitForVisibilityOfElement(driver, togglebutton_RFID); inAction.buttonClick(driver, togglebutton_RFID, "Click button : togglebutton_RFID"); }

My element visible check method,

public void waitForVisibilityOfElement(WebDriver driver, WebElement e) { try { WebDriverWait wait = new WebDriverWait(driver, timeoutsec); wait.until(ExpectedConditions.visibilityOf(e)); System.out.println("*%^$%#$@#!@!#$@%$^$%$" + ExpectedConditions.visibilityOf(e)); //Thread.sleep(5000); Reporter.log("Success : Element is visible"); } catch (Throwable t) { //; Reporter.log("Failed : Element is not visible"); } }

android getFromLocation SDK 19

Mon, 11/20/2017 - 12:36

i have a function getCountry which return country name:

public String getCoutry(double longitude, double latitude){ Geocoder geocoder = new Geocoder(getBaseContext(), Locale.getDefault()); String country = ""; List<Address> address = null; try{ address = geocoder.getFromLocation(latitude, longitude, 1); if (address != null || address.size() != 0) { Address object = address.get(0); country = object.getCountryName(); }else{ } }catch(IOException e){ Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show(); } return country; }

With android version 21 and greater work perfect but in 19 sdk application has stopped, address.size equals 0, Why?

Longitude: 14.8260 latitude: 50.8706

Thanks for your answers!

Calculating Standard Deviation in c#

Mon, 11/20/2017 - 12:36

I am trying to calculate the standard deviation of numbers inputted manually on the front end by the user. I can get the mean but i cannot figure out how to code the standard deviation. Below is my code to calculate the mean.

protected void meanbutton_onclick(object sender, EventArgs e) { //get input values String values = planningpokervalues.Value.ToString(); if (values == null || values.Length == 0) { String result = "Please enter values."; returnvalue.Text = result; } else { String[] separatedvalues = values.Split(' '); double[] doublevalues = Array.ConvertAll<string, double>(separatedvalues, Double.Parse); double mean = doublevalues.Average(); String result = mean.ToString(); returnvalue.Text = "Mean: " + result; } }

any help is appreciated!!

Retrofit2+RxAndroid execute many requests in a loop

Mon, 11/20/2017 - 12:36

I use RxAndroid library + Retrofit2.

I Have 2 post requests:

  1. Get all category (return List == each String is category id)
  2. Get ProductsByCategory (return List)

I need load all products and save to DB after start App.

When I create MainFragment I get all Categories:

restApiFactory.getProductService().getCategories(new CategoryRequest(initiatorId)) .subscribeOn( .observeOn(AndroidSchedulers.mainThread()) .subscribe(new CategoriesHandler());

and Handle response:

@Override public void onNext(CategoryResponse value) { List categoryItems = value.getCategoryItems(); ... }

And then I need send another request(ProductsByCategory ) but I not understand how do it?

I can send it in foreach:

for (CategoryItem categoryItem : categoryItems) { Observable<Products> product = ProductsByCategory... }

or maby there is some Observable merge ....

I do not know. In general, how to do this? two requests to the server. one will return the list of id and the second product on these id.

what is the optimized way to write query

Mon, 11/20/2017 - 12:31

I have below query which I want to optimized

SELECT -- COUNT(message_queue_id_pk) message_queue_id_pk, q.media_filename_original, a.media_filename_original, processed_flag , schedule_flag, q.message_mode, q.added_datetime FROM messages_queue q LEFT JOIN messages_all a ON q.media_filename_original = a.media_filename_original WHERE q.message_type_flag != 1 AND a.media_filename_original IS NULL AND processed_flag = 2 LIMIT 10;

How to run my created java program to my pc

Mon, 11/20/2017 - 12:31

I'm using Dialog Boxes in java. How do i apply this to my computer? just asking I'm not very good enough. please help me.

import javax.swing.*; public class dialogs{ public static void main(String [] args){ JOptionPane.showMessageDialog(null,"Hello World"); } }

How to always get newest version when using * instead of version number in package.json?

Mon, 11/20/2017 - 12:30

I have a private dependency on package.json and it should always install the latest version. So instead of the version, it's *.

"dependencies": { "@user/package": "*" }

After the package was updated in npmjs it still installed old version with npm i if I enter exact version number instead of * - it installs a fresh version, which was published like a day ago.

I had a similar issue when the version was updated a minute ago at npmjs but now npmjs cache should be expired & updated with the new version, isn't it?

How can I avoid such issue and always get newest versions for everything with *?

I've tried npm cache verify npm cache clean --force. No luck.

jQuery doesn't select the element with dynamic ID, how to do that?

Mon, 11/20/2017 - 12:27

I am having a problem when I pass the ID through a directive. I can't obtain the element using jQuery inside the Link function, and the element is using the correct dynamic ID coming as parameter:

The Directive:

(function(angular) { var app = angular.module('pi.core'); app.directive('piSearch', function() { return { restrict: 'E', transclude: true, replace: true, scope: { idelement: '@' }, link: function(scope, element, attrs, controller, transcludeFn) { var idelement = scope.idelement; console.log('idElement: ' + idelement); console.log($('#' + idelement + ' .typeahead')); }, template: '<div id="{{idelement}}"></div>' }; }); })(angular);

(function(angular) { var app = angular.module('pi.core'); app.directive('piSearch', function() { return { restrict: 'E', transclude: true, replace: true, scope: { idelement: '@' }, link: function(scope, element, attrs, controller, transcludeFn) { var idelement = scope.idelement; scope.elementSelected = $('#' + idelement + ' .typeahead'); console.log('idElement: ' + idelement); console.log($('#' + idelement + ' .typeahead')); }, template: '<div id="{{idelement}}"></div>' }; }); })(angular); <script src=""></script> <script src=""></script> <pi-search></pi-search> {{scope.elementSelected}}

Any hints? Thanks in advance for your help!

How do I change logger level according to environmen in configuration file in log4j?

Mon, 11/20/2017 - 12:26

I have a log4j.xml config file. I want to change log level if environmental variables changes. I have multiple environmental which are DEVELOP, TEST, PREPROD etc. How can I do this?


<Loggers> <Root level="debug"> <AppenderRef ref="Console"/> </Root> </Loggers>


<Loggers> <Root level="error"> <AppenderRef ref="Console"/> </Root> </Loggers>

Change a MessageBox default button?

Mon, 11/20/2017 - 12:21

I have:

if (MessageBox.Show("Do you want to delete?", "", MessageBoxButton.YesNo) == MessageBoxResult.Yes)

I tried adding:

MessageBoxDefaultButton.Button2 if (MessageBox.Show("Do you want to delete?", "", MessageBoxDefaultButton.Button2, MessageBoxButton.YesNo) == MessageBoxResult.Yes)

The C# compiler does not like:


I am using C# 2013.

Is there any way to get notified before the app is being replaced by another?

Mon, 11/20/2017 - 12:20

I know about the ACTION_MY_PACKAGE_REPLACED Intent action but what it do is - notifies the receiver AFTER the app got replaced.

But the things is - I want to know before the app is being replaced by another.

I tried with these actions

<receiver android:name=".receivers.InstallReceiver" android:enabled="true" android:exported="true"> <intent-filter> <action android:name="android.intent.action.PACKAGE_INSTALL" /> <action android:name="android.intent.action.PACKAGE_ADDED" /> <action android:name="android.intent.action.PACKAGE_CHANGED" /> <action android:name="android.intent.action.MY_PACKAGE_REPLACED" /> </intent-filter> </receiver>

but doesn't help!

FlowType - InitialState init

Mon, 11/20/2017 - 12:09

A flow-beginner question ...

I have this type definition for a certain reducer :

type State = { +forProfile: { profileId: string, albums: Array<string> }, +entities: Array<Album>, +selectedAlbum: Album, +pictureQueue: Array<string> }

How can I set the initial state? This gives me flow errors on the albums and selectedAlbum ...

const initialState: State = { forProfile: { profileId: '', albums: [] }, enitites: [], selectedAlbum: {}, pictureQueue: [] }

/EDIT: Album Type:

export class Album { +id: string +description: string +visibility: number +accessRights: number +name: string +slug: string +numberOfPictures: number }

How to set bits in byte without loop

Mon, 11/20/2017 - 12:00

I am really confused, but cannot to do simple task as it seems:

I simply need to set number of bits in byte.

For example:

I need 5 bits set. So I need 0xb00011111.

Is it possible to do this without loop?

Also I'd not like to write lot of #defines too.

Enable ping by name from Docker container

Mon, 11/20/2017 - 11:51

I'm disabled to ping by name (ping from my docker container, but only by ip (ping From cmd I can ping by name and ip, so I think is some network setup on my docker.

I'm not too much in networking, so if anybody knows how to allow pinging by name, I would be more than grateful.

Regards, Stefan

Creating multiple objects using JPA

Mon, 11/20/2017 - 11:24

I am implementing a service which imports data into DB using hibernate. the number of db entries it creates might be between 10 to 10 million

Can I just use the list interface of JPA to save such data or do I need to do some optimization ? or do we have based on the size like below.

  1. when the number of objects is < 10
  2. when the number of objects is in 100s
  3. when it is in millions

Agent does not set "From" in header

Mon, 11/20/2017 - 11:14

We have a mail agent which generates a basic mail and sends it to an mailaddress.

Dim s As New NotesSession Dim maildoc As NotesDocument Dim db As NotesDatabase Set db = s.Currentdatabase Set maildoc = New NotesDocument(db) maildoc.Form = "Memo" maildoc.SendTo = "" maildoc.Subject = "Test" Call maildoc.replaceitemvalue("Principal","") Call maildoc.replaceitemvalue("AltFrom","") Call maildoc.replaceitemvalue("InetPrincipal","") Call maildoc.replaceitemvalue("SMTPOriginator","") Call maildoc.replaceitemvalue("From","") Call maildoc.replaceitemvalue("sentFrom","") Call maildoc.replaceitemvalue("InetFrom","") Call maildoc.send(False,False)

When I execute this agent and look in my account I see that there are not senders information. In the header of the mail there is no "from" field set. Only a "Sender" field.

Does anyone know about a server configuration or something to solve this? I don´t think it´s the agents fault, right?

ggplot in Mb Kb units

Mon, 11/20/2017 - 10:45

I have this data :

group event chr size a Gain 4 127146 b Gain 4 167600 c Loss 10 33575 a Loss 4 23456 b Gain 14 67576 c Gain 15 83471

I want to plot it this manner, so the units will be in Mb, Kb :

How should I do this?

Why do I get the error "Smart cast to 'Long' is impossible" in Kotlin? [duplicate]

Mon, 11/20/2017 - 07:01

This question already has an answer here:

I try to run the following code, but the code can't pass compile, I get the error:

Smart cast to 'Long' is impossible, because 'i' is a mutable property that could have been changed by this time


class MyClass1(var i: Long?) { fun change(): Long? { if (i != null) { return i + 10L } else { return 5L } } }


I write the code MyClass2 in Java, it can work well, why?

class MyClass2{ private Long i; public MyClass2(Long k){ i=k; } public Long change(){ if (i!=null){ return i+10L; }else { return 5L; } } }

composer is disabled for this thread on facebook messenger

Mon, 11/20/2017 - 06:26

Hi can i ask if what happen on my chatbot on facebook messenger? here's the problem says on chatbox "composer is disabled for this thread ".

I've created BOT using Gupshop ,

How to include telugu language in django forms

Mon, 11/20/2017 - 02:56


class Application(models.Model): full_name = models.CharField(max_length=40) father_or_husband_name = models.CharField(max_length=20) nominee_name = models.CharField(max_length=20) date_of_birth = models.DateField() job = models.CharField(max_length=20) address = models.CharField(max_length=20) mobile_no = models.CharField(max_length=10)


class ApplicationForm(forms.ModelForm): class Meta: model = Application fields = ('full_name', 'father_or_husband_name', 'nominee_name', 'date_of_birth', 'job', 'address', 'mobile_no')

In my template the fields display as:

Full Name: Father Or Husband Name: Nominee Name: Date Of Birth: Job: Address: Mobile No:

I want these fields in my native language Telugu.