_id
stringlengths
2
6
partition
stringclasses
3 values
text
stringlengths
4
46k
language
stringclasses
1 value
title
stringclasses
1 value
d3401
train
Sorry what do you mean by the scheduled "build"? * *Do you want the Multi-Branch to check for more branches on your given interval? If so you can only do it by "Scan Multibranch Pipeline with defaults Triggers" *Do you want to issue a build on the branch when there is change on it? Noted that the option in the mult-branch folder > "Scan Multibranch Pipeline with defaults Now" and get all current branches > status > the jobs > View Configuration is read only. So, to alter the option, from https://issues.jenkins-ci.org/browse/JENKINS-33900?focusedCommentId=326181&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-326181 , I think you should use the Jenkinsfile to do theSCM for every job. So, for all jobs you need to configure for SCM poll, include a Jenkinsfile on Git for each of them (Don't forget to install the pipeline-model-definition plugin and all its dependent plugins): pipeline { triggers { pollSCM('H 0-15/3 * * H(1-5)') } agent any stages{ stage('Build') { steps { echo 'Building.. or whatever' } } } } That should do the job, at least it works for me`` Hope it helps
unknown
d3402
train
connection.setDoInput(true); forces POST request. Make it connection.setDoInput(false); A: The issue that I ran into with the OP's code is that opening the output stream...: OutputStream os = connection.getOutputStream(); ...implicitly changes the connection from a "GET" (which I initially set on the connection via setProperties) to a "POST", thus giving the 405 error on the end point. If you want to have a flexible httpConnection method, that supports both GET and POST operations, then only open the output stream on non-GET http calls. A: Well according to me into the GET method parameters are to be send as the part of the URL so try this. String request = "http://example.com/index.php?param1=a&param2=b&param3=c"; URL url = new URL(request); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoOutput(true); connection.setDoInput(true); connection.setInstanceFollowRedirects(false); connection.setRequestMethod("GET"); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); connection.setRequestProperty("charset", "utf-8"); connection.setUseCaches (false); BufferedReader in = new BufferedReader( new InputStreamReader(connection.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); //print result System.out.println(response.toString()); try it.
unknown
d3403
train
I wouldn't use for-each at all. The following stylesheet solves your problem in a more idiomatic way: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <!-- the number of items to include in each group --> <xsl:variable name="group" select="3" /> <xsl:template match="/"> <xsl:apply-templates select="contact/person[position() mod $group = 1]" /> </xsl:template> <xsl:template match="person"> <div class="group"> <xsl:apply-templates select=".|following-sibling::person[position() &lt; $group]" mode="inner" /> </div> </xsl:template> <xsl:template match="person" mode="inner"> <div class="info"> <xsl:apply-templates /> </div> </xsl:template> <xsl:template match="name"> <h2><xsl:apply-templates /></h2> </xsl:template> <xsl:template match="phone"> <h3><xsl:apply-templates /></h3> </xsl:template> <xsl:template match="address"> <p><xsl:apply-templates /></p> </xsl:template> </xsl:stylesheet> We select every third person (starting with the first one) and apply a special template (using modes) to that element and its next two siblings. A: If someone could please correct my errors please? I don't know if I can correct your errors, because I don't really understand where you're going with your stylesheet. You seem to have the right idea that a processing template is required here, but I lost you after that. Try the following approach: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/> <xsl:template match="/"> <root> <xsl:call-template name="divide"> <xsl:with-param name="items" select="contact/person"/> </xsl:call-template> </root> </xsl:template> <xsl:template name="divide"> <xsl:param name="items" /> <xsl:param name="groupSize" select="3"/> <xsl:param name="i" select="1"/> <xsl:choose> <xsl:when test="$i > count($items)"/> <xsl:otherwise> <div class="group"> <xsl:for-each select="$items[$i &lt;= position() and position() &lt; $i+$groupSize]"> <div class="info"> <h2><xsl:value-of select="name"/></h2> <h3><xsl:value-of select="phone"/></h3> <p><xsl:value-of select="address"/></p> </div> </xsl:for-each> </div> <xsl:call-template name="divide"> <xsl:with-param name="items" select="$items"/> <xsl:with-param name="i" select="$i+$groupSize"/> </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet> Note that I have added a <root> element to the output which is missing from your required output. While I am at it, your input is also invalid: the <person> tags are not closed.
unknown
d3404
train
The following will extract alt_tbl.sql from the file abc.txt: with open('abc.txt') as f_input: text = f_input.read() file_name = text.split(' ', 2)[1] print file_name A: With a csv reader will be more apt with a check for quotes using csv sniffer to check for multiple delimiters import csv scndval=None li=[] scndval=None with open('abc.txt', 'rb') as csvfile: dialect = csv.Sniffer().sniff(csvfile.read(1024), delimiters=" \t") csvfile.seek(0) csvreader = csv.reader(csvfile, dialect,quotechar='"') for row in csvreader: li+=row if (li)>1: scndval = li[1] break print scndval I/P : hello "how are you" ? O/P : how are you
unknown
d3405
train
Like this: SELECT col, rn, (rn - 1) / 10 AS trunc FROM (SELECT col, row_number() over (order by col) as rn FROM data ) t WHERE mod(rn,10)=0 or mod(rn,10)=1 ORDER BY (rn - 1) / 10 DESC ; Result: +------+----+-------+ | col | rn | trunc | +------+----+-------+ | 11 | 11 | 1 | | 20 | 20 | 1 | | 1 | 1 | 0 | | 10 | 10 | 0 | +------+----+-------+ Working Example
unknown
d3406
train
When using "attr" just pass the variable as a plain string instead of wrapping it with template literals. Using children is not possible there i guess.
unknown
d3407
train
You can, of course, create a project on mounted network drive via File/Open, but note that this is not officially supported. All IDE functionality is based on the index of the project files which PHPStorm builds when the project is loaded and updates on the fly as you edit your code. To provide efficient coding assistance, PHPStorm needs to re-index code fast, which requires fast access to project files and caches storage. The latter can be ensured only for local files, that is, files that are stored on you hard disk and are accessible through the file system. Sure, mounts are typically in the fast network, but one day some hiccup happen and a user sends a stacktrace and all we see in it is blocking I/O call. So, the suggested approach is downloading files to your local drive and use deployment configuiration to synchronize local files with remote. See https://confluence.jetbrains.com/display/PhpStorm/Sync+changes+and+automatic+upload+to+a+deployment+server+in+PhpStorm
unknown
d3408
train
Try this below xpath. Explanation: User value attribute of input tag. driver.findElement(By.xpath("//input[@value='Log In']")).click(); For click on Lock and Edit button use this code. driver.findElement(By.xpath("//input[@value='Lock & Edit']")).click();
unknown
d3409
train
First, incredibly slow is of course dependant on the compute power you are throwing at your problem, the exact models you tried, and of course the type of data the models are processing. So, as a small disclaimer, if the compute and the data are causing a bottleneck now, smaller and simpler models may still perform slow in your case. That being said, here you can see a list of all the embeddings that are supported within flair. Note that "classic" WordEmbeddings are also part of the models that you can choose from. In your case, you could choose any of the embeddings presented on that page, for instance the FastText embeddings for English, and then use the produced representations in a downstream NER task. Within flair, you could check out the SequenceTagger. Here is a great page to see how this is implemented in HuggingFace, with a training example.
unknown
d3410
train
I was facing the same problem when I was trying to use the MailGun to send e-mails using REST API. The solution is to use HTTP instead of http. ionic 2 provides the class [HTTP]: http://ionicframework.com/docs/v2/native/http/ . In your projects root folder, run this command from the terminal: ionic plugin add cordova-plugin-http In your .ts file: import { HTTP } from 'ionic-native'; Then, wherever you want to send the HTTP post/get using Basic Authentication, use this: HTTP.useBasicAuth(username, password) //replace username and password with your basic auth credentials Finally, send the HTTP post using this method: HTTP.post(url, parameters, headers) Hope this helps! Good luck! A: Solved. Explicitly setting the BaseURL constant (PRE_LIVE_BASE) to http://localhost:8100/api resolves the issue. Now all requests are passed via the proxy alias and subvert the CORS issue. The only downside of this approach, is that I had to change a variable that was part of a package in node_modules, which will be overwritten during any future updates. So I should probably create my own fork for a cleaner solution. A: For Development purposes where the calling url is http://localhost, the browsers disallow cross-origin requests, but when you build the app and run it in mobile, it will start working. For the sake of development, 1. Install CORS plugin/Extension in chrome browser which will help get over the CORS issue. 2. If the provider is giving a JSONP interface instead of a normal get/post, You will be able to get over the CORS issue. I prefer using the 1st option as not a lot of api's provide a jsonP interface. For Deployment, You need not worry as building a app & running it in your mobile, you will not face the same issue.
unknown
d3411
train
The steps to enable WNS for your UWP app have changed, but the documentation has not yet been updated. To enable WNS: * *Register for a developer account at developer.microsoft.com *Create a new app - you can do this through Visual Studio by right clicking your UWP app > Store > Associate app with store *In Microsoft Developer Center, select your app and go to App Management > WNS/MPNS. Follow the link to Live Services Site *Here you can find your app secret and Package SID required to enable WNS
unknown
d3412
train
This is C code : #include <stdio.h> int main() { FILE *fp; int i = 0; fp = fopen("configFile.conf", "r"); if(fp == NULL) // To check for errors { printf("Error \n"); } char a[20][20]; // Declared a 2D array char b[20][20]; char c[20][20]; while (fscanf(fp, "%s\t%s\t%s", a[i], b[i], c[i]) != EOF) //fscanf returns EOF if end of file (or an input error) occurs { printf("%s %s %s\n", a[i], b[i], c[i]); i++; } return 0; } C++ code is : #include <iostream> using namespace std; int main() { FILE *fp; int i = 0; fp = fopen("configFile.conf", "r"); if(fp == NULL) // To check for errors { cout<< "Error" << endl; } char a[20][20]; // Declared a 2D array char b[20][20]; char c[20][20]; while (fscanf(fp, "%s\t%s\t%s", a[i], b[i], c[i]) != EOF) //fscanf returns EOF if end of file (or an input error) occurs { cout << a[i] << " " << b[i] << " " << c[i] << endl; i++; } return 0; }
unknown
d3413
train
I'm guessing that your customers and suppliers have some things in common (username and password, logging in to your site, etc), but they are just able to access different controllers/views/features etc. If you were to create two Devise models, it seems like you'd be creating a bunch of repetition. This seems like a great fit for role-based authorization. There's a nice description of role-based authorization in the cancan docs: even if you're not using cancan, their docs give some nice examples that could be a starting point for a larger conversation.
unknown
d3414
train
The problem is this line of the stack trace: Caused by: java.lang.ClassNotFoundException: sample.view.Dashboard This means that the FXML loader could not find a class named Dashboard in package sample.view. The FXML loader looked for this class because that is what was written in file Dashboard.fxml, namely: <AnchorPane prefHeight="800.0" prefWidth="1400.0" xmlns="http://javafx.com/javafx/15.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sample.view.Dashboard"> Notice the part at the end of the line: fx:controller="sample.view.Dashboard" If you don't need a controller class then simply remove that part.
unknown
d3415
train
import pandas as pd def calculate_break_level(row): if row.Qty >= row.BuyQty3: return row.BuyQty3Cost elif row.Qty >= row.BuyQty2: return row.BuyQty2Cost else: return row.BuyQty1Cost # apply the function row-by-row by specifying axis=1 # the newly produced Line_Cost is in the last column. df['Line_Cost'] = df.apply(calculate_break_level, axis=1) Out[58]: ProductName Qty LineCost BuyQty1 BuyQty1Cost BuyQty2 BuyQty2Cost BuyQty3 BuyQty3Cost Line_Cost 0 SIGN2WH 48 40.63 5 43.64 48 40.63 72 39.11 40.63 1 SIGN2BK 144 39.11 5 43.64 48 40.63 72 39.11 39.11
unknown
d3416
train
I would think that you could get an answer by reading the solution to this question: internal string encoding . By utilizing Reponse.Codepage you can affect how posted variables are interpreted. And as I understand you can then switch back to wichever encoding you like. [Update] Because you are using an iframe it is the browser that handles the encoding when sending the request back to the server. And the browser (as I understand) sends the data in the same encoding as the originating page. So if page A that contains the iframe has the charset=Korean I believe that data is sent using Korean encoding. Is the charset defined in the html tag on page A? If not, add it and then try to use the same in page B. <meta charset="utf-8"> Also, as "테스트" is a string literal that is affected of the FILE-encoding, make sure to save the asp-file in the appropiate encoding.
unknown
d3417
train
I'd get the unique values in id1 and id2 and do a join using data.table's cross join function CJ as follows: # if you've already set the key: ans <- f[CJ(id1, id2, unique=TRUE)][is.na(v), v := 0L][] # or, if f is not keyed: ans <- f[CJ(id1 = id1, id2 = id2, unique=TRUE), on=.(id1, id2)][is.na(v), v := 0L][] ans A: f[, { tab = table(id2) x = as.numeric(tab) x[x != 0] = v list(id2 = names(tab), v = x) }, by = id1] ## id1 id2 v ## 1: 1 a 1 ## 2: 1 b 0 ## 3: 1 c 4 ## 4: 1 d 0 ## 5: 2 a 2 ## 6: 2 b 5 ## 7: 2 c 0 ## 8: 2 d 0 ## 9: 3 a 0 ## 10: 3 b 3 ## 11: 3 c 0 ## 12: 3 d 6
unknown
d3418
train
The problem is that you are querying whether or not an object matches a subdocument, and this can be tricky. What you want to do use a combination of $elemMatch and $ne in your query. var query = { _id: 'pickable_qty', 'locks': { $elemMatch: { merchant_warehouse_id: { $ne: 11.1 }, product_item_id: { $ne: 5334 } } }, 'definition.unique_keys': { '$all': [ 'merchant_warehouse_id', 'product_item_id' ] } } It's basically a query for a document inside of an array. A: After using MongoDB's query profiler, I figured out that Mongoose was switching the order of the keys in the lock's unique_values object while doing the update query. Then it was inserting the duplicate subdocuments with the keys in the correct order. So apparently MongoDB's $ne operator will match nested subdocument arrays only if the keys in the subdocument are in the same order as your query.
unknown
d3419
train
Figured out a solution... Environment: Ubuntu Server 14.04 Build and install OpenFST: mkdir openfst cd openfst wget http://www.openfst.org/twiki/pub/FST/FstDownload/openfst-1.5.0.tar.gz tar zxf openfst-1.5.0.tar.gz cd openfst-1.5.0 ./configure make sudo make install The Magic: sudo CFLAGS="-std=c++0x" pip install pyfst Hope this helps. A: i also came across the problem,but i solved it easily! https://github.com/UFAL-DSG/pyfst You should install OpenFst first,then to install fst!For more details,look at the link above.
unknown
d3420
train
maybe you can try browserify which allow you to use some npm modules in browser. A: Converting my comment into an answer... The natural module says it's for running in the node.js environment. Unless it has a specific version that runs in a browser, you won't be able to run this in the browser. A: have you install that module with global mode and have defined that in package.json? Otherwise, try this: npm install -g natural
unknown
d3421
train
If I'm not mistaken about your question, you basically ask the following: You have an XML file, which is updated, on some event from user. The page, which is displayed to the user is based on this XML file. What info will users see, when multiple users are working with the application? This greatly depends on how you are using that file. In general, if you try to write that file to disk each time, users will see the last update. Basically update from the last user. However, you can synchronize access to this file, write the file on per-user basis and you will see a per-user output: <data> <selectedData user="user name">123</selectedData> <!-- and so on --> </data> UPDATE: For anonymous users this would not work well. However, if you need to store the selection only for the current user, you can use SessionState and not an XML file. A: I would like to introduce a new way that it helped me to answer my above question. What i did here is on Page load we added all the information related to each section in different hidden fields. suppose i have three section with my custom drop down! What exactly we implemented is that on click on my custom drop-down, we separated the values from the hidden field with the separator we entered and displayed the data accordingly, small part of logic but it helped in displaying the data without post back. and Jquery helps a lot to me for just changing the inner html of my block.
unknown
d3422
train
@Tsyvarev this. I needed to change the COMPONENTS as "python27". This behavior definitely changed over the time. I don't remember having to do this at boost release >= 1.65 <= 1.67. Thanks.
unknown
d3423
train
Maybe like this? It's a lot of style inline, but seem to get the job done... https://codesandbox.io/s/bosky-active-forked-bcbd35?file=/src/Components/Footer.js
unknown
d3424
train
Copy your google-service.json file to root folder (that contains www, config.xml etc). Step 1: Login to your firebase console. Step 2: On Project Overview Settings, Copy the Cloud Messaging ServerKey My key ex: `AAAAjXzVMKY:APA91bED4d53RX.....bla bla Step 3: Replace the key define( "API_ACCESS_KEY", "My key"); Finally Test the app :D I sent push notification using node succesfully. var gcm = require('node-gcm'); // Replace these with your own values. var apiKey = "MY_SERVER_KEY"; var deviceID = "MY_DEVICE_ID"; var service = new gcm.Sender(apiKey); var message = new gcm.Message(); message.addData('title', 'Hi'); message.addData('body', 'BLA BLA BLA BLA'); message.addData('actions', [ { "icon": "accept", "title": "Accept", "callback": "app.accept"}, { "icon": "reject", "title": "Reject", "callback": "app.reject"}, ]); service.send(message, { registrationTokens: [ deviceID ] }, function (err, response) { if(err) console.error(err); else console.log(response); }); A: The documentation for this error states: A registration token is tied to a certain group of senders. When a client app registers for FCM, it must specify which senders are allowed to send messages. You should use one of those sender IDs when sending messages to the client app. If you switch to a different sender, the existing registration tokens won't work. You should double check that you are using the Server Key from the same project used to generate the google-services.json file the app was built with. The project_number at the top of the google-services.json file must be the same as the Sender ID shown in the project settings Cloud Messaging tab of the Firebase Console.
unknown
d3425
train
You need to use HomeAddress = new Person.Address{ City = "SoKa" , Country = "Look" } instead of HomeAddress = { City = "SoKa" , Country = "Look" }
unknown
d3426
train
I think GridBagLayout is the best to achieve this design. Here is a full working example for you that will look like this: JFrame frame = new JFrame(); JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints gc = new GridBagConstraints(); gc.gridx=0; gc.gridy=0; gc.fill = GridBagConstraints.HORIZONTAL; gc.weightx = 1.0; gc.gridwidth = 2; JLabel title = new JLabel("TITLE"); title.setBackground(Color.RED); title.setOpaque(true); title.setHorizontalAlignment(SwingConstants.CENTER); panel.add(title, gc); gc.gridx=0; gc.gridy=1; gc.weightx = 0.5; gc.gridwidth = 1; JLabel col1 = new JLabel("COLUMN 1 TITLE"); col1.setBackground(Color.YELLOW); col1.setOpaque(true); col1.setHorizontalAlignment(SwingConstants.CENTER); panel.add(col1, gc); gc.gridx=1; gc.gridy=1; JLabel col2 = new JLabel("COLUMN 2 TITLE"); col2.setBackground(Color.GREEN); col2.setOpaque(true); col2.setHorizontalAlignment(SwingConstants.CENTER); panel.add(col2, gc); gc.fill = GridBagConstraints.BOTH; gc.gridx=0; gc.gridy=2; gc.weighty = 1.0; gc.gridwidth = 1; JLabel info1 = new JLabel("Info 1 Text"); info1.setBackground(Color.CYAN); info1.setOpaque(true); info1.setHorizontalAlignment(SwingConstants.CENTER); panel.add(info1, gc); gc.gridx=1; gc.gridy=2; JLabel info2 = new JLabel("Info 2 Text"); info2.setBackground(Color.MAGENTA); info2.setOpaque(true); info2.setHorizontalAlignment(SwingConstants.CENTER); panel.add(info2, gc); frame.add(panel); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true);
unknown
d3427
train
The problem here is that the "gotElement" message is emitted before the listener is attached. You can fix it with: setTimeout(_ => self.port.emit("gotElement", document.location.href)); Afaict you don't need the contentScript, just do what you wanted to do in the onAttach handler.
unknown
d3428
train
Just remove the .dat prefix in filter: {dat.product_name : textname}. <div ng-repeat="dat in details | filter: {product_name : textname}"> <hr/> <p style="color:#4C97C8;" class="lead"><strong>{{dat.product_name}}</strong></p> <ul> <li><b>Product:</b><span> {{dat.product_name}}</span></li> <li><b>Product Manager:</b><span> {{dat.first_name}}{{dat.last_name}}</span></li> <li><b>Product Line:</b><span> {{dat.productline_name}}</span></li> </ul> </div>
unknown
d3429
train
try this: rvm get head rvm pkg remove rvm reinstall 1.9.2-p320 --with-opt-dir=$(brew --prefix imagemagick)
unknown
d3430
train
This is theoretical and I don't have code to add, but you could create an identical button and add it for UIControlStateTouched so there's no change when the button/image is touched.
unknown
d3431
train
To get the desired output, your regex should be: ((.*?)\.(.*)) DEMO See the captured groups at right bottom of the DEMO site. Explanation: ( group and capture to \1: ( group and capture to \2: .*? any character except \n (0 or more times) ? after * makes the regex engine to does a non-greedy match(shortest possible match). ) end of \2 \. '.' ( group and capture to \3: .* any character except \n (0 or more times) ) end of \3 ) end of \1 A: Here is a visualization of this regex (.*)\.(.*) Debuggex Demo in words * *(.*) matches anything als large as possible and references it *\. matches one period, no reference (no brackets) *(.*) matches anything again, may be empty, and references it in your case this is * *(.*) : South.6987556.Input.csv *\. : . *(.*) : cop it isn't just only South and 6987556.Input.csv.cop because the first part (.*) isn't optional but greedy and must be followed by a period, so the engine tries to match the largest possible string. Your intended result would be created by this regex: (.*?)\.(.*). The ? after a quantifier (in this case *) switches the behaviour of the engine to ungreedy, so the smallest matching string will be searched. By default most regex engines are greedy.
unknown
d3432
train
First, you did seem to leave out the web method directive on your general function. And your ajax call should thus include the web method. eg: [WebMethod] Public static function toggleSetting(setting, ctrl) { But a ajax call means your code behind will run just fine, but you can't update any control attributes because the web page has not been posted/sent to the server. So the web page and controls remains sitting on users desktop. You can call your server code, but it can't modify controls since the whole web page has not been sent up to the server (it is still sitting in the browser). Your current code setup thus needs a post back of the page. Or at the VERY least the part of the page with the controls you are setting. This suggest you might as well use a update panel, and your button code is not ajax or JS anymore. So, you could place regular asp button that posts back the pack. And update panel means a partial post back - so both the button and table have to be inside of that up-date panel for this to work. That means the page and a post back occurs, but ONLY what is inside the update panel goes up to the server. The other way? Don't call the server. Do this client side as js, and then you don't need or have to call server side code. And thus you not need any post back (full or partial with a update panel). So, I would consider writing the function in js, and not call the code behind (server side). However, I unfortunately find js somewhat hard to work with, but 100% client side code would be best. Eventually, if you going to run any code behind after a hide/show of the given control (client side), then eventually if ANY code is to run server side and set or work with those controls, then a post-back will be required. And your ajax post needs to include the web method in the url eg: $.ajax({ type: "POST", url: "AccInfo.ashx/toggleSetting", data: {setting: "some value", ctrl: "some value"} note VERY VERY careful in above how in the above json string the names are to be the SAME as the parameters you have for the server side function. But, without a post back? The settings will occur server side, but any post back from the client side will send up the whole web page in its current state, and the changed values of the controls server side will be over-written. So best to think that you have a copy of the web page sitting client side, and then one sitting server side. Changes on the server side copy of the web page will get over written by any post back. And changes server side will NOT appear until such time that the server side copy of the web page is sent back down to the client. You have: Client side web page. Change things, controls etc. client side. post-back. The web page is sent to server. Code behind runs (maybe update web page), and then the WHOLE page is sent back down to the browser. So, you can't run server side code that updates controls unless te web page is sent up to the server. If you break this rule, then you have changes being made client side and server side - but the two pages are out of sync now. Change the style attributes 100% client side. So in js, you can do the same as your c# server side code with something like this: function ShowUpload() { var JUpload = document.getElementById('<%=UploadFiles.ClientID%>') JUpload.style.display = "inline"; return false; } With jquery, then you can go: function mysetter(ctrl, setting, value) { $('#' + ctrl).css(setting, value); } And thus now set any style setting, say like: mysetter('Button1', 'display', 'none'); And, because hide and show is oh so very common? You can use this: $('#MyControl').hide(); or $('#MyControl').hide(); Note that hide() and show() actually sets the style display to "none" or "normal". So, I would would not do a ajax call to set/hide the controls UNLESS you using a full asp.net button and a full postback. Or put the buttons/controls and the asp.net button inside of a update panel, and you also not get a full page post back. Given that you just hiding and showing a button or control? I think this can with relative ease be handled with 100% client side browser code.
unknown
d3433
train
The react router structure usually follows 1 Switch 1 Router and multiple Routes <Router> <Switch> <Route exact path="/"> <HomePage /> </Route> <Route path="/YOUR_PATH"> <BlogPost /> </Route> </Switch> </Router>, You are returning multiple Router in RouteWithSubRoutes change that to Route function RouteWithSubRoutes(route) { return ( <Route path={route.path} exact={route.exact} render={props => <route.component {...props} routes={route.routes} />} /> ); }
unknown
d3434
train
You can get a list of all running or active apps and then check if the App you want to start is in it. ActivityManager activityManager = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE); List<RunningAppProcessInfo> runningProcInfo = activityManager.getRunningAppProcesses(); for(int i = 0; i < runningProcInfo.size(); i++){ if(runningProcInfo.get(i).processName.equals("package.of.app.to.launch")) { Log.i(TAG, "XXXX is running"); } else { // RUN THE CODE TO START THE ACTIVITY } } A: You can use ActivityManager to get Currently running Applications and to get recent task executed on Device as: ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); List<RunningTaskInfo> recentTasks = activityManager.getRunningTasks(Integer.MAX_VALUE); for (int i = 0; i < recentTasks.size(); i++) { // Here you can put your logic for executing new task } A: If you want to know whether an app is running or not, you should have a look at getRunningTasks Also this post might help you. A: you can get that which activity is running List< ActivityManager.RunningTaskInfo > taskInfo = am.getRunningTasks(1); String currentActivity=taskInfo.get(0).topActivity.getPackageName(); then check if(currentActivity!=(your activity)) { **your intent** } else{ "app already running" } hope it helps. thank you
unknown
d3435
train
I have tried cleaning your data manipulation process by preparing the data before plotting. library(dplyr) library(plotly) library(ggplot2) p1 <- data_a %>% filter(grepl('\\d+', datainput)) %>% mutate(datainput = as.numeric(datainput), row = as.numeric(`...1`), verification = ifelse(verification == 'Yes', 'verified', 'Non-Verified')) %>% ggplot(aes(row, datainput, color = verification)) + scale_colour_manual(name = 'Verification', values = c("green", "red")) + geom_point(size=1.5, alpha = 0.4)+ geom_text(aes(label= ifelse(datainput > quantile(datainput, 0.975,na.rm = TRUE), indexlist,"")), vjust = -2, hjust = "inward", size = 2, color = "grey50") + theme_minimal()+ labs(title = "datainput Details", x = "", y = "")+ theme( axis.text.x = element_text(size = 5.5), axis.text.y = element_text(size = 5.5), plot.title = element_text(color = "grey40", size = 9, face = "bold")) plotly::ggplotly(p1) A: Try to keep data cleaning/preparation separate from plotting, see cleaned data and plot, now the ggplot and plotly look the same: library(tidyverse) library(plotly) # prepare the data plotData <- data_a %>% select(indexlist, datainput, verification) %>% # remove non-numeric rows before converting filter(!grepl("^[^0-9.]+$", datainput)) %>% # prepare data for plotting mutate(datainput = as.numeric(datainput), x = seq(n()), Verification = factor(ifelse(verification == "Yes", "Verified", "Non-Verified"), levels = c("Verified", "Non-Verified")), label = ifelse(datainput > quantile(datainput, 0.975, na.rm = TRUE), indexlist, "")) # then plot with clean data p <- ggplot(plotData, aes(x = x, y = datainput, color = Verification, label = label)) + scale_colour_manual(values = c("green", "red"))+ geom_point(size = 1.5, alpha = 0.4) + geom_text(vjust = "inward", hjust = "inward", size = 2, color = "grey50") + theme_minimal() + labs(title = "datainput Details", x = "", y = "") + theme(axis.text.x = element_text(size = 5.5), axis.text.y = element_text(size = 5.5), plot.title = element_text(color = "grey40", size = 9, face = "bold")) # now plotly ggplotly(p) ggplot plotly
unknown
d3436
train
I think I found something really close to what I wanted with this library: SRML: "String Resource Markup Language"
unknown
d3437
train
Try to set one more cURL option. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); Also try to use curl_multi_exec. A: Use file_get_contents($url) example with User Agent <?php // Create a stream $opts = array( 'http'=>array( 'method'=>"GET", 'header'=>"Accept-language: en\r\n" . "Cookie: foo=bar\r\n" ) ); $context = stream_context_create($opts); // Open the file using the HTTP headers set above $file = file_get_contents('http://www.example.com/', false, $context); ?>
unknown
d3438
train
You cannot use .find() with multiple tag names in it stacked like this. You need to repeatedly call .find() to get desired result. Check out docs for more information. Below code will give you desired output: soup.find('div').find('span').get_text() A: r = requests.get(url) soup = bs(r.content, 'html.parser') desc = soup.find('div').find('span') print(desc.getText()) A: Your selector is wrong. >>> from bs4 import BeautifulSoup >>> data = '''\ ... <div> ... <div>Description</div> ... <span> ... <div><span>example text</span></div> ... </span> ... </div>''' >>> soup = BeautifulSoup(data, 'html.parser') >>> desc = soup.select_one('div span div span') >>> desc.text 'example text' >>> A: Check this out - soup = BeautifulSoup('''<div> <div>Description</div> <span> <div><span>example text</span></div> </span> </div>''',"html.parser") text = soup.span.get_text() print(text)
unknown
d3439
train
You need to put the \ at the end of each line, not before the &&. Make sure there is no whitespace after the \. A: As long as the && is the last non-whitespace token on the line, the command will automatically continue onto the next line. if [ "$PASSWDCHECK" = "<title>401 Authorization Required</title>" ] then echo "The Subsubscription password is wrong" ; exit else mkdir /home/"$USERNAME"/src && mkdir /opt/logstash && mkdir /etc/snort && mkdir /etc/snort/rules/ fi A && list joins two commands, so the parser knows that a newline before the second command should be discarded. A: if [ "$PASSWDCHECK" = "<title>401 Authorization Required</title>" ] then echo "The Subsubscription password is wrong" ; exit else mkdir /home/"$USERNAME"/src && \ mkdir /opt/logstash && \ mkdir /etc/snort && \ mkdir /etc/snort/rules/ fi
unknown
d3440
train
Dont mix onclick attributes with event handlers, its messy and can cause errors (such as mistaking the scope of this, which i believe is you main issue here). If you are using jquery make use of it: First add a class to the links you want to attach the event to, here i use the class showme: <a href="#;" data-id="1" class="btn btn-primary btn-single btn-sm showme">Show Me</a> Then attach to the click event on those links: <script type="text/javascript"> jQuery(function($){ $('a.showme').click(function(ev){ ev.preventDefault(); var uid = $(this).data('id'); $.get('test-modal.php?id=' + uid, function(html){ $('#modal-7 .modal-body').html(html); $('#modal-7').modal('show', {backdrop: 'static'}); }); }); }); </script> To access the variable in php: $uid = $_GET['id']; //NOT $_GET['uid'] as you mention in a comment A: Try the load method instead. I'm taking a guess here, but it seems like you want to actually load the contents of the page found at test-modal.php. If that's correct, replace your ajax call as follows: function showAjaxModal() { var uid = $(this).data('id'); var url = "test-modal.php?id=" + uid; jQuery('#modal-7').modal('show', {backdrop: 'static'}); jQuery('#modal-7 .modal-body').load(url); } If your test-modal.php page contains more than a fragment (e.g., it has html and body tags), you can target just a portion of the page by passing an id of the containing element for the content that you want to load, such as: jQuery('#modal-7 .modal-body').load(url+' #container'); which would only load the contents of the element with the id container from your test-modal.php page into the modal-body.
unknown
d3441
train
Linuxrc (/linuxrc, also common name /init) on desktop OSes is on initramfs(ramdisk). Usualy this in script that probed modules, creates temporary device nodes in /dev, waits and mount rootfs, switches to real root. If initramfs is not used it may by symlinked to init. Systemd uses udev to create /dev/ tree so it non needed. Desktop linux uses it in initramfs to mount root. If rootfs mounted directly it can run from footfs. Example /init extracted from router. #!/bin/sh # # crucial mountpoints mount -t proc none /proc mount -t sysfs none /sys mount -n tmpfs /var -t tmpfs -o size=17825792 mount -t tmpfs dev /dev mknod /dev/console c 5 1 mknod /dev/ttyS0 c 4 64 mknod /dev/ttyS1 c 4 65 # setup console, consider using ptmx? CIN=/dev/console COUT=/dev/console exec <$CIN &>$COUT mknod /dev/null c 1 3 mknod /dev/gpio c 127 0 mknod /dev/zero c 1 5 mknod /dev/tty c 5 0 mknod /dev/tty0 c 4 0 mknod /dev/tty1 c 4 1 mknod /dev/random c 1 8 mknod /dev/urandom c 1 9 mknod /dev/ptmx c 5 2 mknod /dev/mem c 1 1 mknod /dev/watchdog c 10 130 mknod /dev/mtdblock0 b 31 0 mknod /dev/mtdblock1 b 31 1 mknod /dev/mtdblock2 b 31 2 mknod /dev/mtdblock3 b 31 3 mknod /dev/mtdblock4 b 31 4 mknod /dev/mtdblock5 b 31 5 mknod /dev/mtdblock6 b 31 6 mknod /dev/mtdblock7 b 31 7 mknod /dev/mtd0 c 90 0 mknod /dev/mtd1 c 90 2 mknod /dev/mtd2 c 90 4 mknod /dev/mtd3 c 90 6 mknod /dev/mtd4 c 90 8 mknod /dev/mtd5 c 90 10 mknod /dev/mtd6 c 90 12 mknod /dev/mtd7 c 90 14 mknod /dev/ttyUSB0 c 188 0 mknod /dev/ttyUSB1 c 188 1 mknod /dev/ttyUSB2 c 188 2 mknod /dev/ttyUSB3 c 188 3 mknod /dev/ttyUSB4 c 188 4 mknod /dev/ttyUSB5 c 188 5 mknod /dev/ttyUSB6 c 188 6 mknod /dev/ppp c 108 0 mknod /dev/i2c-0 c 89 0 mknod /dev/i2c-1 c 89 1 mknod /dev/i2c-2 c 89 2 mknod /dev/i2c-3 c 89 3 # # Create the ubnt-poll-host char dev entries # The major number is 189 # # NOTE: wifiN's minor number = N # mknod /dev/uph_wifi0 c 189 0 mkdir /dev/pts /dev/shm # rest of the mounts mount none /dev/pts -t devpts if [ -e /proc/bus/usb ]; then mount none /proc/bus/usb -t usbfs fi echo "...mounts done" mkdir -p /var/run /var/tmp /var/log /var/etc /var/etc/persistent /var/lock echo "...filesystem init done" # insert hal module [ ! -f /lib/modules/*/ubnthal.ko ] || insmod /lib/modules/*/ubnthal.ko # making sure that critical files are in place mkdir -p /etc/rc.d /etc/init.d # forced update for f in inittab rc.d/rc.sysinit rc.d/rc rc.d/rc.stop ppp; do cp -f -r /usr/etc/$f /etc/$f done echo "...base ok" mkdir -p /etc/udhcpc # do not update if exist for f in passwd group login.defs profile hosts host.conf \ fstab udhcpc/udhcpc startup.list; do if [ -e /etc/$f ]; then echo -n '.' else cp -f /usr/etc/$f /etc/$f fi done echo "...update ok" mkdir -p /etc/sysinit # make symlinks if do not exist for f in services protocols shells mime.types ethertypes modules.d; do if [ -e /etc/$f ]; then echo -n '.' else ln -s /usr/etc/$f /etc/$f fi done echo "...symlinks ok" mkdir -p /etc/httpd # check if we have uploaded certificates for f in server.crt server.key; do if [ -e /etc/persistent/https/$f ]; then ln -s /etc/persistent/https/$f /etc/httpd/$f else ln -s /usr/etc/$f /etc/httpd/$f fi done echo "...httpd ok" CFG_SYSTEM="/tmp/system.cfg" CFG_RUNNING="/tmp/running.cfg" CFG_DEFAULT="/etc/default.cfg" #Starting watchdog manager /bin/watchdog -t 1 /dev/watchdog # board data symlinks + default config if [ -e /sbin/ubntconf ]; then /sbin/ubntconf -i $CFG_DEFAULT echo "ubntconf returned $?" >> /tmp/ubntconf.log echo "...detect ok" fi # System configuration mkdir -p /etc/sysinit/ /sbin/cfgmtd -r -p /etc/ -f $CFG_RUNNING if [ $? -ne 0 ]; then /sbin/cfgmtd -r -p /etc/ -t 2 -f $CFG_RUNNING if [ $? -ne 0 ]; then cp $CFG_DEFAULT $CFG_RUNNING fi fi sort $CFG_RUNNING | tr -d "\r" > $CFG_SYSTEM cp $CFG_SYSTEM $CFG_RUNNING # But for DFS testing, it's useful to be able to overide this if [ -f /etc/persistent/enable_printk ]; then echo 9 > /proc/sys/kernel/printk dmesg -c else # Do not clutter serial port, normally echo 1 > /proc/sys/kernel/printk fi; # Set device date to firmware build date BDATE=201509091722 if [ ! -z $BDATE ]; then date -s $BDATE >/dev/null 2>&1 fi # Run configuration parser if [ -e /sbin/ubntconf ]; then /sbin/ubntconf echo "ubntconf returned $?" >> /tmp/ubntconf.log fi echo "...running /sbin/init" exec /sbin/init echo "INTERNAL ERROR!!! Cannot run /sbin/init."
unknown
d3442
train
your missing the the units of the value try: .langs { background-color: #90A090; position:absolute; right:4px; /* right:0; is ok but right:4; will fail */ top:4px; } But you are expected to set position relative to the parent, for better results xD form#form2 { position: relative; }
unknown
d3443
train
The manual of rename does not match your expectations. I see no regex capability. SYNOPSIS rename [options] expression replacement file... DESCRIPTION rename will rename the specified files by replacing the first occur‐ rence of expression in their name by replacement. OPTIONS -v, --verbose Give visual feedback which files where renamed, if any. -V, --version Display version information and exit. -s, --symlink Peform rename on symlink target -h, --help Display help text and exit. EXAMPLES Given the files foo1, ..., foo9, foo10, ..., foo278, the commands rename foo foo0 foo? rename foo foo0 foo?? will turn them into foo001, ..., foo009, foo010, ..., foo278. And rename .htm .html *.htm will fix the extension of your html files. for what you want to reach the easy way is: for i in fort*; do mv ${i} ${i}_v1 ; done A: I have found a workaround. I replaced the util-linux rename to perl rename a separate package. This was provided from @subogero from GitHub. All the usual rename expressions is working.
unknown
d3444
train
try { stuff() } catch( NullPointerException e ) { // Do nothing... go on } catch( FileNotFoundException e ) { // Do nothing... go on } catch( Exception e ) { // Now.. handle it! } A: You can do this as @daniel suggested, but I have some additional thoughts. * *You never want to 'do nothing'. At least log the fact that there was an exception. *catching NullPointerExceptions can be dangerous. They can come from anywhere, not just the code where you expect the exception from. If you catch and proceed, you might get unintended results if you don't tightly control the code between the try/catch block. A: multiple catch block to caught exception arised in try block <code> try{<br/> // Code that may exception arise.<br/> }catch(<exception-class1> <parameter1>){<br/> //User code<br/> }catch(<exception-class2> <parameter2>){<br/> //User code<br/> }catch(<exception-class3> <parameter3>){<br/> //User code<br/> } </code> Source : Tutorial Data - Exception handling
unknown
d3445
train
In the unwarn command db.delete(`warn.${Wuser.id}`) Instead of this add to the db db.add(`warn.${Wuser.id}`, -1); or subtract from the value db.subtract(`warn.${Wuser.id}`, 1);
unknown
d3446
train
If you're using jQuery to intercept the click event like so... $(this).click(callback) you need to get creative because .hasClass('active') doesn't report the correct value. In the callback function put the following: $(this).toggleClass('checked') $(this).hasClass('checked') A: you can see what classes the button has.. $(this).hasClass('disabled') // for disabled states $(this).hasClass('active') // for active states $(this).is(':disabled') // for disabled buttons only the is(':disabled') works for buttons, but not the link btns
unknown
d3447
train
For sum += n-- the following operations are performed * *add n to sum *decrement n With sum += --n * *n is decremented *the new value of n is added to sum n-- is called postdecrement, and --n is called predecrement A: That has to do with post- and predecrement operations. Predecrement operations first decrease the value and then are used in other operations while postdecrement ones first get used in operations (addition in the case) and decrement the value only after this. All in all, the order will be as follows: * *sum is incremented by n *n is decremented A: A very simple example I would like to demostrate. Let us consider two variables a=1 and b=4 the statement a=b will assign the value of b to a, In the statement a=b++ , first the value of b is assigned to a and then the value of b is incremented. If the value of awas 1 and value of b was 4, then after using a=b++, the value of a will become 4 and the value of b will become 5. The statement a=b++can be visualised as a=b; then b=b+1; Similarly, in your case, you have sum+=n-- which can be broken down as sum=sum+(n--) or sum=sum+n then n=n-1 Here again, first the value of sum+n will be assigned to sum, then the value of n will be decremented by 1
unknown
d3448
train
Sometimes this kind of issues are caused by another credential configuration. Environment variables credential configuration takes prority over credentials config file. So in case there are present the environment variables "AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY" or "AWS_SESSION_TOKEN" these could generate issues if it were missconfigured or have been expired. Try checking the env vars associated to AWS Credentials and removing them using the 'unset' command in linux. Additionally, to remove env vars permanently you need to remove the lines related on configuration files like: * */etc/environment */etc/profile *~/.profile *~/.bashrc Reference: Configuration settings and precedence A: I had my default region disabled by default (eu-south-1), so I had to enable it via the Web console at first, then it worked.
unknown
d3449
train
You can pass the number (bill/transaction) this.router.navigate(['/edit-transaction-portal'], { queryParams: { bill: 'U001' } }); this.router.navigate(['/edit-transaction-portal'], { queryParams: { transaction: 'U001' } }); then in your component(edit-transaction-portal) hit the api to get the data. In component you should include ActivatedRoute in constructor. It will be something like: isBill: boolean; isTransaction: boolean; number: string; constructor(private route: ActivatedRoute) {} ngOnInit() { this.sub = this.route .queryParams .subscribe(params => { this.isBill = params['bill'] != undefined; this.isTransaction = params['transaction'] != undefined; this.number = this.isBill ? params['bill'] : params['transaction']; // Call API here }); } A: My question is, how can I past the data, particularly the number the user entered on the material dialog component to another component You can pass it throw material dialog component. Inject dialogRef to you component which opened in the dialog: constructor( public dialogRef: MatDialogRef<SomeComponent>, @Inject(MAT_DIALOG_DATA) public data: any, ) { } After the submitting data, you can pass any data to component which opened this dialog, by closing the dialog: onSubmit() { this.service.postProduct(this.contract, this.product) .subscribe(resp => { this.dialogRef.close(resp); }); } And in your Parent component, who opened this dialog can get this passed data by subscribing to afterClosed() observable: Parent.component.ts: openDialog(id) { const dialogRef = this.dialog.open(SomeComponent, { data: { id: anyData} }); dialogRef.afterClosed().subscribe(result => { if (result) { // do something... } }); } Would I pass the data object in dialog.open()? How would I retrieve it from there? Look at openDialog() above. It has data property, that you can send to dialog components. And in the opened component inject MAT_DIALOG_DATA as this: @Inject(MAT_DIALOG_DATA) public data: any, to access passed data object as shown code above Official docs[sharing-data-with-the-dialog-component] A: if you want to pass data which the help of routing you have to define route which takes value as part of rout like as below const appRoutes: Routes = [ { path: 'hero/:id', component: HeroDetailComponent },]; it will from code side gotoHeroes(hero: Hero) { let heroId = hero ? hero.id : null; // Pass along the hero id if available // so that the HeroList component can select that hero. // Include a junk 'foo' property for fun. this.router.navigate(['/heroes', { id: heroId, foo: 'foo' }]); } Read : https://angular.io/guide/router#router-imports If you want to pass data between two component then there is @Input and @Output property concept in angular which allows you to pass data between components. @Input() - this type of property allows you to pass data from parent to child component. Output() - this type of property allows you to pass data from child to parent component. Other way to do it is make use of Service as use the same instance of service between component. Read : 3 ways to communicate between Angular components
unknown
d3450
train
Swap the colors and the order of the panel.histograms calls. That is, plot the gray histogram first.
unknown
d3451
train
So in JSON format, a key has to be a string. Just that ruby allows you to have pretty much anything as a key of the hash, doesn't mean it will be compatible with the JSON standard. I will suggest you to change the format of your data so you can produce something like this: # It is JSON, not ruby { "ops_headers": [ # each of your OpsHeader instances { "pb_id": 133204, "pbbname": "AMARR INC", "pb_net_rev": 2425.9, "ops_driver1": 61, "ops_stop_id": 268970, "dh_first_name": "MARK", "dh_last_name": "STAYTON", "ops_stop_recs": [ # contains array of their OpsStopRec instances { "ops_stop_id": 268973, "ops_order_id": "133204.0", "ops_type": "P", "ops_driver1": 61, "opl_amount": "2375.9" }, { "ops_stop_id": 268973, "ops_order_id": "133204.0", "ops_type": "P", "ops_driver1": 61, "opl_amount": "2375.9" } ] } ] }
unknown
d3452
train
There a at least two separate problems here. The first is the inclusion of the automatically generated <sectionGroup name="dotNetOpenAuth" type="DotNetOpenAuth.Configuration.DotNetOpenAuthSection, DotNetOpenAuth.Core"> <section name="messaging" type="DotNetOpenAuth.Configuration.MessagingElement, DotNetOpenAuth.Core" requirePermission="false" allowLocation="true" /> <section name="reporting" type="DotNetOpenAuth.Configuration.ReportingElement, DotNetOpenAuth.Core" requirePermission="false" allowLocation="true" /> <section name="openid" type="DotNetOpenAuth.Configuration.OpenIdElement, DotNetOpenAuth.OpenId" requirePermission="false" allowLocation="true" /> <section name="oauth" type="DotNetOpenAuth.Configuration.OAuthElement, DotNetOpenAuth.OAuth" requirePermission="false" allowLocation="true" /> </sectionGroup> Apparently in the earlier versions of MVC this code was necessary. However, it is currently redundant and worse, in conflict with the an identical block contained in "machine.config" found in the 4.5 .NET framework, By carefully removing these blocks, in an editor outside VS2013 at least what I'm using, the this problem will be resolved. I say an external editor because some catch 22 in VS 2103 prevents the editing , AND SAVING, of this block from the config.web sections in the Solution. I use Notepad++ The second problem may have to do with locating the references to System.Web.WebPages.Razor in your entire solution, If the version number in the not 3.0.0.0, i.e. 2.0.0.0 then update it and make sure nuget has loaded 3.0.0.0 The entire dotNetOpenAuth package has self induced problems with earlier versions of MVC solutions. I am trying to use examples from the book ASP.NET Web API Security. It contains brilliant code but huge problems are encountered when attempting to run the Solutions that include dotNetOpenAuth code. The problems all have to do with MVC levels and dotNetOpenAuth, not the examples themselves.
unknown
d3453
train
I found a solution. Call element.select(); before changing the value.
unknown
d3454
train
I found an answer here and modified it a bit to make it more usable. Here is my code that works on gnome. You might have to adjust the escaped windows names for other gdms. import Xlib.display #Find out if fullscreen app is running screen = Xlib.display.Display().screen() root_win = screen.root def is_fullscreen(): #cycle through all windows for window in root_win.query_tree()._data['children']: width = window.get_geometry()._data["width"] height = window.get_geometry()._data["height"] #if window is full screen, check it the window name if width == screen.width_in_pixels and height == screen.height_in_pixels: if window.get_wm_name() in ['Media viewer', 'mutter guard window']: continue #return true if window name is not one of the gnome windows return True #if we reach this, no fs window is open return False
unknown
d3455
train
Just apply that isnan on a row by row basis In [135]: [row[~np.isnan(row)] for row in arr] Out[135]: [array([1., 2., 3.]), array([4., 5.]), array([6.])] Boolean masking as in x[~numpy.isnan(x)] produces a flattened result because, in general, the result will be ragged like this, and can't be formed into a 2d array. The source array must be float dtype - because np.nan is a float: In [138]: arr = np.array([[1,2,3,np.nan],[4,5,np.nan,np.nan],[6,np.nan,np.nan,np.nan]]) In [139]: arr Out[139]: array([[ 1., 2., 3., nan], [ 4., 5., nan, nan], [ 6., nan, nan, nan]]) If object dtype, the numbers can be integer, but np.isnan(arr) won't work. If the original is a list, rather than an array: In [146]: alist = [[1,2,3,np.nan],[4,5,np.nan,np.nan],[6,np.nan,np.nan,np.nan]] In [147]: alist Out[147]: [[1, 2, 3, nan], [4, 5, nan, nan], [6, nan, nan, nan]] In [148]: [[i for i in row if ~np.isnan(i)] for row in alist] Out[148]: [[1, 2, 3], [4, 5], [6]] The flat array could be turned into a list of arrays with split: In [152]: np.split(arr[~np.isnan(arr)],(3,5)) Out[152]: [array([1., 2., 3.]), array([4., 5.]), array([6.])] where the (3,5) split parameter could be determined by counting the non-nan in each row, but that's more work and doesn't promise to be faster than than the row iteration.
unknown
d3456
train
I think that you are missing things. One thing is to call CRIS (and watch out I think that you are using an outdated SDK, take a look at the new one and also to the docs), and another thing is to call LUIS, which is another SDK (this one). Once you get the output of CRIS, you can just call the LUIS SDK to send the query text.
unknown
d3457
train
The 46 in this line: nColors = (int)getImageInfo(bmpInput, 46, 4); ...refers to the bit offset into the header of the BMP. Unless you are creating BMPs that do not use this file structure it should theoretically work. He is referring to 8-bit images on that page. Perhaps, 16 or 32-bit images use a different file structure for the header. Read this Wikipedia page for more info: https://en.wikipedia.org/wiki/BMP_file_format#File_structure
unknown
d3458
train
You can access it with grid.store._dirtyObjects
unknown
d3459
train
http://php.net/manual/en/function.html-entity-decode.php $str = "this 'quote' is &lt;b&gt;bold&lt;/b&gt;" html_entity_decode($output) // output This 'quote' is <b>bold</b> http://php.net/manual/en/function.htmlentities.php $str = "This 'quote' is <b>bold</b>"; htmlentities($output); // output this 'quote' is &lt;b&gt;bold&lt;/b&gt;
unknown
d3460
train
The name of your variables requires good descriptive skills and a shared cultural background. In this case you should use row and col but don't forget the scope of your variables. I would like recommend you read the Book: Clean Code. Especially you can review some of the proposed rules on this post (http://www.itiseezee.com/?p=83). A: looping over a table or grid, row and column are perfectly fine variable names. for more generic nested loops i, j, and k (in that order) are typical counter variables even though they are less aptly named
unknown
d3461
train
SELECT a[2] AS FirstName, a[1] AS LastName, a[3] AS ID FROM ( SELECT regexp_matches(column_name, '(.+), (.+) \((.+)\)') FROM table_name ) t(a)
unknown
d3462
train
The trick with using AudioRecord is that each device may have different initialization settings, so you will have to create a method that loops over all possible combinations of bit rates, encoding, etc. private static int[] mSampleRates = new int[] { 8000, 11025, 22050, 44100 }; public AudioRecord findAudioRecord() { for (int rate : mSampleRates) { for (short audioFormat : new short[] { AudioFormat.ENCODING_PCM_8BIT, AudioFormat.ENCODING_PCM_16BIT }) { for (short channelConfig : new short[] { AudioFormat.CHANNEL_IN_MONO, AudioFormat.CHANNEL_IN_STEREO }) { try { Log.d(C.TAG, "Attempting rate " + rate + "Hz, bits: " + audioFormat + ", channel: " + channelConfig); int bufferSize = AudioRecord.getMinBufferSize(rate, channelConfig, audioFormat); if (bufferSize != AudioRecord.ERROR_BAD_VALUE) { // check if we can instantiate and have a success AudioRecord recorder = new AudioRecord(AudioSource.DEFAULT, rate, channelConfig, audioFormat, bufferSize); if (recorder.getState() == AudioRecord.STATE_INITIALIZED) return recorder; } } catch (Exception e) { Log.e(C.TAG, rate + "Exception, keep trying.",e); } } } } return null; } AudioRecord recorder = findAudioRecord(); recorder.release(); A: I had the same issue, it was solved by putting <uses-permission android:name="android.permission.RECORD_AUDIO"></uses-permission> into the manifest. Since Lollipop, you also need to specifically ask the user for each permission. As they may have revoked them. Make sure the permission is granted. A: Problem with initializing few AudioRecord objects could by fixed by using audioRecord.release(); before creating next object... More here: Android AudioRecord - Won't Initialize 2nd time A: Now, with lollipop, you need to specifically ask the user for each permission. Make sure the permission is granted. A: Even after doing all of the above steps I was getting the same issue, what worked for me was that my os was marshmallow and I had to ask for permissions. A: Just had the same problem. The solution was to restart the device. While playing with the code I did not release the AudioRecord Object which obviously caused the audio device to stuck. To test whether the audio device worked or not I downloaded Audalyzer from Google Play. A: If your mobile phone system is Android M or above,perhaps you need to apply record audio permission in Android M.http://developer.android.com/guide/topics/security/permissions.html A: in my case I had to manually allow the permission in android 7 for microphone, as sean zhu commented. A: According to the javadocs, all devices are guaranteed to support this format (for recording): 44100, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT. Change to CHANNEL_OUT_MONO for playback. A: I noticed that when the SDCard on the avd I am running gets full the AudioRecord constructor returns null. Have you tried clearing the SDCard? A: I think this has to do with the thread not knowing that you've paused the main activity and still trying to record after you've stopped the recorder. I solved it by changing my onResume() and onPause() methods to modify the isRecording boolean. public void onResume() { ... isRecording = true; } public void onPause() { ... isRecording = false; } Then in your thread, surround both your startRecording() and stop() with if-statements checking for isRecording: if(isRecording) recorder.startRecording(); ... if(isRecording) recorder.stop(); // which you've done A: I rewrote the answer from @DustinB for anyone who is using Xamarin Android AudioRecord with C#. int[] sampleRates = new int[] { 44100, 22050, 11025, 8000 }; Encoding[] encodings = new Encoding[] { Encoding.Pcm8bit, Encoding.Pcm16bit }; ChannelIn[] channelConfigs = new ChannelIn[]{ ChannelIn.Mono, ChannelIn.Stereo }; //Not all of the formats are supported on each device foreach (int sampleRate in sampleRates) { foreach (Encoding encoding in encodings) { foreach (ChannelIn channelConfig in channelConfigs) { try { Console.WriteLine("Attempting rate " + sampleRate + "Hz, bits: " + encoding + ", channel: " + channelConfig); int bufferSize = AudioRecord.GetMinBufferSize(sampleRate, channelConfig, encoding); if (bufferSize > 0) { // check if we can instantiate and have a success AudioRecord recorder = new AudioRecord(AudioSource.Mic, sampleRate, channelConfig, encoding, bufferSize); if (recorder.State == State.Initialized) { mBufferSize = bufferSize; mSampleRate = sampleRate; mChannelConfig = channelConfig; mEncoding = encoding; recorder.Release(); recorder = null; return true; } } } catch (Exception ex) { Console.WriteLine(sampleRate + "Exception, keep trying." + ex.Message); } } } }
unknown
d3463
train
You are looking for #region #region foo public static foo() { } #endregion foo However, using regions is frowned upon. A: the name comes after the # #region MyClass definition public class MyClass { .... } #endregion Reference: https://msdn.microsoft.com/en-us/library/9a1ybwek.aspx
unknown
d3464
train
I got a solution, effectively the problem is much more simple that the 'SkyScrape & Fences' puzzle I solved previously. I'm afraid I previously misunderstood the problem and placed a wrong comment, suggesting you to abandon the (right) path you already took. /* File: second_end_view_puzzle.pl Author: Carlo,,, Created: Oct 8 2012 Purpose: help to solve Second End View puzzle as quested at https://stackoverflow.com/q/12717609/874024 */ :- [library(clpfd)]. gen_row(Ls) :- length(Ls, 7), Ls ins 0..6. abc_view :- Rows = [R1,R2,R3,R4,R5,_R6,R7], maplist(gen_row, Rows), transpose(Rows, [C1,C2,C3,C4,C5,C6,C7]), maplist(all_distinct, Rows), maplist(all_distinct, [C1,C2,C3,C4,C5,C6,C7]), start(R1, 4), start(R2, 2), start(R3, 3), start(R4, 5), start(R5, 3), finish(R1, 6), finish(R2, 4), finish(R3, 2), finish(R5, 1), finish(R7, 2), start(C2, 3), start(C3, 4), start(C4, 3), start(C5, 5), start(C6, 4), start(C7, 1), finish(C1, 3), finish(C2, 2), finish(C3, 5), finish(C4, 5), finish(C5, 6), finish(C6, 1), finish(C7, 4), maplist(label, Rows), maplist(writeln, Rows). % place the constraint 'SECOND in that direction' using a reified check start(Vars, Num) :- Vars = [A,B,C|_], X #<==> ( A #= 0 #\/ B #= 0 ) #/\ C #= Num, Y #<==> A #\= 0 #/\ B #= Num, X + Y #= 1 . finish(Vars, Num) :- reverse(Vars, Sarv), start(Sarv, Num). edit test: ?- abc_view. [5,4,0,2,1,6,3] [6,0,2,3,5,4,1] [1,3,4,6,2,5,0] [2,5,1,4,0,3,6] [0,6,3,5,4,1,2] [3,2,5,1,6,0,4] [4,1,6,0,3,2,5] true ; false. edit here is the 'porting' to GnuProlog. I've copied from SWI-Prolog CLP(FD) library the transpose/2 code. /* File: second_end_view_puzzle.pl Author: Carlo,,, Created: Oct 8 2012 Purpose: help to solve Second End View puzzle as quested at https://stackoverflow.com/q/12717609/874024 */ gen_row(Ls) :- length(Ls, 7), fd_domain(Ls, 0, 6). transpose(Ms, Ts) :- %must_be(list(list), Ms), ( Ms = [] -> Ts = [] ; Ms = [F|_], transpose(F, Ms, Ts) ). transpose([], _, []). transpose([_|Rs], Ms, [Ts|Tss]) :- lists_firsts_rests(Ms, Ts, Ms1), transpose(Rs, Ms1, Tss). lists_firsts_rests([], [], []). lists_firsts_rests([[F|Os]|Rest], [F|Fs], [Os|Oss]) :- lists_firsts_rests(Rest, Fs, Oss). writeln(X) :- write(X), nl. abc_view :- Rows = [R1,R2,R3,R4,R5,_R6,R7], maplist(gen_row, Rows), transpose(Rows, [C1,C2,C3,C4,C5,C6,C7]), maplist(fd_all_different, Rows), maplist(fd_all_different, [C1,C2,C3,C4,C5,C6,C7]), start(R1, 4), start(R2, 2), start(R3, 3), start(R4, 5), start(R5, 3), finish(R1, 6), finish(R2, 4), finish(R3, 2), finish(R5, 1), finish(R7, 2), start(C2, 3), start(C3, 4), start(C4, 3), start(C5, 5), start(C6, 4), start(C7, 1), finish(C1, 3), finish(C2, 2), finish(C3, 5), finish(C4, 5), finish(C5, 6), finish(C6, 1), finish(C7, 4), maplist(fd_labeling, Rows), maplist(writeln, Rows). % place the constraint 'SECOND in that direction' using a reified check start(Vars, Num) :- Vars = [A,B,C|_], X #<=> ( A #= 0 #\/ B #= 0 ) #/\ C #= Num, Y #<=> A #\= 0 #/\ B #= Num, X + Y #= 1 . finish(Vars, Num) :- reverse(Vars, Sarv), start(Sarv, Num).
unknown
d3465
train
You can use .stack() as follows. Using .stack() is preferred as it naturally resulted in rows already sorted in the order of RecordID so that you don't need to waste processing time sorting on it again, especially important when you have a large number of columns. df = df.set_index('RecordID').stack().reset_index().rename(columns={'level_1': 'Column', 0: 'Value'}) Output: RecordID Column Value 0 A good 0 1 A bad 0 2 A ok 1 3 A Horrible 0 4 B good 1 5 B bad 0 6 B ok 0 7 B Horrible 1 A: You can use melt function: (df.melt(id_vars='RecordID', var_name='Column', value_name='Value') .sort_values('RecordID') .reset_index(drop=True) ) Output: RecordID Column Value 0 A good 0 1 A bad 0 2 A ok 1 3 A Horrible 0 4 B good 1 5 B bad 0 6 B ok 0 7 B Horrible 1 A: Adding dataframe: import pandas as pd import numpy as np data2 = {'RecordID': ['a', 'b', 'c'], 'good': [0, 1, 1], 'bad': [0, 0, 1], 'horrible': [0, 1, 1], 'ok': [1, 0, 0]} # Convert the dictionary into DataFrame df = pd.DataFrame(data2) Melt data: https://pandas.pydata.org/docs/reference/api/pandas.melt.html melted = df.melt(id_vars='RecordID', var_name='Column', value_name='Value') melted Optionally: Group By - for summ or mean values: f2 = melted.groupby(['Column']).sum() df2
unknown
d3466
train
There are a couple ways to solve it. The easy/hack way to do it is to employ the re.escape() function. That function can be thought of as an equivalent to PHP's addslashes() function, though it pains me to make that comparison. Having said that, my reading indicates psycopg2 takes advantage of PEP 249. If that's true, then you should be able to pass in parameterized queries and have it escape them for you.
unknown
d3467
train
Seems the problem was in the environment variables. I checked them and there was DOCKER_HOST pointing to 192.168.99.100, after deleting it everything's working fine. Where it comes from is still a mystery. A: I got the same problem. The problems was: I used to have Docker Toolbox on my PC before. So, I had Environmental Variables: DOCKER_TLS_VERIFY, DOCKER_CERT_PATH, DOCKER_HOST, DOCKER_TOOLBOX_INSTALL_PATH. I deleted them and it helped.
unknown
d3468
train
I believe that Constant Throughput Timer is what you're looking for. In regards to "separate groups" - you can set thread number as a property for, the same for all groups, and set this property during JMeter execution via jmeter.properties file or -J command line argument like: Set "Number of Threads" in Thread Group to ${__P(virtual.users,)} and launch JMeter as: jmeter -Jvirtual.users=50 ... ... ... Hope this all helps. A: Little bit late but you can use in that way cmd.exe /c jmeter.bat --nongui -JforcePerfmonFile=true --runremote --testfile "performance.jmx" --jmeterproperty "perf.properties" in file perf.properties set: virtual.users=50 and it will used 50 for your players. Hope this all helps A: Throughput Controller should be also a choice. Thread Group * *Throughput Controller2: 98% *Throughput Controller2: 2% * *Http Request1 *Http Request2 When Throughput Controller set percent 2%, Here are run rate: Http Request1: 2% ,Http Request2: 2%.
unknown
d3469
train
I don't know about an API that you can use. However I found a research paper on ML model that predicts travel mode on the basis of GPS information. If you have sufficient time to develop your own AI model you may try this: AI model Predicting travel mode
unknown
d3470
train
select ( select count(*) from Tasks where IsDone = 1 for xml path('CompletedCount'), type ), ( select TaskName, case IsDone when 1 then 'True' else 'False' end as IsDone from Tasks for xml path('Task'), type ) for xml path('Tasks') Update: You can do it with a singe select if you first build your task list and then query the XML for the completed count. I doubt this will be any faster than using two select statements. ;with C(Tasks) as ( select TaskName, case IsDone when 1 then 'True' else 'False' end as IsDone from Tasks for xml path('Task'), type ) select C.Tasks.value('count(/Task[IsDone = "True"])', 'int') as CompletedCount, C.Tasks from C for xml path('Tasks') A: You can use type to calculate part of the XML in a subquery: declare @todo table (TaskName varchar(50), IsDone bit) insert @todo values ('Buy milk',1) insert @todo values ('Send thank you note',1) select sum(case when isdone = 1 then 1 end) as 'CompletedCount' , ( select TaskName 'TaskName' , case when isdone = 1 then 'True' else 'False' end 'IsDone' from @todo for xml path('Task'), type ) as 'TaskList' from @todo for xml path('Tasks') This prints: <Tasks> <CompletedCount>2</CompletedCount> <TaskList> <Task> <TaskName>Buy milk</TaskName> <IsDone>True</IsDone> </Task> <Task> <TaskName>Send thank you note</TaskName> <IsDone>True</IsDone> </Task> </TaskList> </Tasks>
unknown
d3471
train
Did you reference WindowsAzure.Storage yourself in project.json? You shouldn't, because that one is already referenced for you by the environment. You should use #r to reference this one: #r "Microsoft.WindowsAzure.Storage" using Microsoft.WindowsAzure.Storage.Blob; This is simply set in your function itself. learn.microsoft.com/en-us/azure/azure-functions/functions-reference-csharp#referencing-external-assemblies
unknown
d3472
train
As the $scope attributre should be dynamic and saved in variable bind use: listenToUrl: function (scope, moduleName, stateName, bind) { scope.$on('$locationChangeSuccess', function (event) { // use scope like an associative array scope[bind] = urlFactory.parseState(moduleName, stateName); }); } In the controller it is sufficient, if you use. urlWatch.listenToUrl($scope, "module1", "mod1", "mod1m3"); $scope.mod1m3 will then be whatever parseState returns
unknown
d3473
train
Try this for your ImageView: <ImageView android:id="@+id/mudImg" android:layout_width="match_parent" android:layout_height="wrap_content" android:adjustViewBounds="true" android:src="@drawable/icon_m0_r" android:visibility="visible" /> adjustViewBounds="true" tells the ImageView to set the height so that the image has the correct aspect ratio using the given width.
unknown
d3474
train
I changed my application.js to //= require selectize/standalone/selectize I figured it out by looking at the load paths ~/.rvm/gems/ruby-2.3.1/gems/rails-assets-selectize-0.12.3/app/assets/javascripts and found standalone was in /selectize/standalone/selectize.js I knew to look there by looking at their examples.
unknown
d3475
train
The "403 Token invalid" error usually occurs if you missed giving permissions to particular scope (Azure Service Management). By giving this scope it enables you to access https://management.azure.com To resolve this error, please follow below steps: Go to Azure Ad ->your application -> API permissions -> Add permission -> Azure Service Management -> delegated permissions ->User impersonation -> Add After giving these permissions try to retrieve the resource again, there won't be any error. A: Since I didn't find a solution that worked with OAuth2 and the Credentials flow, I got it working with Basic Authentication. The username (userName) and password (userPWD) can be taken from the publishing profile of the respective app service. GET https://{appservicename}.scm.azurewebsites.net/api/triggeredwebjobs/{jobName}/history Authorization Basic ....
unknown
d3476
train
This works for the first article in the list - the dialog opens, but the orther articles open in a separate page. I am assuming this is because the ids are not unique. You're right, having 2 or more elements with the same ID is invalid HTML and will cause you all sorts of problems. Remove the id attribute and use a class attribute instead: <ul> <li><a href="/Updates/LoadArticle?NewsId=3" class="article">Article 3</a></li> <li><a href="/Updates/LoadArticle?NewsId=2" class="article">Article 2</a></li> <li><a href="/Updates/LoadArticle?NewsId=1" class="article">Article 1</a></li> </ul> Then instead of: $("#article").click() Use: $(".article").click()
unknown
d3477
train
Looks like you can work around this by supplying a dict to Series.fillna. >>> df FocusColumn 0 NaN 1 1.0 2 NaN >>> df['FocusColumn'].fillna({i: [] for i in df.index}) 0 [] 1 1 2 [] Name: FocusColumn, dtype: object Notes: * *Surprisingly, this only works for Series.fillna. *For large Series with few missing values, this might create an unreasonable amount of throwaway empty lists. *Tested with pandas 1.0.5. A: You could try the following: import pandas as pd import numpy as np df = pd.DataFrame({'FocusColumn': [1, 2, 3, 4, np.NaN, np.NaN, np.NaN, np.NaN], 'Column1': [1, 2, 3, 4, 5, 6, 7, 8], 'Column2': [7, 8, 6, 5, 7, 8, 5, 4]}) df['FocusColumn'] = df['FocusColumn'].apply(lambda x: [] if np.isnan(x) else x) print(df) Output: FocusColumn Column1 Column2 0 1 1 7 1 2 2 8 2 3 3 6 3 4 4 5 4 [] 5 7 5 [] 6 8 6 [] 7 5 7 [] 8 4
unknown
d3478
train
As per the open graph documentation you should use 1:1 i.e square images, apart from that remove the yoast seo plugin and add the meta tags manually (i used a plugin called scripts and styles). This helped me solve the problem for the thumbnail in WhatsApp for ios. You might also want to add another meta tag with a rectangular image as Facebook will skew the 1:1 image when you'll share it on Facebook.
unknown
d3479
train
try this add z-index: 100; so its work .sub-menu { z-index: 100; } { margin: 0; padding: 0; } #menu { text-align: center; padding: 10px; } #menu ul { list-style-type: none; text-align: center; } #menu li { display: inline-block; padding: 10px; position: relative; } #menu a { color: #4C9CF1; text-decoration: none; font-weight: bold; display: block; font-size: 16px; } #menu a:hover { color: #444; } .sub-menu { display: none; position: absolute; z-index: 100; } .sub-menu li { display: none; margin-left: 0 !important; white-space: nowrap; } .sub-menu li a { display: none; margin-left: 0 !important; } #menu li:hover .sub-menu { display: block; } <body> <header> <div id="menu"> <ul> <li><a href="home">Home</a></li> <li><a href="about">Product</a> <ul class="sub-menu"> <li><a href="#">Product 1</a></li> <li><a href="#">Product 2</a></li> <li><a href="#">Product 3</a></li> </ul> </li> <li><a href="login">Login</a></li> <li><a href="signup">SignUp</a></li> <li><a href="#">Contact</a></li> </ul> </div> </header> <!-- display the slider --> <div> <div id="amazingslider-1" style="display:block;position:relative;margin:0 auto;"> <ul class="amazingslider-slides" style=""> <li><img src="https://static.pexels.com/photos/34950/pexels-photo.jpg" alt="1" title="1" /> </li> </ul> </div> </div> <!-- End --> </body> A: Set the z-index higher for the item that you want to show in-front. { margin: 0; padding: 0; } #menu { text-align: center; padding: 10px; } #menu ul { list-style-type: none; text-align: center; } #menu li { display: inline-block; padding: 10px; position: relative; } #menu a { color: #4C9CF1; text-decoration: none; font-weight: bold; display: block; font-size: 16px; } #menu a:hover { color: #444; } .sub-menu { display: none; position: absolute; z-index: 100; } .sub-menu li { display: none; margin-left: 0 !important; white-space: nowrap; } .sub-menu li a { display: none; margin-left: 0 !important; } #menu li:hover .sub-menu { display: block; } <header> <div id="menu"> <ul> <li><a href="home">Home</a></li> <li><a href="about">Product</a> <ul class="sub-menu"> <li><a href="#">Product 1</a></li> <li><a href="#">Product 2</a></li> <li><a href="#">Product 3</a></li> </ul> </li> <li><a href="login">Login</a></li> <li><a href="signup">SignUp</a></li> <li><a href="#">Contact</a></li> </ul> </div> </header> <body> <!-- display the slider --> <div> <div id="amazingslider-1" style="display:block;position:relative;margin:0 auto;"> <ul class="amazingslider-slides" style=""> <li><img src="https://via.placeholder.com/1024x768" alt="1" title="1" /> </li> </ul> </div> </div> </body> <!-- End --> A: #menu { z-index:9000 text-align: center; padding: 10px; } A: #menu { text-align: center; padding: 10px; position:relative z-index:99; } try this,must add position
unknown
d3480
train
I ended up using Karma with jasmine. Setting it to browser mode means no modules and no strict mode, yay.
unknown
d3481
train
Instead of using render @trading_cards to loop through your TradingCards for you. You could do that yourself in slices of 3 (as @alfie suggested). <% @trading_cards.each_slice(3) do |cards| %> <div class="row"> <% cards.each do |card| %> <%= render card %> <!-- This will render your `_trading_card` partial --> <% end %> </div> <% end %>
unknown
d3482
train
There's an extra </li> <li><a>Edit Sale</a> <?php if(is_array($sales_pages)): ?> <ul> <?php foreach($sales_pages as $sale): ?> <li> <a href="<?=base_url();?>admin/editsale/index/<?= $sale->id ?>/<?php echo url_title($sale->name,'dash', TRUE); ?>"><?=$sale->name?></a> </li> <?php endforeach; ?> </ul> <?php endif; ?> </li><!-- LI Edit Sale Close --> <!-- Right here you have two closing end tags for <li>--> </li><!-- LI Close -->
unknown
d3483
train
Assuming you're referring to the scaffolded list view, the scaffolding only renders six fields. The basic logic (from src/templates/scaffolding/list.gsp) is: props.eachWithIndex { p, i -> if(i == 0 { // render the field as a link to the show view } else if(i < 6) { // render the field value } } Note that the list of properties includes the id. Since you define six fields in your constraints, the last one's not being displayed (only the id + first five are). Edit To "fix" this, you have some options: * *Update the scaffolded list view code: * *First, run grails install-templates *Open up src/templates/scaffolding/list.gsp *Find the code segment above and change the condition Note that this will change the rendering for all scaffolded and generated list views. *Generate the view and update it manually. It looks like you've already generated the view, so you'll just need to update it. Note that if you generate it again, it will overwrite your changes.
unknown
d3484
train
You have a problem with compiling, start using ide eclipse or intelij Idea. The PageRank class is not compilable Another problem is in your package name, try like that: java pagerank.PageRank So if you would create a folder structure like that: src/ pagerank/ PageRank.java PageRankTester.java PageRank.java package pagerank; public class PageRank { public PageRank(String filename) {} public static void main(String[] args) { if (args.length != 1) { System.err.println("Please give the name of the link file"); } else { new PageRank(args[0]); } } } PageRankTester.java package pagerank; public class PageRankTester{ public static PageRank pagerank = new PageRank("filename"); public static void main(String[] args){ testNorm(); testSubtract(); testDot(); testMatrixMul(); } private static void testNorm(){ // Tests pagerank.norm() } private static void testSubtract(){ // Tests pagerank.subtract() } public static void testDot(){ // Tests pagerank.dot() } public static void testMatrixMul(){ // Tests pagerank.matrixMul() } } in cmd cd into src folder and do: javac pagerank/*.java java pagerank.PageRank java pagerank.PageRankTester
unknown
d3485
train
I assume you mean this SmoothCheckBox on github. Looking at the source code, one finds no setText(String)-method. If I understand the readme correctly, those check boxes are designed to have a selected and unselected color, but no text.
unknown
d3486
train
Well you are trying to create an instance of a COM object with the name 'ProjName.ClassName' - which is unlikely to be a real COM object. Either your COM class needs to be one that has been registered in Windows, or it needs to be a class defined within your VB project. The example in MSDN is: Sub CreateADODB() Dim adoApp As Object adoApp = CreateObject("ADODB.Connection") End Sub Where ADODB.Connection is a COM class that has been previously registered in Windows. The code you have provided above is trying to instantiate a non existant class (unless it is already within the same VB project). You say that the other project this works, then I will hazard a guess that the test project has a class called ClassName. Ok -Updated. The error code is not 'DLL Missing' - It is likely to be some reason why the COM object could not be instantiated. The following Microsoft support page suggests some reasons and ways of tracking down the problem. Its likely to be some sort of missing dependency to the DLL. http://support.microsoft.com/kb/194801
unknown
d3487
train
You can run a mysqldump command using PHP exec function to only export data. Ex: exec('mysqldump -u [user] -p[pass] --no-create-info mydb > mydb.sql'); More info: * *mysqldump data only *Using a .php file to generate a MySQL dump
unknown
d3488
train
If you don't know sorting refer this link https://www.geeksforgeeks.org/sorting-algorithms/ to better understand the concept and types of sorting algorithms. In this example we have used bubble sort algorithm to sort elements in descending order //sort your linked list this way as you said you have 5 element in your linked list //n=5 i. e size of linked list for(int i=0;i<n;i++)//sorting logic for linked list to be in descending order { temp=head; for(int j=0;j<n-1-i;j++) { if(temp->value<temp->next->value) { val=temp->value; //val is integer variable nm=temp->name; //nm is string variable temp->value=temp->next->value; temp->name=temp->next->name; temp->next->value=val; temp->next->name=nm; } temp=temp->next; } } temp=head; for(int i=0;i<3;i++)// prints 3 elements as you want 3 greatest numbers { cout<<temp->value<<endl; cout<<temp->name<<endl; temp=temp->next; }
unknown
d3489
train
You don't need to change any settings in Source Tree. Instead, to open it in other editors like VS Code, Visual Studio 2015, Visual Studio 2017/2019/2022, you need to change the default filetype opening setting you wish to open in your operating system. Perform the following steps:
unknown
d3490
train
No, it's not an issue. It's just interpreted as a comment starting with "Define name=...". It also doesn't matter if you put it on the same line or on separate lines. You could as well write: <!--<Define name="default election policy"> <Policy name="DefaultToWaive"/> </Define>-->
unknown
d3491
train
Try this piece of code... simplest and shortest :) $i=array('One','Two','Two','Three','Four','Five','Five','Six'); $arrayValueCounts = array_count_values($i); foreach($i as $value){ if($arrayValueCounts[$value]>1){ echo '<span style="color:red">'.$value.'</span>'; } else{ echo '<span>'.$value.'</span>'; } } A: Here is optimized way that will print exact expected output. <?php $i=array('One','Two','Two','Three','Four','Five','Five','Six'); $dups = array_count_values($i); print_r($dups); foreach($i as $v) { $colorStyle = ($dups[$v] > 1) ? 'style="color:red"' : ''; echo "<span $colorStyle>$v</span>"; } ?> A: Try this, function array_not_unique($input) { $duplicates=array(); $processed=array(); foreach($input as $key => $i) { if(in_array($i,$processed)) { $duplicates[$key]=$i; // fetching only duplicates here and its key and value } } return $duplicates; } foreach($processed as $k => $V){ if(!empty($duplicates[$k])){ // if duplicate found then red echo '<span style="color:red">'.$duplicates[$k].'</span>'; }else{ echo '<span>'.$duplicates[$k].'</span>'; // normal string } } A: Like this : PHP function array_duplicate_css($input) { $output = $processed = array(); foreach($input as $key => $i) { $output[$key]['value'] = $i; if(in_array($i, $processed)) { $output[$key]['class'] = 'duplicate'; } else { $output[$key]['class'] = ''; $processed[] = $i; } } return $output; } foreach(array_duplicate_css($input) as $row) { echo '<tr><td class="' . $row['class'] . '">' . $row['value'] . '</td></tr>'; } CSS .duplicate { color: #ff0000; } A: Simple use array_count_values. $array=array('One','Two','Two','Three','Four','Five','Five','Six'); $new_array= array_count_values($array); foreach($new_array as $key=>$val){ if($val>1){ for($j=0;$j<$val;$j++){ echo "<span style='color:red'>".$key."</span>"; } }else{ echo "<span>".$key."</span>"; } } A: It can be done in several ways. This is just a one method. Step one maintain 2 arrays. Then store the duplicated indexes in one array. When you iterating use a if condition to check whether the index is available in the "duplicated indexes" array. If so add the neccessary css.
unknown
d3492
train
It seems that you essentially try to use discriminated union. But it seems that it is not working with ...rest. So to make it work * *Add additional property to both interfaces, say type which will be used as discriminant interface IAnchor extends React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement> { type: 'anchor' href: string } interface IButton extends React.ButtonHTMLAttributes<HTMLButtonElement> { type: 'button' } *Accept porps and than destruct them in condition branch const Button: React.FC<TButton> = (props): JSX.Element => { if (props.type === 'anchor') { const { type, href, children, ...rest } = props; return ( <a href={href} {...rest}> {children} </a> ) } const { type, children, ...rest } = props; return <button {...rest}>{children}</button> } See working example A: I took a look at your StackBlitz and was able to approach this using the ts-toolbelt library: First, let's define your two different possible prop types (all anchor props and all button props), combine them as a strict union and use a type guard to let our React component know when we're using which set of props: import { Union } from 'ts-toolbelt' type TButton = Union.Strict<IAnchor | IButton> interface IAnchor extends React.AnchorHTMLAttributes<HTMLAnchorElement> {} interface IButton extends React.ButtonHTMLAttributes<HTMLButtonElement> {} const isAnchor = (props: TButton): props is IAnchor => { return props.href !== undefined; } const isButton = (props: TButton): props is IButton => { return props.type !== undefined } Now, let's write our custom component that can either be a button or an anchor: const Button: React.FC<TButton> = ({ children, ...props }): JSX.Element => { if (isAnchor(props)) { return ( <a href={props.href} {...props}> {children} </a> ) } else if (isButton(props)) { return <button {...props}>{children}</button> } } You can view it working in this StackBlitz.
unknown
d3493
train
Xamarin application: As you already mentioned, you can debug your Xamarin app in Visual Studio just like you would any other .Net projects. Web API: Similarly, you can also debug your Web API project in Visual Studio. * *Run the Web API project locally. *Note the address from the address bar and use that in Postman or other similar tools to send/receive the API requests/response. SQL Server Database: You cannot technically 'debug' a database, but you can verify the CRUD operations using SQL Server Management Studio (or SSMS) provided you have the necessary access/credentials. To find where the error is, I would suggest: * *Start from your Xamarin application and verify if the app is sending the JSON as expected; *Then send the same JSON from postman to your Web API and verify if it is accepting/processing the JSON as expected; *And finally, check your database tables in SSMS if the data is stored as expected. Refer the following links: https://www.c-sharpcorner.com/article/asp-net-web-api-with-fiddler-and-postman/ https://learn.microsoft.com/en-us/azure/sql-database/sql-database-connect-query-ssms Hope it helps. Cheers! A: Found out you can debug a web API using Visual Studio almost the same way you debug a Xamarin app. Here's a nice tutorial for that: https://learn.microsoft.com/en-us/azure/app-service/web-sites-dotnet-troubleshoot-visual-studio#remotedebug
unknown
d3494
train
You will have to reset the basics margin and padding if applied from html and other top level tags. body, html {margin: 0;padding: 0;} Or just use something like reset.css http://meyerweb.com/eric/tools/css/reset/
unknown
d3495
train
in the definition of json, one of the posible values its a string. which can contain <, > among other things you can use a base64 enconding to avoid this. A: JSON can contain nearly any character in its strings. As you are using it in an attribute, escape_quotesaddslashes should be enough, that depends on your (X)HTML version. htmlspecialchars is OK anyway.
unknown
d3496
train
This can be done both iteratively and recursively. Here is a decent permutation generator. That can be adapted to your needs and made generic (to take a List<T> of elements) so it can take a list of numbers, a string (list of characters) and so on. A: Try thinking about the characters as elements in a bag of characters. Here's some pseudocode that should work: permute ( bag < character > : theBag, integer : length, string : resultSoFar ) if length <= 0 then: print resultSoFar exit end-if for each x in theBag: nextResult = resultSoFar + x nextBag = theBag - x permute( nextBag, length - 1, nextResult ) end-for end-method Good luck! A: make a function that takes a set of letters make it return the set of n permutations (3 or 4) that start with the letter you specify. Then run it once for each of the unique chars in your set. The full result set will be the union of the subsets. A: Here's a clue that might help. If you have input "aabcdef" and you don't want permutations with two "a"s, it is easier to remove one of the "a"s from the input rather than trying to eliminate the permutations with multiple "a"s as you generate them. A: @ Chip Uni: when I implemented your code, it generated all permutations of length x to max. So when I fed it length 3 with a bag containing 7 characters it generated all permutations of length 3 through 7. It was a simple matter to eliminate all results greater than length 4, though. Thank you very much, y'all! I greatly appreciate your suggestions and assistance. A: This is in Ruby, but it might help: http://trevoke.net/blog/2009/12/17/random-constrained-permutations-in-ruby/
unknown
d3497
train
If you have a non-generic enumerator, the cheapest way to check for any elements is to check if there's a first element. In this case, hasAny is false: var collection= new List<string>( ) as IEnumerable; bool hasAny = collection.GetEnumerator().MoveNext(); while in this case, it's true: var collection= new List<string>{"dummy"} as IEnumerable; bool hasAny = collection.GetEnumerator().MoveNext(); A: Your parameter is IEnumerable not IEnumerable<T> but the LINQ extension methods are for the latter. So either change the type of the parameter to IEnumerable<string> or use Cast: if (!list.Cast<string>().Any()) { return string.Empty; } If you don't know the type (string in this case) and you just want to know if there's at least one, you can still use Cast and Any because Object works always: bool containsAny = list.Cast<Object>().Any();
unknown
d3498
train
Build a dictionary from data with the key x0: dataDictionary = {} for datum in data: x0, t, r = datum.split() dataDictionary[x0] = t, r This allows you to look up values from data based on x0. Now, when you loop through x, you can get those values and do your calculations: for item in x: x1, x2 = item.split() t1, r1 = dataDictionary[x1] t2, r2 = dataDictionary[x2] y = r1 - r2 + t1 * t2 print(y)
unknown
d3499
train
You can implement PostProcessingMapStore interface on your MapStore which enables the ability to update the stored entry inside the store() method. You can obtain the auto-generated fields from the database then you can reflect those changes to your entry. See Post Processing documentation : http://docs.hazelcast.org/docs/latest-dev/manual/html-single/index.html#post-processing-objects-in-map-store A: The only way I can see to do what you ask is to have your code write a demo record into the database and then read it back before into Hz and making MapStore do an update rather than insert. Of course this would be slow and cumbersome. The best solution would be to turn off the autoincrement, but what you could also do is use a different field as the cache key, say have a member called cacheKey and store that in your database record, when you do an insert in MapStore you just need insert where databaserecord.cachekey == cacheKey.
unknown
d3500
train
use: =ARRAYFORMULA({"", TRANSPOSE(UNIQUE(FILTER(B2:B, B2:B<>""))); FLATTEN({SORT(UNIQUE(C2:C)), IFERROR(TEXT(UNIQUE(C2:C), {"@", "@"})/0)}), IFNA(VLOOKUP(TRANSPOSE(UNIQUE(FILTER(B2:B, B2:B<>"")))&FLATTEN({TEXT(SORT(UNIQUE(C2:C)), "hh:mm"), TEXT(SORT(Unique(C2:C)), "hh:mm")&{".1", ".2"}}), {FLATTEN({B2:B&TEXT(C2:C, "hh:mm"), B2:B&TEXT(C2:C, "hh:mm")&{".1", ".2"}}), FLATTEN({A2:A, D2:D, E2:E})}, 2, ))})
unknown