2018-10-22         Miranda

pandas multiple dataframe columns to single datetime index

I have a pandas dataframe (no index) with an awkward arrangement that looks like this, but about 60,000 rows long:YYYYMMDD, HH, DATA20110101, 1, 22020110101, 2, 22020110101, 3, 22020110101, 4, 23020110101, 5, 23020110101, 6, 22020110101, 7, 24020110101, 8, 23020110101, 9, 23020110101, 10, 23020110101, 11, 24020110101, 12, 23020110101, 13, 24020110101, 14, 24020110101, 15, 26020110101, 16, 27020110101, 17, 28020110101, 18, 30020110101, 19, 30020110101, 20, 32020110101, 21, 31020110101, 22, 310201101...

 python-3.x                     1 answers                     91 view
 2018-10-22         Miranda

How can I add a query parameter using Elasticsearch RestHighLevelClient?

How can I add a query parameter using Elasticsearch RestHighLevelClient?For example:/_search/q=style:SBI do not see the option in the SearchRequest class. I think you can't add query parameters in RestHighLevelClient because its main goal is to expose API specific methods, that accept request objects as an argument and return response objects. As RestHighLevelClient is built on top of Low Level REST Client, you can use it to add the query parameters. RestHighLevelClient client = new RestHighLevelClient( RestClient.builder( new HttpHost("localhost", ...

 java                     1 answers                     12 view
 2018-10-22         Miranda

UIView movement

Wich is the best way to move a UIView. I have a custom UIView with some custom things in it, like shadows, labels etc. Today I'm using, for move this UIView.: - (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [[event allTouches] anyObject]; if (self.isEditing) { CGPoint location = [touch locationInView:[rootView view]]; self.center = location; }}Is this the best way to move a UIView? I experience this a bit laggy. I usually reposition a view using the offset between the touchesBegan location and...

 iphone                     1 answers                     65 view
 2018-10-22         Miranda

Vertex with minimal distance to n other vertices

Given a directed, weighted, cyclic graph, and minimal path distance between vertices given by m(x,y), find the vertex v that minimises m(a,v) + m(b,v) + m(c,v) + ... for n vertices a, b, c...For example if the graph was undirected and we wanted the vertex v with minimal paths to vertices a and b, v would just be the vertex in the centre of the minimal path from a to b.I can imagine an approach involving depth traversal etc, but wanted to ask what SO would suggest - Thanks hope this was clear. Now that I am thinking a bit more about it, you should probably look at Bidirec...

 algorithm                     1 answers                     66 view
 2018-10-22         Miranda

How to specify using Python 3's Version of PIP (or why isn't PIP working)

I have a mac that has both Python 2.7.6 installed (by default) and Python 3.4.0 installed (by me).I think that I may also have multiple versions of PIP installed. (When I run PIP --version I get pip 1.5.6 from /Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg (python 2.7)But I know that Python 3 comes with version 1.5.4.So, my questions are:A. How do I find out if I have multiple versions of pip installed.B. If I do have multiple versions installed, how do I specify which one to use, or where the installed packages should go?I have tried the suggestion outlined here (ba...

 python                     1 answers                     61 view
 2018-10-22         Miranda

Merge two or more base64 code in one PDF with PHP

I have two or more variables that have base64 values which are PDFs.Is there anyway that I can merge all my variables and they become one PDF, beacause it is impossible to download more than 1 PDF via HTTP.I will be really thankfull for your answers. Old question but my solution.I found and use http://www.fpdf.org/en/script/script94.phpget base64 data from DB and create temp files, save names in one array.$pdf = fopen ('../tmp/test'.$rowp['id'].'.pdf','w');fwrite ($pdf,base64_decode($rowp['pdf']));fclose ($pdf);array_push($pdfs,'../tmp/test'.$rowp['id'].'.pdf');then for ...

 php                     1 answers                     18 view
 2018-10-22         Miranda

How to use Spring REST Projections with custom controller

I have the following Projection which return a name of a tag: @Projection(types = NewsTag.class, name = "newsTag")public interface NewsTagProjection { @Value("#{target.tag.name}") String getName();}I'm using it in the following repository which is responsible of newsTag model: @RepositoryRestResource(excerptProjection = NewsTagProjection.class)public interface NewsTagRepository extends JpaRepository<NewsTag, Integer> {}so when i call the news repository which have a list of NewsTag: @RepositoryRestResourcepublic interface NewsRepository extends JpaRepository&...

 java                     1 answers                     25 view
 2018-10-22         Miranda

Image in ListView not completely centered

I'm trying to display a list of images in a ListView. I'd like these images to be displayed in the center of the "item".I've tried to achieve this by setting the respective VerticalAlignment and HorizontalAlignment to center. This does not give me the result I want. When an item is selected, you can clearly see a larger "blue" area on the left.Am I missing something?GUI example:My code:<Window x:Class="MyClass.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schem...

 wpf                     1 answers                     61 view
 2018-10-22         Miranda

SQL insert statement in teradata assistant

can anybody help me with this please?I want to insert data in table in Teradata SQL Assistant, but insert only that doesn't exist in the table. I have an ideal how to do it in Microsoft SQL Server but not in teradata as i'm new to it.Any help would be highly appreciated.Thank you This very much depends on your situation. Can you elaborate a little more by answering the following questions? I can then give you my best idea of what to do.Are you inserting into an existing table using a select statement from other Teradata tables, or from a file?Does the table you are ins...

 teradata-sql-assistant                     2 answers                     39 view
 2018-10-22         Miranda

Keeping only newest 10000 Rows from all tables of a database

I am developing an app that operates on a legacy database. Because the size of database is very large, I want to delete all but latest N=10000 rows from every table before I can import this database into my laptop. Following is the code:exec sp_MSforeachtable 'with cte as(select top (CASE WHEN (select count(*) - 10000 from ?) <= 0 THEN 0 ELSE (select count(*) - 10000 from ?) END) * from ?) delete from cte'I am getting the error "Subquery returned more than 1 value..." on many tables. How do I modify this? If we suppose you dont have forey key, you can try Somet...

 sql                     1 answers                     63 view
 2018-10-22         Miranda

C# Delete all checked checkboxes in database

I am having trouble in deleting the checked checkboxes in the database.It shows string was not recognized as a valid boolean on this line:if (bool.Parse(item.Cells[0].Value.ToString()))This is my code for checkingall checkboxes if (checkBox2.Checked == false) { foreach (DataGridViewRow row in dataGridView1.Rows) { DataGridViewCheckBoxCell chk = (DataGridViewCheckBoxCell)row.Cells[0]; chk.Value = chk.TrueValue; } } else if (checkBox2.Checked == true) { foreach (DataG...

 c#                     2 answers                     90 view
 2018-10-22         Miranda

Get first day and last day dates of month of selected date in Marklogic

I am trying to get first day and last day dates of any selected date using MarkLogic.Example: let $date := xs:date("2018-08-24") let $firstDay := "*Should be 1st day of month - of $date*" let $lastDay := "*Should be last day of month - of $date*" return ("$firstDay:",$firstDay,"$lastDay:",$lastDay)Expected Output dates: $firstDay: 2018-08-01$lastDay: 2018-08-31I can able to get this dates by using functx:first-day-of-month($date) andfunctx:last-day-of-month($date) but I wanted to know is there any API or alternative option provided by MarkLogic You can compute ...

 date                     1 answers                     22 view
 2018-10-22         Miranda

Android O - Old start foreground service still working?

So, with Android O, you need to have your service running as a foreground service if you want to receive more than just a few location updates per hour.I noticed that the old method for starting a foreground service does seem to work on O.i.e. startForeground(NOTIFICATION_ID, getNotification());According to the behaviour changes guide here:https://developer.android.com/preview/behavior-changes.html The NotificationManager.startServiceInForeground() method starts a foreground service. The old way to start a foreground service no longer works.Though the new method only works...

 android                     7 answers                     27 view
 2018-10-22         Miranda

where and how to submit DNSSEC DS record for a IDN ccTLD

I got the opportunity to configure an IDN ccTLD.I have already configured the DNS server and it is working properly.Now I have a challenge to secure the dns service by DNSSEC. I configured DNSSECC by self-signing. But Now I can't understand where and how I should entry the DS record. While Calle Dybedahl answered "where", I'd like to offer some pointers about "how" you should enable DNSSEC for your ccTLD (IDN or otherwise).Viktor Dukhovni's "Common Mistakes" page deals with a lot of things specific to DANE (the use of DNSSEC as an anchor for certificates, particularly fo...

 dns                     2 answers                     19 view
 2018-10-22         Miranda

How to create a task to periodically check for another scheduled task and delete it if it's present?

Is there a way to create windows scheduled task that is run periodically to check for another task, and if found, then delete said task and continue checking for that task in case it appears again? You can write a batch script, and schedule it to run.The command line to delete a task by name is:schtasks /delete /tn <task name> /fThe command line to list all tasks with details in CSV is:schtasks /query /v /fo LIST > file.csvthough schtasks /query gives a bit of information too, especially names.Sources:http://jane.dallaway.com/nts-get-a-list-of-windows-scheduled-...

 windows                     1 answers                     34 view
 2018-10-22         Miranda

VSTS Continuous Integration - Change SDK path

I'm looking for a solution for a problem. That is arise during Continuous Integration. To run the build command on my agent I have to give the path of the sdk of my server where build is going to be run. Normally the local.properties files are not part of git change list. I have come to know that there are git hooks for running custom scripts but after reading more, it seems like they are made for some other purpose.What I want is that after I push the code the sdk directory path in local.properties gets changed to reflect the sdk path of my server and whenever i pull the c...

 android                     1 answers                     79 view

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