input
stringlengths
51
42.3k
output
stringlengths
18
55k
Import Class into another Class Component in angular2 <p>I have repeated code in my project.</p> <p>I separate it from other component to make it much easier and dynamic when changing some value. Unluckily, It doesn't work with me.</p> <p>Here's what I have</p> <p><code>Repeated Code: form.ts</code></p> <pre><code>...
<p>Now you need to initialzie your form object.</p> <pre><code>export class BalanceComponent { form: Form; constructor() { this.form = new Form(); } } </code></pre> <p>If you want to share this value between components, best idea is to create service and then inject it into components.</p> <pre>...
google/cadvisor:latest image monitor container run error <p>I found the bug below on the above "devicemapper" at bugzilla.redhat.com. It let me install the "device-mapper-persistent-data" package. However, when I installed it, I received the following error.</p> <p>I tried to use <a href="https://github.com/google/cad...
<p>It looks like you're hitting the issue fixed in the <a href="https://github.com/google/cadvisor/pull/1476" rel="nofollow">link</a> you mentioned. That fix has not yet been incorporated into a cAdvisor release, so it is not included when you run the docker image <code>google/cadvisor:latest</code> (assuming you didn'...
numba argument argtypes deprecated keyword <p>When i type following code :</p> <pre><code>mandel_numba = numba.jit(restype=uint32, argtypes=[float32, float32, uint32])(mandel) </code></pre> <p>and get error message </p> <pre><code> raise DeprecationError(_msg_deprecated_signature_arg.format('argtypes')) numba.errors...
<p>The error message is telling you what it expects</p> <pre><code>Signatures should be passed as the first positional argument. </code></pre> <p>So instead of</p> <pre><code>numba.jit(restype=uint32, argtypes=[float32, float32, uint32]) </code></pre> <p>They should be positional</p> <pre><code>numba.jit(uint32(fl...
Is it possible to access the DataContext of the current page of the frame? How? <p>In wpf, is it possible to access the DataContext of the current page of the frame? If YES, how?</p> <p>If NO, what should I use as replacement for frame so that I can access its DataContext?</p> <p>If something is not clear, please tel...
<p>I'm not sure that it will work for you, because I still don't understand the relationship between view models and models in your architecure, but try to use this idea:</p> <p>1). My Window1's xaml has following content :</p> <pre><code>&lt;Grid&gt; &lt;Frame Panel.ZIndex="1" x:Name="MainFrame...
Typescript: Date operations From Javascript to typescript <p>I'm passing a code from Javascript to TypeScript, but I have a problem in a code, where I do an operation with Dates:</p> <pre><code>function(d) { let di = new Date(d); let df = new Date(d); df.setMonth(d.getMonth() + 1); let dl = +new Date(+...
<p><code>di</code> and <code>df</code> are already dates. You're trying to use them as argument to <code>Date</code>, i.e. <code>new Date(new Date)</code>. That's a) rather nonsensical and b) where your error comes from (<code>new Date</code> accepts an integer or string as argument, not a <code>Date</code>).</p> <p>G...
CSS Highlight list entries <p>I've created a simple list as follows :</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-css lang-css prettyprint-override"><code>.menu ul { font-size:20px; margin-left:0; li...
<p><a href="https://jsfiddle.net/hba5jgxb/1/">https://jsfiddle.net/hba5jgxb/1/</a></p> <p>Wrap the text of each item in a tag, then apply CSS hover for it:</p> <pre><code>&lt;li class='menu'&gt;&lt;span class="icon-indent"&gt;&lt;/span&gt; &lt;span class="item-text"&gt;Learn HTML&lt;/span&gt; &lt;/li&gt; .item-tex...
JDK 1.7 jarsigner with https tsa no longer works <p>It seems like Thawte root certificates in JDK 1.7.0_80 is revoked. <a href="https://www.thawte.com/roots/retired.html" rel="nofollow">https://www.thawte.com/roots/retired.html</a></p> <p>Using the 7u80 jarsigner no longer works and it worked fine just a few days ago....
<p>I also only experienced this issue in the last 12 hours. This issue is not to do with certificates but rather to do with the protocol used to communicate with the timestamp server. This will work with JDK7, however you need to add the following to the jarsigner command</p> <pre><code>-J-Dhttps.protocols=TLSv1.2 </c...
How to serialize armadillo's vector <p>How can I serialize <code>arma::Col</code>? Below are a MWE and the error output.</p> <p><strong>MWE:</strong></p> <pre><code>#include &lt;boost/mpi/environment.hpp&gt; #include &lt;boost/mpi/communicator.hpp&gt; #include &lt;iostream&gt; #include "armadillo" namespace mpi = bo...
<p>The real crux of the issue here is that you want to add a <code>serialize()</code> member function to the various Armadillo objects, but that doesn't appear to be possible... except that thanks to a clever use of the preprocessor in Armadillo, it is!</p> <p>Take a look at <code>Mat_bones.hpp</code> and <code>Col_bo...
Radio Button layout not appearing with listview/adapter in dialog <p>I'm fairly new to Android but am trying my hardest to get a handle on it. I've been researching this most of the day and I've concluded that there must be an issue with my actual adapter. </p> <p>Unfortunately when I load up my dialog box I don't get...
<p>Well it's fixed what I wanted and I think it came down to the adapter failing. Now I'm aware my adapter does not have a ViewHolder but it has a limit amount of options so it's ok for now. </p> <p>First I needed a class that allowed a CheckableLinearLayout. This is a special type of LinearLayout that allows sections...
Accessing a path which case sensitive without writing so <p>I would like to know whether it possible to access linux path like: <code>/home/dan/CaseSensitivE/test.txt</code></p> <p>In a way we write it as <code>/home/dan/casesensitive/test.txt</code> and it goes to the right place, means python consider paths as not c...
<p>As Klaus said, the simple answer is no. You could, however, take a more laborious route, and enumerate all folders/files in your top directory (<code>os.path, glob</code>), convert to lower case (<code>string.lower</code>), test equality, step one level down, etc.</p> <p>This works for me:</p> <pre><code>import os...
Remove duplicate words from address <p>I'm getting address using Geocoder. Sometimes I get city or postcode twice. I want to remove these duplicate words to make the address more acceptable. Is there any way to do this? I searched for removing duplicate words from string but only got one good <a href="http://stackoverf...
<p>//call method like</p> <pre><code> String Address = "Street no 0360 DH Block(Newtown), Action Area I, NewTown NewTown, West Bengal 700156 NewTown 700156 India"; String output = RemoveDuplicateWords(Address.toLowerCase()); </code></pre> <p>// Method for remove duplicate words</p> <pre><code>public String Re...
Drupal 8 - Getting dynamic content with view data into a page/template <p>I'm new to Drupal and Drupal 8 and I want to add areas(blocks?) that I can easily add to a page that pulls in and has access to selected view data and fields. What's the easiest way to get this done? It seems like it should be something that's ea...
<p>Although the question is not so specific I would recommend to start from here <a href="https://www.drupal.org/docs/8/understanding-drupal/overview" rel="nofollow">Understanding Drupal > Overview > The Drupal flow</a> and then move to Drupal <a href="https://www.drupal.org/docs/7/understanding-drupal/glossary" rel="n...
Trying to Migrate project from BuildForge to Jenkins <p>I have to migrate a project from Build-Forge to Jenkins.</p> <p>As a project can be created in Jenkins from <code>config.xml</code> using <code>Jenkins CLI</code>. Here, I am trying to build a <code>config.xml</code> using <code>Groovy scripts</code> accessing th...
<p>You can export the project by executing command ".export". It will save the project into an xml.</p> <p>You can also use buildforge apis.</p>
Spring Integration DSL: wont execute other components after executing routeToRecipients <p>Upon running the application, the flow stops at routeToRecipients and other components were not executed. (See the inline comments in the code below) No error occured.</p> <p>But when I remove the routeToRecipients(), other comp...
<p>A router does not have an output channel - it only sends messages to the recipients.</p> <p>You can either put a publish/subscribe channel before the router with the router being one subscriber and the remaining flow the second subscriber.</p> <p>Or add channel5 and start the remaining flow (in a new flow) with th...
sas macro string-comparison does not equate in the same way <p>This macro string-comparison works in misterious ways for me. The obvious to me would be that the result of <code>%test1(intotest)</code> and <code>%test2(intotest)</code> are equal.</p> <pre><code>%macro test1(intotest=); %str(&amp;intotest) = %str("b...
<p>The SAS language is designed to process data in data sets (and other sources). The macro language is designed to process text and generate SAS language code.</p> <p>In your first example, you are successfully using the macro language to generate SAS code <code>fromtable = "b";</code> and then that SAS code evaluat...
Adding constants to be used across node modules <p>I have a constants.js file I am using with my node application with the content being a list of exports like so:</p> <pre><code>exports.SESSION_COOKIE_NAME = 'myapp.sid'; exports.SESSION_STORE_DB_PATH = 'mongodb://someip:someport'; exports.API_GATEWAY_URL = 'http://so...
<p>Like mentioned in the comments, apart from some of these looking more like configuration settings than constants.. You could also simplify your exports a tad.</p> <p>Instead of having lots of exports.*,</p> <pre><code>module.exports = { SESSION_COOKIE_NAME: 'myapp.sid', SESSION_STORE_DB_PATH: 'mongodb://some...
Is html needed when making an Android app? <p>Is html needed when making an Android app? For example, the game I play there are buildings which you can construct and upgrade.Now is this done by html?</p>
<p>Well, short answer - no.</p> <p>Most android apps are developed using Java as the programming language, with a mark-up language which could be comparable to HTML (but is <strong>not</strong> HTML) to build the basic UI structure of most screens.</p> <p>Certain aspects of HTML are still used in Android apps, for ex...
Facebook key hash doesn't match any stored key hashes <p>I have generated the key hash of my app by cmd but when I try to login, I obtain the message of "Facebook key hash doesn't match any stored key hashes".</p> <p>I have executed this code to see the key in logs and I have noticed they key is different depending ev...
<p>To get Hash of your Build or Release APK, just press the Facebook login button while connected to LogCat, they will send you Hash key in response, copy that from LogCat and add to your Facebook app settings.</p> <p>This way you will never get "Facebook key hash doesn't match any stored key hashes" error.</p>
Open all pdf files in folder and save as resized jpgs in other folder <p>I have a script that checks if a image is wider than 250px and if it is taller than 300px and if any of these statements are true it should resize them to fit within both of these values. Then it should save them as jpgs with the extension large t...
<p>opening PDF files is a little bit difficult. As I descriped in my request couple of weeks ago: <a href="http://stackoverflow.com/questions/38991330/photoshop-javascript-options-to-open-a-pdf-as-smart-object">Photoshop JavaScript: options to open a PDF as smart object</a></p> <p>My workarround is to use an action (...
How to get only changed value on Firebase Database? <p>How to get only changed value on Firebase Database? Because every time I changed a value on <code>dir</code>, ex: </p> <pre><code>/ some_user ~ id ~ name / data ~ order_id ~ order_name &lt;&lt;= Changed in here </code></pre> <p>But when I get the changed...
<p>Attach the listener to the order_name reference.</p> <pre><code>var user = "Alan"; var ref = firebase.database().ref(user + "/data/order_name"); ref.on("value", function(snapshot) { console.log(snapshot.val()); }); </code></pre>
How to allow one directive to be used from many inputs in Angular Material? <p>I have the following template:</p> <pre><code>&lt;md-input-container class="new-paragraph addon-menu"&gt; &lt;label&gt;Post text&lt;/label&gt; &lt;textarea ng-model="user.post" rows="3"&gt;&lt;/textarea&gt; &lt;/md-input-container&g...
<p>You don't need directive for this.</p> <p>If I understand your problem this will probably be enougth :</p> <p>controller : </p> <pre><code>$scope.injectVariableAtCursor = function(templateVariable) { $scope.user.post = templateVariable; }; </code></pre> <p>Here is an example of what you want :</p> <p><div clas...
what is the diffrence between factory and controller? <p>I am developing an AngularJs app . when I search about some controller samples like firebase Auth </p> <pre><code> .factory("Auth", function($firebaseAuth) { var usersRef = new Firebase("https//&lt;YOUR-FIREBASE-APP&gt;.firebaseio.com/users"); ...
<p>A factory is used is here because you could use the same Firebase Auth for multiple controllers. Instead, if you are hardcoding this into a specific controller, you would have to do the same for each and every other controllers which need the Auth.(which is bad). Also, it is the cliche that a new feature is added as...
React content change based on selected menu with caching <p>I have this code.</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>class Component { state = { selecte...
<p>One way to handle this would be to use <code>display: none</code> on your elements and keeping track of which elements have already been displayed. This way redux will always keep the rendered component in the DOM and only update the <code>display</code> value.</p> <pre><code>class Component { state = { sele...
How do I decode a Double using NSCoder, NSObject and Swift 3 for iOS <p>I am trying to store and load an object from persistent storage in Xcode 8.0 using Swift.</p> <p>I have followed the <a href="https://developer.apple.com/library/content/referencelibrary/GettingStarted/DevelopiOSAppsSwift/" rel="nofollow">Start De...
<p>Try to load the property as an optional:</p> <pre><code>let amount = aDecoder.decodeObject(forKey: PropertyKey.amountKey) as Double? </code></pre> <p>Also, in order to get the property from the storage you must save it first. If it is not saved yet, you should handle the case it's <code>nil</code>.</p>
Android notificationcompat sound/vibration not working <p>I've spent my last 2 hours trying to figure our why my notification sent from FireBase doesn't make any sound or vibration.</p> <p>I have looked on many topics about this problem and tried different combinations with <code>.setDefaults</code> <code>.setVibrate(...
<p><strong>You aren't sending sound flag from your server</strong> maybe that's why you aren't getting notification sound. Please try adding:</p> <pre><code>sound = "default" </code></pre> <p>This will probably get you the sound of notification. </p> <p>Have a look at this: </p> <p><a href="https://firebase.google....
Files exclusion (custom and transient) from build <p>I have many C++ (<code>Google Test</code>) source files in my <code>Visual Studio</code>solution and I want to have the possibility to keep only a few for the build (to focus on the problem), but also to come back quick enough (two times by day) to the initial confi...
<p>You can control this with a cmake variable. </p> <pre><code>option(BUILD_TESTS "builds test cpp files" ON) </code></pre> <p>This adds an option for your cmake file. It defaults in this case to ON you can change that though. Now lets get on:</p> <pre><code>if(BUILD_TESTS) set(TEST_CPP_FILES test1.cpp test2.cpp...
Confusing multi threading example <pre><code>class ThreadDemo extends Thread { private Thread t; private String threadName; ThreadDemo( String name) { threadName = name; System.out.println("Creating " + threadName ); } public void run() { System.out.println("Running " + threadName )...
<p>I'm making this an answer because I feel we both need to <em>explain</em> <strong>what's so wrong the example</strong> (<em>not only does it show a bad example of MultiThreading, it also exposes a lack of understanding of Object-Oriented Programming</em>) AND we need to <strong>put you back on the right learning pat...
How to write a C function that removes a portion of a string? <p>I want to write a C function that removes a portion of a string for a given index range.</p> <p>For example, if the input string is "ABCDEFGHIJK" and the start index is 2 and the end index is 5 then the output should be: "ABGHIJK".</p> <p>I am attemptin...
<p>I would go with using memmove as in the 2nd approach:</p> <pre><code>void remove_portion(char string[], int start, int end) { if (start&gt;=0 &amp;&amp; end&gt;=start &amp;&amp; start&lt;strlen(string) &amp;&amp; end&lt;strlen(string)) { // some more sanity checking (EDIT added later) memmove(string+...
Compile-time check that all array values are filled <p>This:</p> <pre><code>constexpr const std::array&lt;int, 3&gt; {{ 0, 1 }}; </code></pre> <p>compiles OK.</p> <p>But how to check (in compile-time) that whole array is filled? May be some <code>static_assert</code>?</p>
<p>You could write a wrapper to generate the array for you and carry out the check:</p> <pre><code>template &lt;typename T, std::size_t N, typename... Ts&gt; std::array&lt;T, N&gt; make_array (Ts&amp;&amp;... ts) { static_assert(N == sizeof...(Ts), "Must supply N arguments"); return {{ std::forward&lt;Ts&gt;(t...
expected unqualified id before "." token <p>I've been reading a book called c++ for dummies (7th edition) and I'm currently going through the chapter about classes. I decided to try and write my own program using classes and it looked easier than I found it. I'm having this persistent problem ('expected unqualified id ...
<p>You need to use <code>this</code> i.e.</p> <p>change</p> <pre><code> savings.pin = pin; </code></pre> <p>to</p> <pre><code> this-&gt;pin = pin; </code></pre>
How to find most frequent string in List of strings <p>I have a list of strings (<code>List[String]</code>) and I want to obtain the most frequent string from this list:</p> <pre><code>val list1 = List('a','a','0','b','b','a') </code></pre> <p>The answer should be:</p> <pre><code>freq_list1 = a </code></pre> <p>I w...
<pre><code>list1.groupBy(identity).mapValues(_.size).maxBy(_._2)._1 </code></pre> <p>EDIT: See comment below, can be made shorter by using <code>maxBy(_._2.size)</code> without mapping beforehand, thanks @kawty</p>
Python usage of regular expressions <p>How can I extract <em>string1#string2</em> from the bellow line?</p> <pre><code>&lt;![CDATA[&lt;html&gt;&lt;body&gt;&lt;p style="margin:0;"&gt;string1#string2&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;]]&gt; </code></pre> <p>The # character and the structure of the line is always the s...
<p>I would like to refer you to this <a href="http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags">gem</a>:</p> <p>In synthesis a regex is not the appropriate tool for this job<br> Also have you tried an <a href="https://docs.python.org/3/library/xml.etree.elementtree.html...
Searching for strings within file names using PowerShell <p>I've just started a new job, and we write reports for clients that are helpful for me to read to learn the ropes. I was trying to use PowerShell to pipe the titles into a text file, but unfortunately the company only standardised titles recently. This means th...
<p>Try this:</p> <pre><code>Get-ChildItem -Path "your path here" -recurse -include *.doc | select-String "report" | out-file P:\report.txt </code></pre>
Access hasMany/belongsTo relationship data with JSONAPI <p>Can you help me, please?</p> <p>I have a model Channel, a model Feature, a model ChannelApplication and a model ApplicationFeature. And I defined them like this:</p> <p>My model <code>channel.js</code>:</p> <pre><code>import Model from 'ember-data/model'; im...
<p>Your response is not correct <code>JSONAPI</code>. Also its not clear: Does a <code>channel-application</code> has one or multiple <code>channel</code>s?</p> <p>Becuase <code>channel: belongsTo('channel'),</code> means it has one <code>channel</code> but then you don't should loop through them like <code>{{#each ch...
Removing comments from code character by character [Java] <p>I need to remove comments from code, but in this case I'll have to do it without using; System.out.println(sourceCode.replaceAll("//.<em>|/\</em>((.|\n)(?!=<em>/))+\</em>/", ""));</p> <p>The program needs to check the code character by character to look for...
<p>This is a classic problem given to new learners in Java. I would suggest to go for a simple approach as it is intended to help you practice your coding skills</p> <ol> <li>Read the java source code as a file in your program char by char.</li> <li>Search for comments beginning. In this case, there are 2, <code>/*</c...
Cast the return type of a lambda expression and sort a list with a custom comparator <p>I have a <a href="http://docs.oracle.com/javase/8/docs/api/javax/swing/tree/DefaultMutableTreeNode.html" rel="nofollow"><code>List&lt;DefaultMutableTreeNode&gt;</code></a> and want to sort the list by a property of the <a href="http...
<p>Your question talks about "lambda method reference" but this doesn't exist: there are <a href="https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html" rel="nofollow">lambda expressions</a>, and there are <a href="https://docs.oracle.com/javase/tutorial/java/javaOO/methodreferences.html" rel="nofo...
ElasticSearch Unable to find on disk file script <p>I'm trying to perform a groovy script using Java API:</p> <pre><code>AggregationBuilders .terms(this.getName()) .field(this.getName()) .script( new Script( "year", ScriptType.FILE, "groovy", Immutabl...
<p>The Elasticsearch docker image uses different default paths, looking at the relevant <a href="https://github.com/docker-library/elasticsearch/blob/e74f9ba98e26221af4a3103d65ff519621e989d2/2.4/Dockerfile" rel="nofollow">Dockerfile</a> I can see that it has a reference to <code>/usr/share/elasticsearch/config/scripts<...
How can I compare colors to a known set? <p>Given an image of a billiard ball, I want to be able to tell what ball it is. The colors for the balls are reasonably known and don't often deviate from a few known exceptions. But what's the best way recognize a particular ball?</p> <p>My approach is, given a picture that w...
<p>Per comments: DeltaE (CIE76 and variations) works much better with a larger sample size. My original thought was that I would find the 'true' colors of the balls, and try to use that rather than have lots of samples that vary under lighting, but that proved ineffective, although maybe if the lighting itself could be...
How to find the duplication entry of mobile no using php <p>I have created the form with multiple form field. Based on selection i show and hide the form field. How to validate the duplicate entry of mobile no.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div c...
<p><strong>Way 1 :</strong> Loop through all the mobile number fields and check whether any mobile number is previously occupied or not using <code>$.inArray</code> function of jquery.</p> <p>Please check below snippet.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false...
Can I call store.subscribe method of redux in render() method of react component? <p>I am trying to make an e-commerce store in meteor using <strong>react</strong> and <strong>redux</strong>. There is an icon in my navbar that displays total number of items added to the cart. I just want to update the counter of items....
<p>You should not have the store in your component, only the state. </p> <p>Redux will update your components to match the current state, to put it simply.</p> <p>You should use the <a href="https://github.com/reactjs/react-redux/blob/master/docs/api.md#connectmapstatetoprops-mapdispatchtoprops-mergeprops-options" re...
Select2.min.js dropdown is not working <p><a href="http://i.stack.imgur.com/nBI3P.png" rel="nofollow">IN this image select2 js (multi select is not working..)</a></p> <p>hello Everyone,</p> <p>Problem:- I have use select2.min.js for multiple selection in drop down, its perfectly working in mozilla firefox but its do...
<p>Try this</p> <pre><code> &lt;select multiple id="e1" style="width:300px"&gt; &lt;option value="AL"&gt;Alabama&lt;/option&gt; &lt;option value="Am"&gt;Amalapuram&lt;/option&gt; &lt;option value="An"&gt;Anakapalli&lt;/option&gt; &lt;option value="Ak"&gt;Akkayapalem&l...
How can i return 2 numbers with one decimal? <p>I return this number from my query: <code>44397.6345</code></p> <p>and I want to display it in this format: <code>44.4</code></p>
<p>Just use <a href="http://php.net/manual/en/function.number-format.php" rel="nofollow">number_format</a>:</p> <pre><code>number_format(44397.6345 / 1000, 1) </code></pre> <p>(Note: based on your example, I'm assuming you also want to divide it by 1000)</p>
How to display data in MYSQLI using OOP in PHP . <p>Hello stackoverflow , </p> <p>SO , I've been trying to display some values in my MYSQLI database using oop in php but unable to do it. </p> <p>Please how do i do it ?</p> <p>Thanks </p>
<p>This is the way to do it simply</p> <pre><code>$searchSql = "SELECT * FROM countries WHERE name = ?"; $Connection = "your mysql connection" ; // ex: in CI : $this-&gt;db-&gt;conn_id $stmt = $Connection-&gt;prepare($searchSql); $stmt-&gt;bind_param("s", "name_for_search"); $ok = $stmt-&gt;execute(); $result = $stmt-...
Which method is called when I tap full screen button in AVPlayerController? <p>I play video in the top of ViewController(not full screen). And I have this line of code <code>playerController.videoGravity = AVLayerVideoGravityResizeAspectFill</code>.Everything is ok, but I wanna change <strong><em>videoGravity</em></str...
<p>The simplest way is to check the KVO and observe the videoBounds of the AVPlayerViewController. The other details of the same are shown <a href="http://stackoverflow.com/questions/36323259/detect-video-playing-full-screen-in-portrait-or-landscape">here</a></p> <p>Hope this helps</p>
Mocha force fail after an infinite retries <p>Take this code for example:</p> <pre><code>const assert = require("assert"); describe('Force fail after iterations', function () { var retriesDone = 0; it('Math.random will be eventually give the same numbers', function () { this.retries(Infinite); ...
<p>Got it.. for anyone coming to this thread, check this code and the comments</p> <pre><code>describe('Force fail after iterations', function () { var retriesDone = 0; it('Math.random will be eventually give the same numbers', function () { this.retries(Infinite); retriesDone++; var a ...
Python 3.4 does not read more than one line from a text file <p>I am writing a python(3.4) code which uses a basic authentication. I have stored the credentials i.e the username &amp; password in a text file(abc.txt).<br> Whenever I login, the code accepts only the first line of the text file &amp; ignores the rest of ...
<p>That is happening because you are only checking the first line. Currently the user can only enter credentials that match the first line in the text file, otherwise the program will exit. You should create a dictionary with the username and password and then check if a username is in that dictionary instead of iterat...
How to generate random code mixed of numbers and letters - Swift <p>I'm trying to generate random code mixed of numbers (0-9) and letters(A-z) so I can send it to user email to use it when login . </p> <p>Is there a library or any way to do this ? </p>
<p>This is give random value... </p> <pre><code>func returnUUIDWithTimeStamp() -&gt; String { return UUID().uuidString + NSString(format: "%f", Date().timeIntervalSince1970 * 1000).substring(with: NSRange(location: 8, length: 5)) } </code></pre> <p><strong>Result will contain '-'</strong> </p> <p><strong>C95B92...
Regular expression to find string with iterating letters on the end <p>Can someone help me with this kind of regular expression matching?</p> <p>For example, I'm searching through list containing different strings with a letter iterating at the end of the string:</p> <ul> <li>MonsterA</li> <li>MonsterB</li> <li>Monst...
<p>If you absolutely need a regex:</p> <pre><code>re.match(r"(.*)[A-Z]", word).group(1) </code></pre> <p>But it is not the most efficient if you just want to remove the last character.</p>
How can I install Android NDK Cmake tools on headless server <p>I'm trying to configure an headless build-server to build an Android NDK project that's using Cmake to build the C++ part.</p> <p>Right now I'm having this issue:</p> <pre><code>* What went wrong: A problem occurred configuring project ':app'. &gt; Faile...
<p>The SDK manager can be used from the command line: <a href="http://tools.android.com/recent/updatingsdkfromcommand-line" rel="nofollow">http://tools.android.com/recent/updatingsdkfromcommand-line</a></p> <p>One thing to note though is that that's actually a rather old version of the SDK manager and it's fed from a ...
Find the smallest distance between the profiles <p>I would like to find the smallest distance between the profiles stored in a data frame. I am interested especially in one row in comparison to the rest of the rows stored in the data frame. </p> <p>That's a data frame:</p> <pre><code>structure(list(`10` = c(0, 0, 0, ...
<p>Let's get rid of <code>Katrin_1</code> column with <code>df[!rownames(df) %in% "Katrin_1", ]</code>, subtract <code>df["Katrin_1", ]</code> from each of the remaining rows with <code>sweep</code>, find Euclidean distances by squaring the resulting matrix element-wise and using <code>rowSums</code>, use <code>which.m...
Variable and parameter in a method <p>I am new to Python and I have an issue with it when I am creating a function:</p> <p>I created a dictionary where the keys are parameters like <code>n_estimators</code>, <code>C</code>, <code>max_depths</code> for instance.</p> <p>I have a loop where I would like to set the param...
<p>Use a dict with the <code>**</code> operator:</p> <pre><code>key = 'n_estimators' estimator = estimator.set_params(**{key: 100}) </code></pre>
How to send javascript array to c# list if some index is missing? <p>sry for my bad english</p> <p>I want to create list of data something like below:</p> <pre><code>&lt;div&gt; &lt;input type="text" name="Users[0][FirstName]"&gt; &lt;input type="text" name="Users[0][LastName]"&gt; &lt;/div&gt; &lt;div&gt; &lt;...
<p>This is not exactly a problem with the model binder. If you try to get the length of your array in JavaScript that too will count to the first null index. Bind a function to your form submit event, and iterate through your form inputs, create a clean javascript array which you post with Ajax. I'm assuming you've ke...
Equal to (=) operator in MS SQL <p>I am using Visual Studio 2003 with VB.NET language. I wrote my query like</p> <pre><code>"UPDATE book SET status='confirm' WHERE idnum = '%" &amp; daoi.Text &amp; "%'" </code></pre> <p>but the data doensnt update. When I use this code</p> <pre><code>"UPDATE book SET status='confirm...
<p>The <code>%</code> character is a wildcard in SQL. You don't need it, when not using <code>LIKE</code>, but equals.</p> <p>Your query should be <code>"UPDATE book SET status='confirm' WHERE idnum = '" &amp; daoi.Text &amp; "'"</code></p> <p>Plus: You should parameterize your query. <a href="https://xkcd.com/327/" ...
redis+elk stack using docker-compose <p>I am trying to set up redis+ELK stack with docker. I wish to use redis to accept the logs from a remote location and forward them to logstash. </p> <p>Here is my docker-compose.yml</p> <pre><code>elasticsearch: image: elasticsearch:latest command: elasticsearch -Des.network...
<p>I can see one immediate issue. In your logstash.conf file you specify the redis hostname:</p> <pre><code>redis { host =&gt; "redis:6379" } </code></pre> <p>In your docker-compose file however you do not actually link the redis service into your logstash service:</p> <pre><code>logstash: &lt;snip&gt; links...
Obtain the difference between two files <p><em>First of all, i searched on the web and stackoverflow for around 3 days and haven't found anything i've been looking for.</em></p> <p>I am doing a weekly security audit where i get back a .csv file with the IPs and the open ports. They look like this:</p> <p><strong>2016...
<p>In the following solution I've used sets, so the order doesn't matter and we can do direct subtraction with the old and new to see what has changed.</p> <p>I've also used the <code>with</code> context manager pattern for opening files, which is a neat way of ensuring they are closed again.</p> <pre><code>def read_...
Stream based on StreamSocket returns less data than requested <p>This is <strong>not</strong> a question about how to deal with a stream that returns less than requested. I will show how I dealt with it, then comments are very welcome.</p> <p>But first things first: </p> <p>I use the <code>UWP</code> based <code>Stre...
<blockquote> <p>I thought this should be handled one abstraction layer below.</p> </blockquote> <p>Why? The abstraction that TCP offers is a (potentially endless) stream of bytes in both directions. If you want messages, it's up to you to either implement that yourself (as you're doing here) or move to a higher leve...
Fold a Foldable of Maybe (Monoid) ignoring the missing values in Haskell <p>I am working with some data that has missing values, which is simply represented as lists of Maybe values. I would like to perform various aggregates/statistical operations, which simply ignore the missing values.</p> <p>This is related to the...
<p>There is an instance of <code>Monoid</code> that does exactly the right thing:</p> <pre><code>instance Monoid a =&gt; Monoid (Maybe a) where mempty = Nothing Nothing `mappend` m = m m `mappend` Nothing = m Just m1 `mappend` Just m2 = Just (m1 `mappend` m2) </code></pre> <p>It's in <code>Data.Monoid</code>....
Xcodebuild Test operation failure <p>I'm trying to use the new version of appium with the XCUITEST method for ipad testing. Once I start the Appium server (1.6.0 Beta2) and execute my tests (using Java with Cucumber) I get several errors from appium log.</p> <blockquote> <p>[Xcode] 2016-10-06 12:18:25.074 xcodebuild...
<p>Well after updating the appium server to 1.6.0 beta 3, the issue was resolved. Now I'm on the stable 1.6.0 version and I'm facing a whole different problem. The app I'm testing is in Landscape mode and I cannot have appium clicking or tapping on any of the elements.</p> <p>Did anyone hear this issue?</p>
My ajax method is not working, <p>In console log getting the bellow message Reason: CORS header ‘Access-Control-Allow-Origin’ missing So I checked few stack overflow solution but not able to resolve some one can help me to resolve it.</p> <pre><code> &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.1...
<p>This is clearly a problem with the server side code, which doesn't send the right headers to allow the Cross Origin Request Sharing. You need to <a href="http://enable-cors.org/" rel="nofollow">enable CORS</a> through two ways in Apache Server with PHP.</p> <p><strong>Method 1:</strong> Using Apache Server's settin...
How to deploy a referenced project onto an JBoss? <p>I have a Java project "Project A" which runs on a JBoss 8.2 (Wildfly). I use Intellij do develop and run the project on a local Wildfly (using a run configuration). That works fine.</p> <p>I have a second Java project "Project B", which is a simple library used by P...
<p>Add your jar(module b) as module in local standalone server on which you are running and add dependency in project A for it</p> <p>Edit : steps to add module : <a href="http://www.mastertheboss.com/jboss-server/jboss-as-7/how-to-install-a-module-on-jboss-as-7" rel="nofollow">http://www.mastertheboss.com/jboss-serv...
Android - Showing ImageView in a horizontal RecyclerView places large margins around(?) the image? <p>I'm building an Android Application where the user can take photos at a click of a button, and this photos are shown on the same activity. The photos are inside a RecyclerView and the RecyclerView's Orientation is hori...
<p>Try set <code>android:adjustViewBounds="true"</code> to your <code>ImageView</code>.</p>
Align TextView baseline and another TextView bottom <p>I have RelativeLayout and two TextView, one of which with background.</p> <p>On image two baselines aligned, but I want to align baseline of one and background bottom of another.</p> <p><a href="http://i.stack.imgur.com/83F08.png" rel="nofollow"><img src="http://...
<p>You can do a little trick, here we go:</p> <p>Put the <code>text_view_unread_message_count</code> inside a some viewgroupo e.g. RelativeLayout and add a paddingBottom with using SP scaling (this is your space for manually align), something like this:</p> <p>Obs.: You need to give a new ID to you TextView, this is ...
How to init array of objects in objective-c, similar to swift <p>I am new iOS developer. I started to learn Swift but I want to switch to Objective-C. Below is the code which i'm using in Swift</p> <p>I have <code>Player.swift</code>:</p> <pre><code>import Foundation import UIKit struct Player { var name: String...
<h3>Recommended:</h3> <p>Use a typed array <code>NSArray&lt;Player *&gt;</code> so that you don't have to cast the element when accessing it and the compiler warns you if you try to insert non-<code>Player</code> objects.</p> <pre><code>NSArray&lt;Player *&gt; *players = @[ [[Player alloc] initWithPlayer:@"Steven...
Email token expired and "Email already taken" issue - Asp.net Identity 2.0 API <p>I'm facing a strange issue in Asp.Net Identity API 2.0.</p> <p>When an user signs up, I send a confirmation email to the user, and if the user confirms his / her account within 3 hours of signing up, the "ConfirmEmailAsync" method seems ...
<p>There are various places where you can do this.Say you are doing something like below to register the user</p> <pre><code>var user = new ApplicationUser { UserName = model.RegisterEmail.ToLower(), Email = model.RegisterEmail.ToLower(), PhoneNumber = model.RegisterPhoneNumber, EmailConfirmed = true, PhoneNumberConfi...
Using pandas to scrape weather data from wundergound <p>I came across a very useful set of scripts on the Shane Lynn for the <a href="http://www.shanelynn.ie/analysis-of-weather-data-using-pandas-python-and-seaborn/" rel="nofollow">Analysis of Weather data</a>. The first script, used to scrape data from Weather Undergr...
<p>The output you are getting is because an exception is being raised. If you added a <code>print e</code> you would see that this is because <code>import io</code> was missing from the top of the script. Secondly, the station name you gave was out by one character. Try the following:</p> <pre><code>import io import r...
Automating substitute expressions in vim <p>What is a good way to automate substitute commands in vim?</p> <p>Suppose I have something like:</p> <pre><code>s/foo/bar/g </code></pre> <p>except much more complex and I want to run it on selected ranges without having to type the substitute command?</p> <p>How can I s...
<p>You can create a function with range supported, and in the function do the substitution. Also create a custom command to call the function with range.</p> <p>However the easiest way I think, is creating an <code>abbrev</code> in your vimrc file:</p> <pre><code>cab RR s/foo/bar/g </code></pre> <p>thus, when you se...
How Can I refresh the information of my website in Google? <p>I recently update my website:</p> <p><a href="http://luscoefusco13.es" rel="nofollow">http://luscoefusco13.es</a></p> <p>But it appears in the Google search with the old attributes.</p> <p>How Can I change the name and the description of the website?.</p>...
<p>You need to ask Google to re-crawl your URLs. That could help you: <a href="https://support.google.com/webmasters/answer/6065812?hl=en" rel="nofollow">https://support.google.com/webmasters/answer/6065812?hl=en</a></p>
DISTINCT and GROUP BY with SQL Server <p>I have the following table (sql server) and i'm looking for a query to select the last two rows with all fields: </p> <ul> <li>order by <strong>created_at</strong></li> <li><p>group by / distinct <strong>type_id</strong></p> <pre> id type_id some_value created_at 1 B ...
<p><strong>Solution</strong></p> <p>Based on the comment from Andrew Deighton i did this:</p> <pre><code>SELECT * FROM ( SELECT id, type_id, some_value, created_at, ROW_NUMBER() OVER (PARTITION BY type_id ORDER BY created_at DESC) AS row F...
wpf Single Sign on implementation <p>I'm working on a WPF application. Currently I have authentication done by the user entering their username and password. Which is ok, but rather an old skool method. I'd like to be able to do single sign on so that the user logs into windows as normal, then when they start up my ...
<pre><code>System.Security.Principal.WindowsIdentity.GetCurrent().Name; </code></pre> <p>will return the name of the current user logged into windows.</p> <p>Edit: changed my answer, removed the link</p>
Not able to consume ActiveMQ message on tomcat <p>I am trying to configure Apache Active MQ in Apache Tomcat. I have two war files, MessageProducer.war and MessageConsumer.war.I have added all the ActiveMQ dependency jars in /WebContent/WEB-INF/lib folder of both projects. I have added following Resources configured in...
<p>it's ok for load-on-startup.</p> <p>your <code>startupServelt</code> will listen for only one message on startup, you need to loop over <code>subscriber.receive(3000);</code> in another thread or use a <code>MessageListener</code>.</p> <p>hava you any other logs of tomcat startup or activemq.</p> <p>you say : <st...
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/HBaseConfiguration while running spark Hbase using java API <p>I am running simple application to get data from HBase in <strong>Spark</strong> using java API</p> <p>running <strong>spark-submit command</strong> e.g.</p> <pre><code>bin...
<p>In the console where you are running spark-submit, first execute below command and then run spark-submit</p> <p>export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:$HBASE_CLASSPATH</p> <p>If this works then add this entry in your hadoop-env.sh</p> <p>Hope it helps...</p>
Linker Script Does Not Skip Bytes As Expected <p>So, I have this assembly file, which I assemble with GNU as and link with GNU ld using a linker script.</p> <p>Linker script (<code>boot.ld</code>):</p> <pre><code>INPUT(boot.o) OUTPUT(boot.out) ENTRY(boot_start) SECTIONS { . = 0x7c00; .text : { *(.tex...
<p>You are most probably missing a section flag. Point is, if no section flags are given to <code>as</code> when you are later linking to ELF for a non-standard (not <code>.text</code> or <code>.data</code> or the like) section name, the section will not be allocated in the dump (i.e, silently be ignored by <code>objco...
Finger print Image conversion to byte C# <p>I have been working on a finger print project. The code below can convert finger print image to a byte array, but if you take the finger print of say three people the value that will be submitted is the same value, it is not unique. It is supposed to be unique per person sinc...
<p><code>Convert.ToString()</code> is not going to get the byte array of your image, but the type (System.Drawing.Bitmap).Try this method to convert your image to a byte array:</p> <pre><code>public byte[] imageToByteArray(System.Drawing.Image imageIn) { using (var ms = new MemoryStream()) { image...
Android - custom animation for progress <p>I'm trying to create a progress animation</p> <p><a href="http://i.stack.imgur.com/4p9vg.png" rel="nofollow"><img src="http://i.stack.imgur.com/4p9vg.png" alt=""></a></p> <ul> <li>The cercles position are fix</li> <li>Their scale is animated up and down clockwise (they go bi...
<p>@ An-droid you can try to this hope this can help you..</p> <p>Mainactivity.java </p> <pre><code>public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ProgressView image = (...
Returning js dataset from a D3 function <p>I've been given the following working code:</p> <pre><code>var datasetBarChart = [{ group: "X", category: "Oranges", measure: 100 }, { group: "Y", category: "Apples", measure: 200 }]; // set initial group value var group = "X"; function datasetBarCho...
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="true"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>function datasetBarChosen(group, process) {//this can be refactored more var ds = []; d3.csv("https://raw.githubusercontent.c...
How can I get around memory limitation in this script? <p>I'm trying to normalize my dataset which is <code>1.7 Gigabyte</code>. I have <code>14Gig of RAM</code> and I hit my limit very quickly. </p> <p>This happens when computing the <code>mean/std</code> of the training data. The training data takes up the majority ...
<p>Why not compute the statistics on a subset of the original data? For example, here we compute the mean and std for just 100 points:</p> <pre><code>sample_size = 100 data_train = np.random.rand(1000, 20, 10, 10) # Take subset of training data idxs = np.random.choice(data_train.shape[0], sample_size) data_train_subs...
mysql field name contain backtick <p>I want to create table with a field surrounded by backticks</p> <pre><code>CREATE TABLE t1 (`id` INT); </code></pre> <p>I have tried:</p> <pre><code>CREATE TABLE t1 (``id`` INT); </code></pre> <p>but it didn't work.</p>
<p>It is in the <a href="http://dev.mysql.com/doc/refman/5.7/en/identifiers.html" rel="nofollow">documentation</a> (emphasis mine):</p> <blockquote> <p>Identifier quote characters can be included within an identifier if you quote the identifier. If the character to be included within the identifier is the same as th...
App Group - Today Extension Identifier <p>I've created a today Extension which should share Data with the main app. The Problem is the App is in the AppStore and I can't change the Bundle identifier for this so the App Group throws the error:</p> <p><a href="http://i.stack.imgur.com/pPJPC.png" rel="nofollow">Error App...
<p>You must update your App Id with the app group service, and your app entitlement file with app group too. There's nothing complicated in your errors</p>
Detecting if is zoom-in or zoom-out with leaflet <p>How can I know when the user is zooming in or zooming out? I want to start an animation if the user zooms after some level. Is it possible to know this when the event zoomstart is triggered?</p>
<blockquote> <p>How can I know when the user is zooming in or zooming out?</p> </blockquote> <p>At every <code>zoom</code> level, calculate how much <code>map.getZoom()</code> has changed.</p> <blockquote> <p>Is it possible to know this when the event zoomstart is triggered?</p> </blockquote> <p>No.</p> <p>Cons...
Jboss EAP 6.3 integration with OracleAQ jms <p>I have application working on Jboss eap 6.3 and Hornetq queue for jms. I have to change queue from hornetq to OracleAQ. Is there any ready resource-adapter to connect it or I have to write new one for my own? I will be gratefull for any tips how can i achieve that. Thanks ...
<p>As far as I know, Oracle AQ's administered JMS objects (e.g. connection factories and destinations) must be looked up via a database connection (or perhaps LDAP) rather than JNDI. Nothing shipped with JBoss EAP can do this.</p> <p>I propose to check with Oracle for information regarding a JCA resource adapter that ...
BizTalk - Flat file schema, Date with format and padding zero <p>Have a positional flat file schema with date as data type. We have format as ddMMyy. We have a requirement where 000000 needs to be allowed in date field.</p> <p>When 000000 is passed in the flat file, we are getting Date is not in valid Gregorian date f...
<p>If the field might contain "000000" then you can't use a date/datetime type on it.</p> <p>Instead, treat it as a String for the Flat File.</p> <p>You should the conversion from/to the 6 char value in a Map. The Flat File properties don't give you enough options.</p>
Use route as url in config with Symfony <p>I use CKEditor and want to use <code>uploadimage</code> plugin. I need to specify <code>uploadUrl</code> in config.yml. How can I put here a route instead of direct url?</p> <pre><code>ivory_ck_editor: default_config: my_config configs: my_config: ...
<p>If you define your form as a service, you could inject the router and use it to generate the path in your form. (This ignores the possibility of setting it in <code>config.yml</code>.)</p> <pre><code>services: app.form.type.yourformtype: class: AppBundle\Form\YourFormType arguments: [@router] ...
LibreOffice/Excel Table Calculation Formula <p>I have three Columns in one sheet. <strong>Col1</strong> Have Combination Of <strong>Col2</strong> Values, I need to replace <strong>Col1</strong> Value as equal Of <strong>COl2</strong> = <strong>col3</strong> Value.</p> <p>Is there Any Formula to do this in LibreOffice ...
<p>Basically it's a work around. You would like to change <code>A-&gt;X, B-&gt;Y and C-&gt;Z</code> in <code>col1</code>. Create a <code>col4</code> with the formula </p> <pre><code>=CHAR(CODE(A1)+23) </code></pre> <p>This offsets the <code>A</code> by 23 characters that will be <code>X</code> and therefore, <code>B<...
JavaFX HTMLEditor: HTML to plain text <p>I know that you can use HTMLEditor.getHTMLText(); to convert text to HTML, I was just wondering if you can <strong>convert the HTML text back to plain text</strong>.</p> <p>Any help will be appreciated.</p>
<p>What you need is to remove all the HTML tags from the HTML String returned by <a href="https://docs.oracle.com/javase/8/javafx/api/javafx/scene/web/HTMLEditor.html#getHtmlText--" rel="nofollow"><code>getHtmlText</code></a>.</p> <p>You can implement a method, or better, you can use for example <a href="https://jsoup...
How to connect to MySQL within Android 6.0 app <p>I'm working on an Android app. But I need to connect to a MySQL database. I have searched for the answer on Google but everything I found is outdated (deprecated or even deleted).</p> <p>Hopefully someone can help me solve this.</p>
<p>You have to implement a REST Service (on your Server) or some kind of Service that runs on your Webserver and connects to the sql database. <br> To get an easy beginning take a look at this <strong>Slim Framework, Mysql, REST Tutorial</strong>:<br> <a href="http://www.codediesel.com/php/create-a-quick-rest-api-using...
PHP json_encode in autocomplete <p>I have </p> <pre><code>&lt;form action='' method='post'&gt; City name &lt;br /&gt;&lt;br /&gt; &lt;input type='text' name='search' value='' class='auto'&gt; &lt;/form&gt; </code></pre> <p>and </p> <pre><code>&lt;script type="text/javascript"&gt; $(function() { //autocomp...
<p>Yes you can... just merge tables</p> <pre><code>echo json_encode(array_merge($city, $airport)); </code></pre>
Remove stranger alphabets characters from string <p>I'm trying to load suggestions from user input, but my query fails if user enters some stanger alphabets characters (chinese, greek...).</p> <pre><code>$alphaAccent = array('À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', '...
<p>You need to pass the <code>/u</code> modifier to the regex so that it could match the </p> <pre><code>$alphaAccent = array('À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'à', 'á', 'â', 'ã', 'ä', 'å', 'ç', '...
How to show local notification when app is foreground <p>How to show local notification always, even in foreground, using new (from iOS 10) notification framework UserNotifications <a href="https://developer.apple.com/reference/usernotifications?language=objc" rel="nofollow">https://developer.apple.com/reference/userno...
<pre><code>#import &lt;UserNotifications/UserNotifications.h&gt; #define SYSTEM_VERSION_GRATERTHAN_OR_EQUALTO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) //interface @interface AppDelegate : UIResponder &lt;UIApplicationDelegate,UNUserNotificationCenterDele...
Optimize Sparksql queries by scanning once and run many queries <p>I have multiple sql select queries on same dataset, dataset size is around 500GB every single sql query scans data and gives me the output, is there a way to scan data once and run queries on top of it.</p> <p>below is sample of my code:</p> <pre><cod...
<p>You can write Hive query something like this: (Make sure create a temp table "DevCount")</p> <pre><code>FROM adreqdata INSERT INTO DevCount SELECT DeviceId, count(*) where Network = 9 and EventType = 2 group by DeviceId INSERT INTO DevCount select DeviceId,count(EventType) as AllAdreqCount where ...
python - pandas - check if date exists in dataframe <p>I have a dataframe like this:</p> <pre><code> category date number 0 Cat1 2010-03-01 1 1 Cat2 2010-09-01 1 2 Cat3 2010-10-01 1 3 Cat4 2010-12-01 1 4 Cat5 2012-04-01 1 5 Cat...
<p>I think you need convert to datetime first by <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.to_datetime.html" rel="nofollow"><code>to_datetime</code></a> and then if need select all rows use <a href="http://pandas.pydata.org/pandas-docs/stable/indexing.html#boolean-indexing" rel="nofollow"><c...
click link using getelementsbyclassname vba 7 using access 2007 <p>I have a connection to an internet explorer webpage but i cannot seem to "click" a specific link using vba7 in access. I've tried loads of options like getelementsbyclassname. Here's the source code from the webpage:</p> <pre><code>&lt;tr&gt; &lt;td ...
<p>The following should work assuming you have a pointer to the InternetExplorer object already.</p> <pre><code>Public Sub ClickElement() 'Assuming you already have an IE object Dim Elements As Object Dim Element As Object 'get all 'A' tags, which the hyperlink is part of Set Elements = IE.Documen...
walkup page tables on ARM <p>I'm trying to emulate the function lookup_address(<a href="http://lxr.free-electrons.com/source/arch/x86/mm/pageattr.c#L373" rel="nofollow">http://lxr.free-electrons.com/source/arch/x86/mm/pageattr.c#L373</a>) for arm platform (and just for kernel pagetables).</p> <p>The point is I'm getti...
<p>I've read all the pointed links, but I'm afraig I still don't get the whole picture. I'll try to explain what I understood so far:</p> <p>From include/asm/pgtable-2level.h , it looks like a page stores:</p> <ul> <li>0 - pte1_linux </li> <li>1024 - pte2_linux </li> <li>2048 - pte1_hw </li> <li>3072 - pte2_hw</l...
How can I repeat a public class in Java? <p>I looked for a long time for a possibility to repeat a public class in Java, I found a solution with continue and repeating an additional while loop. But I am really not happy with it, is there a simpler method do to this? Thanks for the help guys. </p> <pre><code>import ja...
<p>About restarting - that seems odd unless you are extracting it in an object. So solution 1 may be to just run in a loop and get rid of the first one, by checking the restart in the second: </p> <pre><code>while (number != zahl || restart.equalsIgnoreCase("j")) { ... } </code></pre> <p>Note that you will need to ch...
How can I remove the box-shadow after clicking away from the input box? <pre><code>$(document).ready(function() { var fname = ""; var lname = ""; var email = ""; var password = ""; var repassword= ""; $("#fn").keyup(function(){ var vall = $(this).val(); if(vall == "") { $("#fnerror").html("Please enter your fir...
<p>this can done easily with css, may be this will help u</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-css lang-css prettyprint-override"><code>input[type=text], textarea { -webkit-transition: all 0.30s eas...
Exclude exact string using regex negative lookahead <p>I want to exclude <code>pqr</code> from a string using regex.</p> <p>What I currently have is</p> <pre><code>abc\/(?!.*pqr).*\/xyz </code></pre> <p>This correctly rejects <code>abc/pqr/xyz</code>, but it also rejects <code>abc/pqrst/xyz</code> which I want it to...
<p>You may use <a href="http://www.regular-expressions.info/wordboundaries.html" rel="nofollow"><strong>word boundaries</strong></a> with <code>pqr</code> that is inside the lookahead:</p> <pre><code> abc\/(?!.*\bpqr\b).*\/xyz ^^ ^^ </code></pre> <p>See the <a href="https://regex101.com/r/HjJBBH/1" rel="...
Getting Cell Values in JTable <p>Anything wrong here? </p> <pre><code> JButton btnCheckout = new JButton("Checkout"); btnCheckout.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { racingUsr.setVisible(false); int row = 0; int c...
<p>You have a=price; instead of price = a;</p> <p>This is the reason because you get the 0 in the subtotal.</p>
simple smack android client not working? <p>I am using <a href="https://drive.google.com/file/d/0BxVa3_wqOp_rbGlRbVBYZjBNOEE/view" rel="nofollow">this android source code</a>, which is simple XMPP android client. I have installed Openfire locally and created a user, in GenyMotion I can connect to the created user after...
<p>Add this to manifest:</p> <pre><code>&lt;uses-permission android:name="android.permission.READ_CONTACTS" /&gt; </code></pre> <p>and in your activity ask permission for it (if sdk >= 23), </p> <pre><code>@Override public void onCreate(Bundle b) { askPermission(); } public void askPermission(){ if (Bui...
Telerik RadGrid Performance Too slow in Winforms <p>i am loading more than 50000 Records in Rad grid win forms. how to optimize and makes the grid to loads fast (instant)?. is there option to load pagewise filter in telerik rad grid columns filter?.</p> <pre><code> Me.cncFilesGridRad.MasterTemplate.AllowAddNewRow = Fa...
<p>Load the records as the page moves, i.e. one page can have <code>100</code> records, when we click second page, it will have another <code>100</code> records.. that will <em>improve performance</em>.</p>
python one line statement for loop with if else <p>Is it possible to write this logic in one line statement?</p> <pre><code>B = [] for book in books: if book not in B: B.append(book) </code></pre> <p>I have tried this but it's false:</p> <pre><code>B = [book if book not in B for book in books] </code><...
<pre><code>B=[book for book in books if not book in B] </code></pre> <p>should do the trick</p>
How to config view and contoller module in angular JS <p>how to link module controller and view in angulaaJS . i am trying to linking with below codes i am getting error please help me to find errors in a code .</p> <p><strong>controller code:</strong></p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html &gt; &lt;head&gt;&l...
<p>on top of the @Steeve Pitis response, you need to run this in your web/app server not in your browser</p>