on-internet

Access service into static method in Angular 5

I'm trying to access the service's reference into my static method like so : export class myComponent { constructor(private backend: BackendService) { } public static myMethod() { myComponent.backend.getData() .subscribe( data => { console.log(data) }, error => { console.error(error); } ); } } I'm getting Property backend doesn't exist on type 'typeof myComponent' How can I access backend reference? Thanks.

Join the discussion →

com.huawei.systemmanager/com.huawei.systemmanager.optimize.process.ProtectActivity}; have you declared this activity in your AndroidManifest.xml?

I am getting this error on my huawei nexus 6p while putting the app in protected apps list. "UncaughtException: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.huawei.systemmanager/com.huawei.systemmanager.optimize.process.ProtectActivity}; have you declared this activity in your AndroidManifest.xml?" and i am using this code to put the app in protected apps list if ("huawei".equalsIgnoreCase(Build.MANUFACTURER) && !settingsManager.getKeyStateProtectedApp()) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Is app killing?")

Join the discussion →

TypeError: expected string or bytes-like object ( Python 3) ( Wordcloud)

import pandas as pd import matplotlib.pyplot as plt from PIL import Image import numpy as np import wordcloud from wordcloud import WordCloud,STOPWORDS # Read the whole text. remarks = open(r'C:\Users\marmar\Remarks.txt').read().split() #Create words over an image mask = np.array(Image.open(r'C:\users\marmar\Documents\cloud.png')) #set the stopwords list stopwords= set(STOPWORDS) #append new words to the stopwords list new_words =open(r'C:\Users\marmar\Documents\comments.txt').read().split() new_stopwords=stopwords.union(new_words) #generate the word cloud with parameters wc = WordCloud( backg

Join the discussion →

shell script to move 2 files from one dir to another and rename it

I want to move 2 files from current directory to archive directory and rename the files while doing it with prefixing the date and changing the file extension. the script below it does work if i remove the move directory part of it. please see script and error message blow. the permission on the archive directory is 777 so is the files. #!/bin/bash cdate=$(date +%Y-%m-%d) destdir=${/home/dcaceres/load/archive} for file in allcustomer.csv loadcustomer.csv; do mv "$file" "$destdir/$cdate"_"$file"".ARCHIVE" done The error: ./archive_customer_load.sh: line 3: /home/dcaceres/load/archive: Is a dire

Join the discussion →

Tomcat: The server encountered an unexpected condition that prevented it from fulfilling the request

I had written a program that counts th times i visited the site. When i press run button there opens new window with this stack trace: I dont know what to do, beacause i am a newbie for tomcat. Im using Eclipse and tomcat 8.5. I also provide my project tree and web.xml I hope we`ll find the answer, because i want to continue learning, and for now i stuck on this.

Join the discussion →

How to select all data with query LIKE in Codeigniter [closed]

Why can not I use '%' or '' in LIKE query builder to select all data? I try in SQL shell can, but in query builder can not My Model public function ajax_getTargetMhs($where,$where2) { $this->db3->SELECT("nim,nama,kodeunit") ->FROM("akademik_ms_mahasiswa") ->LIKE('kodeunit',$where) ->LIKE('periodemasuk',$where2); $query = $this->db3->get(); if( $query->num_rows() > 0 ) { return $query->result(); } else { return array(); } } My Controller public function getTargetMhs($where,$where2) { $json =$this->Survey_Model->ajax_getTargetMhs($where,$where2); $arr = array(); foreach ($json as $results) { $ar

Join the discussion →

How to find elements in webview in android using appium

I am new in automation testing . I am trying to find elements in webview in Android app using appium . Below is code i am using but I am not able to find say div using its id private AppiumDriver<WebElement> driver; @Before public void setUp() throws Exception { // set up appium } @After public void tearDown() throws Exception { driver.quit(); } @Test public void webView() throws InterruptedException { DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("deviceName","Android Emulator"); capabilities.setCapability("appPackage", "com.hokucampusaffairs"); capa

Join the discussion →

Find the second largest number in an array

I have an array of three element like [31,23,12], and I want to find the second largest element and its related position without rearranging the array. Example: array = [21,23,34] Second_largest = 23; Position is = 1;

Join the discussion →

Str_Replace is replacing php syntax

functions/SkriptParser.php <?php $text = file_get_contents(basename($_SERVER['PHP_SELF'])); preg_match_all("/{(.*?)}/", $text, $matches); var_dump($matches[0]); echo str_replace($matches[0],"Test",$text); ?> Is my current code, this is called from my index page which is here: index.php require_once 'functions/SkriptParser.php'; When i open index.php it replace the correct strings [ It'll replace any string inside {} however, it seems to be replacing <?php and I have no clue why. Any ideas?

Join the discussion →

Unexpected HTTP/1.x request: POST /3/device/XXXX

Hi i am sending IOS push notifications using apns and curl in php and getting this error message. I also define 'CURL_HTTP_VERSION_2_0' but still getting this error: Unexpected HTTP/1.x request: POST /3/device/ Here is my code: $key_file = XXXXXX'; $secret = null; $private_key = JWKFactory::createFromKeyFile($key_file, $secret, [ 'kid' => '3W6B5LQQHX', 'alg' => 'ES256', 'use' => 'sig', ]); $payload = [ 'iss' => 'RUK725A7V4', 'iat' => time(), ]; $header = [ 'alg' => 'ES256', 'kid' => $private_key->get('kid'), ]; $jws = JWSFactory::createJWSToCompactJSON( $payload, $private_key, $header ); if (!

Join the discussion →

How to fix Vivado synthesis syntax error at reg declaration?

I want to synthesize this code, but it keeps telling me that there is error at: reg button_old, button_raise; Is there anyone who knows what mistakes I have in the coding? We are doing project using nexys 4. We are able to simulate the code but are unable to synthesize it, so we are not able to proceed to the next steps. `timescale 1ns / 1ps module Player (input clk, input rst,input button, input [29:0] set, input button_p1, input button_p2, output [3:0]oscore1, output [3:0]oscore2, output LED_ON, output answer, output [3:0]seg1, output [3:0]seg2) reg button_old, button_raise; reg number; reg

Join the discussion →

Auto adjust height of the panel based on div height bootstrap

I am newbie to front end development.. We are building a one page app and we have two panels. Panel at the top contains a input text for search and below the input text is a ag-grid with pagination. When user clicks on some of the cell values in the grid column, a div with explanatory text appears below the grid and within the panel. Now this text length can vary from 2 lines to 20 lines. What I would like to achieve is auto adjust the panel height to cover both ag-agrid and div without any empty space when text is smaller and not have the text in div overflow the panel when the text is larger

Join the discussion →

How to remove unwanted white space from my print page

How to remove unwanted white space from my printed output, while printing my div. I have to print content of DIV like POS receipt but it getting extra white space at top and bottom, I just want print only div content. This image with marked unwanted space This is image of current printing receipt function printdiv(printpage) { var headstr = "<html><head><title></title></head><body>"; var footstr = "</body>"; var newstr = document.all.item(printpage).innerHTML; var oldstr = document.body.innerHTML; document.body.innerHTML = headstr+newstr+footstr; window.print(); document.body.innerHTML = oldst

Join the discussion →

Tomcat with https not working

I'm trying to enable my rest API URL with HTTPS. But first my tomcat should be running with https. When I run tomcat and check URL below https//localhost:8080 and http://hostedurl:8080 is working.I land up on apache tomcat page But when I run https://hostedurl:8080 it doesn't work ? May I know why it's happening....? Because hosttedurl works with http fine but not with https ...!! Any specific reason? server.xml <?xml version='1.0' encoding='utf-8'?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this

Join the discussion →

OCR and coordinate association on image for each character

I'm working on a project to help my visually impaired friend, a python script will first take a screenshot every second and whatever is on the image will be converted to text, and the character which is nearest to the coordinate of curser, will be the output. User can move the curser anywhere on screen and nearest alphabet to curser will be the output of program. Don't worry about the form of output, it will be in form audio. But for the sake of simplicity of question lets assume it's in the form of a single character text. Every tutorial I could find explained how to use OCR dependencies just

Join the discussion →

YouTube embedded player throwing 401 errors

I'm using the YouTube HTML5 embed player in an Angular app and I'm seeing these 401 errors pop up on page load (Chrome). Videos still play fine, but I'm wondering what's going on. I've tried pausing AdBlock and I see the same errors. www-embed-player.js:301 POST https://www.youtube.com/youtubei/v1/log_event?alt=json&key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9xx 401 () www-embed-player.js:301 POST https://www.youtube.com/youtubei/v1/log_interaction?alt=json&key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9xx 401 () I've been using this code for months and haven't seen this until now. This is the code that's failin

Join the discussion →

Chrome error: Package is invalid: 'CRX_VERSION_NUMBER_INVALID'

Can somebody help with this error? It comes up when I'm trying to install (drag and drop .crx file) custom chrome extension. The extension is working fine on another computers. { "manifest_version": 2, "name": "Foo", "description": "Bar", "version": "2.0", "browser_action": { "default_title": "Foo", "default_icon": "icon.png", "default_popup": "popup1.html" }, "background": { "scripts": [ "back.js" ] }, "permissions": ["<all_urls>", "tabs", "activeTab", "storage"], "content_scripts": [ { "matches": ["*://foo.bar.ms/*"], "js": ["websites/facebook/authorization.js"], "run_at": "document_start" }

Join the discussion →

Can't draw the epipolar lines in camera calibration and 3D- reconstruction using opencv & python

After I have generated the Fundamental and Essential Matrix from Camera calibration, I am trying to get the Epipolar lines, and draw them in my images to test the Matrix I have generated, following this python-opencv tutorial Here is the code for impelementing the drawing epipolar lines function: def drawlines(img1,img2,lines,pts1,pts2): ''' img1 - image on which we draw the epilines for the points in img2 lines - corresponding epilines ''' r,c = img1.shape img1 = cv2.cvtColor(img1,cv2.COLOR_GRAY2BGR) img2 = cv2.cvtColor(img2,cv2.COLOR_GRAY2BGR) for r,pt1,pt2 in zip(lines,pts1,pts2): color = t

Join the discussion →

error C2893: Failed to specialize function template 'unknown-type std::invoke(_Callable &&,_Types &&...) noexcept()'

Below is a certain program that is giving compile time errors. This has to do mostly with function Boo in class D. I am eventually trying to use a number of threads to call the solve method but this does not seem to be working out too well for me at the moment to get that far. The errors are: 1>d:\dummy\project1\trash.cpp(37): warning C4101: 'd': unreferenced local variable 1>c:\program files (x86)\microsoft visual studio\2017\community1\vc\tools\msvc\14.11.25503\include\thr\xthread(240): error C2672: 'std::invoke': no matching overloaded function found 1>c:\program files (x86)\microsoft visua

Join the discussion →

'Describe is not defined' when running my test

I'm getting the following error when running my test case with mocha ReferenceError: describe is not defined at Object.<anonymous> (/myproject/test/unit/physicalperson.spec.js:12:1) Someone knows why this is happens? package.json "scripts": { "test": "mocha" }, physicalperson.spec.js const request = require('supertest-as-promised'); const chai = require('chai'); const app = require('../../src/server'); const expect = chai.expect; const PHYSICALPERSON_ENDPOINT = '/api/physicalperson'; describe('Integration tests for Physical Person', () => { describe('\nFAIL Cases - Physical Person', () => { it

Join the discussion →

MemoryError when I merge two Pandas data frames

I have two large csv files (each with more than a million rows and about 300-400MB in size). They are loading fine into data frames using the read_csv function without having to use the chunksize parameter. I even performed certain minor operations on this data like new column generation, filtering, etc. However, when I try to merge these two frames, I get a MemoryError: merge_df = pandas.merge(df1, df2, left_on="Colname1", right_on="Colname2") I have even tried to use SQLite to accomplish the merge, but in vain. The operation takes forever. Mine is a Windows 7 PC with 8GB RAM. The Python vers

Join the discussion →

Diminuir script ou trocar por um código em PHP, ajuda [fechada]

Bom dia, se não for incomodar, necessito de ajuda com um script que fiz em java. <script type="text/javascript"> var data, horaAtual, tempoLimite; var clique = 0; function data() { data = new Date(); horaAtual = data.getSeconds(); tempoLimite = horaAtual + 10; } var gravado = new Array(); gravado.push(tempoLimite); function add() { clique = 1; } function calcular() { data; document.body.onmousedown = add; var numero = parseInt(gravado[0]); var data2 = new Date(); var horaAtual2 = data2.getSeconds(); if((numero - horaAtual2) < 5){ alert('Tempo limite atingido!'); } if(clique == 1){ var data3 =

Join the discussion →

How can I make legends have colours that correspond to data points using Python's Plotly?

I'm following the Plotly documentation for colouring a scatter graph. Here is my code: I first create a fake data frame with the same shape as what I'm working with: import pandas import colorlover as cl import plotly import plotly.graph_objs as go import numpy data = numpy.random.normal(0, 1, 3*6*11*2) data = data.reshape(((3*6*11), 2)) data = pandas.DataFrame(data) sub_experiments = ['Subexperiment_{}'.format(i) for i in [1, 2, 3]] repeats = ['Repeat_{}'.format(i) for i in range(1, 7)] time = ['{}h'.format(i) for i in range(11)] array = [sub_experiments, repeats, time] idx = pandas.MultiInde

Join the discussion →

Importing external module in single-file exe created with PyInstaller

I am using PyInstaller to create a single-file executable. Is it possible for my script to perform an import such that i) the imported module is imported from the same directory as the exe (i.e. it's not packaged into the exe) and ii) that imported module can import other modules that were packaged into the exe? The background here is that the imported module contains configuration that the user should be able to modify. This may include creation of custom derived classes and use of enums from the packaged modules. I haven't found any advice on this, though it's a difficult search because ther

Join the discussion →

MATCH AGAINST multiple words AND OR not working in codeigniter model [duplicate]

I have one table like below ,table name is js_skills_achievements id skill1 skill2 skill3 skill4 1 java php html android 2 php java jquery html 3 sql php html jquery When admin search key is "java developer" SELECT * FROM js_skills_achievements WHERE MATCH(skill1,skill2,skill3,skill4) AGAINST ('java developer'); Its working for me , BUT I NEED MULTIPLE KEYWORDS not Working below QUERY SELECT * FROM js_skills_achievements WHERE MATCH (js_skills_achievements.skill1,js_skills_achievements.skill2,js_skills_achievements.skill3,js_skills_achievements.skill4) AGAINST('java developer') OR (MATCH (js_s

Join the discussion →

Access-Control-Allow-Origin Multiple Origin IP

cors problem with apache 2.2.15 i've read serveral posts but i can't find a solution for my problem: conf.inc for grafana dashboard <Location /grafana/dashboard/db/smart-meter-fault-management/> Header always set Access-Control-Allow-Credentials true Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT" Header always set Access-Control-Max-Age "1000" Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token" Header always append Access-Control-Allow-Origin: "http://10.17.52.50:18080" Header al

Join the discussion →

How can I load fonts from a different location in MathJax?

MathJax enforces a directory structure based on its library design. Fonts bundled with the library are in a subdirectory alongside some Javascript configuration and other components. I want to serve the fonts from a different location on disk but I'm not seeing any configuration values that allow me to do that. I've checked the documentation and while I'm seeing different ways to load the full library and pieces of configuration, I'm not seeing how to isolate the fonts. How can I load fonts from a different location in MathJax? Edit: This is a client-side solution; we're doing this in the brow

Join the discussion →

python callable class as a decorator naming convention

I have following decorator declared as callable object: class nest: def __init__(self, func): self.func = func def __get__(self, instance, owner): self.obj = instance self.cls = owner return self.__call__ def __call__(self, request, *args, **kwargs): .... Then I can use it in the code like that: class Abc: @nest def test(self, *args, **kwargs): My question is: what is the convention of naming such decorator ? When I look into different decorators declaration (e.g. as functions) they're always? starting with lowercase. Nevertheless class name should start with the uppercase (according to PEP8).

Join the discussion →

Finding Max date in hive

I have a column named "Date" which is in string datatype. 01-24-2018 04-30-2017 How to find the maximum of these dates which is in string? I used this query which is not returning the expected max. max(to_date(from_unixtime(unix_timestamp(b.Date,'MM-dd-yyyy')))

Join the discussion →

Wordpress/Elementor/PHP Code Widget: PHP code is not execute and everything after "=>" renders as plain text when I am logged out

I want to execute some PHP code in an WordPress Elementor template with the PHP Code Widget. Everything works fine as long as I am logged in. If I log out, the code is not executed and everything after "=>" shows as plain text. So e.g. the code <?php echo 'before'; $someArray = ['foo' => 'bar']; echo 'after'; ?> <b>some HTML</b> would result in the following string: 'bar']; echo 'after'; ?> The HTML after this is fine. If I place the same code in another widget outside of Elementor (e.g. the footer of the theme), everything also works fine. I am the admin of this single WordPress installation.

Join the discussion →
Older stories