query_id
stringlengths
4
64
query_authorID
stringlengths
6
40
query_text
stringlengths
66
72.1k
candidate_id
stringlengths
5
64
candidate_authorID
stringlengths
6
40
candidate_text
stringlengths
9
101k
a2833d5b01a58faf200452434a1c6edac7ac44514b785f529996b52a080e8bae
['663201b5c287488e839dc2d9dfeb12cd']
So in the middle of formating one of my drivers battery died and after starting the laptop i got rescue grub . i tried all the hd partions with ls and none of them has the boot/grub in them. Using ls i am not getting all my partitions btw it is showing 3 while i have 5. After number of attemps with rescue grub i tried installing a new ubuntu and i got a menu suggesting memory test and disk defect test . I tried disk defect test option and i get this error: /script/init-top/framebuffer: line 125 cant fork /init: /scrpt/init-top/order:line 13 cant fork kernel panic - not syncing attemted to kill init exitcode=some number cpu:0 pid: 1 comm: init not tainted 3.19.0 - 25-generic some number again hardware name : my laptops model and its bios model call trace : weird stuff kernel offset: some number(relocation range) some number drm_kms_helper: panic occured, switching back to text console i am stuck in this page and i am on my phone sry about spelling errors
514cd6b3f2dedf20d381489efd3c20a130516b15f5fdd1d040e2d91033dc881d
['663201b5c287488e839dc2d9dfeb12cd']
I am relatively new to web development, so perhaps this is a rookie question. I am trying to set up an ASP.NET MVC web site to implement DotNetOpenAuth as an OpenID relying party. Right now it is all functioning, so that is pretty exciting. My goal though was to have the OpenID authentication take place it a popup window. This seems to be the default behavior when you using WebForms with the DNOA custom controls, but I haven't been able to figure it out in MVC. I thought I was getting close with this: var request = OpenIdRp.CreateRequest(id); request.AddExtension(new UIRequest(Mode = UIModes.Popup)); But the Mode field of the UIRequest is read-only. Does anybody know how to create a request that tells the OpenID provider to open a popup window? Thanks for any help. So far I have been unable to track down any samples of this in action.
58b288d3559e2786f94a8127f32b2e28cbd38cecefde040245a858036ce4b30b
['6636f4e0c705422ca0361bfa5f50d25f']
There are a few issues here... As <PERSON> mentioned, the newline character should be \n, not /n str.strip() does not modify the string directly. It returns a copy of the modified string. So it should be Whole = Whole.strip('\n') str.strip() remove leading and trailing characters. In your case, you wanted to remove the newline characters which are in the middle of the string. So you should use str.replace() instead, e.g. Whole = Whole.replace('\n', '')
920bbc93a60db1ee86daa42324952acde34c7df9c67c9aaccf198ed0afc99991
['6636f4e0c705422ca0361bfa5f50d25f']
What tool did you use to build your app? Is your app supposed to be a native Android app or Web app? Based on your screenshot, you've registered your app as a "Mobile Web" app (aka Web app) on Amazon Developer Console. For Web app, you don't upload an apk. Instead, you upload a .zip file which has a specific folder structure. You can check the Web app documentation for more info. If you have an .apk file, you're likely working with a native Android app. In such case, you should create a new "Android" app on Amazon Developer Console in order to upload your APK.
be22c8d2142d531bcd67fbac6c59e17e6a4cab94ef414abd313c9af798806a84
['6637f35053934bb3adfac7992674c7e2']
If I'm understanding you correctly, you want code to execute when the user either touches the screen or moves their finger across the contents of the a TextView while touching the screen. Since all touch events are not by default passed down to children Views, one way to handle this is to override the activity's onTouchEvent method and check against the locations of each TextView. I made an an example for you that does this: pulic class SomeActivity extends Activity { private TextView tv01; ... @Override public boolean onTouchEvent(MotionEvent event) { // Get the center location of the TextView. int[] tv01pos = {(int) tv01.getX(), (int) tv01.getY()}; // Some debuging logs, may be deleted. Log.d("position TV x", String.valueOf(tv01pos[0])); Log.d("position TV y", String.valueOf(tv01pos[1])); // Get the width and height of textView 01 for calculating the right and bottom boundaries. int tv01Wide = tv01.getWidth(); int tv01High = tv01.getHeight(); // Get the location of the touch event, event may be of type Donw, Move, or Up. // Keep in mind there are a LOT of these generated. int[] touchPos = new int[2]; touchPos[0] = (int) event.getAxisValue(MotionEvent.AXIS_X); touchPos[1] = (int) event.getAxisValue(MotionEvent.AXIS_Y); // More debug logs. Log.d("position Tch x", String.valueOf(touchPos[0])); Log.d("position Tch y", String.valueOf(touchPos[1])); // Check if the touch event is in the boundaries of TextView 01 if ( (touchPos[0] > tv01pos[0] ) && (touchPos[0] < tv01pos[0] + tv01Wide) && (touchPos[1] > tv01pos[1] ) && (touchPos[1] < tv01pos[1] + tv01High)) { // A toast letting you know it's working. Put your code here. Toast.makeText(view.getContext(), "In TextView01", Toast.LENGTH_SHORT).show(); } return true; } }
f3b3274fa163af2b70b957d0b0e09004a1c2a8cf4645a51e44dbf365139c2a7b
['6637f35053934bb3adfac7992674c7e2']
I have two questions, the first being simply: What is the easiest manner in which to add a custom flipping animation to an AdapterViewFlipper (where more than one property must be changed sequentially), preferably the solution using values defined in XML. In the second question I'm asking clarification on a very odd behavior that I will first explain. I've spent several days now messing around with animations trying to animate an AdapterViewFlipper as described above, mostly as a learning exercise. I have found that the methods available (inherited from AdapterViewAnimator are setInAnimatior() and setOutAnimatior(), both receive an ObjectAnimator parameter. ObjectAnimator as I understand (wrongly maybe?) to only be able to animate one Property per XML tag or Java instantiation, (sometimes an x and y Property simultaneously). The documentation shows that typically ObjectAnimators are grouped into AnimatorSet objects which can be created cleanly in XML, my problem is getting these AnimatorSet objects to animate the view transition. I was nearly to the point of creating an extension of AdapterViewFlipper to try to solve this when something weird happened. To explain, below is one of my original attempts to animate the flipping (I've simplified the code to a single flipping direction, the opposite direction is similar only differing in the XML "valueFrom" and "valueTo" values): ... AnimatorSet inLeftSet; AnimatorSet outLeftSet; @Override // This is in a fragment public View onCreateView(...) { ... inLeftSet = (AnimatorSet) AnimatorInflater.loadAnimator( this.getContext(), R.animator.card_flip_left_in); outLeftSet = (AnimatorSet) AnimatorInflater.loadAnimator( this.getContext(), R.animator.card_flip_left_out); } @Override public void onClick(View v) { switch (v.getId()) { ... case (R.id.next_image): outRightSet.setTarget(flipper.getCurrentView()); flipper.showNext(); inRightSet.setTarget(flipper.getCurrentView()); outRightSet.start(); inRightSet.start(); break; ... } And the corresponding XML files are: card_flip_right_in.xml <set xmlns:android="http://schemas.android.com/apk/res/android"> <objectAnimator android:duration="0" android:propertyName="alpha" android:valueFrom="1.0" android:valueTo="0.0"/> <objectAnimator android:duration="@integer/card_flip_time_full" android:interpolator="@android:interpolator/accelerate_decelerate" android:propertyName="rotationY" android:valueFrom="180" android:valueTo=" <objectAnimator android:duration="1" android:propertyName="alpha" android:startOffset="@integer/card_flip_time_half" android:valueFrom="0.0" android:valueTo="1.0"/> </set> card_flip_right_out.xml <set xmlns:android="http://schemas.android.com/apk/res/android"> <objectAnimator android:duration="@integer/card_flip_time_full" android:interpolator="@android:interpolator/accelerate_decelerate" android:propertyName="rotationY" android:valueFrom="0" android:valueTo="-180"/> <objectAnimator android:duration="1" android:propertyName="alpha" android:startOffset="@integer/card_flip_time_half" android:valueFrom="1.0" android:valueTo="0.0"/> </set> This did not produce the desired result (example of the desired animation can be viewed from this Tutorial). Rather the initial ImageView spun completely around before flickering and finally displaying the next ImageView suddenly and without animation. Here comes the weird part, I created this next snippet inside the onClick() for rotating right (next image), and it completely didn't work the ImageView just flashed to the next with no animation, BUT, when I accidentally clicked previous image (which has the same code as above) it animated perfectly!?!? Iterator<Animator> iterator = outRightSet.getChildAnimations().iterator(); while (iterator.hasNext()) { flipper.setOutAnimation((ObjectAnimator) iterator.next()); iterator.remove(); } iterator = inRightSet.getChildAnimations().iterator(); while (iterator.hasNext()) { flipper.setInAnimation((ObjectAnimator) iterator.next()); iterator.remove(); } There was originally more code as it was a test, but through trial and error I nailed down the part of the code that makes it work to the above snippet. What is stranger than anything is that I moved this out of the onClick() to the onCreateView() Override, right after the AnimatorSet objects are inflated and it still worked. Needing to only execute once for all animations to work as intended in both directions, rotating left and rotating right. Though I'm thrilled that it works, I'm bothered that it works, because I don't know why that it works. My original intention with the test code was to try to pass each ObjectAnimator from the AnimatorSet individually to the AdapterViewFlipper through setOutAnimation() and setInAnimation() methods, a test that I wasn't sure would do anything (I was having a hard time finding adequate usage explanations in the documentation) and now I would really like to understand what is going on, and if there is a simpler, more proper, or easier-for-others-who-may-need-to-work-on-my-code way to achieve this same result. Thanks in advance for any help.
1701fc1dbaeb45fc19b2e1ace02118bff8dd9e0805e8c2051f435f6c51c94f2a
['66454347245443ba84be73b88fa6105d']
*Is this accurate enough for a real-time server over the internet serving multiple clients?* Your question is too vague to get a good answer. When is accuracy enough in your case? It might be accurate enough for lets say a turn based computer game, but probably not accurate enough for intersatellite communication (assuming the comm is over internet :) ). Can you give some more context?
e0e51120633f864ad8b77291f4248d23b918e152228218c01709af0a5cb4fa58
['66454347245443ba84be73b88fa6105d']
A few quick observations: String extensions is generally a bad idea because string is such a common type. Conversion code can be written more defensively. Use TryParse instead of Parse and if TryParse fails then handle that by throwing an Exception, or some other error handling. Throwing a generic exception with no message is not great.
28b475cc4c2393178b5a5460beee5ec70cafb58059c3f2059fdb4d7657640d54
['664c2285e21542c8a64f9235b7928d52']
I'm inserting this custom code in Appearance > Customize > Custom Code > Custom JS: for (i=0; i<arr.length; i++) { console.log(arr[i]); } However, this ends up giving me a syntax error. When I check to see if the javascript appears correctly in my browser, this is what I get: for (i=0; i&lt;arr.length; i++) { console.log(arr[i]); } How can I get around this? Thank you!
ba1e799a084f4ec0ecb5f0fa94687c7194dcc3b6d1f147bb8f029177921f9054
['664c2285e21542c8a64f9235b7928d52']
going off of <PERSON>'s answer, the issue may sometimes even be a little subtler than an extraneous manual install of react-native-gesture-handler: for me, i found out that a package i updated recently included their own copy of react-native-gesture-handler as a dependency (found out by doing a search through my yarn.lock, package-lock.json, node_modules, etc.) - so i had to downgrade that package to a version that wasn't dependent on react-native-gesture-handler..
2928032274305640a81101d75e01803bcefe487775528ba0012cd3b63cd6a76c
['6655625ee206435bb3fe6bf9d562e65f']
Unfortunately there is no absolutely elegant solution to this one (as far as I've managed to accomplish). Hoping that Apple will eventually sort it out, but in the meantime, this is the nicest way possible: Place one custom segue instead of Show Detail In perform method of your custom segue have something like: - (void)perform { MasterViewController *source = self.sourceViewController; AppDelegate *appDelegate = [UIApplication sharedApplication].delegate; UISplitViewController *splitViewController = appDelegate.splitViewController; if ([splitViewController.viewControllers count] > 1) { [source performSegueWithIdentifier:@"showDetail" sender:source]; if (appDelegate.masterPopoverController) { [appDelegate.masterPopoverController dismissPopoverAnimated:YES]; } } else { [source performSegueWithIdentifier:@"showDetailSmallDevice" sender:source]; } } [splitViewController.viewControllers count] is here just to separate large devices (iPads & iPhone 6 Plus) and the other, smaller ones In your Storyboard, wire up one segue named showDetail which is actually a showDetail, to the detail navigation controller, and directly to the contents view controller another showDetailSmallDevice which is actually Show (Push) See the example: http://i.stack.imgur.com/GQpg3.png
64fbf087eb32eed376257383b3b32c1bcba8b8206b4442d7fcb16a5194490a57
['6655625ee206435bb3fe6bf9d562e65f']
When you initialize the UIImagePickerController make sure to set allowsEditing property to NO, which would allow you to get the full-sized original image. For an example, if you use: self.imagePickerController = [[UIImagePickerController alloc] init]; self.imagePickerController.delegate = self; self.imagePickerController.allowsEditing = YES; the resulting image you get in - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info from info[UIImagePickerControllerOriginalImage] will have it's size less than the actual original, like it's happening to you. But if you set self.imagePickerController.allowsEditing = NO;, UIImage from info[UIImagePickerControllerOriginalImage] will be the exact same size as it's in the library.
fbaa9f0e3c11682946dfe24fa0a412d2b5e61c647c8acc2f83c44b041eccfcde
['6664bf7903a54c35bdfbe92bca423dc0']
<PERSON> Hi, I added some more data to my question after moving to innoDB, also my above query just need to update 3612 rows. If I want to update all colors then the number of rows to update will be much higher. But I am tring to improve this specific query to check less rows. I just moved to innoDB, and didn't do the rest of the suggestions in your answer. I'll check them now, but I wanted to update the question during this time, because moving to innodb changed some of the numbers in `explain` statement results.
9f5426a123571da27518f9854804ca0f895e510b3d539795e1590110ee2758f0
['6664bf7903a54c35bdfbe92bca423dc0']
I'll provide an exact account of what I'm trying to do, in case the answer can vary depending on the plug-in. At work, I've installed the Feed Intent Viewer plugin without incident [With the latest Chrome version]. When I wanted to install the same plugin into my Chrome browser at home, I was prompted to sign in to Chrome. When I refused to do that, the browser didn't allow me to install the extension. I was signed in in neither of those cases, yet I was able to install an extension in the first case and not in the second. Why? Can I somehow work around it?
68621f7f23a5861f2a13a12384b4a261cf1903cd454d2424f50aeeee60eeefab
['66709f0e88ee45619a633a3e257e0dc9']
One way to accomplish this is to combine your year and quarter and join based on that. Your code already includes the quarter +1, so adding a line to each of your calls to mutate() and then using joining based on the new column. library(lubridate) library(tidyverse) dates_A <- sample(seq(as.Date('2005/01/01'), as.Date('2010/01/01'), by="day"), 1000) x_var_A <- rnorm(1000) d_A <- data.frame(dates_A, x_var_A) %>% mutate(quarter_A = quarter(dates_A), year_A = year(dates_A), YearQ = paste(year_A, quarter_A)) dates_B <- sample(seq(as.Date('2005/01/01'), as.Date('2010/01/01'), by="day"), 1000) x_var_B <- rnorm(1000) d_B <- data.frame(dates_B, x_var_B) %>% mutate(quarter_B = quarter(dates_B), year_B = year(dates_B), quarter_plus_B = quarter(dates_B + months(3)), YearQ = paste(year_B, quarter_plus_B)) final_d <- left_join(d_A, d_B))
4b6bd6b936d69026f62d957d7f1fc1b38f7145fac30e00fb196893cce56add44
['66709f0e88ee45619a633a3e257e0dc9']
You can use gather from tidyr. This converts the column name into a value in a new column. For example assuming your data is in a dataframe called df library(tidyverse) df%>% gather( key = "sampleID", # name for new column that will contain "NA, len1, len1,l1n2, etc) value = "length", # name for new column that will contain length values len1:len3 # columns to include in the process ) At this point you could drop the "sampleID" column if you wish, for example with df %>% select(-sampleID) # or other equivalent approaches select(df,-sampleID) # same command using tidyr without the pipe df$sampleID <- NULL # base R approach
ac76452ce42d88c523b083ca75edcb6d35c4a6191299fb32be6f8371d02c323d
['6672279535f04421906d7c61f74b3f34']
It seems that open two browser ( like chrome and safari ) for the two different phpmyadmin will do the trick. The reason causes this may be the server auth_type is the cookies for both the site. So, any tabs in one browser will share the same cookie for their host is the same.
5a613c543aa60c4808ef5876cae9f91b980dc7821f5873cb21888f7b7715b350
['6672279535f04421906d7c61f74b3f34']
In my case, it is the constroller's case problem, but a little different with @Brain's answer. It is because I use a default controller named as "AxxxxBxxx.php". I always got a 404 error. After I change it to "Axxxxbxxxx.php" and change the corresponding class name. It works. BTW, I use codeigniter 3.0. Hope it helps!
66a85c68ec4d46ec59853c405c0c475829a6b3170f86727f73f19b49ed57742c
['6679a88c6ea845e3a53209e3a99264cd']
I've been working on this for three days. I'm trying to format the text in a UITextField to output in currency format and left aligned. I can format the text in the variable to output as currency, but not in the textView, and NSTextAlignment keeps giving me an error. import Foundation import UIKit class dollarFieldDelegate: NSObject, UITextFieldDelegate { var currentString = "" var newCurrency = "" var newText: NSString = "" func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool { newText = textField.text textField.NSRightTextAlignment//Tried this several different ways, keep getting 'UITextField does not have member NSRightTextAlignment let convertToANumber = string.toInt() //check the replacment string for a Int. UIText // If string does not contain an Int, stringByReplacingCharactersInRange is not executed if convertToANumber != nil { currentString += string formatCurrency(string: currentString) newText = newText.stringByReplacingCharactersInRange(range, withString: newCurrency) println("in newText") println(newText) return true } else { return false}//returns false if checkToSeeIfItsANumber is nil } func formatCurrency(#string: String) ->NSString{ //println("format \(string)") let formatter = NSNumberFormatter() formatter.numberStyle = NSNumberFormatterStyle.CurrencyStyle //formatter.locale = NSLocale(localeIdentifier: "en_US") formatter.currencySymbol = "$" var numberFromField = (NSString(string: currentString).doubleValue)/100 newText = formatter.stringFromNumber(numberFromField)! //println(newCurrency) return newCurrency } } Also the output in the textField is 1234, but the output in the debugger is $1234.56 Thanks!
8b350a7d8dd181acbd3bb40b32568eeb251962b1ea80ca92ae504df15851d964
['6679a88c6ea845e3a53209e3a99264cd']
So I figured it out. And by that, I downloaded the solution. However, I don't understand why it works. Why does returning false (after converting the textField) give the correct solution? func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool { newText = textField.text let convertToANumber = string.toInt() //check the replacment string for a Int. // If string does not contain an Int, stringByReplacingCharactersInRange is not executed if convertToANumber != nil { currentString += string formatCurrency(string: currentString) newText = newText.stringByReplacingCharactersInRange(range, withString: newCurrency) textField.text = newText as String return false//sends correctly formatted $123.45 to viewController } else { return false}//returns false if checkToSeeIfItsANumber is nil
a5654daf5962b2562947760af12903a9e3132e9c814bf82a3b16723c58adb33d
['6683ffc12af04c09b575e980cc98d586']
Malloc's can overflow heap usage, even sparing use can lead to memory fragmentation, but your test code should be able to detect out of memory errors. Recursive function calls passing by reference can overflow stack usage. If you initialize the entire stack/heap with a set value, you can then scan them to see how much has been used during a test (e.g. fill with 0x3F, post test look for how much of this is 'corrupted'). Set up test cases that maximize the usage to gain confidence that it won't overflow. 1) If memory is plentiful, expand the size of your stack/heap. 2) If memory is tight, consider only static allocation, and don't use library functions that malloc. Reduce function depth and avoid recursion. Consider pushing larger local function variables to globals.
7eb5392ea6e62dd5d9aece03919d054bc259c28bde59afa8b49f5fc6371517f5
['6683ffc12af04c09b575e980cc98d586']
One way would be to create your own extension to the API to count contiguous FAT entries across all the sectors. Without modifying the API, you could use f_lseek(). Write open a file, use f_lseek() to expand the size of the file until 'disk full'(end of contiguous space). This would need to be repeated with new files until all of the disk was allocated. Pick from this the maximum allocated file, and delete the others.
509a5d28217120733d1849a7536b1ee831ede33956c7a70226ca4ff8668c1bd8
['6684bafbf1e94603a5caecbab1525d14']
Please try below code $startTime='09:00:00'; $endTime='11:00:00'; $Times=array(); $interval=15; while(strtotime($startTime) < strtotime($endTime)) { $Times[]=$startTime; $startTime=strtotime("+".$interval." minutes",strtotime($startTime)); $startTime=date('h:i:s',$startTime); } Output Array ( [0] => 09:00:00 [1] => 09:15:00 [2] => 09:30:00 [3] => 09:45:00 [4] => 10:00:00 [5] => 10:15:00 [6] => 10:30:00 [7] => 10:45:00 )
6d674f3716030d0dc45487e5fa69c8c4585214626097b2c911079e61395027a7
['6684bafbf1e94603a5caecbab1525d14']
Please check below solutions using mysql function. select prd_code,digits(SUBSTRING_INDEX( SUBSTRING_INDEX( prd_code , '(', -1 ), ')', 1)) as one from `your table` use below mysql function : DELIMITER | CREATE FUNCTION digits( str CHAR(32) ) RETURNS CHAR(32) BEGIN DECLARE i, len SMALLINT DEFAULT 1; DECLARE ret CHAR(32) DEFAULT ''; DECLARE c CHAR(1); IF str IS NULL THEN RETURN ""; END IF; SET len = CHAR_LENGTH( str ); REPEAT BEGIN SET c = MID( str, i, 1 ); IF c BETWEEN '0' AND '9' THEN SET ret=CONCAT(ret,c); END IF; SET i = i + 1; END; UNTIL i > len END REPEAT; RETURN ret; END | DELIMITER ; reference from this
8d15cbf42a3becab0e99951dfbb6f94d7f2ff09f1c74a82c7544fe4fbb8cd4f0
['668978d302334200ba72f861e191e7b0']
In case Mozilla doesn't getting around to making their new changes in FireFox 16's rendering engine backward-compatible, how do I prevent the browser from converting CSS3 non-matrix transfroms into matrixes? Below is an example of how this affects JavaScript-based animations, and why it's important to me. Pasted from my support.mozilla.org question Go to pilatch.com/cards and click any of the cards in the arc. Now do the same in Chrome, or Safari, or IE 9. I have un-min-catted all my JavaScript, so you can see what's going on more easily. CSS3 transforms in version 16 of FireFox are being converted into matrix transforms. It pretty much horks my rotate and scale animations. For instance, if you set the style attribute of an element to something like, style="transform:scale(0.75)", FireFox immediately converts that element's transform property, such as .style.transform to "matrix(...)". I know how to do the linear algebra to convert rotate and scale via jQuery cssHooks into matrix transformations, and I've even written code to detect this "feature" of a browser, (that it forces a transform into matrix), and return a different hook that writes a matrix transform instead of a rotate transform, or scale, all in the past two days, on my development site. However, it's proving to be increasingly challenging to make this new feature compatible with jQuery's animations. Going further, I may have to hack jQuery just to make this work for FireFox, or drop FireFox animation support altogether unless some FireFox developers make their new implementation backwards compatible. I know that transforms normally get converted into matrices behind the scenes in the rendering engine. Leave your matrix there. Don't overwrite what the user has put in for a transform! I also know that I should be using CSS3 animations, but, dangit, I started this project before those had widespread support. I can't rewrite all my animations because I want to support FireFox. That's not really an option. I'll direct my users to Chrome instead. I have more features in development that use these types of animation, and I'm in too deep to turn back.
f19d686e1f7c66c457e3c66b15095f1329e5a870ed02f3020b581f59275645e5
['668978d302334200ba72f861e191e7b0']
Trying gem install json-schema on the command line results in ERROR: While executing gem ... (Errno<IP_ADDRESS>EPERM) Operation not permitted - connect(2) for "<IP_ADDRESS>" port 53 I'm on a Mac which reports macOS Sierra 10.12.6. I have Xcode Version 9.2 (9C40b). I have rvm installed, and I'm using ruby 2.2.9. I get the same behavior with ruby 2.5.0. Same deal if I try to sudo gem install json-schema. Same thing if I try sudo gem install json-schema -n /usr/local/bin If you're wondering why I haven't upgraded to High Sierra yet, it's because my coworkers have, and let's just say it has not gone well for them. :/
edd9ce528295753b4efe9669bbb1a20199548ff221c953aab2dedc1901cc645c
['668d0785abdc4d9d8b861cc9ddd955b4']
I have a Java application running on an embedded linux (BusyBox v1.12.4). I am using CDC 1.1 and the version of the VM (cvm) is CDC HI phoneme_advanced-Core-1.1.2-b111. The application's main purpose is to collect some data and send it via GPRS (using the FTPClient of the Apache commons library) The application was running fine, and then lately I added the ability to compress a file before sending it. Following is the code that compresses the file: public static boolean compressFile(String file, String fileCompressed) { boolean result = false; try { Process process = Runtime.getRuntime().exec("tar -czvf " + fileCompressed + " " + file); System.err.println("Compression in progress"); int returnValue = process.waitFor(); System.err.println("Finished compression"); BufferedReader stderror = new BufferedReader(new InputStreamReader(process.getErrorStream())); String s; s = stderror.readLine(); if (s == null) { result = true; } else { result = false; System.err.println(s); } } catch (IOException e) { result = false; Log.getInstance().newMessage(e.getMessage(), Log.ERROR); } catch (InterruptedException e) { result = false; Log.getInstance().newMessage(e.getMessage(), Log.ERROR); } return result; } After adding this function, the application started crashing! The log didn't contain any memory error or exception and the system it's running on lacks correct configuration, so the syslog doesn't show anything as well (the equipment maker told me that it will be available in the upcoming version). I can't even launch the VM in debug mode! I have to add that the application doesn't crash during the compression, it just crashes randomly during its execution. The thing is that it crashes only when compression is enabled! Has anybody seen this before? does anybody have an idea on how to debug/solve this?
36ecaf2be3de216f19dc0ee5b52da06a8d01a5367e3f7976145dc5946be49a88
['668d0785abdc4d9d8b861cc9ddd955b4']
I have some load testing to do. My web application does not have a domaine name (only an IP adress) and uses HTTPS. When try to top use JMeter's Script Recorder, I get the following error in my web browser: An error occurred during a connection to 188.165.49.217:8443. SSL received a record that exceeded the maximum permissible length. Error code: SSL_ERROR_RX_RECORD_TOO_LONG And if I look at JMeter's log I see the following: Problem with keystore java.io.IOException: >> erreur keytool : java.lang.RuntimeException: java.io.IOException: DNSName components must begin with a letter << Command failed, code: 1 '"C:\Program Files (x86)\Java\jre1.8.0_121\bin\keytool" -genkeypair -alias 1XX.XXX.XX.XXX -dname "cn=1XX.XXX.XX.XXX, o=JMeter Proxy (TEMPORARY TRUST ONLY)" -keyalg RSA -keystore proxyserver.jks -storepass {redacted} -keypass {redacted} -validity 7 -ext san=dns:1XX.XXX.XX.XXX' at org.apache.jorphan.exec.KeyToolUtils.genkeypair(KeyToolUtils.java:171) ~[jorphan.jar:4.0 r1823414] at org.apache.jorphan.exec.KeyToolUtils.generateSignedCert(KeyToolUtils.java:285) ~[jorphan.jar:4.0 r1823414] at org.apache.jorphan.exec.KeyToolUtils.generateHostCert(KeyToolUtils.java:276) ~[jorphan.jar:4.0 r1823414] at org.apache.jmeter.protocol.http.proxy.ProxyControl.updateKeyStore(ProxyControl.java:1563) ~[ApacheJMeter_http.jar:4.0 r1823414] at org.apache.jmeter.protocol.http.proxy.Proxy.getSSLSocketFactory(Proxy.java:324) [ApacheJMeter_http.jar:4.0 r1823414] at org.apache.jmeter.protocol.http.proxy.Proxy.startSSL(Proxy.java:429) [ApacheJMeter_http.jar:4.0 r1823414] at org.apache.jmeter.protocol.http.proxy.Proxy.run(Proxy.java:194) [ApacheJMeter_http.jar:4.0 r1823414] 2018-04-16 17:33:24,397 WARN o.a.j.p.h.p.Proxy: [61014] Unable to negotiate SSL transaction, no keystore? 2018-04-16 17:33:24,397 ERROR o.a.j.p.h.p.Proxy: [61014]  Exception when processing sample java.io.IOException: Unable to negotiate SSL transaction, no keystore? at org.apache.jmeter.protocol.http.proxy.Proxy.startSSL(Proxy.java:446) ~[ApacheJMeter_http.jar:4.0 r1823414] at org.apache.jmeter.protocol.http.proxy.Proxy.run(Proxy.java:194) [ApacheJMeter_http.jar:4.0 r1823414] 2018-04-16 17:33:24,398 WARN o.a.j.p.h.p.Proxy: [61014]  Exception while writing error java.net.SocketException: Connection reset by peer: socket write error at java.net.SocketOutputStream.socketWrite0(Native Method) ~[?:1.8.0_121] at java.net.SocketOutputStream.socketWrite(Unknown Source) ~[?:1.8.0_121] at java.net.SocketOutputStream.write(Unknown Source) ~[?:1.8.0_121] at java.io.DataOutputStream.writeBytes(Unknown Source) ~[?:1.8.0_121] at org.apache.jmeter.protocol.http.proxy.Proxy.writeErrorToClient(Proxy.java:561) [ApacheJMeter_http.jar:4.0 r1823414] at org.apache.jmeter.protocol.http.proxy.Proxy.run(Proxy.java:258) [ApacheJMeter_http.jar:4.0 r1823414] The way I see it, the JMeterScript Recorder does not accept IP adresses for HTTPS recording, Am I right? Is there any way to around that (besides usin a domain name for my we app)? Regards <PERSON><IP_ADDRESS>:8443. SSL received a record that exceeded the maximum permissible length. Error code: SSL_ERROR_RX_RECORD_TOO_LONG And if I look at JMeter's log I see the following: Problem with keystore java.io.IOException: >> erreur keytool : java.lang.RuntimeException: java.io.IOException: DNSName components must begin with a letter << Command failed, code: 1 '"C:\Program Files (x86)\Java\jre1.8.0_121\bin\keytool" -genkeypair -alias 1XX.XXX.XX.XXX -dname "cn=1XX.XXX.XX.XXX, o=JMeter Proxy (TEMPORARY TRUST ONLY)" -keyalg RSA -keystore proxyserver.jks -storepass {redacted} -keypass {redacted} -validity 7 -ext san=dns:1XX.XXX.XX.XXX' at org.apache.jorphan.exec.KeyToolUtils.genkeypair(KeyToolUtils.java:171) ~[jorphan.jar:4.0 r1823414] at org.apache.jorphan.exec.KeyToolUtils.generateSignedCert(KeyToolUtils.java:285) ~[jorphan.jar:4.0 r1823414] at org.apache.jorphan.exec.KeyToolUtils.generateHostCert(KeyToolUtils.java:276) ~[jorphan.jar:4.0 r1823414] at org.apache.jmeter.protocol.http.proxy.ProxyControl.updateKeyStore(ProxyControl.java:1563) ~[ApacheJMeter_http.jar:4.0 r1823414] at org.apache.jmeter.protocol.http.proxy.Proxy.getSSLSocketFactory(Proxy.java:324) [ApacheJMeter_http.jar:4.0 r1823414] at org.apache.jmeter.protocol.http.proxy.Proxy.startSSL(Proxy.java:429) [ApacheJMeter_http.jar:4.0 r1823414] at org.apache.jmeter.protocol.http.proxy.Proxy.run(Proxy.java:194) [ApacheJMeter_http.jar:4.0 r1823414] 2018-04-16 17:33:24,397 WARN o.a.j.p.h.p.Proxy: [61014] Unable to negotiate SSL transaction, no keystore? 2018-04-16 17:33:24,397 ERROR o.a.j.p.h.p.Proxy: [61014]  Exception when processing sample java.io.IOException: Unable to negotiate SSL transaction, no keystore? at org.apache.jmeter.protocol.http.proxy.Proxy.startSSL(Proxy.java:446) ~[ApacheJMeter_http.jar:4.0 r1823414] at org.apache.jmeter.protocol.http.proxy.Proxy.run(Proxy.java:194) [ApacheJMeter_http.jar:4.0 r1823414] 2018-04-16 17:33:24,398 WARN o.a.j.p.h.p.Proxy: [61014]  Exception while writing error java.net.SocketException: Connection reset by peer: socket write error at java.net.SocketOutputStream.socketWrite0(Native Method) ~[?:1.8.0_121] at java.net.SocketOutputStream.socketWrite(Unknown Source) ~[?:1.8.0_121] at java.net.SocketOutputStream.write(Unknown Source) ~[?:1.8.0_121] at java.io.DataOutputStream.writeBytes(Unknown Source) ~[?:1.8.0_121] at org.apache.jmeter.protocol.http.proxy.Proxy.writeErrorToClient(Proxy.java:561) [ApacheJMeter_http.jar:4.0 r1823414] at org.apache.jmeter.protocol.http.proxy.Proxy.run(Proxy.java:258) [ApacheJMeter_http.jar:4.0 r1823414] The way I see it, the JMeterScript Recorder does not accept IP adresses for HTTPS recording, Am I right? Is there any way to around that (besides usin a domain name for my we app)? Regards Elie
b44b60a1d843a53e188133bbb3d997abb764d487426ea39a535f3eb0777bbd24
['669eda6d59b8486fa475d2e2fe64c0a0']
So I got it working after all. It seems that it was an impersonation issue after all. The odd part is that first time I call my code when impersonating a local user on my PC which also is created as a local user on the server, I get a 2059. The second time I call the exact same code literally 2 seconds after, I can now read messages from the queue. Really odd, but calling the read method twice did the trick.
143ed931700ed2c9cb9212e6196cbe2b1ba8940736595f0d914ad5f6926ca87e
['669eda6d59b8486fa475d2e2fe64c0a0']
I have a site where I redirect the user to a url, created within a SQL query based on what he entered. So when someone for instance enters http://www.example.com/Something, they are automatically redirected to something like http://www.example.com/Templates/12ES.html?ID=a_very_long_string&URI=Something. This is all done in one PHP file, and the ID and URI parameters are dynamic. Is there a way to keep the URL the user entered in the browser while I let PHP do the redirecting silently? Thanks.
f02544b24e9c25af29dda59b63a206d4ae692f88284cb97ac3393f83fc94ad8b
['669f4e5cc39c424a994ef48df8783e59']
Find the equation of the plane that is tangent to the plane x = y² + z² - 2 on the point P(-1,1,0). I got the equation x = 2y - 3 out of $F_{x}\Delta x + F_{y}\Delta y + F_{z}\Delta z = 0 $. However this is a line, not a plane. Are my calculations just plain wrong? Or if I did the math right, then what does this mean? Why do I get a line instead of a plane?
ca57745e7bd27639d85833b53b2685596ff51a89b384ce3ecc607b4827f0eeb4
['669f4e5cc39c424a994ef48df8783e59']
I have a panel with a button in it. Clicking on the button will direct the panel to state "State2" adding another two buttons into the panel. During the state change, I want the panel to resize first and then show the newly added two buttons, so I applied transitions onto the state change. My question is: If I put the two buttons within a HBox directly under the addChild tag, it works fine. However, if I create a new component with the same code (HBox with two buttons in it) and then add the new component to the panel (Comp in the code commented), it won't show the resize effect. Could someone tell me how to fix this? Thanks in advance. <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local="*"> <mx:Script> <![CDATA[ protected function button1_clickHandler(event:MouseEvent):void { currentState="State2"; } ]]> </mx:Script> <mx:transitions> <mx:Transition> <mx:Sequence targets="{[comp,panel1]}"> <mx:Resize target="{panel1}" /> <mx:AddChildAction /> </mx:Sequence> </mx:Transition> </mx:transitions> <mx:states> <mx:State name="State2"> <mx:AddChild relativeTo="{panel1}" position="lastChild"> <mx:HBox id="comp"> <mx:Button label="B" /> <mx:Button label="C" /> </mx:HBox> <!--<local:Comp id="comp" />--> </mx:AddChild> </mx:State> </mx:states> <mx:Panel layout="horizontal" borderThickness="1" borderStyle="solid" id="panel1" title="AB"> <mx:Button label="A" click="button1_clickHandler(event)"/> </mx:Panel> </mx:Application>
9ff32689bf195b340cacd84ee121bdb78d132d5c16eb6a9ba6e249532e485abd
['66b0a9790c2c45f7bcd4f1bca876ab8a']
I'm using Slim Framework, trying to build a REST API. Long story short, I've been like for 4 hours looking for a solution for my problem, which it is that json_decode won't take as an argument the array that getBody() returns. Using Advanced REST Client for Chrome, the error I get when I do a post request is: Slim Application Error The application could not run because of the following error: Details Type: ErrorException Code: 2 Message: json_decode() expects parameter 1 to be string, array given File: C:\xampp\htdocs\farmacias\index.php Line: 100 Trace #0 [internal function]: Slim\Slim::handleErrors(2, 'json_decode() e...', 'C:\xampp\htdocs...', 100, Array) #1 C:\xampp\htdocs\farmacias\index.php(100): json_decode(Array) #2 [internal function]: {closure}() #3 C:\xampp\htdocs\farmacias\Slim\Router.php(172): call_user_func_array(Object(Closure), Array) #4 C:\xampp\htdocs\farmacias\Slim\Slim.php(1222): Slim\Router->dispatch(Object(Slim\Route)) #5 C:\xampp\htdocs\farmacias\Slim\Middleware\Flash.php(86): Slim\Slim->call() #6 C:\xampp\htdocs\farmacias\Slim\Middleware\MethodOverride.php(94): Slim\Middleware\Flash->call() #7 C:\xampp\htdocs\farmacias\Slim\Middleware\ContentTypes.php(80): Slim\Middleware\MethodOverride->call() #8 C:\xampp\htdocs\farmacias\Slim\Middleware\PrettyExceptions.php(67): Slim\Middleware\ContentTypes->call() #9 C:\xampp\htdocs\farmacias\Slim\Slim.php(1174): Slim\Middleware\PrettyExceptions->call() #10 C:\xampp\htdocs\farmacias\index.php(139): Slim\Slim->run() #11 {main} And my piece of code, being the line 100 the one with json_decode on it // POST /localidades $app->post('/localidades', function () use ($app){ // Obtenemos <PERSON><IP_ADDRESS>handleErrors(2, 'json_decode() e...', 'C:\xampp\htdocs...', 100, Array) #1 C:\xampp\htdocs\farmacias\index.php(100): json_decode(Array) #2 [internal function]: {closure}() #3 C:\xampp\htdocs\farmacias\Slim\Router.php(172): call_user_func_array(Object(Closure), Array) #4 C:\xampp\htdocs\farmacias\Slim\Slim.php(1222): Slim\Router->dispatch(Object(Slim\Route)) #5 C:\xampp\htdocs\farmacias\Slim\Middleware\Flash.php(86): Slim\Slim->call() #6 C:\xampp\htdocs\farmacias\Slim\Middleware\MethodOverride.php(94): Slim\Middleware\Flash->call() #7 C:\xampp\htdocs\farmacias\Slim\Middleware\ContentTypes.php(80): Slim\Middleware\MethodOverride->call() #8 C:\xampp\htdocs\farmacias\Slim\Middleware\PrettyExceptions.php(67): Slim\Middleware\ContentTypes->call() #9 C:\xampp\htdocs\farmacias\Slim\Slim.php(1174): Slim\Middleware\PrettyExceptions->call() #10 C:\xampp\htdocs\farmacias\index.php(139): Slim\Slim->run() #11 {main} And my piece of code, being the line 100 the one with json_decode on it // POST /localidades $app->post('/localidades', function () use ($app){ // Obtenemos el cuerpo del request, y lo decodificamos $request = $app->request(); $body = $request->getBody(); $input = json_decode($body); // Creamos y guardamos el registro $eloc = R<IP_ADDRESS>dispense('localidades'); $eloc->nombre = (string)$input->nombre; $eloc->provincia = (string)$input->provincia; R<IP_ADDRESS>store($eloc); // Creamos y devolvemos JSON $app->response()->status(201); $app->response()->header('Content-Type','application/json'); echo json_encode(R<IP_ADDRESS>exportAll($eloc)); }); If anyone could help me, I would be delighted. Of course I would also like to know if I'm doing something wrong or approaching the wrong way. I spend a lot of time looking for an answer and I couldn't find any.
7ea7f89b354be0312eea8cee15d5728c0b5531f8ca80a56b52c8bef198563c4e
['66b0a9790c2c45f7bcd4f1bca876ab8a']
All I'm trying to achieve is simply to marshal to a xml file Contacto.java import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement public class Contacto { @XmlElement public String nombre; @XmlElement public String telefono; @XmlElement public String email; @XmlElement public String direccion; } Actividad.java import java.util.Calendar; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement public class Actividad { @XmlElement public Calendar fecha; @XmlElement public String lugar; @XmlElement public String motivo; @XmlElement public Contacto participante; } Agenda.java import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement public class Agenda { @XmlElement public String nombrePropietario; @XmlElement public Actividad actividad; @XmlElement public Contacto contacto; } This is the XML Schema generated using JAXB <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="actividad" type="actividad"/> <xs:element name="agenda" type="agenda"/> <xs:element name="contacto" type="contacto"/> <xs:complexType name="actividad"> <xs:sequence> <xs:element name="fecha" type="xs:dateTime" minOccurs="0"/> <xs:element name="lugar" type="xs:string" minOccurs="0"/> <xs:element name="motivo" type="xs:string" minOccurs="0"/> <xs:element name="participante" type="contacto" minOccurs="0"/> </xs:sequence> </xs:complexType> <xs:complexType name="contacto"> <xs:sequence> <xs:element name="nombre" type="xs:string" minOccurs="0"/> <xs:element name="telefono" type="xs:string" minOccurs="0"/> <xs:element name="email" type="xs:string" minOccurs="0"/> <xs:element name="direccion" type="xs:string" minOccurs="0"/> </xs:sequence> </xs:complexType> <xs:complexType name="agenda"> <xs:sequence> <xs:element name="nombrePropietario" type="xs:string" minOccurs="0"/> <xs:element ref="actividad" minOccurs="0"/> <xs:element ref="contacto" minOccurs="0"/> </xs:sequence> </xs:complexType> <xs:complexType name="principal"> <xs:sequence/> </xs:complexType> </xs:schema> And this is the Class where I try to instantiate some of the other classes and marshall their data to a xml file: import java.io.File; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import java.util.Calendar; import java.io.OutputStream; import java.io.FileOutputStream; import java.io.FileInputStream; import java.lang.Object; import java.io.IOException; public class Principal { public static void main(String[] args) { Contacto contacto = new Contacto(); contacto.nombre = "John Doe"; contacto.telefono = "911"; contacto.email = "<EMAIL_ADDRESS><PERSON> { @XmlElement public String nombrePropietario; @XmlElement public Actividad actividad; @XmlElement public Contacto contacto; } This is the XML Schema generated using JAXB <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="actividad" type="actividad"/> <xs:element name="agenda" type="agenda"/> <xs:element name="contacto" type="contacto"/> <xs:complexType name="actividad"> <xs:sequence> <xs:element name="fecha" type="xs:dateTime" minOccurs="0"/> <xs:element name="lugar" type="xs:string" minOccurs="0"/> <xs:element name="motivo" type="xs:string" minOccurs="0"/> <xs:element name="participante" type="contacto" minOccurs="0"/> </xs:sequence> </xs:complexType> <xs:complexType name="contacto"> <xs:sequence> <xs:element name="nombre" type="xs:string" minOccurs="0"/> <xs:element name="telefono" type="xs:string" minOccurs="0"/> <xs:element name="email" type="xs:string" minOccurs="0"/> <xs:element name="direccion" type="xs:string" minOccurs="0"/> </xs:sequence> </xs:complexType> <xs:complexType name="agenda"> <xs:sequence> <xs:element name="nombrePropietario" type="xs:string" minOccurs="0"/> <xs:element ref="actividad" minOccurs="0"/> <xs:element ref="contacto" minOccurs="0"/> </xs:sequence> </xs:complexType> <xs:complexType name="principal"> <xs:sequence/> </xs:complexType> </xs:schema> And this is the Class where I try to instantiate some of the other classes and marshall their data to a xml file: import java.io.File; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import java.util.Calendar; import java.io.OutputStream; import java.io.FileOutputStream; import java.io.FileInputStream; import java.lang.Object; import java.io.IOException; public class Principal { public static void main(String[] args) { Contacto contacto = new Contacto(); contacto.nombre = "<PERSON>"; contacto.telefono = "911"; contacto.email = "johndoe@gmail.com"; contacto.direccion = "742 Evergreen Terrace"; Actividad <PERSON> = new Actividad(); Calendar cal = Calendar.getInstance(); cal.set(2013,04,17,15,30,00); actividad.fecha = <PERSON>; actividad.lugar = "General <PERSON>"; actividad.motivo = "Reunion"; actividad.participante = <PERSON>; Agenda agenda = new Agenda(); agenda.nombrePropietario = "<PERSON>"; agenda.actividad = actividad; agenda.contacto = contacto; try { File file = new File("archivo.xml"); JAXBContext jaxbContext = JAXBContext.newInstance(Contacto.class); Marshaller <PERSON> = jaxbContext.createMarshaller(); // Salida jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); OutputStream os = new FileOutputStream(file); jaxbMarshaller.marshal(contacto, os); jaxbMarshaller.marshal(contacto, System.out); /* jaxbMarshaller.marshal(actividad, os); jaxbMarshaller.marshal(actividad, System.out); jaxbMarshaller.marshal(agenda, os); jaxbMarshaller.marshal(agenda, System.out); */ } catch (Exception e) { //JAXBException e e.printStackTrace(); } } } The problem is it never generates the .xml file. I just need to solve this small issue, I know I probably face the problem not in the best way, but i'm stucked here. Thanks in advance!
a98eead4275532efdcd6df7f66bdae2920cdb0ae75586858deba8aa851fcc276
['66c96eefcd4f4cb0b3034ce508bcdc14']
Are you trying to echo PHP data within HTML? If that is the case, keep in mind that you can just write your PHP and HTML code just mixed like this. Otherwise, please explain more what you are trying to do and consider posting more detailed code as it's not very clear to me. <html> <head> ... </head> <body> <form> <div id="div1"><?php echo 'some message'; ?></div> <input type="submit" id="submit1"> </form> </body> </html> You can also use <?= 'some message' ?> which is equivalent to <?php echo 'some message' =>.
1103ffe3efb3a1859dc70c872471c8acc2264dc8e77c32fe64fff8ba8feb243e
['66c96eefcd4f4cb0b3034ce508bcdc14']
I don't know whether it's possible within your given circumstances, but I'd definitely use events rather than looping. That means track when a point changes it's position and react to it. This is much more efficient as it needs less processing and refreshes the positions faster than every 1 second. You should probably put in some function-call-per-time cap if your points float around because then these events would be called very often.
682fe7e60355b2a91f8047275364087785b4325b8967ad64fac199e493907ac8
['66db23fcedcd433d946932f878689829']
I'm working in a strong regulation context, in which using opensource libraries (which is almost synonym of on GitHub nowadays) is permitted as long as you're able to have the source of all these libs. During feasibility stage , I've been linking libs on my project using nuget, storing the project in Git, so far so good. Before going in production stage, I would like to be able (at least for each production release, even for nightly builds if possible) to have "somewhere" the source of all the libraries that I use. There might be a strategy for doing this without nuget but with git and submodules, but It doesn't look obvious for me. Anyone has an idea about how to do this ? Thanks !
2525451c279ab8e2b8fc9ff9da728d64f325071698e2f8f2f66a78313bcd6d17
['66db23fcedcd433d946932f878689829']
I'm trying to build an MVVM application without using any MVVM framework. I've defined my main window and viewmodel, an appcontroller, a couple of views (UserControl as generally adviced) that are displayed in a mainwindow panel, sharing the same look&feel by using composition with another usercontrol which contains common style , so far so good. My problem is : I would like that all my views "objects" share a couple of dependency properties (view title, help context , etc ...). The problem is : you cannot put the same DP name to several objects, you can not modify in design mode something that inherits from usercontrol (VS designer seems to only recognize Window, UserControl and Page objects) I think that I miss something here but cannot put the finger on it. Can you help me ?
dd21fdd929e7a2390f052ca63b4defddf6ad57571a5ccffed931c75d9b9849f5
['66dccc75888349298d39c1d0f9d429e6']
Some .x files when opened with something like wordpad have readable material. You can look at the vertices and all that and can even edit it. But some are just symbols which are not readable. My question is: Is there a way to be able to read the information? What I am trying to do is change the texture path name. The name that the .x file tells directx to go to to load a texture from file. What happens is I downloaded an .x file and the textures are not being loaded because the pathname for the textures is the pathname that whoever created the file used. And obviously I need to change it to where I have the textures now. Or I would have to create folders that match the pathname of every .x file I use which would just be silly. Anyway, any help would be greatly appreciated.
b07b1503263840651e9e7f6c618fee558593ac82bf9e4806e0460fe8da49da8d
['66dccc75888349298d39c1d0f9d429e6']
I am doing a report for a course where I need to plan a c++ game project. Part of the planning is to estimate how much memory the program will need. I am really unsure as to how to go about doig that. Should I be estimating the number of variable and their types, the number of classes, the number of funcions, the files used for the poject e.g. bitmap files etc... And adding up how much memory all of those combined will use? Am I looking at this completely the wrong way and/or being stupid? Feel free to say! Any help at all would be greatly appreciated. Thanks in advance.
6972a9ae50f090a96ab28e8fa5253e773b3c40c89d21071ed5dbc2a39ede8e55
['66e97afaaee14f5eae347aca55878cc0']
As aeroNotAuto mentions in his comment more information on how you are planning on experimenting (mic placement, recording techniques & equipment, etc) would be helpful. Mic choice boils down to how a mic sounds to you in the situation you place it. So your choice for your second mic would work fine since there's really no "wrong" answer. That being said, I'm not sure you wouldn't be better served upgrading your LD mic since getting a mic that offers different polar pattern choices expands what/how you can experiment.
8bbb007ffd2a31c8cab936f402ecd6573c961a99ff51405f3e1d4adf8fded1ac
['66e97afaaee14f5eae347aca55878cc0']
I am a pro musician .... yes i agree that similarity and 'content' in any alleged 'blind' study sample will manifest a relevant INACCURATE difference in results. This has to be done with PET or other diagnostics to arrive at the correct conclusion. However, as far as 'sacred' or metaphysical......the shape of the cochlea in the ear (natural biologic resonation chamber) and the mathematical science behind the theory of A-432 seems highly plausible https://www.youtube.com/watch?v=mdJinKf-lnw The human experience detects and reacts to the subtle events...such as 8 cycles per second....IMO.....especially in prolonged exposure..such as normal modern audiophilic activities. The experiment with the metal and the sand showing the perfectly formed patterns with A-432 I feel is conclusive to prove a dissonance exists in the tactile and biological architectural realm. Plus the body is 70% 'water' which has been shown to give the same pattern generated results. As a Professional musician there is NO DOUBT that music effects activity and the 'pace' of human activity.....MUZAK proved that with elevators.....internal thought and healing are natural not psychic human activities so my conclusion is 'YES' A-432 is probably a better vibrational experience which most likely has deeper results in the physical body.
85fec55391af79a23ad92dbbc8b7c34485bb70342ad2270b4afb6f5f8be067a2
['66eec57f827e4728a1d6210faf94f77e']
I have had success in using Glue + Deltalake. I added the Deltalake dependencies to the section "Dependent jars path" of the Glue job. Here you have the list of them (I am using Deltalake 0.6.1): com.ibm.icu_icu4j-58.2.jar io.delta_delta-core_2.11-0.6.1.jar org.abego.treelayout_org.abego.treelayout.core-1.0.3.jar org.antlr_antlr4-4.7.jar org.antlr_antlr4-runtime-4.7.jar org.antlr_antlr-runtime-3.5.2.jar org.antlr_ST4-4.0.8.jar org.glassfish_javax.json-1.0.4.jar Then in your Glue job you can use the following code: from pyspark.context import SparkContext from awsglue.context import GlueContext sc = SparkContext() sc.addPyFile("io.delta_delta-core_2.11-0.6.1.jar") from delta.tables import * glueContext = GlueContext(sc) spark = glueContext.spark_session delta_path = "s3a://your_bucket/folder" data = spark.range(0, 5) data.write.format("delta").mode("overwrite").save(delta_path) deltaTable = DeltaTable.forPath(spark, delta_path)
53c0fe1d802b4f56a5cbada3ad0e9bc37e7d7d2dae030915ee1adee0f914632d
['66eec57f827e4728a1d6210faf94f77e']
I have faced the same issue. The lambda filesystem is temporal, so you will need to do the autenticate process every time you run the function and the o365 lib will ask for the url. So try saving your token (o365_token.txt) in S3 instead of getting it in lambda filesystem and the use this token for authentication. I hope this code will help you: import boto3 bucket_name = 'bucket_name' # replace with your bucket name filename_token = 'o365_token.txt' # replace with your AWS credentials s3 = boto3.resource('s3',aws_access_key_id='xxxx', aws_secret_access_key='xxxx') # Read the token in S3 and save to /tmp directory in Lambda s3.Bucket(bucket_name).download_file(filename_token, f'/tmp/{filename_token}') # Read the token in /tmp directory token_backend = FileSystemTokenBackend(token_path='/tmp', token_filename=filename_token) # Your azure credentials credentials = ('xxxx', 'xxxx') account = Account(credentials,token_backend=token_backend) # Then do the normal authentication process and include the refresh token command if not account.is_authenticated: account.authenticate() account.connection.refresh_token()
e7a38a77af77c21920d1ac8ee856b5a81ffc2e2b6743b3353ef21d7777347047
['66f1ac142713486b9af59c93bff05591']
Like <PERSON> suggested in his answer, you probably want to declare a resource handler in your configuration class. What did the trick for me was to put a link in like this, especially the "media" attribute seemed to make the difference for my application. <link rel="stylesheet" href="<c:url value="/resources/css/bootstrap.min.css"/>" type="text/css" media="screen"> On top of that you need to pay extra attention to the path you declare in the resource handler and the actual path.
bbc35ac485bf1c2112ee8ef38c137fa38d0982f8d03741532dd483e91b32b8d1
['66f1ac142713486b9af59c93bff05591']
Basically you need to configure the TCP/IP in a hard coded way. How to do that is very well explaned here configuring SpringBoot for MSSQL : From the Start menu, open SQL Server 2014 Configuration Manager. Click Protocol for SQLEXPRESS under SQL Server Network Configuration on the left pane. On the right pane, right- click TCP/IP, and select Properties. On the TCP/IP Properties dialog box that appears, click the IP Addresses tab. Scroll down to locate the IPALL node. Remove any value, if present for TCP Dynamic Ports and specify 1433 for TCP Port. Now click OK and restart your SQL Server.
3ea770b619cd31a0c58ca7d1c1122cb7c237e18ccc6771c540272822b8d5c40d
['66ff76e0caef404098d976dcf679da7f']
Essentially, what I'm doing is writing my login and authentication routines for the CMS I'm developing. I'd like to incorporate the ability for a user to log in using Facebook or Twitter instead of having to type in their username and passwords. Part of the feature is the site owner would be able to turn this feature on and off, depending on their security preferences for managing their site. I've got the app set up in Facebook and Twitter, though what I'm running into is that the request will only ever be bounced back to one URL, even though I'm intending that the CMS be downloaded and installed on separate domains and run independently from one another. I've tried setting up a simple service that my CMS can dial home to (which is where the responses have to be funneled to due to Facebook and Twitter policy). Idealistically, my service would retrieve the user's facebook or twitter ID, and output the response data as an XML feed so that my CMS could parse the response and log them in accordingly. The part that I'm snagged on is the feed will prompt the user to login every time, so it seems like the permissions are not where they need to be, or the data just isn't crossing the domains appropriately. What am I missing here?
943d73904675ff1c8bd08d059b5c72abd6de5e7438f8a0ca1ab9d7c7817f71fd
['66ff76e0caef404098d976dcf679da7f']
We just had to solve this issue for a client at the agency I work with. I'll also describe the code here so just in case anything happens with the fiddle, it's here in perpetuity. The Fiddle https://jsfiddle.net/GrafikMatthew/7nx53twL/ The Libraries I'm using the 2.2 jQuery library for this, though I'm pretty sure an earlier version could be used if needed. <script src="https://code.jquery.com/jquery-2.2.0.min.js"></script> The CSS This is just a barebones presentation so these are the minimum styles required for this approach. You can modify these all you want to match your page design. <style type="text/css"> .nav-wrapper ul { margin: 0; padding: 0; list-style-type: none; } .nav-wrapper > ul<IP_ADDRESS>after { content: ""; clear: both; display: block; float: none; height: 0; } .nav-wrapper > ul > li { display: block; float: left; padding: 10px; position: relative; } .subnav-wrapper { display: none; background: #000; position: absolute; top: 100%; left: 0; } .subnav-wrapper > ul > li { padding: 10px; } .subnav-wrapper > ul > li > a { white-space: nowrap; color: #fff; } .nav-wrapper > ul > li:hover , .nav-wrapper > ul > li.hover { background: #000; } .nav-wrapper > ul > li:hover > a , .nav-wrapper > ul > li.hover > a { color: #fff; } .nav-wrapper > ul > li:hover > .subnav-wrapper , .nav-wrapper > ul > li.hover > .subnav-wrapper { display: block; } </style> The HTML I'm using a fairly straight forward markup for this menu structure, though since everything aside from the list and anchors, targeting is done via class name, so the elements can be swapped out for ones that work better for your project. <div class="nav-wrapper"> <ul class="nav"> <li><a href="#link-a">Link A</a> <div class="subnav-wrapper"> <ul class="subnav"> <li><a href="#link-a-a">Sublink A A</a></li> <li><a href="#link-a-b">Sublink A B</a></li> <li><a href="#link-a-c">Sublink A C</a></li> </ul> </div> </li> <li><a href="#link-b">Link B</a></li> <li><a href="#link-c">Link C</a> <div class="subnav-wrapper"> <ul class="subnav"> <li><a href="#link-c-a">Sublink C A</a></li> <li><a href="#link-c-b">Sublink C B</a></li> <li><a href="#link-c-c">Sublink C C</a></li> </ul> </div> </li> <li><a href="#link-d">Link D</a></li> </ul> </div> <hr /> <div class="dummy"> <p>Dummy content...</p> </div> The JS I'm using a standard anonymous enclosure and exposing jQuery via $. <script type="text/javascript"> (function($){ function MH_ResetAll() { $( '.nav-wrapper .hover' ).removeClass( 'hover' ); } function MH_Init() { // > // > Environment // > $( document ).on( 'touchstart', function( e ) { MH_ResetAll(); } ); // > // > Primary Navigation // > $( '.nav-wrapper > ul > li > a' ).on( 'touchstart', function( e ) { // Cancel default event behaviors... e.preventDefault(); e.stopPropagation(); // Hook the important elements for this event... var ThisA = $( this ); var ThisParentLI = $( ThisA.parents( 'li' ).get( 0 ) ); // Is there a subnav-wrapper in the parent list item? if( ThisParentLI.find( '.subnav-wrapper').length ) { // Is the parent list item already hovered? if( ThisParentLI.hasClass( 'hover' ) ) { // Handle the event as a link click... window.location.href = ThisA.attr( 'href' ); } else { // Reset all other hover states... MH_ResetAll(); // Add the hover class to the parent list item... ThisParentLI.addClass( 'hover' ); } } else { // Handle the event as a link click... window.location.href = ThisA.attr( 'href' ); } } ); // > // > Secondary Navigation // > $( '.subnav-wrapper' ).on( 'touchstart', function( e ) { // Prevent secondary navigation from bubbling up... e.stopPropagation(); } ); $( '.subnav-wrapper > ul > li > a' ).on( 'touchstart', function( e ) { // Cancel default event behaviors... e.preventDefault(); e.stopPropagation(); // Hook the important elements for this event... var ThisA = $( this ); // Handle the event as a link click... window.location.href = ThisA.attr( 'href' ); } ); } $( document ).on( 'ready', function() { MH_Init(); } ); } )( jQuery ); </script>
72f5cf4c7b981dec0c4f65c987407c1d0c8b512a39b7fff10ba6e74e326edd13
['6704b1309e64436c8e114c575930079f']
This is my simple filter table. <tr class="text-center" ng-repeat="ticket in filteredTickets = (vm.tickets | orderBy : vm.propertyName : vm.reverse | filter : vm.search | limitTo:vm.itemsPerPage:vm.itemsPerPage*(vm.currentPage-1))"> And a search input <input class="form-control w25 pull-right" ng-change="vm.searchChanged()" type="text" ng-model="vm.search" placeholder="Search..." /> And I created a fake td to get the value of filteredTickets.length (because I cannot get the value of this in the scope, if you know a way tell me) <td class="hidden" id="filteredTicketLength">{{filteredTickets.length}}</td> basically the innerText of this will have the length of the tickets after the filtering. Now here comes the problem. When I type something on the input search the totalItems does not update until I write/delete another character. Basically, the correct message is displayed after I write/delete another letter <span class="pull-left">Showing {{filteredTickets.length}} tickets of {{vm.totalItems}} found.</span> vm.searchChanged = function () { var filteredTickets = document.getElementById('filteredTicketLength'); console.log(filteredTickets); if(filteredTickets !== null) vm.filteredTicketLength = filteredTickets.innerText; vm.totalItems = vm.filteredTicketLength; }; How can I write that message showing x items of x found after the filtering? It's like the searchChanged function is being run before the filteredTicketLength is updated.
db35d7d711c37a18b7a43962fb107f3ebd14e5582a6c696cf55cec8a7273caa8
['6704b1309e64436c8e114c575930079f']
I have a table with this ng-repeat ticket in filteredTickets = (vm.tickets | filter : vm.search | orderBy : vm.propertyName : vm.reverse | limitTo:vm.itemsPerPage:vm.itemsPerPage*(vm.currentPage-1)) My thead call a function on ng-click ng-click="vm.sortBy('title');" And in my controller // table ordering vm.propertyName = 'ticketID'; // default order vm.reverse = true; vm.sortBy = function(propertyName) { vm.reverse = (vm.propertyName === propertyName) ? !vm.reverse : false; vm.propertyName = propertyName; } but it's not ordering well. I have multiple columns, some with integers other with strings and doesnt order correctly (it orders but randomly) Any help?
a4aca1dc232a8b6421f091f1df1e019f106b5c0128eb1c2b8b834a63f386c3d4
['6707adad6dc74bee8c647bfe5e7617a4']
Figured it out. Now though the code was an example that I had found the for loop was not working correctly for me, so I got rid of it. And for iteration I implemented a do-while loop. However, the code the works now. #include "stdafx.h" #include <iostream> #include <iomanip> #include <conio.h> #include <vector> #include <algorithm> using namespace std; int SIZE = 10; int main() { //this is my binary search int thisArray[10] = { 0,11,32,44,55,63,78,86,99 }; int i = 0; //index of the array int n = 0; //variable of number that will be looked for int first = 0; int last = SIZE - 1; int middle; int pos = -1; bool found = false; int count = 0; do { cout << "Enter a number to look for.\n"; cin >> n; while (first <= last) { middle = first + last / 2; if (thisArray[middle] == n) { pos = middle; cout << "item found at " << middle + 1; exit(0); } else if (thisArray[middle] > n) { last = middle - 1; } else { first = middle + 1; }//endif }//end while } while (found = true); return 0; }
2b6db82b6a04ac5e8a2a3149e3b765efe3bfcc090cedd43bd1ddc3d590fb2c9d
['6707adad6dc74bee8c647bfe5e7617a4']
I need to access a file and then display the content but for some reason I cannot display the full name. I made the variables fname and lname for the first and last name. For now I just wanted to read the first line correctly. I've gone over a lot of help material but have not understood how to figure it out. A push in the right direction or reading material would be awesome. Also anything that you think I could do better. Below is my code. **Dat file** <PERSON> 453456 1232 -4.00 <PERSON> 323468 1234 250.0 <PERSON> 1240 987.56 <PERSON> 234129 1236 194.56 Vai vu 432657 1240 -888987.56 <PERSON> 987654 1238 10004.8 <PERSON> 323468 1234 8474.0 <PERSON> 786534 1242 001.98 **main.cpp** #include <iostream> #include <iomanip> #include <string> #include <sstream> #include <fstream> #include "BankAccount.h" using namespace std; const int SIZE = 8; int main() { string accountName; string fname; string lname; int accountID; int accountNumber; double accountBalance; BankAccount accountArray[SIZE]; string line; int i = 0; int number = 0; ifstream inputFile; //istringstream ss(line); inputFile.open("BankData.dat"); getline(inputFile, line); istringstream instream(line); instream >> fname >> lname >> accountID >> accountNumber >> accountBalance; BankAccount buddy(fname, lname, accountID, accountNumber, accountBalance); cout << buddy.toString() << endl; } **BankAccount.h** #pragma once #include <iostream> #include <iomanip> #include <string> #include <sstream> using namespace std; class BankAccount { private: string fname, lname; string accountName; int accountID; int accountNumber; double accountBalance; int getID(); void addReward(double amount); public: //Default constructor BankAccount(); //Regular constructor BankAccount(string fname, string lname, int accountID, int accountNumber, double accountBalance); double getAccountBalance(); string getAccountName(); int getAccountNumber(); void setAccoutBalance(double amount); //BankAccount equals(BankAccount other); bool withdraw(double amount); void deposit(double amount); string toString(); }; BankAccount.cpp #include <iostream> #include <sstream> #include "BankAccount.h" using namespace std; double minBalance = 9.99; double rewardsAmount = 1000.00; double rewardsRate = 0.04; BankAccount<IP_ADDRESS>BankAccount() { accountName = ""; accountBalance = 0; accountNumber = 0; accountID = 0; }; BankAccount<IP_ADDRESS>BankAccount(string fname, string lname, int accountID, int accountNumber, double accountBalance) { this->accountBalance = accountBalance; this->accountID = accountID; this->accountNumber = accountNumber; this->accountName = accountName; }; double BankAccount<IP_ADDRESS>getAccountBalance() { return accountBalance; } string BankAccount<IP_ADDRESS>getAccountName() { return accountName; } int BankAccount<IP_ADDRESS>getAccountNumber() { return accountNumber; } void BankAccount<IP_ADDRESS>setAccoutBalance(double amount) { amount += accountBalance; } bool BankAccount<IP_ADDRESS>withdraw(double amount) { if (accountBalance - amount <= minBalance) { return false; } else { accountBalance -= amount; return true; } } void BankAccount<IP_ADDRESS>deposit(double amount) { accountBalance += amount; if (amount > rewardsAmount) { addReward(amount); } } void BankAccount<IP_ADDRESS>addReward(double amount) { accountBalance += (rewardsRate * amount); } string BankAccount<IP_ADDRESS>toString() { return "Account Name: " + fname +" "+ fname +"\n" + "Account Number: " + to_string(accountNumber) + "\n" + "Account Balance: " + to_string(accountBalance) + "\n\n"; } int BankAccount<IP_ADDRESS>getID() { return accountID; } //BankAccount BankAccount<IP_ADDRESS><PHONE_NUMBER> -4.00 Fernando Diaz 323468 1234 250.0 Vai vu 432657 1240 987.56 Howard Chen 234129 1236 194.56 Vai vu <PHONE_NUMBER> -888987.56 Sugata Misra 987654 1238 10004.8 Fernando Diaz 323468 1234 8474.0 Lily Zhaou 786534 1242 001.98 **main.cpp** #include <iostream> #include <iomanip> #include <string> #include <sstream> #include <fstream> #include "BankAccount.h" using namespace std; const int SIZE = 8; int main() { string accountName; string fname; string lname; int accountID; int accountNumber; double accountBalance; BankAccount accountArray[SIZE]; string line; int i = 0; int number = 0; ifstream inputFile; //istringstream ss(line); inputFile.open("BankData.dat"); getline(inputFile, line); istringstream instream(line); instream >> fname >> lname >> accountID >> accountNumber >> accountBalance; BankAccount buddy(fname, lname, accountID, accountNumber, accountBalance); cout << buddy.toString() << endl; } **BankAccount.h** #pragma once #include <iostream> #include <iomanip> #include <string> #include <sstream> using namespace std; class BankAccount { private: string fname, lname; string accountName; int accountID; int accountNumber; double accountBalance; int getID(); void addReward(double amount); public: //Default constructor BankAccount(); //Regular constructor BankAccount(string fname, string lname, int accountID, int accountNumber, double accountBalance); double getAccountBalance(); string getAccountName(); int getAccountNumber(); void setAccoutBalance(double amount); //BankAccount equals(BankAccount other); bool withdraw(double amount); void deposit(double amount); string toString(); }; BankAccount.cpp #include <iostream> #include <sstream> #include "BankAccount.h" using namespace std; double minBalance = 9.99; double rewardsAmount = 1000.00; double rewardsRate = 0.04; BankAccount::BankAccount() { accountName = ""; accountBalance = 0; accountNumber = 0; accountID = 0; }; BankAccount::BankAccount(string fname, string lname, int accountID, int accountNumber, double accountBalance) { this->accountBalance = accountBalance; this->accountID = accountID; this->accountNumber = accountNumber; this->accountName = accountName; }; double BankAccount::getAccountBalance() { return accountBalance; } string BankAccount::getAccountName() { return accountName; } int BankAccount::getAccountNumber() { return accountNumber; } void BankAccount::setAccoutBalance(double amount) { amount += accountBalance; } bool BankAccount::withdraw(double amount) { if (accountBalance - amount <= minBalance) { return false; } else { accountBalance -= amount; return true; } } void BankAccount::deposit(double amount) { accountBalance += amount; if (amount > rewardsAmount) { addReward(amount); } } void BankAccount::addReward(double amount) { accountBalance += (rewardsRate * amount); } string BankAccount::toString() { return "Account Name: " + fname +" "+ fname +"\n" + "Account Number: " + to_string(accountNumber) + "\n" + "Account Balance: " + to_string(accountBalance) + "\n\n"; } int BankAccount::getID() { return accountID; } //BankAccount BankAccount::equals() { // //}
5a8f1415980d31a8066d5e04d1f5119e64ae4f656d1ca9092580c7870de46ead
['6722337a97704d569b7f37b332392f9f']
In SSMS I've gotten my for xml path query written and it's beautiful. I put it in an "Execute SQL Task" in the Control Flow, set the resultset to XML. Now how to I get the results into an actual xml file that I can turn around and FTP to a third party? This should have been so easy! I would put the XML into a variable but we are looking at a HUGE file, possibly 100mb+ Do I need to use a Script Task? (I'd like to avoid that if there is another option.)
97f36e125bc0e872ff00edb77d098344d8e7aa5a0b015480682d9a9a695681eb
['6722337a97704d569b7f37b332392f9f']
I know it seems redundant converting to a DT_STR even though you know it's already a DT_STR but SSRS can be finicky: (DT_I8)(ISNULL((DT_STR,5,1252)Column_Name) ? (DT_I8)NULL(DT_I8) : (DT_I8)(DT_STR,5,1252)Column_Name) I did this in a derived column with both your way and my way coming from a DT_STR field that stored numbers and managed to get an eight-byte signed integer. Hope this helps!
045c17efd2999fa9c1e7233c38296e6670a3abdbbe768597965498f7783ef5e4
['67278f6ba206463aaabf1fafdea1db07']
If I am not mistaken, I don't think there's a way to do it with purely pandas. However with python and datetime, you can do so: import pandas as pd from datetime import timedelta, date def daterange(start_date, end_date): # Credit: https://stackoverflow.com/a/1060330/10640517 for n in range(int((end_date - start_date).days)): yield start_date + timedelta(n) dates = [] start_date = date(2020, 1, 19) # Start date here end_date = date(2021, 12, 31) # End date here for single_date in daterange(start_date, end_date): dates.append(single_date.strftime("%m/%d/%Y") + " Cases") dates.append(single_date.strftime("%m/%d/%Y") + " Deaths") pdates = pd.DataFrame(dates) print (pdates) Is this what you want? If not, I can delete it.
4b9c64cecf576d0bd2686a63f14395c95cb14ad46d6e9e757c062a7d5ee04829
['67278f6ba206463aaabf1fafdea1db07']
Since you're using python 2 (there's no raw_input in python 3), raw_input returns a string. To get an integer from input, use input. prompt = "> " def pos(answer): print answer if 0 < answer < 12: print "Damn you'r young, but you can still do a lot of things.\n" elif 65 < answer < 110: print "Wow you'r old, but never to old to learn something.\n" elif answer < 0: print "You should input a positive number." else: print "I didn't understand you, try inputting a number." print "Hi there, what's your name?" name_a = input(prompt) print "Hi %s, how old are you?" % name_a age = input(prompt) pos(age) Side note: Use int(input()) for python 3 If for some reason you want the code to run in both python 2 and python 3, try this raw_input = input # since `input` exist in both python 2 and python 3 age = int(raw_input("..."))
c06ac00fa421aa28dc92ff16f3b69413be5a250145a2edb8de81e636a3b4734f
['672be2ee65b54e788676d2fb1d947bf0']
I am new to MATLAB and I currently have a script that generates different values for a variable n every seconds. So I end up with 100s of data that needs to be transferred to excel. Currently, I do this manually by copying pasting each but it does take really long. I thought about using xlswrite command but that just writes data on the first column and keeps overwriting that column as new data is generated. Would you be able to help me or lead me to easier way with this?
eb126a4f89ba7fb299807407e20c7b47873a09f5ca40d6d8836feeee2850b487
['672be2ee65b54e788676d2fb1d947bf0']
I am currently working on a game project where objects fall from the top of the screen and the person at the bottom needs to catch the right objects. Texture2D blockTexture; List<Vector2> blockPositions = new List<Vector2>(); float BlockSpawnProbability = 0.01f; const int BlockFallSpeed = 2; The following is to spawn new falling blocks if (random.NextDouble() < BlockSpawnProbability) { float x = (float)random.NextDouble() * (Window.ClientBounds.Width - blockTexture.Width); blockPositions.Add(new Vector2(x, -blockTexture.Height)); } personHit = false; for (int i = 0; i < blockPositions.Count; i++) { // Animate this block falling blockPositions[i] = new Vector2(blockPositions[i].X, blockPositions[i].Y + BlockFallSpeed); // Get the bounding rectangle of this block Rectangle sprite = new Rectangle((int)blockPositions[i].X, (int)blockPositions[i].Y, blockTexture.Width, blockTexture.Height); // check collision with person if (personRectangle.Intersects(sprite)) personHit = true; if (blockPositions[i].Y > Window.ClientBounds.Height) { blockPositions.RemoveAt(i); i--; } } base.Update(gameTime); } To draw the blocks foreach (Vector2 blockPosition in blockPositions) spriteBatch.Draw(blockTexture, blockPosition, Color.White); I understand if someone says they don't give our answers here but I just want some help with this and how to do it.. How can I make an array where the objects get picked randomly and they fall from the screen instead of adding the Texture2Ds one by one. I did try to find tutorials on this but I couldn't.. I'll appreciate any help given.
5f66fe070c5bc98c59d68d541ba9eb26b0f84e46d02437f77de9ca1b6f690643
['672f50c3734e43909433ff574c0c1bc5']
Got it! So, turns out, unknowingly, although my API was returning valid JSON, matter examining the header response logged on the Xcode side of things (thru NSLog(@"Error: %@", error);), it was actually returning text/HTML because it wasn't actually hitting the correct file, it was getting re-routed by a header somewhere. After explicitly stating the API path to be /API/index.php and not just /API, it started returning the valid JSON! Next, after making sure the response was properly JSON serialized (using requestManager.responseSerializer = [AFJSONResponseSerializer serializer];), the app worked! Hopefully this helps someone who was having the same issue :)
0d0fa0df561595e55bf25b59671bb3aea8fec4c24854500bc5d9ac02e10a2bea
['672f50c3734e43909433ff574c0c1bc5']
I am writing a script to display images on my site. The images are stored on the server and the source (path) is on a mySQL database. I want to be able to move to the next (or previous picture) by invoking two php functions I have made to do so. The code I have written so far is: <?php require "db_connection.php"; $query="SELECT source FROM photos"; $result=mysql_query($query); $count=0; $numberofpics=mysql_num_rows($result); $image=mysql_result($result, $count, "source"); $num=1; function slideshowForward() { $num=$num+1; if($num==($numberofpics+1)) { $num=1; } $count=$count+1; $image=mysql_result($result, $count, "source"); } function slideshowBack() { $num=$num-1; if ($num==0) { $num=$numberofpics; } $count=$count-1; $image=mysql_result($result, $count, "source"); } ?> The html portion to display the images is: <!-- FORWARD AND BACK FUNCTIONS--> <a class="back" href="http://mywebsite.com/discoverandrank.php?function=slideshowBack()"> <img src="graphics/back.png"/></a> <a class="next" href="http://mywebsite.com/discoverandrank.php? function=slideshowForward()"><img src="graphics/forward.png"/></a> <!--DISPLAY MIDDLE PHOTO--> <div id="thepics"> <img src="http://www.mywebsite.com/<?php echo $image; ?>" name="mypic" border=0 height="300" width="500"></img> </div> I'm pretty sure that the php script is incrementing/decrementing the count currently for the image, but I think the problem might be because the html (specifically img src="....") part is not re-evaluated when the count of the image increases?
5109a2472fabc024eb96dc141de123172ec3faa82ce91b27a614d553ac4b037c
['672f50f4e7d34b298d0b5a775008cad5']
I'm trying to create a calculator-like program that takes the number you enter into the first input field and divides it by the number in the dropdown field below it. I'm trying to get a specific percentage of whatever number is entered in the first field. However, I keep getting "NaN" when it runs. What should I change? const number = document.getElementById('number'); const percentageSelector = document.getElementById('percentageSelector'); const submitButton = document.getElementById('submitButton'); //The mathematical stuff submitButton.addEventListener('click', () => { alert(number * percentageSelector); }); <h2>Enter number here</h2> <input type="number" id="number"> <h2>Select a percentage to divide by</h2> <select id="percentageSelector"> <option selected disabled>Pick one</option> <option>1%</option> <option>2%</option> <option>3%</option> <option>4%</option> <option>5%</option> <option>6%</option> <option>7%</option> <option>8%</option> <option>9%</option> <option>10%</option> </select> <button type="submit" id="submitButton">Submit</button>
f110963d983db20dfd7190354fd019d7355af0416fd2f9e67fb120203e0c11cc
['672f50f4e7d34b298d0b5a775008cad5']
I noticed Mellow Mushroom's website tabs change depending on if it is active or not. I'd like to be able to reproduce this on my personal site. Here's a video in case you don't know what I mean ---> https://imgur.com/i4MLMKz Will I need to do this in JavaScript?
b2637bb502936efe0432c3ef4462068622c5138e54c2152663e72881f73bdc1b
['675446fff2444af78ad887cfd7391f3d']
I'm wanting to set the Welcome Page for my Sharepoint site using CSOM in C#. Essentially what I'm doing is uploading my new welcome page (home.aspx) to either Site Pages or Pages and then I want to change the welcome page to match my newly uploaded page location. I've looked around but a lot of what I've seen is either PowerShell or Server side code. If someone can point me in the right direction I would very much appreciate it.
d57480caa81dea6389d0a2ba08afec335deba3352203e6b61284abc28a2aa235
['675446fff2444af78ad887cfd7391f3d']
I'm doing some HTML and am running into an issue with my left and right column divs not scaling based on the content inside them as well as in proportion to the rest of the page. Here's my example: http://i.imgur.com/9vi2EK9.png And my CSS for each of the divs: #wrapper{ background:white; width:1280px; position:relative; border: 1px solid black; /* black border */ margin:auto; /* centre this div */ } #header{ height:90px; text-align:center; padding: .5em; background-color: grey; border-bottom: 2px solid black; } #leftmenu{ width:100px; float:left; font-size: 75%; padding:.5em; border-right:2px solid black; border-left:2px solid black, } #rightmenu{ width:180px; float:right; font-size: 75%; padding:.5em; border-left:2px solid black; border-right:1px solid black; } #content{ background-color:white; margin-left:120px; font-size: 80%; } #footer{ clear:both; /* push footer under other divs */ height: 70px; background-color:white; border-top:1px solid black; border: 1px solid black; padding-top:40px; text-align:center; font-size: 70%; } How can I ensure that my divs resize based on the content in my other divs? Thanks!
16ef1c0b0f65346c42e4f99148a3f88517a392f2c5f1ed104fb3318e9a1f6522
['67574ef26c5b4e4185c63f1df3f8adbd']
I am already logged in the front end of my joomla site with admin credentials. But when I try to login into the backend or admin panel it ask me to renter credentials. I want that when a user is logged in the front end and if he has the access capabilities to login into admin panel then he should be directly logged into admin panel without asking for credentials.
505c66efeefd6cc703a4a136198bbf9791cd9e0ddc919d80fc05b2de1fc56dd0
['67574ef26c5b4e4185c63f1df3f8adbd']
I have a user logged in admin panel(backend) and frontend of the joomla site. I checked the session table in DB and found that a session has been created for that user. I just deleted that row from DB and when I goto admin panel(backend), the user is logged out, which is correct. But when I goto frontend of the site, the user is not logged out. So my question is "Is separate session maintained for frontend and backend for same user?" If it so then why I didn't find the 2 session rows in session table of DB? Is frontend session stored in separate table? Also is there a way such that when I click on logout button, I logged out from both backend and frontend of the site?
f5d76292fe17e016763c839be1922606288748c8b529cdadad2dbca3bf41472d
['676285cc01624ebaa847cf7968d77b30']
I have a bottom navigation bar in my flutter app which is used to show different pages. I need to click on a button in one of the pages to navigate to another which can also be navigated through the bottom navigation bar. To keep the state of the page i have used IndexedStack widget. also i highlight which page i am currently at. How to do so. Here is the code. class IndexPage extends StatefulWidget { @override _IndexPageState createState() => _IndexPageState(); } class _IndexPageState extends State<IndexPage> with SingleTickerProviderStateMixin { final ValueNotifier<int> pageNumberNotifier = ValueNotifier<int>(0); final List<Widget> _widgets = <Widget>[ Page1(), Page2(), Page3(), ]; @override void dispose() { super.dispose(); pageNumberNotifier.dispose(); } @override Widget build(BuildContext context) { return ValueListenableBuilder( valueListenable: pageNumberNotifier, builder: (BuildContext context, int pageNumber, Widget child) { return SafeArea( child: Scaffold( body: IndexedStack( index: pageNumberNotifier.value, children: _widgets, ), bottomNavigationBar: BottomNavigationBar( showUnselectedLabels: true, currentIndex: pageNumber, onTap: (index) => pageNumberNotifier.value = index, items: <BottomNavigationBarItem>[ bottomNavigationBarItem( iconString: 'page1', index: 0, title: 'Page1'), bottomNavigationBarItem( iconString: 'page2', index: 1, title: 'Page2'), bottomNavigationBarItem( iconString: 'page3', index: 2, title: 'Page3'), ], ), ), ); }); } BottomNavigationBarItem bottomNavigationBarItem( {String iconString, int index, String title}) { //shows the icons and also highlights the icon of the current page based on the current index. } } Here is the page that contains the button class Page1 extends StatelessWidget { @override Widget build(BuildContext context) { ... onTap(){ // go to Page3 and also highlight Page3 icon in the bottom navigation bar } ... } }
9d793b46e6354b95ac371ff7dfc1f4129cb873eaeedb21a699df4adec336212f
['676285cc01624ebaa847cf7968d77b30']
How to change the widgets in a list item in flutter using bloc pacakage. Should i use BlockBuilder or listener on the whole ListView.builder or only the individual items. It would be nice if u share an example or tutorial. eg If i have a checkbox i need to change its state on clicking it. These are my Bloc classes Bloc const String SERVER_FAILURE_MESSAGE = 'Server Failure'; const String CACHE_FAILURE_MESSAGE = 'Cache Failure'; class MarkAttendanceBloc extends Bloc<MarkAttendanceEvent, MarkAttendanceState> { final MarkStudentPresent markStudentPresent; final MarkStudentAbsent markStudentAbsent; MarkAttendanceBloc({@required this.markStudentPresent,@required this.markStudentAbsent}); @override MarkAttendanceState get initialState => MarkedInitial(); @override Stream<MarkAttendanceState> mapEventToState(MarkAttendanceEvent event) async* { yield MarkedLoading(); if(event is MarkAbsentEvent){ final remotelyReceived = await markStudentAbsent(MarkStudentParams(classId: event.classId, courseId: event.courseId,studentId: event.studentId)); yield* _eitherLoadedOrErrorState(remotelyReceived); } else if(event is MarkPresentEvent){ final remotelyReceived = await markStudentPresent(MarkStudentParams(classId: event.classId, courseId: event.courseId,studentId: event.studentId)); yield* _eitherLoadedOrErrorState(remotelyReceived); } } Stream<MarkAttendanceState> _eitherLoadedOrErrorState( Either<StudentDetailsFacultyFailure,int> failureOrClasses, ) async* { yield failureOrClasses.fold( (failure) => MarkedError(_mapFailureToMessage(failure)), (studentId) => Marked(studentId), ); } String _mapFailureToMessage(StudentDetailsFacultyFailure failure) { switch (failure.runtimeType) { case ServerError: return SERVER_FAILURE_MESSAGE; default: return 'No internet'; } } } State abstract class MarkAttendanceState extends Equatable{ const MarkAttendanceState(); } class <PERSON> extends MarkAttendanceState{ const MarkedInitial(); @override List<Object> get props => []; } class <PERSON> extends MarkAttendanceState{ const MarkedLoading(); @override List<Object> get props => []; } class <PERSON> extends MarkAttendanceState{ final int studentId; Marked(this.studentId); @override List<Object> get props => [studentId]; } class <PERSON> extends MarkAttendanceState{ final String errorMessage; MarkedError(this.errorMessage); @override List<Object> get props => [errorMessage]; } Event import 'package:equatable/equatable.dart'; abstract class MarkAttendanceEvent extends Equatable { const MarkAttendanceEvent(); } class MarkPresentEvent extends MarkAttendanceEvent { final int studentId; final int courseId; final int classId; MarkPresentEvent(this.studentId, this.courseId, this.classId); @override List<Object> get props =>[studentId,courseId,classId]; } class MarkAbsentEvent extends MarkAttendanceEvent { final int studentId; final int courseId; final int classId; MarkAbsentEvent(this.studentId, this.courseId, this.classId); @override List<Object> get props =>[studentId,courseId,classId]; }
54961c39719dc5b259b605c282dc9514989449a02596222164107bd3a51056ca
['6763175ec5e9478ab881f97bb9176ca7']
I have developed a UWP app in C# which contains a Windows Runtime Component C++ project. the app allows the user to choose an mp4 file and passes this file to the c++ code, which then utilizes ffmpeg libraries to retrieve the presentation time stamps of a video file and output them to a file. the issue i'm facing is that the c++ code is not able to open the mp4 file when using the avformat_open_input function: int PTSExtraction<IP_ADDRESS>parse_file(Platform<IP_ADDRESS>String^ filename) { int ret = 0; AVPacket pkt = { 0 }; std<IP_ADDRESS>wstring fileNameW(filename->Begin()); std<IP_ADDRESS>string fileNameA(fileNameW.begin(), fileNameW.end()); const wchar_t* w_chars = fileNameW.c_str(); src_filename = fileNameA.c_str(); if (avformat_open_input(&fmt_ctx, src_filename, NULL, NULL) < 0) { fprintf(stderr, "Could not open source file %s\n", src_filename); return 1; } // rest of code } the error received by avformat_open_input is Permission Denied. I cannot even open a random text file in this function by doing: ofstream output; output.open("output.txt"); I realize there are file system permissions that are blocking the C++ component of my uwp app from opening files. here are the things i have tried so far: i have enabled broadFileSystemAccess in the Package.appxmanifest (https://blogs.windows.com/windowsdeveloper/2018/05/18/console-uwp-applications-and-file-system-access/) - in the Capabilities section of the Package.appxmanifest file I've allowed access to Location, Pictures Library, and Videos Library. I've checked the File System Privacy Settings on my computer and enabled my app to access the File System. I've tried moving the mp4 file to various locations (Documents, Pictures Library, Videos Library) to see if the C++ component has access to these locations. I've tried the solution from this post: Qt WinRT App cannot access file permission denied. None of these allow the C++ component to open any files. i would really appreciate if anyone has a solution for this problem.
8a999ff260ea9373b460e7de9a2e023e59f977d90f164c12feab3b79d2d3c568
['6763175ec5e9478ab881f97bb9176ca7']
I'm making a website for handling office hour queues that has 3 different types of users: guest, student, and instructor. the instructors will be able to log in and enter the timings for their office hours for a specific course. and i want these office hours to show up in a calendar such that all the instructors teaching the same course can see the office hours. i also want the students to be able to see this calendar for a specific course, so that they know when the office hours are. i want to basically have a calendar for each course...and i'm not sure if that is possible? i'm using java, javascript, html, and css to develop this website. does anyone know how i can do this?
b8c54632f4621ef17b2e9433e7dd75abe003c425c8ce51bd1524a99a6e4acacc
['6767976714a74a8785b171ea3682cb87']
Fwiw, here's one crude way of solving this problem. # your original data frame dat <- structure(list(ID = c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L), DATE = structure(c(3L, 4L, 5L, 5L, 2L, 3L, 4L, 4L, 4L, 1L, 2L, 3L, 3L), .Label = c("9/18/2014", "9/19/2014", "9/20/2014", "9/21/2014", "9/22/2014"), class = "factor")), .Names = c("ID", "DATE"), class = "data.frame", row.names = c(NA, -13L)) # glue the columns to avoid need of grouping by ID first dat2 <- paste(dat$ID, dat$DATE, sep='/') # alternatively, you can use following for string comparison, if needed. # dat2<-paste(as.character(dat$ID),as.character(dat$DATE),sep='/') # create a lookup table for counts of each ID+DATE combo lookup<-table(dat2) # add a column based on counts. If count is 1 then ID+DATE is not duplicated. dat$FL <- sapply(dat2,FUN = function(x) { if (lookup[x] == 1) 0 else 1}) # output print(dat) This should give you what you're looking for. ID DATE FL 1 1 9/20/2014 0 2 1 9/21/2014 0 3 1 9/22/2014 1 4 1 9/22/2014 1 5 2 9/19/2014 0 6 2 9/20/2014 0 7 2 9/21/2014 1 8 2 9/21/2014 1 9 2 9/21/2014 1 10 3 9/18/2014 0 11 3 9/19/2014 0 12 3 9/20/2014 1 13 3 9/20/2014 1 There are more sophisticated ways to do this, and table() has its limitations, but for most part, this is simple, easy to read, and should do the job for you.
de2718a6cde60751d47bcbe3b68c29f70399b7e723ef508cfd08816c82b12ee0
['6767976714a74a8785b171ea3682cb87']
I was reading Parallel Computing docs of Julia, and having never done any parallel coding, I was left wanting a gentler intro. So, I thought of a (probably) simple problem that I couldn't figure out how to code in parallel Julia paradigm. Let's say I have a matrix/dataframe df from some experiment. Its N rows are variables, and M columns are samples. I have a method pwCorr(..) that calculates pairwise correlation of rows. If I wanted an NxN matrix of all the pairwise correlations, I'd probably run a for-loop that'd iterate for N*N/2 (upper or lower triangle of the matrix) and fill in the values; however, this seems like a perfect thing to parallelize since each of the pwCorr() calls are independent of others. (Am I correct in thinking this way about what can be parallelized, and what cannot?) To do this, I feel like I'd have to create a DArray that gets filled by a @parallel for loop. And if so, I'm not sure how this can be achieved in Julia. If that's not the right approach, I guess I don't even know where to begin.
570208ca1e48027c0a5ade5b0b2ecc7c71c6035e3281ff79faaf046fd730180d
['6771f631e0af4e9a8ad109bcf748da49']
I'm trying to prove the following statement: Given a Lie group $G$ with Lie algebra $\mathfrak{g}$, if $\psi: \mathfrak{g} \rightarrow \mathfrak{X}(\mathfrak{g})$ is the infinitesimal action determined by the adjoint action then $$ \psi \left( \left[ X , Y \right] \right) = - \left[ \psi(X) , \psi(Y) \right]\,. $$ Initially I assumed that the adjoint action was the usual $\mathrm{Ad}: G \rightarrow \mathrm{Aut}(\mathfrak{g})$ which would imply that $\psi = \mathrm{ad}$, however in this case, since we have that $\mathrm{ad}(X) (Y) = \left[X,Y \right]$ and then through the Jacobi identity one obtains $$ \mathrm{ad} \left( \left[ X,Y \right] \right) (Z) = \left[ \mathrm{ad}(X) ,\mathrm{ad}(Y) \right] (Z) $$ which does not agree with what is asked. I guess I'm probably looking at the wrong thing but I can't understand what could also be meant by the adjoint action in that case. Any pointers on what is $\psi$ (if indeed it is something different than what I interpreted it to be) or otherwise on what I might be doing wrong, would be greatly appreciated.
c566eba46c0918f6f17a2039abf0ede6ef28d31cef856228a833a0ef5768fab5
['6771f631e0af4e9a8ad109bcf748da49']
I'm trying to prove the second part of exercise 4.6 of <PERSON> and <PERSON>. So far, I have proved that $H$ is central. I thought of using the fact that in this situation $G/H$ is locally isomorphic to $G$ but I am stuck on how to proceed so some hints or advice would be greatly appreciated.
fad4b808db1bfdca267f71593866d9c795be314b406249d3a68e48ef514abec1
['67886d467e0e47aeb685b4ef661d01f5']
Нет, новый файл не нужен. Просто выводим новую строку. Имеем текстовую строку без точки с запятой, а получить нужно с точками с запятой в местах, где необходимо. Было: `"mersedes audi honda_b5. творог bentley грибы."` Стало: `"<PERSON>; audi honda_b5. творог bentley; грибы."` Но имеем ввиду, что в этом тексте два предложения(может быть больше). То есть чтобы не получилось строки `"mersedes; audi honda_b5. ;mersedes творог bentley; грибы."`(обратите внимание на символ перед вторым словом mersedes) так как слово mersedes в новом предложении не относится к первому предложению.
0d2dd60b2b516cd4c15102986eb302c4ba7a611b45b757042fcf7c5904608f77
['67886d467e0e47aeb685b4ef661d01f5']
Да, я как раз смотрю ваше решение, спасибо, что сами и откликнулись. Изменил описание на более подробное -- пошагово, так как первоначальное ТЗ вводило в заблуждение. Ваше решение отлично написано и работает, но выполняет немного не ту задачу. Если есть свободные 10 минут, то ваша помощь будет очень кстати, если нет, то я пошел дальше сходить с ума :)
f1b25d4b7a1556c5f9d5a8827d12e902041353bf05e595ef46ccce2baf9c21b6
['6789251047d940308c4809be3bc08301']
Yes, just in case you were wondering...this one was totally operator error! Yep...me! I had forgotten one basic thing. When I chose the default author for guest posts, I forgot to check and make sure that the author had the ability to publish entries! Yep. I'm a moron!
8764469d5fe41e4819e5d17e5a03b034acdb501961b6dbbb1c2eae10e010a11a
['6789251047d940308c4809be3bc08301']
The universal cover of $G=SO(p,q)$ is called $\tilde G=\text{spin}(p,q)$. These spin-groups can be constructed using Clifford algebras and they are therefore useful in constructing spinor (projective) representations of $SO(p,q)$. As an simple example take $G=SO(3)=SU(2)/\mathbb Z_2$, it has only integer spin representations. To find the projective representations we can use $\tilde G = \text{spin}(3) = SU(2)$. This has integer spin representations AND half-integer spin (spinor) representations.
7529eb0bf8ebf98283bdf00e7d0b3efe4bbc54123ee2a89b417046e621ecd362
['6795842a4cec4720926264c90c04b9d6']
You can create multiple similar VMs faster by creating a group of managed VMs. First, create an instance template, specifying the VM configuration that you need: gcloud compute instance-templates create TEMPLATE_NAME \ --machine-type MACHINE_TYPE \ --image-project IMAGE_PROJECT \ # project where your boot disk image is stored --image IMAGE \ # boot disk image name --boot-disk-type pd-ssd \ --boot-disk-size 50GB \ --boot-disk-auto-delete \ --boot-disk-device-name DEVICE_NAME \ # boot disk device name, the same for all VMs --subnet default \ --maintenance-policy MIGRATE \ [...] Note: You specify boot disk as part of instance template. No need to specify zone for instance template. You will specify desired zone at instance group creation time. Device name is the same for boot disks of all VMs in the group. This is not a conflict because device name of a particular disk is seen from guest OS of each specific VM and is local to that VM. Other parameters are the same as those for creating a VM. Then, create a group of 4 (or 100, or 1000+) VMs, based on this template: gcloud compute instance-groups managed create GROUP_NAME \ --zone ZONE \ --template TEMPLATE_NAME \ # name of the instance template that you have just created --size 4 \ number of VMs that you need to create The group creates multiple similar VMs, based on your template, much faster than you would do it by iterating creation of standalone VMs.
cafd9b04d35c56508ff8caa9defa4a4e3ea911647393cd9b1f99d200802ec1ad
['6795842a4cec4720926264c90c04b9d6']
Try launching your preemptible instance in a different zone in another region, even another continent - where there is night is at the moment. For example, if it is a day in the U.S., you could launch your preemptible VM in a European zone. Preemptible VMs could indeed be utilized more during day time as people use them to do their daily jobs.
634521b163ab06ccf747cd9285249f3881fb7e6c38497c9bcaf6af555d83fa56
['679c421af04e48e18f35b7b025f4e3ef']
current->next = malloc(sizeof(node)); should be current->next = calloc(1,sizeof(node)); /* because safe NULL test for ->next ! */ void newnode(node *n, int x, int y) { n->key = malloc(x*sizeof(char)); n->value = malloc(y*sizeof(char)); } should be void newnode(node *n, int x, int y) { n->key = malloc(x+1); /* because x comes from strlen() and sizeof(char)==1 */ n->value = malloc(y+1); /* because x comes from strlen() and sizeof(char)==1 */ }
1ad8d1de1b6ac52a5f5c6382a2b723c8acdf27cbb08a89c7f9db26c8478ef0de
['679c421af04e48e18f35b7b025f4e3ef']
You should separate your work in a function and sscanf can split the string. For a constant splitsize at compiletime you can iterate with pointers over the new N+1 char-size like: char (*split4chars(char *s,char (*b)[5]))[5] { /* returns a pointer to char[5] elements */ int n; while( 1==sscanf(s,"%4[^\n]%n",*b++,&n) ) s+=n; return --b; } int main() { char *s = "Have a nice day"; char (*b)[5] = malloc(ceil(strlen(s)/4)*5), /* enough memory for destination */ (*e)[5] = split4chars(s,b); while( e!=b ) /* iterate from begin to end here */ puts(*b++); return 0; }
01b24015fd35c4cebe7094a3d3f38f2d4c61a05221f228e09e6da47c2cd57040
['679cc77d51354c3d99dbda9c45889675']
Yes, this works for swapping the longitude and latitude :) But is there no way I can get the id marked along with each point? You would observe I have an ID parameter as well in my table corresponding to each coordinate. I need to individually label each point into one of three classes which is why I was using iteration in my original code. ID of each point would help me correspond the point to the class.
58c3ad304349cd862947fc0999df535bffdb21a95cb00e0412f08804307159da
['679cc77d51354c3d99dbda9c45889675']
I have this small code for getting nightlight image for a particular city using VIIRS Nighttime dataset. var district = ee.FeatureCollection('ft:1PA2zwArj8EsplrX9eMxJ2H_TICyyx855KPnbJhC1','geometry') .filter(ee.Filter.eq('name','Gurgaon')); var nighttime = ee.Image(ee.ImageCollection('NOAA/VIIRS/DNB/MONTHLY_V1/VCMCFG') .select('avg_rad') .filterBounds(district) .filterDate('2013-05-01', '2017-05-31') .median()) var nighttimeVis = {min: 0.0, max: 60.0}; Map.addLayer(nighttime.clip(district), nighttimeVis, 'Nighttime'); Now I wish to export this image to my Google Drive. Usually I use the following script for exporting: Export.image.toDrive({ image: nighttime.clip(district), description: 'Nighttime_Image', maxPixels: <PHONE_NUMBER>, scale: 30, region: district }); But for this particular image, I need to specify the min and max values like I have done while using Map.addlayer (for viewing the image) by using nighttimeVis vector. How can I specify the same max and min before or in my Export command for this image?
735a1a226c6ad637fed707922f54ea5cc763321061014a9997bf9850fb721d28
['67a3645232f745f3a342902e7b043662']
Got a conclusion here: We found a work around and the statement that this is a bug in VS2012 PCL projects still stands. We created our proxy in a metro project and simply copied the reference.cs file over into the PCL project. It was a "what the heck - why not" last attempt of sorts, but it actually works. Even better, the calls are awaitable and come with response objects. Awesome! Cheers, <PERSON>
8971bb75ff74b4edd24e2265f7a73690ceae9e7e54237d87b68a9d1a83c98664
['67a3645232f745f3a342902e7b043662']
How do I shape the payload to enable a post or patch for fields that are Hyperlink/Picture? Getting those fields is straight forward: they come as "fieldName" : { "Description":"asdf", "Url":"asdf.com"} This works in flow using the Send HTTP Request to SharePoint block, but I can't figure out how to make this work using the graph api. Do i need to set the odata type explicitly (SP.FieldUrlValue doesn't work) and what is it for Hyperlinks? Somethink like this: {"fieldName@odata.type", "Complex" } - we use this with Collection(Edm.String) for multiple lookup fields for instance. Kind regards, <PERSON>
88b075a751a21276a8384391bbffd463ac74c9f982e61d07d2d3259abf6440a2
['67a6120e877a413aaf5a25176cfb83d4']
I want to plot a "double" bar chart for three categories of data, and show the significance level based on <PERSON> test, for each of the two "double" bars. Running the below code, I don't see the counts reflected on the y-axis, rather, all the bars are at the same height. library(dplyr) library(ggplot2) library(ggpubr) library(reshape2) theme_set(theme_pubclean()) data = data.frame("cut" = c("type 1","type 1","type 2","type 2","type 3","type 3"), "counts" = c(0.6844,0.5867,0.6297,0.6383,0.7134,0.7075), "color" = c("c","d","c","d","c","d")) data df <- data %>% filter(color %in% c("c", "d")) %>% group_by(cut, color) %>% summarise(counts = n()) ggdotchart(df, x = "cut", y ="counts", color = "color", palette = "jco", size = 3, add = "segment", add.params = list(color = "lightgray", size = 1.5), position = position_dodge(0.3), ggtheme = theme_pubclean() ) The plot I'm trying to make looks something like this: https://drive.google.com/open?id=1EndiF-sCtXFyUOAPIToRY5hqjp97b1Px appreviate your help to: 1. edit my code such that it shows the real count values 2. add significance to the plot
6e34976960fcc3c6bae6a27fc1ab59cadada55ed8b43cbe8b32820e2bcc346f7
['67a6120e877a413aaf5a25176cfb83d4']
I am using the following code to generate a 3D scatter plot with vectors in Plotly - R studio. Currently, the legend labels are displayed as "trace 1, trace 2, etc", but I'd like to change that with my own text. Any idea how to achieve this? #Define the data from df to be plotted, basically three columns of a data frame x = df[,1] y = df[,2] z = df[,3] #Scatter and Axis Labels p <- plot_ly() %>% add_trace(x=x, y=y, z=z, type="scatter3d", mode="markers", marker = list(color=y, colorscale = 'Viridis', opacity = 0.02,showscale = F)) %>% layout(title = "TITLE", scene = list( xaxis = list(title = "LABEL 1"), yaxis = list(title = "LABEL 2"), zaxis = list(title = "LABEL 3"))) #Add Vectors to the Plot for (k in 1:nrow(df_vector)) { x <- c(0, df_vector[k,1]) y <- c(0, df_vector[k,2]) z <- c(0, df_vector[k,3]) p <- p %>% add_trace(x=x, y=y, z=z, type="scatter3d", mode="lines", line = list(width=8), opacity = 1) }
c10dc35e2c3741372c97b022ebb88b97241ed6e3b809dca793bb4bea4b4d3ae8
['67b948aa9e95416299631981ac0e21aa']
After upgrading tensorflow 1.3.0 to 1.4.0 I encountered this error. to solve it, I check different steps : sudo pip3 uninstall tensorflow-gpu sudo pip3 uninstall protobuf sudo pip3 install tensorflow-gpu==1.3.0 sudo pip3 install protobuf==3.3.0 but the error was not resolved. finally, I uninstalled pygoogle sudo pip3 uninstall pygoogle and it works! Hope it will work for you too.
c59a3ddf4de69d2c985a658a8b96c7026eba6fcdc96e036d8e59ea7fd000c48f
['67b948aa9e95416299631981ac0e21aa']
Here is the code that works for me. it is originally taken From the previous answer by <PERSON>. I just add some modifications : #get the number of records in the tfrecord file c = 0 for record in tf.python_io.tf_record_iterator(tfrecords_filename): c += 1 totalFiles+=c logfile.write(" {} : {}".format(f, c)) logfile.flush() print("going to restore {} files from {}".format(c,f)) tf.reset_default_graph() # here a path to tfrecords file as list fq = tf.train.string_input_producer([tfrecords_filename], num_epochs=fileCount) reader = tf.TFRecordReader() _, v = reader.read(fq) fk = { 'image/encoded': tf.FixedLenFeature((), tf.string, default_value=''), 'image/class/synset': tf.FixedLenFeature([], tf.string, default_value=''), 'image/filename': tf.FixedLenFeature([], tf.string, default_value='') } ex = tf.parse_single_example(v, fk) image = tf.image.decode_jpeg(ex['image/encoded'], dct_method='INTEGER_ACCURATE') label = tf.cast(ex['image/class/synset'], tf.string) fileName = tf.cast(ex['image/filename'], tf.string) # The op for initializing the variables. init_op = tf.group(tf.global_variables_initializer(), tf.local_variables_initializer()) with tf.Session() as sess: sess.run(init_op) coord = tf.train.Coordinator() threads = tf.train.start_queue_runners(coord=coord) # sess.run([tf.global_variables_initializer(),tf.local_variables_initializer()]) # set the number of images in your tfrecords file num_images=c print("going to restore {} files from {}".format(num_images, f)) for i in range(num_images): im_,lbl,fName = sess.run([image,label,fileName]) lbl_=lbl.decode("utf-8") savePath=os.path.join(output_path,lbl_) if not os.path.exists(savePath): os.makedirs(savePath) fName_=os.path.join(savePath, fName.decode("utf-8").split('_')[1]) # chnage the image save path here cv2.imwrite(fName_ , im_) coord.request_stop() coord.join(threads)
36110c9d7356c93e208ce9d81c23de945299bfb7e078e8f30b0de355c7c7c50f
['67cc3552d45d4f50bff0d6069899acee']
Swearing is completely acceptable around women, at least as much as it is around men. Usually you dont swear around children but its fine around adults. There is no separation between the sexes and such beliefs are long since antiquated. I edited your answer due to this sexist and quite simply wrong assertion.
ea7b4313fcbce49a8deae3cc36e0e567b5cfc529d9799a70e35aeb2049b04826
['67cc3552d45d4f50bff0d6069899acee']
Thanks <PERSON>, I love this device. I wonder why you have not provide a link to this gadget or did not mention the price range. I found it here: https://www.amazon.com/Portable-Bluetooth-Playtime-Wireless-Flashlight/dp/B01EUGUNGK/ref=sr_1_fkmr1_1?ie=UTF8&qid=<PHONE_NUMBER>&sr=8-1-fkmr1&keywords=Puridea+I2+Mini+Wireless+Bluetooth+Speaker+with+Power+Bank
717cd30d5b0e7a02b35ed2737df71497aad27aa4f88dfae1ee0bcb25a0236324
['67d1487f294f4f2384f233820abb19b1']
i want to bind this simple XML File in my java project: <?xml version="1.0" encoding="UTF-8"?> <itg> <reader> <chapter id="1"> <subchapter id="1"></subchapter> <subchapter id="2"></subchapter> </chapter> <chapter id="2"> <subchapter id="1"></subchapter> <subchapter id="2"></subchapter> </chapter> <chapter id="3"></chapter> </reader> <questions> </questions> </itg> I use NetBeans, and actually i bind the XML File by parsing the xml file into a ArrayList, an bind the list. It works, but it is possible to bind the xml File in a better way? Thanks!
ec057534b2a81ed3e8ddc2b1189dec1c7b055c49f80cd1b9420bec5ebee8f4cd
['67d1487f294f4f2384f233820abb19b1']
I have the answer, the main problem was the header on the php site: ajax: $.ajax({ dataType : 'jsonp', async: false, jsonpCallback: 'jsonCallback', contentType: "application/json", data: {'d':'empty'}, url : 'http://mysite.de/sqlExecute.php', success : function(sqlArray) { console.log(sqlArray.a); }}); <?php php site: <?php $json = json_encode(array("a" => "Hello World")); header("Content-Type: application/json"); print $_GET['callback'] . "(" . $json . ")"; ?>
e4fed4ff8c08b06a4067988d97741a0142b77b31444aefd6efcfecec54054739
['67e8003e8731416787e0a16146a4d085']
I need a few thousands of street distances between cities in germany. I know that there are a few web APIs where I get the distance thru a REST request, but I wonder if I can do that locally on my Linux PC. I saw the OSRM project and libosrm seems to do what I want. Are there any other tools doing that? What do I have to download and what do I have to install? (I prefer to program in python)
b63b92d40f15f034c9969f42ddd76bcfe47f8abf8e01dd3905b6fad4b41c7c32
['67e8003e8731416787e0a16146a4d085']
You are using 2 different scripts, so just enemyCountt.enemiessCount --; wont work. if both scripts are on the same gameobject, then you can use gameObject.enemyCountt.enemiessCount --; if these arent in the same gameobject, then you can make a reference from the other gameobject with the other script public GameObject OtherObject; void Update(){ if (collision.gameObject.tag == "Enemy") { OtherObject.enemyCountt.enemiessCount --; } then you have in the object, where you added the script, a free field, where you can drag & drop your GameObject with the script "enemyCountt" and then it should work, but I'm not quite sure
3b6f5e94fd57796611c1619545cd505ab60e3d895485f5dc3dcafb781ccc7603
['67f45c3c9a2445af8342010cfb278e89']
You should use JSON.NET or similar library that offers some more advanced options of deserialization. With JSON.NET all you need is adding JsonProperty attribute and specify its custom name that appears in resulting JSON. Here is the example: public class MyClass { [JsonProperty(PropertyName = "24hhigh")] public string Highest { get; set; } ... Now to deserialize: string jsonData = ... MyClass deserializedMyClass = JsonConvert.DeserializeObject<MyClass>(jsonData);
3706aa0150fcc532cd1bab077abc2476bb16ca976b72d0096054ed311264ceff
['67f45c3c9a2445af8342010cfb278e89']
Right, there is no explicit limit. If you inspect the json schema, you will not find any max restriction defined: deployment template schema. However, Azure deployment template is limited in total size and must no exceed 1MB: You must limit the size your template to 1 MB, and each parameter file to 64 KB. The 1 MB limit applies to the final state of the template after it has been expanded with iterative resource definitions, and values for variables and parameters. Do not be confused with resources element though, which is constrained to the 5 levels of nesting: The resources property allows you to specify child resources that are related to the resource being defined. Child resources can only be defined 5 levels deep. It is important to note that an implicit dependency is not created between a child resource and the parent resource. If you need the child resource to be deployed after the parent resource, you must explicitly state that dependency with the dependsOn property. Finally, I can't imagine any situation where you would have more than 10 nested templates. Just think about maintainability and how challenging would it be to debug/troubleshoot failing deployment
f50b21a9c877da2d70f91d7c67ba17f03c18b9aafa2601d68133efe5645a619d
['67fe74d707c446338d699834b3c44331']
<PERSON>, I'm now trying to follow your recommendations and I'm having difficulty actually doing so. Do you have a guide that demonstrates how to install both drivers? I've only be able to find processes to updating the mesa drivers on a laptop that does not have any proprietary drivers already installed.
b5bdf895f7af27e1726da37d8e468dd1667356d7c64177eabc3ea66c54a9cbd4
['67fe74d707c446338d699834b3c44331']
I intend to use the Debian system for resource-consuming mathematical calculations. Both RAM and CPU will be used, and in fact, the speed and accuracy of my computations are directly correlated to the availability of the former. (I've also updated the BIOS, but this has had no effect; I can still only see the blinking underscore when the Gnome user choice is supposed to be displayed.)
ea0a60959c70a5e2fb1844b6281ceb64efcf29c1f266bfae4ef37d08bfd04eb9
['680a83c9ccd54fbc9dff4b90b325e30a']
I've gotten it. I hope I transcribed the solution correctly. An example with Try > Context holds the context of the functions. > > I - input to function (read by f) > > R - result of function (updated by f) > > E - exception causing an error (updated by TryF) > > > Update - copies the old context, notes the exception > > > val tryF = (f:Context=>Context) => > > > Try(f(c)) match { > > > > case Success(ok) => ok > > > > case Failure(e) => c.update(Option(e)) > > > > case _ => c.update(Option(new MatchError(f)) > > > }
47ad1edd0c64fc71edd64e5adc110845e0aa2fbfd639a4374d6ce42dff7c16c0
['680a83c9ccd54fbc9dff4b90b325e30a']
In scala I have two functions with different signatures. I would like to write a function that composes the two functions into a new function with a common signatures. type CFunc = (Context)=>Context type UCFunc = (Context,CFunc)=>Context type CompF = (Context,UCFunc,CFunc)=>CFunc val combine: CompF = (c:Context,uc:UCFunc, f:CFunc ) => ??? If I would execute the code, I would val doIt: UCFunc = (c:Context,f:CFunc) => f(c) def clumsy(c:Context,f:CFunc):Context = doIt(c,f) It's the ??? part I'm having to figure out. I've tried a number of possibilities, none of them work. I won't enumerate what doesn't work. I know they don't work. I'm hoping that someone can help. All of the examples I've seen both functions take the same parameter list. That doesn't really help. Lots of stuff. None of them have worked. I don't think there's a value in listing what doesn't work. See above A new function that evaluates to the will produce same result of the method when evaluated over the input.
39c188a99cf34262fe80fe4e9abf13f2bb13b91e2c93556c68e25986853c938d
['6816bbf5012b443a826494a87fa58e0e']
I would suggest getting an array of the data you'd like to export into php using a MySQL SELECT query and using your php preg_replace() statement since you know that works. Exporting the replaced data to a csv file from the php array is pretty straightforward from there. This link has answers with code samples of how this can be done: Export to CSV via PHP
e21fc2cb9b389736cb67493e50848fd8320f3c4ba28fce90835010cf040ce137
['6816bbf5012b443a826494a87fa58e0e']
Here is a function for writing to a specified log directory. You just pass in the log message and it creates/updates a log file named after the current date. Be sure to give nginx/apache ownership of the log directory with chown. function logActivity($data) { file_put_contents("/home/logs/" . date("m-d-Y"), date("h:i a") . ": " . $data . "\n", FILE_APPEND | LOCK_EX); }
f74e0ce4be9865acc62f01fd998e40f0e317f658b4180683175e3b38377b1b2e
['684404d138a74609a5b2a7af5802018f']
I am attempting to take a user inputted word, ad it to a stack and then check to see if that word is a palindrome. I am attempting to pop everything off the stack and onto a new string and then compare the strings. I believe my current issue is that my pop() function doesn't actually return a value. It actually just cuts off the tail node and then reprints the string without the tail node. I guess my question is, how do I write my pop() function so that it returns the "popped" value? Here is my main method Scanner input = new Scanner(System.in); Stack_Scott_Robinson<Character> myList = new Stack_Scott_Robinson<Character>(); //create a list object System.out.println("Enter a string: "); String s = input.next(); for (int i = 0; i < s.length(); i++){ myList.push(s.charAt(i)); } String reverseInput = ""; while (!myList.isEmpty()){ reverseInput = reverseInput + myList.Pop(); } if (s.equals(reverseInput)){ System.out.println("This is a palindrome"); }else{ System.out.println("This is not a palidrome"); System.out.print("Would you like to re-run code with different input string(y/n)?"); another = input.next(); } Here is my pop() method public void Pop() { Node countList = end; //set "count" node at the front of the list int size = 0; //initialize the size variable //moves the count node down the list and increments the size variable while (countList != null) { countList = countList.next; size++; } if (size == 0){ //empty list System.out.println("error: empty list"); }else if (size == 1) //one node list { top = null; end = null; System.out.println("list is now empty"); } else{ Node current = end;//set a current node at the front of the list for (int i = 0; i<size-2; i++)//-2 because the list starts at 0 and we want the second to last position { current = current.next;//moves the current node down the list until it is } Node temporary = current.next; //the second to last position Node temp = top;//create a new node space top = current;//set the new node equal to the second to last position top.next = null;//sets the node as the tail } }
ca10e45f861e3b08fdc0afa8a4ad5560c1c8c4251a37dc81dd777df46c7096ae
['684404d138a74609a5b2a7af5802018f']
I am trying to create a class that has a few methods in it. I am attempting to only pass the values entered by the user into the methods. Then, each method is run and the value is printed in the main method. Here is what I have. public class HotelRating{ private int hotel = 0; private int years = 0; int [][] Ratingarray = new int [hotel][years]; public HotelRating(){ } public HotelRating(int hotel, int years){ this.hotel = hotel; this.years = years; for (int row = 0; row < Ratingarray.length; row++){ for (int column = 0; column < Ratingarray[row].length; column++){ Ratingarray[row][column] = (int) (Math.random() * 5 + 1); } } } public String fiveStarsHotels(){ String result = ""; System.out.print("Five stars hotels indices: "); System.out.println(); for (int row = 0; row < Ratingarray.length; row++){ for (int column = 0; column < Ratingarray[row].length; column++){ switch (Ratingarray[row][column]){ case 1: break; case 2: break; case 3: break; case 4: break; case 5: result = (row + 1 + ","); } } } return result; } } Here is how I am attempting to call this method in the main method: import java.util.*; public class TestHotelRating{ public static void main (String[] args){ Scanner input = new Scanner(System.in); System.out.println ("Please enter the amount of hotels: "); int hotel = input.nextInt(); System.out.println ("Please enter the number of years: "); int years = input.nextInt(); HotelRating myObject = new HotelRating (hotel, years); System.out.println(myObject.fiveStarsHotels()); } } } When I call the method, it returns nothing. I'm not sure why.
dd92d3c9f8065ee6905d9d91110e5a3ae3b3c340a27d0a708784d12171fa5863
['685379189db4475080578dea1a8d7381']
I'm trying to use class inheritance for puppet. There is a base class named foo and an inherited class named bar. Overriding file or package resources are quite fine and works properly. But at the same time i'm using a custom module for configuring sudo. The problem arises when i try to override sudo class from inside class bar. Puppet classes are as follows: class foo { $nrpe_plugin_pkgs = [ .... ] service { 'nrpe service': .. } package { $nrpe_plugin_pkgs: .. } file { '/etc/nagios/nrpe.cfg': .. } file { '/etc/resolv.conf': .. } class { 'sudo': purge => true, config_file_replace => true, } sudo<IP_ADDRESS>conf { 'sudo_conf': priority => 10, content => [ '%gr1 ALL=(userfoo) NOPASSWD: ALL', '%gr1 ALL=(root) NOPASSWD: /usr/bin/wbinfo *', ] } } class bar inherits foo { File['/etc/resolv.conf'] { .. } sudo<IP_ADDRESS>conf { 'sudo_conf': priority => 10, content => [ '%gr2 ALL=NOPASSWD:/bin/chown userbar\:gr2 /dirbar/*', '%gr2 ALL=NOPASSWD:/bin/chown -R userbar\:gr2 /dirbar/*', '%gr2 ALL=NOPASSWD:/bin/chmod * /dirbar/*', ] } } I just want to customize only resolv.conf and sudo config, but i'm getting error as follows: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Sudo<IP_ADDRESS>Conf[sudo_conf] is already declared in file /etc/puppetlabs/code/environments/foobar_servers/manifests/foobar.pp:80; cannot redeclare at /etc/puppetlabs/code/environments/foobar_servers/manifests/foobar.pp:335 at /etc/puppetlabs/code/environments/foobar_servers/manifests/foobar.pp:335:3 on node foobartest01 /etc/sudoers.d/10_sudo_conf file expected to be created. How can i achieve that? Using: Puppet 4.9 Community version. Any help appreciated.
e6c0d5663bde5962e6d07eaba786b3fd684d12aaf50314e6d5e31a045e927e92
['685379189db4475080578dea1a8d7381']
That is because you are trying to find files using regex instead of file globbing. Try this one: First see if files are matching: jar tf foo/bar/abc.jar | grep "qwe/!(da-man*)xml" if matches then delete them: jar tf foo/bar/abc.jar | grep "qwe/!(da-man*)xml" | xargs zip -d foo/bar/abc.jar
c9069ce403afad20e282b38c4d181f56533abecb311643140ca58c5ebe5bc1da
['685a6d41d03940d894eb254ba3aa2f55']
{ "snapshots": [ { "snapshot": "curator-20160509052605", "version_id": 1070199, "version": "1.7.1", "indices": [ "jal" ], "state": "SUCCESS", "start_time": "2016-05-09T05:26:05.735Z", "start_time_in_millis": 1462771565735, "end_time": "2016-05-09T05:26:06.282Z", "end_time_in_millis": 1462771566282, "duration_in_millis": 547, "failures": [], "shards": { "total": 5, "failed": 0, "successful": 5 } }, { "snapshot": "curator-20160509055355", "version_id": 1070199, "version": "1.7.1", "indices": [ "jal" ], "state": "SUCCESS", "start_time": "2016-05-09T05:53:55.824Z", "start_time_in_millis": 1462773235824, "end_time": "2016-05-09T05:53:56.737Z", "end_time_in_millis": 1462773236737, "duration_in_millis": 913, "failures": [], "shards": { "total": 5, "failed": 0, "successful": 5 } }, { "snapshot": "curator-20160509060002", "version_id": 1070199, "version": "1.7.1", "indices": [ "jal" ], "state": "SUCCESS", "start_time": "2016-05-09T06:00:02.282Z", "start_time_in_millis": 1462773602282, "end_time": "2016-05-09T06:00:03.602Z", "end_time_in_millis": 1462773603602, "duration_in_millis": 1320, "failures": [], "shards": { "total": 5, "failed": 0, "successful": 5 } } ] }
0ce5c0e6d577b73c3ea16a8399c22bb9bdcca51ac5127f483d286942eeb44f2c
['685a6d41d03940d894eb254ba3aa2f55']
hi I want to set custom routing on specific field "userId" on my Es v2.0. But it giving me error.I don't know how to set custom routing on ES v2.0 Please guys help me out.Thanks in advance.Below is error message, while creating custom routing with existing index. { "error": { "root_cause": [ { "type": "mapper_parsing_exception", "reason": "Mapping definition for [_routing] has unsupported parameters: [path : userId]" } ], "type": "mapper_parsing_exception", "reason": "Mapping definition for [_routing] has unsupported parameters: [path : userId]" }, "status": 400 }
86341445a3f607dd255e5e453c4a8e9b8587c28a0875ee8385e49aef86d375c9
['6862f0791e2a4d47b73f9b85c6ccefd1']
Your main .container has 100% width, it doesn't matter if you center it, it will still start drawing it from the very left. The div inside of it that's responsible for the left-aligned box has no id/class, and you're doing no aligning on it. Technically your main container is centered, but everything inside of it is left-aligned.
badbd87835c06a4112f486fcc00cad938b0207fcb229094ad4aba99ae526825d
['6862f0791e2a4d47b73f9b85c6ccefd1']
Before I start, I know there are better ways than regex doing this (like tokenizers), that's not what the question is about. I'm already stuck using regex, and it already works as I need to, except one special case, which is what I need advice on. I need to scan through some JavaScript-like code and insert the new keyword in front of every object declaration. I already know the names of all objects that will need this keyword, and I know that none of them will have that keyword in the code before I start (so I don't need to deal with repeated new words or guessing whether something is an object or not. For example, a typical line could look like this: foo = Bar() Where I would already know that Bar is a 'class' and would need 'new' for object declaration. The following regex does the trick: for classname in allowed_classes: line = re.sub(r'^([^\'"]*(?:([\'"])[^\'"]*\2)*[^\'"]*)\b(%s\s*\()' % classname, r'\1new \3', line) It works like a charm, even making sure not to touch classname when it's inside a string (The first portion of the regex tells it to make sure there are even number of quotes before-hand - it's a bit naive in that it will break with nested quotes, but I don't need to handle that case). Problem is, class names could also have $ in them. So the following line is allowed as well if $Bar exists in allowed_classes: foo = $Bar() The above regex will ignore it, due to the dollar sign. I figured escaping it would do the trick, but this logic seems to have no effect on the above line even if $Bar is one of the classes: for classname in allowed_classes: line = re.sub(r'^([^\'"]*(?:([\'"])[^\'"]*\2)*[^\'"]*)\b(%s\s*\()' % re.escape(classname), r'\1new \3', line) I also tried escaping it by hand using \ but it has no effect either. Can someone explain why converting $ to \$ isn't working and what could fix it? Thanks
d66bcd44ffbc9cd85a073afc137e92aaa2fb8483a31fe0f0e7c474699e39bc2d
['68a2d2a173d144dab73be17c7bde640c']
I have requirement to start Redis server before start of run/debug Django app and possibly to stop the process when debugging is stoppped. I looked at documentation and used preLaunchTask to start redis service, however VS Code waits for Redis to terminate before it can start Django server. I want Redis to run in background and VS Code to start Django app parallely. Here are my launch.json and tasks.json. launch.json (operating system macOS) { "version": "0.2.0", "configurations": [ { "name": "Python: Django", "type": "python", "request": "launch", "preLaunchTask": "start-redis", "program": "${workspaceFolder}/manage.py", "args": [ "runserver", "--noreload" ], "console": "internalConsole", "django": true, } ] } tasks.json { "version": "2.0.0", "tasks": [{ "label": "start-redis", "command": "/usr/local/bin/redis-server", "type": "process", "isBackground": false }] } When I start debugging with above configuration, VS Code starts Redis server in terminal but expects this task to "complete" before it can start Django. I tried setting "isBackground" : true now VS Code throws an error The specified task cannot be tracked and the Django server doesn't start. I tried setting presentation variables in tasks.json and start redis in its own terminal, that too didn't work. I tried starting redis task as shell command /usr/local/bin/redis-server & that too didn't work, the process is getting terminated immediately.
e257afd3b40dd1439e4de453249a59e1baa58a773e259fb75d22679ee5ea4128
['68a2d2a173d144dab73be17c7bde640c']
I have simple data like this: | s | p | o | |-------|----|--------| | repo1 | v1 | high | | repo2 | v2 | medium | | repo2 | v1 | high | Question is how to select ?level such that if v2 exists select v2 else v1. The predicate v1 is guaranteed to exist. I tried select ?s, ?level where { ?s v2 ?o_v2 . ?s v1 ?o_v1 . bind(if(bound(?o_v2), ?o_v2, ?o_v1) as ?level) } However that gets me subjects only for those that have both v1 & v2.
30aaed9642a69516aa243fcdf6ab22a744913e45b320259d6ace32adcf4dae98
['68ad0a87975248f8a6de60b9e009f756']
I'm building an app that produces two tables, each with 5 results. I can't seem to figure out how to crack the code when it comes to mapping over the second table. Table one is {renderItems}, table two is {renderUsers}. The API call for each is at the top of the App.js file detailed below, as 'repoURL' and 'userURL' respectively. import React, { Component } from 'react'; import axios from 'axios'; const repoURL = 'https://api.github.com/search/repositories?q=stars:>1&s=stars&type=Repositories&per_page=5'; const userURL = 'https://api.github.com/search/users?q=created:>=2016-05-29&type=Users&s=followers&per_page=5'; export default class App extends Component { constructor(props) { super(props); this.state = { items: [] } } componentDidMount() { var _this = this; axios.get(repoURL) .then(function(res){ console.log(res) _this.setState({ items: res.data.items }); }) .catch(function(e) { console.log('ERROR ', e); }) axios.get(userURL) .then(function(res){ console.log(res) _this.setState({ users: res.data.items }); }) .catch(function(e) { console.log('ERROR ', e); }) } render() { const renderItems = this.state.items.map(function(item, i) { return ( <div key={i} className="row"> <div className="col-md-3">{item.id}</div> <div className="col-md-3">{item.name}</div> <div className="col-md-3">{item.description}</div> <div className="col-md-3">{item.stargazers_count}</div> </div> ); }); console.log(renderItems) const renderUsers = this.state.items.map(function(item, i) { return ( <div key={i} className="row"> <div className="col-md-3">{item.id}</div> <div className="col-md-3">{item.name}</div> <div className="col-md-3">{item.description}</div> <div className="col-md-3">{item.stargazers_count}</div> </div> ); }); console.log(renderUsers) return ( <div className="App"> <div className="row"> <div className="col-md-6 "> <button type="button" id="hot_repo" className="btn btn-lg btn-danger">Hot Repositories</button> </div> <div className="col-md-6 "> <button type="button" id="prolific_users" className="btn btn-lg btn-success">Prolific Users</button> </div> <div id="repoTable" className="col-md-6 panel panel-default"> <div id="repoHeader" className="panel-heading">5 Most Starred Repositories Last Month</div> <div className="repoSubHeader panel-body"> <div id="repoId" className="col-md-3">ID</div> <div id="repoName" className="col-md-3">Name</div> <div id="repoDescription" className="col-md-3">Description</div> <div id="repoStars" className="col-md-3">Stars</div> </div> <div className="row"> {renderItems} </div> </div> <div id="userTable" className="col-md-6 panel panel-default"> <div id="userHeader" className="panel-heading">5 Most Active Users</div> <div className="userSubHeader panel-body"> <div id="userId" className="col-md-3">ID</div> <div id="userLogin" className="col-md-3">Login</div> <div id="userAvatar" className="col-md-3">Avatar</div> <div id="userFollowers" className="col-md-3">Followers</div> </div> <div className="row"> {renderUsers} </div> </div> </div> </div> ); } } I feel like I'm missing something obvious, but I've been looking at it so long it's not going to be obvious to me at this point. Any help appreciated.
7acc4c5fdfb6647fda99fb591d9c47c9cbbbcaf5cc64540c339dd92f4f706105
['68ad0a87975248f8a6de60b9e009f756']
I've been pulling my hair out too long and I can't focus anymore. I am trying to take the json from a url and just render it visually in the browser. It doesn't even need to be formatted, at least it doesn't until I get past this hurdle. I can get it to show up in the console via console.log, but I can't seem to get the response into the render method. I've simplified it down to the code below until I can see something on the page. import React, { Component } from 'react'; // import axios from 'axios'; var co = require('co'); co(function *() { var res = yield fetch('https://api.stackexchange.com/2.2/search?order=desc&sort=activity&intitle=perl&site=stackoverflow'); var json = yield res.json(); console.log(res); }); class App extends Component { render() { return ( <div className="App"> INSERT JSON HERE </div> ); } } export default App; I have also retrieved the response using fetch('https://api.stackexchange.com/2.2/search?order=desc&sort=activity&intitle=perl&site=stackoverflow') .then(function(res) { return res.json(); }).then(function(json) { console.log(json); }); I originally started by using axios because I thought "oh man, I'm going to use axios because who's awesome? I'm awesome." axios.get('https://api.stackexchange.com/2.2/search?order=desc&sort=activity&intitle=perl&site=stackoverflow') .then(function(response) { console.log(response.data); }); but that was a fallacious because today I am not awesome. I'll take whatever help I can get! My original plans also included using map to just iterate over the "items" so extra points if you can steer me closer to salvation in that area.
41c38d091ff7a1daf46beb55623894e3d01fbe7f0c39c860a52ed1d8d3076605
['68b8fb858eb24dfb9a6361a46cc5034b']
Lets suppose your getBalance function is in a page component called MyPage. Then you can do this: export class MyPage { balance: number; getBalance(outerThis: MyPage){ this.restProvider.getBalance(this.user_id) .then(data => { this.todos = data; outerThis.balance = this.todos.balance; this.timersecs = this.todos.timer; /// HERE /// }); } then depending on where you are calling getBalance() from, you would pass a reference to your page as a parameter. E.g. if calling from somewhere within the page itself, you would say: this.getBalance(this);
07a076cb4017ca1db81328432629796542cbc53711b16934dad68baf6c46b6b0
['68b8fb858eb24dfb9a6361a46cc5034b']
I have a native app in Auth0, using the PKCE flow. When I call Auth0.authorize() from my Ionic app, using Auth0.js, I’m getting an access token and an ID token, but no refresh token. I am passing the offline_access scope to Auth0.authorize() (as well as openid profile). The API I’m using has “Allow Offline Access” enabled. I have no rules defined. The app in Auth0 has the following grants enabled in the advanced settings: Implicit, Authorization Code, Refresh Token. In my config for Auth0 in my client app, I’m setting: ..., audience: 'xxxxxxxxx', /* My API identifier */ responseType: 'token id_token' My redirect callback is receiving hash params like: access_token=xxxxx&scope=openid%20profile%20offline_access&expires_in=7200&token_type=Bearer&state=xxx&id_token=xxxxx but no refresh_token. What am I missing?
6e642f5845a85b2acfba8a5293082ae8b18f96ac7b84a05a3d8e644f6ab28851
['68d4cbeda81e45399ee99356b489793c']
If allowed to use multiple preg_match, this may be a solution: $str = '[cpu]4[cpu] cores and [ram]16gb[ram][hdd]1TB[hdd]asdaddtgg[vga]2gb[vga]'; $arrResult = array(); preg_match_all('/(\[[A-Za-z0-9]+\][A-Za-z0-9]+\[[A-Za-z0-9]+\])/i', $str, $match,PREG_SET_ORDER); if (is_array($match)) { foreach ($match as $tmp) { if (preg_match('/\[([A-Za-z0-9]+)\]([A-Za-z0-9]+)\[([A-Za-z0-9]+)\]/', $tmp[0], $matchkey)) { $arrResult[$matchkey[1]] = $matchkey[2]; } } } var_dump($arrResult); Result: array(4) { 'cpu' => string(1) "4" 'ram' => string(4) "16gb" 'hdd' => string(3) "1TB" 'vga' => string(3) "2gb" }
0003cb912546a6a287eb7568b60accb0abc107a5b3c4cf7867fdecce1ca6aa49
['68d4cbeda81e45399ee99356b489793c']
I new to Spring or even first use to tomcat, i'm just trying add classpath to subsection tomcat task in build.xml (in every tomcat task) and i dont why, but its works. <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"> <classpath> <path location="${appserver.home}/lib/catalina-ant.jar"/> <path location="${appserver.home}/lib/tomcat-coyote.jar"/> <path location="${appserver.home}/lib/tomcat-util.jar"/> <path location="${appserver.home}/bin/tomcat-juli.jar"/> </classpath> </taskdef>
9beaf5bd59b4fff851704daf301535787c07996e61a0694ed813b9e98a8fe287
['68e766585f414a4c822aec34ed56dd47']
I'm new to drools. I've defined the following rule to add the last two numbers in the stream together. I then send in a stream of 100 events, with the values set from 1 to 100. So I would expect the output to be 0, 1, 3, 5, 7, 9, 11, 13 etc. declare TestEvent @role( event ) value : int end rule "Simple Rule" when $sum : Integer() from accumulate ( TestEvent( $value : value ) over window:length( 2 ); sum( $value) ) then System.out.println("Value: " + $sum ); end The session is started using "fireUntilHalt" in a separate thread. If I put a delay of 10 milliseconds between every event inserted it works as expected. However when I don't have the delay, the results aren't as expected. Usually it just prints 0 and 197. Sometimes I might get a number or two in-between as well. Why does this happen and what I should do to fix?
086a1fee96e72f613d8b45e773b33bd295c2375ca7a6290481b54793481d78ff
['68e766585f414a4c822aec34ed56dd47']
You could use Class.forName(<Attribute Data Type>); and then call the string version of the constructor of that class to create a new instance of the object. This will only work if the classes you are using have a String constructor (which Long and String does - but Character doesn't). Do you need to store the Attribute value as a varchar in the DB? Could you not store the serialised Java object? Then you can just de-serialise it straight from the DB and you have the correct object already created.
2d6fecc1bbd44c2657f37ce01afec70ec0890b03d06911b5310f64bcc233958b
['68e80fbd61984a0cbf3276596fc48df1']
I'm at a loss here, i have nougat on my mate mate 8 but i completely forgot that you had to root nougat in a particular way. Anyway, i don't have access to erecovery, power+volUPvolDown doesn't work and i can't get access to fastboot. The only thing i do get is power to the screen and my 'your phone is unlocked and can't be trusted blah blah' message. I need to flash a recovery.img, system.img and any other relevant img. How can i do this with the phone in this state?
5d391c6d119b89e4a85c74dc7587e814c1a3a2d977d2d6639ca9d1bc258f6dca
['68e80fbd61984a0cbf3276596fc48df1']
I already have unlock code. Not worried about re rooting if I have to. Yes...I think fastboot is the safest bet for now. My worst case scenario is taking the phone to a repair shop where I might have to part with $100. It's starting to sound like it's worth it if I'm honest because no matter what I do...I cannot get access to fast boot. Even my Linux machine can't pick up any raw hardware so for now my ph is still not visible on any software
cf2232f212e80346af4f657e8ef118d45af978fe8647f77f240d5f6b3e40157b
['68f6237472904543a419872b7c30dac7']
I'm having an issue getting the Parent component componentWillRecieveProps to work on the child component. If i put all the logic in one component, everything will work fine. However, i want the post items to be in a separate component. The only prop that is being updated is myLikes={post.Likes.length} Posts.js(Parent) import React, { Component } from 'react'; import PostList from './PostList'; import {connect} from 'react-redux'; import { withRouter, Redirect} from 'react-router-dom'; import {GetPosts} from '../actions/'; const Styles = { myPaper:{ margin: '20px 0px', padding:'20px' } , wrapper:{ padding:'0px 60px' } } class Posts extends Component { state = { posts: [], loading: true, isEditing: false, // likes:[] } componentWillMount(){ this.props.GetPosts(); // this.setState({ // loading:false // }) } componentWillReceiveProps(nextProps, prevState) { let hasNewLike = true ; if(prevState.posts !== this.state.posts && this.state.posts>0) { for(let index=0; index < nextProps.myPosts.length; index++) { if(nextProps.myPosts[index].Likes.length !== prevState.posts[index].Likes.length) { hasNewLike = true; } } } if(hasNewLike) { this.setState({posts: nextProps.myPosts, loading:false}) // here we are updating the posts state if redux state has updated value of likes } console.log(nextProps.myPosts); } render() { const {loading} = this.state; const { myPosts} = this.props console.log(this.state.posts); if (!this.props.isAuthenticated) { return (<Redirect to='/signIn' />); } if(loading){ return "loading..." } return ( <div className="App" style={Styles.wrapper}> <h1> Posts </h1> <PostList posts={this.state.posts}/> </div> ); } } const mapStateToProps = (state) => ({ isAuthenticated: state.user.isAuthenticated, myPosts: state.post.posts, }) const mapDispatchToProps = (dispatch, state) => ({ GetPosts: () => dispatch( GetPosts()) }); export default withRouter(connect(mapStateToProps,mapDispatchToProps)(Posts)); PostList.js (Child) import React, { Component } from 'react'; import <PERSON> from '@material-ui/core/Paper'; import <PERSON> from '@material-ui/core/Button'; import Typography from '@material-ui/core/Typography'; import <PERSON> from 'moment'; import {connect} from 'react-redux'; import {DeletePost, postLike, UpdatePost,EditChange, getCount, DisableButton} from '../actions/'; import PostItem from './PostItem'; import _ from 'lodash'; const Styles = { myPaper: { margin: '20px 0px', padding: '20px' } } class PostList extends Component{ constructor(props){ super(props); this.state ={ title: '', } } // Return a new function. Otherwise the DeletePost action will be dispatch each // time the Component rerenders. removePost = (id) => () => { this.props.DeletePost(id); } onChange = (e) => { e.preventDefault(); this.setState({ title: e.target.value }) } formEditing = (id) => ()=> {; this.props.EditChange(id); } render(){ const {posts} = this.props; console.log(this.props.posts) // console.log(this.props.ourLikes); return ( <div> {posts.map(post => ( <Paper key={post.id} style={Styles.myPaper}> <PostItem myLikes={post.Likes.length} // right here myTitle={this.state.title} editChange={this.onChange} editForm={this.formEditing} isEditing={this.props.isEditingId === post.id} removePost={this.removePost} {...post} /> </Paper> ))} </div> ); } } const mapStateToProps = (state) => ({ isEditingId: state.post.isEditingId, // ourLikes: state.post.likes // reducer likes }) const mapDispatchToProps = (dispatch) => ({ // pass creds which can be called anything, but i just call it credentials but it should be called something more // specific. EditChange: (id) => dispatch(EditChange(id)), UpdatePost: (creds) => dispatch(UpdatePost(creds)), postLike: (id) => dispatch( postLike(id)), // Pass id to the DeletePost functions. DeletePost: (id) => dispatch(DeletePost(id)) }); export default connect(mapStateToProps, mapDispatchToProps)(PostList); Alternatively if everything was in one component, it will work Posts.js(all in one) import React, {Component} from 'react'; import PostList from './PostList'; import Paper from '@material-ui/core/Paper'; import {connect} from 'react-redux'; import {withRouter, Redirect} from 'react-router-dom'; import { DeletePost, postLike, UpdatePost, EditChange, getCount, DisableButton } from '../actions/'; import PostItem from './PostItem'; import {GetPosts} from '../actions/'; const Styles = { myPaper: { margin: '20px 0px', padding: '20px' }, wrapper: { padding: '0px 60px' } } class Posts extends Component { constructor(props){ super(props); this.state = { posts: [], title: '', loading: true, isEditing: false, } } componentWillMount() { this.props.GetPosts(); } removePost = (id) => () => { this.props.DeletePost(id); } onChange = (e) => { e.preventDefault(); this.setState({title: e.target.value}) } formEditing = (id) => () => { this.props.EditChange(id); } componentWillReceiveProps(nextProps, prevState) { let hasNewLike = true; if (prevState.posts && prevState.posts.length) { for (let index = 0; index < nextProps.myPosts.length; index++) { if (nextProps.myPosts[index].Likes.length !== prevState.posts[index].Likes.length) { hasNewLike = true; } } } if (hasNewLike) { this.setState({posts: nextProps.myPosts, loading: false}); // here we are updating the posts state if redux state has updated value of likes } } render() { const {loading} = this.state; const {myPosts} = this.props console.log(this.state.posts); if (!this.props.isAuthenticated) { return (<Redirect to='/signIn'/>); } if (loading) { return "loading..." } return ( <div className="App" style={Styles.wrapper}> <h1>Posts</h1> {/* <PostList posts={this.state.posts}/> */} <div> {this.state.posts.map(post => ( <Paper key={post.id} style={Styles.myPaper}> <PostItem myLikes={post.Likes.length} // right here myTitle={this.state.title} editChange={this.onChange} editForm={this.formEditing} isEditing={this.props.isEditingId === post.id} removePost={this.removePost} {...post}/> </Paper> ))} </div> </div> ); } } const mapStateToProps = (state) => ({ isAuthenticated: state.user.isAuthenticated, myPosts: state.post.posts, isEditingId: state.post.isEditingId }) const mapDispatchToProps = (dispatch, state) => ({ GetPosts: () => dispatch(GetPosts()), // specific. EditChange: (id) => dispatch(EditChange(id)), UpdatePost: (creds) => dispatch(UpdatePost(creds)), postLike: (id) => dispatch(postLike(id)), // Pass id to the DeletePost functions. DeletePost: (id) => dispatch(DeletePost(id)) }); export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Posts));
ff78470c88ef4fc1adc08681463e9ad3cc7956ff357eb805819aa2a6d40a5257
['68f6237472904543a419872b7c30dac7']
I'm having an issue with saving the session. It appears that logging in and logging out works fine. However, if making code changes or if the nodemon server refreshes, it renders null on the current_user route. And then this error when making post requests. Cannot read property 'id' of undefined router.get("/current_user", (req, res) => { if(req.user){ res.status(200).send({ user: req.user}); } else { res.json({ user:null}) } }); routes const jwt = require('jsonwebtoken'); const passport = require('passport'); router.post('/loginUser', passport.authenticate('login', {session: true}), (req, res, next) => { passport.authenticate('login', (err, user, info) => { if (err) { console.log(err); } if (info != undefined) { console.log(info.message); res.status(401).send(info.message); } else { req.logIn(user, err => { models.User.findOne({ where: { username: req.body.username, }, }).then(user => { const token = jwt.sign({ id: user.id }, process.env.JWT_SECRET); // res.cookie("jwt", token, { expires: new Date(Date.now() + 10*1000*60*60*24)}); jwt.verify(token, process.env.JWT_SECRET, function(err, data){ console.log(err, data); }) res.status(200).send({ auth: true, token: token, message: 'user found & logged in', }); // console.log(req.user) }); }); } })(req, res, next); }); passport.js const bcrypt = require('bcrypt'), BCRYPT_SALT_ROUNDS = 12, JWTstrategy = require('passport-jwt').Strategy, ExtractJWT = require('passport-jwt').ExtractJwt, Sequelize = require('sequelize'), Op = Sequelize.Op, models = require( '../models/'), localStrategy = require('passport-local').Strategy; // passport = require("passport"); // serialize session, only store user id in the session information module.exports = async (passport) => { passport.use( 'register', new localStrategy( { usernameField: 'username', passwordField: 'password', passReqToCallback: true, session: false, }, (req, username, password, done) => { try { models.User.findOne({ where: { [Op.or]: [ { username: username, }, { email: req.body.email }, ], }, }).then(user => { if (user != null) { console.log('username or email already taken'); return done(null, false, { message: 'username or email already taken', }); } else { bcrypt.hash(password, BCRYPT_SALT_ROUNDS).then(hashedPassword => { models.User.create({ username: req.body.username, password: hashedPassword, email: req.body.email }).then(user => { console.log('user created'); return done(null, user); }); }); } }); } catch (err) { done(err); } }, ), ); passport.use( 'login', new localStrategy( { usernameField: 'username', passwordField: 'password', session: false, }, (username, password, done, req) => { try { models.User.findOne({ where: { [Op.or]: [ { username: username, } ], }, }).then(user => { if (user === null) { return done(null, false, { message: 'Username doesn\'t exist' }); } else { bcrypt.compare(password, user.password).then(response => { if (response !== true) { console.log('passwords do not match'); return done(null, false, { message: 'passwords do not match' }); } console.log('user found & authenticated'); // note the return needed with passport local - remove this return for passport JWT return done(null, user); }); } }); } catch (err) { done(err); } }, ), ); const opts = { jwtFromRequest: ExtractJWT.fromAuthHeaderWithScheme('JWT'), secretOrKey: process.env.JWT_SECRET, }; passport.use( 'jwt', new JWTstrategy(opts, (jwt_payload, done) => { try { models.User.findOne({ where: { username: jwt_payload._id, }, }).then(user => { if (user) { console.log('user found in db in passport'); // note the return removed with passport JWT - add this return for passport local done(null, user); // console.log(user); } else { console.log('user not found in db'); done(null, false); } }); } catch (err) { done(err); } }), ); passport.serializeUser(function(user, done) { done(null, user.id); console.log(user.id); // gets user id }); // from the user id, figure out who the user is... passport.deserializeUser(function(id, done){ models.User.findOne({ where: { id, }, }).then(user => done(null, user)) .catch(done); }); } app.js var express = require('express'); var app = express(); var userRoute = require('./routes/users'); var postRoute = require('./routes/posts'); var bodyParser = require('body-parser'); var logger = require('morgan'); var session = require('express-session'); var cookieParser = require('cookie-parser') ; var dotenv = require('dotenv'); var env = dotenv.config(); var cors = require('cors'); var models = require('./models/'); const host = '<IP_ADDRESS>'; const PORT = process.env.PORT || 8000; const passport = require('passport'); const path = require('path'); // const allowOrigin = process.env.ALLOW_ORIGIN || '*' // CORS Middleware if (!process.env.PORT) { require('dotenv').config() } // console.log(process.env.DATABASE_URL); if (!process.env.PORT) { console.log('[api][port] 8000 set as default') console.log('[api][header] Access-Control-Allow-Origin: * set as default') } else { console.log('[api][node] Loaded ENV vars from .env file') console.log(`[api][port] ${process.env.PORT}`) console.log(`[api][header] Access-Control-Allow-Origin: ${process.env.ALLOW_ORIGIN}`) } app.use(logger('dev')); app.use(express.static(path.join(__dirname, 'public'))); app.use(express.static(path.join(__dirname, 'build'))); app.use(cookieParser()); app.use(session({ secret : process.env.JWT_SECRET, })); require('./config/passport.js')(passport); // PASSPORT Init app.use(passport.initialize()); app.use(passport.session()); app.use(bodyParser.urlencoded({ extended:false})); app.use(bodyParser.json()); // this code may be useless or useful, still trying to understand cors. app.use(function(req, res, next) { res.header('Access-Control-Allow-Origin', '*'); res.header('Access-Control-Allow-Credentials', true); res.header("preflightContinue", false) res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE'); res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization'); next(); }); app.use(cors({ origin: process.env.ALLOW_ORIGIN, credentials: true, allowedHeaders: 'X-Requested-With, Content-Type, Authorization', methods: 'GET, POST, PATCH, PUT, POST, DELETE, OPTIONS' })) app.use('/api/users', userRoute ); app.use('/api/posts', postRoute ); // In order to use REACT + EXPRESS we need the following code, alone with a build // in the client folder we run a npm run build in the client folder then it is referred // in the following code. app.use(express.static(path.join(__dirname, 'client/build'))); if(process.env.NODE_ENV === 'production') { app.use(express.static(path.join(__dirname, 'client/build'))); // app.get('*', (req, res) => { res.sendfile(path.join(__dirname = 'client/build/index.html')); }) } //build mode app.get('*', (req, res) => { res.sendFile(path.join(__dirname+'/client/public/index.html')); }) app.use(function(req, res, next) { res.locals.user = req.user; // This is the important line // req.session.user = user console.log(res.locals.user); next(); }); models.sequelize.sync().then(function() { app.listen(PORT, host, () => { console.log('[api][listen] http://localhost:' + PORT) }) })
de319a983a216f795b8e5496e07e0184e7f01e72f657f0c6bed0a5a618d14502
['6910da609e0c49b28c56056991455a92']
An ActionMailer method can be triggered using one of two methods: either deliver or deliver! - the main difference between the two is that the second will throw exceptions if it cannot be sent, which is why I tend to prefer using it. Something to keep in mind though, is that using deliver! will call any registered Mail Observers, but not Interceptors - meaning that your mail will be sent unaltered. Taken from this blog.
68cf5a5733843bf3da27646fcad4d1b74cbb3d9e0aa9ac223e12f9f178458f81
['6910da609e0c49b28c56056991455a92']
EntityManager.merge(T entity) merges the state of the given entity into the current persistence context. Depending on the underlying datastore, by the time it merges the entity, the same entity record from the repository may already be altered with different information so any of that altered information may be lost and overwritten by the later merge. Instead of using EntityManager.merge(T entity), use EntityManager.createQuery(CriteriaUpdate updateQuery).executeUpdate(). This should only update the values of the specified attributes you provide. @Transactional public void methodA(Long id, String color) { final CriteriaBuilder cb = entityManager.getCriteriaBuilder(); final CriteriaUpdate<Fruit> updateColor = cb.createCriteriaUpdate(Fruit.class); final Root<Fruit> updateRoot = updateColor.from(Fruit.class); updateColor.where(cb.equal(updateRoot.get(Fruit_.id), id)); updateColor.set(updateRoot.get(Fruit_.id), id); entityManager.createQuery(updateColor).executeUpdate(); } @Transactional public void methodB(Long id, int price) { final CriteriaBuilder cb = entityManager.getCriteriaBuilder(); final CriteriaUpdate<Fruit> updatePrice = cb.createCriteriaUpdate(Fruit.class); final Root<Fruit> updateRoot = updatePrice.from(Fruit.class); updatePrice.where(cb.equal(updateRoot.get(Fruit_.id), id)); updatePrice.set(updateRoot.get(Fruit_.price), price); entityManager.createQuery(updatePrice).executeUpdate(); } As long as no other transaction updates the same fields as either of these methods, then there should no longer be any issues with this update.
8e074476738f4447519afd2778a38e0140535f27e4935c8b7f2e06affe1e8c15
['6918804a8835415b832c601e5c07d7fc']
In the case of a roped up team marching along a glacier with some hidden crevasses, the greatest risk is of a team member falling in and then dragging everyone else along before they can self-arrest. In such a scenario would it help to use either an elastic lanyard or a "energy absorber"? My guess is that 1) the fall is somewhat slowed down, and 2) the expansion of the elastic sling/absorber both makes it easier for the others to notice as well as gives them more time to react. But I have not seen this in practice, hence the question.
868dd68cd848d82328dcfc6faf8b333b295884506cdb1427fbd677ff76483b3c
['6918804a8835415b832c601e5c07d7fc']
You have actually answered the question yourself. In order to act on behalf of an account, you need its private key. As such, if the node is down it is impossible to retrieve any accounts associated with it through other nodes. That would defeat the purpose of having a blockchain as a blockchain network consists of peers whose owners you do not necessarily trust, let alone entrust with the private key(s) to your account(s).
11b63ea311855d4b8285edea6427c798fc4914921440909262ba801baded5c77
['691d724337e74460bdfe817818a4153f']
So I am new to HTML5 and decided to start to code a pong game. I want to move my characters smoothly using my keyboard, the W and S keys for the one on the left and the Up and Down arrows for the one on the right. I can't seem to get it to work. It's probably quite easy, but me being the noob I am, I need a bit of help. Thanks in advance! <!DOCTYPE html> <html> <head> <title>Pingedy Pong</title> </head> <body style="font-family:Arial;"> <canvas id="ctx" width="699" height="400" style="background-color:black;border:2px solid black;background-image: url('background.jpg');"></canvas> <script> // STARTING SCRIPT var ctx = document.getElementById("ctx").getContext("2d"); ctx.fillStyle="white"; ctx.font = '30px Arial'; // VARIABLES var keys1 = []; var keys2 = []; var width = 699; var height = 400; var ball = { width:20, height:20, spdX:2.9, spdY:2.9, x:340, y:190, }; var char1 = { w:15, h:90, spdX:3, spdY:3, x:10, y:155, }; var char2 = { w:15, h:90, spdX:3, spdY:3, x:674, y:155, }; // UPDATE function updateEntity(a) { a.x+=a.spdX; a.y+=a.spdY; ctx.clearRect(0,0,width,height); ctx.fillRect(a.x,a.y,a.height,a.width); if(a.x > width-a.width || a.x < 0) { a.spdX = -a.spdX; }; if(a.y > height-a.height || a.y < 0) { a.spdY = -a.spdY; }; }; function renderChar(b) { ctx.fillRect(b.x,b.y,b.w,b.h); }; function checkInput() { document.addEventListener('onkeydown', function(e) { if(e.keyCode == 37) { char1.y += 1; } else if(e.keyCode == 39) { char1.y -= 1; } }); }; function checkWinP1() { if (ball.x < 0.33) { console.log("P1 Wins"); }; }; function checkWinP2() { if (ball.x > 679) { console.log("P2 Wins"); }; }; function update() { updateEntity(ball); renderChar(char1); renderChar(char2); checkInput(); checkWinP1(); checkWinP2(); }; //TICKS setInterval(update,1000/120); </script> </body> </html>
c577df8fbd2b4f6cd795ae60ed3556ffa732d0233b19adc176cb382a30493102
['691d724337e74460bdfe817818a4153f']
Firstly, bring in the file. Make sure to include the './' before the file name to show that it's from the current directory. const data = require('./data.json'); Now the JSON data is stored inside the variable data. To access the members, use the dot operator. data.room will return the array of rooms. To access the individual room, use data.room[i] where i is the numbered element in the array (starting from 0). For example, to access the first room: const first_room = data.room[0]; This first_room variable can now be used to access the name. console.log(first_room.name); This will log "room1" to the console.
3dafb330968323feb9034676205f3af8dac605b1f2645f038960ffb0e1178c18
['69264b7936ef446b803d84cd4aa6f932']
This was an 80s movie, the kid had super intelligence, was able to read barcodes and I think could some how ID people if they had arrest records. I also remember him being attacked by some sort of virus he got through the phone. I want to say it's because of some sort of accident with a computer.
8b9ee55856d25b8f959022ccd4e5a9aa75a89edfc34bddbbeb3f4f6bd8a59048
['69264b7936ef446b803d84cd4aa6f932']
In need help in my homework assignment: let $X =\left \{ (x_{0}:x_{1}:x_{2}:x_{3}:x_{4})\in \mathbb{P}^{4} : rk\begin{pmatrix} x_{0} & x_{1} & x_{2}\\ x_{2} & x_{3} & x_{4} \end{pmatrix} < 2\right \} $ show that there is a morphism $\varphi :X\rightarrow \mathbb{P}^2 $ which on the open subset of $X$ where $(x_{0},x_{1},x_{2}) \neq(0,0,0)$ is given by the projection $ (x_{0}:x_{1}:x_{2}:x_{3}:x_{4}) \mapsto (x_{0},x_{1},x_{2})$ for each point $P \in \mathbb{P}^{2} $ determine the inverse image $\varphi ^{-1}(P)$ I thought at first to display X like V(I), but I got no intuition of what that could be, can you help?
279ef09f58bf98bfccd142b7aa6292a2c085a1f7d9e111e96c3adffe80402703
['6928b82c20d34e4fb9e8f525282adffc']
You'll need to rewrite jwtAccessAuthCheck(accessToken) so that it keeps track of the outcome of its nested tasks. In the code you've written: // Code that needs fixes! async function jwtAccessAuthCheck(accessToken) { // This part is fine. We are in the main async flow. if (!accessToken) { return Promise.reject('Empty access token'); } // This needs to be rewritten, as the async function itself doesn't know anything about // the outcome of `jwt.verify`... jwt.verify(accessToken,"dipa",function(err){ if(err) { // This is wrapped in a `function(err)` callback, so the return value is irrelevant // to the async function itself return Promise.reject('TokenExpiredError.'); } else { // Same problem here. return Promise.resolve(); } }); // Since the main async scope didn't handle anything related to `jwt.verify`, the content // below will print even before `jwt.verify()` completes! And the async call will be // considered complete right away. console.log('Completed before jwt.verify() outcome'); } A better rewrite would be: // Fixed code. The outcome of `jwt.verify` is explicitly delegated back to a new Promise's // `resolve` and `reject` handlers, Promise which we await for. async function jwtAccessAuthCheck(accessToken) { await new Promise((resolve, reject) => { if (!accessToken) { reject('Empty access token'); return; } jwt.verify(accessToken,"dipa",function(err){ if(err) { reject('TokenExpiredError.'); } else { resolve(); } }); }); // We won't consider this async call done until the Promise above completes. console.log('Completed'); } An alternate signature that would also work in this specific use case: // Also works this way without the `async` type: function jwtAccessAuthCheck(accessToken) { return new Promise((resolve, reject) => { ... }); } Regarding your cancelDansok(req, res) middleware, since jwtAccessAuthCheck is guaranteed to return a Promise (you made it an async function), you'll also need to handle its returned Promise directly. No try / catch can handle the outcome of this asynchronous task. exports.cancelDansok = function (req, res) { ... jwtAccessAuthCheck(accessToken) .then(() => { log.info("jwt success"); return doCancel(dansokSeqNo); }) .then(() => { log.info("cancelDansok() finish"); res.status(200).json({ message: 'cancelDansok success.' }); }) .catch(e => { res.status(e.status).json(e); }); }; I strongly suggest reading a few Promise-related articles to get the hang of it. They're very handy and powerful, but also bring a little pain when mixed with other JS patterns (async callbacks, try / catch...). https://www.promisejs.org/ Node.js util.promisify
ca8e033374f0d48256786f1304ccec0cfd90c3a67d7d71cc01e357528eed6d05
['6928b82c20d34e4fb9e8f525282adffc']
You want /server/rest-api/v1/index.js to expose a unique Router that uses sub-routers, each corresponding to one of your folders (products, product_categories, etc.) /server/rest-api/v1/index.js var express = require('express'), router = express.Router(), product_router = require('./products'), product_categories_router = require('./product_categories'); router.use(product_router); router.use(product_categories_router); // etc. module.exports = router; On a side note, if you are dealing with many routes this way, it may be handier for you to define your API entry point once ('/api/v1'), when mounting the router. This way your "business" routers don't need to know the entry path themselves (and it should not matter to them), which is convenient if you ever need to change that path one day. Then again this is up to you and how you want to design your server :) Example : server.js app.use('/api/v1', require('./server/rest-api/v1')); /server/rest-api/v1/index.js var express = require('express'), router = express.Router(), product_router = require('./products'); router.use('/purchases/products', product_router); module.exports = router; /server/rest-api/v1/products/index.js var express = require('express'), router = express.Router(), create_product = require('./create-product.controller'); router.route('/new').post(create_product.post); module.exports = router;
5dde7ec7887bc732947dc4359ec336d3ea1e634682bfb8e1d09986f89193725b
['692a0505eecb4c8683cda40491864722']
I'm generating a Nuget Package dll generated from ILMerge. 1º - The code was inserted in Post-build event command line: "$(ProjectDir)....\packages\ilmerge.2.13.0307\ILMerge.exe" "$(ProjectDir)....\05-ILMergeDlls\Custom.Framework.ExtensionInt.dll" "$(ProjectDir)....\05-ILMergeDlls\Custom.Framework.ExtensionString.dll" /ndebug /log /out:"$(ProjectDir)....\05-ILMergeDlls\Custom.Framework.dll". Image1: https://lh3.googleusercontent.com/-D28vgwy8eb0/UrLRrfLcC0I/AAAAAAAABIg/-4BKu_MZjyU/w665-h485-no/01-Package.jpg 2º - My nuspec file and when installing the package, appears in the directory two XML documentation files: Image2: https://lh5.googleusercontent.com/-ttIt9aWGR4U/UrLb_ZGX9HI/AAAAAAAABJg/0i9POZHgwx4/w1090-h694-no/02-NuspecFile-FilesXML.jpg Any idea why they appear? Actually I would like to include the XML documentation file of the merged dll, even tried this using the command / xmldocs in ILMerge, but the same thing happened, can someone help me? PS: Windows 8, Visual Studio 2010 SP1, C#, ILMerge 2.13.0307 In advance, thank you! Still can not post pictures directly, so only insert links.
367ac8e11f86d0ee9dd84aa253c899672d0404364d591337047600fd9866c243
['692a0505eecb4c8683cda40491864722']
I'm new to WPF and would like to know what to use to get a shape like the image below: I also wonder if it is possible that this design may follow the form's dimensions, ie, if the form is resized, the design is too. In advance, thank you! Windows 8.1, Visual Studio 2013, C#, WPF Application
d17a10273eb85488e0fe59378e274f0ee759b824c82a3cabb0ca5fc12c1f5293
['6948b173d18b4215a03a8b5fa1f3985f']
My main problem is that I cannot use sudo. My root account is locked using sudo passwd -dl root. I have two users on my machine. root and admin, admin does not have su permission. When I try to use sudo on admin user, it says that admin is not in the sudoers file. When I try to use su while logged in admin user su: Authentication failure and when I try to use sudo admin is not in the sudoers file. This incident will be reported. can I unlock my root user back?
942de986974b2c2cb6e4144ca376d8d7b3b63360d7dbe705a0931f2623c46901
['6948b173d18b4215a03a8b5fa1f3985f']
I have a current root user which is able to do, well ROOT privileges on my SFTP running on Ubuntu LTS 12.04. I'm planning on adding a new user that can only read a specific directory inside my sftp. probably just inside the www/ folder. What privileges should I gave?
fbb5d762c79b8f8b5e1a96373ea2323e2109b1e35691be1a3b393a789abd0c89
['69499727b5cc406f8ae1676c9bea8051']
As described for example on wikipedia, you can shorten these addresses and omit zeros if it is unambiguous. For example: The loopback address, <IP_ADDRESS>, may be abbreviated to <IP_ADDRESS>1 by using both rules. So give it a try once more to have a look at your real IP if you don't miss some colon : or something else.
5ee4ce4961bd58eb817fb9c5f7d2a036378fc9d64dfb51266fc16d48736f6e42
['69499727b5cc406f8ae1676c9bea8051']
What is "secure"? It is not a boolean value, secure and insecure. In *nix systems, there are various levels of security and privacy. Talking about chroot, it can be always used in a way that is insecure, but SSH is trying to avoid the insecure use cases the most. In the first place, it will not allow to use chroot on directory, that is writable by anyone else but root. Using internal-sftp significantly limits what the user can do inside so unless there is very serious security vulnerability, you should be fine with that.
403c8212429f0631a5210f50e50b2e7faad1a20339e9dcc5d096b3789c84c1f3
['69590a9b64fa41e583fa1e258bb7ebdb']
I'm trying to perfom update on mongodb, using motor and tornadoweb with the following code: @gen.coroutine def set_project_status(self, pid, status): try: project = yield motor.Op(self.db[S.DB_PROJECT_TABLE].find_one, {'PID': pid}) logging.debug('set_project_status old_id {0}'.format(project['_id'])) project_update = yield motor.Op(self.db[S.DB_PROJECT_TABLE].update, {'_id': ObjectId(project['_id'])}, {'STATUS': status}) logging.debug('set_project_status saving') save = yield motor.Op(self.db[S.DB_PROJECT_TABLE].save, project_update) logging.debug('set_project_status saved {0}'.format(save)) logging.debug('set_project_status saved id {0}'.format(project_update)) project = yield motor.Op(self.db[S.DB_PROJECT_TABLE].find_one, {'PID': pid}) logging.debug('set_project_status project {0}'.format(project)) raise gen.Return(True) except Exception,e: logging.debug('{0} {1} {2}'.format(pid, status, e)) raise gen.Return(False) What I get in logs is: set_project_status old_id 52d532d4b12c6478ce767a83 set_project_status saving set_project_status saved 52d532d4b12c6478ce767a84 set_project_status saved id {u'ok': 1.0, u'err': None, u'connectionId': 2052, u'n': 1, u'updatedExisting': True, '_id': ObjectId('52d532d4b12c6478ce767a84')} set_project_status project None I'm getting some intermediate object (u'updatedExisting ?) and None later on. I seems, like I should do some 'commit'or so. Any ideas? Greets!
869ecbdcc5982bcc8aacf9e6607d454541b729d3ec2781bcb332b6f5e81be2e2
['69590a9b64fa41e583fa1e258bb7ebdb']
In my backend handler I'm sending string with double quots, like: print '\"test\"' self.render('test.html', test = '\"test\"') in template test.html I'm passing test variable into javascript, like: <script> var test = {{ test }}; </script> But what actually browser generates is: <script> var test = &quo t;test&quo t;; </script> string quote appears instead of double quote " Is there in tornadoweb something similar to Django pipeline, which should do the trick: <script> var test = {{ test|safe }}; </script> Or maybe there is another way for passing strings with double quotes (which I really need in frontend)? greets!
ceb8a245089364f264823c09447af99abc6db59b3050c71b1548a9b3f15e1ed8
['698dbc332d4442fe9d4dba26407c8e27']
I'm working on a project where I want to ramp the pwm duty cycle from 0 to 50%. My period is 16000 counts or 1ms (16MHz default timer count). For some reason, instead of updating the duty cycle each period, it updates it much slower. I wonder if it's because I'm calculating the new duty cycle within the timer interrupt? Here's what I'm using: void TIM4_IRQHandler() { if (TIM_GetITStatus(TIM4, TIM_IT_Update) != RESET) { TIM_ClearITPendingBit(TIM4, TIM_IT_Update); if (loop <= 8000) { TIM4 -> CCR1 = CCR_i; uint16_t y = CCR_i; CCR_i = y + 1; int x = loop; loop = x + 1; } if (loop == 8001) { TIM4 -> CCR1 = 0; uint16_t x = CCR_i; CCR_i = x + 1; int c = loop; loop = c + 1; } if (loop > 8001) { int t; for(t = 0; t < 10; t++){ // wait } GPIO_SetBits(GPIOG, GPIO_Pin_8); //Stop2(); TIM_ITConfig(TIM4, TIM_IT_Update, DISABLE); NVIC_DisableIRQ(TIM4_IRQn); } } }
23adad7dad626d3a9f86e6be5a56876a0a3e7780e8eb84a8fa13bafe1b2b1d95
['698dbc332d4442fe9d4dba26407c8e27']
I've adjusted the example from here for the STM3240G-EVAL board in order to blink LEDs 3 and 4. I have it working, but am confused by the Mode register setting: GPIOG->MODER |= (GPIO_MODER_MODER6_0 | GPIO_MODER_MODER8_0) ; When I read the reference manual (p186), it claims that the mode must be set to 01 for output, yet setting it to 0 in this way works just fine. Ideally I'd like to be able to change to the other modes, but I would have assumed that the above code would have changed pins 6 and 8 of port G to input pins. I must be missing something. Here's my complete main document in case it's relevant: #include "stm32f4xx.h" /* We will use PG6 and PG8 connected to LEDs 1 and 2 because they're the same port. */ /* Find base register value for Port G */ void delay (int a); int main(void) { /*!< At this stage the microcontroller clock setting is already configured, this is done through SystemInit() function which is called from startup file (startup_stm32f0xx.s) before to branch to application main. To reconfigure the default setting of SystemInit() function, refer to system_stm32f0xx.c file */ /* GPIOG Periph clock enable */ RCC->AHB1ENR |= RCC_AHB1ENR_GPIOGEN; GPIOG->MODER |= (GPIO_MODER_MODER6_0 | GPIO_MODER_MODER8_0) ; /* Configure PG6 and PG8 in output mode */ GPIOG->OTYPER &= ~(GPIO_OTYPER_OT_6 | GPIO_OTYPER_OT_8) ; // Ensure push pull mode selected--default GPIOG->OSPEEDR |= (GPIO_OSPEEDER_OSPEEDR6|GPIO_OSPEEDER_OSPEEDR8); //Ensure maximum speed setting (even though it is unnecessary) GPIOG->PUPDR &= ~(GPIO_PUPDR_PUPDR6|GPIO_PUPDR_PUPDR8); //Ensure all pull up pull down resistors are disabled while (1) { /* Set PG6 and PG8 */ /* the bit set/reset low register SETS the output data register */ /* the bit set/reset high register RESETS the output data register */ GPIOG -> BSRRL = (1 << 6); GPIOG -> BSRRL = (1 << 8); delay(500000); /* Reset PC8 and PC9 */ GPIOG -> BSRRH = (1 << 6); GPIOG -> BSRRH = (1 << 8); delay(500000); } return 0; } void delay (int a) { volatile int i,j; for (i=0 ; i < a ; i++) { j++; } return; }
740184ac736ea0b68b1198f56d9c9545eba9d6cc022807cd4fbb333ec992f58a
['6991ec60b02c4c559b7b376119372a65']
In your activity, after you set the adapter for the view pager, put your code for whatever on the onPageSelected() method. It is called everytime you change or swipe the viewPager. viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { } @Override public void onPageScrollStateChanged(int state) { } });
77ab9d007d019a224e09f0fd10ab865fa996f1b59e5666b8cb2b0e23a62be369
['6991ec60b02c4c559b7b376119372a65']
I want to override the android chronometer class. I want it to inflate a custom XML layout and to also have a quicker update interval. I've found one that modifies the update interval from the default 1s to 0.1s on github. But I want to do more and have imageViews or Buttons display the time instead of the default textView it uses. I haven't really done this before except for a recycle view, so some explanation would be nice. My end goal is to have an efficient stopwatch with custom digits and display, like the one found on HTC one M7 in the default clock app or any Samsung phone. I also need it to run in its own Fragment and be able to handle orientation changes and the activities onPause() or onStop() without losing any time. Would it be better to use Intent Service and a Results Reciever? if so how would i accomplish this?
625b1a664545ca2861ee5325368e34b9f7353900dfe4fc8c20084f82b1d8000c
['699811a66c204dd89076073ca678913c']
In our current SP2013 project, we're using AD Import to import data from the AD to the user profiles. Now I want to add some more information from the user profile to the search results of the people search. So far I've successfully changed the display template for the people item to include the WorkPhone for example. Now I want to include the Office (room) into the result. When looking at the properties of an AD user, this is the field General tab -> Office. The AD import to SharePoint apparently works, because the user profile contains the value I entered in the AD. Here this is in the property "Office" (User Profile Service Application -> Manage User Properties). But now I'm not sure how this property can be mapped to the SP2013 search (to a managed property which I can then include in the display template). In the Search Service Application -> Search Schema, there is no crawled property "Office", and also no managed property of that name. There is a crawled Property "People:Office" which is mapped to the managed properties "OfficeNumber" and "ContentsHidden". I included both in the display template, but the template seems to find no values for them (I'm logging the values found in ctx.CurrentItem to the javascript console, but there are no values for either property, in fact, neither appear as properties on the ctx.CurrentItem object). There is also a managed property "BaseOfficeLocation" which maps to the crawled property "People:SPS-Location" but this is not the one I want. So, my question is: Does anyone know how the property "Office" in the user profile service application is mapped to the search managed properties?
86d6b35dfbe22a0641e8b5ad0f1aae92d21ed21f118d1b69cf5ed1f609969dff
['699811a66c204dd89076073ca678913c']
Ok, this makes sense. I was looking for a crawled property "Office" but there was none. Now I understand that those (User Profile) properties are preceded with "People:". But: when I add the corresponding properties to my display template (under mso:ManagedPropertyMapping), like "OfficeNumber":"OfficeNumber", then I still do not get a value for it. I'm logging all values I find in the ctx.CurrentItem to the console, and it does not have an OfficeNumber value. I did a full crawl inbetween, and made sure the profile has a value in the field. But it is not found in the display template.
4cf9e790576b350604b43d779f67d6a610c14707a4c83ac8836a27321854760a
['69a8cf45671042f085b7eaacbcc0685b']
In GIMP, is there a way to control a gradient brightness and/or contrast of a selection? The application is this: I'd like to control the brightness/contrast of one end of my selection to match a darker area of a particular image, while also controlling the brightness/contrast of the other end to match a lighter area of the same image while obtaining a smooth transition between the two ends. Thank you, in advance.
7d04e52e80c47c13fb71e63485b9e46a3b1952746a5fcb444b637ee840325d05
['69a8cf45671042f085b7eaacbcc0685b']
I found this on another forum and so will post it here in case anyone finds it useful. Note that how you do this changes depending on whether you are using MVC 1 or 2 the class you create needs to implement public void OnAuthorization(AuthorizationContext filterContext) and then you can use string controllerName = filterContext.RouteData.Values["controller"].ToString(); and the same, substituting "action" for "controller" (make sure you check for nulls in these values first). In MVC 2 this can be changed to filterContext.ActionDescriptor.ActionName and .ActionDescriptor.ControllerDescriptor.ControllerName and you won't have to check for nulls
743ae4d21b83e8d4007a33329c078ed90e89a628d2c6c465da07bf4353647382
['69b51230ebfc4bd082870e251488da34']
I have not worked with any kind of I2C TO SPI converter. Still, you can use some I2C to SPI bridges if they work, I just googled it, but that can cause wiring problems. I can suggest you the same ADC MCP series with I2C interface.Thus, the further I2C connections with MCP23017 expander and then the Raspberry pi would be easy.You can go through various analog to digital converters that can be I2C interfaced with their codes in python or java for pi like MCP3425, MCP3426, MCP3427, MCP3428. You can easily find them or also check control everything as that would be easy to interface using I2C cables and adapters preventing connection or wiring problems.For codes: https://github.com/ControlEverythingCommunity?utf8=%E2%9C%93&query=MCP34 The following codes for MCP_23017 can also help you code the way you want easily with expander being connected to pi:https://github.com/ControlEverythingCommunity/MCP23017_16-Channel. I think this would solve your problem!! Thanks.
49633851aa79c6016045dbaaac83da5fd80207aa65f2ad763999e3211564052f
['69b51230ebfc4bd082870e251488da34']
Since you want for the application you want to design, that pressure do not change with the temperature changes, you can use the following sensors: https://www.controleverything.com/content/Analog-Digital-Converters?sku=MS5637-02BA03_I2CS https://www.controleverything.com/content/Pressure?sku=AMS5812_I2CS_0150-D-B These sensors would require I2C interface with the controlling unit you are using. If you will give me any idea about the controlling unit you are using I can further provide you with the codes and all. I hope this helps you out.
c3e5641f45ebc305e357bcd97cbbb52d474c424fcdcb4c2f23026fde106c952b
['69d2b39038c6404f9c8bf17bfae23b88']
I have netcdf data that is masked. The data is in (time, latitude, longitude). I would like to make an array with the same size as the original data but with zeros when the data is masked and with ones where it is not masked. So fare I have tried to make this function: def find_unmasked_values(data): empty = np.ones((len(data),len(data[0]),len(data[0,0]))) for k in range(0,len(data[0,0]),1): # third coordinate for j in range(0,len(data[0]),1): # second coordinate for i in range(0,len(data),1): # first coordinate if ma.is_mask(data[i,j,k]) is True: empty[i,j,k] = 0 return(empty) But this only returns an array with ones and no zeros eventhough there is masked values in the data. If you have suggestions on how to improve the code in efficiency I would also be very happy. Thanks,
623e6a6b9ee1672b52bb844b483c1394e9e9f991349cc996a76f21d74dce5cb1
['69d2b39038c6404f9c8bf17bfae23b88']
I am working on filling in missing data in a large (4GB) netcdf datafile (3 dimensions: time, longitude and latitude). The method is to fill in the masked values in data1 either with: 1) previous values from data1 or 2) with data from another (also masked dataset, data2) if the found value from data1 < the found value from data2. So fare I have tried a couple of things, one is to make a very complex script with long for loops which never finished running after 24 hours. I have tried to reduce it, but i think it is still very much to complicated. I believe there is a much more simple procedure to do it than the way I am doing it now I just can't see how. I have made a script where masked data is first replaced with zeroes in order to use the function np.where to get the index of my masked data (i did not find a function that returns the coordinates of masked data, so this is my work arround it). My problem is that my code is very long and i think time consuming for large datasets to run through. I believe there is a more simple way of doing it, but I haven't found another work arround it. Here is what I have so fare: : (the first part is just to generate some matrices that are easy to work with): if __name__ == '__main__': import numpy as np import numpy.ma as ma from sortdata_helpers import decision_tree # Generating some (easy) test data to try the algorithm on: # data1 rand1 = np.random.randint(10, size=(10, 10, 10)) rand1 = ma.masked_where(rand1 > 5, rand1) rand1 = ma.filled(rand1, fill_value=0) rand1[0,:,:] = 1 #data2 rand2 = np.random.randint(10, size=(10, 10, 10)) rand2[0, :, :] = 1 coordinates1 = np.asarray(np.where(rand1 == 0)) # gives the locations of where in the data there are zeros filled_data = decision_tree(rand1, rand2, coordinates1) print(filled_data) The functions that I defined to be called in the main script are these, in the same order as they are used: def decision_tree(data1, data2, coordinates): # This is the main function, # where the decision between data1 or data2 is chosen. import numpy as np from sortdata_helpers import generate_vector from sortdata_helpers import find_value for i in range(coordinates.shape[1]): coordinate = [coordinates[0, i], coordinates[1,i], coordinates[2,i]] AET_vec = generate_vector(data1, coordinate) # makes vector to go back in time AET_value = find_value(AET_vec) # Takes the vector and find closest day with data PET_vec = generate_vector(data2, coordinate) PET_value = find_value(PET_vec) if PET_value > AET_value: data1[coordinate[0], coordinate[1], coordinate[2]] = AET_value else: data1[coordinate[0], coordinate[1], coordinate[2]] = PET_value return(data1) def generate_vector(data, coordinate): # This one generates the vector to go back in time. vector = data[0:coordinate[0], coordinate[1], coordinate[2]] return(vector) def find_value(vector): # Here the fist value in vector that is not zero is chosen as "value" from itertools import dropwhile value = list(dropwhile(lambda x: x == 0, reversed(vector)))[0] return(value) Hope someone has a good idea or suggestions on how to improve my code. I am still struggling with understanding indexing in python, and I think this can definately be done in a more smooth way than I have done here. Thanks for any suggestions or comments,
bb8925f79057dd57ec8881b78a4572e2b75e14709576d2e5beb4c8dfa531edd6
['69dce749ccc742d88a27db51c13ceb5f']
Basically, on a Nexus 7 when the font-size changes on the HTML element it's ignored. If I remove the smaller font size everything works as intended, but this adds it's own issues for phones. CSS: html { font-size: 10px; } @media (min-width: 600px) and (max-aspect-ratio: 21/15), (min-width: 768px) { html { font-size: 16px; } } It works if I remove the first line so the media query isn't the issue. Anyone have any ideas or come across this? My only theory so far is it might be a bug with WebViews (this is currently in a web view).
82bedf4cc7348e0bb895a556d01baf8da5159ca4fd5b8deb768c1644f60b3bc3
['69dce749ccc742d88a27db51c13ceb5f']
I have two SVGs I want to morph between with Anime.Js, however they need to be the same number of points. So I either need a way to add points to an SVG or a way to convert a circle into a path with a specific number of points. Here are the SVGs in question: <svg id="svg1" width="290" height="290" viewBox="0 0 290 290" xmlns="http://www.w3.org/2000/svg"> <path d="M10,145a135,135 0 1,0 270,0a135,135 0 1,0 -270,0" /> </svg> <svg width="290" height="290" viewBox="0 0 290 290" xmlns="http://www.w3.org/2000/svg"> <path d="M280 145C280 225.081 219.558 290 145 290C10 290 10 225.081 10 145C10 64.9187 70.4416 0 145 0C280 0 280 64.9187 280 145Z" /> </svg> My assumption is that I might be able to just add points anywhere on the line of the circle's path in something like Figma. If that's the case, it's 22 points I need, correct?
855474442357cd0875da5a883355e365f2d9d3ebb90a171bc69dfbfa2aa11175
['69ec003bf66b487daca09e4d356fd317']
I have written a code in python which copies files from one folder to another and it's working fine. I need to amend it so that it can only copy the new files only because with the following code, whenever I run my script, all of my files in folder_1 get copied into folder_2 and I have to deal with millions of text files so it's not a compact code right now. Anyone here who can solve this problem? Check the following code which is running fine but not fulfilling my requirements. I only want those files to copy from Folder_1 to to Folder_2 which are not present in Folder_2... import os, shutil import os.path, time path = 'C:/Users/saqibshakeel035/Desktop/Folder_1/' copyto= 'C:/Users/saqibshakeel035/Desktop/Folder_2/' files = os.listdir(path) files.sort() for f in files: print(f) #f contains the names of files src = path+f #path of source dst = copyto+f #path of destination shutil.copy(src,dst) #copying from source to destination print("This is source" +src) print("This is destination " +dst) print(f) Output Image
3b382e26c563eb708fe6ace60555f27e5695cc907b37a6093376b59af7a7c1e1
['69ec003bf66b487daca09e4d356fd317']
I am setting up my raspberry pi as a VPN client using IPsec/L2TP.I am using the following guide Configure Linux VPN clients using the command line There are several problems which I am encountring After setting up all the settings, when I try to start the IPsec connection using ipsec up myvpn. I get the following error /usr/local/sbin/ipsec: unknown IPsec command "up" ("ipsec --help" for list) After setting up and rebooting my raspberry pi, when I run ipsec verify, I get the table status table of ipsec verify in which my pluto is not running(error 1) and there is an error of ikev1. My motivation is to setup VPN client on my raspberry pi using IPsec/L2TP so that I can access my remote VPN client. Also I am setting up my IPsec/L2TP using strongSwan and xl2tpd but using Ipsec verify, on path ipsec verison is Libreswan 3.27 (netkey) on 4.14.98-v7+. i tried to change it but didn't succeeded. Any recommendations regaridng above mentioned queries would be great and I shall be thanful. Regards <PERSON>
b06911edcb534661dbf84fc42e8943ee757af90068bae81d360c2e4f6f41edd1
['69fa75e2a24a462aa141928c38723dcb']
One of my staff just got a new Mac mini with the USB 3 ports and Mavericks. It has 2 Seagate GoFlex 3TB hard drives connected: 1 for Time Machine, the other for Dropbox files. When the computer is restarted, the drives don't mount. They are not visible in Disk Utilities. Unplugging the drives and plugging them back in will mount them. I'd like everything to mount and Dropbox to start up automatically for this user, which worked on the old Mac mini she was using. Now she has to go through multiple steps every time she restarts, which is not ideal. Any ideas what might be causing this behavior?
5ca6704cb87efdaae383ef61e5c543cc6e476bc00a1b96819d05d92ef2c2bd03
['69fa75e2a24a462aa141928c38723dcb']
I am a little bit confused about how to calculate the memory capacity. word=data lines size byte=8 bit n=adresse lines size Most of the people use this formula to calculate the capacity of the memory: C=(2^n*word)/8 octet Is this formula correct when speaking about byte-addressable? Because if we have byte-addressable memory, I think the capacity will be 2^n octet. If this is correct why people use the formula in all cases? If not can you please explain why to me? Thanks you.
0cce5c68aeb1c03c2e21313ca798c13b702e847f4f4512d234f6cd0d8dedd582
['69fbe5af8a2e495185a7d0736adabd35']
In a panda dataframe, I have nominal and real valued columns arbitrarily mixed and I want to standardize just the numeric columns. I have this piece of code, which does the job.. but it's using two .tolist() function calls to make it work. I had a hard time understanding indexing and I feel there might be a faster method to this class Standardizer(): def __init__(self, matrix): self.means_ = matrix.mean() self.stds_ = matrix.std() def transform(self, matrix): matrix = matrix.fillna(self.means_) matrix[self.means_.index] = (matrix[self.means_.index] - self.means_.tolist()) / self.stds_.tolist() return matrix
4df79daaef16769442b32e521317ce9cfa67b801cce3da32ab888b638f3e6181
['69fbe5af8a2e495185a7d0736adabd35']
I've come across some interesting browser behavior (Chrome) that I was hoping to get insight into. I have the following structure to my html document (I've been careful about the domain names) // Hosted on http://www.example.com <html> <head> <link href="http://cdn.com/css1.css"> <link href="http://cdn.com/css2.css"> <link href="http://cdn.com/css3.css"> </head> <body> <img src="http://cdn.com/img1.jpg"> <img src="http://cdn.com/img2.jpg"> <script src="http://www.example.com/local-js-1.js" async></script> <script src="http://www.example.com/local-js-2.js" async></script> <script src="http://another-cdn.com/ext-js-1.js" async></script> <script src="http://another-cdn.com/ext-js-2.js" async></script> </body> </html> But Chrome will wait until the CSS files have finished downloading before downloading the local javascript files. It (chrome) does NOT wait when those javascript files are external though. I thought it might be a number-of-resources issue, but I am not downloading ANY files from the root domain other than the index.html document and those two local javascript files. This is true if I don't include the external javascript files or not, or if the external files are included before the local files. Both local and external included together as described in the HTML above : Only Local files : Notice how the two images are requested, if I refresh the page, they will show up in a random order and the fact that they are included first here is happenstance... obviously they are all waiting for the same thing before requesting : I'd prefer the local files to download concurrently with the CSS files (serving them from the same CDN as the CSS files results in the same behavior above... presumably because Chrome only downloads a few resources from the same domain at a time) so that I don't have to pay for the DNS lookup of the additional CDN so my question is "Why doesn't chrome download my locally referenced files at the same time it would download external files?"
96715fd58c6ad9f7b94a5378bb3eb59613e5e37983f93fea2fe5afc3f5ddfbea
['6a0019e5223346b087adffd1fb60e603']
I have a set of binary records packed into a file and I am reading them using Data.ByteString.Lazy and Data.Binary.Get. With my current implementation an 8Mb file takes 6 seconds to parse. import qualified Data.ByteString.Lazy as BL import Data.Binary.Get data Trade = Trade { timestamp <IP_ADDRESS> Int, price <IP_ADDRESS> Int , qty <IP_ADDRESS> Int } deriving (Show) getTrades = do empty <- isEmpty if empty then return [] else do timestamp <- getWord32le price <- getWord32le qty <- getWord16le rest <- getTrades let trade = Trade (fromIntegral timestamp) (fromIntegral price) (fromIntegral qty) return (trade : rest) main <IP_ADDRESS> IO() main = do input <- BL.readFile "trades.bin" let trades = runGet getTrades input print $ length trades What can I do to make this faster?
bbfc4031981f9025df7ef7f70a3086c1796173b05e6e6ec5f91cff7a80bca73b
['6a0019e5223346b087adffd1fb60e603']
I have implemented infinite scroll for a 1.2k item collection. It works great apart from when scrolling past certain elements - an exception is raised when they are rendered and I can't figure out why... Exception from Deps recompute: TypeError: Cannot read property 'nodeName' of null at Patcher.match (http://localhost:3000/packages/spark.js?742c715b73fac26c16ad433118b87045bc5658ff:1539:12) at http://localhost:3000/packages/spark.js?742c715b73fac26c16ad433118b87045bc5658ff:1352:23 at visitNodes (http://localhost:3000/packages/spark.js?742c715b73fac26c16ad433118b87045bc5658ff:1319:11) at visitNodes (http://localhost:3000/packages/spark.js?742c715b73fac26c16ad433118b87045bc5658ff:1320:9) at visitNodes (http://localhost:3000/packages/spark.js?742c715b73fac26c16ad433118b87045bc5658ff:1320:9) at visitNodes (http://localhost:3000/packages/spark.js?742c715b73fac26c16ad433118b87045bc5658ff:1320:9) at patch (http://localhost:3000/packages/spark.js?742c715b73fac26c16ad433118b87045bc5658ff:1333:3) at http://localhost:3000/packages/spark.js?742c715b73fac26c16ad433118b87045bc5658ff:698:7 at LiveRange.operate (http://localhost:3000/packages/liverange.js?710fe06b230e4e9dea26fab955d6a2badb8467cc:490:9) at http://localhost:3000/packages/spark.js?742c715b73fac26c16ad433118b87045bc5658ff:693:11 debug.js:41 Can anyone explain?
0af762c6dbe5f0d017f1b931aa666ee8a4f5b742729406c9f40c261fdd3ca12b
['6a08d2f4692b4c6e996d5b8ec9103a36']
I want to make UL menu Responsive. For PC it should be as UL and for mobile as SELECT, depending on Widnow width it should transform. And I almost did but I have a problem: It works as it should when resizing from Big resolution to Small (<700px) but when window is resized back to Big the Dropdown UL is disappears. Here is JS: function responsive(mainNavigation) { var $ = jQuery; var screenRes = $('.body_wrap').width(); if (screenRes < 700) { /* Replace unordered list with a "select" element to be populated with options, and create a variable to select our new empty option menu */ $('.topmenu').html('<select class="select_topmenu" id="topm-select"></select>'); var selectMenu = $('#topm-select'); /* Navigate our nav clone for information needed to populate options */ $(mainNavigation).children('ul').children('li').each(function () { /* Get top-level link and text */ var href = $(this).children('a').attr('href'); var text = $(this).children('a').text(); /* Append this option to our "select" */ if ($(this).is(".current-menu-item") && href != '#') { $(selectMenu).append('<option value="' + href + '" selected>' + text + '</option>'); } else if (href == '#') { $(selectMenu).append('<option value="' + href + '" disabled="disabled">' + text + '</option>'); } else { $(selectMenu).append('<option value="' + href + '">' + text + '</option>'); } /* Check for "children" and navigate for more options if they exist */ if ($(this).children('ul').length > 0) { $(this).children('ul').children('li').each(function () { /* Get child-level link and text */ var href2 = $(this).children('a').attr('href'); var text2 = $(this).children('a').text(); /* Append this option to our "select" */ if ($(this).is(".current-menu-item") && href2 != '#') { $(selectMenu).append('<option value="'+href2+'" selected> - '+text2+'</option>'); } else if (href2 == '#') { $(selectMenu).append('<option value="'+href2+'" disabled="disabled"># '+text2+'</option>'); } else { $(selectMenu).append('<option value="'+href2+'"> - '+text2+'</option>'); } /* Check for "children" and navigate for more options if they exist */ if ($(this).children('ul').length > 0) { $(this).children('ul').children('li').each(function () { /* Get child-level link and text */ var href3 = $(this).children('a').attr('href'); var text3 = $(this).children('a').text(); /* Append this option to our "select" */ if ($(this).is(".current-menu-item")) { $(selectMenu).append('<option value="' + href3 + '" class="select-current" selected> -- ' + text3 + '</option>'); } else { $(selectMenu).append('<option value="' + href3 + '"> -- ' + text3 + '</option>'); } }); } }); } }); } else { $('#topm-select').css('display', 'none'); } /* When our select menu is changed, change the window location to match the value of the selected option. */ $(selectMenu).change(function () { location = this.options[this.selectedIndex].value; });} jQuery(document).ready(function($) { var screenRes = $('.body_wrap').width(); /* topmenu replace to select */ var mainNavigation = $('.topmenu').clone(); responsive(mainNavigation); /* reload topmenu on Resize */ $(window).resize(function() { var screenRes = $('.body_wrap').width(); responsive(mainNavigation); }); }); And here is DEMO: http://jsfiddle.net/nJ5b5/1/ (to view the result make Result Box bigger/smaller)
4f55c15143456ff0d10782e546030bec6ace1f9df9a27edf98206c0405e202a4
['6a08d2f4692b4c6e996d5b8ec9103a36']
I just started to learn knockout and I'm stuck. I need to load a data from server and show it with DataTables and each cell is binded with knockout. The table should have basic functions: Search, Sorting, Pagination. each item must have a Column with some actions like: Edit, Remove, Link. editing must be made in Modal Window I found a similar example with almost all my needs and changed a little bit: http://jsfiddle.net/bq5f7fcc/11/ This is custom KO binding: ko.bindingHandlers.dataTablesForEach = { page: 0, init: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) { var options = ko.unwrap(valueAccessor()); ko.unwrap(options.data); if(options.dataTableOptions.paging){ valueAccessor().data.subscribe(function (changes) { var table = $(element).closest('table').DataTable(); ko.bindingHandlers.dataTablesForEach.page = table.page(); table.destroy(); }, null, 'arrayChange'); } var nodes = Array.prototype.slice.call(element.childNodes, 0); ko.utils.arrayForEach(nodes, function (node) { if (node && node.nodeType !== 1) { node.parentNode.removeChild(node); } }); return ko.bindingHandlers.foreach.init(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext); }, update: function (element, valueAccessor, allBindings, viewModel, bindingContext) { var options = ko.unwrap(valueAccessor()), key = 'DataTablesForEach_Initialized'; ko.unwrap(options.data); var table; if(!options.dataTableOptions.paging){ table = $(element).closest('table').DataTable(); table.destroy(); } ko.bindingHandlers.foreach.update(element, valueAccessor, allBindings, viewModel, bindingContext); table = $(element).closest('table').DataTable(options.dataTableOptions); if (options.dataTableOptions.paging) { if (table.page.info().pages - ko.bindingHandlers.dataTablesForEach.page == 0) table.page(--ko.bindingHandlers.dataTablesForEach.page).draw(false); else table.page(ko.bindingHandlers.dataTablesForEach.page).draw(false); } if (!ko.utils.domData.get(element, key) && (options.data || options.length)) ko.utils.domData.set(element, key, true); return { controlsDescendantBindings: true }; } }; How can I add SEARCH field from DataTables? P.S. Table will have a large amount of data (3-7k of rows).
90f996d986740dd282563ebcf35eaac9ec5c3b2720a101e48d23cd1fa7446584
['6a0bf2b19d404f74aee8981b860e550e']
I agree with you, with the exception that this makes looking for my 12.04 a longer process. If there were an archive marked so, to handle obsolete systems, or wrong threads, which kept the comments _italic_which are useful intact; would this be possible? I meant to italicize which are useful.
3b693ea77f0ba8fa56298c9ce8a88bcc00796f45e299137ffad21dac3466ad56
['6a0bf2b19d404f74aee8981b860e550e']
May try a clean install of Windows patch it with the upgrade and install ubuntu. I have never been able to install ubuntu on a Windows formatted drive, but I have done it on a jump drive as well, you could add a harddrive to your machine and install Ubuntu there. Your machine would recognize the second drive and this would not entail using grub nor the windows boot mgr.
be21575f3db9b7cfb3203ce36e234b488b638246291224612186de044d7b921c
['6a0fa9eff89d4008b748ae648e639b34']
Foreground: You can set "Foreground text" in you app manifest to dark or light. Background: This follows the "Background color" of the app manifest - and hence will be the same as the app's tile background. For most of the apps I've worked on, it's enough to set the tile color according the UI spec - and then set the 'foreground text' to light or dark. You can surely override the light/dark themes if you want to too.
6b3e5f5376f647270cf60a72a6ca877267bde50d88e0015edc082bda17d9d639
['6a0fa9eff89d4008b748ae648e639b34']
try this for get data from database. DataSet ds = new DataSet("dstblName"); using(SqlConnection conn = new SqlConnection("ConnectionString")) { SqlCommand sqlComm = new SqlCommand("spselect", conn); sqlComm.Parameters.AddWithValue("@parameter1", parameter1value); sqlComm.CommandType = CommandType.StoredProcedure; SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = sqlComm; da.Fill(ds); } Similarly you need to call "spdelte" etc.
eabf75bba123f0981ca31dd2c480c0174efca98b3e5f2d9d4913614ceb828cab
['6a373a0164de4873808adf53d6d9ae9a']
You can create a new post type, under the name "post" and then add a rewrite slug. This will overwrite the default Wordpres post type. Here is a sample code: add_action( 'init', 'my_new_default_post_type', 1 ); function my_new_default_post_type() { register_post_type( 'post', array( 'labels' => array( 'name_admin_bar' => _x( 'Post', 'add new on admin bar' ), ), 'public' => true, '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'map_meta_cap' => true, 'hierarchical' => false, 'rewrite' => array( 'slug' => 'post' ), 'query_var' => false, 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'post-formats' ), ) ); } This is not tested, but you can give it a try. It's better than changing the URL settings on htaccess - because it will apply to all posts and pages.
28a487c61fccc09fcb3728d2bcb815f566818bb65bf465dd98dc3b29a782908c
['6a373a0164de4873808adf53d6d9ae9a']
The statement "you do need permission to take certain photos of some real property in the UK" is not really correct, except in the case that the real property is itself a protected copyright work. The question is not about that scenario - e.g. Durdle Door is a natural formation and very obviously not a copyright work. The reason you need permission to take photographs ON the land is that the landowner has the right to say who can enter the land and for what purposes. You do not need the landowner's permission to take photos OF Durdle Door if you can do so without entering the landowner's land.
da94298f52a1cd737d8b2c1ca361619d66b1598781017cc146c33a48490bddf9
['6a3fc461bc3f444193d7bc2998c0e847']
thanks for the suggestion. now obviously, the survey design has its influence through the variance estimation. so yeah, even in my case it would be probably a bad idea to ignore it. but I'm still not sure what to do if for example I want to employ log-log model (and to aggregate the data as a result), so hopefully somebody will give some other ideas too. thanks again!
65dfcf94913207583e00203e64e0f654536db485db80e44c93c528cdf6ebb200
['6a3fc461bc3f444193d7bc2998c0e847']
Tentei assim, mas não esta vindo o valor correto SELECT id, data, max(valor) FROM teste WHERE data BETWEEN '2017-03-01 00:00:00' AND '2017-04-01 00:00:00' O valor de máximo vem perfeito, mas ele pega o primeiro id dentro dessa data. Como pegar o id referente ao valor do max? Se possível a data também.
3850a81cec1eda6f035edddb76d5eac09009322732dac84fbf760adcd6da4133
['6a4105b41f7e460181e3e7ccff24aa2b']
<PERSON>, this is exactly the response I was looking for. I can't believe I forgot that stray tag! Also, if you could elaborate on a couple of your points that would be great. Particularly: "Just because one input is set does not mean that another is $_POST['submit'] and $_POST['name'] are not magically linked A user could exploit this to cause a notice" And: The $del issue. The script works great even though you say it isn't defined?
9dc018b80ac037d7800a3ff63cdb2cd7139b0e3274b5ed49d819ae0e311eae7a
['6a4105b41f7e460181e3e7ccff24aa2b']
TL;DR No For reference, "Line of Sight" (pg 12) from the Rules of Play: In order for a figure to have line of sight to a space, a player must be able to trace an uninterrupted, straight line from any corner of that figure’s space to any corner of the target space. If the line passes through the edge of a map tile, a door, or a blocked space (a space containing a figure or obstacle), the target space is not in line of sight (see “Line of Sight Example” on page 12). If the line passes along the edge of a blocked space (see “Line of Sight Example” on page 12), the target space is not in line of sight. However, if the line only touches the corner of a blocked space (without passing through the space itself ), the target space is in line of sight. Now let's address the possible lines from the Hero's space: Top left corner Any line from this corner must pass through the Hero's space. The Hero is a figure, so the Hero's space is a blocked space. So all lines are invalid because they pass through a blocked space. Bottom left corner Bottom right corner For both of these corners, any line must pass through or along the Obstacle space. An obstacle space is a blocked space, therefore all lines are invalid. Top right corner Only a single line can pass from this corner through the obstacles. By geometry, that fixed line does continue to the Monster's bottom right corner, but passes through the Monster's space. A monster is a figure, so therefore the Monster's space is a blocked space. Therefore, the line passes through the edge of a blocked space and is invalid. Summary: All possible lines are invalid; the Monster can't be targeted by the Hero.
d1d742e72722bb50ba1110685fd70d04ea58358ff503f4ab64a6c1a1fccbfa75
['6a5188a7d44b499e9e76109b501005cb']
I try to create a simple project. In this project there are some images and their names and when user push on image, image name is played from mp3 source file and pass next image. However when I pass next image, memory usage is increasing up to 300mb fro each next item. When I check where memory leaks occur by helping instruments,i saw that most of memory leak is caused by AVFAudio library - AVAudioSession. Maybe my approach is wrong to play sound. Here my code to play sound: var sound: AVAudioPlayer! func playSound(name: String) { let path = Bundle.main.path(forResource: name, ofType: "mp3") let soundURL = URL(fileURLWithPath: path!) do { try sound = AVAudioPlayer(contentsOf: soundURL) } catch let err as NSError { print(err.debugDescription) } } @IBAction func btnClick(_ sender: UIButton) { playSound(name: "table") sound.play() } Is my "playing sound" way is wrong? Why this memory leak happen? How to solve this problem. Thank you
ad902c3c9692fbf46c20e1eb00e79e0e9d36c0a98f67cf0b2fc444fe09d38dc1
['6a5188a7d44b499e9e76109b501005cb']
I have really weird problem with url routing. I defined 3 routes for menu bar like that routes.MapPageRoute("Article", "Article/{id}/{title}", "~/article.aspx"); routes.MapPageRoute("Contact", "Contact", "~/contact.aspx"); routes.MapPageRoute("Category","Category/{id}/{name}","~/category.aspx"); when i click to contact i get www.website.com/Contact and then i click to an article i get www.website.com/Article/id/title and all links are working. However when i click an article firstly and then click contact, i have www.website.com/Article/id/title/contact, or www.website/category/id/name/contact This problem only occurs when clicking from parameter routes to nonparameter routes. I will be glad if u give any idea. Thank you.
0e6f436022c68b00878bae5aef40eacae422ec4700b0c18cd396844a593ccf72
['6a576a276e7743c2aca5ed106fa9e176']
Let's say I have a table with three columns - id, name, and gender. There might be multiple ids with the same name. There may also be multiple genders for the same name. For all but one name, I'm completely ok with there being both a row for female and a row for male, and even a row for intersex and so on. However, for <PERSON> and only <PERSON>, I cannot allow there to be both a male row and a female row (though intersex, etc is completely ok). If there is both a row for male and row for female with <PERSON>'s name, I'd like to eliminate the male row, leaving only the female row and any other genders that were present. id | name | gender ---+--------+--------- 1 | <PERSON> | male 1 | <PERSON> | female 2 | <PERSON> | female 1 | <PERSON> | male 1 | <PERSON> | female 1 | <PERSON> | intersex 2 | <PERSON> | male 2 | <PERSON> | female 4 | <PERSON> | intersex 1 | <PERSON> | male -- this row must be eliminated... 1 | <PERSON> | female -- beacuse this row is present. 1 | <PERSON> | intersex -- But this one is totally cool. 1 | <PERSON> | porcupine -- So is this one. 2 | <PERSON> | male -- this row must be eliminated... 2 | <PERSON> | female -- beacuse this row is present. 3 | <PERSON> | male -- But this row is totally cool, -- because there's no female <PERSON> row -- with an id of 3. How can I go about removing those rows? I have a sneaking suspicion I'm missing something really obvious...
4742b1ab9b3a286d2a282a6b7957e567727ade9cd616de6fdea21ff155a30db4
['6a576a276e7743c2aca5ed106fa9e176']
I'll go ahead and give you the LOD expression, so that you'll have something that will work regardless of your table layout. { FIXED [salesperson], [date] : SUM([unit price] * [quantity]) / SUM([quantity]) } That will give you a table that looks like this: +------------+----------+-------------+------+-----------------+ | unit price | quantity | salesperson | date | Avg Daily Sales | +------------+----------+-------------+------+-----------------+ | 10 | 5 | A | 1/1 | 22.86 | | 10 | 6 | B | 1/1 | 22.5 | | 30 | 9 | A | 1/1 | 22.86 | | 30 | 10 | B | 1/1 | 22.5 | | 10 | 3 | A | 1/2 | 17 | | 10 | 5 | B | 1/2 | 16.15 | | 20 | 7 | A | 1/2 | 17 | | 20 | 8 | B | 1/2 | 16.15 | +------------+----------+-------------+------+-----------------+ That follows the formula you gave in a comment on <PERSON>'s answer. Here's a quick calculation, just to confirm that it works. On 1/2, Salesman A sold: ( (10 * 3) + (20 * 7) ) / (3 + 7) = (30 + 140) / 10 = 170 / 10 = 17
fb704422c79d5ea917a125381d5c1dce05dbe98a53c05ffb05e2fdee26716931
['6a5ac90f65ea4f8083bb827a0c91ebc9']
It's rather conceptual problem than implementational one, so I suggest you to have a look at wiki Priority queue or heap pages or dive into some really great books, for instance "Introduction to algorithms". When you understand logic behind those data structures (and other algorithms as well) implementing them in any programming language shouldn't be a big deal.
7ac5ae5c60fa099d4e12097dfcc4fdc5fe94af2ce5ba385fb15f45e2b0a8e4e1
['6a5ac90f65ea4f8083bb827a0c91ebc9']
The latest beta (5.9.3.xxx) takes one step forward on Wine - the note previews now change when you click on a note - and one step back: the note editing toolbar (which usually pops up when you click in a note to edit it) doesn't appear, and the title appears, but is not editable. If anyone has suggestion for native libraries to add or anything that might help, then please post! For reference, the last version that works very well under Wine for me is Evernote_5.8.14.8221.exe, which can probably be downloaded somewhere...
4e3897ea75b1d4d5063c87b93fe503448f4fa041ed80890d69518254ee249f4c
['6a8b1be2eea74a07a76e1d0b0baed449']
Given the vector space $S=\{(a,a+b,a+b,-b)':-\infty < a < \infty, -\infty <b<\infty\}$ determine if the following sets of vectors span $S$: $\{(1,1,0,0)',(0,0,1,-1)'\}$ $\{(2,1,1,1)',(3,1,1,2)',(3,2,2,1)'\}$ $\{(1,0,0,0)',(0,1,1,0)',(0,0,0,1)'\}$ I am not looking for the answers, rather the procedure to answer these questions. I have seen similar questions on this forum that ask if the above vectors span some generic vector space $(a,b,c,d)$, and they use Gaussian elimination for the most part. However, I do not know how to solve this problem given an altered vector space. Thank you.
912798fc7af71dc4bd30e07302d31454bc97924015d59ade1d506289702083f8
['6a8b1be2eea74a07a76e1d0b0baed449']
Let ${y_j}_{j=1}^N$ be N given real numbers. Construct a sequence ${a_n}$ so that ${y_j}_{j=1}^N$ is the set of limit points of ${a_n}$, but $a_n \ne y_j$ for any n or j. My work is as follows, but it's probably wrong: Suppose $a_n = \frac{1}{n}$. Zero is the only limit point, but $0 \notin a_n = \frac{1}{n} \forall n.$ Thank you for your help!
a9efcf61e88fa45d698d7974cf43c0d3fed4845baf6d9f142553fa559c8515ce
['6aad1b26ff6d42e8aedff8573fb8242b']
Yes, you should. You will be able to generate your client code, tests and documentation using a set of tools supporting WADL. Some examples can be found here. Also, I think you should stick with WADL, rather than WSDL 2.0 because it is less verbose and way simpler (IMHO). In fact, in WADL you describe exactly what the user sees on the documentation page, just using WADL XML syntax. BTW, that is why it's so easy to write XSLT-based documentation generators for WADL.
6eb9f3c95dbbd0ab3b6f82dd86a299e257e2c82e322c164529d35b5e3f5de690
['6aad1b26ff6d42e8aedff8573fb8242b']
When driving my car, I often ask myself following question: How does the thermometer measure the air temperature that precisely, and is it even precise? I know the basic concepts of a thermometer, but let's say the car is sitting in the sun for the whole day. The outside parts of the car are heated up and the thermal energy eventually spreads to all parts of the car, which, even when hidden in "shadow" under the hood, also includes the thermometer at some point. Doesn't this mean the measurement of air temperature would be incorrect? Another scenario would be going 100mph, in which (at least the front of) the car is eventually cooled down by giving of thermal energy to the headwind, again distorting the measurement. I can imagine the thermometer could be isolated from those effect, but in case of perfect isolation, it would not measure anymore, and in case it's not a perfect isolation, the measured temperature would eventually be distorted at some point. Same goes with isolator/conductor combinations, as the conductors have to take the airs' temperature from somewhere and this location has to have "neutral" and unaltered temperature. However, the car's thermometer always shows pretty reliable values (e.g. 20°C), even when standing in the sun for hours or going really fast or even both. Are the effects I'm describing too miniscule to be visible, is the shown temperature just an approximation or am I missing something completely different? Depending on the answer, this may lead to a more abstract question: Is there even something as a spatial air temperature or is it ultimately relative to the specific circumstances of the measuring device and thus, dependent on the very exact location of latter, making every temperature indication an approximation?
830c62187b64a0d04a23775f6bb5627cafaf0b7bb3835edf98e3b99623d88248
['6ab10ca1cfc54b5ab7dcee258087f8ea']
I came across this probability puzzle: <PERSON> is playing archery blindfolded. The first arrow he shoots unfortunately misses the bull's-eye. The second arrow misses the bull's-eye even further. <PERSON> still shoots a third arrow. How big is the chance that his third shot is also worse than his first shot? Now the given solution is: We have first two marks as [A B] (here, A is left to 'B' means A is closer to Bull's eye than B). So C has following $3$ possibilities to take on, viz.: [A B C] [A C B] [C A B] So, the probability that C is worse than A is $\frac 2 3$ i.e. the cases [A B C] and [A C B]. My doubt here is that this probability of $\frac 2 3$ would be true only when above three possibilities are equally likely. But they don't seem to be equally likely because if we look a bull's eye: Now, farther we move from bull's eye, we have more area to hit on and so probability to perform worse than a shot should be more than the probability to perform better than it, for e.g. Suppose I first hit at the Red region, then to perform better than my first hit I need to hit in Yellow Region and to perform worse than my first hit I need to hit in Black or White or even out of the board and so probability of performing worse is more than that of performing better. So, what is going wrong here? Or there is some other solution?
393fc44a7384e32a5fca2061d614ddaf600a09755fab6ef9f21dbca94b103ff0
['6ab10ca1cfc54b5ab7dcee258087f8ea']
<PERSON>, Introduction to Probability (2019 2 edn), Chapter 2, Exercise 50, p 94. <PERSON> and <PERSON> play a match consisting of a series of games, where <PERSON> has probability $p$ of winning each game (independently). They play with a “win by two” rule: the first player to win two games more than his opponent wins the match. Find the probability that <PERSON> wins the match (in terms of p) , in two different ways: (a) by conditioning, using the law of total probability. Why's my attempt below wrong? What to correct? • Let P(C) be the probability that <PERSON> wins the match. • Let W stands for Winning a game and L stands for losing a game. So, possible ways of Games for winning the match = WW, WLW, LWW. (i) WW $\implies$ <PERSON> wins first two games. (ii) WLW $\implies$ wins first game, loses second game and wins third game. (iii) LWW $\implies$ loses first game and wins next two games. $\begin{align} \implies P(C) & = P(WW) + P(WLW) + P(LWW) \\ & = p*p + p*(1-p)*p + (1-p)*p*p \\ & = p^2(3-2p). \end{align} $ But this is wrong. The right answer is: $P(C) = \frac{p^2}{p^2+q^2}$.
24db1c501b6246c5e5cfc74e540e0978e0cae4423a9fd4446d7fcff6548eb9fb
['6ac5842b796c470d920ca58573409fd2']
I was doubtful whether electron addition will be possible as the electrons in a rydberg atom are already in a highly exited state.As you point out electron addition,is it possible to launch particles into the array,for prof. <PERSON> stated the atoms are held in position with lasers,can one manage to create rydberg state gas independent of lasers?
b749e0efc621398bdbf330f2c8b6c1058fa478ce05e088bbae72d5462636c1dd
['6ac5842b796c470d920ca58573409fd2']
Often when learning about heat transfer within metals and thermal conductors,the heat transfer is explained by saying how molecules vibrate in thier positions to conduct heat. But if that's the case then how is heat observed externally as thermal radiations and how does the transfer actually take place for these radiation from one atom to another.If these radiation can travel in solids why doesn't light. ex. If I placed a bulb within a metal shell why can't I observe visible light outside the metal.
a1d2520b36d474af65e6d6a1054ff6e3ed3f5ede371fb2a3418b3ade51644146
['6acd47f43c15469e8dd8ba211524cc2d']
In config block I am setting templateURL, and I want to append version number that I will get from json file to templateURL. But I am not able to get data from json file within config block. Using grunt to build the project and creating app.js in which I have config block and within this config block, trying to get data from json file.
1704310ce32712a6e5e58ee5375ed26a6e26140d21ce29bc3699827b1e23651e
['6acd47f43c15469e8dd8ba211524cc2d']
I am trying to write a stored procedure to get data and stored procedure is as below - ALTER PROCEDURE SPProfileScholarshipReports @scholarshipGroupCode nvarchar(50), @statuses nvarchar(350), @studentSearch nvarchar(100), @fromDateString nvarchar(50), @toDateString nvarchar(50), @studentTypeFilter nvarchar(50), @offsetFrom INT, @offsetTo INT, @sortColumn nvarchar(50), @sortOrder nvarchar(10), @isExportToExcel BIT AS Begin SET NOCOUNT ON; -- variable declaration declare @Separator varchar(1)= ',' DECLARE @XML XML declare @studentType varchar(20)= null IF(@studentSearch = '') set @studentSearch = null IF(@studentTypeFilter = 'new') set @studentType = 'false' else if(@studentTypeFilter = 'continuing') set @studentType = 'true' else set @studentType = null if(@sortOrder = '' or @sortOrder is null) set @sortOrder = ' DESC ' else if(@sortOrder = 'true') set @sortOrder = 'ASC' else set @sortOrder = 'DESC' -- accept comma separated parameters and convert them to use for in clause condition declare @tPsListViewStatus TABLE (val nvarchar(3600)) IF(@statuses is not null and @statuses<>'' and @statuses like '%,%') BEGIN set @statuses = replace(replace(replace(replace(@statuses,' , ',','),', ',','),' ,',','),' ','') SET @XML = CAST( ('<i>' + REPLACE(@statuses, @Separator, '</i><i>') + '</i>') AS XML) INSERT INTO @tPsListViewStatus select t.i.value('.', 'VARCHAR(2000)') FROM @XML.nodes('i') AS t(i) WHERE t.i.value('.', 'VARCHAR(2000)') <> '' END select * from ( select (nm.LastName+' ' + nm.FirstName) as studentName, pi.value, ps.isContinuing, sc.name as scholarshipName, ps.status, ps.CreatedDate, ps.summary, ps.effectiveDate, ps.expiryDate, sc.id as scholarshipId, (SELECT STUFF((SELECT ',' + t.code FROM Academic_Term t WHERE t.effectiveDate >= ps.effectiveDate and t.expiryDate <= ps.expiryDate and t.active = 'true' and t.code not like '%.%' and t.code not like '%COFA%' and t.code not like '%NUR%' order BY t.code asc FOR XML PATH('')),1,1,'')) as code, (SELECT SUM( convert( decimal( 10, 2 ), AmountAwarded )) as athleticAmount FROM profile_scholarship WHERE (Status IN(select * from @tPsListViewStatus)) and id= ps.id) AS PS_amountAwarded, (SELECT DISTINCT(fs1.code) FROM profile_scholarship_term pst LEFT OUTER JOIN fund_source_academic_term fsat ON pst.FundSourceAcademicTermId=fsat.Id LEFT OUTER JOIN fund_source fs1 ON fsat.FundSourceId=fs1.Id WHERE ps.Id = pst.ProfileScholarshipId) as fundSourceCode, ps.studentProgramId, ps.id as psId, ROW_NUMBER() OVER( PARTITION by ps.scholarshipId, ps.profileId, ps.status ORDER BY ps.EffectiveDate desc, ps.ExpiryDate desc, ps.CreatedDate desc ) AS RowNumber, ps.profileId, ps.FAStudentAcademicYearId from profile_scholarship ps INNER JOIN scholarship sc on ps.ScholarshipId = sc.id INNER JOIN dbo.scholarship_sub_group ssg on sc.ScholarshipSubGroupId = ssg.Id INNER JOIN dbo.scholarship_group sg on ssg.ScholarshipGroupId = sg.Id INNER JOIN name nm on ps.ProfileId = nm.profileId INNER JOIN dbo.profile_identity pi on ps.ProfileId = pi.ProfileId where sg.code = @scholarshipGroupCode and ps.SystemIdentified = 'SIS' and (ps.Status IN(select * from @tPsListViewStatus)) AND((ps.status = 'DELETED' AND ps.summary like '%CVUE_DELETE%') OR (ps.status != 'DELETED')) and pi.type = 'STUDENT_NUMBER' and(ps.isContinuing IN(@studentType) or ISNULL(@studentType,'')= '') and ps.CreatedDate BETWEEN @fromDateString AND @toDateString ) as resultList where resultList.rowNumber = 1 and (ISNULL(@studentSearch,'')= '' or resultList.studentName like '%' + @studentSearch + '%' or resultList.value like '%' + @studentSearch + '%') order by case when @sortOrder <> 'DESC' then '' when @sortColumn = 'modified' then resultList.CreatedDate end DESC, case when @sortOrder <> 'ASC' then '' when @sortColumn = 'modified' then resultList.CreatedDate end ASC, case when @sortColumn = '' then resultList.CreatedDate end DESC OFFSET @offsetFrom ROWS FETCH NEXT @offsetTo ROWS ONLY END In this query I want to remove "OFFSET @offsetFrom ROWS FETCH NEXT @offsetTo ROWS ONLY" if @isExportToExcel is true. the value of @isExportToExcel is being passed from java code. I tried with below CASE statement but it is not working Case when @isExportToExcel = 0 then 'OFFSET @offsetFrom ROWS FETCH NEXT @offsetTo ROWS ONLY' END But this is not working and I am always getting completed data and pagination is not working with this
41cd612c4d298b020124a11970f1e7ab9c61dc97a086fb2663f9ce2c6bbb92a0
['6ad1ef6b5e23450dad4b125de4648670']
I think the key is in the determine_node_label_by_layertype function. This is a block of code that should look something like this (or at least it does in my current version of the repository): def determine_node_label_by_layertype(layer, layertype, rankdir): """Define node label based on layer type """ if rankdir in ('TB', 'BT'): # If graph orientation is vertical, horizontal space is free and # vertical space is not; separate words with spaces separator = ' ' else: # If graph orientation is horizontal, vertical space is free and # horizontal space is not; separate words with newlines separator = '\n' Replace the separater = '\n' with separater = r"\n" and it seemed to work for me.
f1f58de17e98447158541bd85612da6fc9d69e55e95efbd00ebc2b83dbc709d1
['6ad1ef6b5e23450dad4b125de4648670']
Perhaps the following will help ... Split the dataframe based on 'Survived' df_survived=df[df['Survived']==1] df_not_survive=df[df['Survived']==0] Create Bins age_bins=np.linspace(0,80,21) Use np.histogram to generate histogram data survived_hist=np.histogram(df_survived['Age'],bins=age_bins,range=(0,80)) not_survive_hist=np.histogram(df_not_survive['Age'],bins=age_bins,range=(0,80)) Calculate survival rate in each bin surv_rates=survived_hist[0]/(survived_hist[0]+not_survive_hist[0]) Plot plt.bar(age_bins[:-1],surv_rates,width=age_bins[1]-age_bins[0]) plt.xlabel('Age') plt.ylabel('Survival Rate')
04c4c9ee309a7961ae86b2cb34dec670c1708f79f41546c7026e7bb6ba1b3364
['6ad3d7fb34d94432a7453b7a1717237c']
I know how to set Image width and height using pixel coords. Is there a way to set relative coords? I want to deal with multiple screens. For example i have 1920x1080 screen size. And i have relative coords width (-100,100) and height = 200*1080/1920=112.5, height(-56.25, 56.25) Can i use this relative coords to set width and height? and how to do it? Is there any best practices to handle different screens ratio, handle orientation change correctly? thanks in advance. here is how i'm using it in my app: create() public void create() { stage = new Stage(); Gdx.input.setInputProcessor(stage); camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); camera.setToOrtho(true, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); camera.update(); Skin skinBackground = new Skin(); skinBackground.add("background", new Texture(Gdx.files.absolute(FilePathSlicer.preparePath(taskSheet.background.getPicUrl())))); background=new Image(skinBackground,"background"); if(background!=null) { background.setWidth(width); background.setHeight(height); stage.addActor(background); } } render public void render() { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); Gdx.gl.glClearColor(255/255f, 255/255f, 255/255f, 1); stage.getBatch().setProjectionMatrix(camera.combined); stage.act(Gdx.graphics.getDeltaTime()); stage.draw(); }
cba5bcd8eafd6abbb2032c313d661efbb2432188f63997a545608ae2a8479b05
['6ad3d7fb34d94432a7453b7a1717237c']
It worked for me public static HashSet<String> getExternalMounts() { final HashSet<String> out = new HashSet<String>(); String reg = "(?i).*vold.*(vfat|ntfs|exfat|fat32|ext3|ext4).*rw.*"; String s = ""; try { final Process process = new ProcessBuilder().command("mount") .redirectErrorStream(true).start(); process.waitFor(); final InputStream is = process.getInputStream(); final byte[] buffer = new byte[1024]; while (is.read(buffer) != -1) { s = s + new String(buffer); } is.close(); } catch (final Exception e) { e.printStackTrace(); } // parse output final String[] lines = s.split("\n"); for (String line : lines) { if (!line.toLowerCase(Locale.US).contains("asec")) { if (line.matches(reg)) { String[] parts = line.split(" "); for (String part : parts) { if (part.startsWith("/")) if (!part.toLowerCase(Locale.US).contains("vold")) out.add(part); } } } } return out; }
d407bb7cafbd8a8bdb37abcb745cf48af079d560cb58f106c47661a2fdf0a226
['6ad666fac0f640b68e836e00cecc54cc']
I am seeing the same issue and followed the suggestions above with no effect. I am running VS2015 Community edition under VMWare Fusion 8.1 and Windows 10 (Windows Update reports all current patches are applied) The emulator runs fine but the application fails to deploy/run with the same bootstrap error the original poster had. Windows 10 (all configurations) work fine.
8b1071452fe103c8ad09a57563b27c6c169d4f7af277012ff3dc6806c748568b
['6ad666fac0f640b68e836e00cecc54cc']
As has been mentioned, toptracks by itself is undefined, declare it at the start of the render function as const { toptracks } = this.props; then you can use it without referencing this.props.toptracks Secondly the map function takes arguments of the element and the index but you have declared them as toptracks again which creates aliasing issues (at least in my mind) and is also just plain confusing... return toptracks.map((toptracks,k) => should ideally be return toptracks.map((toptrack,k) => - then remember to update the toptracks inside the map callback to toptrack to make it clearer which is the collection and which is the element See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map for more info on the map function. As already pointed out, if toptracks is not an array then you will need to turn it into an array or use .keys for example if it is an object.