Thursday, May 31, 2018

Lookup against MYSQL TEXT type column

Leave a Comment
My table/model has TEXT type column, and when filtering for the records on the model itself, the AR where produces the correct SQL and returns correct results, here is what I mean : MyNamespace::MyValue.where(value: 'Good Quality') Produces this SQL : SELECT `my_namespace_my_values`.* FROM `my_namespace_my_values` WHERE `my_namespace_my_values`.`value` = '\\\"Good Quality\\\"' Take another example where I m joining MyNamespace::MyValue and filtering on the same value column but from the other model (has relation...
Read More

How to create simple 2-page site using 2 markdown files in github pages?

Leave a Comment
I am trying to make a very simple site in github pages that will only have two pages: a homepage and an about page. I would like each of these pages to be generated from markdown files. The homepage is easy, I just put the homepage markdown in README.md and it shows up at myusername.github.io Is there a simple way to add a second markdown page? I understand github pages uses jekyll and I can do this by creating an entire jekyll blog, but that seems like overkill for what I want to do. What's the simplest way to add...
Read More

Android buttons are only clickable on the corners

Leave a Comment
I have a simple LinearLayout with several buttons, whos state color/text change based on the state of an underlying service, thats working fine. However the buttons, are only clickable on the right corner ??? The button allSystemServicesToggleButton which i have included the implementation for in this post and only be clicked on the right side/right corner??? Here is my fragment xml layout: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"...
Read More

Matplotlib canvas as numpy array artefacts

Leave a Comment
I want to convert a matplotlib figure into a numpy array. I have been able to do this by accessing the contents of the renderer directly. However, when I call imshow on the numpy array it has what looks like aliasing artefacts along the edges which aren't present in the original figure. I've tried playing around with various parameters but can't figure out how to fix the artefacts from imshow. The differences in the images remain...
Read More

Pyspark: spark-submit not working like CLI

Leave a Comment
I have a pyspark to load data from a TSV file and save it as parquet file as well save it as a persistent SQL table. When I run it line by line through pyspark CLI, it works exactly like expected. When I run it as as an application using spark-submit it runs without any errors but I get strange results: 1. the data is overwritten instead of appended. 2. When I run SQL queries against it I get no data returned even though the parquet files are several gigabytes in size (what I expect). Any suggestions? Code: from pyspark...
Read More

Add multiple colspans that line up in HTML

Leave a Comment
I'm building a calendar scheduler where I am hoping to add multiple tasks to one employee row. Whenever I try to add multiple tasks to the same time span, the spans no longer line up. Here is an example of how it looks now: . What would be the best practice to add tasks to the same day columns while keeping a task like "Slaughter them" similar? HTML Script: <script> var sysDate = new Date(); ...
Read More

Diagram of laravel architecture?

Leave a Comment
Can anyone point me to a diagram that shows the relationship between the normal MVC bits and the following: middleware Guards facades Contracts Laravel seems to have so many middlemen and I'm struggling to see the big picture. 0 Answe...
Read More

Why is javafx mangling my semi-transparent cursors?

Leave a Comment
Below are two PNG images: Visually they are exactly identical - the only difference is that one has semi-transparent background in some of the pixels (you can download the images to check it). But when I use those images as an ImageCursor on JavaFX nodes, I get the following result: First cursor (without partially transparent pixels) is still crisp, but the second gets distorted. After fighting with the problem for a while,...
Read More

Wednesday, May 30, 2018

ignore QTapGesture after QTapAndHoldGesture

Leave a Comment
I want to get QTapAndHoldGesture and QTapGesture in my widget and do different thing as reaction on these gestures. So I override QWidget::event method and add such code: bool event(QEvent *event) override { if (event->type() == QEvent::Gesture) { auto g_event = static_cast<QGestureEvent *>(event); qDebug() << "GestureEvent BEGIN: gestures " << g_event->gestures().size() << ", active: " << g_event->activeGestures(); if (auto g = qobject_cast<QTapGesture *>(g_event->gesture(Qt::TapGesture)))...
Read More

How to find corners on a Image using OpenCv

Leave a Comment
I´m trying to find the corners on a image, I don´t need the contours, only the 4 corners. I will change the perspective using 4 corners. I´m using Opencv, but I need to know the steps to find the corners and what function I will use. My images will be like this:(without red points, I will paint the points after) EDITED: After suggested steps, I writed the code: (Note: I´m not using pure OpenCv, I´m using javaCV, but the logic...
Read More

How can my library with built in ssl certificate also allow use with default certs

Leave a Comment
I am distributing a library jar for internal clients, and the library includes a certificate which it uses to call a service that is also internal to our network. The trust manager is set up as follows TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); KeyStore keystore = KeyStore.getInstance("JKS"); InputStream keystoreStream = clazz.getClassLoader().getResourceAsStream("certs.keystore"); // (on classpath) keystore.load(keystoreStream,...
Read More

How to access text field using selenium when main identifiers are auto-generated

Leave a Comment
I have a HTML table which outputs some data on each row and for each row includes a text field. I have a separate dataframe with values I need to input into the relevant row but I can't figure out how to get the correct text input element as the name isn't unique. I can get the element which contains 123456/1 so I can find the row containing the PartA I want but I can't figure out how to get the text input field id="VALUE.ENTER.SYSTEM.1-XY that then corresponds to that row. .XY is a number value that changes depending...
Read More

How To Delete Cache Using Accessibility Service in Android?

Leave a Comment
I'm working on cache cleaner app, after doing research on google I found that Android system has moved "CLEAR_APP_CACHE" permission to "signature, privileged" state. So I'm unable clear cache with freeStorageAndNotify method. Apps on google playstore like CCleaner, Power Clean etc.. are using Accessibility Service To Delete Cache. I have also created basic accessibility service for my app, but don't know how to delete cache of apps 1 AnswersAnswers 1 You can get a list of installed apps and delete cache like: ...
Read More

Tuesday, May 29, 2018

Database Design and Query for Historical Tabular Data

Leave a Comment
I have a set of HTML tables that store survey questions and responses over time. Each question has it's own HTML table, the columns are the years, the rows are the responses, then the individual cells have the number of responses for that year, as shown below: I've gone back and forth on how to normalize this data and store it in a database, but I'm not sure what the best way is. I'm looking for a good database schema that can handle...
Read More

javascript and web services WSDL

Leave a Comment
i want to call a web service using javascript. i have a form where i give some parameters (int) and want to get the result how can do it using javascript? here are the WSDL files <definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://lapack.sws4hpsc.uth/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://lapack.sws4hpsc.uth/" name="DgesvSampleWsService">...
Read More