I'm trying to switch from reading csv flat files to avro files on spark. following https://github.com/databricks/spark-avro I use: import com.databricks.spark.avro._ val sqlContext = new org.apache.spark.sql.SQLContext(sc) val df = sqlContext.read.avro("gs://logs.xyz.com/raw/2016/04/20/div1/div2/2016-04-20-08-28-35.UTC.blah-blah.avro") and get java.lang.UnsupportedOperationException: This mix of union types is not supported (see README): ArrayBuffer(STRING) the readme file states clearly: This library supports...
Saturday, April 30, 2016
Edge following with camera
I want to follow the rightmost edge in the following picture with a line following robot. I tried simple "thresholding", but unfortunately, it includes the blurry white halo: The reason I threshold is to obtain a clean line from the Sobel edge detector: Is there a good algorithm which I can use to isolate this edge/move along this edge? The one I am using currently seems error prone, but it's the best one I've been able to...
Rails - Keep a table out of structure.sql during migrations
It is straightforward to ignore tables when your schema format is :ruby, but is there a way to do it when your schema format is :sql? Ideally something like this in environment.rb: ActiveRecord::SQLDumper.ignore_tables = ['table_name'] After a quick perusal through the AR source code it looks unpromising. 1 AnswersAnswers 1 There is currently no way to do this, when the schema format is set to :sql, Rails doesn't go through the regular SchemaDumper but instead uses the tasks in ActiveRecord::Tasks::PostgreSQLDatabaseTasks...
React Native: 2 scroll views with 2 sticky headers
I am trying to create a day-view with times on the left side, and a top header of people. Currently I can get the left OR the top header to stick, but not both. How do you get 2 sticky headers? My render looks like this: <ScrollView style={{height: 600}}> <ScrollView horizontal={true}> <View style={styles.column}> <View style={{ flex: 1, flexDirection: 'row', width}}> {header}...
libclang: how to get token semantics
libclang defines only 5 types of tokens: CXToken_Punctuation CXToken_Keyword CXToken_Identifier CXToken_Literal CXToken_Comment Is it possible to get a more detailed information about tokens? For example, for the following source code: struct Type; void foo(Type param); I would expect the output to be like: struct - keyword Type - type name ; - punctuation void - type/keyword foo - function name ( - punctuation Type - type of the function parameter param - function parameter name ) - punctuation ; - punctuation...
Atom HTML syntax highlight in template literals (for angular2)
How can I get HTML syntax highlight in template literals? Something like this which I've wrote for sublime before: Here is sublime version https://github.com/Microsoft/TypeScript-Sublime-Plugin/pull/189/files How can I write the same thing for Atom? 1 AnswersAnswers 1 I was able to achieve this, here is the gist for ts.cson file. form atom typescript plugin on my system: /Users/amin/.atom/packages/atom-typescript/grammars/ts.cson...
Place a chart in plotly popup
I'm using plotly for R, although I'm open to using the Python version, as well. When I hover over a datapoint, is there a way to make the popup contain another chart? Ideally the chart would be created from the data, although I can use a static image as a fallback. I'm unsure where to start on this, and apologize in advance for not having an MWE. 3 AnswersAnswers 1 Solution 1: Stick to R Thanks to @MLavoie. The following example...
Getting doxia-module-markdown to rewrite *.md links
My goal is to generate site documentation that is also browsable from within github, so I've written a bunch of markdown pages. I'm using maven-site-plugin with doxia-module-markdown to generate project documentation. The problem I'm running into is that links of the form [foo](foo.md) show up in the generated HTML as <a href="foo.md">foo</a>, not <a href="foo.html">foo</a>. Changing the link to point to foo.html would make things unbrowseable from Github, and it seems to me that the .md→.html...
oAuth signature creation issue with PHP (posting photoset to Tumblr)
I've made a simple script that posts images on tumblr. everything is fine, but I've noticed some performance issues right after I've changed the host provider (my new host is limited and cheaper). now, after debugging the script and after contacting the tumblr api helpdesk, I'm stuck on a problem: there are 3 functions: function oauth_gen($method, $url, $iparams, &$headers) { $iparams['oauth_consumer_key'] = CONSUMER_KEY; $iparams['oauth_nonce'] = strval(time()); $iparams['oauth_signature_method'] =...
Obtain child anchor element within WebBrowser control
Preamble I'm using the WebBrowser control, which a user will interact with, so a solution will need to work with a visible WebBrowser control. Question How do I check if an element has an anchor as a child? All browsers are able to distinguish that an element contains an anchor (<a href=""...), and offers "open in new tab" functionality. That is what I am attempting to replicate. However, when I right click on a HtmlElement...
PHP not responding for Angularjs Request
I have a Raw form with some angularjs Validation, <form name = "sform" novalidate="true"> <table border="0"> <tr> <td> First name: </td> <td> <input type="text" name="fname" ng-model="fname" placeholder="First Name" required="true" ng-pattern="/^[A-Za-z]*$/"> </td> <td ng-show="sform.fname.$invalid && !sform.fname.$pristine" class="help-block">wrong name </td> </tr> <tr>...
How to force soft wrap from ACE editor mode?
I'm writing a custom mode for the ACE editor to support my toy template language. In the language there is a construct to embed a newline: foo{\n}bar It will be rendered with a newline, as follows: foo bar I would like to imitate this in the editor and force a soft wrap after {\n}: 1 | foo{\n} | bar Is there a way to do this in my mode? 1 AnswersAnswers 1 Without code, it's a bit hard to reproduce, but according to the class diagram, you need to interact with the VirtualRenderer to alter how things are...
Friday, April 29, 2016
System.Runtime.InteropServices.COMException: Invalid file name in Crystal Report
I am using Visual Studio 2010 with Crystal Report. It is working fine in my local server but on web server, it is giving error : System.Runtime.InteropServices.COMException: Invalid file name. I tried many solutions like put .rpt file in any folder and provide that path, give full permission to windows temp folder, enable parent path form IIS etc. But none of them is working. Please help me to solve this. My current path : crystalReport.Load(Server.MapPath("~/PurchaseOrder1.rpt"));...
Search for view files in a custom location only for Specified Area in MVC 5
I'm looking to override the 'ViewEngine' for MVC5 in a way that first, it find my pages.. which already i failed. Second, It only operate on a single Area {root}/{area}/{controller}/{action}/{etc.} as so far as i googled it, i found several topic and answers, but they didn't fit my need. so i rather to ask it here, maybe i'm wrong with something... public class CustomAreaViewEngine:RazorViewEngine { public CustomAreaViewEngine()...
How to make a aspxdocumentviewer direction rtl?
My goal is to have a right justified report. So I changed the text align from right to middle center justified because right justified alignment is not supported in document viewer I think. Now my text is justified but the direction is ltr. How to make it rtl? I tried to set a rtl style for created html from document viewer by css and jquery but it ignores styles. I am using devexpress report suit 15.2 with asp.net webforms. How to do it? 1 AnswersAnswers 1 Finally I fount it. By adding the following code to the...
get image url of rss with rome library
I having a rss file in following : <?xml version="1.0" encoding="UTF-8" ?> <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"> <channel> <title> سایپا نیوز </title> <link>http://www.saipanews.com/</link> <description></description> <language>fa</language> <item> <author></author> <pretitle></pretitle> <title>پیام تبریک دکتر جمالی به مناسبت فرارسیدن سالروز...
Pandas - SQL case statement equivalent
NOTE: Looking for some help on an efficient way to do this besides a mega join and then calculating the difference between dates I have table1 with country ID and a date (no duplicates of these values) and I want to summarize table2 information (which has country, date, cluster_x and a count variable, where cluster_x is cluster_1, cluster_2, cluster_3) so that table1 has appended to it each value of the cluster ID and the summarized...
Django-REST Serializer: Queryset does not filter PrimaryKeyRelatedField results
So I have a serializer that looks like this class BuildingsSerializer(serializers.ModelSerializer): masterlisting_set = serializers.PrimaryKeyRelatedField(many=True, queryset=Masterlistings.objects.all()) and it works great serializer = BuildingsSerializer(Buildings.objects.get(pk=1)) serializer.data produces OrderedDict([ ("masterlistings_set", [ "0a06e3d7-87b7-4526-a877-c10f54fa5bc9", "343643ac-681f-4597-b8f5-ff7e5be65eef", "449a3ad2-c76c-4cb8-bb86-1be72fafcf64",...
Using a coordinatorlayout to collapse a full screen imageview and replace it with viewpager with headers
I started playing around with coordinatoralyout and I'm trying to achieve the behavior on the attached image, I want a background image to be on full screen size and upon a scroll I want some textviews to dissapear and some to stick as parts of a viewpager (rather then a toolbarlayout) any guidance on how can I achieve this? 3 AnswersAnswers 1 As I am not sure if you want a particular or a general solution, I am going to give...