Stack Overflow

Subscribe to Stack Overflow feed
most recent 30 from 2018-02-21T10:21:19Z
Updated: 4 hours 26 min ago

Android Firebase Merging multiple queries

Sun, 02/18/2018 - 09:32

I have this table on firebase;

{ "car1" : { "carId" : "123asd45", "carImageUrl" : "url", "carName" : "Champion" }, "car2" : { "carId" : "123aa456", "carImageUrl" : "url", "carName" : "Super" }, "car3" : { "carId" : "1234ew5", "carImageUrl" : "url", "carName" : "A" } }

And I am using firebase ui adapter like;

Query query = FirebaseDatabase.getInstance() .getReference() .child("carmodels") .orderByChild("carName") .equalTo(MYFILTER1) .limitToLast(30); FirebaseRecyclerOptions<Car> options = new FirebaseRecyclerOptions.Builder<Car>() .setQuery(query, Car.class) .build();

The above code working fine, but what I would like to do is; to filter by multiple strings like;

Query query = FirebaseDatabase.getInstance() .getReference() .child("carmodels") .orderByChild("carName") .equalTo(MYFILTER1) .limitToLast(30); Query query2 = FirebaseDatabase.getInstance() .getReference() .child("carmodels") .orderByChild("carName") .equalTo(MYFILTER2) .limitToLast(30);

Then merge them query results and give it to options;

FirebaseRecyclerOptions<Car> options = new FirebaseRecyclerOptions.Builder<Car>() .setQuery(MERGEDQuery, Car.class) .build();

So is it possible something like that ? Or do you suggest another solution for this ? Thank you


I have lots of Filters so using another child on firebase like "filters":"filter1_filter2_filter3.." can be problematic.

how to stick menu bar to the top using javascript in html

Sun, 02/18/2018 - 09:30

When I scroll my home page only then my Menu bar should stick to the top.Need help.Share the link of a video that explains about this in the best way or give me code if you have one.

h2 server mode or mixed mode : how to make it work

Sun, 02/18/2018 - 09:11

I'm new to h2, but I read a lot of documentation, I successfully created embeded H2 mem or file database.

But I'm still not able to use server mode or mixed mode :

I launch my Web server and tcp server like this :

java -jar h2-1.4.196.jar -web -webAllowOthers -tcp -tcpAllowOthers -browser -tcpPort 9092

Trying server mode :

I create file database like this :

  • I open H2 console and enter following :

    • jdbc:h2:~/maBaseH2FichierTCP
    • username: sa
    • password:

Database is created, and I see a lock file

  • In my java application

    • url: jdbc:h2:tcp://localhost:9092/~/maBaseH2FichierTCP
    • same username and pwd

--> When I launch my java application properties file, it stays sticked at the phase of datasource creation. I tried to change url: jdbc:h2:tcp://localhost:9092/~/maBaseH2FichierTCP to jdbc:h2:tcp://localhost/~/maBaseH2FichierTCP, but no effect.

Trying mixed mode :

  • In H2 console, I created jdbc:h2:C:/data/maBaseFichierAutoServeur;AUTO_SERVER=TRUE

  • In java, url: jdbc:h2:tcp://;AUTO_SERVER=TRUE

--> Behaviour is the same, application start, but when at datasource creation, it waits, and nothing more happen ...

Does someone take has a idea to make one of orther server mode work ?

Why does this std::vector::emplace_back fail?

Sun, 02/18/2018 - 09:01

I'm coming across a compiler error that says:

attempting to reference a deleted function

#include <iostream> #include <vector> template <typename T> struct Container { Container() = default; Container(const Container& other) = delete; Container(T* ptr) : ptr(ptr) {} T* ptr; ~Container() { delete ptr; } }; struct Foo { Foo(int a, int b) {} }; int main() { std::vector<Container<Foo>> myvector; myvector.push_back(new Foo(1, 2)); // I understand why this doesn't work. myvector.emplace_back((new Foo(1, 2))); // I don't understand why this fails }

I understand why it says attempting to reference a deleted constructor when I do std::vector::push_back(), because this does a copy and needs to call the copy constructor, which I deleted.

But std::vector::emplace_back() is supposed to take the constructor arguments of the type it holds. When I emplace back, I give it a pointer to a Foo, and this should be forwarded to the Container::Container(T* ptr) constructor.

What am I missing?

Windows Form Controls error in WPF

Sun, 02/18/2018 - 09:00

I have a Code Which will Create a Textbox During Runtime.

public System.Windows.Forms.TextBox AddNewTextBox() { System.Windows.Forms.TextBox txt = new System.Windows.Forms.TextBox(); this.Controls.Add(txt); dynamicTextBoxes.Add($"tb{cLeft}", txt); txt.Top = cLeft * 25; txt.Left = 100; txt.Multiline = true; txt.Size = new System.Drawing.Size(100,100); txt.BringToFront(); txt.BorderStyle = BorderStyle.None; txt.Text = "TextBox " + this.cLeft.ToString(); cLeft = cLeft + 1; return txt; }

This Code works fine in Windows Form Application but when I use this code in WPF application it gives an error at 4th line


I am not getting what the problem. Please guide me how can I solve this problem?

Wordpress .htaccess rewrite html

Sun, 02/18/2018 - 06:17

I migrated our site from HTML-based to Wordpress and included a rewrite rule to redirect all .htm / .html requests. This was working successfully until I noticed that the Google site verification file was a .html rather than a .xml like Bing, so it too was getting rewritten. I want to exclude this specific .html file googlexxxxxxxxxx.html from the rewrite. Currently my .htaccess says:

RewriteRule ^.+\.htm$ http://some-other-page [R=301,L] RewriteRule ^.+\.htm/$ http://some-other-page [R=301,L] RewriteRule ^.+\.html$ http://some-other-page [R=301,L] RewriteRule ^.+\.html/$ http://some-other-page [R=301,L]

Range loop fails after it's first iteration

Sun, 02/18/2018 - 04:19

Have this code to loop through a range looking for row duplicates in two of four columns. When a match is found, I resize the row to copy and paste all four columns to another sheet and delete those two rows from sheet 1. Beginning on iteration 2, the code starts both loops on the new "first row" and matches itself. How can I modify the code to start the loop in the correct rows?

Dim c As Range, d As Range Worksheets("2018 Daily Cash (Feb)").Activate Application.ScreenUpdating = False 'Set c = Range("B2:B" & Cells(Rows.Count, "B").End(xlUp).Row) For Each c In Range("B2:B" & Cells(Rows.Count, "B").End(xlUp).Row) For Each d In Worksheets("2018 Daily Cash (Feb)").Range("B3:B" & Cells(Rows.Count, "B").End(xlUp).Row) If c = d And c.Offset(0, 2).Value = d.Offset(0, 2).Value * (-1) Then c.Resize(1, 4).Copy Worksheets("Clears-Feb").Range("B2").End(xlDown).Offset(1, 0).PasteSpecial Paste:=xlPasteAll d.Resize(1, 4).Copy Worksheets("Clears-Feb").Range("B2").End(xlDown).Offset(1, 0).PasteSpecial Paste:=xlPasteAll d.EntireRow.Delete c.EntireRow.Delete End If Next Next

App store rejection - "no defined ‘loadingView’ or ‘contentView’ elements"

Sun, 02/18/2018 - 02:05

Apple have rejected my React Native app for external beta testing because:

when reviewed on iPad running iOS 11.2.5 on Wi-Fi connected to an IPv6 network….the app launches to a white screen and no content is loaded.

After some weeks of back and forth, they’ve admitted that it was not related to IPV6, and have given me some further info:

The app’s initial React Native view controller loads with no defined ‘loadingView’ or ‘contentView’ elements. It appears that there is code in place for Javascript updating, but as stated, we’re not seeing any attempt at the app to reach out - it appears likely something was disconnected between the executable and associated bundle files between your project and the submission.

I have not seen this issue when testing on my own devices or on the iOS Simulator. Even when submitting the app to TestFlight for internal beta testers, and then installing on my iPhone via the TestFlight iOS app, it always works fine. So, I'm baffled as to why Apple sees this and I don't, and I don't really know where to start with debugging it.

What's the equivalent of .gitignore in unity teams?

Sun, 02/18/2018 - 01:45

Title says it all. I want unity to not sync a directory with the rest of the team due to the 1gb restriction on personal accounts - is there any way to do that?

Is it possible to create a new wifi network from an existing wifi network that has a login page?

Sun, 02/18/2018 - 01:13

I apologize that I lack the vocabulary for solving this problem, but here we go...

The only internet connection available to me is a paid wifi service (like you might find at a coffee shop). To connect to this network, I have to log in via the paid service's login web page. This is a problem because I have devices (google home and nintendo switch) that are unable to connect to any network that requires logging in via a web page.

So my proposed solution is to connect to the network with the wifi adapter in my windows pc, then hopefully route that to my wifi router to create a new personal network - that way I can connect all my devices to my personal network.

Is this even possible? Would I need to build my own tool to accomplish this? I'm a developer, but I don't have much networking experience, so apologies if this doesn't make sense.


FirebaseDatabase.setValue() switch android activities

Sat, 02/17/2018 - 22:02

I have trouble with this line of code mRefPrfileUser.child(mAuth.getUid()).child("followingUsers").setValue(followingUsers); It's basic sending data to FirebaseDatabase. Problem is that when this line execute actual activity is switches to background and my main activity come up but data are send to firebase. Have you any idea why ?

how change data store in predictionio to mongodb

Sat, 02/17/2018 - 22:01

I have a little problem, I have nodejs server with mongodb as database and I want to share that database with my predictionio server, but it seems that predicitionio have no support for mongodb anymore! so is there any thing I can do to make it work ?
predictionio version: 0.12.0

How to convert an existing Django app to run in a virtualenv?

Sat, 02/17/2018 - 22:01

There are so many questions about this, and so many tries I've made and probably bungled...

But let me stick to the real problem: I have a fledgling Django app that I want to insulate from future changes to support software. I think putting in under a virtual environment is the answer. I'd like guidance, even just a pointer to the right Howto (one about migrating, not a fresh install).

My environment is Ubuntu 16.04.3 LTS, apache2, python3.5 and django 2.0. I'll be upgrading to the next LTS, which is why I want to insulate this app from changes.

Complicating matters is the fact that python2 and python 3 are both here, and pyhton2 is the default (what you get when you just call for "python". That makes things weird, for instance, because pip3 is uses the default python, so the output of 'pip3 freeze' is very different from what I get when I run it under python3, and I don't know the details of why.

What has failed in the past is my attempts to do it following guidance aimed at a freshly installed OS. What's more, probably because I did something wrong, pip3 lives in my $HOME/.local/bin/pip3. I don't know how to undo this.

How to modularize with pyqt

Sat, 02/17/2018 - 22:01

So I am using pyqt5 with qt designer and pyuic5 to turn them in python script. And I inherit from those scripts to modify the screens in other module. And there is the problem, working in this files end up being too large, to the point is confusing, normally I would modularize trough the meta-class getting the methods from other files, but I can't do this here because the inheritance from classes of pyqt5. When I try to use a meta-class this the error:

TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

So how I can modularize with pyqt?

Track Share events to FirebaseAnalytics

Sat, 02/17/2018 - 22:01

I have a share function on the app that allows users to share app to others, but I want to track number of shares. The share item is on the action bar, not on the dropdown menu.

@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(, menu); //some other code here for items search item //share menu item MenuItem shareItem = menu.findItem(; // Fetch and store ShareActionProvider mShareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(shareItem); String playStoreLink = Constants.PLAYSTORE_LINK + getPackageName(); String shareText = "Install app" + playStoreLink; Intent shareIntent = ShareCompat.IntentBuilder.from(this) .setType("text/plain").setText(shareText).getIntent(); // Set the share Intent mShareActionProvider.setShareIntent(shareIntent); return true; }

I have managed to implement tracking on other events by simply adding code in onClick() events but share event doesnt have onClick.

Code for tracking events

Bundle param = new Bundle(); param.putString("call_data", "1"); mFirebaseAnalytics.logEvent("calls_made", param);

Using group_by in R

Sat, 02/17/2018 - 22:00

Super simple question, I have some data for species, year and abundance and I'm looking to ignore the year and calculate the average abundance for each species so that I have data that lists each species and its average abundance only once. I'm assuming I should use group_by() in some way. Thanks.

CSS: column loads squished in internet explorder

Sat, 02/17/2018 - 22:00

my site loads fine in chrome/firefox . However, on internet explorer, the right div column loads all stuck together

but not the main page only when you read an article

any suggestions? thank you kindly

(i converted my site from tables/2000s era to mobile friendly)

here is a sample article

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'

Sat, 02/17/2018 - 22:00

When I want to build project in Android Studio this message appears :

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

java.lang.RuntimeException: java.lang.RuntimeException: Unable to merge dex

Please help

How to cache images with Picasso async?

Sat, 02/17/2018 - 21:59

At start of my application I have list of imageLinks

List<String> imageLinks = Arrays.asList("", "", "" ... "");

I want to download the images async and in next run of my app without internet connection, I want to display the images with Picasso:


But when I'm trying to download the image in background (io) thread with rxJava

for (String imageLink:imageLinks ) mPicasso.load(imageLink).into(new SimpleTarget() @Override public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) { Log.e(TAG, "onBitmapLoaded: "+imageLink); subscriber.onNext(true); subscriber.onCompleted(); })

the error occurs:

java.lang.IllegalStateException: Method call should happen from the main thread. at com.squareup.picasso.Utils.checkMain( at com.squareup.picasso.RequestCreator.into(

My another idea is to download the images with Retrofit , but how then tell to Picasso display downloaded images?

Can't display list bullets? [on hold]

Sat, 02/17/2018 - 21:55

You can reference this page for the issue. There are lists of services which I want to show a tick icon, like a checklist but no matter what I do I can't seem to get them to display.

Here is what I believe to be the offending CSS lines.

ul.jrFieldValueList, ul.jrFieldValueList li { overflow: hidden; list-style-type: none!important; padding: 0!important; margin: 0!important; background: none!important; }