Saturday, March 31, 2018

AngularJS token authentication with sliding expiration in state transitions with ui-router version 1.x

Leave a Comment
In our application we have a requirement that user should be logged in for a certain amount of time which is configurable by system admin, say 10 minutes. We have another requirement that the when user navigates to different parts of the app, this time should be refreshed and set back to that configured amount. Our application is written in AngularJS and we use ui-router for routing, So when user navigates between different states, time to be logged out gets updated. The back-end is written with .NET and we use jwt tokens...
Read More

Including jquery-sparkline with webpack

Leave a Comment
I'm struggling with my first attempt with webpack. I'm getting the following error in the browser console. ERROR TypeError: $(...).sparkline is not a function This is my webpack.config.vendor.js code const path = require('path'); const webpack = require('webpack'); //const ExtractTextPlugin = require('extract-text-webpack-plugin'); const merge = require('webpack-merge'); const treeShakableModules = [ '@angular/animations', '@angular/common', '@angular/compiler', '@angular/core', '@angular/forms',...
Read More

appropriate to use either Func0 and Action1 in rxjava what is the difference

Leave a Comment
I have the following code snippet where Func0 and Action1 are used. Observable.defer(new Func0<Observable<String>>() { @Override public Observable<String> call() { try { return Observable.just(Database.readValue()); } catch(IOException e) { return Observable.error(e); } }) .subscribe(new Action1<String>() { @Override public void call(String result) { resultTextView.setText(result);...
Read More

Friday, March 30, 2018

Porting nodejs module to React Native: Object.prototype undefined

Leave a Comment
Here's my source tree at the exact moment of the problem: https://github.com/lucaszanella/jscam/tree/cf29b3cc90df7c5c7bb2d27c2205264d52b0715d/src/jscam I believe npm install, npm start and npm run android will make it launch (note that onvif is not installed from npm but cloned in npm post-install script and then installed, but it gets installed in node_modules with a symlink to the place where it cloned. I even tried to put everything...
Read More

Thursday, March 29, 2018

notification disappears after showing

Leave a Comment
We have code similar to the following in our app val pendingIntent = PendingIntent.getActivity(ctx, id.toInt(), intent, PendingIntent.FLAG_CANCEL_CURRENT) val builder = NotificationCompat.Builder(ctx, Channel.TEST_CHANNEL.channelId) builder.setTicker(tickerText) .setContentTitle(contentTitle) .setContentText(contentText) .setVibrate(vibrate) .setSmallIcon(icon) .setAutoCancel(true) .setLights(-0xff0100, 300, 1000) .setSound(uri)...
Read More

Implementing the D3 “reusable chart” pattern in TypeScript

Leave a Comment
The code in section 2 below (working example here) is based on the code in section 1 but changed to use arrow functions, and it is based on Mike Bostock's pattern in Toward Resusable Charts, namely returning a function that has other functions on it. If I try to run either the code in section 1 or 2 in typescript (demo here) it says the methods addToChart and stop do not exist on type (selection: any) => () => void. How can I get typescript to recognize the functions properties (addToChart and stop in this case)...
Read More

How to validate SAML EntitiesDescriptor Signature with Apache Santuario

Leave a Comment
The aim is to validate a saml EntitiesDescriptor signature using a stux processor to ensure the amount of memory used is low. I have been using the following code with an example from Apache Santuario without any luck. Please can someone advise on how to use Apache Santuario with SAML Entity Descriptor files. SignatureUtils can be found here URL url = new URL("http://metadata.ukfederation.org.uk/ukfederation-metadata.xml"); // Validation List<QName> namesToSign = new ArrayList<QName>(); namesToSign.add(new...
Read More

Wednesday, March 28, 2018

Select long text in spinner then create space

Leave a Comment
when i select long text in my spinner then its create space between textView and spinner see my default spinner : after selecting a long text it's look like below shot: below is xml code : <TextView style="@style/TextLabelBookGray" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_vertical"...
Read More

How can I change the color of a Selector Rendere in iOS to be a new color?

Leave a Comment
I am using code that creates a selector looking like this: img alt=" What I would like to do is to change the code so that what is blue all changed to a color specified in the XAML. Does anyone have any ideas as to how this could be done? The XAML I use looks like this: <local:SegmentedControl ValueChanged="OnModeChanged" x:Name="segControlMode" HorizontalOptions="End"> <local:SegmentedControl.Children> <local:SegmentedControlOption...
Read More

How Android Layout editor works?

Leave a Comment
before answering the question, keep in mind I have experience developing Android apps, I even know how to build an APK using Android SDK command line. I want to build an utility that parses the layout file (.xml) and renders a preview. Summary: A layout previewer. I've checked the source code of the isInEditMode() method, but it doesn't help, it only returns false public boolean isInEditMode() { return false; } I can't simply display images, because the Android Studio layout editor renders the preview according...
Read More

Animating In and Out with CSS

Leave a Comment
I have a menu which displays over the top of the current page once the hamburger icon is pressed which uses Glamor for CSS. The menu animates in from the right of the screen and works perfectly, however i'm struggling to get it to animate out once anywhere in the Menu is pressed. The animation is written (animateOut) but I need help with the code in flicking between animating in and out depending on the click: Hamburger menu clicked -> menu slides in from the right. Anywhere in the menu container is clicked ->...
Read More

Child control handling touch event affects multi-point manipulation

Leave a Comment
I have a UserControl that must respond to TouchUp events and this sits within a Viewbox which needs to be panned and scaled with pinch manipulation. Touch events on the control are handled fine. However pinch manipulations only scale the ViewPort if both pinch points are contained entirely within either the user control or the Viewport space around it. If the pinch straddles the user control boundary then the ManipulationDelta loses...
Read More

MVC 5 - Mitigating BREACH Vulnerability

Leave a Comment
I'm hoping someone will be able to help my understanding of this issue and whether or not I need to take any extra steps to protect my application. Reading up on this particular vulnerability, it seems to impact servers that match the following criteria: Be served from a server that uses HTTP-level compression Reflect user-input in HTTP response bodies Reflect a secret (such as a CSRF token) in HTTP response bodies It also seems that mitigation steps, in order of effectiveness are: Disabling HTTP compression Separating...
Read More

Volley attach access token to evey request using singleton

Leave a Comment
I am doing the following which perfectly works //else proceed with the checks JsonObjectRequest jsonObjectRequest = new JsonObjectRequest( Request.Method.GET, checkauthurl, null, new Response.Listener<JSONObject>() { @Override public void onResponse(String response) { //do stuff here } }, new Response.ErrorListener() { @Override public...
Read More

Chrome - if jquery-simple-combobox is inside a modal collapses when mouse dragging

Leave a Comment
I'm trying to learn to work with jquery.scombobox but I'm stuck when adding the scombobox to a modal <div id="modalA" class="modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title">My Modal</h4> </div>...
Read More

Xamarin Android linking cannot access file

Leave a Comment
I have a Xamarin Android project that I am trying to use Sdk and User Assembly linking with. If I set the Android project to Sdk Assembly Linking only, the APK is created and deployed successfully and works. However, when I set Sdk and User Assembly linking, with no other changes, I get the following error only when I deploy. The solution builds succesfully. The "LinkAssemblies" task failed unexpectedly. System.IO.IOException:...
Read More

Tuesday, March 27, 2018

Add JIRA OAuth to my WebApp

Leave a Comment
I am developing a web app. I want to add JIRA based Authentication to the app. Just like "Login with Google" or "Login with Facebook", I am trying to implement "Login with JIRA". I am following this article https://developer.atlassian.com/server/jira/platform/oauth to configure OAuth using "Application Link". In Step 2. Do the “OAuth dance”, point 4, the user will be redirected to JIRA and he will be asked to allow access. Now we will get verification token. In normal OAuth flows like "login with Google", we won't get this...
Read More

Is there an equivalent for using matplotlib.image in ruby

Leave a Comment
Been experimenting with using Ruby inside a jupyter notebook. With Python I can do this import matplotlib.image as mpimg Does anyone know the equivalent with Ruby, I have not been able to find it in any of the iRuby or sciruby documentation? To clarify a little, In my gemfile I have this gem 'iruby' gem 'cztop' gem 'matplotlib' But cannot seem to get access to the image part of matplotlib that I am use to using in python. ...
Read More

Protractor find parent element

Leave a Comment
<label class="radio inline check"> <input class="input ng-new ng-valid" name="BookType" required="" type="radio"> <!----> <!----> Fiction </label> <label class="radio inline check"> <input class="input ng-new ng-valid" name="BookType" required="" type="radio"> <!----> <!----> NonFiction </label> <label class="radio inline check"> <input...
Read More

JavaConfig format of TransportGuarantee.CONFIDENTIAL related code for Tomcat 8.5

Leave a Comment
My goal is to have my Tomcat 8.5 application serve pages soley through https. In my ApplicationInitializer, I have this block of code: ServletRegistration.Dynamic dispatcher = container.addServlet("dispatcher", new DispatcherServlet(rootContext)); dispatcher.setLoadOnStartup(1); dispatcher.addMapping("/"); if (Environment.PRODUCTION.getValue().equals(EnvironmentUtil.getEnvironmentName())) { //checked that the flow of control reaches here. yes, I know it should be using spring profiles instead HttpConstraintElement...
Read More

live MySQL db accepts 'CURRENT_TIMESTAMP" as datetime value - local does not

Leave a Comment
I've picked up on a project that's a few years old, and noted CURRENT_TIMESTAMP is being sent with a lot of the php calls to update the datetime field in a lot of rows. This works perfectly on the live environment - however, on my local setup, it does not. Both the Live DB, and my local version from the WAMP64 download are running on MySQL5.7.19. A PHP script running a query that involves inserting CURRENT_TIMESTAMP will return back...
Read More