Friday, September 30, 2016

How can I set up a d3 chart inside a custom directive in Angular?

Leave a Comment
I'v been following a few walkthroughs on how to implement d3 charts in an angular application. Basically, Im trying to implement the following d3 chart into my custom angular directive ('workHistory'). For the purpose of this question, I'm following a simple bar chart example where I have it set up like so : index.html <!doctype html> <html lang="en" ng-app="webApp"> <head> <meta charset="utf-8"> <title>My Portfolio</title> <!--Stylesheets -->...
Read More

Thursday, September 29, 2016

Any way to run multiple Google App Engine local instances for appengineFunctionalTest?

Leave a Comment
Background From the docs, at https://github.com/GoogleCloudPlatform/gradle-appengine-plugin I see that by putting my functionalTests in /src/functionalTests/java does the following: Starts the Local GAE instance runs tests in the functionalTests directory Stops the Local instance after the tests are complete My Issue For my microservices, I need to have 2 local servers for running my tests. 1 server is responsible for a lot of auth operations, and the other microservices talk to this server for some verification...
Read More

Cannot install psget

Leave a Comment
I am trying to install psget on windows 10 from powershell in admin mode but I get: PS C:\Windows\system32> (new-object Net.WebClient).DownloadString("http://psget.net/GetPsGet.ps1") | iex Downloading PsGet from https://github.com/psget/psget/raw/master/PsGet/PsGet.psm1 Invoke-WebRequest : The given path's format is not supported. At line:42 char:13 + Invoke-WebRequest -Uri $Url -OutFile $SaveToLocation + ...
Read More

Wednesday, September 28, 2016

Javascript - Parsing JSON returns syntax error

Leave a Comment
I am getting an error when trying to parse JSON: SyntaxError: Unexpected token u in JSON at position 0(…) eFormsAtoZIndex.aspx:6558 Full Code: http://pastebin.com/LXpJN8GF Relevant Code: $(document).ready(function() { var rebuild = getParameterByName("rebuild"); var createdStructures = $('#AtoZContentDiv').children().length; if ((rebuild !== undefined && rebuild !== null && rebuild.indexOf("true") === 0) || (createdStructures === 0)) { // clean up pre-existing data cleanUp();...
Read More

Show multilayer function relationship by cscope in vim

Leave a Comment
I know source insight can show multilayer function relationship in one window. For example, we have four functions as below void example_A() { example_B(); } void example_B() { example_C(); } void example_C() { example_D(); } void example_D(); { return 5; } When I click example_D() in source insight, source insight show example_C() is calling the function. Moreover, when I click example_C(), I see example_B() is calling the function. The relationship is like this: Example_D() | -->Example_C()...
Read More

Logstash worker dies with no reason

Leave a Comment
Using logstash 2.3.4-1 on centos 7 with kafka-input plugin I sometimes get {:timestamp=>"2016-09-07T13:41:46.437000+0000", :message=>#0, :events_consumed=>822, :worker_count=>1, :inflight_count=>0, :worker_states=>[{:status=>"dead", :alive=>false, :index=>0, :inflight_count=>0}], :output_info=>[{:type=>"http", :config=>{"http_method"=>"post", "url"=>"${APP_URL}/", "headers"=>["AUTHORIZATION", "Basic ${CREDS}"], "ALLOW_ENV"=>true}, :is_multi_worker=>false, :events_received=>0,...
Read More

Activity log of database MS SQL Server

Leave a Comment
I have a database more than hundred tables. I am continuously adding columns to existing tables (if required) and also added few new tables. Now I want to check what changes I have made in last 3 months. Is there any activity log in MS SQL Server 2012 for that specific database to track changes. 6 AnswersAnswers 1 Right now,your options are limited ,going forward you can try below and also check to see if they help you now.....
Read More

Tuesday, September 27, 2016

What is untrackOutstandingTimeouts setting for in Protractor?

Leave a Comment
In the Protractor reference configuration, there is the untrackOutstandingTimeouts setting mentioned: // Protractor will track outstanding $timeouts by default, and report them in // the error message if Protractor fails to synchronize with Angular in time. // In order to do this Protractor needs to decorate $timeout. // CAUTION: If your app decorates $timeout, you must turn on this flag. This // is false by default. untrackOutstandingTimeouts: false, I've never seen anyone changing the setting. What is the practical...
Read More

Mocking method calls using power mockito - org.powermock.api.mockito.ClassNotPreparedException

Leave a Comment
I have an image loader class and i need to test some static methods in it. Since Mockito does not support static methods i switched to Power Mockito. But the static method i am testing has a method call Base64.encodeToString(byteArray, Base64.DEFAULT); To mock this i am using mockStatic method as below with @PrepareForTest annotation. PowerMockito.mockStatic(Base64.class); But Android studio is returning me still returning me an error as below. org.powermock.api.mockito.ClassNotPreparedException: The class...
Read More

How to allow users to define arbitrary number of fields in Rails

Leave a Comment
I'm building a CMS where Administrators must be able to define an arbitrary number fields of different types (text, checkboxes, etc). Users then can fill those fields and generate posts. How can this be done in Rails? I guess that the persistence of these "virtual" attributes will be done in a serialised attribute in the database. But I am not sure how to struct the views and controllers, or where the fields should be defined. 2 AnswersAnswers 1 What you describe is called Entity-Attribute-Value model. MattW. provided...
Read More

Reading SQL Varbinary Blob from Database

Leave a Comment
I am working on saving files to sql blob to a varbinary(max) column, and have got the save side of things working now (I believe). What I can't figure out is how to read the data out, given that I'm retrieving my DB values using a stored procedure I should be able to access the column data like ds.Tables[0].Rows[0]["blobData"]; so is it necessary that I have an SQLCommand etc like I've seen in examples such as the one below: private...
Read More

Monday, September 26, 2016

Why are .domain, tickFormat and tickValues not recognised inside dimensions variable? (d3, parallel coordinates)

Leave a Comment
I am creating a parallel coordinates plot using d3.js, but am struggling to format axis labeling as I would like. For instance, one of my axes, 'Buffer Concentration', is plotted on a log scale, which I've specified through the dimensions variable, like so. var dimensions = [ ... { key: "b.Conc", description: "Buffer Concentration", type: types["Number"], scale: d3.scale.log().domain([.1, 100]).range([innerHeight,...
Read More

Camera and video control with HTML5 form android webview

Leave a Comment
I use this guide : Camera and video control with HTML5 This example work excellent on Google Chrome but i can not make it work on Android webview. I also use permission : android.permission.CAMERA. 1 AnswersAnswers 1 Did you remember to add this to your onCreate WebSettings webSettings = myWebView.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setAllowFileAccessFromFileURLs(true); webSettings.setAllowUniversalAccessFromFileURLs(true); You are probably missing the last two lines in your code....
Read More

VBA trigger enter or update lookup values

Leave a Comment
I have the following code: Sub PrintToCSV() Dim i As Long, e As Long i = Worksheets("STATEMENT (2)").Range("$G$6").Value e = Worksheets("STATEMENT (2)").Range("$G$7").Value Do While i <= e Range("K6") = i Application.Wait (Now + #12:00:01 AM#) If Range("$X$10").Value > 0 Then Cells(1, 1).Value = i End If i = i + 1 Loop End Sub It loops and changes value...
Read More

Referrer and origin preflight request headers in Safari are not changing when user navigates

Leave a Comment
I have two web pages hosted on a.example.com and b.example. Each web page is including a script with a <script> tag, hosted on another domain and served with correct CORS headers. At a certain point, user navigates from a.example.com to b.example.com. Safari has here a strange behavior: the referrer and origin headers in preflight request are filled with a.example.com, making the server sending a bad value in Access-Control-Allow-Origin (and so the script can't be executed). Is there a way to force Safari browser...
Read More

Sunday, September 25, 2016

Authenticated Route not working for Rspec test

Leave a Comment
I'm following this post about setting up authentication in the routes of my Rails 4 application. Here is my routes.rb file: Rails.application.routes.draw do devise_for :employees, :controllers => { registrations: 'employees/registrations' } devise_for :clients authenticate :employee do resources :quotation_requests, only: [:show, :edit,:index, :update, :destroy] end resources :quotation_requests, only: [:new, :create] get '/dashboard' => 'dashboard#show', as: 'show_dashboard' root to: 'home#index'...
Read More

Is it possible to launch mobile sensor with html5 but only with android webview?

Leave a Comment
I mean without cordova or other framework. I'm pretty sure i need to write Java code and link it somehow with html5 through the android webview. If it is possible, can get a little example how to connect to the camera or other sensor. 2 AnswersAnswers 1 Some of the sensors have a JavaScript API such as geolocation, orientation (gyroscope) and the battery. To access the camera you could use MediaDevices.getUserMedia, however, this is still in an experimental stage and is not supported by all Android devices. For more...
Read More

Saturday, September 24, 2016

Managing signalR notifications to synchronize client and server (c#)

1 comment
In my web application I want to load all data to client side from the server on power up. After that I want all communication be managed through Signalr - meaning that each update the server will send notification to all clients and they will ask for the updated data. However, I don't know what to do when the SingalR connection is corrupted and then goes back. I don't want to load all the data all over again. What I want to do is to implement some sort of notifications management on the server side for each disconnected...
Read More

Where can I load the user information to the session in ASP.NET MVC 5 with windows authentication?

Leave a Comment
I want to use the ASP.NET MVC 5 for my web app. I need use the windows authentication. If I use the windows authentication where is the best place for reading user information (userid and roles) and store its to the Session? I have the method for getting the user information by username from the database like this: public class CurrentUser { public int UserId { get; set; } public string UserName { get; set; } public Roles Roles { get; set; } } public enum Roles { Administrator,...
Read More

App is crashing after capturing picture using intents

Leave a Comment
My app is crashing after capturing 5 to 6 photos using intents.log cat shows nothing. am unable to find the reason why it is crashing. please help me out. private void capturePhoto() { File root = new File(Environment.getExternalStorageDirectory(), "Feedback"); if (!root.exists()) { root.mkdirs(); } File file = new File(root, Constants.PROFILE_IMAGE_NAME + ".jpeg"); Uri outputFileUri = Uri.fromFile(file); Intent photoPickerIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);...
Read More