input
stringlengths
51
42.3k
output
stringlengths
18
55k
how to save filename of file upload in codeigniter <p>I have a form that implement field upload more than 1 file. but i still confused how to store it to mysql. i just wanna to make all the file saved in mysql with just once submit. i need your help.</p> <p>this is my controller :</p> <pre><code>function do_upload() ...
<p>When upload succeeds, <code>$this-&gt;upload-&gt;do_upload($key)</code> returns some data.</p> <p>Have a look here: <a href="https://www.codeigniter.com/userguide3/libraries/file_uploading.html#CI_Upload::do_upload" rel="nofollow">CI3 Docs</a></p> <p>So, save it into a variable, say <code>$data</code> like,</p> <...
ASP.NET application and user it is running under <p>I have multiple applications on a IIS server. How can I set one particular application to run as user 'appuser' and all uploaded files to be saved by as this user. ASP.NET</p>
<p>Every single IIS application run under some so-called application pool. The application pools have default identity (App Pool Identity in newer IIS, NETWORK SERVICE in older IIS). You can also set application pool to have custom identity by specifying user credentials. </p> <p>However it seems like an overkill to r...
Mysql Query with Cases <pre><code>SELECT *, CASE WHEN paydatefinal IS NULL OR paydatefinal = '0000-00-00' THEN paydate ELSE paydatefinal END AS `paydatefinColumn` FROM `ws_crm_comenzi` WHERE `sezonId` = '4' AND `service_id` = '1' AND `finished` = '1' AND `paydatefinColumn`='2016-09-26' ORDER BY `pay...
<p>Since that generated column is rather lengthy and you cannot use a generated column in a where clause, the easiest perhaps to wrap the whole thing in another select</p> <pre><code>SELECT * FROM ( SELECT *, CASE WHEN paydatefinal IS NULL OR paydatefinal = '0000-00-00' THEN paydate ELSE paydat...
Filter array elements with $regex <pre><code> ///sample Data { "_id" : "CUST1234", "Phone Number" : "9585290750", "First Name" : "jeff", "Last Name" : "ayan", "Email ID" : "", "createddate" : 1462559400000.0, "services" : [ { "type" : "Enquiry", "timeSpent" ...
<p>This is because you are passing in a string of JavaScript regular expression object to <a href="https://docs.mongodb.com/manual/reference/operator/query/regex/#regex-vs-pattern-syntax" rel="nofollow"><code>$regex</code></a>. Change your regex to one of the following.</p> <pre><code>"service": { "$regex": /^t/, "$op...
Meaning of ? and $ in htaccess rewrite Rule <p>I know the basic rewrite rule in .htaccess file. but i can't find the meaning of highlighed <code>?</code> and <code>$</code>:</p> <p>RewriteRule ^([a-zA-Z]<em>)/<code>?</code>([a-zA-Z]</em>)<code>?</code>/<code>?</code>([a-zA-Z0-9]*)<code>?</code>/<code>?$</code> index....
<p>This question is more of regex rather than a .htaccess one. Let me try to to answer:</p> <ul> <li><code>?</code> in regex means 0 or 1 match or to make something an <strong>optional</strong> match</li> <li><code>$</code> is end anchor in regex that means the end of input.</li> </ul> <p>Your rewrite rule appears to...
Setting a Parcelable as an ImageView image <p>I've been using this library <a href="https://android-arsenal.com/details/1/4072" rel="nofollow">https://android-arsenal.com/details/1/4072</a> to get images from gallary and camera to set as a profile picture.</p> <pre><code> TextView chooseImageTextView = (TextView) f...
<p>A quick digging into the source code of your provided library reveals that the <code>Image</code> class is not from the android package <code>android.media.Image</code>.</p> <p><a href="https://github.com/nguyenhoanglam/ImagePicker/blob/master/imagepicker/src/main/java/com/nguyenhoanglam/imagepicker/model/Image.jav...
How do i dereference some files in my git repo <p>When working on my Cordova project, I didnt have a <code>.gitignore</code> file, so when i committed everything (by way of <code>git add *</code>, it seemed to commit all my platforms, .idea, and plugins.</p> <p>So, this is now pushed to GIT, but I wanted to dereferenc...
<p>For file:</p> <pre><code>git rm yourFile </code></pre> <p>For dir:</p> <pre><code>git rm -R yourDir </code></pre>
How to obtain implicit ownerCtx: rx.Ctx.Owner in scala.rx <p>Here goes basic hello world example using <a href="https://github.com/lihaoyi/scala.rx" rel="nofollow">scala.rx</a> in <em>version 0.3.1</em>.</p> <p>It doesn't compile because of lack of <code>implicit ownerCtx: rx.Ctx.Owner</code>. How do I get this instan...
<p>It seems that providing implicit value of <code>rx.Ctx.Owner</code> is done <em>auto-macro-magically</em> only when code requesting for <code>rx.Ctx.Owner</code> is inside code block which will run only once. This includes <code>object</code>s, <code>val</code>s, <code>lazy val</code>s, etc.</p> <p>This example wil...
Add generated subproject configure file to main project in CMake <p>I am trying to compile my application using CMake, and I need to compile Lua with it for various reasons. My current setup is as follows:</p> <p><code>project/ CMakeLists.txt ... libs/ CMakeLists.txt ... lua/ CMakeLists.tx...
<p>If you're including lua directly via an <code>add_subdirectory</code> call, you can also use <code>include_directories(${lua_BINARY_DIR})</code> (assuming there's a <code>project(lua)</code> command in lua's CMakeLists.txt file). The name of the variable may be something else if the project command is different, or ...
Laravel Images in Public Folder <p>I am trying to integrate innovastudios contentbuilder.js (<a href="http://innovastudio.com/content-builder.aspx" rel="nofollow">http://innovastudio.com/content-builder.aspx</a>) in my existing laravel 5 project and facing some issues. The JS is working properly, but I am missing some ...
<p>I think the problem lies in the JS code snippet that you have provided.</p> <p>Instead of defining the snippetFile with the <code>asset()</code> helper,</p> <p>In your <code>file.blade.php</code> add this snippet at the beginning inside the <code>&lt;head&gt;</code> tag.</p> <p>So, your blade looks like this</p> ...
bootstrap image resizing to screen size with in container <p>I have a bootstrap page which gives me tiles that adjust position to screen size. It all work great but I have a problem with adding images to tiles along with other items. The below script is an example of my problem. The first tile has an image which is dis...
<p>You forgot <code>class="img-responsive"</code> on your second image, or was that on purpose?</p> <p>You should take a look into <a href="http://getbootstrap.com/css/#grid-media-queries" rel="nofollow">Bootstrap Media Queries</a></p> <pre><code>/* Extra small devices (phones, less than 768px) */ /* No media query s...
Clearing a char-array <p>I want to clear some bits of a char array in c! I wanted to know if it's faster to clear 4 bits (for example) this way : </p> <pre><code>for(int i =0; i&lt;3; i++){ array[2][i][9][14][1] = 0; array[2][i][8][14][1] = 0; array[2][i][7][14][1] = 0; } </code></pre> <p>or by clearing the whole arr...
<p>It depends from code optimalization during compilation. Every compilator using different optimalization. (gcc / ms visual studio / etc ... )</p> <p>I think nobody compile without optimalization nowadays.</p> <p>Best way to compare which method is faster is make your own benchmark.</p> <p>Try every method on reall...
represent and sorting polynomial using linked list IN C <p>Help me please. Code below is made to represent the polynomial function and sorting that polynomial:</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; typedef struct PolyNode *pnode; typedef struct PolyNode { float coef; int expon; ...
<p>Your problem appears to be that you are not allocating enough space for each node. Given this code:</p> <pre><code>pnode ptr; ptr = (pnode) malloc(sizeof(pnode)); </code></pre> <p>Type <code>pnode</code> is a <em>pointer</em> type, so you are allocating enough space for a pointer. What you need is enough space f...
Why are sysprocesses left open on SQL Server for a long time? <p>I've noticed a lot of db connections left open on my production SQL Server, some for a very long time. Many of these have an open transaction. As seen in the query:</p> <pre><code>select * from sysprocesses where open_tran&gt;0 </code></pre> <p>They ar...
<blockquote> <p>They are in status = "sleeping", cmd = "AWAITING COMMAND".</p> </blockquote> <p>when you see a row in sysprocesses with a status of sleeping,that means this connection is active ,but not being used..This also happens due to <a href="http://stackoverflow.com/questions/11179880/number-of-open-connecti...
Java, can a static method instantize an object where it was called? <pre><code>public class Depot extends Item2 { } public class Ship extends Item2 { } abstract public class Item2 { public static void loadFromStream(FileInputStream oos) throws IOException { return new whatToWriteHereToGetDEPOTorSHIP? ...
<pre><code>abstract public class Item2 { public static Item2 loadFromStream(FileInputStream oos) throws IOException { try (ObjectInputStream ois = new ObjectInputStream(oos)) { return (Item2) ois.readObject(); } } } </code></pre> <p>After that you need to cast. If you want the stati...
any one knows the solution for this? <pre><code> Private Sub Btnlog_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnlog.Click If txtuser.Text = "Manish" And txtpw.Text = "Nair" Then MessageBox.Show("welcome") Else MessageBox.Show("Try again") ...
<p>You haven't stated the issue. However, just reading your code, you're using count() which is calling the variable count as a function. Also, count is never defined. Please try:</p> <pre><code> Private Sub Btnlog_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnlog.Click d...
pymongo get rid of ObjectId <p>I'm using pymongo to insert records into my mongodb database:</p> <pre><code>mongo = MongoClient('localhost',3001) db = mongo.meteor db.clients.insert({"hi":"test"}) </code></pre> <p>the id of the inserted record is of type:</p> <blockquote> <p>_id: ObjectId("57e92af647700265a2427f69...
<p>You can just specify the <code>_id</code> on insert:</p> <pre><code>db.clients.insert({"hi":"test", "_id":"123"}) </code></pre>
C++ how to manage dependencies (use libraries from github for example) <p>I'm very new to C++ world, so please, sorry me for such a dummy question. I google a little, but wasn't able to find proper answer.</p> <p>My question is fairly simple - how should I use lib's in C++ world. For example in Java - there is <code>m...
<p>C++ sadly has no package manager for libraries. Some are out there and try to be one which are still small and scattered though (like conan).</p> <p>In linux you have some "-dev" packages you can install but they are also not "all".</p> <p>You most likely end up downloading them yourself. Next though is you have t...
"svg:hover path" is only working on the last svg <p>I'm trying to have a responsive logo, that on hover the colour changes. </p> <p>There are three versions of the logo which pop in and out with media queries, all that need the same effect, but only the last svg works</p> <p>HTML:</p> <pre><code>&lt;section class="w...
<p>Here you will find a <a href="https://codepen.io/illdapt/pen/XjRpJJ" rel="nofollow">working pen as well</a>.</p> <p>Instead of using <code>opacity</code> to "hide" the others, try <code>display: none</code> on the elements you want to hide, thus allowing the logo you want to always be present hoverable and on top. ...
Django REST framework without model <p>I want to use Django REST framework to create an API to call different methods. I read the guide of [django-rest-framework][1] to work with this framework, but I still have some questions.</p> <p>I have no model I get my data from an external database. I want to try first somethi...
<p>From docs <a href="http://www.django-rest-framework.org/tutorial/1-serialization/#creating-a-serializer-class" rel="nofollow">here</a>.You don't have to have a model for create a Serializer class.You can define some serializers field then use them. You should not import CPUProjectsViewSet and also define it in below...
Qt Android Application Execution failed <p>I'm learning developing Android Application by Qt Creator (v4.1.0 Community). When I build my sample app, there's no issue but when I run it with Android x86 Kit (GCC 4.9, Qt 5.7.0), it's failed and I get this message from Compile Output Console (it still runs well when I run ...
<p>Do you see your Android kit get detected automatically ? or was it added by you manually. I would suggest to try the thing I mentioned below and see if that helps. </p> <p>On Projects, Build Android APK, change the Android build SDK to newer version as shown in the picture below:</p> <p><a href="http://i.stack.img...
Admob Ads within Textview <p>I have a textview created programmatically, loading some data using settext().After the end of first paragraph and before the start of second paragraph I need to load a banner ads using Admob to show up. At the end settext should be called which set all data with Ads.I have tried a lot but ...
<p>You can't place the admob ad inside TextView. Create two textViews for two paragraphs and place the admob banner between the two textviews. This is a better approach</p>
mySQL ORDER BY DAYOFWEEK Starting with TODAY <p>I have a List of events that occur on various days weekly. I would like my query to return the results sorted by day of the week starting with today.</p> <pre><code>'Meeting_Day' = Sunday, Monday, Tuesday... 'Day_of_Week' = 1, 2, 3... SELECT Meeting_Day, Day_of_Week, ...
<p>I looked it over a bit more and found that I could do it thustly.</p> <pre><code>SELECT *, If(Day_of_Week &lt; DAYOFWEEK(Now()), (Day_of_Week + 7), Day_of_Week) as SDAY FROM `meetings` ORDER BY SDAY </code></pre>
php how to insert comma separated multiple strings in json format as one value into mysql table? <p>in php , with the following code:</p> <pre><code>$j_id = $jData[$j]['itop_id']; $res = '"name":"' . $jData[$j]['label'] . '","x":'. $jData[$j]['x'] . ',"y":' . $jData[$j]['y'] . ',"url":"' . $jData[$j]['icon_url'] . '"'...
<p>You should really use prepared statements and parameters. If security isn't an issue you can just change your SQL to look like this:</p> <pre><code>$sql = 'INSERT INTO coordinate_info (id,coordinate_res) VALUES ('.$j_id.',"'. $res.'")'; </code></pre>
Apahce server Forbidden php <p>I just got a VPS and its running Cent OS 6.8 with WHM 58.0. I really don't want the WHM, I only want to add one site to the server. So I just installed an FTP server and uploaded the files to the apache root dir at <code>/usr/local/apache/htdocs</code> and give all files chmod 777.</p> <...
<p>Among other things, you want to make sure that the Linux user that is running Apache has permission to read and execute the PHP files where they are on the server.</p> <p>This is a good guide for transferring PHP files and setting the permissions using PHP: <a href="https://www.digitalocean.com/community/tutorials/...
Is there a way to change background-color of dygraph labels? <p>When I place a dygraph on my website I want the background of the graph to match the background-color of my website. When I set the dygraph background color via css in the <code>&lt;div&gt;</code> tag attributes the color is not applied to the label, it r...
<p>Not sure why you’re having an issue with the color of the background as my graph div is in the body of my page and simply inherits the CSS background style of the page body. As for the color of the legend, amongst other things, see <a href="http://dygraphs.com/css.html" rel="nofollow">http://dygraphs.com/css.html...
Return a q.promise - knockout/app <p>I'm building a mobile app that calls an API. An endpoint of the API gets called on app login and I see the results load in the DOM. I want to defer or promise the output/result for when I then click on a button to open another view/page inside the app. At the moment the app loads th...
<p>You can just put returned data to the MyText and use "if" and "ifnot" bindings in the markup:</p> <p>Code:</p> <pre><code> var MyText = ko.observable(); var company = shell.authenticatedCompany(); return q.getHelpText() .then(function(data) { MyText(data); }); return { ...
Getting a single resource from a JNLP file <p>If I open a <code>.jnlp</code> file I see that it's just an xml with elements such as <code>.jar</code> files and other resources like images. I can currently get the <code>jnlp</code> file by writing:</p> <pre><code>final URL jnlp = new URL("http://&lt;host&gt;:&lt;port&g...
<p>Solved it myself-- It is just concatenating the URL for the <code>codebase</code> with the <code>href</code>! </p> <p>(<em>I input the wrong string while I was testing. /rant</em>)</p> <p>For example:</p> <p>to get <code>test.jar</code> from the bellow <code>.jnlp</code> you use the URL <code>http://&lt;host&gt;:...
How to check if a string contain valid hash <p>i encounter a problem when i want to validate the input string if it contain a valid hash before execute eval on it, for example:</p> <p><code>"{:key=&gt;true}"</code> if i run eval it return a correct hash, but if i run eval on this string <code>"{:key=&gt;true"</code> i...
<p>You can't tell without actually parsing it as Ruby, and (<em>assuming you trust the string</em>), the simplest way of parsing it is to simply do the <code>eval</code> call, and <strong>handle the exception</strong>:</p> <pre><code>begin hash = eval(string) rescue SyntaxError # It's not valid end </code></pre> ...
Angular2: Component doesn't update <p>I am building an angular application about some projects I did. I have a detail page that shows the detail of a project.</p> <p><strong>The problem:</strong> When I go to the project detail page, everything is correct. But when I <strong>switch the project variable</strong> (by us...
<p>You were correctly passing an array of id's to the component but you never listen to the changes made so there is a quick fix for you:</p> <p>in programminglanguages.component.ts change this code:</p> <pre><code>import { Component, Input, OnInit } from '@angular/core'; </code></pre> <p>to</p> <p><code>import { C...
can't make rails assets pipeline to works? <p>i am developing an app in rails with some css and js plugins template, by default we should separate or js and css file into javascript and css folder right? </p> <p>but the problem is my plugins folder structure are quite complex, have a lot of sub folders, so i decided t...
<pre><code>&lt;%= image_tag "logo.png", { src: "logo.png", height: "24"} %&gt; </code></pre> <p>you don't need to set <code>src</code>. The first argument is a filename already. Do this instead:</p> <pre><code>&lt;%= image_tag "logo.png", height: "24" %&gt; </code></pre> <p>If there is a file at <code>app/assets/ima...
PHP SMTP Custom contact form <p>I have this form, that send fine locally, but when i upload it to hostgator i get the following error message </p> <blockquote> <p>Mailer Error: Could not instantiate mail function.</p> </blockquote> <p>my php code is</p> <pre><code>&lt;?php if(isset($_POST['submit'])){ requir...
<p>Just to let you know if anyone finds this, my problem was i was missing $mail->IsSMTP(); from my config.</p> <p>the SMTP config section should be as follows</p> <pre><code>&lt;?php if(isset($_POST['submit'])){ require 'PHPMailer/PHPMailerAutoload.php'; // Send mail $mail = new PHPMailer(); // D...
How to get __lt__() to sort <pre><code>class City: def __init__(self, string): self._string = string.split(',') self._name = self._string[0] self._state = self._string[1] self._latitude = self._string[2] self._longitude = self._string[3] self._location = [self._latitu...
<p>You are comparing your longitude and latitude as <em>strings</em>, not numbers. They are therefor compared lexicographically, not numerically, so <code>'104'</code> will sort <em>before</em> <code>'80'</code> because <code>'1'</code> comes before <code>'8'</code> in the ASCII table (it doesn't matter what other char...
Cannot convert from lpstr to wchar_t <p>I got a piece of code from a Bluetooth example on the web, where we use a condition:</p> <pre><code> ULONG NameToBthAddr(_In_ const LPWSTR pszRemoteName, _Out_ PSOCKADDR_BTH pRemoteBtAddr) { INT iResult = CXN_SUCCESS; BOOL bContinueLookup = FALSE, ...
<p><code>_wcsicmp_l()</code> expects two <code>wchar_t</code> strings, but you are passing a <code>char</code> string in the first parameter, hence the error. Which means <code>pWSAQuerySet</code> is pointing at a <code>WSAQUERYSETA</code> and not a <code>WSAQUERYSETW</code>. Since your code is using the <code>TCHAR</...
value of max_connections in AWS RDS <p>does anyone know where I can found the highest value of max_connections in AWS RDS? I'm primarily interested in the db.t2 instances running MySQL. I cannot find any appropriate link about that. Thanks!!</p>
<p>When you go to configuration details of your RDS you will find a Parameter Group in the details. Click on that parameter group.</p> <p><a href="http://i.stack.imgur.com/IpE5R.png" rel="nofollow"><img src="http://i.stack.imgur.com/IpE5R.png" alt="enter image description here"></a></p> <p>In that parameter group sea...
XAML trigger not triggering <p>do you see anything wrong with this trigger?</p> <pre><code>&lt;Border Margin="2" BorderBrush="#6593CF" BorderThickness="1.5" &gt; &lt;Border.Style&gt; &lt;Style&gt; &lt;Style.Triggers&gt; ...
<p>You have set BorderBrush and BorderThinkness inline on your border. Inline declaration has <a href="https://msdn.microsoft.com/en-us/library/ms743230(v=vs.110).aspx" rel="nofollow">quite hight precedence</a> and override your trigger. Remove your inline declaration from border and move it to trigger:</p> <pre><code...
JQuery disable 16 years date from selected date - jquery-ui-datepicker <p>How to disable the 16 years date(Date-2) range from selected date(Date-1)</p> <p><strong>Example:</strong></p> <p>Selected Date from date-1: 26-09-2016 </p> <p>Disabled Date from date-2: 26-09-2016 - 25-09-2000 </p> <pre><code>&lt;!doctype ht...
<p>Do you mean something like this?</p> <pre><code>$( ".selector" ).datepicker( "setDate", "10/12/2012" ); </code></pre> <p>Here do you have the JQuery datepicker widget example's <a href="http://api.jqueryui.com/datepicker/#method-setDate" rel="nofollow">Jquery datapicker</a></p> <p>otherwise, i miss understand you...
How to profile/debug VBA script that works fine on XLS files, but hangs on XLSX files? <p>I have a VB script that does row processing on a small Excel file (35 columns, 2000 rows, no hidden content). It takes about 3 seconds to process the file when applied to an .xls file. If I save the .xls as a .xlsx file, the same ...
<p>yes - kind of. I use this to test how fast things are running and experiment with different approaches to get better timings. I stole this from somewhere here on SO.</p> <pre><code> sub thetimingstuff() Dim StartTime As Double Dim SecondsElapsed As Double StartTime = Timer 'your code goes here SecondsElap...
Add empty first row in smart field <p>in eclipse scout mars:</p> <p>how to add empty row in smart field, so user can select nothing and he is not forced to select some value in smart field. </p> <p>In sql if I add SELECT 0, '' UNION SELECT id, name FROM users...is working ok, empty row is show, but in modify value is...
<p>I am not sure if Eclipse Scout supports this construct of a row having an empty text.</p> <p>The way to clear a value in a SmartField is to delete the text. In this case the value in of the SmartField is set to <code>null</code>. If the value is not mandatory the user can save the form.</p> <p>Can you check if you...
Error updating packages (0.4) <p>I'm having trouble pulling/updating packages after removing .julia/v0.4/ due to some permission problems I was having. I was trying to do a fresh install of all of my packages, but now have a problem when trying to update or install packages. </p> <p>When I run Pkg.update(), after havi...
<p>In future removing all of the files inside <code>~/.julia/v0.x</code> was probably not the best way to go to begin with. <code>Pkg.resolve()</code>, which installs the packages, uses the the REQUIRE file which inside this folder as it has the names of all of all the packages to install (or keep installed). You will ...
Multi Stringsplit in Angularjs <p>I am getting some data back from the server and need to display it using ng-repeat. Here is my json data:</p> <pre><code> { "eShowOnHome": "No", "dModifiedDate": "2016-08-21", "eText": "No", "eTodayGame": "No", "eDelay": "No"...
<p>Here is the regex to split \r\n (a new line) or a single space character.</p> <pre><code>item.tScore.split(/[\r\n | \s]/); </code></pre> <p>To split with one or more newlines or any number of space characters use the following: </p> <pre><code>item.tScore.split(/\s+/); </code></pre>
Adding multiple Reducer using ChainReducer throwing Exception <p>I have already read previous posts related to this but didn't get anything meaningful.</p> <p>My use case is :</p> <ol> <li>Aggregate Impression and click data</li> <li>Separate Clicked and non-clicked data in different files.</li> </ol> <p>I have writ...
<p>ChainReducer is used to chain Map tasks after the Reducer, you can only call <code>setReducer()</code> once (<a href="https://github.com/apache/hadoop/blob/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/chain/Chain.java#L650" rel="nof...
Visual Studio 2015 link error LNK2005 <p>I need to link a static library against a given object file. I neither have the source code of that file nor any influence on it. </p> <p>When using Visual Studio 2010 I can create a library and link it against the given file. </p> <p>On a different machine I only have VS 2015...
<p>The Visual Studio 2015 compilers aren't compatible with object files created with earlier versions of the compiler. There was a major reorganization of the C runtime library that broke the C object level backwards compatibility that Visual Studio used to have. You'll need to use the older compiler to compile and cre...
POST request with Perl and read response object within dancer route <p>Trying to write the exact equivalence in perl of the following:</p> <pre><code>curl -H "Content-Type: application/json" -X POST -d '{"user": { "uid":"13453"},"access_token":"3428D3194353750548196BA3FD83E58474E26B8B9"}' https://platform.gethealth.io...
<p>I take it you are working with Dancer already, or you are adding something to an existing application, and the goal is to hide the POST request to another service behind your API.</p> <p>In your curl example, you have the Content-Type <code>application/json</code>, but in your Perl code you are sending a form. That...
Source code for CMS_ContentInfo_print_ctx function <p>I am trying to find the source code for an OpenSSL function <code>CMS_ContentInfo_print_ctx</code>. I have searched through the code and not found anything so I assume the code is auto generated. </p> <p>Can anyone tell me where this code is generated or how?</p> ...
<blockquote> <p>I am trying to find the source code for an OpenSSL function ... I have searched through the code and not found anything so I assume the code is auto generated.</p> </blockquote> <p>Many times OpenSSL uses uses macros to take base name, like <code>ASIdOrRange</code>, and expand it into a collection o...
MultipartStreamProvider loses HttpContext after async work <p>I have implemented a custom subclass of MultipartStreamProvider in order to write uploaded file data to a custom stream. After writing to the stream, the HttpContext is sometimes lost. The code below is a simplified repro that demonstrates the problem. If t...
<p>Turns out that @StephenCleary's suggestion was correct: setting the targetFramework in web.config to >= 4.5 solves the problem, however, you have to set the <strong>right</strong> targetFramework attribute. I first attempted to change the line</p> <p><code>&lt;compilation debug="true" targetFramework="4.0" /&gt;</c...
IndexedDB search for key and sort <p>At the moment i have 2 functions. One for querying the DB for results with a specific key/value pair and one for getAll rows sorted by a specific key. Is there a way combine these two ? So i want to have a function where you search a store for objects where a=1 sorted by b asc . </p...
<p>Create an index on the two properties:</p> <pre><code>function myOnUpgradeNeeded(event) { // ... var index = store.createIndex('myIndex', ['a', 'b']); } </code></pre> <p>Define a function that opens a bounded cursor over the index and iterate:</p> <pre><code>function query(db, a, callback) { if(!a) { th...
GCM push not working with parse <p>I am using self hosted parse server version <code>2.2.19</code>. I have already setup the push certificates for ios(APNS) and works fine. Now doing the same as before to GCM. But the GCM doesn't work. The senderIDs, keys are all correct, the device is hits the parse server and install...
<p>The recent FCM changes made it so you cannot specify your type of key in GCM anymore, so you can't specifically grab your server key. </p> <p>Instead you need to grab your server key from FCM and use that from now on. </p> <p>First, head over to the <a href="https://console.firebase.google.com" rel="nofollow">Fire...
LibGdx actor bounds incorrect <p>I am developing a simple game and faced with a problem. My virtual screen size is 640x360, but if I launch my game on device with, for example 1920x1080 screen resolution, actors' bouns stay in my virtual world coordinates, but not in 1920x1080, so I can't detect any input. Can anyone h...
<p>This is the common issue related to the viewport .for ahndling multiple mobile screen you must use the viewPort. the answer for this question is allready done in the below link please check it once. it will help you to maintain the constants screen ratio for all the devices.</p> <pre><code> http://stackoverflow.c...
How do you match multiple text in multiple column in a table with SQLite FTS3? <p>I'm searching for Multiple text in multiple column of Virtual Table. I have checked <a href="http://stackoverflow.com/a/14593298/2624806">this</a> thread, this search for a single word in multiple column.</p> <p>I checked with following ...
<p>Try this instead:</p> <pre><code>SELECT * FROM mytable WHERE mytable MATCH '(A:cat OR C:cat) AND (A:dog OR C:dog)'; </code></pre> <p>However, I suspect that the following query will perform faster:</p> <pre><code>SELECT * FROM mytable WHERE mytable MATCH '(A:cat AND C:dog) OR (A:dog AND C:cat)'; </code></pre> <p...
Selecting data from MongoDB where K of N criterias are met <p>I have documents with four fields: A, B, C, D Now I need to find documents where at least three fields matches. For example:</p> <p>Query: A=a, B=b, C=c, D=d</p> <p>Returned documents:</p> <blockquote> <ol> <li>a,b,c,d (four of four met)</li> <li>a,...
<p>Currently in MongoDB we cannot do this directly, since we dont have any functionality supporting Permutation/Combination on the query parameters.</p> <p>But we can simplify the query by breaking the condition into parts.</p> <p>Use <a href="https://docs.mongodb.com/manual/reference/method/db.collection.aggregate/"...
Adding informations to tree - Rpart <p>I want to add some information to my tree. Let's say for instance I have a database like this :</p> <pre><code>library(rpart) library(rpart.plot) set.seed(1) mydb&lt;-data.frame(results=rnorm(1000,0,1),expo=runif(1000),var1=sample(LETTERS[1:4],1000,replace=T), va...
<p>This is really nice, I didn't know this was an option.</p> <p>All the work seems to be getting the subset of the original data used on each node. This is easy for terminal nodes, but I didn't find a straight-forward way of identifying rows of data that were used in every node, not just the leaves. If someone knows ...
Extracting key/value pairs from json using jooq/postgresql - java <p>I have the json data in a PostgreSQL database column in the following form:</p> <pre><code>myData [{"key1": "value1", "key2": "value2"}, {"key1": "value1", "key2": "value2"} ] </code></pre> <p>where <code>myData</code> is an array containing two obj...
<p>You have a couple of interesting questions here.</p> <h3>1. Query logic in the database vs. query logic in Java</h3> <p>It <em>depends</em>. First off, in PostgreSQL specifically, <code>jsonb</code> has better index support. I'm no expert on the topic, but I'm pretty sure you will come to this conclusion once you ...
Async Service processes entity multiple times <p>I have a very strange behaviour of my Async service. The story is: There's a plugin, which fires on <code>Lead Create</code>. The purpose of the plugin itself is to create custom enumeration of Leads. The plugin gets the last numer from the field in tha Autonumbering ent...
<p>I can't tell you why it's being processed multiple times, except if you're not getting your context and your service from your IServiceProvider, you're doing it wrong. </p> <p>A simple way to prevent this from happening, would be to check for a <a href="https://msdn.microsoft.com/en-us/library/gg328579.aspx" rel="...
How to get the value from include statement in a variable? <p>Suppose I write a line </p> <pre><code>include Yii::app()-&gt;basepath.'/views/email/email_friend.php'; </code></pre> <p>now how can i take the response of this line into a variable?</p> <p>like </p> <pre><code>$abc = include Yii::app()-&gt;basepath.'/vi...
<p>Have a look at the PHP docs for include <a href="http://php.net/manual/en/function.include.php" rel="nofollow">http://php.net/manual/en/function.include.php</a></p> <p>Example #5 is I think what you're looking for</p> <pre><code>return.php &lt;?php $var = 'PHP'; return $var; ?&gt; noreturn.php &lt;?php $var =...
WordPress backend menu items not loading <p>On our website, we use the Ubermenu plugin. As I was creating a menu within WordPress' backend, the menu items suddenly no longer appeared. I've disabled Ubermenu and a bunch of other plugins but they just won't show. Has anyone come across this before?</p> <p>Edit to add: A...
<p>There are some js errors in console?</p> <p>Or, do you edit some files inside wp-includes folder? </p>
Pyvmomi get folders name <p>I'm new to Python and Django and I need to list all my VMs. I used pyvmomi and Django but I can't get the folders name from VSphere, it shows a strange line.</p> <blockquote> <p>VMware list</p> <p>'vim.Folder:group-v207'</p> <p>'vim.Folder:group-v3177'</p> <p>'vim.Folder:gr...
<p>You need to specifically state you want the name, like this:</p> <pre><code>vmFolders = datacenter.vmFolder.childEntity for folder in vmFolders: print(folder.name) </code></pre>
pass parameters from java to groovy <p>I have a groovy script like:</p> <pre class="lang-groovy prettyprint-override"><code>import groovy.sql.Sql Object execute(def params = null) { def sql = new DBUtils().getConnection() println "sql params : " + params ... } </code></pre> <p>And the java class will ...
<p>You don't specify the arguments' type properly, it should be:</p> <pre><code>String param = "test"; Object obj = scriptClass.getDeclaredMethod("execute", new Class[]{Object.class}) .invoke(scriptInstance, new Object[]{param}); </code></pre> <p>Indeed, if you call <code>getDeclaredMethod("execute", new Class[]{...
Decimals round off only when report is run live <p>My crosstab displays percentages with two decimal points when run locally. Run from Live in Crystal Report Viewer, the values are rounded to the nearest integer. How can I force the decimals to show?</p> <p><a href="http://i.stack.imgur.com/UYWCO.png" rel="nofollow"><...
<p>In the end I needed to perform the calculation manually:</p> <p>I created a running total called <em>MyDistinctCount</em> to get the total number of entries, 132. Then I duplicated the first row of the CrossTab (<strong>Total:</strong> | <strong>7</strong> | <strong>71</strong> | <strong>46</strong>...) and altered...
Android - Problems while fetching info from sql database <p>Greetings overflow community.</p> <p>I'm still a newbie for Android develpment, so please bear with me. I'm sorry if this is already in another thread. I couldn't find anything related.</p> <p>By following a huge amount of tutorials for the last 2 weeks, i'...
<p>Your code is really too complex for this kind of operation. Try to use this code:</p> <pre><code>String userName = user.getUsername(); Cursor cursor = db.query(TABLE_USER, new String[]{COLUMN_USER_PASSWORD}, "COLUMN_USER_USERNAME = ?", new String[]{userName}, null, null, null, null, null); if(cursor.moveToFirst)...
How to write multiple lines to a file from user input (Perl) <p>I am trying to do a simple perl program that takes user input and writes it to a file. However I want to be able to have multiple lines in the file instead of the entire user input being on one line (for example the users types \n so move to next line in f...
<p>You have this line in your code:</p> <pre><code>my $input = &lt;STDIN&gt;; </code></pre> <p>That means "read from STDIN up to and including the next newline character and return that data". So, by definition, <code>$input</code> can only ever contain a single line of input.</p> <p>There are a couple of different ...
Window function is not supported in order by clauses <p>I am using Amazon Redshift to query the data. I want to select the top 4 products that generated most revenue within each quarter group. I used windows function to calculate the sum value of revenues per product within a quarter then use another window function to...
<p>If you add another ROW_NUMBER() or DENSE_RANK() ranked by your revenue descending in your sub query then you should be able to access that value in the order by of the outer query.</p> <p>Something like below. This is the general idea.</p> <pre><code> SELECT * FROM ( SELECT i...
SQLite on IONIC "TypeError: Cannot call method 'openDatabase' of undefined <p>Im new with IONIC and I need help on using ngCordova. I am able to create database on my app.js. But I always get this error message when trying to access the database on my controller. <strong>"TypeError: Cannot call method 'openDatabase' of...
<blockquote> <p>Check the plugin usage in ngCordova docs you include the sqlite in your controller in order to use it.</p> </blockquote> <pre><code>module.controller('MyCtrl', function($scope, $cordovaSQLite) { var db = $cordovaSQLite.openDB({ name: "my.db" }); </code></pre> <blockquote> <p>// for opening a bac...
pandas error when convert object to datetime <p>This is two lines of inputdataframe:</p> <pre><code> ts country os product_id total_users total_purchases 0 0000-00-00 Brazil iOS 1 0 1 0000-00-00 Germany 1 0 </code>...
<p>easy peasy</p> <pre><code>df['ts'] = pd.to_datetime(df['ts'], errors ='coerce') </code></pre> <p>no need to clean the data. wrong timestamps will get the <code>NaT</code> (not a timestamp)</p>
Pandas - Alternative to rank() function that gives unique ordinal ranks for a column <p>At this moment I am writing a Python script that aggregates data from multiple Excel sheets. The module I choose to use is Pandas, because of its speed and ease of use with Excel files. The question is only related to the use of Pan...
<p>I think the way you were trying to use the <code>method=first</code> to rank them after sorting were causing problems. </p> <p>You could simply use the rank method with <code>first</code> arg on the grouped object itself giving you the desired unique ranks per group.</p> <pre><code>df['new_rank'] = df.groupby(['we...
How do we include a header which is a angular js component into our index.html <p>I have a <strong>header component</strong> ,which has its <strong>own html</strong> and <strong>js file</strong> ,How do i include this component in my main <strong>index.html</strong></p>
<p>You can use the <code>ng-include</code> directive to include an external HTML fragment.</p> <pre><code>&lt;div ng-include="header.html"&gt;&lt;/div&gt; </code></pre> <p>The above code will include whatever present inside the <code>header.html</code> file to be present inside the div element. You can read more from...
ASP.NET Web Forms Application Suddenly Throwing JavaScript Error <p>For some unknown reason, an ASP.NET Web Forms application that I've been working on for months has suddenly begun throwing this JavaScript error: </p> <blockquote> <p>JavaScript runtime error: Object doesn't support property or method 'indexOf'.</...
<p>Upon further investigation, I have found that the <code>&lt;meta&gt;</code> tags in some of my Master Pages are causing the problem. The <code>content</code> attribute should be set to <code>IE=edge</code>. This is how it should read:</p> <pre><code>&lt;meta http-equiv="X-UA-Compatible" content="IE=edge" /&gt; </co...
Find current and previous node hovered <p>I have an html list that contains children with links. I want to find the current element that is hovered, and also the previously hovered one. (Not the previous sibling of the one currently hovered, just the item that was hovered until the current).</p> <p>Thanks</p>
<p>You would need to store the element when the mouse leaves it, and on mouse enter check what it is. For example:</p> <pre><code>var previous; $('div').on('mouseleave',function(event){ previous = $(this); }); $('div').on("mouseenter", function(event){ console.log($(this).text(), previous.text()); }) </code>...
Stopping or Interrupting a Java Thread <p>I am trying to stop a java thread if it is running for 6000 milliseconds.</p> <p>Below code to kill the Thread R1 is failed to stop the thread. could you please correct code?</p> <p>I have tried this code with while (!Thread.currentThread().isInterrupted()) to stop the t...
<p>You've got two problems in your code, firstly that you aren't sleeping your main thread long enough, and secondly that you're interrupting the wrong thread.</p> <p><code>6001</code> ms isn't long enough to guarantee that your duration check will be true. When I run your code, the main method rarely enters the if b...
Select element based on the child of its previous sibling <p>I have this code:</p> <pre><code>&lt;cite&gt; &lt;a id="john" href="javascript: void(0)"&gt;John&lt;/a&gt; &lt;span&gt;time&lt;/span&gt; &lt;a&gt;DELETE&lt;/a&gt; &lt;/cite&gt; &lt;blockquote&gt;hello there&lt;/blockquote&gt; </code></pre> <p>This is my ...
<p>You can use following jQuery selector to select the desired element.</p> <pre><code>$('cite').has('a#john').next('blockquote') </code></pre> <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-...
Maximum call stack size exceeded react <pre><code>import React,{ Component } from 'react'; import { connect } from 'react-redux'; import { itemid } from '../actions/action'; class DetailPage extends Component{ componentWillUpdate(){ this.props.dispatch(itemid([this.props.params.item,`${this.props.params.item}...
<p>You're firing dispatch on <code>componentWillUpdate</code>. So every time you update state, you're updating state again. You should <em>never</em> modify state in componentWillUpdate: <a href="https://facebook.github.io/react/docs/component-specs.html#updating-componentwillupdate" rel="nofollow">https://facebook.git...
Why use @Asynchronous in EJB when we can use ExecutorService? <p>I am new to multithreading in Java and EJB too. I have a scenario where I have to hit a web service concurrently using threads. I have got two approaches for that.</p> <ol> <li>Using ExecutorService with Callable to hit the service concurrently.</li> <li...
<p>Basically, the answer can be found in the <a href="http://download.oracle.com/otndocs/jcp/ejb-3.1-pfd-oth-JSpec/" rel="nofollow">EJB 3.1 specification</a>:</p> <blockquote> <p>The enterprise bean must not attempt to manage threads. The enterprise bean must not attempt to start, stop, suspend, or resume a thread, ...
drawRect, fillRect, scale not matching up <p>I'm trying to do some very simple drawings but I cant seem to get the result I need.</p> <pre><code> /* Draw Title Bar */ int w = window.getWidth(); int h = 10; g2d.setColor(Color.blue); BasicStroke stroke = new BasicStroke(1.0f,BasicStroke.CAP_BUTT, ...
<p>Apart from filling the upper rectangle - you should also draw it. As you can see there is no border for him.</p>
Unity3D WWW not working on Android and iOS <p>I'm trying to access a server that my friend made using php. I'm using a WWW object to GET or POST json. The server always requires http basic authorization. For example, one of my GET requests to get a user's info looks like this.</p> <p><a href="https://basicauthuser:bas...
<p>Maybe the access problem:</p> <p>Unity requires that websites you want to access via a WWW Request have a cross domain policy.</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;cross-domain-policy&gt; &lt;allow-access-from domain="*"/&gt; &lt;/cross-domain-policy&gt; </code></pre> <p>Upload this file to the root of ...
How an Authentication Server works <p>As the title suggests, I am not sure how an Authentication Server works. I have implemented authentication on multiple websites but it hasn't ever sat on a separate server. So, how would this architecture work? Is there material online that can explain this (I couldn't find any)? A...
<p>Having different authentication systems per application would land the user to create multiple profile which could be cumbersome for the user. Also architecturally you are creating tight coupling between application and authentication.</p> <p>You should consider &amp; design authentication as a simple Service/API c...
How to implement same set of JavaScript/jQuery functions on multiple elements <p>I need to run same method for multiple div elements. The code is give here:</p> <pre><code>&lt;div class="opage" id="oddPage"&gt; &lt;img&gt; &lt;/div&gt; &lt;div class="epage" id="evenPage"&gt; &lt;img&gt; &lt;/div&gt; &lt;div cl...
<pre><code>$('#oddPage').click(flip); $('#evenPage').click(flop); </code></pre> <p>if there are multiple elements with this id, change it to a class because ids are unique and reference it with a <code>.</code></p> <pre><code>$('.oddPage').click(flip); $('.evenPage').click(flop); </code></pre>
Why does click event on window not have target event path unless within setTimeout? <p>I am working on a JavaScript library for some data collection. I need to capture all click events, and want to traverse the event path looking for specific tags/ids/classes on click.</p> <p>If I run the following code without the se...
<p>You should wait for window to load, use below code so you should get the same result without the time delay:</p> <pre><code>window.onload = function() { document.addEventListener('click', function (event) { console.log(event.path); }); }; </code></pre>
Android 6.1 and Smartwatch not communicating WearableListenerService <p>I am trying to send messages between my phone and wearable using the Wearable message API. Both the phone(physical One plus one) and the smartwatch(physical sony smartwatch 3) will connect to each other. Sending a message also reports back as sent....
<p>Change your service definition to be:</p> <pre><code>&lt;service android:name=".ListenerFromWear"&gt; &lt;intent-filter&gt; &lt;action android:name="com.google.android.gms.wearable.MESSAGE_RECEIVED" /&gt; &lt;data android:host="*" android:scheme="wear" /&gt; &lt;/intent-filter&gt; &lt;/servi...
How to display the number of groups with at least 13 members? <p>How to display the number of groups with memberships of at least 13 members. For each group that match the condition, I want to display the number of members in the group, The ID for the Group and the group name.</p>
<p>you can use something like this;</p> <pre><code>#!/bin/bash echo "GroupName GroupID UserCount" while IFS=: read -r groupName f2 groupID users do usersCount=$(echo $users| sed 's/,/ /g' | wc -w) if [ $usersCount -gt 12 ]; then echo $groupName $groupID $usersCount fi done &lt; &lt;(getent group) #done &lt; /etc/gr...
How can I detect the end of a text file (EOF) in vbscript? <p>I'm using VBscript to sort the information in a text file to an excel sheet. I am able to do so, but only one line of the text is being read, and the loop control doesn't seem to go to the next line of the text file. I am using <strong>AtEndOfStream</strong>...
<p>As I mentioned in the comments, your problem is with your variables, because you are trying to reusing them, but not doing it properly. If you manually walk into your code, you will see that, in the first iteration you are adding <code>objFile.ReadLine</code> to <code>arrFileLines(0)</code> and then storing <code>ar...
Error handling for missing values in a dictionary <p>I would like to incorporate some error handling in the below code when the population file is missing population data for a city but I get this message. </p> <p><strong>TypeError: descriptor 'get' requires a 'dict' object but received a 'str'</strong></p> <pre><co...
<p>Try:</p> <pre><code>population = populations.get(row[0] + row[1], None) </code></pre> <p>The reason for the error is that <code>get()</code> is a method descriptor of the builtin type <code>dict</code>. Similar to other methods (functions that are members of a class), they require the first argument to be the obje...
Instancing millions of objects in OpenGL <p>My ultimate goal is to render 1 million spheres of different sizes and colors at 60 fps. I want to be able to move the camera around the screen as well. </p> <p>I have modified the code on <a href="http://learnopengl.com/#!Advanced-OpenGL/Instancing" rel="nofollow">this pa...
<p>Here</p> <blockquote> <pre><code>glm::vec2 translations[NUM_INS]; </code></pre> </blockquote> <p>you are allocating your array of positions <em>on the stack</em>; now, as long as <code>NUM_INS</code> is relatively small this is not such a big problem, but when you start going to "big" numbers (say, 100000) the sta...
Haskell list of lists multiplication <p>If I have 2 lists of lists in Haskell like the following:</p> <pre><code>[[1,1,1],[3,4,6],[1,2,3]] [[3,2,2],[3,4,5],[5,4,3]] </code></pre> <p>I must multiply the first lists, second lists, and so on.</p> <p>The example above should result in</p> <pre><code>[[3,2,2],[9,16,30],...
<p>Use <code>zipWith</code> twice.</p> <pre><code>multListt xss yss = zipWith (zipWith (*)) xss yss </code></pre>
RadioButtonFor not returning the Selected Value <p>So, I'm trying to figure out how to return the selected value of a RadioButtonFor. Should be simple, but I'm missing something.</p> <p>In the view I have:</p> <pre><code>@for (int i = 0; i &lt; Model.ProfessionalRelations.Count; i++) { @Html.RadioButtonFor(m =&gt...
<p><strong><em>RadioButtonFor</em></strong>'s third parameter is an object which we normally pass <strong><em>string</em></strong> argument. </p> <pre><code>@for (int i = 0; i &lt; Model.ProfessionalRelations.Count; i++) { @Html.RadioButtonFor(m =&gt; m.SelectedProfessionalRelation, Model.ProfessionalRel...
how to put stored procedure job for sleep for duration of 35 mins <p>I have below piece of code that is below is stored procedure to clean up the table based on certain conditions that is there is view and if it get refreshed , now please advise if we need to put the logic in a loop.. if the clean-up doesn’t happen,...
<pre><code>... DBMS_LOCK.SLEEP(60*35); ... </code></pre>
Formatting List of Text Strings in Excel <p>I am trying to turn the font to red for the occurrences of a list of words in excel. So far, I am able to find a single word, but I need to search for a whole array. I am a newbie with VBA and struggling. So far, I've been able to find this as a solution, but it deals with fi...
<p><strong>This is a method to achieve what you desire by looping through a range, collection, and array.</strong> </p> <p>The code will find matches between the collection (your chosen match words) and the array (the string of words delimited in each cell). If a match is found, the starting and ending characters in t...
Mosquitto not printing messages on terminal <p>I am publishing messages from JavaScript code using Paho client. The messages are getting published as I can see them on subscriber side though I can't see any of them on terminal.</p> <pre><code>client = new Paho.MQTT.Client("localhost", 9002, "myClient"); client.connect...
<p>The broker will not print messages to the console unless put in full verbose mode, this is not intended to be a way to view messages, but a debug tool to fix problems.</p> <p>You can enable verbose mode by adding <code>-v</code> to the command line.</p> <p>If you want to see all the messages following through the ...
How to remove last comma of a javascript array <p>I've found lots of answers on how to remove last comma of javascript string and so, but I nowhere managed to find a solution for the following problem:</p> <pre><code>var columns = new Array("datum","viz1","viz2","gaz","aram_nappali",); </code></pre> <p>That's my arra...
<p>Don't use <code>new Array()</code>, it does not do what you think it does (thanks to <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array#Syntax" rel="nofollow">behaving differently depending on how many arguments you supply</a>). JavaScript has an array <em>literal</em> th...
ViewConfiguration.getScaledTouchSlop returns pixels or DP (density independant pixels)? <p>In this android doc <a href="https://developer.android.com/guide/practices/screens_support.html" rel="nofollow">https://developer.android.com/guide/practices/screens_support.html</a> it says that getScaledTouchSlop returns a valu...
<p>It returns the value in pixels, but scaled to the density of the device. i.e. it returns the DP value converted to pixel value. </p> <p>So you don't have to convert it to pixel again. </p> <p>For example, say, if it returns value 10 for mdpi device. Then it will return 40 for xxxhdpi (4 times of mdpi) device. </p>...
@Path annotation not working while creating a RESTful webservice <p>I am creating a simple RESTful webservice using jaxrs version 2.23.2. But @Path not working. Service Class</p> <pre><code>package com; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws...
<p><code>System.out.println()</code> method prints on the server side, so the text will not be sent over to client as you expected. To see the message as text in the web browser you need to return a String as a response:</p> <pre><code>@GET public String getUser(){ return "Inside getUser"; } </code></pre> <p>You...
Destruct a Reference Member Initialized from Factory Method <p>To initialize a reference member without a reference to an external entity passed to the constructor of the containing class, a factory method can be used, like this:</p> <pre><code>struct B { B() : a(new_a()) {} // factory a&amp; new_a() {...
<p><code>delete &amp;a;</code> in <code>B</code>'s destructor should do the job correctly to avoid a memory leak.</p> <p>I'd better recommend the factory function rather should return a <a href="http://en.cppreference.com/w/cpp/memory/unique_ptr" rel="nofollow"><code>std::unique_ptr&lt;A&gt;</code></a> though. Or you ...
What does the long empty space in git reflog signify? <p>After reading <a href="http://stackoverflow.com/questions/17857723/whats-the-difference-between-git-reflog-and-log">here</a> as far as I have learned <code>git reflog</code> will show a list of all heads, basically it will keep a history after every checkout you ...
<p>The blank lines and the <code>:...skipping...</code> lines are printed by the pager. You see these lines only when you give the pager an instruction to scroll, and then you later use the scrollbar of your terminal to go back to see "off-screen" output in your terminal.</p> <p>If you do not use the pager, e.g., usin...
Jupyter/Ipython notebook autosave during execution <p>Is it possible to autosave the notebook while e kernel is running and a cell is being executed? Everytime I execute a cell for a long time it stops autosaving and it starts saving again after the cell execution is finished. Is this the default behavior? Is there a...
<p>Autosaving is always running on a timer, regardless of execution. However, the autosave event only fires if there are changes to save (indicated via a so-called 'dirty' flag). Output arriving sets that flag, which might be why you see autosave resuming once execution completes (more precisely, it should be when outp...
Spring MVC and AOP: @Pointcuts only apply for Rest Controllers and not for common Web Controllers <p>I am working with <code>Spring Framework</code> 4.3.3 in a web environment.</p> <p>I have a <code>@Controller</code> used for <code>Web</code> requests through a <code>Web Browser</code> that uses how dependency other ...
<p>Seems that the problem is in you <code>pointcut</code> definition. You may notice that your advice method is performed only for methods with one parameter, so this is due to the fact that you have specified <code>args(id)</code> in the pointcut declaration. It must work as you expect if you remove <code>args(id)</co...
Web API comments for methods taking complex types? <p>I have a Web Api ApiController with an action method that has structured comments that are supposed to show up on the help page.</p> <p>The action is a Put that supposed to take a single [FromBody] argument that is an array of POCO objects.</p> <pre><code>/// &lt;...
<p>The problem was with trying to pass an array instead of a collection.</p> <p>This works:</p> <pre><code>[HttpPut] public HttpResponseMessage Put([FromBody] IEnumerable&lt;AckNak&gt; ackNaks) { return this.Request.CreateResponse(HttpStatusCode.OK); } </code></pre> <p>Or, rather, this makes the doc comments wor...
Angular 2 Element recreation after 3rd party lib DOM interaction (VideoJS) <p>Which way should i go, when i want to recreate some DOM element after it was removed by 3Rd party lib. As an example, after VideoJS dispose() function, original <code>&lt;video&gt;</code> element is removed.</p> <p>I have come to this soluti...
<p>Ok so for anyone strugling with the same problem. Here is my solution. After reading tons of tutorials and discussions TemplateRef and ViewContainerRef seem to be the right way.</p> <p>There are different approcahes through another directives stc. My solutution is made within the same component. </p> <p><strong>HT...
How to make circle page indicator while scrolling images in horizontal scroll view? <p>To use circle page indicator, what dependencies should I use?</p> <p>This is my dependency file:</p> <pre><code>compile 'com.android.support:appcompat-v7:24.1.0' compile 'com.android.support:design:24.1.0' compile 'com.android.supp...
<p>I hope this demo will help you a lot</p> <p><a href="https://github.com/ongakuer/CircleIndicator" rel="nofollow">https://github.com/ongakuer/CircleIndicator</a></p>
loop wait for function complete node.js <p>** i am trying to download videos with loop. but loop do not wait for function complete.</p> <pre><code>for (var i = 0; i &lt; linkLength; i++) { download (); } </code></pre> <p>Is there a way to make loop wait for the download.<br> edit 2. Solved . Thanks!</p>
<blockquote> <p>Node.js nature is <code>asynchronous</code> that's why you are getting this issue.</p> </blockquote> <p>You need to make it's nature as <code>synchronous</code> with the help of <code>callback</code> or <code>promises</code>.</p> <p>I recommend using <a href="http://caolan.github.io/async/docs.html#...
UITableView header view overlap cells in iOS 10 <p>There's a simple <code>UITableView</code> in my app, and there's a custom view for the <code>tableView.tableHeaderView</code> property. When this property is set, the view has the correct size (full width, about 45px high).</p> <pre><code>[_resultHeaderView sizeToFit]...
<p>The bug was in the fact that the view was being resized automatically, so its frame height really was 0 when it was being attached to the tableView, which explains the behavior.</p> <p>Setting the autoresizingMask to none fixed this bug. </p> <p><code>_headerView.autoresizingMask = UIViewAutoresizingNone</code></p...
Using Vue.js in Laravel 5.3 <p>In Laravel projects prior to 5.3 I've utilised Vue.js using the script tag like this:</p> <pre><code>&lt;script type="text/javascript" src="../js/vue.js"&gt;&lt;/script&gt; </code></pre> <p>I would then create a Vue instance specific for that page like this:</p> <pre><code>&lt;script&g...
<p>If you want to incorporate <em>vuejs</em> into <em>app.js</em> using <em>gulp</em> then you can do it with elixir:</p> <p>Firstly, you need <em>laravel-elixir-browserify-official</em> from npm:</p> <p><em>npm install laravel-elixir-browserify-official</em></p> <p>Then place the following in <em>package.json</em>:...