2018-10-22         Bernie

Comparing values in a data frame based on a column and if values are different concatenating them and deleting the other row in R

I have a dataset which looks something like this:https://i.stack.imgur.com/5W0HU.pngI want to compare all columns based on 'Agentdepartment'. If values are same, then pick it up as it is, if different then concatenate both the values via a '/', and then delete the lower row. In case of NA, I don't want them to be coalesced,i.e if one columns has Null and other non null, keep the non null value.If both are having NULL then keep NULL. So I want a single row for every department. This is how I want my final dataset to look like:https://i.stack.imgur.com/8B819.pngI found a solu...

 r                     1 answers                     15 view
 2018-10-22         Bernie

CSS transition doesnt play

I am building an image slider where an image should slide in from either left or right depending on which button is pressed. The images have the following CSS:opacity:0;left:0;transition:.7s ease-in-out;transition-property:opacity,left;display:none;This is the part of my code that is moving the images in:newimage.style.left = factor * 100 + '%';newimage.style.display = 'block';setTimeout(function(){ newimage.style.left = '0%'; newimage.style.opacity = 1;},0)factor is either 1 or -1 depending on the direction it is coming in from, so the left property is either 100% or...

 javascript                     1 answers                     52 view
 2018-10-22         Bernie

Can we use camera2 API to access Canon DSLR camera

I would like to take a picture from DSLR camera by using android device. Is it possible that I can use camera2 API for this? Android camera2 API supports USB webcams if the V4L drivers match. Even for these, bandwidth is often the bottleneck, because I have not yet seen Android OTG (USB Host-mode) with USB3 performance. USB2 is not capable of passing full HD video at 30FPS.Worse with DSLR camera. Even if it has V4L-compliant USB interface, it is probably tuned for the highest edge, not the mediocre USB2 capabilities of Android hosts. [XXX]While several dSLR cameras do...

 android                     2 answers                     57 view
 2018-10-22         Bernie

Image upload goes to "None" folder in django

I'm trying to upload an image via ajax. The image uploads well, but it is delivered inside a "None" folder, between the MEDIA_ROOT value and upload_to parameter of ImageField.My current settings are as follows: MEDIA_ROOT = (os.path.join(BASE_DIR, 'static', 'media'))Inside my app's models.py:image = models.ImageField(blank=True, null=True, upload_to=get_image_path)anddef get_image_path(instance, filename): return os.path.join(connection.tenant.schema_name, 'img', 'devices', filename)When I upload the image, it goes to static/media/None/(tenant.schema_name)/img/devices, i...

 python                     2 answers                     31 view
 2018-10-22         Bernie

Converting Normalized Vertex to Vertex in Google Cloud Vision

Any idea how can I convert Normalized Vertex to Vertex? Normalized Vertex gives me relative position on an image whereas the Vertex returns coordinates based on the scale of the image. I have a set of Normalized Vertex that I would like to convert it to regular Vertex. https://cloud.google.com/vision/docs/reference/rest/v1p2beta1/images/annotate#normalizedvertex If you know the size of your image (it's width and height), you can simply multiply it with your NorrmalizedVertex.You should multiply the x field of your NormalizedVertex with the width of the picture to get the...

 google-cloud-vision                     1 answers                     2 view
 2018-10-22         Bernie

book count per author for filtered book list in django

Short question.I have two models:class Author(models.Model): name = models.CharField(max_length=250)class Book(models.Model): title = models.CharField(max_length=250) author = models.ManyToManyField(Author)One view:def filter_books(request): book_list = Book.objects.filter(...)How can I display in template next content:Authors in selected books: Author1: book_count Author2: book_count ... Let's build the query step by step.First, get the authors who have a book in book_list.authors = Author.objects.filter(book__in=book_list)The trick is to realise th...

 django                     2 answers                     36 view
 2018-10-22         Bernie

Entity Framework 6 or Core - Read query result with a "DataReader" like pattern

is there a way to get a LINQ query result on a EF DBContext as a 'Typed Data Reader', in sucha a way that when i am reading de IQueryable result (ex with a .ToList()) I don't put all the result in memory?I am expecting something like this (or equivalent):var personQueryResult=dbContext.People.Where(…).Select(…).AsDataReader();foreach(person in personQueryResult){ //Here I expect that person is typed of the People Dbset<T> type, ex. a Person type and i can do:person.Name="...";person.Surname="...";//etc.} There is not an explicit method that ensure you that that t...

 entity-framework-6                     1 answers                     76 view
 2018-10-22         Bernie

Ruby on Rails Editor for Windows

I love to use Textmate on my Mac at home but have a hard finding somehing to use at work (windows). What is the best editor to use for Ruby on Rails on windows that get you the closest look and feel to Textmate? You should try Intype. It is in the alpha stage, and currently does not have all the functions of TextMate, but it looks very promising. Take a look at the blog, the forums, and download the "unstable releases". I currently use it every day on Windows for Ruby on Rails development and I am eager to test the next alpha release. [XXX]E-Text Editor. Even compati...

 ruby-on-rails                     26 answers                     96 view
 2018-10-22         Bernie

Update SQL Server stored procedure - switch columns in the parameters

I am trying to create a basic stored procedure as below:SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOALTER PROCEDURE [dbo].[spUpdate1] @registration_id NCHAR(8), @registration_status INTASBEGIN UPDATE dbo.Test1 SET Registration_Status = @registration_status WHERE Registration_id = @registration_id;ENDThis stored procedure works without issue, however the registration_id isn't the parameter I would like to pass in.I have a three columns in my table: Reference_Number, Registration_id, Registration_StatusI would like to be able to pass in the Reference_Number as...

 sql                     2 answers                     66 view
 2018-10-22         Bernie

Package Validation Error

I'm trying to use a foreach loop container to import several excel files into a table, I specified the folder and the files I'm going to use (*.xls), after that I created a path variable then I went to the excel source connection and in the "Expression" property I selected the variable. I created the foreach container but, the excel source's connectionString only shows Provider=Microsoft.Jet.OLEDB.4.0;, so it means it's not taking the variable value. What can I do to solve that? Note: I'm using SQL Server 2012ADDITIONAL INFORMATION:Error at Data Flow Task [Excel Source [20]...

 sql-server                     2 answers                     78 view
 2018-10-22         Bernie

Hazelcast query to get Map based on keyset and predicate

I have a hazelcast IMAP which looks likeIMAP = key -> val1, val2, val3indexed on val1, val2I am trying to get say key->val2 given the set of KeyshzObj.getMap("testMap").getAll(keys.toSet.asJava)which returns the key->val1, val2, val3Need help to write predicate which says to return only key->val2Please help @nocturnal, please see example usage below:imap.project(Projections.singleAttribute("val2"), Predicates.in("__key", new String[]{"key1, key2"}));One important note, that'll require you to define an index on key as well.Since this will be using query threads, ...

 hazelcast                     2 answers                     82 view
 2018-10-22         Bernie

Adding Angular Template Web App To Azure Service Fabric Cluster?

I have created a .NET Core web API service using service fabric. How can I add an angular front-end to the service fabric cluster. I want to add the web application as a independent service, and do not want to use the .NET Core + Angular template.One of the steps I have already researched and tried was creating an empty service container and adding a new angular template to it. The cluster doesn't recognize it as a service and it didn't do me any good. Is anyone familiar with adding a web template as a service with service fabric? For Azure Web App please follow John Pa...

 .net                     1 answers                     69 view
 2018-10-22         Bernie

Are the Amazon 'cloud' services viable as web hosting options?

I am a keen follower in news related to Amazon S3. It seems to be reliable, scalable and a cheap service.However, web hosts do not seem to be overly scared. I have not noticed any major drops in prices since Amazon and Google released their 'Cloud' based platforms.Is there a reason for this? Or are web developers simply not aware of the possibilities behind Amazon's offering yet? Both S3 and EC2 provide slightly different services than the typical web hosting package. S3 - Simple Storage Service, used for scalable file storageEC2 - Elastic Compute Cloud, used for scalab...

 amazon-s3                     3 answers                     77 view
 2018-10-22         Bernie

How to make UI changes while loading next screen in Xamarin.Forms

I have a screen that takes some time to load. All I want to do is display a simple "Now Loading" message before the next screen loads. How do I achieve this? Here is the code I currently have trying to accomplish this:void BT_User_Clicked(object sender, EventArgs e) { // Start a new task (this launches a new thread) var t = Task.Run(() => { // Do some work on a background thread, allowing the UI to remain responsive Navigation.PushAsync(new UserList()); }); BT_User.IsEnabled = false; BT_Use...

 c#                     1 answers                     89 view
 2018-10-22         Bernie

Relocation compiling issue with shared flags

I have a program in C that uses the GSL to integrate an ODE system, and store the resulting data in arrays. The code is at the end of the question, but as you'll see it's not really the issue here. Secondary to the C code, I use a Python script to pass the array pointers into the C code using ctypes, since I later want to plot and manipulate the array data. All of which is fine, it worked with small test programs. But to do so, I need to create a shared library using gcc. Here's where things go wrong. When I compile with gcc ctest.c -o ctest.o -std=c11 -Wall -g -lgsl -...

 c                     1 answers                     72 view
 2018-10-22         Bernie

These two codes should do exactly the same thing, but the first one doesn't work as I expect

PythonPlease explain why these two codes work differently..Actually I am trying to make kind of AI where in initial generations the individuals will go in random directions. For keeping the code simple I have provided some random directions in Brain myself.There is an Individual class that gives a brain to the individual. It also has a function that returns a child with EXACTLY the same brain (means same directions to go in) as the parent.I have two codes:First: When some directions is changed in the parent, the same thing is changed in the child too (or if changed in child...

 python                     2 answers                     16 view

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