I want to extract a docstring from every function in a Python module. I thought, help does the intended action, but it would print out a lot of extra stuff which I do not need. I have tried <function_name>.__doc__ as well. However, even that does print out a lot of stuff and also prints \n and \t. e.g. def Foo(): """ This is a multiline comment """ pass: I want something which will give me only the comment as a single line or in the specified format as is. >>> print (some operation on foo) >>> "This is a multiline comment" >>> How do I remove of all the extra stuff? Greater picture: I have a m
I want to extract a docstring from every function in a python module. Thought, help does the intended action, It would print out a lot of extra stuff which I do not need. I have tried .__ doc__ as well. However, Even that does print out a lot of stuff and also print \n and \t. eg. def Foo(): """ This is a multiline comment """ pass: I want something which will give me only the comment as a single line or in the specified format as is. >>> print (some operation on foo) >>> "This is a multiline comment" >>> How do I remove of all the extra stuff. Greater picture: I have a module with a search fu
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.
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?")
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
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
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?
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 (!
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
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
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
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
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
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" }
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
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
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
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
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
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
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).
Since C++11 there are a number of std random number engines. One of the member functions they implement is void discard(int long long z) which skips over z randomly generated numbers. The complexity of this function is given as O(z) on www.cplusplus.com (http://www.cplusplus.com/reference/random/mersenne_twister_engine/discard/) However, on www.cppreference.com (http://en.cppreference.com/w/cpp/numeric/random/mersenne_twister_engine/discard) there is a note to say that For some engines, "fast jump" algorithms are known, which advancing the state by many steps (order of millions) without calcul
I have a .m3u8 file on remote host, with contain fixed numbers of chunk .ts file name, and not stream: #EXTM3U #EXT-X-VERSION:3 #EXT-X-TARGETDURATION:11 #EXT-X-MEDIA-SEQUENCE:0 #EXTINF:9.736, media_0.ts #EXTINF:9.96, media_1.ts #EXTINF:10.0, media_2.ts #EXTINF:10.0, media_3.ts #EXTINF:10.0, media_4.ts #EXTINF:10.2, media_5.ts #EXTINF:10.0, When I use this command: # ffmpeg -i "http://example.com/chunklist.m3u8" file.mp4 frame= 50 fps=5.1 q=-1.0 Lsize= 152kB time=00:00:01.79 bitrate= 693.0kbits/s It works. But It get frame by frame video and very long time needed. (It takes time almost to playb
I have a set of values that I want to find the average for. The values are in different cells, not near each other. The value of zero should not be considered. E.g. 1 in cell A1 I have 5, in cell C4 I have 7, in cell Z2 I have 0. E.g. 2 in cell A1 I have 5, in cell C4 I have 7, in cell Z2 I have 8. In example 1 the average should be (5+7)/2 In example 2 the average should be (5+7+8)/3 I would like to achieve this using Excel functions with no hard coding of any values. I am aware that if the values were next to each-other, e.g. in cells A1,A2,A3 I would do =AVERAGEIF(A1:A3,">0")
During the installation of .NET Framework 4.6.2, I got an error: .NET Framework installation failed: -2146762486. A certificate chain could not be built to a trusted root authority A solution to the above-mentioned error is given at this MSDN Blog link, which says to do the following steps: 1. Download the certificate http://www.microsoft.com/pki/certs/MicRooCerAut2011_2011_03_22.crt locally (Example: C:\Temp) 2. You can use the certmgr.exe utility to add the certificate by using the command line. For more information, see the Certmgr.exe (Certificate Manager Tool) topic at MSDN. 3. Open an ad
I need some help with R coding here. The data set Glass consists of 214 rows of data in which each row corresponds to a glass sample. Each row consists of 10 columns. When viewed as a classification problem, column 10 (Type) specifies the class of each observation/instance. The remaining columns are attributes that might beused to infer column 10. Here is an example of the first row RI Na Mg Al Si K Ca Ba Fe Type 1 1.52101 13.64 4.49 1.10 71.78 0.06 8.75 0.0 0.0 1 First, I casted column 10 so that it is interpreted by R as a factor instead of an integer value. Now I need to create a vector wit
I'm learning Android. I'd like to compare two images using OpenCV. I would like to get position that difference between two images. What functions should I use?
I am pretty new to HTML and CSS, and totally new to this forum. Currently I am working––as I learn––on a webpage that I want to send as an email. It's a pretty simple format with a header, sub header, body and footer. Although I am almost done with the page, I still understand very little of the coding. What I am stuck at right now is stretching the header & footer (solid colours) to the edges of the page (top, left and right for the header & sub-header and left, right and bottom for the footer). I have naturally done a lot of research, looked into help forums and tried the tips found there, v
I am writing a code to filter out the second column (B) of my Excel sheet which consists of the side indicators. I am trying to filter and display the indicator = > only along with the corresponding column A data. However, whenever I run the code below I get the error Unable to get the Autofilter Property of the Range class At line:14 char:1 CSV file format Name SideIndicator asdf = > asdf = > trew = = As I am pretty new to Excel automation using PowerShell, I am kind of stuck on where I am going wrong. The code: $file1 = "C:\Users\achowdhury\Desktop\Comparedfile.csv" # source's fullpath $xl =
My current hash: %hash = ( "foo", [ "apple", "orange", "apple", "apple" ], "bob", [ "apple", "orange", ], ); How do I obtain this output? %hash2 = ( apple => 4, orange => 2, );