2018-10-22         Hugo

flutter bloc pattren Stream Transformer objects causing syntax errors

I am new to Flutter and Dart language. while following along a tutorial I create a validator class which has 2 StreamTransformers, this is being done in an attempt for bloc pattren, where user will type email and password in 2 TextFields and hence will be validated everytime the text changes in them. And I am getting bulk of errors specifically in that validator class within the FromHandler constructor if I use incoming email or password they are recognized but when I put them within an if statement like I have done here they are not recignized as string objects and that is...

 android                     1 answers                     85 view
 2018-10-22         Hugo

Get multi-class confusion matrix equal to number of class labels

I trained Random Forest Classifier in sklearn to predict multi-class classification problem.My dataset has four class labels. But my code create 2x2 confusion matrixy_predict = rf.predict(X_test)conf_mat = sklearn.metrics.confusion_matrix(y_test, y_predict)print(conf_mat)Output:[[0, 0] [394, 39]]How can I get 4x4 confusion matrix to analyze TP, TN, FP, FN. From the documentation at http://scikit-learn.org/stable/modules/generated/sklearn.metrics.confusion_matrix.html y_true = ["cat", "ant", "cat", "cat", "ant", "bird"]y_pred = ["ant", "ant", "cat", "cat", "ant", "cat...

 scikit-learn                     1 answers                     65 view
 2018-10-22         Hugo

Where can we deploy FIORI Launchpad, when we have HANA XS running on HANA DB?

If the system landscape has HANA XS running in HANA DB, is it possible to deploy FIORI launchpad in the landscape. ? All the necessary steps are described in the official SAP HANA HANA XS Advanced Developer Guide. Please check the steps here: Developing SAP Fiori Launchpad ModulesBasically you have to do following steps:Enabled the SAP Fiori Launchpad Site Feature in the SAP Web IDE for SAP HANACreate a SAP Fiori Launchpad Site Module in your MTA ApplicationBuild and deploy the moduleAssign your UI5/Web Application to the Launchpad Site via configuration (as described in...

 hana                     1 answers                     100 view
 2018-10-22         Hugo

display MVCHtmlString base on user role

for example, I have a search form like below form, I want check if your has access see inputs ( a user may have access to see just one of them and the other may have access to see 3 of them ), what is the best method or extension to check mvchtmlstring @using (Html.BeginForm()){<div class="form-horizontal"> <h4>Course</h4> <hr /> @Html.ValidationSummary(true, "", new { @class = "text-danger" }) @Html.HiddenFor(model => model.CourseID) <div class="form-group"> @Html.LabelFor(model => model.CourseID, new { @class = ...

 asp.net-mvc                     1 answers                     70 view
 2018-10-22         Hugo

How to use this in ffi

std::string __cpuid(){ char VendorName[49] = {0}; char VendorID[13] = {0}; unsigned int a, b, c, d;__asm xor EBX, EBX;__asm xor ECX, ECX;__asm xor EDX, EDX;__asm mov EAX, 0x80000002;__asm cpuid;__asm mov a, EAX;__asm mov b, EBX;__asm mov c, ECX;__asm mov d, EDX;__asm mov DWORD PTR [VendorName + 0], EAX;__asm mov DWORD PTR [VendorName + 4], EBX;__asm mov DWORD PTR [VendorName + 8], ECX;__asm mov DWORD PTR [VendorName + 12], EDX;__asm mov EAX, 0x80000003;__asm cpuid;__asm mov DWORD PTR [VendorName + 16], EAX;__asm mov DWORD PTR [VendorName + 20], EBX;__asm mov DWORD ...

 assembly                     1 answers                     10 view
 2018-10-22         Hugo

How can I expire entries to Django database cache?

I have a Django application with a registered database cache:CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.db.DatabaseCache', 'LOCATION': 'exchange_rate_cache', }}I want the entries in my cache to expire and be deleted after a week. To delete an entry from the cache all that is needed is the following:from django.core.cache import cachecache.delete(key)However I must only perform this if the entry has been stored in cache for longer than 1 week.How can this be done? Thank you. I think you solve the problem at the wrong level: the CACH...

 python                     2 answers                     93 view
 2018-10-22         Hugo

D3 V4 with Angular-cli

I am using D3 charting library to create charts with Angular-cli. D3 version is 4.2.2. Following is what I am trying. import {Directive, ElementRef} from '@angular/core'; import * as D3 from 'd3'; @Directive({ selector: 'bar-graph', properties: ['data'], }) export class BarGraphDirective { private data:Array<number>; // raw chart data private htmlElement:HTMLElement; constructor(elementRef:ElementRef) { this.htmlElement = elementRef.nativeElement; // reference to <bar-graph> element from the main template c...

 javascript                     1 answers                     13 view
 2018-10-22         Hugo

does fread takes processing power / works with DMA?

does fread takes processing power / works with DMA ? Assume that device on which file is residing has DMA support ? Yes it does. But it will show up as "system" time when you use the "time" command in Linux.Basically, you make a system call, telling the OS what data to read and where to put it, then the OS (here comes the CPU cycles) sets up the buffers and tells the DMA where to put the data. Your process is blocked, and the OS picks a new process to run, but that's not really counting against your fread call. Eventually, the reading completes, and the DMA system is...

 fread                     2 answers                     47 view
 2018-10-22         Hugo

How to handle empty return from getJSON

Alright so I have a php script which gets results from a DB, and to get those results I'm using a jQuery script to pull the results via getJSON. It works perfectly but now I want to do something if the php script returns no results (empty).I tried:$.getJSON('path/to/script'), {parameter:parameter}, function(data){ if (data) { alert('Result'); } else { alert('Empty); }});But it's no good. I've tried different things like if (data.length) but still nothing. I've noticed that if there is no returned data the callback will never fire at all. So if that's the case, how do I ha...

 javascript                     4 answers                     80 view
 2018-10-22         Hugo

Use each row in one table by joining it to another table

I'd like a query that at its simplest will join 2 tables together with no other express relationship other than each row in what I will call the "pool" table will match to precisely 1 row in my other table. I don't care which row, I just want every row in my primary table to get a single row from the "pool" table and know that each row from the pool will only be used once.I was thinking something like ROW_NUMBER() OVER() could be used to match on an arbitrary row number which would be fine but I think requires at least 2 inner rowset providers; I thought there would be some...

 sql                     3 answers                     76 view
 2018-10-22         Hugo

Oracle NVL problem

I'm trying to pass a null value as something else in my db and it seems to work without a Where clause like soselect NVL(column1, '0') column1 from table1produces this 0 test1 0 test2 1 test3But when I add the where clause like soselect NVL(column1, '0') column1 from table1 where column1 <=1it produces this 1 test3But now if I add the following to the query it worksselect NVL(column1, '0') column1 from table1 where NVL(column1, '0') <=1But it seems like a long way round to get the value to show correctly with a Where clauseAny ideas what i'm doi...

 sql                     2 answers                     39 view
 2018-10-22         Hugo

kafka loses all topics on reboot

I'm trying out Kafka (0.8.2.1) in a VM, but am having trouble with it: though everything is fine while the machine remains on (even if I restart ZK/Kafka), if I reboot the machine (after gracefully shutting down ZK/Kafka) it seems all Kafka topics go lost.I'm probably missing something basic here, since this is probably not supposed to happen. What might it be?cd /vagrant/kafka_2.11-0.8.2.1bin/zookeeper-server-start.sh config/zookeeper.propertiesbin/kafka-server-start.sh config/server.propertiesbin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 -...

 apache-kafka                     1 answers                     30 view
 2018-10-22         Hugo

maven-assembly-plugin not copying .git folder

I'm using the plugin to copy over files, but it keeps ignoring the .git folder.<fileSet> <directory>${project.build.directory}/xyz</directory> <outputDirectory>/Final</outputDirectory> <includes> <include>**/*</include> </includes> <filtered>false</filtered></fileSet> .git diretory is ignored by default. See What files are excluded by default from Ant zip task?On the other hand, .git stores git repository metadata. It has nothing to do with the files you work on. Copying over it...

 git                     1 answers                     17 view
 2018-10-22         Hugo

How do I use wildcards to delete multiple files

I need to delete all .gr2 and .dds files in a folder. I have tried to do it within this piece of code:del "ToDelete/*/*.gr2"del "ToDelete/*/*.dds"pauseBut this code doesn't delete any of files. I guess I use the wildcards incorrectly. Wildcards can only be used in the last element of a path. You can use a for /D loop to loop through the parent directories of the files to delete:for /D %%D in ("ToDelete\*") do ( del "%%~D\*.gr2" "%%~D\*.dds")Add the /Q switch to delete without prompting.Note: In Windows, use \ as path separators as / might cause trouble.In case you...

 windows                     1 answers                     19 view
 2018-10-22         Hugo

Django Rest Framework: How to implement a nested logic?

Let's say I have three models as:class User(AppModel): name = models.CharField(max_length=255)class Business(AppModel): owner = models.ForeignKey("User", related_name="businesses", on_delete=models.CASCADE) legal_name = models.CharField(max_length=255)class Invoice(AppModel): business = models.ForeignKey("Business", related_name="invoices", on_delete=models.CASCADE) amount = models.integerField()As you can see, a user can have multiple businesses and a business can have multiple invoices.My serializers.py:class UserSerializer(serializers.ModelSerializer): ...

 python                     2 answers                     94 view
 2018-10-22         Hugo

Get data from another HTML page

I am making an on-line shop for selling magazines, and I need to show the image of the magazine. For that, I would like to show the same image that is shown in the website of the company that distributes the magazines.For that, it would be easy with an absolute path, like this:<img src="http://www.remotewebsite.com/image.jpg" />But, it is not possible in my case, because the name of the image changes everytime there is a new magazine.In Javascript, it is possible to get the path of an image with this code:var strImage = document.getElementById('Image').src;But, is it...

 javascript                     3 answers                     47 view

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