I have to download a file from aws S3 async. I have a anchor tag, on clicking it a method will be hit in a controller for download. The file should be start downloading at the bottom of the browser, like other file download. In View <a href="/controller/action?parameter">Click here</a> In Controller public void action() { try { AmazonS3Client client = new AmazonS3Client(accessKeyID, secretAccessKey); GetObjectRequest req = new GetObjectRequest(); req.Key = originalName;...
Tuesday, January 31, 2017
Custom line style for network graph in R

I am hoping to make a directed network plot with arrowheads (or similar chevrons) along the length of the line... The igraph library seems to use the base polygon function, which accepts lty to specify line types, but these are limited to various dashes. Is there a way to make customized symbols (or even using the triangles in pch) to form a line in R? Minimal code to make the graph: require(igraph) gr = graph_from_literal(...
Jupyter Lab - launches but don't see any tabs (look/feel is 100% different than seen in youtube videos)

I have jupyter notebook version 4.2 on my MacOS. I launch via jupyter lab at the MacOS terminal and it automatically opens a browser at the following link: http://localhost:8888/lab At this point I see the Welcome to the JupyterLab Alpha preview screen but nothing more. No tabs etc. Please see the image I have included. I am using Chromium (Version 43.0.2357.130 (64-bit) ). When I try to open in Safari browser absolutely nothing...
Can YouTube be forced to play fullscreen by default on Android?

The behaviour between YouTube embedded videos and Vimeo embedded videos appears to differ both from each other and across iOS/Android platforms. I'm displaying the videos within a lightbox provided by a wordpress plugin. The videos are embedded via an iframe which has the allowfullscreen attribute. On an iPhone (using Chrome browser), when the user presses play on either YouTube or Vimeo video, it automatically enters full screen...
Web Api call fails now after TLS 1.2 is enforced between our servers
We have a server with a windows service that calls an web api over https in other server (both servers internals) and it was working normal, until they were changed their TLS configuration. I coded a simple console app for test the call and reproduced the error. I tested from Firefox from the machine acting as client and is respoding ok (this discard any firewall or port blocks issue) More strange is I tested from my laptop (win7) and worked ok. As can be seen in the Exception details fails "at System.Net.TlsStream.EndWrite(...)"...
Blockchain decentralised database on rails
I want to store the data of my rails application on a blockchain technology where data is decentralised. any quick tutorials or reference articles from where I can learn how to do so? I want to store JSON data inside blockchain and I want to use any external service. And any reliable blockchain as a service people like heroku for rails to get started? Thanks. 2 AnswersAnswers 1 You have to handle this with Database setup. Go through this document https://www.bigchaindb.com/whitepaper/bigchaindb-whitepaper.pdf....
Can you and how do you embed images in an email when using the Gmail API?
When creating a message and using it to create a draft or email using the Gmail API, can you have an image embedded in the body? I'm looking to have the image data actually embedded similar to how copying and pasting an image (the actual data, not the link) into a Gmail email will place the image right in the content. Can it be done like this or do I need to upload the image to some other location and use HTML to embed the image in the email? Any pointers on how to do it? 1 AnswersAnswers 1 The short answer is that...
What are the rules to order the keywords in a MySQL boolean search?
When I change the order of the keywords in a boolean search, I get the same result but very different performance results. The profiling on MySQL 5.6.33 with a MyISAM table, ft_min_word_len=2 and description_index as a FULLTEXT index on title and description returns this: # Query 1 SELECT id FROM archive, topic WHERE topic.type=0 AND archive.status=2 AND MATCH(title, description) AGAINST ('+house* +tz*' IN BOOLEAN MODE) AND archive.topicId = topic.id ORDER BY archive.featured DESC, archive.submissionDate DESC LIMIT 0,20...
Monday, January 30, 2017
Stop Visual Studio from running JS tests on build
My Visual Studio (2015) seems to have started running our full JS test suite at a variety of points, including (I think?) on-solution-open and post-build. It's outputting into the "Output Window", under the "Tests" dropdown. It's producing an output along the lines of: ------ Discover test started ------ < ... Test output ... > ========== Discover test finished: 0 found (0:00:05.9645562) ========== ------ Discover test started ------ < ... Test output ... > ========== Discover test finished: 0 found (0:00:04.589261)...
Vertical Separator in ListBox Group

I have a ListBox where I did the grouping based on a property like this : CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(listbox.ItemsSource); PropertyGroupDescription groupDescription = new PropertyGroupDescription("CurrentDate"); view.GroupDescriptions.Add(groupDescription); And after grouping I want to add a vertical separator between the groups and I wrote a code like this: <ListBox.GroupStyle>...
Internal socket.io clients list location
I am wondering if Socket.io will internally do bookkeeping and allow the user to retrieve a list of clients, or if we will manually need to keep track of a list of connected clients like so: var Server = require('socket.io'); var io = new Server(3980, {}); const clients = []; io.on('connection', function (socket) { clients.push(socket); socket.on('disconnect', function () { clients.splice(clients.indexOf(socket),1); }); }); does socket.io store a list of connections, somewhere like: io.connections...
Android OpenGL occasional stutter

I've written an OpenGL ES 2 app using NativeActivity that renders around 6 textured triangles that you can drag around using touch input. The app is rendering as fast as possible, calling glClear() before and eglSwapBuffers() after rendering. As expected the frame rate is capped to the display frequency of around 60 fps and the scene moves around smoothly. However, after some time (10 to 60 seconds) the movement starts to stutter even...
Tensorflow: Finetune pretrained model on new dataset with different number of classes
How can I finetune a pretrained model in tensorflow on a new dataset? In Caffe I can simply rename the last layer and set some parameters for random initialization. Is something similar possible in tensorflow? Say I have a checkpoint file (deeplab_resnet.ckpt) and some code that sets up the computational graph in which I can modify the last layer such that it has the same number of ouputs as the new dataset has classes. Then I try to start the session like this: sess = tf.Session(config=config) init = tf.initialize_all_variables()...
React-native running offline bundle error no script URL provided
I am trying to run a completely offline bundle of my app only once to test if the microphone is working and failing to do so. I have read other threads and github issues but I have a rather weird setup: My OSX machine (sierra) is running inside a VM (I do not have access to a Mac) so the iphone (5s running 10.2) and the OSX probably do not appear to be on the same network (because the host is connected to the same WIFI as the iphone but the VM is using NAT). I can bundle correctly with react-native bundle --platform ios...
Slack API - Attatchments from custom bot post as plain text
I'm using Python 2.7 along with a python-slackclient. I have an attachment structure like so: self.msg = { "attachments": [ { "fallback": "%s, %s" % (self.jiraIssueObj.fields.summary, self.link), "pretext": "Detail summary for %s" % self.jiraIssueObj, "title": self.jiraIssueObj.fields.summary, "title_link": self.link, "text": self.jiraIssueObj.fields.description[0:self.maxSummary], "color": "#7CD197", "mrkdwn_in": ["text", "pretext",...
Will JavaScripts embedded in an HTML file loaded by WKWebView be accessible?
I have a basic foo.html in my iOS 10 application. The markup is straight forward: <!doctype html> <html> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <title>Example</title> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <p>Hello, World!</p> <div id="container"></div> </body> <script type="text/javascript"...
Dynamic parameter in Crystal Reports with filter

There is a possibility in Crystal Reports to use dynamic parameters - list of choices for parameter isn't fixed and typed in the report but is taken from some database table. It is described for example here: https://www.youtube.com/watch?v=kuHs89yyuEc My problem is that a parameter created in such way allows to choose from ALL values in the table. I'd like to filter it in relevance with data in report. For example: My report represents...
Can't install my app on wear
I tried to add a wear module to my existing app, tried a lot of solutions, but can't figure out why my app is not being installed on my watch. What I tried : First, Manual packaging with my app : https://developer.android.com/training/wearables/apps/packaging.html But I quickly decided not to go through this. Then I decided to go to gradle include, so to the build.gradle of app, I added the following to the end of dependencies : debugWearApp project(path:':wear', configuration: 'flavor1Debug') releaseWearApp project(path:':wear',...
Swagger documentation for facebook graph api
Can we build a swagger definition in a json format for facebook graph api? 1 AnswersAnswers 1 Yes you can, it has already be done by Kin Lane the API Evangelist. His work his available on the API Stack website (search Facebook in the page), all files are in a github repository. ...
Wit.ai PHP cURL execute bot function?
It is my first time working with bots. I decided to use wit.ai bot, using PHP. What I am trying to do is to set callback function for the bot, for example when user ask for weather the bot will execute getWeather(). How can I pass this function to the bot if I am using cURL? Is it possible to do that? I found some SDKs on git but all of them are unofficial for wit.ai. $ch = curl_init(); $headr = array(); $headr[] = "Authorization: Bearer XXXXXXXXXXXXXXXX"; curl_setopt($ch, CURLOPT_URL,"https://api.wit.ai/message?v=20170118&q=what...
Sunday, January 29, 2017
Stuck in implementing a method for mapping symbols to an interval - if-else loop not working properly implementation does not match theory
I am trying out an encoding - decoding method that had been asked in this post Matlab : Help in implementing a mathematical equation for generating multi level quantization and a related one Generate random number with given probability matlab There are 2 parts to this question - encoding and decoding. Encoding of a symbolic sequence is done using inverse interval mapping using the map f_inv. The method of inverse interval mapping yields a real valued number. Based on the real valued number, we iterate the map f(). The...
Connection refused when running mongo DB command in docker
I'm new to docker and mongoDB, so I expect I'm missing some steps. Here's what I have in my Dockerfile so far: FROM python:2.7 RUN apt-get update \ && apt-get install -y mongodb \ && rm -rf /var/lib/apt/lists/* RUN mkdir -p /data/db RUN service mongodb start RUN mongod --fork --logpath /var/log/mongodb.log RUN mongo db --eval 'db.createUser({user:"dbuser",pwd:"dbpass",roles:["readWrite","dbAdmin"]})' The connection fails on the last command: Error: couldn't connect to server 127.0.0.1:27017...