Java – How do I call a method within a switch statement?

averageLength gets all the words the user has enters in the previous case and gets the average amount of words. the switch statement sits under the main method (not shown here) but when i try to implement case 3 to get the average it does not work because average is not declared under the main […]

Categories
Development

How to rotate coordinates (x,y) of an image at a specific angle

To best understand, please reproduce the code in a Jupyternotebook: I have two files: img.jpg and img.txt. Img.jpg is the image and img.txt is the face landmarks….If you plot them both, it will look like this: I rotated the image by 24.5 degree….but how to do I also rotate the coordinates? import cv2 img = […]

Categories
Development

X[Y] join of keyed data.table fails when key on numeric column AND data fread from a file

This one’s quite weird. Not sure if I’m missing something, or whether it’s a bug in data.table or fread. I’m trying to “stretch” a data table with a time series where one time point is missing. When this table is read from a file, the X[Y] join fills NA’s in the missing row but also […]

Spring data jpa with multiple entities not rolling back – PostgreSQL

I am using spring-data-jpa in one of my projects. In service layer, I have annotated a private method with @Transactional and also enabled @EnableTransactionManagement in application. When one of the save method of entities throws an exception, the rest of the entities which were saved before are not rolling back. BTW I am using PostgreSQL. […]

Can I Get Updates on the device’s Contacts List – with React-Native

On a React-Native mobile app, I need to access the contacts list, which is stored on the mobile device. The following 2 libraries provide this functionality. However, it seems that none of them provides information about which contacts have been updated (added/deleted/changed) recently. Is there any library, which (1) provides some sort of notifications, which […]

Categories
Development

How to find the intervals that are intersection of a circle with a rectangle

I need to integrate over the arcs that are resulted from the intersection of a circle with a rectangle and fall inside the rectangle. I can find the intersection points using the shapely package. However, I don’t know how to obtain integration intervals. For example, in the below figure my code returns [-2.1562, 2.1562] in […]

How to add button to a divider plugin (draft-js)

I installed a divider plugin to my draftJs Editor, it works ok, but it has only one button with this style “…” I need two more dividers in this toolbar with different styles. I tried to copy a button script and make a ButtonScript1, tried to copy the whole pluginfolder, but this do not work. […]

Replace string with quotes and slashes

I have the following string in a file: application=\”MyApp\” and I would like to remove it with PowerShell command (or replace with ”). I tried this and it didn’t work: powershell -Command “Get-ChildItem -Path ./Transform\*.json -recurse | ForEach {If (Get-Content $_.FullName | Select-String -Pattern ‘ where useraction.application=\\\”MyApp\\\”‘) {(Get-Content $_ | ForEach {$_ -replace ‘ where […]

LaunchMode “singleTop” is ignored when activity is started with startActivityForResult

I launch an activity with startActivityForResult() and want to prevent multiple instances from being started at the top of activity stack. So I expect android:launchMode=”singleTop” to do its work, but for some reason the flag gets ignored. After some investigations I managed to launch only one instance by adding FLAG_ACTIVITY_REORDER_TO_FRONT to intent, but I would […]

Categories
Development

Stuck on user’s location,cant zoom in or out

import UIKit import MapKit class ViewController: UIViewController,MKMapViewDelegate,CLLocationManagerDelegate { func viewForZoomingInScrollView(scrollView: UIViewController!) -> UIView! { return myMap } var locationManager = CLLocationManager() @IBOutlet weak var myMap: MKMapView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. self.locationManager.requestWhenInUseAuthorization() if CLLocationManager.locationServicesEnabled() { locationManager.delegate = self as CLLocationManagerDelegate locationManager.desiredAccuracy = […]