2018-10-22         Nicole

How To Check To See If A Concept Is A Child Of Itself

I'm linking a number of ontology models, all with a shared base model where all classes and relationships are defined. Each model was created by a different developer and have overlapping domains. I need to check to make sure that no circular references have been made. Such as A has a child B, B has C and then, by accident, C has the child A. It's possible in our software to achieve this without error. I have written SPARQL that catches A has child B and simultaneously B has child A, but I'm not sure how to resolve the first issue. Thanks. EDIT:I need to detect any rec...

 sparql                     1 answers                     83 view
 2018-10-22         Nicole

Refactoring SQL

I must connect from my Rails app to a remote database on a Java application.I have a query like this:find_by_sql("select c_templateid, c_templateinfoid, c_startdate, c_enddate, c_active,campaign, shortcode, prefix, c_descriptivename, c_description, c_templatename from (active_services aser join activity a on aser.c_primaryprefixid =a.c_primaryprefixid ) join matrix_templateinfo using(c_templateinfoid) where campaign is not null)")I need to refactor it to the AR#find() method, because I want later add complex :conditions on it. I dont want convert them into string to append ...

 sql                     1 answers                     80 view
 2018-10-22         Nicole

Load additional objects from Core Data when a user scrolls an MKMapView

With MapKit in the iPhone 3.0 SDK, you create objects that conform to the MKAnnotation protocol. Loading these onto the MKMapView is very easy. However, when a user scrolls the MKMapView, it's time to load new annotations. A likely place to request the new objects would be in mapView:regionDidChangeAnimated: which is called when the map's region is changed, and then add/replace the annotations with the new ones.Specifically, I'd like to query Core Data to retrieve all objects that exist within the current MKCoordinateRegion (mapView.region) so that I'm loading only the obje...

 iphone                     1 answers                     46 view
 2018-10-22         Nicole

PyJWT raises Signature verification failed

I'm trying to verify JWT which issued by ThingsBoard.But verification was failed with Signature verification failedMy test code is at below.def test_jwt_decoding(): jwt_options = { 'verify_signature': True, 'verify_exp': True, 'verify_nbf': False, 'verify_iat': True, 'verify_aud': False } token = 'eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbkB0LW1vbmV0LmNvbSIsInNjb3BlcyI6WyJURU5BTlRfQURNSU4iXSwidXNlcklkIjoiODNiYmEzNDAtMDI3ZC0xMWU4LWI4ZmEtYWY1YjU0OTEyMDA0IiwiZmlyc3ROYW1lIjoi7ISx64Ko7IucIiwibGFzdE5hbWUiOiLqtIDrpqzsnpAiLCJlbmFibGVkIjp0cnVl...

 python                     1 answers                     90 view
 2018-10-22         Nicole

AssertionError: Cannot apply DjangoModelPermissions on a view that does not have `.model` or `.queryset` property

I previously had this view on my project:from rest_framework import statusfrom rest_framework.views import APIViewfrom rest_framework.response import Responsefrom rest_framework.parsers import JSONParserfrom rest_framework.permissions import IsAuthenticatedfrom rest_api.my_app.serializer import MySerializerfrom my_project.models import Bagclass MyView(APIView): parser_classes = (JSONParser,) queryset = Bag.objects.all() permission_classes = (IsAuthenticated,) @staticmethod def post(self, request, format=None): serializer = MySerializer(data=request.DAT...

 django                     1 answers                     20 view
 2018-10-22         Nicole

Python, Pygame Mastermind lib - Use server functions from the client

This is my server code:from Mastermind import *from time import gmtime, strftimeimport globalv as gfrom db import *class Server(MastermindServerTCP): def __init__(self): MastermindServerTCP.__init__(self, 0.5,0.5,10.0) def serverAlert(self, msg="Test"): print(msg) def connectAlert(self, username): timestamp = strftime("%H:%M:%S", gmtime()) print(username + " connected to the server at: '%s'" % timestamp)if __name__ == '__main__': ....(Start server etc.)What I want to do, that I don't really know how, is I want to be able to call the c...

 python                     1 answers                     72 view
 2018-10-22         Nicole

Implement Spring Security for Rest Api

I use this code for Rest API authentication:@Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { Optional<String> basicToken = Optional.ofNullable(request.getHeader(HttpHeaders.AUTHORIZATION)) .filter(v -> v.startsWith("Basic")) .map(v -> v.split("\\s+")).filter(a -> a.length == 2).map(a -> a[1]); if (!basicToken.isPresent()) { return sendAuthError(response); } byte[] bytes = Base64Utils.decodeFromStr...

 spring                     2 answers                     46 view
 2018-10-22         Nicole

Android theme doesn't apply fully to a device

I have created a custom theme for my Android application. In the designer and several real test devices they all show correctly, but a particular device doesn't seem to apply parts of the theme correctly. It looks like for some reason anything inactive/disabled uses the styling for the opposite state. Example: The blue button is disabled, and the text in the input control is actually a hint, but they aren't grayed out despite that on the problematic device.The theme itself didn't change much from the base theme:<resources><!-- Base application theme. --><styl...

 android                     1 answers                     72 view
 2018-10-22         Nicole

SQL Server - How to add column with group subtotals to the query results

I have a database table with items that are placed in a tree hierarchy. Items have their IDs and ParentIDs. Each item has an Amount assigned to it, so when I pull data on my hierarchy and its Amounts, it looks like so:| ID | Name | ParentID | Level | Amount || 1 | ITEM 1 | NULL | 0 | 100 || 3 | - Item 1-1 | 1 | 1 | 100 || 7 | - - Item 1-1-1 | 3 | 2 | 100 || 8 | - - Item 1-1-2 | 3 | 2 | 100 || 4 | - Item 1-2 | 1 | 1 | 100 || 9 | - - Item 1-2-1 | 4 | 2 | 100...

 sql                     1 answers                     35 view
 2018-10-22         Nicole

Cant update image in php

<?php$connect = mysqli_connect("localhost", "root", "", "accounts");session_start();$param_email=$_SESSION['email'];// If session variable is not set it will redirect to login pageif(!isset($_SESSION['email']) || empty($_SESSION['email'])){ header("location: login.php"); exit;}if(isset($_POST["insert"])){ $file = addslashes(file_get_contents($_FILES["image"]["tmp_name"])); $query = "UPDATE users SET image='$file' where email= $param_email"; if(mysqli_query($connect, $query)) {echo '<script>alert("Image Inserted into Database")</script>'; ...

 php                     1 answers                     53 view
 2018-10-22         Nicole

Trying to duplicate a View without it's parent - Android

I've got a list of layouts that I use to generate a new Layout.However the problem is that before adding the list layouts to the new layout, I need to call removeView() as the list layouts are children. Calling this method removes the view from the UI which doesn't look so great.LinearLayout linearLayout = null; for(LinearLayout cardView : selectedCardIDList){ viewHeight += cardView.getHeight(); if(viewHeight < 842){ ViewGroup viewGroup = ((ViewGroup)cardView.getParent()); viewGroup.removeView(cardView); ...

 android                     1 answers                     98 view
 2018-10-22         Nicole

Change Notification with Sql Server 2008

I have an application that consists of a database and several services. One of these services adds information to the database (triggered by a user). Another service periodically queries the databases for changes and uses the new data as input for processing.Until now I used a configurable timer that queries the database every 30 seconds or so. I read about Sql 2005 featuring Notification of changes. However, in Sql 2008 this feature is deprecated.What is the best way of getting notified of changes that occurred in the database directly in code? What are the best practices?...

 sql-server                     4 answers                     9 view
 2018-10-22         Nicole

Reverse smallest currency unit

In order to use stripe with my Django application, I am using the following code snippet to transform e.g. 523.34 USD into 52334 CENTS. Currently, I have to handle a webhook sent from Stripe and therefore I have to reverse this. Meaning 52334 CENTS into 523.34 USD. I am a bit stuck with that and wonder if anyone could help me how I can reverse this calculation with my funciton:def smallest_currency_unit(large_currency_amount, iso_code): iso_code = iso_code.upper() exponent = iso4217.Currency(iso_code).exponent if exponent == 0: # 0 signals unused/nonexistent minor...

 python                     1 answers                     22 view
 2018-10-22         Nicole

Null byte injection still in PHP7?

I am wondering if Null Byte Injection is still an issue in PHP7?If null byte injection is exploitable in PHP7, then how can I prevent it?Thanks. I am not completly sure whether all related functions have been fixed in PHP 7. file_exists has been fixed for sure.In any case you can prevent it by not blindly accepting user data but validating it before-hand:<?php$file = $_GET['file']; // Whitelisting possible valuesswitch ($file) { case 'main': case 'foo': case 'bar': include '/home/wwwrun/include/'.$file.'.php'; break; default: include '...

 php                     1 answers                     32 view
 2018-10-22         Nicole

Best Practices for Primary Key in DocumentDB

I'm developing a web site with azure DocumentDB. I need to create unique and short primary key. Since there isn't available auto increment in documentDB is there any good way to handle this problem.I expect the answer with best practice advices. Thank You I have a document class whose primary key is named as PrimaryKeypublic class Document<T> : BaseDocument, IDocument<T> { [JsonProperty(PropertyName = "id")] public virtual T PrimaryKey { get; set; } }Since the document db primary key is id (lower case mandatory), You can replace the id wit...

 azure                     3 answers                     29 view
 2018-10-22         Nicole

Migrate project to gradle file??This project does not use Gradle build system.We recommend that you migrate to using Gradle build system

Am not getting gradle file in the Android project as it is unavailable in android studio bt is available in project file folder. I tried a lot to resolve this issue but I failed.Thanks in Advance The project thinks it's still a non-Gradle based project; it's not the presence of the build.gradle file that makes it Gradle-based, but it's how the project was set up in the first place. You'll need to re-import your project to finish the conversion to Gradle.First, though, it looks like you don't have a settings.gradle file; it looks like you need one. Since you've set up you...

 android                     2 answers                     103 view

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