2018-10-22         Cleveland

How do you remove a role from a user?

I'm trying to remove a role from a user with a command but I'm not quite sure how the command works. Here is the code:@bot.command(pass_context=True)@commands.has_role('staff')async def mute(ctx, user: discord.Member): await bot.remove_roles(user, 'member') await bot.say("{} has been muted from chat".format(user.name)) It looks like remove_roles needs a Role object, not just the name of the role. We can use discord.utils.get to get the rolefrom discord.utils import get@bot.command(pass_context=True)@commands.has_role('staff')async def mute(ctx, user: discord.Membe...

 python                     1 answers                     6 view
 2018-10-22         Cleveland

C++: Parameter type that requires inheritance from few interface-like classes

I want to be able to create non-template function that requires type of class to be inherited from few another classes.Something like thatclass A1{};class A2{};class A3{};class B: public A1, public A2, public A3{};class C: public A1, public A3{};void Foo(const C&){}int main(void){ B b; C c; Foo(b); // error. But B inherited from A1 and A3, so I want to be able pass it Foo(c); // ok return 0;}I will glad to hear any suggestions to solve the problem.Note: some languages like Swift and Objective-C have this functionality as part of the language calling 'conf...

 c++                     2 answers                     81 view
 2018-10-22         Cleveland

Will PDO's LastInsertID Break AWS Replication?

Does the PDO lastinsertid function use MySQL's last_insert_id function?I'm particularly interested in replication with AWS and per the AWS manual using some MySQL functions break replication: Other common situations that can cause replication errors include the following:...Using unsafe nondeterministic queriesThe mysql manual states that the functions I'm using aren't actually unsafe though: Nondeterministic functions not considered unsafeI plan to rewrite my now() usages but am not sure how I can avoid the last_insert_id since PDO, not I, am querying that. I can't do a...

 mysql                     1 answers                     50 view
 2018-10-22         Cleveland

Form Spacing justify-content-between one <div> to left and one <span> to the right

Hi I am trying to align the label tag, text and submit input types to the left and align the 17 total orders to the right side of the page aligned vertically with the Date label and horizontally right aligned with the end of the paragraph tag "Shipping List is Finalized Everyday at 5pm EST".So far I have gotten the label tag and two input tags aligned where I would like them, but the span tag is not aligning completely to the right side. I am using bootstrap 4.1.1.Here is my code:.main { margin: 15px 0;}.btn-appear { color: #000000; background-color: #e6e6e6; border: 3...

 html                     2 answers                     82 view
 2018-10-22         Cleveland

IOS - Rich push duplication after being handled by clicking on UNNotificationAction

After the rich push is handled in the background (user clicked on an UNNotificationAction without opening the app - no foreground)), then when you enter the app, there is a duplicate push event resulting in "didReceiveRemoteNotification" execution.My question is:Why when I handle the rich push in:func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {and call competionHandler(), same push is being received in:func application(_ application: UIApplication,...

 ios                     1 answers                     25 view
 2018-10-22         Cleveland

Javascript tabs using data attributes rather than IDs to link button and tab

I'm wanting to create a variation of Javascript tabs using data attributes rather than IDs to link the tab and the content.Here's how it should work:Clicking a <button class="tab" data-tab-trigger="1"> adds a class of is-active and removes any is-active classes from all other button elementsThe value of data-tab-trigger matches the value of data-tab-content on the corresponding <div class="tab-content" data-tab-content="1"> and should add a class of is-open to itThe is-active class highlights the active tab and the is-open class shows the related tab contentHere...

 javascript                     1 answers                     49 view
 2018-10-22         Cleveland

pass argument when opening another python file as a module?

I'm remaking a game in python and the menu file and the game file are separate. The menu imports the game file as a module and calls it when requested. However I want variables that determine the sound and difficulty to be passed through from the menu file to the game file, as these options are chosen by the user in the menu.I'm not sure how to do this at all, so here is how i import and call the python game file:import SpaceInvadersSpaceInvaders.SpaceInvaders().mainLoop()and I want to pass the arguments 'sound' and 'difficulty' through, whose values are strings.also i call...

 python                     2 answers                     82 view
 2018-10-22         Cleveland

BigQuery Session & Hit level understanding

I want to ask about your knowledge regarding the concept of Events. Hit level Session Level How in BigQuery (standard SQL) how i can map mind this logic, and also SessionsEvents Per Session Unique Events Please can somebody guide me to understand these concepts? totals.visitors is Session sometime visitId is taken as Session to achieve that you need to grapple a little with a few different concepts. The first being "what is a session" in GA lingo. you can find that here. A session is a collection of hits. A hit is one of the following: pageview, event, social interaction...

 sql                     2 answers                     63 view
 2018-10-22         Cleveland

Populate RowSource and RecordSource without a persistent db connection

As the title suggests, I wondered if it was possible to populate a RecordSource or RowSource without maintaining a persistent connection to the external database I am querying.I have tried two methods listed below to no avail: IN Clauseps.RecordSource = " SELECT TM_Adjudicator AS Adjudicator, Nz(Sum(PS_DB_view.PS_Points+PS_DB_view.PS_Adhoc),0) AS [Total Points] " & _ " FROM SD_Adjudicators_view " & _ " LEFT JOIN PS_DB_view ON (((cstr(SD_Adjudicators_view.TM_Adjudicator) = cstr(PS_DB_view.PS_Adjudicator)) AND cdate(PS_DB_vie...

 sql                     1 answers                     7 view
 2018-10-22         Cleveland

MS SQL Server Query caching

One of my projects has a very large database on which I can't edit indexes etc, have to work as it is.What I saw when testing some queries that I will be running on their database via a service that I am writing in .net is that they are quite slow when ran the first time. What they used to do before is - they have 2 main (large) tables that are used mostly. They showed me that they open SQL Server Management Studio and run a SELECT * FROM table1 JOIN table2query that takes around 5 minutes to run the first time, but then takes about 30 seconds if you run it again without cl...

 sql                     4 answers                     28 view
 2018-10-22         Cleveland

Read and process a batch of messages from Kafka

I would like to read a batch of messages from a kafka topic and at regular time intervals, or when the number of messages read reaches a certain number, send them as a batch to a downstream system. At the moment my kafka topology is terminated by a processor which holds the messages and then processes the batch incrementally using the punctuate method. I'm not sure this is perfect, however, because if the application crashes before the punctuate method is called, I think some messages get lost (i.e. the consumer thinks it has finished with them but they won't appear in the ...

 java                     1 answers                     41 view
 2018-10-22         Cleveland

dotnet publish only one project from the solution in VSTS

We are trying to build one project from a Visual Studio solution in VSTS with .NET Core task. We are able to "dotnet build" that project. But when we try to "dotnet publish" it tries to publish all projects from the solution. Even if we use "dotnet custom", it tries to publish all projects.Is there a way to use .NET Core task to publish only one project or projects that were built? Or should we run a custom command line task?Reason for this is that we have a project that won't build and we don't need/want to publish it. So we would like to build and publish one project and ...

 c#                     2 answers                     28 view
 2018-10-22         Cleveland

How can I make the query work with doctrine1 using symfony 1.4?

I am trying to run the following query using Doctrine 1 with symfony 1.4 but it says Couldn't find class (SELECT with 500 Internal Error. Is there any way I can make it work with Doctrine: SELECT location_id FROM (SELECT DISTINCT location_id FROM location_feature_restriction WHERE feature_restriction_id IN(4,15,16)) as t1 WHERE location_id NOT IN(SELECT DISTINCT location_id FROM location_feature_restriction WHERE feature_restriction_id = 5);Currently I have it like this but it's not working:/** * Search for venues with selected features * @param Doctrine_Query $qry The ...

 mysql                     1 answers                     26 view
 2018-10-22         Cleveland

How to add task in plan through Microsoft Graph API

I want to know how to create task in Planner plan using Microsoft Graph API.Now I'm trying to crate task in planner plan using "Create task" API, but I got UnknownError.{ "error": { "code": "UnknownError", "message": "", "innerError": { "request-id": "2303b87d-fb0c-431c-9336-c93908758d25", "date": "2016-06-28T10:16:56" } }}As the document described I posted to api like this.POST https://graph.microsoft.com/beta/tasksContent-type: application/jsonContent-length: 192{ "assignedTo": "<I set my uuid>", "planId": "&...

 office365                     2 answers                     52 view
 2018-10-22         Cleveland

spark sql date interval sql query not working

The objective I have is to show the data (sourced by a csv file) for every 15 minutes interval per day.The solution I come up is a sql query which is creating the data I need:select dateadd(minute, datediff(minute, 0, cast ([date] + ' ' + [time] as datetime2) ) / 15 * 15, 0) as dateInterval, SecurityDesc, StartPrice, SUM(CAST(TradedVolume as decimal(18,2))) as totalTradedVolume, SUM(cast(NumberOfTrades as int)) as totalNumberOfTrades, ROW_NUMBER() over(PARTITION BY dateadd(minute, datediff(minute, 0, cast ([date] + ' ' + [time] as datetime) ) / 15 * 15, 0...

 sql                     1 answers                     23 view
 2018-10-22         Cleveland

How to parsed all the data in JSON?

First issue I addressed I am working on an APIService using Alamofire, I tried to print the response and the I got the data successfully, but unfortunately the data from JSON turns to nil when I parse it to the attendees Object. How can I reflect the data from json to the attendees object? Second Issue I solved the 1st issue, after all the debugging I had. The codes I used was written in my answer below. I parsed data from JSON going to attendees but as I checked only the first array was fetch. How can I get all the data inside the JSON? Hope you can help me. Thank you.fu...

 ios                     2 answers                     76 view

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