2018-10-22         Todd

How to use JWT tokens with WCF and WIF?

General notesWe're using IdentityServer3 and have been very happy with it so far.We've gotten to secure MVC and ASP.NET Web API applications very easily with the help of both MS and Thinktecture OWIN middlewares.The client we're working for still has a lot of SOAP WCF services, and this is where we're getting stuck.The SetupI'm not gonna lie, I'm far from being experienced with WCF, I've only used it for very basic scenarios - understand basicHttpBinding, no transport nor message security.This is what I want to achieve:A client gets a JWT access token from IdentityServerSom...

 wcf                     1 answers                     5 view
 2018-10-22         Todd

Assigning values to a new user from a view

I have an application fileman with models.py like so:from django.db import modelsfrom django.contrib.auth.models import Userfrom fileman.fields import AutoForeignKeyfrom django.utils.translation import ugettext as _class Setting(models.Model): owner = AutoForeignKey(User, unique=True, related_name='fileman_Setting') root = models.CharField(max_length=250, null=True) home = models.CharField(max_length=250, null=True) buffer = models.TextField(blank=True) class Meta: permissions = ( ("can_fm_list", _("Can look files list")), ("can_f...

 python                     2 answers                     43 view
 2018-10-22         Todd

How to test Alert/Popup in Selenium using Python

I'm stuck with my automation where when I enter wrong username and password it will pop up saying "Unable to login. Try different username"def test_logonWrongUserName(self): self.setUpClass() # Initialize the driver self.sh.navigateToUrl("http://test.com") self.sh.member_Login("Foo", "asd") Now need to test the Alert or popup (Not sure it is an alert or popup window) which has the text "Unable to login. Try different username". If it's find the text then the test pass. If not then the test has to fail. Note:Just want to add, We can't access the html dom until we c...

 python                     1 answers                     95 view
 2018-10-22         Todd

Semantic-UI Sidebar.Pusher causing react router to rerender its component

I am using the react router and semantic-ui sidebar. When the sidebar is toggled between visible and invisible, the router triggers its component (OilBarrelComponent) to be recreated (rather than just 'pushed'). This seems unnecessary and has side effects that i don't want. Is there something wrong with my code that causes the OilBarrelContainer component to be recreated just because I toggle the sidebar?import {BrowserRouter as Router, Route, Link, Switch} from 'react-router-dom';import {Sidebar, Segment, Button, Menu, Icon} from 'semantic-ui-react' toggleSidebarVisibilit...

 reactjs                     1 answers                     59 view
 2018-10-22         Todd

Howcan I start @Scheduled method with concrete scheduler?

I have scheduler:@Bean("one")ThreadPoolTaskScheduler taskScheduler(){ ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler(); threadPoolTaskScheduler.setPoolSize(5); threadPoolTaskScheduler.setAwaitTerminationSeconds(60); threadPoolTaskScheduler.setThreadNamePrefix("Test-"); return threadPoolTaskScheduler;}@Bean("two")ThreadPoolTaskScheduler taskScheduler2(){ ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler(); threadPoolTaskScheduler.setPoolSize(50); threadPoolTaskScheduler.setAwaitTerminationSeco...

 java                     3 answers                     59 view
 2018-10-22         Todd

Xamarin Forms toolbar not showing on Android

I have a ContentPage that is accessed via a TabPage's child, it is simply accessed via a click of a button.On iOS, the page has a toolbarHowever on Android, there isn't one displayed. I have to rely on the user to use the back button on their device.How can I get this to display on Android?I have tried using several fixes including: NavigationPage.SetHasNavigationBar(this, true); but this makes no difference. To enable hierarchical navigation from a tab you just need to wrap those tabs in a NavigationPage, like so: public partial class TabPage : TabbedPage{ Page TabOn...

 c#                     1 answers                     92 view
 2018-10-22         Todd

Several joins in query - possible to replacement to gain performance?

I have a table consisting of 10 million rows where I am trying to find who was the first/last maintainer of some machines (id) depending on some dates and also depending on what status the machine had. My query uses six joins, is there any other preferred option? EDIT: The original table has index, trying to optimise the query replacing the joins - if its possible? SQL Fiddle with example:SQL FiddleEDIT (added additional information below):Example table:CREATE TABLE vendor_info ( id INT, datestamp INT, statuz INT, maintainer VARCHAR(25)); INSERT INTO vendor_info VALUES...

 sql                     5 answers                     58 view
 2018-10-22         Todd

Maintaining Customer Data

All our applications rely on a certain amount of client data i.e. Lookups for comboboxes, users, roles, user-roles...We currently use a spreadsheet to map the data and generate insert scripts that are then imported into SQL server. The has seemed to work for us but it is very difficult to update and maintain when there are a lot of changes going on (excel is not good at merging data) and it is slow when there is a lot of data.I am sure this is a common problem and would to hear how others have approached it so we could borrow some ideas and improve our process. Excel ro...

 sql                     4 answers                     75 view
 2018-10-22         Todd

MySQL: Efficiency of views containing GROUP BY

The fact that I haven't been able to come up (or research) a solution to this question means that I'm either too stupid to read the docs or it is in fact a complicated problem.In a rather big database I often need a query like this:SELECT ... WHERE condition GROUP BY something;This takes a fraction of a second to complete. So I put this in a VIEW:CREATE VIEW view_x AS SELECT ... GROUP BY something;And when I then doSELECT * FROM view_x WHERE condition;it takes more than a minute to complete. Now it's easy to see why: In the plain SELECT, the DB engine first selects a few hu...

 mysql                     1 answers                     17 view
 2018-10-22         Todd

SQL: How to set job to get executed annually

I have created a job in sql.My requirement is that the job should get executed annually in 31st of march. While creating the steps, i was not able to find Yearly frequency occurance. Can anybody tell me how to achieve this.Thanks in advance. There's no such option - you'll have to schedule it to run on the 31st of every month. Then, as the first step, detect if its not the 31st of march and cause the job to complete early.I normally write such steps as an obvious error, and use that to control the flow of the job - something like:IF DATEPART(month,CURRENT_TIMESTAMP) != 3...

 sql                     2 answers                     36 view
 2018-10-22         Todd

decodeString codefights: Program doesn't pass all tests."30/31 Output limit exceeded on test -31". Kindly support

function decodeString(s){ let arr = []; let digitSum = ''; let digitSumArr = []; // for numbers before '[' let i; //iterating string for (i = 0; i < s.length; i++) { if (!isNaN(s[i])) { digitSum += s[i]; // count number before '[' } else if (s[i] === '[') { // add number to the array digitSumArr.push(+digitSum); arr.push(i + 1); digitSum = ''; } else if (s[i] === ']') { let digit = digitSumArr.pop(); i = decStr(arr, i...

 javascript                     1 answers                     60 view
 2018-10-22         Todd

DecimalFormat issue with EditText Input

Hello i'm writing this program to get user input and format to 0,000.00 for examplethe program works fine when i try 5,768.80 BUT it doesn't when i try 5,768.08 as you can see the problem is that i can't put a 0 in the cents place before any other number... here is my code:package com.calculadorabss.gorydev.calculadorabolivaressoberanos;import android.text.Editable;import android.text.TextWatcher;import android.widget.EditText;import java.text.DecimalFormat;import java.text.ParseException;class NumberTextWatcher implements TextWatcher { private DecimalFormat df; priva...

 java                     1 answers                     39 view
 2018-10-22         Todd

VSTS Drop Single Artifact - Release to Azure Multiple Websites

I have a Visual Studio Solution which has multiple websites projects.I'm currently running a build in VSTS against 1 repository which is creating a drop.zip artifact that has produced 3 websites segmented by their project/folder name.Now I'd like to have 3 release definitions which publish each of the respective folders to Azure App Service.How can this be done?Inside of the Azure App Service Release step, I can only point to a single Zip file. I need to point to a folder inside the Zip the file, correct? You could create a zip for each of you 3 websites. Publish the web...

 azure                     3 answers                     48 view
 2018-10-22         Todd

delete azure table storage row without checking for existence

I've been using azure table storage for years, and I'm not sure what the "proper" way to do this is with the newest WindowsAzure.Storage library, version 5.0.1-preview (for use in a new ASP.NET 5 application):Problem:Given a partition key and row key, delete the row without checking for existence first, and without failing if it does not exist.Current Solution: This code works... but the exception handling is confusing:public async Task DeleteRowAsync(CloudTable table, string partition, string row){ var entity = new DynamicTableEntity(partition, row); entity.ETag = "*...

 c#                     1 answers                     53 view
 2018-10-22         Todd

Beautify URL on Google App Engine PHP Static Website

I am developing a static website for my friend with some light vanilla PHP code. There is a .php on the url on every page such as xxxxx.com/service.php. I did some research and found out that tweaking on app.yaml is not an elagance method as it will not handling error 404 gracefully. What is in my mind is that I can create a special PHP file taking in request that end with .php from app.yaml and process each request like .htaccess. Due to my lacking of PHP knowledge, I am not able to produce the code in the file. Please enlighten me on the process.Below is my app.yamlruntim...

 php                     1 answers                     48 view
 2018-10-22         Todd

SyntaxError: invalid syntax when creating DataFrame with ArrayType

I want to create PySpark DataFramefrom pyspark.sql import SparkSessionfrom pyspark.sql.types import *from pyspark.sql import Rowspark = SparkSession \ .builder \ .appName("Test") \ .master("local[4]") \ .getOrCreate()schema = StructType([StructField('id', StringType()), \ StructField('timestamp',LongType()), \ StructField('coordinates',ArrayType())])rows = [Row(id="11", timestamp=1523975430000, coordinates = [41.5555, 2.1522])]df = spark.createDataFrame(rows, schema)However, I get the syntax error SyntaxError: invalid synt...

 python                     1 answers                     13 view

Page 1 of 146  |  Show More Pages:  Top Prev Next Last