Stack Overflow

Subscribe to Stack Overflow feed
most recent 30 from 2017-10-23T10:43:17Z
Updated: 40 min 36 sec ago

GWT change Jetty version

40 min 48 sec ago

I want to change GWT's v. 2.7.0 embedded Jetty version v. 8.1.12.v20130726 to later jetty v. 9.2.22.v20170606, because for some reason Atmosphere websockets do not work with jetty 8 version (while it works with 9).

To make sure that it's Jetty that's causing problems for Atmosphere (and not GWT super dev mode), I deployed application.war to tomcat/Jetty servers:

  • Tomcat 7.0.79: works
  • Jetty 9.2.22.v20170606: works
  • Jetty 8.1.12.v20130726: does not work

I found a thread asking quite a similar question, GWT: Jetty version in dev mode, and I would like to expand on that. If I were to implement ServletContainerLauncher , would it not conflict with JettyLauncher ? How should I go about writting my own ServletCotainerLauncher for dev mode?

If you have any better ideas then writing my own ServletContainerLauncher, I would like to hear them.

how to make designs compatible for all devices

41 min 3 sec ago

I have a design in which i need to get image view in center alignment. how can i manage to get a image view with centered image and make its size compatible with all screens.if i give hard code size ,that doesn't set on some devices.Do i have to make design for all screens individual or i can manage it somehow through one XML. here is my XML file :

<LinearLayout xmlns:android="" android:layout_width="match_parent" android:layout_height="200dp" android:layout_margin="5dp" android:padding="5dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/backgrondcolor" android:orientation="horizontal" android:weightSum="4"> <LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="2" android:orientation="vertical"> <ImageView android:id="@id/image" android:layout_width="match_parent" android:layout_height="match_parent" android:cropToPadding="true" android:scaleType="fitXY" android:src="@drawable/image_corner" /> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_margin="7dp" android:layout_weight="1.8" android:orientation="vertical" android:weightSum="5.5"> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1.5"> <TextView android:id="@+id/assemblyName" android:layout_width="match_parent" android:layout_height="wrap_content" android:maxLines="2" android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium" android:textColor="@color/colortoolbartitle" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="3"> <TextView android:id="@+id/asemblyinformation" android:layout_width="match_parent" android:layout_height="wrap_content" android:textAppearance="@style/Base.TextAppearance.AppCompat.Small" android:textColor="@color/colortoolbartitle" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:orientation="horizontal" android:weightSum="7"> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1"> <ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:src="@drawable/image" /> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1.5"> <TextView android:id="@+id/totalassemblies" android:layout_width="match_parent" android:layout_height="match_parent" android:src="@mipmap/ic_launcher" android:textAppearance="@style/Base.TextAppearance.AppCompat.Small" android:textColor="@color/colortoolbartitle" /> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="2"> <ImageView android:id="@+id/imageweb" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/web" /> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="2"> <ImageView android:id="@+id/imagenextpage" android:layout_width="match_parent" android:layout_height="match_parent" android:clickable="true" android:src="@drawable/link" /> </LinearLayout> </LinearLayout> </LinearLayout> </LinearLayout> </LinearLayout>

How to download files from Marklogic in linux box to windows

41 min 4 sec ago

I have Marklogic server on Linux and want to download files on Windows box. As far as i know MarKlogic cannot communicate to multiple environment. But is there a way by which i can download files on different platform? Thanks in Advance.

R expand numeric vector values each from the count of 1

41 min 7 sec ago

I have a numeric vector of random numbers:

v1 <- c(4, 20, 19, 11, 7, 11, 7, 2, 5, 3)

How do I expand it in such a way that each starts from the count of 1?

[1] 1 2 3 4 1 2 3 4 5 6 7 ... 20 1 2 3 4 ... 19 ...

How to change the timeZone in SwiftDate?

41 min 16 sec ago

I have displayed the list of timezones in my app. If user selects a particular timezones, I need to change the local timezone to user selected timezone.

let region = Region(tz: timeZoneName.timeZone , cal: cal, loc: cal.locale!) let date = Date().inRegion(region: region).absoluteDate

Here the problem is, the region is changed to selected timezone but the date issuing the local timezone.

How to show list of names according to their rank in by using subject name as a drop down list excel

41 min 20 sec ago

Have some list of student name, their subject name and mark. If select the Subject name need to show list student name in descending order according to their mark rank

As shown in the picture

Http Response Splitting veracode flaw while using request.getCookies()

41 min 24 sec ago

I am getting all the cookies from the request object and then further filtering out the cookie i need and adding the same in the response.

But this give me Http Response splitting veracode flaw.

Optional<Cookie> optional = .filter(x -> ESAPI.encoder().encodeForHTML("myCookie").equals(x.getName()) .findFirst(); if (optional.isPresent()) { Cookie tkCookie = optional.get(); tkCookie.setMaxAge(0); response.addCookie(tkCookie); }

How to prevent this veracode flaw here? Thanks.

Firebase Delete or a Create rule

41 min 33 sec ago

In the Firebase documentation in the following link in the section Existing Data vs. New Data it states that the following rule is applied on the creation or deletion of data.

// we can write as long as old data or new data does not exist // in other words, if this is a delete or a create, but not an update ".write": "!data.exists() || !newData.exists()"

Could someone explain me why the write permits the delete operation as this seems to me wrong?

In the same section of the documentation it states that: newData represents the merged result of the new data being written and existing data.

The problem is that if there is a delete operation then the data will exist and the newData will also exist as it is the merged result as the documentation states. As such, the expression !data.exists() || !newData.exists() should return false.

Could someone please tell me if I am missing something?

E/DefaultBootstrapChannel: Failed to receive operation servers list {}

41 min 37 sec ago

I have deployed kaa on AWS but whenever i try run sample project the it is showing error:

E/DefaultBootstrapChannel: Failed to receive operation servers list {} org.apache.http.conn.HttpHostConnectException: Connection to http://ec2-old IP refused at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(

  1. Please help me change IP address in kaa aws

Bitlocker Turn On for Windows 8.1 Pro

45 min 35 sec ago

My operatin system is Windows 8.1 Pro 64-bit. Allthough I set "Allow Bitlocker without a compatible TPM" option in the "Require additional authentication at startup" policy for OS volumes, I can not turn on bitlocker for Local Disk(C:). But I can turn on for Local Disc(D:)

Python Convert a part of a String into Float

45 min 41 sec ago

I am trying to make a list containing 2 strings:

List=["Height = 7.2","Baselength = 8.32"]

But I am having a problem trying to extract the numbers from the strings:

For example:

If "Height = 7.2" then the result should be: 7.2

or if the "Height= 7.3232" then the result should be: 7.3232

err is blank but err.message exists on expressJS

47 min 29 sec ago

In ExpressJS app final app.use which is using for error handling

app.use(function(err, req, res, next) { res.status(err.status || 500); console.log('as',typeof err); // res.render('error1', { // message: err.message, // error: {} // }); res.json(err.message) });

When I log err it print as {} ,but when I log err.message it show string like 'obj is not defined'. Why this happens and how I can see all the keys of err object like message .

Node Js Socket Io trigger event on a route

52 min 45 sec ago

I am trying to create a route which should trigger or emit message but I don't know how to do that. My code for Node and Socket is like this:

var app = require('express')(); var http = require('http').Server(app); var io = require('')(http); app.get('/', function(req, res) { res.sendfile('index.html'); }); io.on('connection', function(socket) { socket.on('message', function(data){ console.log(data); console.log(connectedUsers[data.description]); var l = data.description; console.log(l+ " Ia m undefined"); io.emit('message2', data.message); console.log(data.message+ "One message"); }); }); app.get('/test', function (req, res) { res.send('GET request to the homepage'); io.on('connection', function(socket) { io.emit('message2', data.message); console.log("hello"); }); }); http.listen(3000, function() { console.log('listening on localhost:3000'); });

Here I want to trigger this event called io.emit in a route suppose I want to create a route called test and when anyone access that route I need to trigger socket emit function. I have tried few things but nothing is working. I am triggering event from index.html using this function:

socket.emit('message',{ description: id , message: "I am a message"});

How can I do this on a route when anyone access that route it should send message something like this:

app.get('/test', function (req, res) { res.send('GET request to the homepage'); io.emit('message2', data.message); });

Is it possible if yes then how.

automatically send mail birthday wishes in php without crone

53 min 41 sec ago

i have a user table with date of birth and email address i want to send automatic email for there birthday wishes according date of birth in there email address. in php with mysql server please help me regrading this.

How to redirect to url within same context

56 min 10 sec ago

I have /logout action, that should redirect to /login. /login renders template, where I read flash message from context. This works, but url in browser is still remains "/logout":

router.get("/logout").handler((ctx) => { if (ctx.user()!=null) { ctx.clearUser() //flash message ctx.put("msg", "Logout succeed") } ctx.reroute("/login") })

What I want, but url should be "/login":

Better to use(?):

ctx.response.putHeader("location", "/login").setStatusCode(302).end()

But there is different context. So I haven't flash message.

How to redirect to /login within same context?

Project R - Barplot of occurrences of levels

58 min 23 sec ago

I am struggling with some plots. I have a really big data.frame with some entries. To get an overview I will work with some test data.

Let's assume the following data:

Sender <- c("ARD", "ZDF", "ARD", "ARD", "ZDF", "ZDF", "ARD") Akz <- as.factor(c(0, 1, 1, 0, 0, 1, 1)) NAkz <- as.factor(c(1, 1, 1, 0, 0, 0, 0)) data <- data.frame(Sender, Akz, NAkz)

I want to get a (stacked) barplot group by the column "Person". So for each person I want to illustrate the occurrences of the columns "A" and "NA". Means one bar represents the column "A" with 3 "0"s and 4 "1"s and next to this bar I want the column "NA" with 4 "0"s and 3 "1"s. Would be great if there is a possibility to have a legend and the total amount of each level.

Thanks and all the best Peter

PS: Found a pictures which illustrates a cool barplot. But I am not able to create this since the work with integers and total amounts

fuse: device not found, try 'modprobe fuse' first

1 hour 2 min ago

I am trying to mount s3fs into docker container by adding following commands in my Dockerfile.

FROM ubuntu:16.04 ADD etc/passwd-s3fs /etc RUN chmod 640 /etc/passwd-s3fs RUN rm -rf /opt/s3-projects RUN mkdir -p /opt/s3-projects RUN chmod 777 /opt/s3-projects RUN apt-get -y install s3fs RUN which s3fs RUN s3fs mybucket-name /opt/s3-projects -o nosuid,nonempty,nodev,allow_other,default_acl=private,retries=5,passwd_file=/etc/passwd-s3fs

when i try to build the image am getting this "fuse: device not found, try 'modprobe fuse' first" error

Please help.

Thanks in advance.

Making a nested array in php

1 hour 7 min ago

Probably my question is too much common or easy for you, but I really have no idea how to do it. Trying all everything I know and lots of googling didn't help me.

I just need a nested array.

Here is my PHP code:

Corrected: $data['product_names'][$language['language_id']][] = array(

$data['product_names'] = array(); foreach ($data['languages'] as $language) { $product_names_info = $this->model_catalog_category->getCategoryMultiLang($this->request->get['product_id'], $language['language_id']); if ($product_names_info) { $data['product_names'][$language['language_id']][] = array( 'category_id' => $product_names_info['category_id'], 'language_id' => $product_names_info['language_id'], 'name' => $product_names_info['name'] ); } } print_r($data['product_names']);

The result that I get:

Array ( [5] => Array ( [0] => Array ( [category_id] => [language_id] => [name] => ) ) [2] => Array ( [0] => Array ( [category_id] => [language_id] => [name] => ) ) [4] => Array ( [0] => Array ( [category_id] => [language_id] => [name] => ) ) ...

The result should look like this:

Array ( [0] => Array ( [language_id] => 1 [category_id] => 8 [name] => book ) [1] => Array ( [language_id] => 5 [category_id] => 188 [name] => magazine ) ... ) Array ( [0] => Array ( [language_id] => 1 [category_id] => 8 [name] => buch ) ...

The result of print_r($product_names_info); inside foreach ($data['languages'] as $key => $language) {

Array ( [0] => Array ( [language_id] => 5 [category_id] => 8 [name] => Gecelik ) [1] => Array ( [language_id] => 5 [category_id] => 188 [name] => Sabahlık ) ... ) Array ( [0] => Array ( [language_id] => 2 [category_id] => 8 [name] => لباس خواب ) [1] => Array ( [language_id] => 2 [category_id] => 188 [name] => Sabahlık )

Thanks for any kind help.

How to write Java Spring MVC database access classes for a MySQL database with lot of tables?

1 hour 7 min ago

I want to connect to a database with lot of tables with Java Spring MVC.

Currently, I am coding one class for each table. Ex;

@Table(name = "sa_user") //table name public class SaUser implements Serializable { private static long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "sa_user_id") private Integer saUserId; ... ... }

Do I have to write these class for all of the tables. This is a huge task. What is the best way?

Expo.ImagePicker works within Expo, but not in Standalone Android

1 hour 11 min ago

Our app allows the user take pictures (and select pictures) from it.

I've used the Expo component ImagePicker for that, as it provides a simple API.

And it works perfectly inside expo (both exp start and exp publish), but it does not work within a standalone apk.


An excerpt of the code:

import { ImagePicker } from 'expo'; (...) const image = await ImagePicker.launchCameraAsync({ allowsEditing: true, aspect: [3, 5], }); (...) let image = await ImagePicker.launchImageLibraryAsync({ allowsEditing: true, aspect: [3, 5], });

It works well within expo, including exp publish version.

As for my permissions in the app.json, what I have is the following:

(...) "android": { "package": "", "versionCode": 3, "permissions": [ "android.permissions.CAMERA", "android.permissions.READ_INTERNAL_STORAGE", "android.permissions.READ_EXTERNAL_STORAGE" ] }

I have also tried without the android.permissions.

The mobile does request for the permission, I accept it, and it does not launch the camera / picker, like it does within the expo.

Any help?