on-internet

java.lang.ClassCastException cannot be cast to java.util.Map$Entry [duplicate]

I have this problem I can't solve: I'm getting some data from a Firebase database. Everything works fine, except when I reach the title column. The title column is a JSON tree and it has key- value rows, so new logic must be written here. I've tried to create an entry for it and save it in a HashMap inside my ConfigItem class that I created. I receive the data just fine, but I don't know who to loop through it. When I reach the third line in the while loop, I get the error: java.lang.ClassCastException: java.util.HashMap$EntrySet cannot be cast to java.util.Map$Entry What am I missing here? pu

Join the discussion →

bundler: failed to load command: rspec

I am new to Rails and I want to run Rspec using Mac. When I run: bundle exec rspec spec/00_hello_spec.rb I get the following response: bundler: failed to load command: rspec (/Users/OumouKaba/Downloads/test-first-ruby-master/vendor/bundle/ruby/2.4.0/bin/rspec) LoadError: cannot load such file -- spec_helper /Users/OumouKaba/Downloads/test-first-ruby-master/vendor/bundle/ruby/2.4.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1181:in `require' /Users/OumouKaba/Downloads/test-first-ruby-master/vendor/bundle/ruby/2.4.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1181:in `block

Join the discussion →

build gradle fail with "no signature of method .... is applicable for argument types: (java.lang.String) values"

I have 4 gradle build files: when I build in android studio I am constantly having the error: No signature of method: org.gradle.model.ModelMap.getDefaultProguardFile() is applicable for argument types: (java.lang.String) values: [proguard-android.txt] file 1 // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle-experimental:0.9.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } a

Join the discussion →

How to set width to Mobile screen size using HTML / CSS

I am developing a website Register page. if(strpos($_SERVER['HTTP_USER_AGENT'], 'Android') !== false) With the above trap, I directed the page to a separate mobile page, where the problems started with setting the width. in the mobile page, I tried setting the width in CSS like width="auto", width=100% and even a width element, but still the Register page occupies just 30%-40% of the screen (used align: left) and not visible. I am using PHP and MySQL. Please help me how to come out of this problem

Join the discussion →

Restrict concurrency in sub-make

For a project spread over several sub-directories we use GNU make for the builds. Developers can use the -j <number> flag to parallelize the build tasks, and choose a number that suits the hardware of their machines. However, the Makefiles of a third-party library that we use are not safe to parallelize - they apparently rely on implicit order of targets instead of explicit dependency rules between all dependent targets. Since I have no desire to fix third-party Makefiles, we currently invoke their Makefiles with an explicit -j 1 parameter to restrict the number of jobs to 1 for building that

Join the discussion →

Can I use Apache Camel as ESB?

I was trying to know more about Apache Camel, Mule ESB, JBoss ESB]...and in general speaking about ESB. I can find several ESB characteristic in Apache Camel. So, can I use Apache Camel like ESB or is Apache ServiceMix is the best fit?

Join the discussion →

IONIC 3 [ERROR] An error occurred while running cordova run android (exit code 1)

i start for ionic 3, but i try to run command 'ionic cordova run android', i was try any way for solve this problem but i cannot found answer from this problem, i got error like this : this result error [13:29:45] preprocess started ... [13:29:45] deeplinks started ... [13:29:45] deeplinks finished in 44 ms [13:29:45] preprocess finished in 52 ms [13:29:45] webpack started ... [13:29:45] copy finished in 14.20 s [13:30:30] webpack finished in 45.55 s [13:30:30] sass started ... [13:30:36] sass finished in 5.48 s [13:30:36] postprocess started ... [13:30:36] postprocess finished in 22 ms [13:30

Join the discussion →

what is the object type of mean in R?

I am looking for the real object type of some functions in R, for example, I can not find out the object type of mean function. > library(pryr) > otype(mean) [1] "base" > ftype(mean) [1] "s3" "generic" Sometimes the mean function is S3 and sometimes it is base!

Join the discussion →

How to find docker.socket file after change of docker root folder ?

Docker service is correctly setting up. Before long, I change the root directory of Docker from /var/lib/docker to /opt/docker. I can't find the docker.socket file, in order to share it with another container (Docker In Docker, DIND). Docker info does not display any information about the location of the socker ?, How can I find it ?

Join the discussion →

Interfacing MQ-3 Alcohol Sensor with Raspberry Pi 3

Since MQ-3 sensor provides analog output, we have got MCP 3008. We tried to make the connections with Raspberry pi 3 using the connections from MQ-2 sensor available online. Nothing works! Need help to interface MQ 3 with Raspberry pi 3 for detecting Alcohol Level

Join the discussion →

curl error 56 (failure receiving network data) when run from cron

I have a bash script that uses curl to retrieve a file. It runs fine when I run it from interactive bash shell but curl fails with exit code 56 (failure in receiving network data) when I run the script with cron. I also get an error message curl: (56) SSL read: errno -5961 Any ideas? Crontab entry: 57 21 * * * /opt/tltutilities/lss/bin/get_hosts.sh 2>&1 | /bin/mail -s "get_hosts.sh" [email protected] Bash script: #! /bin/bash BASEDIR=/opt/tltutilities/lss cd $BASEDIR/bin curl -v -o /opt/tltutilities/lss/tmp/etc_hosts https://remote_host.edu/pub/hosts/hosts rc=$? if [ $rc -ne 0 ] then errmsg="curl: c

Join the discussion →

Interleaving array_agg in postgres

I have a postgres query in which I want to interleave my array_agg statements : SELECT client_user_id, (array_agg(question), array_agg(client_intake_question_id), array_agg(answer)) as answer FROM client_intake_answer LEFT OUTER JOIN client_intake_question ON client_intake_question.id = client_user_id GROUP BY client_user_id Gives me the following: 5 | ("{""Have you ever received counselling?"",""Have you ever received counselling or mental health support in the past?""}","{1,2}","{yes,no}") I would like the results to be: 5 | ("{""Have you ever received counselling?", 1, "yes"",""Have you eve

Join the discussion →

Uninstall older unixODBC completely and install 2.3.2 unixODBC in redhat 6.3

I am trying to install msodbcsql v13 in redhat 6.3. It shows dependency error for unixODBC(64 bit) >= 2.3.1 needs to be installed before installing msodbcsql. I tried running below command, odbcinst -j It shows unixODBC 2.3.2 is installed. Also i tried to some other way, yum provides /usr/lib64/odbcinst.so.2.0.0 The above command shows, ODBC version 2.2 is installed. Also if i run yum local install, it shows unixODBC 32 bit version available in machine. To remove unixODBC, i tried the below commands. But not works out. yum remove unixODBC yum erase unixODBC rpm -e unixODBC* rpm rpm -qa | grep

Join the discussion →

Print a python output to an html file

I am writing a script to print the output to an html file. I am stuck on the format of my output. Below is my code: def printTohtml(Alist): myfile = open('zip_files.html', 'w') html = """<html> <head></head> <body><p></p>{htmlText}</body> </html>""" title = "Study - User - zip file - Last date modified" myfile.write(html.format(htmlText = title)) for newL in Alist: for j in newL: if j == newL[-1]: myfile.write(html.format(htmlText=j)) else: message = j + ', ' myfile.write(html.format(htmlText = message)) myfile.close() Alist = [['123', 'user1', 'New Compressed (zipped) Folder.zip', '05-24-17']

Join the discussion →

npm - EPERM: operation not permitted on Linux

I'm trying to do the react tutorial on my local machine (centOS) I ran sudo npm install -g create-react-app After running that command I got the following error npm ERR! Linux 3.10.0-514.el7.x86_64 npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "create-react-app" npm ERR! node v6.10.3 npm ERR! npm v3.10.10 npm ERR! path /tmp/npm-1422-84cdbe70/registry.npmjs.org/tar/-/tar-2.2.1.tgz npm ERR! code EPERM npm ERR! errno -1 npm ERR! syscall open npm ERR! Error: EPERM: operation not permitted, open '/tmp/npm- 1422-84cdbe70/registry.npmjs.org/tar/-/tar-2.2.1.tgz' while getting shasum for

Join the discussion →

What does /// (triple slash) do in JavaScript?

I was adding some comments to my code using Notepad++, and instead of typing //check for null I accidentally typed ///check for null. I noticed that this caused my text to be colored differently, so presumably it has a different function. When I tried to Google it, Google seemed to replace my javascript /// with just javascript. So, my question: What does /// do in JavaScript? Also, this is not a duplicate of this question because that question is about C++, I'm talking about Javascript.

Join the discussion →

Using Python's shutil to create a directory if it does not already exist

I have a program that currently copies a file from my computer to other computers on the network. This functions just fine if the other computers already have the directory specified. Some of the computers may not already have the specified directory. In this case, how could I create the directory if it does not exist and then copy the file into the new directory? Would shutil.copytree() work? Here is a portion of my current program: import fileinput import shutil def copyerror(): print("Cannot connect to " + servername + ".") def copyfiles(servername): source = os.listdir("C:/Users/jm/Desktop

Join the discussion →

Is it possible to open the content of a textarea in a about:blank?

I am currently trying to make a print button on my website. Once the print button is clicked it should take the contents of the textarea and open it in a about:blank. <textarea id="icontent" placeholder="Enter your content here." name="mas" rows="15" class="content"> </textarea> <a id="wprint" class="btn">Print</a> Is it possible to do this with only front end.

Join the discussion →

How to offset flex item?

I'm developing a pure flexbox grid framework called flexboxes. I'm looking to implement a way to offset flex items by a particular number of grid columns in any flex-direction. This is possible with percentage margin, but can it be done in a simpler way using flex properties? With what's available in [email protected]? I'd rather not implement margin classes this way because doing so would seemingly require adding classes for all 4 directions to accommodate all flex-direction values.

Join the discussion →

Can't get fresh length of list Telegram bot API

I have flask telegram bot with pyTelegramBotAPI deployed on Heroku. Need to get fresh length of list in the start message. List refreshing every 5 minutes in gettinglist.py. Can't find my mistake, please help. bot.py import config import gettinglist from gettinglist import getting_list import telebot from flask import Flask, request from threading import Thread def app_run(): app.run(host="0.0.0.0", port=os.environ.get('PORT', 80)) msg_start = """ Length of list now: %d """ % config.LIST_LENGTH application_thread = Thread(target=app_run) getting_list_thread = Thread(target=getting_list) bot =

Join the discussion →

To use the default BatchConfigurer the context must contain no more thanone DataSource, found 2

I am using spring boot and spring batch. For meta table i want to use mysql and for all business thing i want to use db2 as a database.When i implemented getting error. application.properties spring.datasource.url = jdbc:mysql://localhost:3306/local spring.datasource.username = root spring.datasource.password = root spring.jpa.show-sql = true spring.jpa.hibernate.ddl-auto = update spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect spring.seconddatasource.url=jdbc:db2://*************** spring.seconddatasource.username=****** spring.seconddatasource.password=**** sprin

Join the discussion →

Safe reinterpret_cast with sockaddr?

Assume I'm doing some socket programming: struct sockaddr_in sa; inet_pton(AF_INET, "127.0.0.1", &(sa.sin_addr)); auto *resa = reinterpret_cast<struct sockaddr*>(&sa); bind(sfd, resa, sizeof(sa)); Now the question is: we do reinterpret_cast (or C-style (struct sockaddr *) cast like in tutorials or man) yet the standard does not guarantee that to work, right? On the other hand there does not seem to be a way to do that differently, bind() requires struct sockaddr* (and it has to access the underlying struct to determine what it received). So is it safe to do reinterpret_cast between different t

Join the discussion →

Bash function to check if a given variable is set

As explained in this answer, the "right" way to check if a variable is set in bash looks like this: if [ -z ${var+x} ]; then echo "var is unset" else echo "var is set to '$var'" fi What I'm interested in is how to extract this into a function that can be reused for different variables. The best I've been able to do so far is: is_set() { local test_start='[ ! -z ${' local test_end='+x} ]' local tester=$test_start$1$test_end eval $tester } It seems to work, but is there a better way that doesn't resort to calling eval?

Join the discussion →

How to solve "shell request failed on channel 0" on RHEL container?

I'm trying to connect to a Stash repo from a Jenkins container (RHEL7). The connection appears to authenticate successfully however fails shortly afterward. Connection established. debug1: identity file /var/jenkins_home/.ssh/id_rsa type 1 debug1: key_load_public: No such file or directory debug1: identity file /var/jenkins_home/.ssh/id_rsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /var/jenkins_home/.ssh/id_dsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /var/jenkins_home/.ssh/id_dsa-cert type -1 debug1: key_load_

Join the discussion →

jquery datatables pagination "show entries" not working

I am new to jquery datatables. I had a simple function which calls ajax and maps the response into datatables. That is working, but the pagination is not working properly. Any suggestion would be great. Here is my code: function loadJson() { $('#datatable') .dataTable( { "bProcessing" : true, "bPaginate" : true, "bServerSide" : true, "sServerMethod" : "GET", "sAjaxSource" : "${pageContext.request.contextPath}/emi/calculate?jsonValue=" + jsonData, "sAjaxDataProp" : "", "fnRowCallback" : function(nRow, aData, iDisplayIndex) { $("td:first", nRow).html(iDisplayIndex + 1); return nRow; }, "aoColumn

Join the discussion →

jquery datatables pagination not working

I am new to jquery datatables, I had a simple function which call ajax and map the response into datatables, that is working but , the pagination is not working properly , any suggestion would be greate. Here is my code. function loadJson() { $('#datatable') .dataTable( { "bProcessing" : true, "bPaginate" : true, "bServerSide" : true, "sServerMethod" : "GET", "sAjaxSource" : "${pageContext.request.contextPath}/emi/calculate?jsonValue=" + jsonData, "sAjaxDataProp" : "", "fnRowCallback" : function(nRow, aData, iDisplayIndex) { $("td:first", nRow).html(iDisplayIndex + 1); return nRow; }, "aoColum

Join the discussion →

Install apache cloudstack Management Server

I'm trying to install apache cloudstack management server on centos 6.9. As instructions provided i've configured yum repository with; *[cloudstack] name=cloudstack baseurl=http://cloudstack.apt-get.eu/centos/6/4.9/ enabled=1 gpgcheck=0* Now when I'm going to install management server with command; *yum install cloudstack-management* I get the message; *Loaded plugins: fastestmirror, refresh-packagekit, security Setting up Install Process Loading mirror speeds from cached hostfile * base: mirrors.btte.net * extras: mirrors.zju.edu.cn * updates: mirror.bit.edu.cn base | 3.7 kB 00:00 cloudstack

Join the discussion →

xlPasteValues and xlPasteFormats at the same time

I am copying a range and then pasting its values and formats to another range: ws5.Range("F3:N" & xCell).SpecialCells(xlCellTypeVisible).Copy ws16.Cells(Rows.Count, "B").End(xlUp).Offset(4, 0).PasteSpecial xlPasteValues ws16.Cells(Rows.Count, "B").End(xlUp).Offset(4, 0).PasteSpecial xlPasteFormats Is it possible to do these two paste actions in one action without using With? I would like to increase the speed of my macro and that kind of small reduction might help me. Is there something like .PasteSpecial xlPasteValues and xlPasteFormats? I found link but even this answer is using With, which

Join the discussion →
Older stories