input
stringlengths
51
42.3k
output
stringlengths
18
55k
XQuery cross apply returns extra records <p>I have following structure in XML column. It supposed to <code>show stored procedures</code> and list <code>used tables and columns</code> underneath.</p> <p>It is showing extra records. Please see below structure and queries:</p> <pre><code>CREATE TABLE #T ( ID int pr...
<p>cross apply the value from the previous set</p> <pre><code>SELECT r.o.value('@name', 'varchar(max)') as ObjectName , t.x.value('@name', 'varchar(max)') as TableName , c.x.value('@name', 'varchar(max)') as ColumnName FROM #T CROSS APPLY MetaData.nodes('root/object') as r(o) CROSS APPLY r.o.nodes(...
Get text field information from one class and show it on a JTextArea on another class <p>I have a class BasicInfoWindow that gets the user information such as name, address, etc. I then have another class ReviewandSubmit where it show the the texts the user entered from BasicInfoWindow in the JTextArea. I am using card...
<p>You could use a Singleton Pattern in the HiringPersonInfo class to instantiate one instance of the class and then during the submit you could add that instance of that class to an ArrayList.</p> <p>Singleton Patterns can be used to create one instance of the object that can be shared by all the classes in that pack...
Display notification after field was changed (Angular and node) <p>I have an input field whose value gets updated in the database when the focus is lost (using onblur). What I would like to do is add a notification that tells the user that the value was changed.</p> <p>My code so far:</p> <p>HTML </p> <pre><code>&lt...
<p>The expression variable used in view should be <code>allsettings.pin_notification</code> not just <code>pin_notification</code></p> <pre><code>&lt;div class="alert-box notification"&gt;&lt;span&gt;Update: &lt;/span&gt; {{allsettings.pin_notification}}&lt;/div&gt; </code></pre>
Odoo 8 override _amount_line <p>I'm trying to override the <code>_amount_line</code> function in <code>sale.order.line</code> model in order to add custum logic.</p> <p>Here is my code:</p> <pre class="lang-py prettyprint-override"><code>class SaleOrderLine(models.Model): _inherit = 'sale.order.line' def _am...
<p>You have made mistake in compute_all method calling.</p> <p>This method should be like this,</p> <pre><code>@api.multi def _amount_line(self): tax_obj = self.env['account.tax'] cur_obj = self.env['res.currency'] for line in self: print line.tax_id price = self._calc_line_base_price(line...
To use GKAgents or not <p>I am developing (or atleast trying to develop) a decently big real time tactics game (something similar to RTS) using SpriteKit.</p> <p>I am using GamePlay kit for pathfinding.</p> <p>Initially I used <code>SKAction</code>s to move the sprites within the Path but fast enough I realized that ...
<p>One of the best ways (in SpriteKit/GameplayKit) to get the kind of behavior you're after is to recognize that path <em>planning</em> and path <em>following</em> need not be the same operation. GameplayKit provides tools for both — <code>GKObstacleGraph</code> is good for planning and <code>GKAgent</code> is good f...
How to have elastalert triger when the sum of a field, for all documents that match a query, exceeds some value <p>Can elastalert be triggered when the sum of a field for all documents that match a query exceeds some value? Say each document has a "price" value - Can elastalert be triggered when the sum of the "price" ...
<p>This is not supported out of the box by ElastAlert. </p> <p>There's <a href="https://github.com/Yelp/elastalert/issues/401" rel="nofollow">an open issue</a> which is still unresolved yet, as well as a related <a href="https://github.com/Yelp/elastalert/pull/657" rel="nofollow">pull request</a> which hasn't been mer...
Taking 3 photos with StartActivityForResults <p>I would appreciate some help, I want to take three photos under the same Intent with startActivityForResults() within a loop, and getting back onActivityResult () which prints those three photos in three imageviews, with MarshMallow, and its specific permissions (I think ...
<p>This will not work; a single startActivityForResult will result in a single call to onActivityResult. </p> <p>There's no contract in the ACTION_IMAGE_CAPTURE documentation or elsewhere in the system that says that you can issue it multiple times and get one result with 3 URIs. </p> <p>You'll have to loop it so th...
How to use Gorilla Mux to match entire path with regex <p>I would like to be able to use regex to match the entire path not just a portion of it.</p> <p>For Example:</p> <pre><code>/users.* </code></pre> <p>would match</p> <pre><code>/users /users/bob /users/bob/repos </code></pre> <p>Currently with Mux's <code>Ha...
<p>I ended up writing my own custom matcher function and used go's regex package. It was very easy to do and here is an example:</p> <pre><code>import ( ... "net/http" "net/url" "regexp" "github.com/gorilla/mux" ... ) ... muxRouter := mux.NewRouter() muxRouter. Methods("GET", "POST"). Scheme...
TFS 2015 - always denies <p>It doesn't submit my check-in even if I write a comment. When I put a break point statusMessage returns empty, why can't I get the comment into the statusMessage, how can I pull the message from the comment part? (I am using Visual Studio 2013)</p> <p>. . .</p> <pre><code> public EventNoti...
<p>Well, I found my answer.</p> <pre><code> if (!messageRegex.IsMatch(statusMessage)) </code></pre> <p>Should be </p> <pre><code>if (!messageRegex.IsMatch(checkinNotificationArgs.Comment)) </code></pre>
I can't understand codility PermMissingElem wrong using C/C++ <p>I used C++ for solving problem, codility PermMissingElem. I didn't use <code>xor</code>, just sum of sequence.</p> <p>c++</p> <pre><code> int solution(vector&lt;int&gt; &amp;A) { // write your code in C++11 (g++ 4.8.2) int n = A.size(); ...
<p>You store n in an int. So when you square it, you still have an int. Then you assign that int to a long long sum, but it's too late because overflow has already occurred.</p>
C++ program compiles and runs in codeblocks, but can't compile it in terminal <p>I created a C++ project that contains several source files and header files. The program compiles and runs well in codeblocks, but I can't compile it in terminal. </p> <p>All the files are in the same folder.</p> <p>Here are the command ...
<p>You should to avoid to compile an <em>header</em> file (<code>.h</code>).</p> <p>Try with:</p> <pre><code>clang++ -std=c++11 main.cpp file1.cpp </code></pre> <p>The header file is something that the <em>preprocessor</em> will include in the <em>cpp</em> files which need it (those <em>compilation units</em> which ...
What to do when a type contains itself? <p>I have code that works for a monad that's constrained to have some state. I'm having a problem because the state has a type variable that requires the monad.</p> <p>It looks like:</p> <pre><code>myget :: MonadState (MyState m A) m =&gt; m A </code></pre> <p>Now when I try t...
<p><code>newtype</code> to the rescue! A <code>newtype</code> or <code>data</code> declaration can break a loop.</p> <pre><code>newtype MS s m a = MS {getMS :: StateT (MyState (MS s m) s) m a} deriving (Functor, Applicative, Monad) deriving instance Monad m =&gt; MonadState (MyState (MS s m) s) (MS s m) instan...
Center Sub-Menu Under Parent Menu (WordPress > Genesis > Foodie Pro) <p>I am trying to center my submenu items under their parent menu item in my main navigation bar. I've tried a million things and nothing seems to be working.</p> <p>In case anyone is interested, I'm doing this on a WordPress site using Parent Theme ...
<p>I think you have to edit your css adding some rules.</p> <p>1 - add relative position to your menu <code>li</code></p> <pre><code>.menu-primary li{ position: relative; } </code></pre> <p>2 - Change the behaviour for your submenu when is open, centering it</p> <pre><code>.genesis-nav-menu .menu-item:hover &gt;...
Adobe Flash file names <p>I have some Windows 2012 R2 machines which come with inbuilt support for Adobe Flash in my lab. On some systems, Flash.ocx &amp; FlashUtil_Activex.dll, while on some systems I have NPSWF64_xx_x_xxx_xxx.dll &amp; NPSWF32_xx_x_xxx_xxx.dll.</p> <p>Does anyone know if even though HKEY_CLASSES_ROO...
<p>I found the answer myself. Here is what I found - FlashUtil_Activex.dll is the ActiveX Control used by IE. On Windows 2012, this is integrated in IE and all updates come from Microsoft, and therefore, no version number listed in the file name. NPSWF64_x.dll &amp; NPSWF32_x.dll are the NPAPI plugins used by Firefox...
IBM MobileFirst 7 dependencies <p>I'm using MobileFirst 7 library for a native Android application but have found it <strong>severely</strong> increases the dex method count of my Android application (pushing it over the <a href="https://developer.android.com/studio/build/multidex.html" rel="nofollow">65,536 limit</a>)...
<p>If you are not using the JSONStore feature, you can safely exclude the following:</p> <ul> <li>guava.jar</li> <li>commons-codec.jar</li> <li>jackson-*</li> </ul>
StyleBundle, how to include all the *.js files in a folder along with the *.js files in the subfolders <p>this is my code, but i'm not sure if i'm putting the correct virtual directories..</p> <pre><code>bundles.Add(new ScriptBundle("~/App_Data").IncludeDirectory("~/App_Data", "*.js", true)); </code></pre> <p>this is...
<p>For anybody visiting for a quick answer: After creating your bundles for CSS/JS, you must include them in your _Layout.cshtml or specific View.</p>
Error while installing DCOS "vagrant up m1 a1 boot" <p>I am very to new to DCOS. i am fallowing the instructions given in <a href="https://github.com/dcos/dcos-vagrant/blob/master/docs/deploy.md" rel="nofollow">https://github.com/dcos/dcos-vagrant/blob/master/docs/deploy.md</a> In the installation i am getting error wh...
<p>"Time is marked as bad" is from a new time-check process that was added in 1.8.4 to validate that time between nodes is synchronized.</p> <p>Usually, a production cluster would use NTP to synchronize node clocks, but this hasn't been baked into the dcos-vagrant base image yet (Just made <a href="https://dcosjira.at...
How can I use GLMatrix to do matrix multiplications? <p>I'm just beginning to try to find/use a matrix operations library for JS. I want to do simple translation, scale, and rotation operations on 2D matrices. The <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Matrix_math_for_the_web" rel="nofoll...
<p>Use</p> <pre><code>var ans = mat2d.create(); </code></pre> <p>to create a new (identity) matrix. See the <a href="http://glmatrix.net/docs/mat2d.html#.create" rel="nofollow">docs</a> or the <a href="https://github.com/toji/gl-matrix/blob/master/src/gl-matrix/mat2d.js#L48" rel="nofollow">source</a>.</p>
Import CSV file of locations into Android once, not every runtime <p>I am trying to import a csv file into an android app. The file is a list of about 2000 locations, given by name, address, telephone number, state and postcode. I then need to find the closest of these to the user, and show the location and map.</p> <...
<p>You could use a background service. When your app does the initial onCreate, you can start the service processing the CSV. As long as your app is still in memory, you should be fine.</p> <p><a href="https://developer.android.com/training/run-background-service/create-service.html" rel="nofollow">https://developer.a...
CSS Vertical Align Placeholder Text <p>I'm trying to vertically align the place holder for a text input box.</p> <p>I've got the <code>::--webkit</code> and <code>:--moz</code> rules going, and they're working for other stylings, but not vertically aligning...</p> <p>I've tried <code>vertical-align: middle;</code> in...
<p>One option is change the font formatting placeholder for input (the placeholder inherits the formatting).</p> <p><a href="https://jsfiddle.net/rwh6hkc6/" rel="nofollow">https://jsfiddle.net/rwh6hkc6/</a></p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div clas...
MSI for Visual C++ 2015 <p>I need to install redistributable Visual C++ 2015 on three hundred computers in a corporate office. Is there any way to convert EXE to MSI. It would save tons of time.</p>
<p>Have you tried to extract it, as in the <a href="http://www.applepie.se/extract-msi-from-visual-c-2012-redistributable" rel="nofollow">this example</a>?</p>
Jest Ignore react peer dependency in linked module <p>I'm working on a React web app that uses a component library we include as an npm module. Because I'm working on the library and the webapp at the same time, I linked the library as module in npm.</p> <p>The directories are set up like this:</p> <pre><code>~/Devel...
<p>Try a new regex for modulePathIgnorePatterns:</p> <pre><code>"modulePathIgnorePatterns": [ "&lt;rootDir&gt;/node_modules.*/react" ] </code></pre> <p>.* should match any character zero or more times. So, all react should be excluded.</p>
Alamofire requst taking around 10 seconds <p>I've run this code on my mac with good wifi and my phone using wifi / data and I'm getting an extremely slow load time on the code below. It takes about 7-10 seconds for my UI to update which I do in my view controller in the second block of code where the ...'s are.</p> <p...
<p>Usually the loading takes more time if the Per_Page is more than 50 for your API link. This can cause a delay when dealing with API and requests that contain images and videos.</p>
If more than 10% of results are over X in mysql <p>I have a database table with lists of temperature readings from many locations in a number of buildings. I need a query that will give me a true or false if more than 10% of the readings in a building, taken on a date, are greater than X</p> <p>I am not looking for a ...
<p>You can use conditional aggregation, something like this:</p> <pre><code>select building, date, (case when avg(temperature &gt; x) &gt; 0.1 then 'Y' else 'N' end) as flag from t group by building, date; </code></pre>
Can't get SQL query result, when using * (not column names) <p>I can only get results from a SQL query execution when I use <code>select columnname from tablename</code>, but not when I use <code>select * from tablename</code></p> <pre><code>public static void connectAndExecute(String host, String uName, String uPass,...
<p>Use <code>ResultSet.class</code> methods to get the desired result. You can give the column names or column index.</p> <p><code>getInt(int columnIndex)</code></p> <blockquote> <p>Retrieves the value of the designated column in the current row of this ResultSet object as an int in the Java programming lang...
Excel, find a date closest in a range of dates given a number and return another cell <p>New to advanced excel concepts, I have a list of numbers such as:</p> <pre><code>101 02/22/2016 100 02/21/2016 </code></pre> <p>and then another list like so:</p> <pre><code>101 01/01/2016 Apple 101 02/20/2016 Banana 100 02/21...
<p>You can use this array formula:</p> <pre><code>=INDEX($C$1:$C$4,MATCH(MIN(IF($A$1:$A$4=E1,ABS($B$1:$B$4-F1))),IF($A$1:$A$4=E1,ABS($B$1:$B$4-F1)),0)) </code></pre> <p>Being an array formula it needs to be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode. If done correctly then Excel will put...
jsp select dropdown not coming one list <p><a href="http://i.stack.imgur.com/mnstw.png" rel="nofollow"><img src="http://i.stack.imgur.com/mnstw.png" alt="font-end showing this way"></a></p> <p>here is code I want dropdown in one list <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel=...
<p>Use this in your code. Assuming you are getting your list in JSP. </p> <pre><code> &lt;select name="itemCode"&gt; &lt;c:forEach items="${list}" var="value"&gt; &lt;option value="${value}"&gt; ${value} &lt;/option&gt; &lt;/c:forEach&gt; &lt;/select&gt; </code></pre> <p>Currently you are crea...
Does the data migrate to other nodes automatically if a datanode role get removed in a hadoop cluster? <p>We have 5 nodes on our CDH cluster, having datanode and namenode on the same node, and 4 other datanode. The problem is that name node enters safe mode and it should happens because of low disk space. I removed th...
<p>There is not a general answer but normally if a data node be removed (by a failure, intentionally, etc) the blocks missed should be identified as under-replicated and the name node should start sending instructions to the data nodes to make a copy from the replicas until all the blocks have all the required replicas...
Eclipse plugin project "checkstyle internal error" says "cannot initialize module TreeWalker - Unable to instantiate '...ForbidCertainImportsCheck'" <p>I haven't looked at my Eclipse plugin project for a few weeks, but after I updated to Neon.1, I noticed the following error in the Problems view:</p> <blockquote> <...
<p>I've managed to resolve this.</p> <p>The parent POM of the project I work on had a change to its checkstyle configuration, and it now requires adding the "seventu" auxiliary checkstyle plugin, which I found at <a href="https://github.com/sevntu-checkstyle/sevntu.checkstyle" rel="nofollow">https://github.com/sevntu-...
Toggle display with javascript vanilla <p>How to toggle display with Javascript Vanilla when I click a checkbox. </p> <p>I tried with only one element and it works but when there is more than one...I put this in my code--></p> <pre><code>function OnlyOK(){ var ul = document.getElementsByClassName('RQ'); ...
<p>So basically you want to hide some elements when you click and check a checkbox and show them again after you uncheck the checkbox, right?</p> <p>You can achieve such a thing like this:</p> <pre><code>function OnlyOK(flag){ var ul = document.getElementsByClassName('RQ'); for (i = 0; i &lt; ul.length;...
Can an alerting rule include a collection query? <p>When using Query Based Flexible Replication, is it possible to use a collection query in the alerting rule? Anyone have an example of how to create such a rule if it is possible? </p> <p>We'd like to add documents that need to be pulled to the replica system to a col...
<p>Yes, that should work fine. I don't have an example handy.</p>
Bluemix SSML with PHP <p>I'm using PHP shell_exec to call the <code>Bluemix</code> Text to Speech API and my code is working well except when I call the text with <code>SSML</code> tags like my second code. </p> <p>How could I use text and SSML in the same data query?</p> <pre><code> $result = shell_exec("/u...
<p>Does say-as interpret-as="letters" Hello fragment need the escape slashes around 'letters'?</p>
regex match proc name without slash <p>I have a list of proc names on Linux. Some have slash, some don't. For example,</p> <p><strong>kworker</strong>/23:1</p> <strong>migration</strong>/39</p> <strong>qmgr</strong></p> <p>I need to extract just the proc name without the slash and the rest. I tried a few different ...
<p>An alternative to regex is to <code>split</code> on <em>slash</em> and take the first item:</p> <pre><code>&gt;&gt;&gt; s ='kworker/23:1' &gt;&gt;&gt; s.split('/')[0] 'kworker' </code></pre> <p>This also works when the string does not contain a slash:</p> <pre><code>&gt;&gt;&gt; s = 'qmgr' &gt;&gt;&gt; s.split('/...
Filter describe-images command results <p>I have a command that prints out all of my AMIs after a particular date. However, instead of printing everything about the AMI, I would like to print just the AMI's "image-id" </p> <p>Any help is sincerely appreciated.</p> <pre><code>aws ec2 describe-images --filters Name=de...
<p>Here's the answer:</p> <pre><code>aws ec2 describe-images --filters Name=description,Values=soft_ami --query "Images[?CreationDate&gt;=`2016-09-25`][ImageId]" --output text &gt; C:\amioutput.txt </code></pre> <p>You should read the documentation <a href="http://docs.aws.amazon.com/cli/latest/userguide/controlling-...
Addition operator overload for pointers to nested classes <p>I am working on a linked list class which contains a private nested node class. I want to advance n nodes forward in my list by using the overloaded addition operator but clang is giving me the error "overloaded 'operator+' must be a unary or binary operator ...
<p>Fundamentally, the problem with what you're trying to do is that it's oveloading an operator on pointers. This is <a href="http://stackoverflow.com/questions/6171630/why-isnt-operator-overloading-for-pointers-allowed-to-work">problematic</a>. Simplifying your code as much as possible for the point, the following doe...
mvn command can't compile a github project <p>I installed maven on my ubuntu machine. I don't know why I can't compile this project successfully.</p> <p>Command I'm using: 'mvn compile <a href="https://github.com/Nukkit/Nukkit" rel="nofollow">https://github.com/Nukkit/Nukkit</a>'</p> <p><a href="http://i.stack.imgur....
<p>You will have to download (clone) the project on your machine. Then navigate using your terminal to the downloaded folder. This folder will have the pom.xml.<br> Run the command <code>mvn clean install</code> and it will start building the project.<br> If you simply want to compile the code (and not build the artifa...
Check if mobilefirst is loaded <p>I have angular app and using Mobile-first 8. How can I check that MobileFirst is loaded?. Do I have to wait for cordova to be loaded first ?.</p> <p>In V7.1, I have a wrapper for MobileFirst that return the cordova device object. However, since it is now a plugin I am not sure how to ...
<p>Why not use wlCommonInit? It's there for this exact reason. </p> <p>See the following blog post for best practices for building AngularJS apps with MobileFirst Foundation 8.0: <a href="https://mobilefirstplatform.ibmcloud.com/blog/2016/08/11/best-practices-for-building-angularjs-apps-with-mobilefirst-foundation-8....
Evaluate Time Between Elements of Row <p>I'm trying to evaluate time elements of a row to create a TRUE/FALSE column. For instance:</p> <pre><code>datetime 10/10/15 0:45 10/1/15 0:45 10/10/15 0:30 10/1/15 0:30 10/10/15 0:15 10/1/15 0:15 10/10/15 0:00 10/1/15 0:00 10/10/15 10:45 10/10/15 1:45 10/10/15 10:30 10/10/15 1:...
<p>If your data is in a csv called <code>test.csv</code></p> <pre><code>library(data.table) library(fasttime) data = fread('test.csv',header = TRUE,sep='\n') data[,datetime:=fastPOSIXct(datetime)] data[,v1:=FALSE][as.ITime(datetime) %between% as.ITime(c('01:45','08:45')) | as.ITime(datetime) %between% as.ITime(c('23:4...
Textures as particular powers of two? <p>I'm using textures to pre-compute some position values using shaders and am getting an error that the textures are not powers of two. In fact, I did make sure to extend them to make them square (7,043,716 texels, which is the square of 2654) however I am beginning to suspect tha...
<p>I don't think you need to be a particular power of two but <code>gl.getParameter(gl.MAX_TEXTURE_SIZE)</code> should tell you the upper limit that is available on the browser and hardware that you're on, and must be <em>at least</em> 64. (caveat: per the docs it's merely "a rough estimate"; but it's as good as you ca...
Azure Active Directory Saty Sign in OR Remeber Me Option <p>We are planning to move to Azure Active Directory from current custom forms based authentication. In process wondering if below is possible (Custom forms authentication implements below). How do I achieve this using Azure Active Directory. </p> <p>Currently c...
<p>The session created by Azure AD on user login can't really be controlled by the user. It has fairly static rules about session length, persistence, etc. Shortly, Azure AD tenant administrators will be able to control some of these aspects through config. But it's not really up to the user.</p> <p>With that said, y...
How to separate a numpy array into separate columns in pandas <p>I have a dataframe that looks like</p> <pre><code> ID_0 ID_1 ID_2 0 a b 0.05 1 a b 0.10 2 a b 0.19 3 a c 0.25 4 a c 0.40 5 a c 0.65 6 a c 0.71 7 d c 0.95 8 d c 1.00 </code></pre> <p>I want...
<p>You can construct a series object from each numpy array and the elements will be broadcasted as columns:</p> <pre><code>import pandas as pd import numpy as np df.groupby(['ID_0', 'ID_1']).apply(lambda x: pd.Series(np.histogram(x['ID_2'], range = (0,1), density=True)[0])).reset_index() </code></pre> <p><a href="htt...
synchronization other than current object <p>i have a class called counter, in that stringbuffer instance and a integer variable is shared across two threads.</p> <p>my question here is in the counter class i have used synchronized (buffer) ,buffer is nothing but a stringbuffer instance.</p> <p>i haven't used synchro...
<p>Actually there isn't too much to say here; strange it took me 10+ minutes to write down my answer. </p> <p>You see, one of the two threads acquires the lock first; then it counts to 100; then the other takes the lock; and further increases the counter to 200. </p> <p>And in your case, it really doesn't make any di...
I use several computers with different gitconfigs. How do I stop leaking my e-mail addresses to GitHub? <p>I have a work computer where <code>$HOME/.gitconfig</code> has <code>user.email</code> to <code>RotatingPieces@work.tld</code>. My home computer has <code>$HOME/.gitconfig</code> has <code>user.email</code> to <co...
<p>I've had the same issue for a while: I want different email addresses to be used for work projects, open source projects, personal projects, and so on, and I want it to be set automatically based on folder structure rather than remembering to do it per repo.</p> <p>This solution will automate the process of setting...
Rewriterule won't work due to folder name conflict <p>I have simple task. I need to redirect mywebsite.com/admin to mywebsite.com/login.php, but the url in browser should stay mywebsite.com/admin. I use this rewrite rule:</p> <pre><code>RewriteCond %{REQUEST_URI} /admin$ [NC] RewriteRule admin login.php [NC,L] </cod...
<p>Seems that this message board is only for simple, dumb questions... Every time I've asked something complicated, no one answered. I'm wondering if there's even one expert participating in these discussions...</p>
adb shell dumpsys window windows output describing <p>I'm using <a href="http://appium.io/" rel="nofollow">appuim</a> for interaction between my Android device and java code. And I faced with problem that on some kind of devices(including emulators) after pressing on Home button, appium return incorrect current activit...
<p>The <em>explanation of the difference</em> between <code>mCurrentFocus</code> and <code>mFocusedApp</code> stares right at you:</p> <pre> $ dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp' mCurrentFocus=<b>Window</b>{X uX package/.activity} mFocusedApp=<b>AppWindowToken</b>{X token=Token{X Activ...
How to trim ONLY certain characters from string in Postgresql database? <p>I have a table in a db that is labeled like so:</p> <pre><code>TableA: ID ID2 Text 0 64556-546-1 465846 adfadf 1 64556-546-1 465846 adfadf 2 64556-546-1 465846 adfadf </code></pre> <p>I want to trim th...
<p>I'd check here;</p> <p><a href="https://www.postgresql.org/docs/9.1/static/functions-string.html" rel="nofollow">https://www.postgresql.org/docs/9.1/static/functions-string.html</a></p> <p>and do a;</p> <p>regexp_replace(string text, pattern text, replacement text [, flags text])</p> <p>So one way to do it (igno...
Two outputs for one DataSource <p>I'm trying to process log files and save almost similar results to two different places without needing to process the whole log files all over again.</p> <p>e.g.</p> <pre><code> ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); DataSource&lt;Integer&g...
<p>A DataSet program can have as many data sinks as you need. Just add one ore more sinks with <code>DataSet.output(OutputFormat)</code> and call <code>env.execute()</code> to start the program. Flink provides a <code>JDBCOutputFormat</code> which you might use to write data into a database. </p> <p>As you noticed, yo...
Printing variables from inside a function <p>So I have a main function (foo) that recursively calls two other functions (step1 &amp; step2). foo will add a1 to a2 a <code>count</code> amount of times and then return (a1, a2). How can I print the variables count, a1, and a2 at each step?</p> <pre><code>-- adds a1 to a2...
<p>You have to change <code>foo</code> and make it operate in the <code>IO</code> monad. Effectively this "tags" the function as being impure (i.e. it has side effect, such as printing on <code>stdout</code>) which allows it to call functions such as <code>print</code>. Here's an example:</p> <pre><code>foo :: Integer...
Is it possible to feed a database table from a XML file? <p>We have some (stable) data that is saved in some generic database (database that contains a database structure and its data). To be used, this data must be re-written. Currently, we have an application that export this data to XML files to some very specific l...
<p>You can use SSIS to import XML files into database tables. This will work well if the xml files conform to a schema.</p> <p><a href="https://www.mssqltips.com/sqlservertip/3141/importing-xml-documents-using-sql-server-integration-services/" rel="nofollow">https://www.mssqltips.com/sqlservertip/3141/importing-xml-d...
SQL Query of 2 tables finding missing value in table 2 <p>I have 2 tables in SQL. </p> <p>-Table 1-</p> <ul> <li>Name</li> <li>ID</li> </ul> <p>-Table 2-</p> <ul> <li><p>ID</p></li> <li><p>Program</p></li> </ul> <p>Table 1 only holds a single record for each company. In table 2, there can be multiple entries for...
<pre><code>SELECT * FROM Table1 t1 LEFT JOIN Table2 t2 ON t1.id = t2.id AND t2.program = 'asdf' WHERE t2.id IS NULL </code></pre> <p>Just use an OUTER JOIN place the program requirement on the join condition and then say where a record for the Table2 doesn't exist.</p> <p>Trying to make this a lit...
Do I need a random geometry, material, or something else? - SceneKit, Swift <p>In my game, I add a new a tempLeftBox (an SCNNode with an SCNBox geometry, and an SCNMaterial) every 5 seconds or so along a straight path. The tempLeftBox has its own geometry and its own material. For each tempLeftBox that is added, the co...
<p>I assume you're instantiating instances of tempLeftBox class...</p> <p>Each instance you create, of your tempLeftBox, is unique. It's a reference type, meaning you can have many references to it, but each instance is utterly unique. Each time you make a box, create a reference to it, and set the materials to the qu...
Erased border with the scale <p>There stylized input, but the zoom in / out, they change size, it seems as if the border is lost, I can't understand what went wrong, thanks in advance.</p> <p><a href="https://codepen.io/volya/pen/EgNakz" rel="nofollow">My codepen</a></p> <p>For example, Chrome - zoom 75%</p> <p><a h...
<p>This happens because you use an absolute positioned label to <em>cover</em> its parent partially to make it appear to have a border, and when the page is zoomed, depending on how the browser calculate its position, it jumps a pixel up and down, hence sometimes fully aligns with its parent's edge.</p> <p>Update your...
Rails 4: Permitted parameter hash <p>My params are as follows:</p> <pre><code>{"utf8"=&gt;"✓", "authenticity_token"=&gt;"...", "consult_stat"=&gt; {"0"=&gt; {"employee_id"=&gt;"1", "consults"=&gt;"7", "signed"=&gt;"8"}, "1"=&gt; {"employee_id"=&gt;"2", "consults"...
<p>This is quite simple you can achieve it as </p> <pre><code>params.require(:consult_stat).permit(:employee_id,:consults,:signed) </code></pre>
AutoIT - Combo keys get stuck held down after execution? <p>I'm trying to make CTRL + Shift + X fire off a function in AutoIT, the function fires off fine but at the end of it the CTRL and SHIFT keys get stuck held down. I've tried inserting {CTRL up} and {SHIFT up} but it has had no effect.</p> <p>What's going on wit...
<p>I modified your test function below. This solution has a problem because to run the function again you will need to let go of shift and ctrl and repress them. You can remove the dll call from your code. I also disabled the ^X hotkey while the function is being called. It's just safer that way.</p> <pre><code>Func t...
Linking prebuilt static libraries ndk vs. Android source <p>I have found recently that linking prebuilt static libraries from the ndk-build is fundamentally different than from within the android source tree (mm). Why is this?</p> <pre><code> // main.cpp #include &lt;stdio.h&gt; #include "doubler.hpp" int...
<blockquote> <p>Why is this?</p> </blockquote> <p>ndk-build and the AOSP build system are two entirely different build systems that unfortunately look very similar.</p> <blockquote> <p>Ultimately, what is the correct way to link a static lib in the src tree?</p> </blockquote> <p>In the AOSP tree? Prebuilt module...
How to ge the field set values of Archetype datatype using Partial views Umbraco? <p><a href="http://i.stack.imgur.com/vUrm8.jpg" rel="nofollow">I am getting "Object reference not set to an instance of an object" exception when using the following code in Partial views section but same code working fine in Templates. D...
<p>That's a really general question. If you follow the Archetype documentation you won't have a problem getting the values.</p> <p>Two things: "Not set to an instance of an object" means that you literally have asked something that doesn't exist. I've came across this error so many times and every time was the fact th...
XSLT calling the value of the attribute from the xml <p>i have this xml and im trying to display using xslt. i am able to display the date,and the team name, but i cannot get the value of the score to display.</p> <pre><code>&lt;teamscores&gt; &lt;season year="2015"&gt; &lt;game&gt; &lt;date&...
<p>Assuming the context at that point is <code>&lt;game&gt;</code>, the correct XPath expression is <code>team1/@score</code>, i.e.</p> <pre><code>(&lt;xsl:value-of select ="team1/@score"/&gt;) </code></pre>
How to identify the Excel Sheet changed event in office js api? <p>We have an Excel office js add-in written on angular. It has different functionalities based on the sheet the user is in. When users switch the sheets of excel, how can the application know it, so it can change the UI to match the sheet's functionalitie...
<p>There isn't a sheet-changed event. However, one workaround would be to subscribe to DocumentSelectionChanged events, then check the user's active sheet each time to see if it changed.</p>
Cannot customize HERE map position listener (location) update parameters <p>I'm currently using HERE Map SDK on my android app but, I cannot change the position listener parameters like in native android LocationManager. The thing I want to do is to modify MIN_DISTANCE,MIN_TIME_INTERVAL,MAX_TIME_INTERVAL parameters in ...
<p>Under the hood, the SDK uses the shared LocationManager in the system. So please use the regular Android APIs and it should reflect to the SDK.</p>
Git Config core.autocrlf overwrite <p>I'm trying to set the <code>autocrlf</code> property to <code>false</code>. For some reason I currently having 3 such entries and I'm assuming one of them overwrites the others. Running <code>git config -l</code> returns a list with 3 <code>autocrlf</code> entries, one of them <cod...
<p>With git version 2.8 onwards, you can simply use:</p> <pre><code>git config --list --show-origin </code></pre> <p>You will see which config is set where.</p> <p>Also, see "<a href="http://stackoverflow.com/a/35670933/6309">Where do the settings in my Git configuration come from?</a>"</p> <p>It is also possible t...
PHP - Preg replace pattern to replace / or & with space or without space if necessary <p>What is the <code>preg_replace</code> pattern to replace the <code>/</code> or <code>&amp;</code> with <code>and</code> with and without space? The pattern should be able to replace all the below examples:</p> <p><p> <code>This is...
<p>Try this:</p> <pre><code>&lt;?php $text = "J/J, Y&amp; S, and U / A are names."; $result = preg_replace('~[/&amp;]~', ' and ', $text, -1); echo $result; </code></pre>
AdalSilentTokenAcquisitionException: Failed to acquire token silently as no token was found in the cache. Call method AcquireToken <p>Trying to reverse engineer this sample <a href="https://github.com/Azure-Samples/active-directory-dotnet-webapp-webapi-openidconnect-aspnetcore" rel="nofollow">app</a>. Only i have not ...
<p>I'd recommend using the <code>UserIdentifierType.UniqueId</code> as the sample <a href="https://github.com/Azure-Samples/active-directory-dotnet-webapp-webapi-openidconnect-aspnetcore/blob/master/WebApp-WebAPI-OpenIdConnect-DotNet/Controllers/TodoController.cs#L34" rel="nofollow">does</a>. Using the wrong identifier...
Stuck defining composition function in python <p>input: two functions f and g, represented as dictionaries, such that g ◦ f exists. output: dictionary that represents the function g ◦ f. example: given f = {0:’a’, 1:’b’} and g = {’a’:’apple’, ’b’:’banana’}, return {0:’apple’, 1:’banan...
<p>You need to just iterate over one dict <code>f</code>, and in the comprehension, replace the value of f with the value of <code>g</code> </p> <pre><code>f = {0:'a', 1:'b'} g = {'a':'apple', 'b': 'banana'} new_dict = {k: g[v] for k, v in f.items()} # Value of new_dict = {0: 'apple', 1: 'banana'} </code></pre>
How to set the visibility of a Tablix based on the individual values of cells? <p>I've a table that has several columns, such as firstname, lastname, position, and so forth. There's one important column called <strong>Rating</strong>. In the beginning of the year, every row has the value of <strong>Not Rated</strong>. ...
<p>Try in the tablix visibility property:</p> <pre><code>=IIF(Sum(IIF(Fields!Rating.Value&lt;&gt;"Not Rated",1,0),"DataSetName")&gt;0,False,True) </code></pre> <p>Replace <code>DataSetName</code> by the actual name of yours.</p> <p>Let me know if this helps.</p>
go test coverprofile cannot find package <p>When I try the following</p> <pre><code>go test -coverprofile=coverage.out </code></pre> <p>I get this coverage.out:</p> <pre><code>mode: set _/Users/gert/Desktop/httx/auth.go:10.66,11.54 1 0 _/Users/gert/Desktop/httx/auth.go:11.54,13.89 2 0 _/Users/gert/Desktop/httx/auth....
<p>Your package <code>/Users/gert/Desktop/httx/</code> is outside of your <code>$GOPATH</code> which is <code>/Users/gert/go</code>. Move the <code>httx</code> package somewhere under your <code>$GOPATH</code> and it will work fine. You could move it to <code>/Users/gert/go/src/httx</code> or probably something like <c...
How do I create an oval around text in CSS? <p>I need to create the image below using css. <br> <a href="http://i.stack.imgur.com/xpr1R.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/xpr1R.jpg" alt="enter image description here"></a> But this is what I get<br> <a href="http://i.stack.imgur.com/MVWGX.png" rel="n...
<p>that would change the height of your box and align it center</p> <pre><code> .trending-button1{ border-radius: 25px; border: 3px solid #fff; padding: 20px; width: 200px; max-height: 20px; margin:0 auto; } </code></pre>
Erlang: DRYing up string+binary concatenation <p>I am currently forming strings from strings and binaries like this:</p> <pre><code>X = string:join(io_lib:format("~s~s~s", ["something1", "something2",&lt;&lt;"something3"&gt;&gt;]), "") %X is now something1something2something3 </code></pre> <p>This seems painful and m...
<p>I'm confused as to why you need the call to <code>io_lib:format</code> at all. It's not doing any work in this case.</p> <pre><code>string:join(["something1","something2","something3"], ""). </code></pre> <p>Would give you the same result. You can simplify even further if there's really no separator character (and...
Why a windowed application doesn't show in chroot? <p>I have followed all of the instructions on this page to try and get a graphical program running from inside a chrooted environment: <a href="https://help.ubuntu.com/community/BasicChroot" rel="nofollow">https://help.ubuntu.com/community/BasicChroot</a></p> <p>The o...
<p>The X server is also a daemon: it listens on a TCP port (and also on a Unix socket), and client applications are interacting with it on this way. It is because the X is theoretically a networked thing: it is possible to run remote X apps as part of the very core protocol.</p> <p>This requires also a little bit of a...
maven artifact copy folder from bundle zip <p>Maven 3. I have following bundle zip artifact. there are resources inside the zip i want to unzip and copy those resources into project resource dir.</p> <p>I created this artifact using maven-assembly-plugin</p> <p>any help appreciated.</p> <pre><code>&lt;dependency&gt;...
<p>You can use the <a href="http://maven.apache.org/plugins/maven-dependency-plugin/examples/unpacking-artifacts.html" rel="nofollow">maven dependency unpack goal</a>. For Eg:</p> <pre><code>&lt;project&gt; [...] &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.p...
Implementing a ReaderWriter class based upon separate stateful Reader and Writer bases <p>Suppose I have two classes...</p> <p>We can call the first <code>FooReader</code> and it looks something like this:</p> <pre><code>class FooReader { public: FooReader(const Foo* const foo) : m_foo(foo) { } FooD...
<p>CRTP.</p> <pre><code>template&lt;class Storage&gt; class FooReaderImpl { public: FooData readFooDataAndAdvance() { // the point here is that the algorithm is stateful // and relies upon the m_offset member return get_storage()-&gt;m_foo[get_storage()-&gt;m_offset++]; } private: Storage const* get_...
Quaternions in Three.Js - Clamp object to landscape <p>I created a small tank game a year ago, as proof of concept using three.js and WebSockets. However in the later versions of Three.js that way to do quaternions has changed. I cannot find any example code of how to do it in the latest version. This is my old code:</...
<p>I found the answer. If anyone else have problems porting quarternions from older Three.JS to later, this is how it's done (version 81):</p> <p>replace:</p> <pre><code>tankmesh.quaternion = q2; </code></pre> <p>with:</p> <pre><code>tankmesh.setRotationFromQuaternion(q2); </code></pre>
How to get max value of a column from two tables <p>I have one table named 'posts' and one table named 'threads'. Both have the column called 'total_id' which is an integer. Now, how to get from those two tables the 1 highest value (max) in the 'total_id' column? (MySQL)</p>
<p>Though it's not really very clear what's your expected result but in case you want max of <code>total_id</code> including both tables data? If yes, then you can do a <code>UNION</code> and then get the highest value like</p> <pre><code>select max(total_id) as max_total_id from ( select total_id from posts union sel...
Input javascript code not working <p>So what i want is when i click on deluxe i want all the options to be checked so fog lights leather and DVD but it doesn't work.. I have no clue what is wrong with my jquery :/ Please help and also when i click on an option let's say i want fog lights it will automaticaly check the ...
<p>There are many errors in the code, like clousures and selectors at JQuery function. Try this:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function()...
C# Beginner, Don't understand output? <p>Decided to teach myself c# so I'm currently going through tutorials. Found this piece of code but I don't understand why the output is 4? The answer is probably staring at me in the face but I can't seem to get it.</p> <pre><code>namespace Practice{ class DataTypeApplication { ...
<p>sizeof(..) function returns the size of a type in number of bytes. In this case, the size of an integer is 4 bytes. Although uncommon, the size of a given type may differ across computing architectures, so to say an integer is always 4 bytes would be false. </p>
WP_Query Order Posts By Custom Meta Value Array Not in Codex <p>I have a different sort of post order I'm trying to return that I can't find anywhere with an answer. I'm using a wp_query to try to order posts by a list of meta values. However non of the standard orderby options do what I'm trying to achieve.</p> <p>...
<p>Learned something new myself trying to solve this for you :)</p> <p>Apparently as of WP 3.5, you can specify an 'orderby' parameter of 'post__in' when creating your WP_Query</p> <p><a href="https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters" rel="nofollow">https://codex.wordpress.org...
HTA Gamepad API (or alternatives) <p>I am building an game launcher app (similar to Steam Big Picture) using HTA and I'd like to be able to control this app using my X360 controller. One way to do it is to use Xpadder and emulate keyboard presses, but since MS Edge has a native support of Gamepad API, I wonder whether ...
<p>Judging by <a href="http://stackoverflow.com/a/30992020/692942">this answer</a> to a <a href="http://stackoverflow.com/q/30975195/692942">similar-<em>ish</em> question</a>...</p> <blockquote> <p><em>I suspect that an HTA would work in Windows 10, but only in IE9 mode. It would be a major shift if Microsoft built ...
Creating XML document from SOAP Message vs Document Builder[Source for both is Input Stream] <p>I am basically trying to check for failures in a service by checking the response object I have a response from a SOAP service and i expect it to be like this: Following is the input stream</p> <pre><code>&lt;?xml version="...
<p><code>message.getSOAPBody().extractContentAsDocument();</code></p> <p>Here you are asking to return everything within <code>&lt;S:Body&gt;</code> tag of the SOAP response. If you want to get the envelope, <code> SOAPPart sp = message.getSOAPPart(); SOAPEnvelope se = sp.getEnvelope(); </code></p> <p>as mentioned in...
Why Visual Studio do not support variables for array size? <p>So this was a problem statement from CodeLeet to find the Longest Palindromic Substring.</p> <p>In the codeleet interface this solution works:</p> <pre><code>class Solution { public: string longestPalindrome(string s) { int len = s.size(); i...
<p>Because variable length arrays (array declarations that use non-<code>constexpr</code> variables) are a C99 feature, <em>not</em> a C++ feature. No version of C++ offers them, and no version of Visual Studio provides that particular C99 feature.</p> <p>If your code compiles on other C++ compilers, then that is beca...
onProgressChanged doesnot hit 100% on heavy sites <p><strong>Chrome/WebView version: 53 and 54 beta</strong> </p> <p>Example URL: bbc.com , cnn.com</p> <p><strong>Steps to reproduce the problem:</strong></p> <ol> <li>launch a webview based application with chrome / webview 53 installed</li> <li>load bbc.com or cnn.c...
<p>Nevermind. Chromium accpected my bug. </p> <p><a href="https://bugs.chromium.org/p/chromium/issues/detail?id=650781" rel="nofollow">https://bugs.chromium.org/p/chromium/issues/detail?id=650781</a></p>
Is this ordering guaranteed? <p>Is this script:</p> <pre><code>local data = { { "data1", "1"}, { "data5", "2"}, { "3453453", "3"}, { "zzz", "4"}, { "222", "5"}, { "lol", "6"}, { "asdf", "7"}, { "hello", "8"}, } local function test() local count = #data for i = 1, count...
<blockquote> <p>I read something about pairs VS ipairs not returning a fixed order of results</p> </blockquote> <p><code>ipairs</code> is an iterator of the array elements of a table, <em>in order</em> from first to last. "Array elements" being defined as the members of a table with keys that are numeric values on t...
Drools- Rule Compilation error name cannot be resolved to a variable Syntax error, insert ";" to complete Statement <p>I'm trying to build a simple rule on KIE Workbench/Drools in a new DRL file and I keep getting the following error on build &amp; deploy</p> <p><strong><em>Rule Compilation error name cannot be resolv...
<p>I found the answer- if helpful to anyone in the future- here's the code that ended up working for me. Needed semicolons and slightly different syntax. </p> <pre><code>package demo.people.peopleproject import demo.people.peopleproject.Person; rule 'is18rule' when p: Person(age &gt;= 18) then ...
How may I connect Google Dataproc cluster from Sparklyr? <p>I'm new to Spark and GCP. I've tried to connect to it with</p> <pre><code>sc &lt;- spark_connect(master = "IP address") </code></pre> <p>but it obviously couldn't work (e.g. there is no authentication).</p> <p>How should I do that? Is it possible to connect...
<p>There are two issues with connecting to Spark on Dataproc from outside a cluster: Configuration and Network access. It is generally somewhat difficult and not fully supported, So I would recommend using sparklyr inside the cluster.</p> <h2>Configuration</h2> <p>Google Cloud Dataproc runs Spark on Hadoop YARN. You ...
Aurelia view inheritance gives odd behavior (typescript skeleton) <p>I recently started trying out Aurelia (I'm new to Javascript and used to typed languages so I'm working from the typescript skeleton), and I ran into some odd issues with view inheritance that I don't understand.</p> <p>I wanted to create two views w...
<p>It's not necessarily a bug in Aurelia, more a general problem with JavaScript. But yes, inheritance is known to be problematic with custom elements and it is not recommended.</p> <p>Aurelia strongly favors the composition over inheritance.</p> <p>If you need to share common code between two or more ViewModels, try...
Test Requests for Django Rest Framework aren't parsable by its own Request class <p>I'm writing an endpoint to receive and parse <a href="https://developer.github.com/webhooks/#example-delivery" rel="nofollow">GitHub Webhook payloads</a> using Django Rest Framework 3. In order to match the payload specification, I'm wr...
<p>"Yo dawg, I heard you like Request, cos' you put a Request inside a Request" XD</p> <p>I'd do it like this:</p> <pre><code>from rest_framework.test import APIClient client = APIClient() response = client.post('/', {'github': 'payload'}, format='json') self.assertEqual(response.data, {'github': 'payload'}) # ...or...
Disqus comments don't work in a polymer custom element <p>I don't know how to make a disqus comments code to work inside of my custom elements. </p> <h3>Structure of my site:<br></h3> <p>| <code>index.html</code><br> --------\ <code>my-app.html</code> (custom element)<br> ----------------\ <code>my-testView1.html</c...
<p>The error is due to the fact that the <em>disqus</em> library can't find the <code>&lt;div id="disqus_thread"&gt;</code> element.</p> <p>It's because this element is inside a Shadow DOM (and that's why it works fine in Firefox which doesn't implement real Shadow DOM).</p> <p>3 possible solutions:</p> <ol> <li>Don...
Singleton Collection To Multiple Object Collection <p>So I was initially using a singleton list to pass data to Google Cloud API like this:</p> <pre><code>inputInput.setCsvInstance(Collections.&lt;Object&gt;singletonList("Ear")); </code></pre> <p>How can I change the <code>singletonList</code> to send multiple object...
<p>A singleton list has only 1 element by definition. If you want a list with multiple elements, you can use <code>Arrays.asList()</code>:</p> <pre><code>inputInput.setCsvInstance(Arrays.asList("5.656346", "2.43485744", ...)); </code></pre>
Custom MVC route appends angular http request url to current url in IE <p>I'm running into a bit of a snag with some custom routing I did. We have these custom routes that handle product perma-links, and I have Angular in the background doing requests to the server for routes that aren't perma-links. This works fine an...
<p>Okay so I figured out what the issue was, if you use location.href, in this case IE isn't smart enough to redo the url after the hostname, so it ends up just appending what you had to the end of the url, so changing it to location.pathname will fix the bug because it tells IE to explicitly redo the url after the hos...
(autoit)sending random words from text file but it gives errors <p>hello im trying to read and write (send) text from words text file but it gives me bunch of errors i'm kinda newbie please be gentle to me thank you so much.</p> <pre><code>$File = FileReadToArray("words.txt") $RandomWords = $File[Random(0, UBound($Fil...
<p>I'm certain there are better ways of doing it but if you're wanting to send one random line from a text file, this should work. </p> <pre><code>#include &lt;file.au3&gt; $File = "words.txt" $Lines = _FileCountLines($File) $word = FileReadLine($File, Random(0, $Lines)) Run("notepad.exe") WinWaitActive("Untitled - ...
Selenium -Java runtime error <p>I have written a test case and don't see any compilation errors but when I run the test case the browser opens and it suddenly gets closed within a second by throwing this error:</p> <pre><code>**Starting ChromeDriver 2.23.409699 (49b0fa931cda1caad0ae15b7d1b68004acd05129) on port 7788 ...
<p>There is a mistake in your third line: the path should be to <strong>Chromedriver.exe</strong> and not <strong>chrome.driver.exe</strong></p> <p>Also you don't need to include the 1st two lines, just use:</p> <pre><code>System.setProperty("WebDriver.Chrome.driver", "C : \\desktop\\Chromedriver.exe"); </code></pre>...
Add new column from conditional logic in Octave <p>Let's say I have this vector (or matrix)</p> <pre><code> a = [1; 2; 3] </code></pre> <p>it is a 3x1 </p> <p>1</p> <p>2</p> <p>3</p> <p>How would I add another column based off conditional logic?</p> <p>Say I want the second column to be 1 or 0 depending on if th...
<p>You can either use <code>[]</code> to implicitly horizontally concatenate the two </p> <pre><code>b = [a, a &gt;= 2]; % Implicit horizontal concatenation </code></pre> <p>Or you can use <code>horzcat</code> or <code>cat</code> to accomplish the same thing</p> <pre><code>b = horzcat(a, a &gt;= 2); %...
Infix to prefix works but not for power (caret) function expressions? <p>I have a function that's taking infix expressions and converting them to prefix expressions. Here's my code:</p> <pre><code>string infixToPrefix(string expression) { stack&lt;char&gt; S; //holds operators stack&lt;char&gt;output; //displa...
<p>SOLVED. My professor had coded that the isp of ^ = 3 and icp of ^ = 3, whereas when I changed the isp to 4 it started to work. I will take this up with my professor.</p>
argparse: how to parse a single string argument OR a file listing many arguments? <p>I have a use case where I'd like the user to be able to provide, as an argument to argparse, EITHER a single string OR a filename where each line has a string.</p> <p>Assume the user launches <code>./myscript.py -i foobar</code></p> ...
<p>A way would be:</p> <p>Let's say that you have created a parser like this:</p> <pre><code>parser.add_argument('-i', help='...', type=function) </code></pre> <p>Where <code>type</code> points to the <code>function</code> which will be an outer function that evaluates the ...
trac wiki suddenly failing on logins <p>I have a trac wiki that seems to have decided not to allow logins. Selecting "login" does not even get users to the text boxes that allow them to enter their login details. Instead there seems to be a timeout, after which the browser presents the following :</p> <pre><code>Trace...
<p>I fixed this, and figured out a better way to proceed in future. I made a copy of the database :</p> <pre><code>$ cp /var/www/trac/db/trac.db ./new.db </code></pre> <p>I then made a list of the tables in the database by issuing the .schema command and parsing it :</p> <pre><code>$ echo .schema | sqlite3 new.db | ...
Why WordPress image link in not appearing after activating SSL? <p>I've successfully added SSL on my WordPress website and it's every URL is working well with https URL but there seems all images is missing. In dashboard, all images URL is converted to https URL but in front-end they are not showing any URL it just see...
<p>This is likely because the URLs to the images are now http, and may be being blocked by browser security settings. There's a handy plugin I often use to help sort out issues like this called Really Simple SSL:</p> <p><a href="https://wordpress.org/plugins/really-simple-ssl/" rel="nofollow">https://wordpress.org/plu...
open pdf after downloaded it <p>I use this code to download pdf </p> <pre><code>downloadManager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE); Uri uri = Uri.parse(url); DownloadManager.Request request = new DownloadManager...
<p>To download the document to external storage</p> <pre><code>DownloadManager.Request r = new DownloadManager.Request(Uri.parse(document_url)); // This puts the downloaded document in the Download directory r.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "my_document.pdf"); r.setNotificationVi...
correct implementation of plupdate <p>i´m implementing this upload library, maybe not much people use this, but maybe somebody can help me to figure how to solve this.</p> <p>So i'm already uploading, the thing is that i want to implement the "uploader" objet, like</p> <pre><code>upload.bind(); </code></pre> <p>i w...
<p>i want to answer this question, i found a solution.</p> <p>so all these objects are events.</p> <p>here you have a complete example of how to implement them.</p> <pre><code>uploader = $("#uploader").plupload({ // General settings runtimes: 'html5,html4', url: objMaterial.geturl(), ...
Loop is not vectorized when variable extent is used <p>Version A code is not vectorized while version B code is vectorized.</p> <p>How to make version A vectorize and keep the variable extents (without using literal extents)?</p> <p>The nested loop is for multiplication with broadcasting as in numpy library of python...
<p>In order to test dependencies between memory accesses within and across loop iterations, the array indices (in the polyhedral model of compilation), should have the form <code>i*c0 + j*c1 + k*c2 + ...</code>, where <code>i, j, k ...</code> are loop counters and <code>c0, c1, c2 ...</code> are integer constants.</p> ...
Rails - ArgumentError in BookingsController#create, Can't multiply a Money by a NilClass's value <p>I'm getting the error code above in my Rails app when attempting to implement a payment/reservation process which allows a user to be able to book &amp; pay for spaces on an event. Previously my code would only allow fo...
<p>In <code>BookingsController#create</code>, on you call <code>@event.bookings.new(bookings_params)</code>. This creates a new <code>Booking</code> <em>object</em> in memory, but it doesn't yet create a <code>Booking</code> <em>record</em> in the database. It's always perfectly valid to call <code>Model.new()</code> ...
R percentage of counts from a data.frame <p>I need to calculate the percentage of counts of variables and put it in a vector</p> <p>I have a frame as follows:</p> <pre><code>group &lt;- c('A','A','A','B','B','B') hight &lt;- c('tall','tall','short','tall','short','short') group hight A tall A tall A...
<p>If we are using <code>dplyr/tidyr</code>, the way to get the expected is</p> <pre><code>library(dplyr) library(tidyr) df %&gt;% count(group, hight) %&gt;% mutate(percent = n/sum(n)) %&gt;% select(-n) %&gt;% spread(hight, percent) # group short tall # &lt;fctr&gt; &lt;dbl&gt; ...
Query on Date only with Spring Boot Data JPA / Java 8 Instant? <p>I have a Spring boot 1.4.x application that uses the starter jpa in combination with H2/Postgresql. I have an entity that stores a date as an Instant (with Instant.now(), based on <a href="http://stackoverflow.com/questions/32437550/java-8-whats-the-diff...
<p>There are two approaches:</p> <p>1st one:</p> <pre><code>List&lt;Orders&gt; findBySaleTimeBetween(DateTime start, DateTime end); </code></pre> <p>2nd one:</p> <pre><code>List&lt;Orders&gt; findBySaleTime(DateTime date); </code></pre> <p>It's worth trying to save dates rounded as much as possible, so if you only...