2018-10-22         Myrna

Error when using collect_list in Spark Structured Streaming

I have two versions of Spark code. The first uses structured streaming with a Kafka source:dfStream.printSchema()//root//|-- dt: string (nullable = true)//|-- ip: string (nullable = true)//|-- device: string (nullable = true)val dfWindowed = dfStream .groupBy($"ip") .agg(concat_ws(",", collect_list($"device")).alias("devices")) .writeStream .outputMode("complete") .format("memory") ...

 apache-spark                     2 answers                     87 view
 2018-10-22         Myrna

Recode into new variable conditional on values in two other variables

I would like to be able to create a new variable based on specific values in two existing variables. My dataframe looks like:structure(list(id = structure(c(1L, 2L, 3L, NA, NA, NA), .Label = c("blue", "red", "yellow"), class = "factor"), value = c(-4.3, -2.5, -3.6, NA, NA, NA)), .Names = c("id", "value"), row.names = c(NA, -6L), class = "data.frame")I would like to create a new column that contains only those values that pertain to blue (e.g., 4.2). All other values would result in NA, like so:structure(list(id = structure(c(1L, 2L, 3L, NA, NA, NA), .Label = c("blue", "red"...

 r                     1 answers                     2 view
 2018-10-22         Myrna

'CGRectGetMaxX' has been replaced by property 'CGRect.maxX' swift error

I am creating a mobile game application and I keep receiving the error 'CGRectGetMaxX' has been replaced by property 'CGRect.maxX' when I am attempting you use the code:if spaceship.position.x > CGRectGetMaxX(gameArea) - spaceship.size.width/2 { spaceship.position.x = CGRectGetMaxX(gameArea) - spaceship.size.width/2}Any ideas on how to fix this issue... I know it tells me that it is replaced however when I attempt to use the new method it doesn't workThanks! when I attempt to use the new method it doesn't workThat's your problem. It isn't a method, it's a proper...

 swift                     1 answers                     77 view
 2018-10-22         Myrna

baffling python datetime.strptime() "does not match format" error

I have a Django project that is running on a live CentOS production server. I last updated code about 9 days ago, and everything had been working fine until today. Suddenly, I started getting a baffling error that makes no sense. Here is my traceback:[Fri Nov 04 18:43:00 2016] [error] File "/usr/lib/tethys/src/tethys_apps/tethysapp/hydroshare_gis/utilities.py", line 1196, in res_has_been_updated[Fri Nov 04 18:43:00 2016] [error] db_date_obj = datetime.strptime(db_date.split('+')[0], '%Y-%m-%dT%X.%f')[Fri Nov 04 18:43:00 2016] [error] File "/usr/local/lib/python2.7/_...

 python                     1 answers                     81 view
 2018-10-22         Myrna

How to integrate Alexa Rank API/gem with Ruby on Rails?

I'm new to rails. I'm trying to integrate Alexa Rank API into my application. I don't know how to proceed? I did my best here, and it gives error:- NameError: undefined local variable or method `access_key_id' for #Any one tell me , how to consume a third party API like this into rails application. It would be greatful.I need to build a web ranking site with graph analysis.Here is my code:- Client.rbclass Client < ActiveRecord::Base attr_reader :access_key_id, :secret_access_keydef self.find_rank(site_name) look_rank = Alexa::Client.new(access_key_id , secret_...

 ruby-on-rails                     1 answers                     28 view
 2018-10-22         Myrna

how to change strings/labels in a csv file

My code is given below. I have a input_df.csv file as given below: input_df = [time:[1,2,3,4],v1=[10,20,30,40],p1=[1,2,3,4],v2=[10,20,30,40],p2=[1,2,3,4]]I want to change the title of two strings in above dataframe. That is, p1 and p2 to i1, i2. I tried following way: import re with open('input_df.csv', 'r') as f: my_csv_text = f.read()new_csv_str = re.sub('p1', 'i1', my_csv_text)new_csv_str1 = re.sub('p2', 'i2', my_csv_text)with open('modifiedInput_df.csv', 'w') as f: f.write(new_csv_str),f.write(new_csv_str1)with open('modifiedInput_df.csv', 'w') as f: f.writ...

 regex                     1 answers                     30 view
 2018-10-22         Myrna

In react, how to target specific table row with onChange event?

I have table that contains multiple rows and has a dropdown for the last column on each row which contains 3 values Incomplete, Fail, and Pass. If the dropdown is selected to Pass then I need to show checkmark icon, and if the dropdown is selected to Fail, then bug icon would show up.The above logic seems to be working fine. What I am struggling with is how do I target the specific row of the table only and not have any affect on the other rows. I only want to show the icon to the row that I am targeting (in this example, row 1).For example, this is what my current table lo...

 javascript                     1 answers                     8 view
 2018-10-22         Myrna

Is it possible to send js variables to google sheets? (Not form data)

I have some variables that get created depending on what a user selects on my web app. I want to send those variables to a google sheet - is this possible? I already send data from a form to google sheets. Because the variables get created at the same time a user submits the form I want to put the form data as well as those variables into the sheet.Here is the current js (left form html out to be concise):$('#CompleteOrder').on('click', function(event){ event.preventDefault(); const scriptURL = 'https://script.google.com/macros/...

 javascript                     2 answers                     46 view
 2018-10-22         Myrna

Find only those ID's where color are same on all rows

id color1 Yellow1 Pink2 Yellow2 blue3 Yellow3 Yellow4 RedWant only those ID's where color are same for all rows.Have tried multiple way but didn't get any answer.;WITH CTE AS (select ROW_NUMBER() OVER(PARTITION BY A.ID,A.COLOR ORDER BY A.ID,A.COLOR)RNO,A.ID,A.COLOR from COLOR a join COLOR b on a.id = b.id and a.color=b.color)SELECT DISTINCT ID, COLOR FROM CTE --WHERE RNO > 1SELECT *FROM color a join ( SELECT id, color, count(*) as qty FROM color GROUP BY id, color HAVING COUNT(*) > 1) b on a.id = b.id and a.color = b.colorselect * from (Sele...

 sql                     2 answers                     2 view
 2018-10-22         Myrna

GrooVY Sql :: how call a stored function that returns a ORACLE cursor

I have a package create or replace package core_utils is TYPE CONSULTA IS REF CURSOR; function getCursor(par in varchar2 default null) return core_utils.CONSULTA;end core_utils;create or replace package body core_utils is function getCursor(par in varchar2 default null) return core_utils.CONSULTA is c core_utils.CONSULTA; begin OPEN c FOR select d.aplicacio,d.nom from variables_def d where d.global='S' and d.nom like par order by d.nom; return c; end;end core_utils;the call will be like ..@Gr...

 sql                     1 answers                     75 view
 2018-10-22         Myrna

Wordpress - echo implode

I've got the following snippet to grab all the terms of the taxonomy available for the post.$tags = get_the_terms( $post->ID, 'books' );if( $tags ) : ?><div class="listing-tag-list"> <?php foreach( $tags as $tag ) : $tag_link = esc_url( get_term_link( $tag ) ); $tag_output = ''; $tag_output .= '<a href="' . $tag_link . '" class="listing-tag">'; $tag_output .= '<span class="tag__text">' . $tag->name . '</span></a>'; echo $tag_output; endforeach; ?> </div> <?php endif;My problem...

 php                     2 answers                     35 view
 2018-10-22         Myrna

How can get User Session token from getstream.io?

I want to add reactions to my Stream App. I saw this:var userToken = client.createUserSessionToken(userId);from stream documentation. I don't understand how to get this token. Do we have to make our own method for getting it or getstream.io has createUserSessionToken() method inbuilt. Can anybody confirm. Can I get one simple example how to get User Session Token.Thanks in advance.... You need to generate a user session token on your server and send it to the client.First connect to getstream on your server (use your apiSecret here, but not on the client):const client =...

 c#                     1 answers                     10 view
 2018-10-22         Myrna

How do mail filter applications work to move messages between mailboxes?

I want to create a spam filter similar to Boxtrapper, SpamArrest, Gafana, and Boxbe. I need to move the message to a different folder depending on custom rules. I looked into the following, but it's not clear how to indicate to Postfix to move the message. Most filter protocols only allow to accept or reject the message, without any way to move messages. I saw Sieve allows rules processing to move mail, but doesn't allow running custom programs. Milter: http://www.postfix.org/MILTER_README.html - No way to move messages. Only return action of accept, reject, tempfail, or qu...

 postfix-mta                     1 answers                     18 view
 2018-10-22         Myrna

Windows Azure Web Role to Upload File to Blob Storage

I'm looking for an up-to-date tutorial or code sample showing how to create a web role which contains a field and button which allows the user to upload a file to Azure Blob Storage. I would take a look at this walk-through (http://msdn.microsoft.com/en-us/library/gg651129.aspx) to get a feel on how to accomplish what you need. This is a console example, but, it should be trivial to translate it to a web based approach. [XXX]Take a look at the very first hands-on lab in the Windows Azure Platform Training Kit, titled "Introduction to Windows Azure." This lab builds an...

 azure                     2 answers                     82 view
 2018-10-22         Myrna

Cosmos DB with multiple partition keys

We're looking at potentially using a single Cosmos DB collection to hold multiple document types in a multi-tenanted environment using a tenant ID as the partition key. The path to tenant id may change in each document type and I am therefore looking at various was of exposing the partition key to Cosmos DB to enable correct partitioning / querying.I have noticed that the Paths property of DocumentCollection.PartitionKey is a collection and was therefore wondering whether it is possible to pass multiple paths during the creation of a document collection and what the behavio...

 azure                     2 answers                     45 view
 2018-10-22         Myrna

CSS - align text to div

I'm struggling with aligning text to div. I currently have this:But I want to achieve this (I have just edited a screenshot to show you what I mean):My code looks as follows:HTML<div class="regionHeader"> <div class="regionArrow"></div> <h2>Some long header that should be aligned to the left next to the div with arrow</h2></div>CSS.regionHeader { border-bottom: 1px solid #ffd800; cursor: pointer;}.regionArrow { border-right: 4px solid #ffd800; border-bottom: 4px solid #ffd800; width: 13px; height: 13px; transfor...

 html                     1 answers                     88 view

Page 1 of 146  |  Show More Pages:  Top Prev Next Last