2018-10-22         Darlene

how to delete a token JWT

I'm working on authentication on spring framework using JWT, bearer token. public String generateToken(UserProfile authentication) { // set the expiration time Date now = new Date(); Date expiryDate = new Date(now.getTime() + jwtExpirationInMs); // Generate token and return return Jwts.builder() .setSubject(authentication.getUsername()) .claim("roles","user") .setIssuedAt(new Date()) .setExpiration(expiryDate) .signWith(SignatureAlgorithm.HS512,jwtSecret) .compact();The above class generates a token and respond back to the user. My quest...

 java                     2 answers                     89 view
 2018-10-22         Darlene

Modify object before save and passing it to serializer

I'm trying to set some fields before saving an object that a user wants to insert. For example, if a user wants to create a new instance, before saving it, I want to set the field owner equal to request.user and then call the create method from the parent. I've achieved this with the following code:class ClassView(viewsets.ModelViewSet): queryset = ModelClass.objects.all() serializer_class = ModelClassSerializer def create(self, request, pk = None): if ModelClass.objects.filter(pk = request.user.id): return Response({'detail' : "This user is alrea...

 django                     1 answers                     23 view
 2018-10-22         Darlene

Python encoding for pipe.communicate

I'm calling pipe.communicate from Python's subprocess module from Python 2.6. I get the following error from this code:from subprocess import Popenpipe = Popen(cwd)pipe.communicate( data )For an arbitrary cwd, and where data that contains unicode (specifically 0xE9):Exec. exception: 'ascii' codec can't encode character u'\xe9' in position 507: ordinal not in range(128)Traceback (most recent call last): ... stdout, stderr = pipe.communicate( data ) File"/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py",line 671, in communicate return ...

 python                     1 answers                     66 view
 2018-10-22         Darlene

I don't know why it remains blank even though there is no error.

This is my code for a screen in pygame, but nothing appears except a black screen. There is no error but I'm new to python so could you tell me what's wrong?import pygame, sysfrom pygame.locals import*pygame.init()My ScreenDISPLAYSURF=pygame.display.set_mode((300,200), 0, 32)pygame.display.set_caption('WorldMaker')ColorsBLACK=(0,0,0)WHITE=(255,255,255)RED=(255, 0, 0)GREEN=(0,255,0)BLUE=(0,0,255)YELLOW=(255,255,0)Text and LinesDISPLAYSURF.fill(WHITE)pygame.draw.line(DISPLAYSURF, BLACK, (0,30), (300,30), 3)pygame.draw.line(DISPLAYSURF, BLACK, (200,0), (200,200), 3)myfont=pyga...

 python-3.x                     1 answers                     76 view
 2018-10-22         Darlene

Rewriting URLs in webpack

I'm using webpack to bundle files and import CSS. Inside a CSS file included from bootstrap, there is a font reference to /fonts/glyphicons-halflings-regular.ttf.Is there any way to instruct webpack to mount files from /node_modules/bootstrap-css-only/fonts/ to /fonts? Or to rewrite the HTTP request through webpack dev server based on a regex expression?Sorry if this is super basic, new to webpack. You can use file loader and adjust [path] variable:loaders: [ { test: /\.(png|jpg|svg|ttf|eot|woff|woff2)$/, loader: 'file?name=[path][name].[ext]' // your cas...

 webpack                     1 answers                     41 view
 2018-10-22         Darlene

Unable to connect to Command Metric Stream in Spring Cloud + Hystrix + Turbine - MIME type ("text/plain") that is not "text/event-stream"

I already went through the link: Unable to connect to Command Metric Stream for Hystrix Dashboard with Spring Cloud and tried few options, but nothing worked out for yet.I am developing Spring Cloud Code + Hystrix + Turbine.Could you please let me know what is the issue ? I am using Spring Boot v2.0.4.RELEASE.HystrixDashboardApplication.java@EnableTurbine@EnableHystrixDashboard@SpringBootApplicationpublic class HystrixDashboardApplication { public static void main(String[] args) { SpringApplication.run(HystrixDashboardApplication.class, args); }}pom.xml<pare...

 spring                     1 answers                     47 view
 2018-10-22         Darlene

Splash Screen Based on time of Day

Is it possible to have a different splash screen based on the time of day. I have tried to create values-night/styles.xml and values-notnight/styles.xml along with a drawable-night and drawable-notnight with same named images, but it is not alternating based on the time of the phone.Does anyone have experience with having different launch screens without using a timer in the main activity?Thus, doing a launch screen only until the main activity is loaded.Am I missing a setup step? values-notnight/styles.xml<resources> <!-- Base application theme. --> <...

 android                     1 answers                     72 view
 2018-10-22         Darlene

SUBSTRING WITH CHARINDEX

I have a column containing two concatenated data separated by a '/', I want to get only what is before '/' that is equal to a column of another table, so I am trying to use SUBSTRING with CHARINDEX, but I think I'm doing something wrong, follow the code. TRANSLATE: Olá, possuo uma coluna que contem dois dados concatenados separados por um '/', quero pegar apenas o que está antes da '/' que seja igual a uma coluna de uma outra tabela, para isso estou tentando utilizar o SUBSTRING com CHARINDEX, mas creio que estou fazendo algo de errado, segue o código.SELECT TOP 1 * FR...

 sql                     2 answers                     37 view
 2018-10-22         Darlene

Can you do queries against two databases if mysql_select_db was already used?

I have code that in the connection setup selects the database using mysql_select_db().$link = mysql_connect('localhost', 'user', 'pass');mysql_select_db("database1");Can I later run a query against two databases such as:SELECT database1.row, database2.row FROM database1.table, database2.table WHERE database1.row = database2.otherroweven though "database1" was already selected at first? Or is there a method for unselecting the database? You can. Also check this out: How do I construct a cross database query in PHP? [XXX]

 php                     1 answers                     56 view
 2018-10-22         Darlene

Could you explain "receiver" and "view - superview" in Swift?

override func draw(_ rect: CGRect) { let size: CGFloat = 20 let currencyLbl = UILabel(frame: CGRect(x: 5, y: (frame.size.height/2) - size, width: size, height: size)) currencyLbl.backgroundColor = #colorLiteral(red: 0.2549019754, green: 0.2745098174, blue: 0.3019607961, alpha: 0.5) currencyLbl.textAlignment = .center currencyLbl.textColor = #colorLiteral(red: 0.2549019754, green: 0.2745098174, blue: 0.3019607961, alpha: 1) currencyLbl.layer.cornerRadius = 5.0 let formatter = NumberFormatter() formatter.numberStyle = .currency formatter.locale = .c...

 ios                     2 answers                     0 view
 2018-10-22         Darlene

How to install fulltext on sql server 2008?

Trying to install fulltext on my sql server 2008 box.I went to 'programs and features', selected sql server 2008 and now I get this popup asking to choose either: add/ repair or remove.I click on add, and it asks me for the location of sql server CD? I extracted the ISO we have, not sure which file to point it too? Download the installer from:http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=1842 Or for SQL 2008 R2 Express, it is here:http://www.microsoft.com/en-us/download/details.aspx?id=25174Then go to where you saved it and Unzip the self extra...

 sql-server                     3 answers                     13 view
 2018-10-22         Darlene

Segmentation evaluation after border thinning not working

I am currently working on a image segmentation project with data from the ISBI-2012 segmentation challenge. I am trying to run the BeanShell script at this link: https://imagej.net/Segmentation_evaluation_after_border_thinning_-_Scripton my own predicted segmentation images. However, I cannot seem to reproduce the results with my images. predicted imageground truth imageand I get this as a result. I understand that the generated cell labels must be in a certain format, as described on the ISBI-2012 site: The results are expected to be submitted as a 32-bit TIFF 3D image, w...

 format                     1 answers                     21 view
 2018-10-22         Darlene

Remove / rebind SSL certificate from an Azure function using Azure SDK

I am trying to automate the process of obtaining an SSL certificate on my azure portal. For that I wrote an Azure function which downloads a new certificate and then uploads/binds it to my web app. The code looks like this: app.Update() .DefineSslBinding() .ForHostname("*.my.domain") .WithPfxCertificateToUpload(Path.Combine(executionContext.FunctionDirectory, "cert.pfx"), "pwd") .WithSniBasedSsl() .Attach() .Apply();which is supposed to upload a new certificate and create a new binding....

 c#                     1 answers                     32 view
 2018-10-22         Darlene

DocumentDb "where" clause with mathematical expression

I would like to understand how to create query where clauses on DocumentDB with mathematical comparator inside.For example, I used this demonstrator to understand how to make a "greater than" comparaison : expression AND food.version > 0 seems to work very well.Here is under what I tryed onto portal.azure.com documentdb query explorer and the results. I don't understand why I got an error in some cases(QUERY3), and (in option) how to get error details on portal.azure.com ?!Tested:>>> QUERY1 >>SELECT d.id, d.name, d.lastUpdateTimeFROM d >>...

 azure                     2 answers                     32 view
 2018-10-22         Darlene

failed to install constraintlayout for android 1.0.2

I am new to AndroidStudio and android programing please help me to solve my problemwhen I create new project on AndroidStudio v3.1.4 frist time build is started to sync after 20 seconds build sync failed and show me this error : Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.1.3.and error: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.android.support.test:runner:1.0.2.and Such 5 more error...I installed latest Sdk tools and Plugins..I...

 android                     2 answers                     36 view
 2018-10-22         Darlene

Android Studio: unable to find valid certification path to requested target using Proxy

I am under enterprise network and I have tried adding proxies into android studio as well as in gradle but still I am facing this issue of certificate path.I have also tried adding jcenter cert to studio but it does not help either.Here are the logs: Caused by: org.gradle.internal.resource.transport.http.HttpRequestException: Could not GET 'https://dl.google.com/dl/a ndroid/maven2/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.pom'.at org.gradle.internal.resource.transport.http.HttpClientHelper.performRequest(HttpClientHelper.java:96)at org.gradle.internal.resource.tra...

 android-studio                     1 answers                     0 view

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