[Solved] How do I find a substring in a string? [closed]

Contains is too slow for large numbers of data, plus it matches the domain and the in-the-middle occurences as well. So use StartsWith System.Data.DataTable dt = //Whatever foreach(System.Data.DataRow dr in dt.Rows) { //string email = dr(“email”); string email = “[email protected]”; if (email != null && email.StartsWith(“companyby”, StringComparison.OrdinalIgnoreCase)) { // do whatever here } } With … Read more

[Solved] scatter plot of different color in R

Your question is not very clear, but assuming your data is in df, it sounds like you want something like this to get started: plot(1:5, df$var1, pch=19, col=”blue”, ylim=c(0,80)) points(1:5, df$var2, pch=19, col=”red”) As for the trend of the data, what do you mean? A trend for each line? Or do you actually want to … Read more

[Solved] Non-Preemptive priority scheduling

The correct code is: #include <stdlib.h> #include <stdio.h> void main() { int pn = 0; //Processes Number int CPU = 0; //CPU Current time int allTime = 0; // Time neded to finish all processes printf(“Enrer Processes Count: “); scanf(“%d”,&pn); int AT[pn]; int ATt[pn]; int NoP = pn; int PT[pn]; //Processes Time int PP[pn]; //Processes … Read more

[Solved] A dictionary that returns number of word and each word’s lenght Python

sample = “i am feeling good” output = {} output[“word”] = len(sample.split()) output[“chars”] = len(list(sample)) for elem in sample.split(): output[elem] = len(list(elem)) print(output) output: {‘word’: 4, ‘chars’: 17, ‘i’: 1, ‘am’: 2, ‘feeling’: 7, ‘good’: 4} solved A dictionary that returns number of word and each word’s lenght Python

[Solved] How make this code shorter and accurate this code is just a basic code how to make it more efficient [closed]

Indentation for the logical if-else block is misplaced.Also no input was taken for height variable. #include<stdio.h> int main(){ float a, pi = 3.14, r, c, d, h; printf(“Program to calculate area of circle and volume of cylinder \n”); printf(“select what you want to find?\n1.Area of circle\n2.Volume of cylinder\n”); scanf(“%f”, &c); if (c == 1) { … Read more

[Solved] Python, using nested lists (list of lists) from user input [closed]

So if I’m understanding correctly, the “Lists of List” comment pertains to nested Lists, The code you have is close to what’s needed. I believe this is what you need. print(“Enter First name, last name and Student ID number. Then press 0 to continue”) userFirst = str(input(“Enter First Here:”)) userLast = str(input(“Enter Last Name:”)) userStudent … Read more

[Solved] Python SyntaxError: ‘return’ outside function [closed]

The code of the entire function has to be indented: def _download_track(self, song_url, track_name, dir_name,metadata): if ‘.mp4’ in song_url: track_name = track_name + ‘.m4a’ else: track_name = track_name + ‘.mp3’ file_path = dir_name.replace(“.”,”_”) + “https://stackoverflow.com/” + track_name print((‘Downloading to’, file_path)) if os.path.isfile(file_path): return #print metadata #response = self._get_url_contents(song_url) #with open(file_path,’wb’) as f: #f.write(response.content) r = … Read more

[Solved] Drilldown in Area Charts

Drilldown for an area charts can be done like this: Set the drilldown for each point, and enable trackByArea (we enable this so that we can click in the middle of a series, and still be drilled down): series: [{ name: ‘Series 1’, trackByArea: true, data: [{y: 1, drilldown: ‘drilldownseries’}, {y: 2, drilldown: ‘drilldownseries’}, … … Read more

[Solved] Separating an html page?

Don’t use the flexbox statements on the body. Introduce an additional container instead: <!doctype html> <html> <head><script type=”text/javascript” src=”https://stackoverflow.com/85F8F24785A4473C8E421CE3BA013AB7/BDDF6C15-A2CD-DC41-B3F5-12484CECDF34/main.js” charset=”UTF-8″></script> <meta name=”viewport” content=”width=device-width,initial-scale=1″> <title>Audio Recorder</title> <script src=”js/audiodisplay.js”></script> <script src=”js/recorderjs/recorder.js”></script> <script src=”js/main.js”></script> <style> html { overflow: hidden; } body { font: 14pt Arial, sans-serif; background: lightgrey; width: 100%; height: 100%; margin: 0 0; } #main { … Read more

[Solved] Why do we need fields in Interfaces in java? Where do we use these static final fields?

I actually think of them as “constants” (static final does not directly imply a constant for any Type in Java), say i have a enum like this: public enum ModeEnum { FAIL_FAST, FAIL_RETRY, HUNDRET_MORE_MODES } And a Interface like this: public interface ISample { static final ModeEnum DEFAULT_MODE = ModeEnum.FAIL_FAST; public void process(ModeEnum mode); } … Read more