input
stringlengths
51
42.3k
output
stringlengths
18
55k
Individually shorten URLs in Hive <p>I have URLs of the following structure:</p> <pre><code>https://pinball.globalzone.com/en_US/home?tic=1-dj33jl-dj33jl&amp;goToRegisterNow=true </code></pre> <p>What I want to do now is to shorten the URLs to be able to group and count similar URL patterns. For instance, I want to c...
<p>What about</p> <pre><code>(?:https?:\/\/|\/[a-z]{2}_[A-Z]{2}|[?&amp;]tic=[^&amp;?]*) </code></pre> <p>It matches the parts you've described as unwanted. Replace that with an empty string should leave you with what you want.</p> <p><a href="https://regex101.com/r/wN1jA5/2" rel="nofollow">See it here at regex101</a...
Use regex in grep while while using two files <p>I know that you can use regex in grep and use patterns from a file to search another file. But, can you combine these two options? </p> <p>For example, from the file where the patterns come from (with the -f option for use patterns from a file), I only want to use the f...
<p>Grep doesn't use wildcards for patterns, it uses <em>regular expressions</em>, so <code>(*)</code> makes little sense.</p> <p>If you want to extract the first column from a file, use <code>cut -f1</code> or <code>awk '{print $1}'</code> (or <code>sed</code> or <code>perl</code> or whatever to extract it), the redir...
How to extract a word(s) with digits from a string in MySQL? <p>Sample text: </p> <p>Calvin Klein K2R2S1K6 Women</p> <p>I need to get the K2R2S1K6 of this example, it could be at any position in the string. Is it possible to get the first word with digits in it?</p>
<p>Could be something like:</p> <pre><code>SELECT REGEXP_REPLACE('Calvin Klein K2R2S1K6 Women', '^(.*?)([^ ]*[0-9][^ ]*).*$', '\2') </code></pre> <p>I could only test it against PostgreSQL as I don't have MySQL at hand, so it may need minor tweaking. The regex is POSIX, though, so generally should work just like that...
Need to avoid submit form twice to the server when user double clicks on submit button <p>Using jquery validatye plugin, I am validating and submitting the form to the server which stores form data in data base. The issue is when user double clicks on the form, multiple requests are going in and its submitting twice to...
<p>The <code>submitHandler</code> is only fired after the form is valid AND the submit button is clicked. If you disable the submit button immediately after it's first clicked, it would be impossible to have a double-click situation.</p> <pre><code>submitHandler: function(form) { // form is valid // disable sub...
Simplify edge by Douglas–Peucker <h2>Edge Detection</h2> <p>I have used <code>Soble</code> operator to get some useful points.Here is my al:</p> <pre><code> for (int x = 0; x &lt; mWidth; x++) { for (int y = 0; y &lt; mHeight; y++) { int grayX = getGrayPoint(x + 1, y - 1) + 2 * getGrayPoint(x...
<p>Before simplifying you have to join edge points in continuous chain. </p> <p>The most important part of well-known <a href="https://en.wikipedia.org/wiki/Canny_edge_detector" rel="nofollow">Canny algorithm</a> is edge tracking, so you might learn this algo and apply used approaches.</p>
Header from bootstrap with HTML contents <p>I'm creating a webpage, I want to be able to do a header for each page I want it to consist of </p> <pre><code>(An Image) Home news about us web call email </code></pre> <p>I have this code so far:</p> <pre><code> &lt;!DOCTYPE html&gt; ...
<pre><code> &lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;title&gt;Bootstrap Case&lt;/title&gt; &lt;meta charset="utf-8"&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt; &lt;link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3....
How to serialize Scala Map<String, MyObj> in Play Framework <p>So I basically have code like:</p> <pre><code>case class MyObj( value:String, unit: String) case class ObjSeries( id: String, myObjs: Map[String, MyObj] ) </code></pre> <p>However, creating writers like:</p> <pre><code>implicit val myObjWrites = Json.wri...
<p>Not sure if it was a copy error, but the first class is missing the name of the second field:</p> <pre><code># ↓↓↓ case class ObjSeries(id: String, Map[String, MyObj] ) </code></pre> <p>Apart from that, what you have should work. Are you sure is this code that is failing?<...
How to draw LineChartData in swift 3? <p>I switched to swift 3 and I am now struggling to get my chart data shown again. When I use it like that, I just see an empty chart. I think some initializers changed?</p> <p>I am using the Swift-3.0 branch. </p> <pre><code>@IBOutlet weak var lineChartView: LineChartView! ov...
<p>They changed the way, how is data constructed. Enclosed please find following sample:</p> <pre><code>override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. let dollars1 = [20.0, 4.0, 6.0, 3.0, 12.0, 16.0, 4.0, 18.0, 2.0, 4.0, 5.0, 4.0] let months = ["Jan...
Expect Script - Not Working for SFTP <pre><code>#!/usr/bin/expect spawn sftp -oPort=1654 py@server1 expect "password:" send "oudfsj\n" expect "sftp&gt;" send "cd /upload\n" expect "sftp&gt;" send "put /var/log/hpc/ibm/asm_python_`date +%Y%m%d`*.csv\n" send "exit\n" interact </code></pre> <p>I am getti...
<p><code>Expect</code> (actually <code>Tcl</code>) does not support the <code>`cmd ...`</code> syntax. You can use the <code>[cmd ...]</code> syntax:</p> <pre><code>[bash] # tclsh % clock seconds 1474074039 % clock format [clock seconds] -format %Y%m%d 20160917 % </code></pre>
Error when trying to send HTTP status code in Phoenix <p>I am a Phoenix/Elixir beginner and am trying to write an API to allow users to sign up in my application.</p> <p>The API endpoint works as expected unless I try to set the HTTP status code of the response. When I include lines A, B and C (indicated in the code b...
<p>Cowboy manually specifies the HTTP response code and matches on the integer specified.</p> <p><a href="https://github.com/ninenines/cowboy/blob/1.0.x/src/cowboy_req.erl#L1318" rel="nofollow">https://github.com/ninenines/cowboy/blob/1.0.x/src/cowboy_req.erl#L1318</a></p> <p>A binary is permitted, however doing:</p>...
Unsubscribe durable subscribers with ActiveMQ <p>I'm trying to UNSUBSCRIBE durable subscribers from TOPICS.</p> <p>My app is a kind of social network : each user is a topic for other users. So, each time a user is doing something, his friends are notified. Of course, a subscriber may unsubscribe from a topic, wanting ...
<p>You can only unsubscribe a durable subscription if there is no active subscriber currently consuming from it. It looks like your code creates several subscriptions and does not stop the consumers so of course the unsubscribe will fail, if you close down the consumers and then do the unsubscribe you should get the r...
how to mast match all args pass in array in elastic search? <p>Here term gives result if one of all args (1,2) match and i need all args must have in degree.id of user<br> here i have data like this <br></p> <pre><code>"id": 66, "name": null, "degrees": [ { "id": 1, "name": "BCA", },{ "...
<p>What you're making with your <code>setTerms</code> is actually an <code>OR</code> on <code>degrees</code> field.</p> <p>To make an <code>AND</code> query, I recommend to use the <code>Elastica\Query\BoolQuery</code> class as follow : </p> <pre><code>$BCAQuery = new Elastica\Query\Term(); $BCAQuery-&gt;setTerm('deg...
jquery geolocate on a https form <p>I have following questions.</p> <p>I have a form on formassembly and now i want to integrate with jquery the option to get the address in the right format.</p> <p>First, I saved the folder to my homepage.</p> <p>I requested an API with google.</p> <p>Then i set up the html code i...
<p>Try this will may help you,</p> <pre><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"&gt;&lt;/script&gt; &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/geocomplete/1.7.0/jquery.geocomplete.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="https://maps.goo...
how to loop and autoanimate a content slider in jquery <p>I'm going crazy since days trying to make a working slider in jquery (I'm learning it so I'm not so able yet). Finally I came to this, that does work, <strong>but</strong> I'm not able to make it startover after the last slide, nor I know how to autostart it.</p...
<p>Try this:</p> <pre><code>$('.next').click(function(){ $('div.slide').animate({ left: "-=800px" }, 800, function() { // Animation complete. }); }); </code></pre>
Predict an event date <p>I have a database with some events with date and location they happened. I would like to know how, and if, I can run some Machine Learning algorithm on this data to try to predict when the next event will happen.</p> <p>I search for something like that and only found exemple of predicting numb...
<p>Machine learning (in its current being) cannot do anything that human cannot do. So ask yourself -- how would you try to solve the problem?</p> <p>If dates form some pattern (e.g. every 1th of month), that can be guessed. If not, best one can do with dates -- calculate density of distribution and get some probabili...
Python 3 changing variable in function from another function <p>I would like to access the testing variable in main from testadder, such that it will add 1 to testing after testadder has been called in main.</p> <p>For some reason I can add 1 to a list this way, but not variables. The nonlocal declaration doesn't work...
<p>Lists are mutable, but integers are not. Return the modified variable and reassign it. </p> <pre><code>def testadder(test, testing): test.append(1) return testing + 1 def main(): test = [] testing = 1 testing = testadder(test, testing) print(test, testing) main() </code></pre>
Find index position of characters in string <p>I am trawling through a storage area and the paths look a lot like this: storagearea/storage1/ABC/ABCDEF1/raw/2013/05/ABCFGM1 </p> <p>I wont always know what year is it. I need to find the starting index position of the year </p> <p>Therefor I am looking for where I fin...
<p>Instead of using a generator expression (which has its own scope), use a traditional loop and then print the found word's index and <code>break</code> when you find a match:</p> <pre><code>list_ = ['2010', '2011','2012','2013','2014', '2015', '2016'] for word in list_: if word in file: print file.index(...
Php code to check if file without and extention is really a directory or file <p>I want to check the file extension of in a root directory and also check if any folder or image but i have a problem when user upload a file that has not extension an show that it is a folder and file will not open because is actually not ...
<p>In this piece of code you checking the variable <code>$name</code> instead of <code>$filename</code> from what I can get from the given context. </p> <pre><code>} else if(!is_dir($name)){ //should be $filename $extn = "Other"; }else if(is_dir($name)){ //should be $filename $extn = "Directory"; } else{ </code></pre...
Some rows aren't counted in a foreach loop <p>I get price from database with 9xx items. I add this on show items page. Using Foreach $rows=$row. vprice is my sellingprice and dprice is my dealerprice</p> <pre><code>$commisionrate = 30; $commisionfee = 100; $fee = $row['dprice'] + $commisionfee;//+100 $x = $row['dpri...
<pre><code>$commisionrate = 30; $commisionfee = 100; $fee = $row['dprice'] + $commisionfee;//+100 $x = $row['dprice']; $y = $x * $commisionrate / 100; $rate = $x + $y; // You don't need to put nested brackets, it very simple condition if ($rate &gt; $row['vprice'] &amp;&amp; $fee &lt; $row['vprice']){ echo "...
CodeIgniter calendar class won't show correct dates for +1 month <p>I am trying to show three callendars, one for the current month and two for the next two months.</p> <p>Here is my <em>commented</em> controller</p> <pre><code>public function index($year = null, $month = null, $day = null) { if (empty($year)) { ...
<p>Okay, well here's the answer for someone like me in the future.</p> <p><strong>Cause of problem</strong></p> <p>CodeIgniter loads libraries which are instantiated ONCE. So here I was trying to get the 'calendar' library three times, when in actual fact CodeIgniter saw that I instantiated it for september, so it di...
Achieving the correct contrast/gradient with a background image & text <p>I really like the look of crisp background images with a text overlay. However, I always seem to find the text is drowned out by the background image when I do them. So I am always looking for the correct solution or industry standard for using t...
<p>A quick look at the CSS of the element and here is your answer:</p> <pre><code>.hero2-fx-frame-2[class*="hero2-theme-1"]::after { background-image: linear-gradient(rgba(0, 0, 0, 0.95), transparent 53%), linear-gradient(to top, rgba(0, 0, 0, 0.95), transparent 53%); } </code></pre> <p>It's basically a black lay...
BOX API, use Box javascript preview SDK to read all files in my box account <p>I'm trying to use <code>Javascript Preview SDK</code> to read all files in box account from my web application. I would like to see a preview of all files on my box account from my custom web application. There is some way to use a default <...
<p>You have to add the URL of your app (<a href="http://localhost:3000" rel="nofollow">http://localhost:3000</a>) to the CORS Allowed Origins text area. You can find this field in the form you used to create your application, the same form where you also obtained the Developer token. Note: Avoid the use of trailing sla...
Postgresql Request wtith array_to_string <p>Hello i am writting a pgsql function and inside this function , i have one request with array_to_string method.</p> <pre><code> AND id NOT IN (array_to_string(excludeArcs,',')) </code></pre> <p>ID is an integer but array_to_string return string so : Error result : opera...
<p>Your query is equivalent to <code>id NOT IN( '1,2,3' )</code>. You can not compare ID with string. </p> <p>It is necessary to expand the array to the table:</p> <pre><code>AND id NOT IN(select * from unnest(excludeArcs)) </code></pre>
CS0117 C# 'Resource' does not contain a definition for 'Drawable' <p>after I finally managed to setup a custom renderer, I wanna change the shape of every button in my app. Sounds easy, huh?</p> <p>Setup:</p> <p>Xamarin.Forms Version 2.3.2.127</p> <p>Xamarin.Android.Support.* Version 23.3.0</p> <p>My custom rendere...
<p>What I usually do when this one surfaces...</p> <ul> <li>[right-mouse] droid project </li> <li>open 'application' tab </li> <li>set min android to android 4.4 / api19 </li> <li>hit [x] to close android manifest </li> <li>[right-mouse] droid project </li> <li>[click] open folder in in file explorer </li> <li>delete ...
iOS 10: NSInvalidLayoutConstraintException: Constraint improperly relates anchors of incompatible types <p>After updating to iOS 10 Im getting this error a bunch on one of my apps</p> <blockquote> <p>NSInvalidLayoutConstraintException: Constraint improperly relates anchors of incompatible types: </p> </blockquote...
<p>You perhaps are doing something like this:</p> <pre><code>NSLayoutConstraint(item: viewA, attribute: .leading , relatedBy: .equal, toItem: parentView, attribute: .top, multiplier: 1.0, constant: 20) </code></pre> <p>So you do not stitch the correct anchors together like <code>.leading</code> and <c...
Having object with a property which has array of numbers, need to sum <p>I have an data file, where I have a information about 5 people. I made a class <code>Person</code> with different <code>properties</code>. One of the properties is called <code>range</code>.</p> <pre><code>public int[] range { get; set; } </code>...
<p>try</p> <pre><code>int sumValue= range.Sum(); </code></pre>
JavaFX scrollpane never scrolls <p>In JavaFX I have something like this:</p> <pre><code>VBox centreBox = new VBox(); ScrollPane scrollPane = new ScrollPane(centreBox); mainHBox.getChildren().add(scrollPane); </code></pre> <p>And then when the user clicks on a button, there is an action that gets triggered:</p> <pre>...
<p>Try: Use ListView instead of ScrollPane.</p> <p>Edit: In order to dynamically fill the pane with the content of the list:</p> <pre><code>HBox box[obj] = ...; // here I create a box based on obj </code></pre>
How do I install the latest minor version of a package on npm? <p>For example:</p> <ul> <li>I have version <code>2.0.0</code> of <code>package-name</code> installed.</li> <li>The latest minor version that has the same major version is <code>2.1.2</code></li> <li>The latest major version (which would be installed if I ...
<p>Npm uses semver, so you can use a variety of thing for getting close to your goal</p> <p>Looking at the offical <a href="https://docs.npmjs.com/cli/install" rel="nofollow">documentation</a>, you could use something like:</p> <pre><code>npm install package-name@"&gt;=2.1.2 &lt;2.2.0" </code></pre> <p>further more ...
UITapGestureRecognizer not working inside of custom class (that's not a view controller) <p>I have a custom class Overlay where I added UIButton. When the button is clicked, a method should be called:</p> <pre><code>class Overlay { func show(onView view: UIView, frame: CGRect) { let dismissButton = UIButton() ...
<p>You are already adding a button try adding a target to it instead of a gesture, and make your overlay variable global.</p> <pre><code>class YourControllerClass: UIViewController { let overlay = Overlay() ... func show(onView: UIView, frame: CGRect) { ... dismissButton.addTarget(self, action: #selector(dismissBtnTap...
i need to understand a solution to a row sum odd numbers method in ruby <p>The question:</p> <p>Calculate the row sums of this triangle from the row index.</p> <pre><code>row_sum_odd_numbers(1); # 1 row_sum_odd_numbers(2); # 3 + 5 = 8 row_sum_odd_numbers(3); # 7 + 9 + 11 = 27 </code></pre> <p>...</p> <pre><code>Tes...
<p>It's just math calculation:)</p> <p>lets find out what is the first summand: before first summand we have <code>1 + 2 + 3 + ... + n-1</code> odd numbers, their amount is <code>((n-1)*n)/2</code>. So, first summand after them is <br> <code>((n-1)*n)/2 * 2 + 1 = (n-1)*n + 1</code>.</p> <p>Now we should just calcula...
Prevent QLabel from resizing parent Widget <p>I have a <code>QLabel</code> inside a <code>QFrame</code>.</p> <p>Sometimes I have too much text in the <code>QLabel</code> and it resizes the <code>QFrame</code> where it is in.</p> <p>Now, I want to prevent the <code>QLabel</code> from resizing the <code>QFrame</code> w...
<p>Use a <code>QScrollArea</code> (which inherits <code>QFrame</code>), and hide its scrollbars:</p> <pre><code>label = QtGui.QLabel(text) frame = QtGui.QScrollArea() frame.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) frame.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) frame.setWidgetResizable...
Copy Command Amazon Redshift <p>Is there any way to output the number of rows copied while executing a copy command in redshift.</p> <p>From aws states that the data is available in stl_load_commits, but gives a warning that data may not be alway correct. </p> <p>I'm looking for more reliable data. I'm also using ke...
<p>I'm pretty sure if you create a job (not a transformation) and use Kettle's built in copy step it will report the number of files copied to you.</p> <p>Yea, I think there's a "Add files to result files name" setting on that step which you can further use with kettle to figure out anything you want.</p>
Swift 3: convert a null-terminated UnsafePointer<UInt8> to a string <p>I have a c api that returns a null terminated string that is an array of type <code>unsigned char*</code> (which would correspond to <code>UnsafePointer&lt;UInt8&gt;</code>).</p> <p>Swift has the initializer <code>String(validatingUTF8:)</code>, bu...
<p>In Swift 3, <code>String</code> has two initializers</p> <pre><code>public init(cString: UnsafePointer&lt;CChar&gt;) public init(cString: UnsafePointer&lt;UInt8&gt;) </code></pre> <p>therefore it can be created from (null-terminated) sequences of both signed and unsigned characters. So </p> <pre><code>let s = Str...
Run JQuery only on small screens <p>I'm trying to get my jquery to only run when the screen size is mobile. Now of course it's very easy to do this with css but for some reason as soon as I try detecting the screen size with jquery it doesn't work. Anyone know where I'm going wrong here?</p> <pre><code>&lt;script src=...
<p>Can you try like this:</p> <pre><code>var isMobileView = false; //global variable $(document).ready(function () { function setScreenWidthFlag() { var newWindowWidth = $(window).width(); if ( $(window).width() &gt; 600) { isMobileView = false; } else { ...
Hover pseudoclass not working on a bootstrap navbar anchor tag <p>I have the following html:</p> <pre><code>&lt;nav class="navbar navbar-inverse navbar-fixed-top"&gt;&lt;!-- navbar begings --&gt; &lt;div class="container"&gt; &lt;div class="navbar-header"&gt; &lt;button aria-expanded="false" cl...
<p>Try below code, it changes the <code>a tag</code> link color.</p> <pre><code>.navbar-collapse &gt; .nav &gt; li &gt; .navAnchor:hover { color: black; text-decoration: underline; } </code></pre> <p>You can even use pseudo <code>nth-child selector</code> to target them individually,</p> <pre><code>.navbar-c...
what does this debug-verbose-info mean? <p>I try to get the content of a page via cURL+PHP, but it gives me nothing back. When I replace the URL with <code>google.com</code> it works.</p> <p>the requested page is htaccess-protected</p> <p>this is my PHP-Code</p> <pre><code>$login = 'admin'; $password = 'xxxxx'; $ch...
<p>HTTP status code 301 means that the URL of the page for which you are trying to get content has moved to a new URL. You cannot retrieve the contents of this website using the old URL, but you have been notified the website now is accessible at the redirect URL. </p> <p>If possible, get the redirect URL by navigatin...
NullPointerException when reading from Database <p>I am building a contacts app and have created a database for it. Each time I run it, it shows the exception below. </p> <p>Sample of logcat error:</p> <pre><code>Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.util.ArrayList.size...
<p>Just add this check above your for-loop to avoid a crash if your database request returns null:</p> <pre><code>if (dbHelper.getAllContacts() != null) { for(...) {...} } </code></pre>
Looping using two variables at a time in all possible combinations - UNIX <p>I need a command that uses all variables, two at a time in all possible combinations </p> <p>Following this logic: (this command does not work, it's only an example):</p> <pre><code>for t1&amp;t2 in 62 63 64 65; do echo "Horse $t1 and $t...
<p>Like what arkascha wrote. You only need to nest the for loop and add an if to check that both numbers are different. A bash example would look like:</p> <pre><code>#/bin/bash NUMBERS="62 63 64 65" for i in $NUMBERS; do for j in $NUMBERS; do if [ "$i" -ne "$j" ]; then echo "Horse $i and $j" fi done...
Where login session cookie is stored in Symfony? <p>The question is quiet simple but I ask me this question when after log on my website, I watched cookies information in my Web browser and I only saw <code>PHPSESSID</code> cookie... </p> <p>So where Symfony stored login cookie and where can I see it ?</p>
<p>Authentication tokens are (typically) stored in the session. The session ID is communicated through the PHPSESSID cookie and any authentication token is read from the session data on the server.</p> <p>Storing additional authentication data on the client side (browser) is not required and not a good idea either, as...
iOS 10 Custom cell color alpha being ignored <p>I'm experiencing that table view cells no longer obey the alpha value that is passed to them upon setting the color property in iOS10. I began to see this in the beta but was hoping that it would be fixed and my post on the apple dev forums has been ignored. For example ...
<p>Although rmdaddy was correct - I didn't like his answer. The answer was as he stated an issue with the parameters but I couldn't see the forest for the trees. I had 128 in the red value and it should have been 0.5 (128/256) which could have very simply been resolved had he pointed that out specifically. There's no s...
PHP LDAP get user SID <p>I don't know how to get users unique identifier (SID) in AD. Code fragment:</p> <pre><code>... $filter="(&amp;(samaccountname=".$this-&gt;username.")(memberOf:1.2.840.113556.1.4.1941:=CN=GROUP_NAME,OU=Security,DC=something,DC=something))"; $attribute = array("cn","objectsid","descripti...
<p>I found a solution on another website (see below). Basically this function is converter and makes SID visible:</p> <pre><code>public static function SIDtoString($ADsid) { $sid = "S-"; //$ADguid = $info[0]['objectguid'][0]; $sidinhex = str_split(bin2hex($ADsid), 2); // Byte 0 = Revision Level $sid = $...
How to correctly setup keys with Hadley's secure package <p>I would like to use Hadley Wickam's <code>secure</code> package from GitHub.</p> <p>The example usage isn't explicit about how to create keys and where to store them and I'm messing something up (possibly more than one thing).</p> <p>I installed the package<...
<p>It looks like <code>local_key</code> is assuming your key is stored in ~/.ssh (which is a reasonable assumption). By default it assumes that the file is named id_rsa.pub so if you've renamed it then you'll need to pass the name into local_key.</p> <p>I haven't used this package but always remember those wise words...
Reading from weight scale problems (PHP) <p>I'm new in php. For now I can read the code (not good), and can write a little bit.</p> <p>I have several weight scales. From first one I can read the weight with this script:</p> <pre><code> // host and port to connect to $host = "10.0.0.119"; $port = 3400; // connect ...
<p>For now I fix this problem with this: </p> <pre><code>ini_set("auto_detect_line_endings", true); </code></pre> <p>and this:</p> <pre><code>$got = fgets($fp, 120000); </code></pre>
Can I run Numpy (or other Python packages) on Android? <p>I have implemented a python script, which imports Numpy and Pandas and I would like to run this script on Android. To be more precise, I would like to embed this script into an application.<br/>I would like to know whether it is possible? If so, what are the bes...
<p>If you do not want to build a website or app and have Python/Pandas running as a backend. You can use <a href="https://kivy.org/planet/2015/04/python-on%C2%A0android/" rel="nofollow">Kivy</a> as a <a href="https://github.com/kivy/python-for-android" rel="nofollow">packager to run Python</a> on Android. Further, if y...
Nested Async calls with Top level function doing await <p>I've this scenario, wanted to check if is feasible before going that route.</p> <p>I've a webApi project, there is a delegateHandler which adds some data in HttpContext.Current.Items. In controller there are few async calls which I'm doing with configureawait(f...
<blockquote> <p>When execution resumes back on controller function will I get stored data back from <code>HttpContext.Current.Items</code>?</p> </blockquote> <p>No, you won't. <code>ConfigureAwait(false)</code> is exactly for the case when you <em>don't</em> need to resume on the previous context. But to access <cod...
Hive query throwing exception - Error while compiling statement: FAILED: ArrayIndexOutOfBoundsException null <p>I just upgraded hive version to 2.1.0 for both hive-exec and hive-jdbc.</p> <p>But because of this, some queries started failing that previously working fine.</p> <p><strong>Exception -</strong></p> <pre><...
<p>Try disabling the sort merge join property which is an interim solution.</p> <p>Since you have enabled the sort merge join property as true, this will by default consider the io.sort.mb as 2047 MB and this might lead to the Arrayindexoutofbound exception. So when you set the sort merge join property it is advised t...
Unable to Install Python Package <p>In trying to install a python package via pip I get the error:</p> <pre><code> Failed building wheel for atari-py Running setup.py clean for atari-py Failed to build atari-py Installing collected packages: atari-py, PyOpenGL Running setup.py install for atari-py ... error C...
<p><code>make</code> is not in your PATH. Do <code>echo %PATH%</code> and check if the path to your msys utilities is in there. Otherwise you can edit this variable by following the instructions here: <a href="https://stackoverflow.com/questions/9546324/adding-directory-to-path-environment-variable-in-windows">Adding d...
How to programmatically erase all populated column data in a Databound DataGridView <p>I've been using the following VB code to erase all populated entries in a databound DatagridView;</p> <pre><code>For Each row As DataGridViewRow In DataGridView.Rows row.Cells(columnIndex).Value = DBNull.Value Next </code></...
<p>If the data source is a datatable (mdt):</p> <pre><code> For Each row As DataRow In mdt.Rows row.Delete() Next </code></pre> <p>This changes your in memory copy of the data. You would need so save the data to change the data on the server.</p>
Smarty check if items in array more than 1 <p>I use smarty to display different code and I want to check if the array of some phrase contains more than 1 items.</p> <p>I want to create a if phrase, that checks if the array contains only 1 value or more. Something like this, but of course that correct.</p> <pre><code>...
<p>You can use count (from the php function <a href="http://php.net/manual/es/function.count.php" rel="nofollow">http://php.net/manual/es/function.count.php</a>):</p> <pre><code>{if $domains|@count &lt; 1} </code></pre>
getting correct certificate info for offlineimap from outlook imap server <p>I'm trying to use offlineimap to download Outlook.com messages, but can't seem to get the security correct (I use offlineimap successfully for other IMAP accounts as well). In .offlineimaprc, in the remote repository section, I've put:</p> <p...
<p>OK, I should have paid more attention to the very first error message:</p> <pre><code>XOAUTH2 authentication failed: AUTHENTICATE command error: BAD ['SASL Token argument is missing or invalid.']. Data: BFKO2 AUTHENTICATE XOAUTH2 </code></pre> <p>Apparently, as discussed <a href="https://bbs.archlinux.org/viewtopi...
How can I get the latest version of ConstraintLayout android? <p>When I am trying to use <code>ConstraintLayout</code> in my layout <code>content_main.xml</code> I am getting message <code>Using version 1.0.0-alpha5 of the constraint library, which is obsolete</code>. now I am using </p> <p><code>compile 'com.android...
<p>Look in the SDK Manager in Android Studio. If you check the "Show Package Details" in the SDK Tools section, you should see all the available verions of ConstraintLayout (under Support Repository -> ConstraintLayout for Android)<a href="http://i.stack.imgur.com/oUhVI.png" rel="nofollow"><img src="http://i.stack.imgu...
Add array item then re-evaluate new array <p>Have been scratching my head for a few hours on this, seems like a silly issue, but just can't find a solution.</p> <p>Here's my sample code:</p> <pre><code>$continueLoop = true; $colorsArray = array("red", "white", "blue"); while($continueLoop == true) { $arrayCount = c...
<p>Will probably clean this up in a moment but just quickly this should do the job;</p> <pre><code>$colorsArray = array("red", "white", "blue"); for ($i=0; $i &lt; count($colorsArray); $i++) { echo "evaluating ".$colorsArray[$i]."&lt;br&gt;"; if($colorsArray[$i] == "blue" &amp;&amp; !in_array('YELLOW', $color...
Ember Data `include` Using JSONAPI Does Not Load Entire Payload <p>Using <em>Ember-2.6</em> with <em>Rails-4.2.7</em> backend <em>JSONAPI-Resources-0.8.0.beta2</em> gem.</p> <p>I've noticed that sometimes when I try to <code>include</code> additional resources, they come back in my payload but don't end up in the Embe...
<p>Turns out that my declarations of my relationships inside my Ember-Data models were using camel-case naming but <strong>MUST use dasherized declarations</strong>.</p> <p>For example:</p> <pre><code>// Example Investment model (investment.js) export default DS.Model.extend({ // ... /** * The investment can h...
How to get values from table <p>I am facing sql query issue. Following is the table structure</p> <p>We have table tbllogin where we are maintaining all type of users like user,admin and vendor columns like userId(pk), name, email.</p> <p>we have another table tbltransaction where we are maintaining transaction of ...
<p>Something like this??</p> <pre><code>SELECT u.Name as userName, v.Name as vendorName, v.email as vendorEmail FROM tbltransaction t LEFT JOIN tbllogin u ON t.userId = u.userId LEFT JOIN tbllogin v ON t.vendorId = v.userId </code></pre>
List of possible values for particular path variable in Spring MVC <p>Consider three REST resources:</p> <pre><code>/persons/id/{id} /persons/code/{code} /persons/email/{email} </code></pre> <p>I want to make one method in <code>Spring MVC</code> controller to handle these requests:</p> <pre><code>@RequestMapping("/...
<p>It can be easily done using <code>regular expression</code> in mapping:</p> <pre><code>@RequestMapping("/persons/{searchField:id|code|email}/{searchValue}") </code></pre>
HTML - How do I reveal a checkbox group based on radio group? <p>I want to have an html form with a required radio group. If one particular option in this radio group is selected, it reveals a checkbox group. This checkbox group should only be required if it is revealed. How could I do this? Preferably in pure HTML, bu...
<p>Something like this should work:</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>.checkbox-group { display: none; } [type=radio]:checked + .checkbox-group { d...
iOS Firebase app not configured after calling FIRApp.configure() <p>I have an iOS (Swift) app with the following code in the AppDelegate:</p> <pre><code>func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -&gt; Bool { FIRApp.configure() ...
<p>Try:</p> <pre><code>override init() { // Firebase Init FIRApp.configure() } </code></pre>
Add Outlook signature into macro that generates new Mail item <p>A little trouble with this. So i am creating a macro that will create a new email from the 2 cells outlined in the code. When i run it, it doesn't have my email signature attached to it. I have tried to work it out but I'm struggling a little bit. Does it...
<p>When you set the HTMLbody, make sure to append the existing HTMLbody to the end of it. That contains the existing signature.</p> <pre><code>Sub SendEmail() Dim OutlookApplication As Object, OutlookMail As Object Set OutlookApplication = CreateObject("Outlook.Application") Set OutlookMail = OutlookApp...
Import customer reporting schedule into Google Analytics <p>The company I work for has a custom reporting schedule, similar to the month specific groups four or more weeks are grouped into 'periods'. I have a mapping from date to period that I wish to upload to Google Analytics using its data import function.</p> <p>W...
<p>No, this is for the most part not possible; imported data is applied to incoming data but not to data that has already been collected, and then it is applied to all hits, not to a specific timeframe. Also you cannot create new interactions, you can only amend or change interaction data as it is being collected.</p> ...
Which is the right way to pass nested parameters to a build method ? (Ruby on Rails 5) <p>I am building a very simple application managing users and keys. Keys are nested attributes of a user. I am inspired by <a href="http://railscasts.com/episodes/196-nested-model-form-part-1" rel="nofollow">RailsCast #196</a>. The m...
<p>Remove the '{' tags inside the build method parameters. Should be: </p> <pre><code>key = @user.keys.new(secteur: "Tous", clef: "ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678") </code></pre> <p>Also, the build method is just an alias for 'new' and used to behave differently on rails 3 apps so I've always strayed away from it ...
Unexpected token error when parsing JSX file <p>Am getting the below error in my main.js file when using ESLint and babel</p> <p>main.js</p> <pre><code>const mountNode = document.getElementById('app'); function HelloMessage(props) { return &lt;div&gt;Hello {props.name}&lt;/div&gt;; } render(&lt;HelloMessage name="t...
<p>The error finally went away by adding the below to my <code>.babelrc</code></p> <pre><code>{ "presets": ["react", "es2015"], "env": { "development": { } }, "plugins": [ "transform-export-extensions" ] } </code></pre> <p>Ofcourse this required the following npm packages to be installed</p> <p...
Poor performance from looping SQL Server Update statement <p>So I have a stored procedure that needs to regularly update a large table with around 70 million records in it. I typically always have followed the standard of doing looping updates to avoid locking any of my other large tables and with that I normally didnt...
<p>So, I would suspect that this is slower because on every loop your query has to figure out the set of records to update i.e. evaluate this:</p> <pre><code> WHERE LastUpdate &gt;= CAST(CONVERT( Varchar(10), DATEADD(day,-1,GETDATE()), 110) as DateTime) AND LastUpdate &lt; CAST(CONVERT( Var...
How can I retreive data from an API (Steam) <p>I am currently building a website in Laravel 5.3 with PHP enabled.</p> <p>But i'm bit stuck on how I can retreive data from the Steam API.</p> <p>This link <code>(http://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v0002/?appid=730&amp;key=XXXXXXXXXXXXXXXXXX...
<p>You should make a request on that URL as this is a REST API.</p> <p>Please refer to the curl() function in PHP.</p> <p>Here are <a href="http://www.techflirt.com/php/php-curl/curl-examples.html" rel="nofollow">some calls examples</a> using the curl() function. </p>
Is it possible to disable the contextmenu plugin in CKEditor without having to disable any other plugins? <p>I want to enable native spellchecking in CKEditor which requires you to disable the CKEditor context menu, however to do that it seems you also need to disable the tabletools, tableresize and liststyle plugins, ...
<p>So it turns out that to get around this we had to remove the parts of the code in the tableresize and liststyle plugins that required the context menu. The plugins work fine without the menu (they even have <code>if</code> statements to not run specific parts if the context menu plugin is not present), however they ...
Classic ASP: Emit Response with charset UTF-16 <p>I need to do a script in classic ASP to generate a CSV file for the user to download. It needs to be encoded in "classic Windows Unicode", ie., UTF-16.</p> <p>I tried this:</p> <pre><code> Response.Clear Response.ContentType = "text/csv" Response.Charset = "utf-1...
<p>Well, I “solved” it using an <code>ADODB.Stream</code>. The disadvantage of this is that I need to accumulate the full output in memory before I send it to the user. Basically,</p> <pre><code>dim s set s = Server.CreateObject("ADODB.Stream") s.Type = 2 ' text ' s.Open do while &lt;getting data&gt; s.WriteTex...
Do I have to run dask.distributed or dask.multiprocessing as sudo on Mac OS X? <p>I am new to using dask for distributed/parallel computing. I have great problem to get it work on my Mac, but it seems to work when I run as root. This seems not be the best way of running long running programs. I there any solution to th...
<p>No. You do not need to have root permissions to use dask.distributed.</p>
How to download this GIF(dynamic) by Python? <p>I give an url as example:</p> <pre><code>http://ww4.sinaimg.cn/large/a7bf601fjw1f7jsbj34a1g20kc0bdnph.gif </code></pre> <p>You can see it in your browser.</p> <p>Now I want to download it. I <strong>have tried</strong>:</p> <p>1.</p> <p><code>urllib.urlretrieve(imgur...
<p>This works quite fine for me, to get the animated gif:</p> <pre><code>&gt;&gt;&gt; import requests &gt;&gt;&gt; uri = 'http://ww4.sinaimg.cn/large/a7bf601fjw1f7jsbj34a1g20kc0bdnph.gif' &gt;&gt;&gt; with open('/tmp/pr0n.gif', 'wb') as f: ... f.write(requests.get(uri).content) ... </code></pre> <p>Happy fap...
PERL Net::SFTP::Foreign autodie=>0 then 1 <p>I'm writing a script that retrieves some files automatically once a day on some sftp server. The problem is this sftp server is not very reliable and sometimes the client have to retry a couple of times until opening the session successfully. I choose Net::SFTP::Foreign for ...
<p>You can wrap your connection into eval statement and set autodie to 1. This should work:</p> <pre><code>use Net::SFTP::Foreign; print "Opening SFTP session...\n"; my $j = 1; my $sftp_max_retry = 5; my $sftp; while (1) { eval { $sftp = do { local $SIG{TERM} = 'IGNORE'; # used to avoid the message...
Extend blade engine in Laravel to use different views directory <p>I am working on a Laravel project and I am very new to it. For now, I want to use blade templates to render views but I want it to search for views in different directories like <code>&lt;custom_dir&gt;\views</code> instead of default <code>resources/vi...
<p>You could probably append the path to the configuration:</p> <p>1) Statically, by modifying file <code>config/view.php</code> </p> <pre><code>'paths' =&gt; [ realpath(base_path('resources/views')), //more paths here ], </code></pre> <p>2) Dynamically at runtime:</p> <pre><code>$paths = config('view.paths...
replicaSet db status after failover and recover <p>My mongodb version is 3.2.4. I have a replicaSet with 2 database nodes and 1 arbitor. All db are running fine for a long time at my customer site. One day, the primary db was brought down for maintenance. After about 2 hours, the-was-primary was brought back up, and be...
<p>When you want to bring down a primary for maintenance, you'd have to do a rs.stepDown() command on the primary. This will elect the other DB node to become the primary:</p> <ul> <li>Primary steps down, it rejects writes. Your application will get brief write errors until the next bullet point below is completed.</l...
Change Bootstrap's mobile navbar breakpoint <p>I'm sorry if the title is confusing, the actual problem is very simple to understand.</p> <p>I have a bootstrap responsive navbar which toggles between mobile and desktop view at 768px breakpoint.</p> <p>However, I would like it to keep the mobile navbar til 992px breakp...
<p>You should also target <code>.navbar-nav .open .dropdown-menu</code></p> <p>Try to add something like this:</p> <pre><code>@media (max-width: 992px) { .navbar-nav .open .dropdown-menu { position: static; float: none; width: auto; margin-top: 0; background-color: transparent; border: 0; ...
Creating a folder with the same name as a controller results in 404 - Web API 2 <p>If one creates a root level folder with the same name/route as a controller IIS seems to try and route to the folder and not consult the WebAPI 2 routing.</p> <p><strong>Example:</strong></p> <pre><code>ProjectA |- Controllers/ |-- Exa...
<p>The routing system checks the file system to see if a URL matches a file/folder on the disk. If it finds a match, the routing is ignored and the request bypassed any route entries so that the file will be served directly. This is there so that static files are served without going through MVC Routing</p> <p>To chan...
Kendo Grid and Modal MVC 5 <p>I'm trying to display a selected row of my kendo grid :</p> <pre><code>@(Html.Kendo().Grid&lt;Solution.ViewModels.ItemViewModel&gt;() .Name("myGrid") .Columns(columns =&gt; { columns.Bound(c =&gt; c.item1); columns.Bound(c =&gt; c.item2); columns.Bound(...
<p>The following example shows a pretty similar scenario:</p> <p><a href="http://docs.telerik.com/kendo-ui/controls/data-management/grid/how-to/Editing/grid-external-form-editing" rel="nofollow">http://docs.telerik.com/kendo-ui/controls/data-management/grid/how-to/Editing/grid-external-form-editing</a></p> <p>The ide...
Get parents and children given a segment in a recursion SQL <p>Given an ID at the beginning or middle or end, I want to look up for all the rows that are linked between them.</p> <p>With this I found the child elements recursively</p> <pre><code>declare @T table( Id int primary key, Name nvarchar(255) not null, ...
<p>Ok! I've got you:</p> <p>I created a separate family for testing.</p> <p>The first thing you need to do is create a query to find the oldest ancestor of your chosen ID. That is the first CTE below. Then you designate that, I called it <code>@Eve</code> and find Eve, all children of Eve.</p> <p><a href="http://...
Confusion with comparison error <p>When i run the following </p> <pre class="lang-python prettyprint-override"><code>def max(L): m = L[0][0] for item in L: if item[0] &gt; m: m = item return m L = [[20, 10], [10, 20], [30, 20],[12,16]] print(max(L)) </code></pre> <p>i get the error ...
<p>In the first iteration of your <em>for</em> loop, doing <code>m = item</code> makes <code>m</code> reference a <code>list</code> which afterwards cannot be compared with an <code>int</code> (viz. <code>item[0] &gt; m</code>) in the next iteration. </p> <p>You should instead assign <code>m</code> to one of the eleme...
googlevis $ operator is invalid for atomic vectors <p>I've hit the dreaded "$ operator is invalid for atomic vectors" error. It happens when I add the gvisLineChart. Any suggestions?</p> <pre><code>library(shiny) library(googleVis) #this is a dput of a sql query to make the example reproducible. #In reality this wil...
<p>googleVis plots aren't quite like regular plots in R. Regular plots produce static images but googleVis produces basically mini-web pages with HTML and javascript data as well. Therefore you should't use <code>plotOutput</code>, you should use <code>htmlOutput</code> to render them to the page. Also, you don't need ...
get serialize data from form <p>I have page like this:</p> <pre><code>&lt;script src="https://code.jquery.com/jquery-1.10.2.js"&gt;&lt;/script&gt; &lt;form id="kelas"&gt; &lt;div class="span12"&gt; &lt;div class="span2"&gt; &lt;input type="text" name="nama_kelas" value="Nama Kelas" style="width: 200px" cla...
<p>Your traverses are incorrect.</p> <p><a href="http://api.jquery.com/prev/" rel="nofollow"><code>prev()</code></a> looks for a sibling and that <code>&lt;span&gt;</code> has no siblings.</p> <p>The <a href="http://api.jquery.com/parent/" rel="nofollow"><code>parent()</code></a> of the <code>&lt;span&gt;</code> is ...
Calculations in Wordpress <p>I am trying to figure out how to do calculations in WordPress. I don't want a "calculator" but I want to display the result of a calculations.</p> <p>I already have a custom value called [days] associated with the custom post type. I need somewhere to store a global value of [rate] and a w...
<p>I got the following code to activate:</p> <pre><code>&lt;?php /** * Plugin Name: nkdAgility Rate Calculator * Description: Tell Us What Your Shortcode Does * Version: 0.6 * Author: MrHinsh * Author URI: https://nkdagility.com */ function nkdCalculate_shortcodes_init() { function nkdCalculate_shortcode($atts,$c...
Quartz.net Scheduler memory leak <p>I have a scheduler windows service running in the server with different schedule time each job.</p> <p>There are two problems that came up:</p> <ol> <li><p>During the week the service is running correct doing all the jobs that have to do, but in certain time it throw an OutofMemory...
<p>Quartz should clean after itself. If you implemented a custom JobFactory be sure to Release your Jobs after execution.</p>
In Swagger UI, how to customize body input ui (model schema UI) <p>I'm using 'swagger UI' with Swagger 2.0 in C#.Net app, and displaying Get, Post, Delete endpoints.</p> <p>For Post, I'm passing 'model schema' as a body(input parameter).</p> <p>Its difficult to use one textarea for to input class object. </p> <p>Is ...
<p>Did you notice that clicking on the <code>Example value</code> on the <strong>Data Type</strong> column actually fills in the body value with the default entity content? That's a start to avoid typing it all.</p> <p>Nonetheless, you <a href="https://github.com/domaindrivendev/Swashbuckle/tree/swagger_2.0#customizin...
Run Play application in production mode using dist taks <p>I am using 'dist' task to generate a distribution of my play application. But if I unzip the generated artifact, in the bin/ directory I have access to the bash file generated by the 'dist' task. The last line of the script is : run "$@" </p> <p>I saw in the o...
<p>You are mixing two different things.</p> <p>The <code>run</code> command stated in the Play documentation is a SBT command, that will start your app in dev mode. So to use that command you have to use activator or sbt (ex: <code>./activator run</code>).</p> <p>The <code>run</code> you see in that script is a bash ...
WooCommerce widget - List of orders from date to date <p>I want to create a dashboard widget to show orders for the first half of the current month, this is my code:</p> <pre><code>add_action( 'wp_dashboard_setup', 'register_my_dashboard_widget' ); function register_my_dashboard_widget() { wp_add_dashboard_widget(...
<p>To give a list style you need to Iterate each order in a loop. You will echo <strong><code>&lt;ul&gt;</code></strong> HTML tags outside the loop and <strong><code>&lt;li&gt;</code></strong> HTML tags inside the loop. I have add in your query the desired order status.</p> <p>I have changed a little bit your code:</p...
Vueify / VueRouter / Laravel - Component not defined <p>I'm building a relatively simple laravel application and wanted to learn Vue.js... which is turning into a super frustrating mess...</p> <p>Anyway, here's the issue. No matter what I do, I get the error that my component isn't defined.</p> <p>Here's what I have....
<p>You need to register the component with Vue. You are telling the router to build a component view when the route changes, but Vue also needs to know about the component.</p> <p>After you import your component, try: <code>Vue.component('Form2016_1099_misc', Form2016_1099_misc);</code></p> <p>See: <a href="https://...
How to make tab active when application load using tabset? <p>When my application loads first time it loads <code>app.dit</code> page but tab does not show active once you start clicking on tabs it works after that, So I want to make first tab <code>DIT</code> active when application load. How can i achieve that task w...
<p>From <a href="https://github.com/angular-ui/bootstrap/tree/master/src/tabs/docs" rel="nofollow">the docs</a>, the <code>active</code> variable bound in <code>&lt;uib-tabset active="active"&gt;</code> must be the index of the tab you want to show as active.</p> <p>Setting the <code>$scope.active</code> variable to 0...
Can you have foreign key constraint without having to create another table? <p>I am not quite sure how to word this so I will give an example. I have a program that reads in it's database tables from user-defined csv files. (I am using SQLite with Python.)</p> <p>Say we have tables:<br></p> <p><strong>Profile (</str...
<p>Foreign keys need to identify a row in the parent table. This is usually done with the primary key, but any other <em>unique</em> key works as well; the only requirement is that the uniqueness is enforced (with a UNIQUE constraint):</p> <pre class="lang-sql prettyprint-override"><code>CREATE TABLE Profile ( profi...
Material Design Lite - Bottom Line in text field has a slight gap with colored line <p>I am trying to get Material Design Lite text field to work and I have an issue where the bottom colored line has a slight 3-4 px gap between the gray starting line. Any MDL text Field example I plug into my page I get the same result...
<p>I did face the same issue with MDL when used with boostrap and turns out the boostrap css file adds a margin of 5px to its bottom for the Label elment which creates a 5px gap.</p> <p><a href="https://jsfiddle.net/ilinkmat/90u6Lxc4/" rel="nofollow">JSFiddle-Recreating the issue</a></p> <p>Code snippet from Bootstr...
Multiple types in a list? <p><strong>Rephrasing of my questions:</strong></p> <p>I am writing a program that implements a data mining algorithm. In this program I want to save the input data which is supposed to be minded. Imagine the input data to be a table with rows and columns. Each row is going to be represented ...
<p>DataFrames in R are heterogenous lists of homogeneous column vectors:</p> <pre><code>&gt; df &lt;- data.frame(c1=c(r1=1,r2=2), c2=c('a', 'b')); df c1 c2 r1 1 a r2 2 b </code></pre> <p>You <em>could</em> think of each row as a heterogeneous list of scalar values:</p> <pre><code>&gt; as.list(df['r1',]) $c1 [...
What does a `~` tilde in a CSS `url()` do? <p>E.g. <code>@import url("~./foobar");</code></p> <p>Saw it <a href="https://github.com/izaakschroeder/font-loader/blob/master/example/test.css#L2" rel="nofollow">here</a>, not sure if it's some package specific thing or if it's actual CSS syntax.</p>
<p>CSS @import is relative to the current working directory. </p> <p>So using the prefix <code>~</code> at the start of the path tells the Webpack loader to resolve the import "like a module".</p> <p>What that means is if you had a module called <code>normalize</code> available, and you needed to import a file that b...
More than one variable in php arrays <p>In a form within a sqlsrv_fetch_array I have</p> <pre><code>&lt;select class="styled-select" name="StockArray['.$row1['ProductID'].']" required&gt;&lt;option selected&gt;&lt;/option&gt;&lt;option&gt;0&lt;/option&gt;&lt;option&gt;1&lt;/option&gt;&lt;option&gt;2&lt;/option&gt;&lt;...
<p>You can by encoding/decoding the variables. So, for example if your productID is 4 and you want to encode a LocationID (let say 28) then you can name the variable like this: P4L28, so in php:</p> <pre><code>$sel = '&lt;select class="styled-select" name="' . "P{$row1['ProductID']}L{$row1['LocationID']}" // and so on...
Postgres change datatype during select into statement <p>Running postgres with postgis extension: trying to change datatype of column during a select into table statement </p> <p>The column sum_popint in the munsummary table is double and I want to change it into an integer column during the select statement. I am awa...
<p>what you are looking to do is <code>CAST</code> it to an integer. This takes the form of <code>CAST ( expression AS type );</code> </p> <p>So in your SELECT, try: </p> <pre><code>SELECT county, CAST(SUM(sum_popint) as INTEGER) AS residentialpopulation, st_union(geom) INTO countysummary FROM munsumm...
R Shiny - No initial value selected in radioButtons? <p>From the documentation:</p> <blockquote> <p>radioButtons(inputId, label, choices, selected = NULL, inline = FALSE, width = NULL)</p> <p><strong>Arguments</strong></p> <p><em>selected</em> The initially selected value (if not specified then defa...
<p>The problem with <code>selected</code> is that if not specified then defaults to the first value. But you can workaround this using the following:</p> <pre><code>selected = character(0) </code></pre> <p>Another way is providing a default option, like <code>Nothing Selected</code></p> <pre><code>radioButtons("test...
How to convert a datetime.time type to float in python? <p>I am performing a data analysis with python. I need to convert a data type from datatime.time to float, something like what makes Excel when we change the cell format from "time" to "number".</p> <p><a href="http://i.stack.imgur.com/fwvHt.png" rel="nofollow"><...
<p>The decimal number used by Excel is simply the fraction of a day that a time represents, with midnight being 0.0. You simply take the hours, minutes, and seconds in the time and divide by the fraction of a day they represent:</p> <pre><code>def excel_time(time): return time.hour / 24.0 + time.minute / (24.0*60...
angular2 forms, selected item in <select> element <p>Here's the <code>FormBuilder</code>:</p> <pre><code>let valuesArray = fb.array([ fb.group({ name: 'one' }), fb.group({ name: 'two' }), fb.group({ name: 'three' }), fb.group({ name: 'four' }) ]); this.form = fb.group({ values:...
<p>I think this should do what you want:</p> <pre><code>&lt;div&gt;{{selectedItem | json}}&lt;/div&gt; &lt;select formControlName="mySelect" [(ngModel)]="selectedItem"&gt; &lt;option *ngFor="let item of items" [(ngValue)]="item"&gt; </code></pre> <pre><code>this.form = fb.group({ mySelect: [] }) items = [ ...
Most Efficient Way to Get a Single Item Based on Priority Condition <p>I have a scenario where there are multiple images within each group and a single image needs to be extracted based on a string criteria.</p> <p>Below is the way it is done right now, and it works; however, not sure if this is the most efficient way...
<p>I'm afraid you might find this answer slightly boring but I would avoid trying to find some extremely impressive-looking but complex linq query. I'm sure it could be done but it's not worth the headache.</p> <p>Just stick all your strings in an array and check them in order of priority. Unless you're running throug...
Why while(scanf("%lld", &num) == 1) is faster than while(scanf("%lld", &num)) <p>I have tried to solve a problem from Uva Online Judge. Problem number is 10302. My accepted code is given below.</p> <pre><code> #include &lt;cstdio&gt; int main() { long long int num, sum; while(scanf("%lld", &amp;num) == 1...
<p><strong>Your second version has an <em>infinite loop</em>.</strong></p> <p><a href="http://en.cppreference.com/w/cpp/io/c/fscanf"><code>scanf</code></a> returns <code>EOF</code> (probably a macro for <code>-1</code>, though this depends on your system to some degree) when it runs out of input, and this return value...
Test async.waterfall in node.js with sinon.js timers <p>I have the following function that I wish to be tested which use async.js heavily in it:</p> <pre><code>MyClass.prototype.pipeline = function(arg1, arg2) { ... async.waterfall([ async.apply(self.a.f.bind(self.a), arg1, arg2), function(data...
<p>You left out a lot of stuff so it is hard to tell what this is supposed to do. Mostly to be honest this looks like noise to me although thats not your fault.</p> <p>If you don't actually need to do lots of IO in parallel then here is what I suggest. Switch to ES2017 and babel. Use classes with @autobind or synta...
How to use a layout from a gem in rails? <p>I am making a gem <a href="https://github.com/BDMADE/college-admin" rel="nofollow">https://github.com/BDMADE/college-admin</a> , It is a simple a layout of an admin template, I am making this gem, for why, I want to re-use in my several rails app.</p> <p>My welcome controlle...
<p>@Engr.Tanbir Hasan I would Like to say , that @kris was right about it . You may need to start it again . You can take help from here :</p> <p><a href="https://www.sitepoint.com/create-ruby-gem-jquery-plugin-basics/" rel="nofollow">Beginner Tutorial</a></p> <p><a href="https://www.sitepoint.com/create-ruby-gem-jqu...
MS Sql Server: Trailing spaces and disk space in a varchar column in a table <p>Does removing trailing spaces in a Varchar column values save any disk space?</p>
<p>Of course it does. Might not be very much. But every one of those trailing spaces the computer has to store so removing those will free up space.</p>
Remove and re-insert a GeoFire location to trigger onKeyExited and onKeyEntered doesn't work <p>I having a problem with GeoFire and so, Firebase.</p> <p>I want to update an information on the UI based on a GeoFire location trigger. When an action occur on client side, a data has to be saved on the Firebase database, a...
<p>This can probably be solved by using a so-called <a href="https://github.com/firebase/geofire-java/blob/master/src/main/java/com/firebase/geofire/GeoFire.java#L199" rel="nofollow">completion listener</a> in to <code>removeLocation()</code>.</p> <p>A quick, untested write-up (so it may contain syntax errors):</p> <...
SAML is a first class citizen in SharePoint 2016, does that mean it doesn't require ADFS for authentication? <p>SAML is a first class citizen in SharePoint 2016, does that mean it doesn't require ADFS for authentication?</p> <p>I am configuring SharePoint 2016 for the first time and trying to determine if a need and A...
<p>You don't need ADFS, however, you may need to develop your own people picker.</p>