_id
stringlengths
2
6
text
stringlengths
4
46k
title
stringclasses
1 value
d14801
You can use "when" and like in the example bellow, the second question will popup only if "Cassandra" is selected: const QUESTIONS = [ { name: 'your-name', type: 'list', message: 'Your name:', choices: ['Batman', 'Superman', 'Ultron', 'Cassandra'], }, { name: 'hello-cassandra', type: 'conf...
d14802
Try this: f=[[1,2,3],[1,2,3],[1,2,3],[1,2,3]] for i in zip(*f): print(i) Output: (1, 1, 1, 1) (2, 2, 2, 2) (3, 3, 3, 3) A: zip() in conjunction with the * operator can be used to unzip a list and it return iterator of tuples. Using map() to apply list on the iterator of tuples that we are getting from zip and ...
d14803
You can try it like this SELECT l.id, l.description, IF(r.type IS NULL, l.type, r.type) AS `Type` FROM newtable as l LEFT JOIN (SELECT * FROM newtable WHERE type <> 'Special') as r on r.id = l.id GROUP BY l.id SQL Fiddle Demo A: This could be a solution: SELECT newtable.id, new...
d14804
Edit the template for showing categories to only list one post per page. By default it shows the x most recent posts; if x is one, it only shows that one most recent post. A: I ended up doing it differently. I found this page: http://codex.wordpress.org/Template_Hierarchy On the page it said this: category-{slug}.php ...
d14805
library(dplyr) df %>% group_by(Group) %>% slice(which.max(Value)) %>% select(-Value) #Source: local data frame [4 x 2] #Groups: Group [4] # Group Year # <fctr> <int> #1 A 1933 #2 B 2011 #3 C 1954 #4 D 1978 Note this only keeps one max value per group if ties exist. A method that keeps ti...
d14806
You are correct about the file handle being closed automatically when its variable goes out of scope; the same will happen to contents, though - it will be destroyed at the end of the function, unless you decide to return it as an owned String. In Rust functions can't return references to objects created inside them, o...
d14807
There are multiple reasons why the C compiler cannot automatically reorder the fields: * *The C compiler doesn't know whether the struct represents the memory structure of objects beyond the current compilation unit (for example: a foreign library, a file on disc, network data, CPU page tables, ...). In such a case ...
d14808
Speed efficient deleting rows My solution takes a long time to execute. I have file with 60k rows, and it can be bigger. Can you help me to make this process faster? Sub kary() Dim table As Variant Dim Wb As Workbook Dim liczba, i As Long Application.ScreenUpdating = False Set Wb = Application.ActiveWorkbook table...
d14809
To solve this task you should to use javafx.concurrent.Task , Example. And simple handle your scroll event, on scroll populate table with additional values.
d14810
Inferring (most general, simple) types for lambda terms is a very simple and highly instructive activity. When you try to decipher a lambda term, starting from guessing its type is a very good approach. The general idea behind type inference is that you start attributing a generic type (a type variable) to any identif...
d14811
Are you trying to get an array of the dates for each row? Then you want an ARRAY subquery: SELECT ARRAY(SELECT date FROM UNNEST(event_dim)) AS dates FROM `table`; If you are trying to get all dates in separate rows, then you want to cross join with the array: SELECT event.date FROM `table` CROSS JOIN UNNEST(event_dim...
d14812
set pointer-events: none in css Ref: https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events The pointer-events CSS property specifies under what circumstances (if any) a particular graphic element can become the target of mouse events. * *Note that while only mouse events are stated, it is in fact val...
d14813
Other ways it can be achieved. For Adding: candidate["skills"] = "javascript"; For Deleting: var skill = "javascript"; delete candidate[skill]; or delete candidate.skills; A: Removing a property of an object can be done by using the delete keyword: candidate.delete("skills"); OR delete candidate["skills"]; To ...
d14814
In the scour download, there is a testscour.py that you could use to see how you can access scour from within the code instead over the cli. When I was finally solving my mostly similar scour problem, I did it like this: from scour import scour import re with open(svg_file, 'r') as f svg = f.read() scour_options...
d14815
As GoZoner explained, you can't use define in an expression context. What could you do instead? Use let: (if (list? code) (let ([x '()]) x) ... Or it would work with an "empty" let and define: (if (list? code) (let () (define x '()) x) ... But that's a bit silly. Or use cond and defi...
d14816
A very common issue is you forget to trim the string. Try this: m.final_states.add(Integer.parseInt(scan.next().trim())); and t = new Translator(Integer.parseInt(scan.next().trim()), Integer.parseInt(scan.next().trim())); A: The good thing about Scanner is that it allows to read primitive types w/o explicit casting...
d14817
In VBA and VB6 you can't initialize variables. You must use an executable statement. However, each variable does have a default initialization value. From the VB6 documentation: When variables are initialized, a numeric variable is initialized to 0, a variable-length string is initialized to a zero-length string ...
d14818
I think the line should be. From the JSON provided which is not complete, I could only find this error! sliderCtrlPtr.GetsliderStyle = function() { if (sliderCtrlPtr.sliderParams != undefined) { var styleObj = sliderCtrlPtr.sliderParams; canvas.color = styleObj["styleMapping"]["1"]["StyleMappingCollecti...
d14819
Try something like this: public void swapPairwiseIteratively() { if(first == null || first.next==null) return; Node one = first, two = first.next, prev = null; first = two; while (one != null && two != null) { // the previous node should point to two if (prev != null) prev.next = two; // node one sh...
d14820
Try this: df_new = df.loc[df['Text'].str.startswith('\n[SPORTS FAN]') | df['Text'].str.startswith('\n[BASEBALL]')] No regex required
d14821
Try to hide all .description except the current element's linked .description, $(function () { $(".trigger").click(function (e) { e.preventDefault(); $(".description").not($(this).toggleClass('open').next('.description').fadeToggle("slow")).fadeOut('fast'); }); }); DEMO A: You need to hide t...
d14822
You can define your own click event handler and stop propagation of the event there. $('your selector').click(function (e) { e.stopPropagation(); }); A: Seems that they haven't given a callback function to call back to. You can modify their JS code to do this - item.click(function() { nav.find("." + conf.acti...
d14823
Google's Android Backup Service seems appropriate for this, and is free.
d14824
It's difficult to understand what you're trying to do and what the problem is because the question looks like a mess, but I'll try to help anyway. Demo: Here's a working example with your data: https://codepen.io/AlekseiHoffman/pen/XWJmpod?editors=1010 Template: <div id="app"> <div v-for="(selection, index) in choice...
d14825
I guess you are using two different properties of DateTime (or simply Date) class: Now and UtcNow. Try to use UtcNow, if you use Now, or vice versa.
d14826
The whole point of Sha256 hashing is that you cannot decrypt it. When doing a login check, you should hash the user entered password and match it with the one you've stored in your datalayer. A: DigestUtils.sha256Hex is not encription it is hash. Main property of hash it is irreversible
d14827
class App extends React.Component { constructor(props) { super(props); this.state = { users: [ { firstName: 'John1', middleName: 'Daniel1', lastName: 'Paul1' }, { firstName: 'John2', middleName: 'Daniel2', lastName: 'Paul2' }, { firstName: 'John3', middleName: 'Daniel3', l...
d14828
My first thought: are you sure you have any lines with a lang property? [EDITED] Also, try decreasing the batch size for each periodic commit. The default is 1000 lines. For example: USING PERIODIC COMMIT 500 to specify a batch size of 500. Also, I see a probable logic error, but it should not be the cause of your main...
d14829
I am not an expert in this area, however, I think that 1.) you need to add a handler to your ajax call to determine if the delete was successful & 2.) you may need to add some sort of success status message from the controller's destroy action. A: The following solved the same problem for me. respond_to do |format| ...
d14830
As mentioned, you need to change the SQL Task to give a Result Set on a 'Single Row', you can then output that result set to a variable. From here you can use the constraints within the Control Flow to execute different tasks based upon what the outcome variable will be; for example:
d14831
You need to be distinct if you are using the Memcache class or the Memcached class. Your cache design is a bit strange. You should be checking the cache to first see if the item is there. If the item is not then store it. Also Memcache has some strange behavior on using the boolen type as the third argument. You shoul...
d14832
You could start by closing your HTML containers, and giving a good example of what you've tried. If you set an explicit width, width: 800px;, that's the width it will be rendered at. Try setting the container's max-width for that and set the width to expand to that The way that I usually do it: .container { max-widt...
d14833
The easy approach is to divide the plane into d-by-d where d > 10 bins and put each point in the bin indexed by floor(x/d), floor(y/d). Then, instead of iterating over all pairs of points, for bin1 in bins: for i in bin1: for bin2 in bins neighboring bin in nine directions (including bin): for j in bi...
d14834
First, I would just assume that all the file-names are supplied on standard input. E.g., if the file names.txt contains the file-names and check.sh is the script, you can invoke it like cat names.txt | ./script.sh to obtain the desired behaviour (i.e., using the file-names from names.txt). Second, inside script.sh you...
d14835
You need to use either the VLOOKUP or HLOOKUP feature when structuring your results table. For instance in cell C3 (color for head/set1) you would type =HLOOKUP(a2,e2:h5,2,FALSE). It will look horizontally in the first row for whatever is in cell A2 (HEAD) and return the value from the 2nd row (RED). Of flip it arou...
d14836
I tried It out by myself and came up with that: Form1.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace StackoverflowHelp { public partial c...
d14837
Welcome to StackOverflow! In the future, you can probably get a good answer faster if you write your question more clearly. You can use document.getElementById('id_of_text_input').value to get or set the value of any text input. Note that you are using id, not name. You can use parseFloat to get a read a string as a ...
d14838
The problem is the order of your arguments. Try to switch -E and -D.
d14839
I believe you have 2 errors: 1 - your select call is limiting the check to a max of fd 2, where the pipe will probably have larger FDs since 0, 1, and 2 are already opened for stdin, stdout, stderr. The pipe FDs will presumably have fds 3 and 4 so you actually need to determine the larger of the 2 pipe FDs and use tha...
d14840
You should not join your array at all. In your example $json_array['stream']['preview']; is the following: array( 'small' => 'http://static-cdn.jtvnw.net/previews-ttv/live_user_adam_ak-80x50.jpg', 'medium' => 'http://static-cdn.jtvnw.net/previews-ttv/live_user_adam_ak-320x200.jpg', 'large' => 'http://static-cdn.j...
d14841
* *$ifNull to check if field is null then return empty array *$in to check "foo" is in overrides.property array *$indexOfArray to get index of array element in overrides.property array *$arrayElemAt to get element by specific index return from above operator let fooOverrideExists = "foo"; db.collection.find({}, { ...
d14842
I have ask Malte Ubl on Twitter. His anwser is: This controls an experiment on the AMP cache. A: According to this Google Analytics forum, the said unusual parameter has been removed. Kindly confirm if this has been reflected on yours as well.
d14843
The LruCache is being instantiated in one class. It won't be accessible from another class. You could try the approach mentioned in this answer https://stackoverflow.com/a/14325075/2931650
d14844
@amehta, no, 8.4 and 9.0 is not your problem. My naive guess is that your configuration is missing: adapter: postgresql The problem is entirely local inside of your Heroku setup. Try manually connecting from Heroku to EC2: require 'postgres' conn = PGconn.connect('amazone-host', 5432, '', '', 'dbname', 'username', 'pa...
d14845
This is not a real code. A real login code should include a lot more, like securing channels, ecryption, etc. As an exercise to try a few concepts it's ok. I see you are expecting to save everything to a file, I suggest you to try with logical structures first. There is always messing with opened files not being able t...
d14846
You need to access the property using square brackets; the way you have it is implying that there's a button that's literally called 'nameOfButton', which is why it's failing. Try the following: private function makeButtonBigger(ev:MouseEvent):void{ var nameOfButton:String = ev.currentTarget.name; this.group_bt...
d14847
This should help. user_choice_port = "23, 80, 44" print map(int, user_choice_port.split(",")) print [int(n) for n in user_choice_port.split(",")]
d14848
If I understand right, you're looking for scroll down steps by steps on li elements just on clicking on the arrow ? If that's it : You could maybe use smooth scroll plugin like ui.kit and trigger a click event in setTimeout or setIntervall which scroll down on every element following an array like myListEl = ['#first'...
d14849
I got the problem!! the issue is the .htaccess file that i am using to force the http into htpps. I don't know why but with it the Svg does not work and without it the SVG works great.
d14850
0 13,19 * * * /usr/bin/php path/myphp.php should work, check your log / user mail for errors. A: Keep in mind that there's a difference in format between a user's crontab (accessed with the command contab -e or what have you) and the system's crontab, managed in files like /etc/cron.d and others. In a user's personal...
d14851
I have had a similar question and I was using signal: import signal def signal_handler(signal_number, frame): print "Proceed ..." signal.signal(signal.SIGINT, signal_handler) signal.pause() So you register a handler for the signal SIGINT and pause waiting for any signal. Now from outside your program (e.g. in ba...
d14852
It seems I didn't need to have 'public' in the src url call for anyone who may experience a similar issue in future. The video tag now looks like so: <video autoPlay loop muted className='w-full h-screen z-10'> <source src='/assets/bubble-video.mp4' type='video/mp4' /> </video> A: adding mut...
d14853
Well, you can extend a JSF component with the regular java extension (extends). You will have to extend a number of classes, depending on the exact component: * *UIComponentName/HtmlComponentName *HtmlComponentNameRenderer *ComponentNameTag and you might need to register the renderer in faces-config.xml. You can t...
d14854
You can either check in every route if the session is loggedIn or not in activate hook of route like this.. if you are setting a variable loggedIn true here is how to do it. App.PostRoute = Ember.Route.extend({ activate: function() { if (!loggedIn){ this.tansitionTo('login'); } } }); If you want to r...
d14855
Now I know Git is very powerful: 1. create a new branch and make change, would not affect other branches. 2. I can create branch with a SHA key (every commit has a unique key) I have made my first the pullrequest, it's feel good.
d14856
The way I would do it is. Create a filter which would basically receive everything sent from the sequencer and send it to your midi out. Inside this filter create a condition where if the "pause flag" is true all note offs would be received but not sent. Create a pause() method which when called first sets your "pause...
d14857
As an alternate approach, you can split string by space and the merge chunks in batch. function splitByWordCount(str, count) { var arr = str.split(' ') var r = []; while (arr.length) { r.push(arr.splice(0, count).join(' ')) } return r; } var a = "This is a test this is a test"; console.log(sp...
d14858
SXSSFWorkbook is for streaming-writing, not reading. Did you try with XSSFWorkbook instead? This will still require quite some memory so might still go OOM with 1024m, depending on the size of the workbook. Another approach is a streamed reading approach, see e.g. https://poi.apache.org/spreadsheet/how-to.html#xssf_sax...
d14859
This technically achieves the result you are asking for. However, I am assuming you want everything to be added together if at least 2 of the lists have numbers within 2 indexes of each other. For example [[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 0, 0, 1]] would result in [1, 1, 0, 0, 1] NOT [[1, 1, 0, 0, 0], [0, 0, 0,...
d14860
Here is a simple Python 2.7 solution I've cooked for you: It depends only on the OleFileIO_PL module which is availble from the project page The good thing with OleFile parser is that it is not aware of the "excel-specific" contents of the file ; it only knows the higher level "OLE storage". So it is quick in analyzing...
d14861
CodeMirror has several Content manipulation methods. You will need to use the setValue method. doc.setValue(content: string) Set the editor content. Please reference the following block of code for my suggestions. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=de...
d14862
CAS does not set a cookie with the user login. It will set a cookie for your SSO session called a Ticket Granting Cookie (TGC). This token does not provide any information on the logged user. To retrieve the identity of the user logged you have to validate a Service Ticket. This ticket is appended to the url of your se...
d14863
Check the server's connection timeout (on the Web Site properties page). A better approach would be to send the request, start the calculation on the server, and serve a page with a Javascript timer that keeps sending requests to itself. Upon post-back, this page checks whether the server process has completed. While t...
d14864
Inside your app module constructor, you can tell what is the default language which you're interested in export class AppModule { constructor(translate: TranslateService) { translate.setDefaultLang('en'); translate.use('en'); } }
d14865
You probably can, but in the current state of the plugin, it looks like you have to define a separate task that extends from the FindBugs one, but has a different configuration than the standard one. The problem is that you will run FindBugs twice indeed, and that can be a performance penalty with any decently-sized co...
d14866
These types of record I/O problems are simplified if you use the Perl idiom of changing the record separator. Now each record becomes a line and lines are easy to count. NOTE: I also removed the last // so we don't count the empty record. Ok... I'm guessing that you may want something like this #! /usr/bin/env perl ...
d14867
you don't need to $apply since everything is inside the angular event loop what you need is not to destroy the reference to your binding by reassigning the product object. when you linked your html product either didn't existed or was pointing to an mem address. when you did $scope.product = productResource.get(); you...
d14868
The warnings were caused by the wicked_pdf gem, updating to version 1.1.0 solved the issue
d14869
There is no need to add path of statically served directory. Just remove '/public/img/' <img class="center" [src]="quizService.rootUrl + quizService.questions[quizService.questionProgress].imageName+'.jpg'"> You can access the all file of your served directory directly. like: http://localhost:5000/shark.jpg A: Follo...
d14870
Finally I found it. So get corresponds to find without any filter. So the code is: Foo.on('attached', function() { Foo.find = function(filter, callback) { //Whatever you need to do here... callback(null, {hello: 'hello'}); } }); Here there is a link for all the PersistedModel methods I just put 'attached' ...
d14871
I expect that the problem is in function context this. May be you can try such that: componentDidMount(){ const setState = this.setState; fetch('https://snaptok.herokuapp.com/fetchPost/'+this.props.postId,{ method: 'GET' }).then(response => { if (response.ok) { return response; ...
d14872
I have Eclipse 4.6 Neon. In Help > Install New software make sure you installed C/C++ Visual C++ Support. Restart Eclipse after installation. I can see Microsoft Visual C++ in Toolchains now.
d14873
io.sockets.send(msg); this worked for me. also make sure you are using the same version of socket.io on both client and server
d14874
I was looking for an IDE. Such as Netbeans.
d14875
You can use Object.values(object.RAW) to get an array of the values inside RAW (assuming RAW is not undefined) Doc: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_objects/Object/values
d14876
Remove the SingleChildScrollView at the top-level of the body and set the scrollPhysics of the GridView to AlwaysScrollableScrollPhysics(). A: Try removing the SingleChildScrollView like this: Column( children: <Widget>[ Card( child: Column( mainAxisSize: MainAxisSize.min, ...
d14877
Actually found the solution after hours of trying. Changing $_GET to $_POST did the trick. if( isset( $_GET['product_' . $term->term_id ] ) && $_GET['product_' . $term->term_id] Changed to: if( isset( $_POST['product_' . $term->term_id ] ) && $_POST['product_' . $term->term_id]
d14878
div { background-color: lightgreen; max-height: 5em; overflow-y: scroll; scrollbar-color: lightgreen lightgreen; } <div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco labo...
d14879
Check these links. These might be useful for your case http://extrimity.in/content/enable-ssl-or-https-ubuntu-1104-apache-2 http://wiki.vpslink.com/Enable_SSL_on_Apache2 http://docs.oracle.com/cd/A95431_01/install/ssl.htm Step by step https://www.digitalocean.com/community/articles/how-to-create-a-ssl-certificate-on-a...
d14880
I've created several tests and all succeeded with SAS URI. I think you should check a few places: * *According to your screen shot. Maybe your SAS key has expired? *The URI configuration. We should concat the connect string and the SAS token. The configuration is as follows: A: First you need to check the pe...
d14881
I would suggest you to normalize your database structure, you could have one table like this: CREATE TABLE bilanci ( id int AUTO_INCREMENT NOT NULL, medicoid int NOT NULL, conguagliodic decimal(10,2), totbilancianno int DEFAULT 0, totpagato decimal(12,2), totdapagare decimal...
d14882
I use the following method: crate VTK of lagrangian data Load data in ParaView Use the "temporalPaticlesToPathlines" filter make sure to have a unique identifier for the particles. I used origId and it is not always unique if you have breakup of particles.
d14883
You better hide the navigationBar inside viewDidAppear method. -(void)viewDidAppear:(BOOL)animated{ [yourNavigationController setNavigationBarHidden:YES animated:YES]; }
d14884
My CSS background wasn't white. Lol. <div style={{ position: "absolute", width: "400px", height: "400px", backgroundColor: "white"}}>
d14885
Have you tired path like this? axios.get(`/api/api/categories/categories.php`) ... A: If you are using create-react-app install http-proxy-middleware as a dev dependency and in your src folder create a file called setupProxy.js (it must be spelt exactly like that). In that file: const proxy = require('http-proxy-mi...
d14886
python 3.10 was released after or-tools 9.1. Next release will contain the 3.10 wheel.
d14887
I fixed the problem by adding the following line before importing the utilities: sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')) from utilities.logging_service import LoggingService from utilities.comparator_utils import Utils I don't know if this is the correct solution, but it did ...
d14888
Dealing with numpy arrays seems to be a major problem for networkx. The function that converts my image skeleton to the graph G however seems to be using numpy arrays. Since I prefer not to alter the imported function, a possible workaround that seemed to mitigate the problem when writing the edgelist to file was to ch...
d14889
1) You should create class to represent json data (http://json2csharp.com/) public class RootObject { public string response { get; set; } public string user_id { get; set; } public string username { get; set; } public string current_balance { get; set; } public string message { get; set; } publ...
d14890
Try adding a 'default' binding (without any name specified). Add the readerQuota settings to this binding. You can then even remove the readerQuota settings from the named binding you are actually using. This worked for me (although I'm not sure why the readerQuotas on the correct named binding are ignored by WCF) A:...
d14891
There is no support for video player plugin on Windows, MacOS or linux as of now. Hopefully flutter team might add this feature by the end of this year.
d14892
Let me try to rephrase the issue: * *You have a model Video *Video has a virtual attribute my_link *Video has a before_update callback before_add_to_galerie *You want this callback to trigger when only my_link was changed does this look correct? If so you have 2 options, first - if you have updated_at change it...
d14893
if you are using eclipse then right click on project2>properties>java build path>projects> add project 1.
d14894
No, you cannot have a key that dynamically changes. Your best bet is to build the object at the time you need it: var obj = {}; obj[$scope.value] = 25; ... A: If you want to use a variable as a property name, then you must create an object first, then assign the data using square bracket notation. var data = { ...
d14895
It appears that you have different installations of PHPUnit mixed up. For instance, you may have used Composer to install PHPUnit and have configured the autoloader generated by Composer as PHPUnit's bootstrap script but then you invoke PHPUnit using an executable other than vendor/bin/phpunit.
d14896
You can use S3 VirusScan, which is a third-party open source tool. Some of its features are: * *Uses ClamAV to scan newly added files on S3 buckets *Updates ClamAV database every 3 hours automatically *Scales EC2 instance workers to distribute workload *Publishes a message to SNS in case of a finding *Can optiona...
d14897
For your example class, and using a bag for an unordered collection: using Map = NHibernate.Mapping.Attributes; [Map.Class( 0, Table = "country", NameType=typeof(Country) )] public class Country { [Map.Id( 1, Name = "Id" )] [Map.Generator( 2, Class = "identity" )] public virtual int Id { get; set; } [M...
d14898
Assuming string structure is constant. You can try this, but it depends on structure. data = YOUR_STRING_FROM_QUESTION # This is the delimeter, which will help us to split query on parts prefix = '& IF (\n' # define list of allowed tables allowed_tables = ['Table1[Column_1]', 'Table2[Column_4]', 'Table6[Column_22]'] ...
d14899
You probably should review this entry: How To: Create custom layouts. More or less, you can set it via ApplicationController: class ApplicationController < ActionController::Base layout :layout_by_resource protected def layout_by_resource if devise_controller? "layout_name_for_devise" else "...
d14900
It seems like the event trigger is within another event's function is causing the crash. In any case, the solution is to remove the listener, then add it back after modifying the other cell. You do need to global the Listener and the Cell objects to make this work. This code is simplified to work on C3 and C15 on the f...