Vote count: 0 Looking for a clean function for this, ideally in Pandas/Numpy. I'm currently building something messy out of CustomBusinessHour() and TimeDelta() functions from Pandas, but I think that there must be a better way. If Pandas had a CustomBusinessMinute() feature, this would be as easy as len(pd.date_range(timestamp1,timestamp,freq=CustomBusinessMinute())). By "Business Minute," I mean a minute that meets certain criteria. For example, in my case this means 1) does not fall on weekend, 2) falls between 9am and 5pm, and 3) does not fall on Federal Holiday. Thanks asked 36 secs agoBryan Gnipp Let's block ads! بخوانید...
ادامه مطلبVote count: 0 I'm trying to duplicate the value of a strtok() token. I'm ruing strtok() on a string with volatile value. char buffer[100]; char temp[100]; for(int i = 0; i < 100; i++){ fgets(buffer, 100, my_file); fscanf(my_file, "%s", temp) } An example value for temp in this case might be "100,200,300" char my_array[3][3]; char* token; token = strtok(temp,","); while(token != NULL){ switch (token[0]) case 1 : strcpy(my_array[0], token); break; case 2 : strcpy(my_array[1], token); break; case 3 : strcpy(my_array[2], token); break; } What i'm attempting to do with strcpy() is to duplicate the value of the token, and store the duplicate value in an array. asked 2 mins agoKastoli Let's block a...
ادامه مطلبVote count: 0 I'm trying to completely make my view programatically. It has a bottom view that animates up when a search query finishes with the relevant information. I've set the .bottom nslayoutconstraint of the bottom view to an optional nslayoutconstraint, first initialising it off screen in override func viewWillLayoutSubviews(). let bottomView = UIView() var bottomViewBottomConstraint: NSLayoutConstraint! override func viewDidLoad() { super.viewDidLoad() view.addSubview(bottomView) } override func viewWillLayoutSubviews() { //Bottom View Constraints bottomView.translatesAutoresizingMaskIntoConstraints = false let bottomViewLeftConstraint = NSLayoutConstraint(item: bottomView, attribute...
ادامه مطلبVote count: 0 What I am trying to do: I want to output all of the books in the book node on my home page. What I need is an array of objects that contain all of the books in the book node so that I can loop through them using the ng-repeat directive in AngularJs. In the code below, when I console log the data, I get an object of objects, which caot be used with ng-repeat. Another issue that I am having is when I try to output the $scope.allBooks variable on to the page, nothing appears. Can anyone help me with this? // Main Controller firebase.database().ref('books').on('value', function(snapshot) { var data = snapshot.val(); $scope.allBooks = data; console.log(data); }); // Book Node in Fir...
ادامه مطلبVote count: 0 I am using Gmap.net API for a small vehicle tracking project. This project is in windows form c#. I am getting info from device like: Latitude, Longitude, Speed, Heading and some other information as well. The Heading information is in degree (0~359), How i can show that the vehicle is moving in some direction with an arrow sign? asked 1 min agoSaud Bin Tariq Let's block ads! بخوانید...
ادامه مطلبVote count: 0 I have a button that is already hooked up in the InterfaceBuilder to bring up a modal interface controller. In some cases I'd like to trigger this transition programmatically but I can't find a way to perform that same segue in Watchkit. I know you can do this in iphones/iOS but so far I can't find it in the Watchkit. asked 1 min agoSaviz Let's block ads! بخوانید...
ادامه مطلبVote count: 0 class ViewController: UIViewController { let manImage = UIImage(named: "man.png") let buttons = (0.....
ادامه مطلبVote count: 219 What exactly are the Python scoping rules? If I have some code: code1 class Foo: code2 def spam..... code3 for code4..: code5 x() Where is x found? Some possible choices include the list above: In the enclosing source file In the class namespace In the function definition In the for loop index variable Inside the for loop Also there is the context during execution, when the function spam is passed somewhere else. And maybe lambda functions pass a bit differently? There must be a simple reference or algorithm somewhere. It's a confusing world for intermediate Python programmers. edited Jul 9 '13 at 12:39Nawaz asked Nov 15 '08 at 1:48Charles Merriam 7 Answers Vote count: 204 ac...
ادامه مطلبVote count: 0 I have a macro enable workbook in my local folder. This workbook consists of 7 worksheet in total. Last sheet named as "AnsSheet". I want to save the last sheet (AnsSheet only) in the same folder location with modified name. Here is the code I am using which is not giving desired result. Could you please guide. Thanks in advance. Sheets("AnsSheet").Select Set wb = Workbooks.Add ThisWorkbook.Sheets("AnsSheet").Copy Before:=wb.Sheets(1) ActiveSheet.SaveAs Filename:=ActiveWorkbook.Path & "WF_Macro_" & Format(Date, "DD-MMM-YYYY") & ".xls" asked 47 secs agoSharma S Let's block ads! بخوانید...
ادامه مطلبVote count: 0 I'm have a sample of data of newbo siblings weight and sex, and want to plot them on a common 2x2 dot plot in R looking like the following done in Stata: 2x2 plot of birthweight of first compared to second child The stata code is this egen sex1sex2=group(sex1st sex2nd),label scatter weight2nd weight1st,by(sex1sex2) aspect(1) scheme(s1mono) The structure of the data in R is this: > str(siblings) 'data.frame': 1000 obs. of 5 variables: $ sex1st : int 1 1 1 2 1 1 2 1 2 2 ... $ sex2nd : int 1 2 1 2 2 2 1 2 2 1 ... $ weight1st: int 3740 3060 3650 3688 3740 3550 3850 3680 2390 3600 ... $ weight2nd: int 3740 3620 3700 3726 3000 3700 4020 4310 2250 3250 ... $ difw : int 0 560 50 38 -74...
ادامه مطلبVote count: 0 Having a file with just one column of data like for example: 10 2 34 4.5 16 I'd like to plot a stack of horizontal lines as plotting a horizontal line from let's say -3 to 3 (x range) for a y value equal to the first row (10 in the example), then replot a another horizontal line ranging form x=[-3:3] with a y value equal to the second row (2 in the example), and so on. How can I do it? asked 26 secs agoGilberto Zapata Let's block ads! بخوانید...
ادامه مطلبVote count: 0 I'm currently developing a webapp in Vuejs. I created a Mixin that I can access globally which handles any request to my api: export default { data() { retu { apiURL: 'http://example.com/api', timeout: 10000, }; }, methods: { callAPI(method, url, body) { this.$http({ url: this.apiURL + url, method, body, timeout: this.timeout, }) .then((response) => response, (response) => { if (response.data.error) { this.error = response.data.error; } else { this.error = 'We can't coect to the server. Please try again in a few minutes.'; } retu response; }); // retu 'test'; }, }, }; Now, in some of my components I call the api function: const api_response = this.callAPI('POST', '/auth', crede...
ادامه مطلبVote count: 0 I am searching a way to authenticate users from an Active Directory Server within my Python / Flask Application. Also needed is a verification step where the client certificates are checked. After the step the Python application should know the groups of the current user so that different access levels can be defined. In the last weeks I read about OAuth2, heard about SAML, ADFS and Shibboleth. Flask Oauthlib appears to provide a good solution for OAuth2 but it is no perfect match for the use case. (+ not really simple and kind of broken) Therefore: Has anybody tried to integrate ADFS into Flask? Any recommondations on how to this? I thought about using python-saml - can I make...
ادامه مطلبVote count: 0 I download and save an image on button click in my app. This works fine. If I view this image via the Gallery app (or any other way) it looks fine. However, if I try to open the image with: Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(imageFile), "image/*"); startActivity(intent); It prompts me what app I want to open the file with (Gallery or Photos). If I select Gallery, the image opens but is very low resolution. As the photo contains a lot of text, it makes it so you can't zoom in and read. If I select "Photos", it looks fine. Is there anything I can do to make it work fine in Gallery? asked 43 secs agoRHok Let's blo...
ادامه مطلبVote count: 0 Im using AlloyUI 3.0. I used the code above: YUI().use( 'aui-datatable', function(Y) { var columns = [ {label: 'ID', key: 'id'}, {label: 'Project Name', key: 'name'}, {label: 'Created At', key: 'created_at'} ], data = []; var myDataTable = new Y.DataTable({ plugins: [ { cfg: { selectRow: true }, fn: Y.Plugin.DataTableSelection }, { cfg: { highlightRange: false, type: 'rows' }, fn: Y.Plugin.DataTableHighlight } ], columns: columns, data: data }) .render("#myDataTable"); } ); How to get the selected row data? How to define the selection event, click, double click, etc? asked 2 mins agoFolken Laccour Fan...
ادامه مطلبVote count: 0 Downloaded the iOS Simulator for Windows Preview from the Xamarin site. As mentioned in the known issues, I ran the app first by unchecking the remote simulator checkbox in the visual studio options. After the app got installed, I again checked the checkbox to enable the remote simulator and ran the app from Visual studio. The Simulator started on my Windows machine successfully. But the app didn't launch automatically. I could manually launch the app, but couldn't do any debugging. Can somebody please help me with this? asked 33 secs agoJoseph Kallarackal Let's block ads! بخوانید...
ادامه مطلبVote count: 0 With API 24 we got a way to dispatch a gesture to the device, however there is no solid documentation or examples out there yet. I am trying to get it to work but currently the gesture is hitting the "onCancelled" callback every time. Here is my code that calls the method: @TargetApi(24) private void pressLocation(Point position){ GestureDescription.Builder builder = new GestureDescription.Builder(); Path p = new Path(); p.lineTo(position.x, position.y); p.lineTo(position.x+10, position.y+10); builder.addStroke(new GestureDescription.StrokeDescription(p, 10L, 200L)); GestureDescription gesture = builder.build(); boolean isDispatched = dispatchGesture(gesture, new GestureResultC...
ادامه مطلبVote count: 0 I am trying to create a new document wherein some of the field values would come from the current document. Note that current document is not in edit mode. There are three buttons in the current document: Edit Document //Validate inputs myForm = window.document.forms[0] myForm.Refresh.click() myForm.Edit.click() Add Guest //Validate inputs myForm = window.document.forms[0] myForm.AddGuest.click() Close myForm = window.document.forms[0] myForm.Close.click() Once the Add Guest button is clicked, it must be able to access the lotusscript agent which can be found in another hidden button, "AddGuest". @Command([ToolsRunMacro]; "AddGuests") Once the Add Guest button's clicked, there ...
ادامه مطلبVote count: 0 I'm using Google Apps Script, whose Drive library has the following function: setSharing(accessType, permissionType) accessType: Access (enum) permissionType: Permission (enum) To allow for a good user experience, I have the following objects to match enum values to nice Strings, and vice-verca (I only show here the objects for the Access, but I have the same for the Permission): /*** Method 1 ***/ var ACCESS_STR = {}; var ACCESS_ID = {}; ACCESS_STR[ DriveApp.Access.ANYONE ] = "Any."; ACCESS_STR[ DriveApp.Access.ANYONE_WITH_LINK ] = "Any. w/link"; ACCESS_STR[ DriveApp.Access.DOMAIN ] = "Domain"; ... ACCESS_ID[ "Any." ] = DriveApp.Access.ANYONE; ACCESS_ID[ "Any. w/link" ] = Driv...
ادامه مطلبVote count: 0 Creating a native activity in android: via vim & Makefile only no use of gradle, ant, maven, android.mk and all that other stuff I already created a (java-native) android apk via makefile that works well on my Samsung S7. When I try to run the app, it crashes. My gut feeling says I haven't compiled/linked the android_native_app_glue.c --> libandroid_native_app_glue.a with main.cpp --> libnative-activity.so properly. It works fine with Google's pre-compiled armeabi-v7a libnative-activity.so I create the static app-glue first as: aarch64-linux-android-gcc -march=armv8-a -c android_native_app_glue.c -o native_app_glue.o aarch64-linux-android-ar rcs libandroid_native_app_glue.a nat...
ادامه مطلب