StackOverflow.com

VN:F [1.9.22_1171]
Rating: 9.3/10 (9 votes cast)

Random snippets of all sorts of code, mixed with a selection of help and advice.

OxyPlot runtime chart

11 May 2021 @ 6:54 pm

I use Oxyplot to create 2 lineseries that run continuously and automatically update new data to delete old data. But only one line works well, the other one just shows the point and not connected to each other. How can i fix it? Thanks for your help! Below is my code. XAML: <Grid Margin="119,112,180,79.5"> <oxy:PlotView Grid.Row="0" Grid.Column="0" Model="{Binding DataPlot}" /> </Grid> Code behind: public MainWindow() { //InitializeComponent(); DataPlot = new PlotModel(); LineSeries s1 = new LineSeries { Title = "chuan", Color = OxyColors.SkyBlue, MarkerType = MarkerType.Circle, MarkerSize = 3, MarkerStroke = OxyColors.White, MarkerFill = OxyColors.SkyBlue, MarkerStrokeThickness = 1.5 }; LineSeries s2 = ne

Angular- How to skip valuechanges for one of the form elements

11 May 2021 @ 6:54 pm

I have 3 form elements defined this way: this.form = this.formBuilder.group({ name: ['', Validators.required], email: ['', Validators.required], preference: ['', Validators.required] }); this.form.valueChanges .pipe( filter( ({ name, email}) => name.length > 0 || email.length > 0 ), takeUntil(this.destroyed$) ) .subscribe(value => { this.onChange(value); this.onTouched(); }); How do I make sure valueChanges is not triggered when the value of preference is changed?

Postfix on-prem Office 365 connector setup

11 May 2021 @ 6:54 pm

Thanks for any input. Having an issue with postfix I just cannot find a solution to. Usually get the same error of something like Recipient address rejected: User unknown in virtual mailbox table. Obviously, I know why it is throwing an error but cannot figure out how to solve. We have an Office 365 tenant that handles email for mydomain.com, this successfully passes email to accounts hosted on exchange e.g. [email protected] and to postfix e.g. [email protected] (and should pass them back again). I CAN send email from office 365 to postfix but CANNOT send from postfix to office 365 (external emails work to and from both). Pretty sure the problem lies with either relay_domains/transport_maps or virtual/mailbox_transport settings in postfix but I cannot find a reference on how to configure (or which to configure) in order to fire email back to 365. Postfix config is here:

Not able to use Multi processing for a Nested for loop function in Python Jupyter Notebook

11 May 2021 @ 6:54 pm

I tried Multiple techniques to use multiple processing but failed. Normal for loop is taking days to execute and I may have done something wrong or the code is not optimized. for i in range(0,len(Years)): colname = int(Years[i]) Status[str(colname)] = '' for j in range(0,len(Unique_ID)): sample = SA_data[SA_data.accountID==Unique_ID[j]] Status.loc[j, 'accountID'] = Unique_ID[j] Status.loc[j, str(colname)] = np.where((((sample['YearMonth_Start'].values)<colname) & ((sample['saStatus'].values)=='Active')).any(),'True', np.where((((sample['YearMonth_Start'].values)<colname) & ((sample['YearMonth_End'].values)>colname) ).any(),'True','False')) I want to execute this piece of code in minimum time as possible. So I thought multiple processing would be the best option. Unique_ID has around 360000 ID's and Years has total 16 rows. I am not even able t

How to match urls with 3 slashes with REGEXMATCH function in Goggle Spreadsheets

11 May 2021 @ 6:53 pm

I have a list of URLS in google spreadsheet, and I'd like to match urls that contain 3 slashes (home page ulrs). I tried to use this formula but it doesn't match correctly =REGEXMATCH(B2;"^https?://.*?.[a-z]{2,6}/$")

SQL: How to check if rows of a table doesnt exist in another table?

11 May 2021 @ 6:53 pm

Currently, I have table A and table B in postgres that have some duplicates, I only want to select the rows that exist in Table A but dont exist in Table B, would this be a form of a left join? What would be the best way to achieve this?

Getting error “No such module” when I install my own CocoaPods

11 May 2021 @ 6:53 pm

Trying to create my own library I call pod install and the dependency is installed but i can't do import if you just download the zip archive with the library and drop it into the project, then everything works enter image description here Please tell me how to fix this problem

Converting datetime to dd/mm/yy h:m

11 May 2021 @ 6:49 pm

I am trying to convert the below date and time to dd/mm/yy H:M using javascript. February 24th 2021, 15:21:46 to 24/02/2021 15:21 I was trying - moment('February 24th 2021, 15:21:46').format('DD/MM/YYYY HH:mm') I am getting an invalid date. Any help is highly appreciated.

Obtener la máxima id en SQLite

11 May 2021 @ 6:45 pm

Queria consegir la ultima id de esta tabla Código tabla db.execSQL("CREATE TABLE RESERVAS(ID INTEGER PRIMARY KEY AUTOINCREMENT,EMAIL TEXT ,DEPORTE TEXT,HORA TEXT,FECHA TEXT,FOREIGN KEY (EMAIL)REFERENCES USERS (EMAIL))"); Mi intento de conseguirlo public int idUltimaReserva() { String consulta= "SELECT ID FROM RESERVAS WHERE ID = (SELECT MAX(ID) FROM RESERVAS)"; SQLiteDatabase database = getReadableDatabase(); Cursor cursor = database.rawQuery(consulta,null); return cursor.getInt(0); } pero de da este error Process: com.example.broadcast, PID: 12501 android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 1 at android.database.AbstractCursor.checkPosition(AbstractCursor.java:460) at android.database.AbstractWindowedCursor.checkPosition(Abstra

'geckodriver.exe binary cannot be found in PATH' when attempting to automate firefox browser with Appium

11 May 2021 @ 6:43 pm

I have been scratching my head with this issue, I can get chrome app running but firefox will not. I have added geckodriver.exe to my path variables (both user and system), install Firefox 64bit, and done all prerequisites to run appium tests (including reading this appium guide). I realise through searching the web this is a recent appium update, so I feel a bit like I'm in uncharted territory. Below is the code I have along with the error message when attempting to run (TestNG) public class test { public AndroidDriver<MobileElement> driver; public WebDriverWait wait; @BeforeMethod public void setup() throws MalformedURLException { DesiredCapabilities caps = new DesiredCapabilities(); System.setProperty("webdriver.gecko.driver", "C:\\Users\\Jack\\Downloads\\drivers\\geckodriver.exe"); caps.setCapability("deviceName&qu