Posts

Showing posts from September 5, 2018

Error: Program type already present, when adding QR reader module [duplicate]

Image
Clash Royale CLAN TAG #URR8PPP Error: Program type already present, when adding QR reader module [duplicate] This question already has an answer here: I've added the following line to my build.gradle: implementation 'com.journeyapps:zxing-android-embedded:3.5.0' implementation 'com.journeyapps:zxing-android-embedded:3.5.0' and then got this Error when trying to build the project: Error: Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver Can anyone explain the meaning of that error This is my entire current build gradle: apply plugin: 'com.android.application' android compileSdkVersion 28 defaultConfig applicationId "com.example.chaimovy.myapplication" minSdkVersion 15 targetSdkVersion 28 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" multiDexEnabled true buildTypes release minifyEnabled false proguardFiles getDefaultProguard...

Error when creating association with polymorphic nested attribute

Image
Clash Royale CLAN TAG #URR8PPP Error when creating association with polymorphic nested attribute I have three models. Customer , Address , and CreditMemo . Customer Address CreditMemo Originally, I had a non polymorphic model Address and I changed it to polymorphic when I created CreditMemo so they could both share the same model. Since then, when I try to create a record with a different parent type than Customer , I get a validation error saying the Customer parent doesn't exist. Address CreditMemo Customer Before I created CreditMemo I simply had a 1-to-many association between Customer and Address . Here is the migration I made to change Address to polymorphic. CreditMemo 1-to-many Customer Address Address class MakeAddressPolymorphic < ActiveRecord::Migration[5.1] def up rename_column :addresses, :customer_id, :addressable_id add_column :addresses, :addressable_type, :string add_index :addresses, [:addressable_id, :addressable_type] Address.reset_column_infor...

Reactjs! Make Span tag clickable

Image
Clash Royale CLAN TAG #URR8PPP Reactjs! Make Span tag clickable Reactjs! I am trying to make span tag clickable only where it says person.name(It should display $person.name in blue) and when it clicks i want to display a popup box which helps to edit the name.Please Help. <span> &nbsp;(&nbsp; `$person.name,$person.address ` &nbsp;) </span> 1 Answer 1 You can add onClick to a span and call your function. Something like this: (i have also added the styles. You can replace the hardcoded "name" with state ) const clickspan1 = () => alert('name'); return ( <div className="App"> <h1>Hello CodeSandbox</h1> <h2>Start editing to see some magic happen!</h2> <span style=color:'blue',cursor:'pointer' onClick=clickspan1 >Name</span> <span>address</span> </div> ); } By clicking "Post Your Answer", you acknowledge that you have read our u...

Why does pycharm occupies more and more memory while debugging a TensorFlow program?

Image
Clash Royale CLAN TAG #URR8PPP Why does pycharm occupies more and more memory while debugging a TensorFlow program? I followed (sentdex's Youtube video) to create a TensorFlow program and it worked well. I started to tweak some parameters(converting all float32 to float 16 to try to make it faster) in it and got errors. So I tried to debug it with Pycharm. Then I discovered that during debug, even if I was pausing on one line and there was no other process running at the same time, python2.7 keeps occupying more and more memory until it hits 100% and my computer freezes. Is it that TensorFlow should not be debugged this way? Or is it that something else is wrong? import tensorflow as tf import time import numpy as np from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("/tmp/data/", one_hot=True) n_node_hl1 = 500 n_node_hl2 = 500 n_node_hl3 = 500 n_classes = 10 batch_size = 100 x = tf.placeholder(tf.float16, [None, 784]) y = tf.p...

Brewing up custom ML models on AWS SageMaker

Image
Clash Royale CLAN TAG #URR8PPP Brewing up custom ML models on AWS SageMaker Iam new with SageMaker and I try to use my own sickit-learn algorithm . For this I use Docker. I try to do the same task as described here in this github account : https://github.com/awslabs/amazon-sagemaker-examples/blob/master/advanced_functionality/scikit_bring_your_own/scikit_bring_your_own.ipynb My question is should I create manually the repository /opt/ml (I work with windows OS) ? /opt/ml Can you explain me please? thank you 1 Answer 1 You don't need to create /opt/ml , SageMaker will do it for you when it launches your training job. /opt/ml The contents of the /opt/ml directory are determined by the parameters you pass to the CreateTrainingJob API call. The scikit example notebook you linked to describes this (look at the Running your container sections). You can find more info about this in the Create a Training Job section of the main SageMaker documentation. /opt/ml By clicking ...

how to connect to DB and retrieve the rows in python

Image
Clash Royale CLAN TAG #URR8PPP how to connect to DB and retrieve the rows in python I am using python 3.7 and Mysql DB How to connect to mysql DB and retrieve the first four column data using python shell scripting. welcome to stackoverflow. Please show what you have tried. code – Ajay Bisht 22 secs ago By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

What does “WithEvents variable” mean in VB?

Image
Clash Royale CLAN TAG #URR8PPP What does “WithEvents variable” mean in VB? I use Visual Studio using language: VB in the case to run my code I come up with this errors : I tried to run this code: Public Class Form1 Dim firstNumber As Single Dim secondNumber As Single Dim answerNumber As Single Dim arithmeticprocess As String Private Sub button1_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox1.Text = TextBox1.Text & 1 End Sub Private Sub button2_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Text = TextBox1.Text & 2 End Sub Private Sub button3_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox1.Text = TextBox1.Text & 3 End Sub Private Sub button4_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click TextBox1.Text = TextBox1.Text & 4 End Sub Private Sub button5_click(...

AUDIO/VIDEO: Unknown MIME type. Internet Explorer playing MP4

Image
Clash Royale CLAN TAG #URR8PPP AUDIO/VIDEO: Unknown MIME type. Internet Explorer playing MP4 The video plays on other browsers like google chrome, firefox except for internet explorer which is the one I need. I tried solving the problem using other forms but cannot solve it. else if (ViewBag.mediatype == "Video") <video width="450" height="600" controls autoplay loop> <source src="@Url.Action("Video", "Suspicious", new filename = ViewBag.MediaFile )" type="video/mp4" /> <source src="@Url.Action("Video", "Suspicious", new filename = ViewBag.MediaFile )" type="video/quicktime" /> </video> Welcome to SO. Please provide a Minimal, Complete, and Verifiable example. Show us the code for your latest attempt and where you got stuck. and explain why the result is not what you expected. stackoverflow.com/help/mcve – Dragonthoughts Aug 10 at 15:45 ...

Create an object of the same class within the class

Image
Clash Royale CLAN TAG #URR8PPP Create an object of the same class within the class I want to have an object of a class within a class, because I need to pass it to a method, similarly to the example below. I would like the example below to print out 1, or fooObj.fooNum, but I keep getting a NameError: name 'foo' is not defined . NameError: name 'foo' is not defined class bar: def fooDef(self, fooObj): print fooObj.fooNum class foo: fooNum = 1 b = bar() f = foo() b.fooDef(f) Why are you placing that code inside the foo class definition at all? – user2357112 Aug 10 at 16:36 foo It should work if you reference foo from foo.__init__() , but not as a Class variable. I think. – Alastair McCormack Aug 10 at 16:38 foo foo.__init__() This appears to be invalid class design: you have class-level code in foo that tries to create an object of its own class (without an initialization), pass the object to an instance method of bar , and then access ...

Xsl with an if statement + add something to a variable

Image
Clash Royale CLAN TAG #URR8PPP Xsl with an if statement + add something to a variable I am trying to show an output where the total_p_calib is a value of an for cycle where I have an if statement that compares my values to see if sum(clb:quantidade) &lt; ../../clb:quantidade is equal and if it's not I would like to put the difference between both in a variable and show it in the end of the for cycle. total_p_calib sum(clb:quantidade) &lt; ../../clb:quantidade XML file <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="style_macaMoimenta.xsl"?> <moimenta xmlns="http://www.macamoimenta.pt/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gnr="http://www.macamoimenta.pt/general" xmlns:clt="http://www.macamoimenta.pt/lote" xmlns:prc="http://www.macamoimenta.pt/precario" xmlns:clb="http://www.macamoimenta.pt/calibragem" xs...

How do I properly add an NPM package to my Kibana 6.2.3 plugin?

Image
Clash Royale CLAN TAG #URR8PPP How do I properly add an NPM package to my Kibana 6.2.3 plugin? I started using a simple NPM package (timemachine) in my Kibana plugin. I did npm install timemachine on my machine, and everything works fine in my dev Kibana environment. npm install timemachine Deploying the plugin to a real Kibana (6.2.3), timemachine doesn't exist. I tried adding "timemachine": "0.3.0", to the package.json in my plugin, but that didn't help. timemachine "timemachine": "0.3.0", package.json What's the proper way to add it? By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Putting a JSON result within []

Image
Clash Royale CLAN TAG #URR8PPP Putting a JSON result within I am trying to add values from a JSON API to a MySQL. The problem is that the result return without the , so I cannot foreach it and insert all the values to the database. This is the API URL http://horoscope-api.herokuapp.com/horoscope/today/Gemini This is the code I am having $data = file_get_contents( "https://horoscope-api.herokuapp.com/horoscope/today/Gemini", true); $array = json_decode($data, true); //Convert JSON String into PHP Array foreach($array as $row) //Extract the Array Values by using Foreach Loop $query .= "INSERT INTO zodiac(date, horoscope, sunsign, url) VALUES ( '" . $row["date"]. "', '" . $row["horoscope"]."', '" . $row["sunsign"]."', '" . $row["sunsign"]."' ); "; // Make Multiple Insert Query If I combine $data = "[$data]"; (with and without the quot...

Pulling Vars from lists and applying them to a function

Image
Clash Royale CLAN TAG #URR8PPP Pulling Vars from lists and applying them to a function I'm working on a project in my work using purely Python 3: If I take my scanner, (Because I work in inventory) and anything I scan goes into a text doc, and I scan the location "117" , and then I scan any device in any other location, (the proceeding lines in the text doc "100203") and I run the script and it plugs in '117' in the search on our database and changes each of the devices (whether they were assigned to that location or not) into that location, (Validating those devices are in location '117') My main question is the 3rd objective down from the Objectives list below that doesn't have "Done" after it. Objective: Pull strings from a text document, convert it into a dictionary. = (Text_Dictionary) **Done** **Done** Assign the first var in the dictionary to a separate var. = (First_Line) **Done** **Done** All proceeding var's gr...

What is the difference between Router and Annotated Controllers?

Image
Clash Royale CLAN TAG #URR8PPP What is the difference between Router and Annotated Controllers? I'm using WebFlux for Web development. And I find 2 ways to express request mappings. @Controller @RestController RouterFunction RouterFunction HandlerFunction I find the second harder to use than the first and also I do not know the difference between them. So I wanted to ask which performs better 2 or 1 ? Thanks my friends! '@RestControlle' = '@Controller' + '@ResponseBody' by default on methods – Errabi Ayoub Aug 10 at 14:24 Yes,right.I'm just giving an example. – MrXionGe Aug 11 at 14:58 2 Answers 2 Let me start with your last question Is 2 better than 1, in performance? No, there is no difference in the performance. I find that 2 is harder to use than 1 That is absolutely based on individual preference. May be you are used to imperative style of programming. And hence you feel it easy to write(Trust me after a while you would f...

Aggregate data frame rows based on conditions

Image
Clash Royale CLAN TAG #URR8PPP Aggregate data frame rows based on conditions I have this table A B C E 1 2 1 3 1 2 4 4 2 7 1 1 3 4 0 2 3 4 8 3 Now, I want to remove duplicates based on column A and B and at the same time sum up column C. For E, it should take the value where C shows the max value. The desirable result table should look like this: A B C E 1 2 5 4 2 7 1 1 3 4 8 3 I tried this: df.groupby(['A', 'B']).sum()['C'] but my data frame does not change at all as I am thinking that I didn't incorporate the E column part properly...Can somebody advise? df.groupby(['A', 'B']).sum()['C'] Thanks so much! Is it the table from DB? By which field you want to group rows? – Daniil Mashkin Aug 10 at 6:41 I want to group by all columns except the first(pandas index) and last (non unique). At the same time the values of the last column needs to be summed, so the first data entry in aggregated form should show the value 12 in...