input
stringlengths
51
42.3k
output
stringlengths
18
55k
LibreOffice (soffice) issue while converting on Amazon ec2 <p>This is not a repost, I am asking for the <strong>Amazon ec2</strong> instance ! Questions that others asked worked fine on my local machine, and those were solved, but not on Amazon.</p> <p>There have been several reports regarding this problem, but nothin...
<p>EDIT: This worked for me, adjust the steps to your code. Changing the permission to folders and other answers I found were simply not helpful at all. I figured this out myself.</p> <p>Upgrade/Update the instance</p> <p>$ sudo apt-get upgrade</p> <p>$ sudo apt-get update</p> <ol> <li>Install java jdk 8</li> </ol>...
How to Convert String to Array Object inside Java Script for JQGrid <p>I have a string Variable in javascript which contains a parsed data from a STATIC XML. The data is parsed in this format: val2 = "[{account:'ss',order:'ss'},{account:'f',order:'f'}]"</p> <p>I need to convert this string variable as Array Object as ...
<p>please read my answer for question in this link. this is having answer of your question.</p> <p>[link]<a href="http://stackoverflow.com/a/39560256/5382854">http://stackoverflow.com/a/39560256/5382854</a> [question] <a href="http://stackoverflow.com/questions/39558993/why-i-cannot-assign-an-array-to-jqgrid-columns/3...
Is there any clean way to use vector images via pack url in WPF/Xaml <p>I figured out how to get a xaml from an svg file (.svg->Inkscape->pdf->ai->ExpressionDesign->xaml).</p> <p>The conversion either gives me a resource dictionary with a DrawingBrush or a Xaml File with a canvas.</p> <p>Now i'm searching for a clean...
<p>For organizational purposes create a separate class library project for your assets. Define your XAML vector graphic in a ResourceDictionary</p> <p>Assets/Category/my-asset.xaml:</p> <pre><code>&lt;ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.mi...
PHP Event booking: get time in increments of 30 minutes is 1 hour out <p>I am trying to get a select box with a list of time increments from 00:00 to 24:00.</p> <p>The time increments are an associative array of seconds to the display time like this:</p> <p>1800 => 00:30</p> <p>Then when someone selects a date, I pl...
<p>I don't really remember where, but you can change your timezone. Search by PHP timezone and you will find from the official website a list with all the possible country/city. You just need to set a variable with the country/city you need and that's it. I don't know if you can do it in your PHP script or need to chan...
How to Regex MultiVariables <p>im trying to regex this, but it doesnt work:</p> <p>this is my string: </p> <pre><code>asdasd2-bgbegebr23-yiyity23-iopip123 </code></pre> <p>So im trying to get: all values between '-', but it doesnt work: im using actually this:</p> <pre><code>/(-)(.*)(-)/gi </code></pre> <p>as rege...
<p>That's because the dot includes de dash. You should remove the dash. Try this:</p> <p>/([^-]+)/gi</p>
Match unicode emoji in python regex <p>I need to extract the text between a number and an emoticon in a text</p> <p>example text:</p> <pre><code>blah xzuyguhbc ibcbb bqw 2 extract1 ☺️ jbjhcb 6 extract2 🙅 bjvcvvv </code></pre> <p>output:</p> <pre><code>extract1 extract2 </code></pre> <p>The regex code tha...
<p>Since there are a lot of emoji <a href="http://apps.timwhitlock.info/emoji/tables/unicode" rel="nofollow">with different unicode values</a>, you have to explicitly specify them in your regex, or if they are with a spesific range you can use a character class. In this case your second simbol is not a standard emoji, ...
How to build a Maven POM file for both Android and Java releases <p><strong>My requirements</strong></p> <p>I have a Java ulitities library. I want to make 2 jar files. One for Android and the another for Java. </p> <p>For Android jar, I want to exclude JDBC package.</p> <p>I want to upload both jar files &amp; thei...
<p>The <a href="https://issues.sonatype.org/browse/OSSRH-5768" rel="nofollow">same issue</a> has already been reported and it's mainly due to the fact that the main artifact uses a classifier (the <code>android</code> one) while sources and javadoc artifact don't, creating a misalignment. </p> <p>Indeed, the error mes...
How do I group a list using Linq <p>The scenario I have is as follows: </p> <p>I have the following data - </p> <h2>ID, Name, Place, Location, GroupID</h2> <pre><code>1, samename, Grand Central, New York, 12 2, samename, Opera House, Sydney, 12 3, samename, Opera House, Sydney, 12 4, name2, Emirates, London, 13 5, n...
<p>You need to do it in two steps, first group them on <code>Name</code> and <code>GroupID</code>:</p> <pre><code>var result = list.GroupBy(x=&gt;new {x.GroupID, x.Name}) .Select(g=&gt; new { GroupID = g.Key.GroupID, Name = g.Key.Name}); </code></pre> <p>and in second case group them with other three...
Junit not passing even though it should <p>Updated the isVanityURL method. See below for original question and code based on Shahid's recommendation. Also looking at the Path class as suggested by assylias.</p> <pre><code>public static boolean isVanityPath(String resourcePath) { String resPath = resourcePath; ...
<pre><code>@Test public void testVanityURLWhenRoot() { // expecting isVanityPath() to return false Assert.assertFalse(ResourcePathUtil.isVanityPath("/")); } @Test public void testVanityURLWhenValidVanity() { // expecting isVanityPath() to return false Assert.assertTrue(!ResourcePathUtil.isVanityPath("/...
Substitute Function call with sympy <p>I want to receive input from a user, parse it, then perform some substitutions on the resulting expression. I know that I can use <code>sympy.parsing.sympy_parser.parse_expr</code> to parse arbitrary input from the user. However, I am having trouble substituting in function defi...
<p>After some experimentation, while I did not find a built-in solution, it was not difficult to build one that satisfies simple cases. I am not a sympy expert, and so there may be edge cases that I haven't considered.</p> <pre><code>import sympy from sympy.core.function import AppliedUndef def func_sub_single(expr,...
Custom 404 Error Page in Golang for Kubernetes <p>I am trying to implement a custom default-http image for my Kubernetes Cluster. I only got 2 requirements:</p> <blockquote> <pre><code> Any image is permissable as long as: 1. It serves a 404 page at / 2. It serves 200 on a /healthz endpoint </code></pre>...
<p>Based on this <a href="https://golang.org/pkg/html/template/" rel="nofollow">documentation for template</a>, I think you might want to use "text/template" instead of "html/template". </p> <p>That page says:</p> <blockquote> <p>The contextual autoescaping in html/template produces safe, escaped HTML output </p> <...
Removed first word in an excerpt <p>Been searching for a way how to remove the first word in an excerpt generated by wordpress. Somehow all possible solutions online didn't work.</p> <p>I have a custom post type archive page where it display all events. I'm using Visual Composer to create the event. So basically the t...
<p>Just do something simple like this:</p> <pre><code>function removeFirstWord($text) { return substr($text, strpos($text, " ") + 1); } </code></pre> <p>This simply returns everything after the first space. You can also add a trim function on there to ensure the first character isn't a space.</p>
Determine the zoom level to cover all marker about lat/lng <p>I know, what I ask exist with Google Map, but I'm working with <strong>Xamarin.Forms.Map</strong> so.. I have to make it by my own.</p> <p>However, I know how to get the center of my point, the <strong>POI (Point of Interest)</strong>, but I don't know how ...
<p>I then found the solution, there is the code for it, it has been wrote to be put into your custom map.</p> <p>Here, <code>private static void OnCustomPinsPropertyChanged(BindableObject bindable, object oldValue, object newValue)</code> is a method which is called by my <code>List&lt;CustomPins&gt;</code> but you ca...
MySQL if query returns nothing, try second query <p>I'm crossing everything I have that this is possible...</p> <p>I currently have some SQL that uses UNION ALL to join a bunch of queries together. It's important that ALL is in there, because these queries could potentially return the same records and I need each inst...
<p>For each of your querygroups, you can use a construct like</p> <pre><code>... UNION ALL SELECT foo,bar FROM foobar WHERE foo = bar or foo is null and not exists ( SELECT * FROM foobar WHERE foo = bar ) UNION ALL ... </code></pre> <p>This will take either the rows that fulfill yo...
Reference specific row's column value from array <p>I have read a-lot of answers on this but they don't seem to be working.</p> <p>I have the following code:</p> <pre><code>$amountoflikes=mysql_query("SELECT * FROM `uc_likes` WHERE `dwable` = '372'"); </code></pre> <p>This returns the following:</p> <p><a href="h...
<p>declare your array as follows</p> <pre><code>$json = array(); </code></pre> <p>and see if you have results before your result</p> <pre><code>if ($amountoflikes) { while(){...} } </code></pre>
How can I change width of a specific label in my program, No inline style is allowed only to control from head <p>This is the label and I want to change its width from style defined in my style rule in the <code>&lt;head&gt;</code> .</p> <pre><code>&lt;label for="gender"&gt;Gender:&lt;/label&gt; &lt;input type="radio"...
<p>By using this: <code>label[for="gender"] { display: inline-block; width: 200px;}</code></p> <p>Inline elements like a <code>&lt;label&gt;</code> is displayed so that its height and width is calculated by the browser based on its content. If you want to control height and width you have to change those elements bloc...
Test unknown data in Kmeans Clustering in R <p>For example, I have a dataset of X= {1, 1.5, 5, 3, 4, 3} and Y = {1, 1.5, 5, 4, 4, 3.5}. What i did is --</p> <pre><code>data &lt;− read . csv (”exp . csv”) print ( data ) results &lt;− kmeans(data , 2) results results $ size results $ cluster plot (temp [ c(”...
<p>case 1: when you know that the point is in the dataset you clustered, e.g., (1,1)</p> <pre><code>point1 &lt;- c(1,1) results$cluster[which(data$X==point1[1] &amp; data$Y==point1[2])] #[1] 1 </code></pre> <p>case 2 (general): when the point may / may not be there in the dataset you clustered</p> <pre><code>point2 ...
Parameters not passing into an ActionResult <p>So I have this Javascript code:</p> <pre><code>function AddToStuff(somethingID) { var stuffID = document.getElementById('StuffID').innerText; alert("First Alert: " + stuffID); if (stuffID == -1) { document.getElementById('StuffID').innerText = 0; ...
<p>If I comment all your JS code and just write </p> <pre><code> StuffCallback.fire(0, 5); </code></pre> <p>it works nicely, as it accepts 5. That means that your stuffID is not being recognized as int. What kind of a HTML element is it? I see you are using .innerText. As you are using jQuery already, why not use </p...
Powershell function Params getting unexpected values when CSV fields are not present <p>I am writing a PowerShell function which can take pipeline input. Specifically I am testing it with <code>Import-CSV</code>. Many of the params are not mandatory, which means sometimes the CSV will not have those columns. For boolea...
<p>This is because you specified <code>ValueFromPipeline=$True</code> so that PoSh coerces the piped object to a <code>string</code> if it cannot bind the parameter by property name. You could solve that by removing <code>ValueFromPipeline=$True</code> from this parameter and introduce another one to be bound to the pi...
Xamarin Facebook iOS10 SDK com.facebook.sdk.login Code=308 <p>I have just updated <code>Xamarin Studio</code> on Mac and <code>XCode</code> to the latest version with iOS 10 simulators.</p> <p>In my application I have <code>Facebook</code> login integration, but after the update I'm getting an error:</p> <pre><code>E...
<p>Believe it or not, I found the solution to this error doing the opposite of what is described here: <a href="https://forums.xamarin.com/discussion/39673/iphonesimulator-build-results-in-no-valid-ios-code-signing-keys-found-in-keychain" rel="nofollow">https://forums.xamarin.com/discussion/39673/iphonesimulator-build-...
Adobe Acrobat / Microsoft Outlook - Placing a <hr> or similar in a mailto link <p>Currently I have: </p> <pre><code>mailto:email@example.com?subject=Test Subject &amp;body=Paragraph One. %0A%0A &lt;hr/&gt; %0A%0AParagraph Two. %0A%0AParagraph Three. %0A%0AParagraph Four. </code></pre> <p>And the hr code isn't working...
<p>Can't do that. Mailto only works with plain text body, no HTML.</p>
Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener Error <p>I am trying to implement Spring Security within my REST API. My project was working perfectly until I started to implement Spring. I believe the issue has something to do with Spring ...
<p>This error is a result of having some non-compatible versions of Spring libraries in your classpath. The spring-boot dependencies should normally take care of pulling in all their required dependencies, but if for any reason you must declare all your dependencies manually, then always make sure that you use the same...
Filtering a pandas dataframe based on a match to partial strings <p>I have a pandas dataframe that contains strings of varying length and characters.</p> <p>For example:</p> <pre><code>print df['name'][0] print df['name'][1] print df['name'][2] print df['name'][3] </code></pre> <p>would return something like this:</...
<p>try this:</p> <pre><code>In [31]: df.name.str.extract(r'\b(?:UserId|loginId)\s*:\s*\b([^\s]+)\b', expand=True) Out[31]: 0 0 Z5QF1X33A 1 test.user 2 0000012348 3 Z5QF1X33A </code></pre>
Issue with Dataweave component flow depolyment on standalone server <p>The application will not deploy on standalone server which having data weave component in my flow.But when my application desinged in anypoint studio 5.4.1 its deployed in standalone run time.But now I am using Anypoint studio 6.0.0.So please sugges...
<p><code>Dataweave</code> component is <code>Premium component</code> and it will not run in <code>Community Edition</code> version of Mule Standalone server, you will need Mule <code>Enterprise Edition</code> version. By default, Anypoint Studio runs <code>Mule EE Runtime</code> hence you won't see any issues while us...
How to change root path in deployment in AWS-EC2 Ubuntu Linux using Apache 2? <p>Once we deploy our Rails app to AWS-EC2,but when we did our routing went all haywire. Rails wants www.example.com/ to be the root. We want www.example.com/myapp to be rails root path. </p> <p><strong>routes</strong></p> <pre><code>Rails....
<p>Why not wrap all of your routes in the routes file inside a scope such as:</p> <pre><code>scope path: '/myapp' do #routes here end </code></pre>
How to click on a link based on text in a table using selenium <p><a href="http://i.stack.imgur.com/wORc5.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/wORc5.jpg" alt="Table with links"></a></p> <p>Hi All,</p> <p>I have the following table with links that I need to select. In this specific example I need to ...
<p>You should use a CSS selector for this case: Can you try:</p> <pre><code>By.CssSelector("a.browse-catalog-categories-link") </code></pre>
Displaying a bitmap to full size in imageview <p>I am trying to display a bitmap loaded from external card to an imageview that occupies the entire screen. My goal is to display how it is displayed in Gallery app. I tried using <code>scaletype="center"</code>, <code>scaletype="fitXY"</code> with and without <code>adjus...
<p>Please try this.</p> <pre><code>&lt;ImageView android:layout_width="wrap_content" android:adjustViewBounds="false" android:scaleType="fitCenter" android:layout_centerInParent="true" android:layout_height="wrap_content" android:id="@+id/player_imageview" /&gt; </code></pre>
Rotate html canvas line pattern <p>How can I rotate canvas line pattern, drawn on HTML canvas?</p> <pre><code>var canvas = document.createElement('canvas'); var context = canvas.getContext("2d"); var canvasPattern = document.createElement("canvas"); canvasPattern.width = 10; canvasPattern.height = 20; var contextPatt...
<p>i have already rotated the canvas by 60 degree but if your requirement is rotating 130 degree u need to keep in mind that the rotation >=90 degree makes the object perpendicular to the plane thus cant be seen due to its thickness!</p> <pre><code>contextPattern.rotate(60 * Math.PI / 180); </code></pre>
Prepare for segue crashing after removing override in Xcode 8 and Swift 3.0 <p>After updating from Xcode 8 beta 5 to Xcode 8 final release, and after removing the override from all my prepare for segue methods, all of them are crashing at run time.</p> <p>Here is an example of my code: </p> <p>This is the action meth...
<p>Don't remove the <code>override</code>, you're hiding the issue instead of fixing it. The signature of the prepare for segue method changed in Xcode 8 beta 6.</p> <p>It should now be:</p> <pre><code>override func prepare(for segue: UIStoryboardSegue, sender: Any?) { </code></pre>
Hosted, private or integrated web panel <p>I'm currently writing a Java program including a web panel. The program itself manages gameserver on a root/ vServer. The web panel is there to control the program and display information about the servers. The program uses sockets to communicate with the web panel. Now I'm g...
<p>Solution 3 seems the best one to me. Reason for this:</p> <p>Solution 1: It might be rather difficult/slow to "talk" to the application, whereas with solution 3 you can do everything fast as it's on the same server. Also don't forget the risk of your webspace ever going down/being inaccessible.</p> <p>Solution 2: ...
Okta sessions/me returning 404 when called from Javascript (Redux) <p>I am trying to get the current session Object from Okta using the sessions/me endpoint called from Javascript (Redux action), but I get a not found response, even when I have an active session. </p> <p>It's not CORS related, I enabled CORS for my do...
<p>I'm guessing this is a 3rd party cookie issue:</p> <p><a href="https://blog.zok.pw/web/2015/10/21/3rd-party-cookies-in-practice/" rel="nofollow">https://blog.zok.pw/web/2015/10/21/3rd-party-cookies-in-practice/</a></p> <p>For example, in Safari privacy settings, I am able to repro the 404 on sessions/me if I set "...
How to parse attribute from savon response <p>I am posting the soap response I am working with at the bottom.<br> I need to grab the <code>BodyType="HTML"</code> attribute from <code>&lt;t:Body BodyType="HTML"&gt;</code></p> <p>Doing <code>response.body</code> turns the entire thing into a hash and there is no sign of...
<p>Namespaces can really muddy the waters.</p> <p>By default, Nokogiri will look in the root node for namespace declarations so <code>t|Body</code> would work if <code>xmlns:t</code> had been defined in the root node.</p> <p>But, because it wasn't, you have to use <a href="http://www.rubydoc.info/github/sparklemotion...
What should i do if False Positive Rate is 0/0 or undefined? <p>I am working on performance measuring and trying to draw a ROC curve, however to draw ROC curve i need TPR and FPR.</p> <p>As we know,</p> <p>False Positive Rate (FPR) = FP / (FP + TN)</p> <p>I have got values of TN and FP both equal to 0, so how can i ...
<p>First of all</p> <blockquote> <p>False Positive Rate (FPR) = FP / (FP + TN)</p> </blockquote> <p>thus</p> <blockquote> <p>I have got values of TP and FP both equal to 0</p> </blockquote> <p>is not a problem, as TP is not used in this equation. The only problem would be for FP + TN to be 0, but this is imposs...
How to break a button or anchor tag for responsive view <pre><code>&lt;td&gt; @if($product-&gt;status) &lt;div class="form-group has-error" style="word-wrap:break-word;"&gt; &lt;label class="control-label"&gt;No&lt;/label&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a class="btn btn-success" href=...
<p>You should add responsive class to table element so that scroll will be displayed on smaller devices.</p> <p>Check bootstrap responsive tables.</p>
x-editable sends empty field although "savenochange" is set to true <p>I have multiple fields being edited with x-editable, saving them all at once after a submit button was clicked, based on this example: </p> <p><a href="https://vitalets.github.io/x-editable/docs.html#newrecord" rel="nofollow">https://vitalets.githu...
<p>The solution is to add</p> <pre><code>$(this).eq(0).data('editable').value = fields[dname]; </code></pre> <p>to the js function updating the text on the page:</p> <pre><code>$(document).ready(function(){ $('.lpeditable').each(function(e) { var dname = $(this).attr('data-name'); var fields = &lt;?php...
Onclick Div inside form <p>I have 4 <code>div</code>s in my form like below:</p> <pre><code>&lt;div class="col-sm-6" &gt; &lt;div class="bunch"&gt; &lt;h4&gt;title&lt;/h4&gt; &lt;span&gt;price $&lt;/span&gt; &lt;span class="time"&gt;text&lt;/span&gt; &lt;span class="button"&gt;tex...
<p>You can <a href="http://api.jquery.com/attr/#keyvalue" rel="nofollow">set an attribute</a> with 2 parameters:</p> <pre><code>$(".bunch").attr("name", "yourValue"); </code></pre>
VBScript Converting Object to String? <p>SORRY IF THIS IS CONSIDERED A REPOST, I DID DELETE THIS FROM THE PROGRAMMER STACK.</p> <p>I am usually a silent user of this website. Picking bits and pieces of your code to better educate myself on the different ways of programming things.</p> <p>I have run into a wall with ...
<p>The VBScript TextFile object's default method isn't WriteLine. I would also avoid your object creation/method chain and create each object via a <code>Set</code> before calling methods on it:</p> <pre><code>Dim objFSO Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFileToWrite = objFSO.OpenTextFile...
Completely hiding block elements that don't fully fit in the visible part of their parent <p>Suppose I have three block elements in a container. The black line indicates the container. The blue boxes are the three block elements within it.</p> <p><a href="http://i.stack.imgur.com/USXCU.png" rel="nofollow"><img src="...
<p>Yes it is possible with <code>Flexbox</code>, you need to set <code>flex-direction: column</code> , <code>flex-wrap: wrap</code> and also <code>overflow: hidden</code>. </p> <p>Also you need to set full width or <code>calc(100% - margin)</code> on flex-childs so when last elements wraps itself it will go out of par...
synchronous query with node and PostgreSQL <p>I want delete from <code>box_property</code> when all update query finished </p> <p>I write this code but I'm not sure that this is correct or not.I want run update query synchronous </p> <pre><code>var data = [1, 2, 3, 4]; //data generate dynamicly for (var i = 0; i &l...
<p>You should avoid making anything synchronous in NodeJS.</p> <p>In your case, a simple IN statement should solve that:</p> <pre><code>var params = []; for (var i = 1; i &lt;= data.length; i++) { params.push("$"+i); } pool.connect(function(err, client, done) { client.query("update box " + "...
exclude Jest snapshots from git whitespace check <p>I am trimming whitespace from git commits using <code>git diff-index --check --cached HEAD --</code>. I want to add Jest tests using snapshots, but the snapshot files include whitespace and my tests will always fail if I remove it. So I want to exclude the <code>*.j...
<p>Git does have a way of specifying paths to exclude, though it's poorly documented and apparently not very well known. It's known as <a href="https://git-scm.com/docs/user-manual.html#def_pathspec" rel="nofollow">pathspec</a>, and in this case can be used as follows:</p> <pre><code>git diff-index --check --cached H...
PHP - Log exec() calls <p>is there a way to log all calls that to exec() PHP makes? Recording PHP file and line number, and target executable with arguments, for example.</p> <p>Thanks</p>
<p>You've got a few options, none of them are great:</p> <ul> <li>If you have PECL APD installed, you can use <a href="http://php.net/manual/en/function.override-function.php" rel="nofollow">override_function()</a>.</li> <li>If you have PECL runkit installed, you can use <a href="http://php.net/manual/en/function.runk...
Why is my react flux function not defined? <p>I have been successfully writing a reactjs app. It works well. I have been writing a new component to take lat and long coords from State and pass it to a function I defined called <code>handleMouseOver</code> and bound it to <code>this</code> in the constructor state is ...
<p>Your thinking is correct.</p> <p>Change <code>MapStore.bathrooms.map(function(bathroom, i, mouseOver) {</code></p> <p>to: <code>MapStore.bathrooms.map((bathroom, i, mouseOver) =&gt; {</code></p> <p>Also the following looks like an error to me:</p> <p><code>&lt;button onClick={this.handleMouseOver()}&gt;</code></...
How create UART Pass through in Microcontroller <p>I'm trying to create a UART Pass through for one of my project. But i could not figure out how i should tie the pins of microcontroller. I'm using embedded C &amp; Keil for programming.</p> <ol> <li>I'm using NXP p89lpc954 Microcontroller(8051 based) for this purpose....
<p>It is not normally possible to directly and transparently connect one UART to another. You will have to provide appropriate software to transfer data from one UART to another. </p> <p>If both UARTs run at the same baud rate this may be relatively simple - you can read the Rx register from one UART and write the v...
List issue with <li> tag <p>I've made a list with <code>&lt;li&gt;</code> tags which looks like this.</p> <p><a href="https://gyazo.com/764cbe3542522bc552d774e1383ac810" rel="nofollow">https://gyazo.com/764cbe3542522bc552d774e1383ac810</a></p> <p>Why is there a random <code>&lt;li&gt;</code> tag down there? There is ...
<p>Here is a version of your exact code but I ran the "tidy" function in the snippet. See how it's broken?</p> <p>You're not closing things properly, see the code comments. Also, you're incorrectly nesting the tags, the <code>li</code> is closed before the <code>p</code> even though it starts before it.</p> <p>Techni...
How can I execute Python code in a virtualenv from Matlab <p>I am creating a Matlab toolbox for research and I need to execute Matlab code but also Python code. </p> <p>I want to allow the user to execute Python code from Matlab. The problem is that if I do it right away, I would have to install everything on the Pyth...
<p>You can either modify the <code>PATH</code> environment variable in MATLAB prior to calling python from MATLAB</p> <pre class="lang-matlab prettyprint-override"><code>% Modify the system PATH so it finds the python executable in your venv first setenv('PATH', ['/path/to/my/venv/bin', pathsep, getenv('PATH')]) % Ca...
Javascript files not loading in sources <p>So I have a landing page up at <a href="http://mytestosteronekit.com" rel="nofollow">http://mytestosteronekit.com</a>. Im using Leadpages to create the page. I have an index.html file that pulls in the leadpage with script in the head. I am also including bootstrap CSS, a c...
<p>Bootstrap requires jQuery to be loaded before firing. All I needed to do to fix this problem was call to jQuery before calling the other scripts. Problem solved. No interference with Leadpages scripts.</p>
Mongo result set with multiple memberIds <p>I am using Meteor/Mongo with Typescript/Javascript.</p> <p>I have a chat app I am developing. I get a result set from Mongo.</p> <pre><code>const chats: Mongo.Cursor&lt;Chat&gt; = Chats.find( { memberIds: 'J65'}, { sort: { lastMessageCreatedAt: -1 }, transform: ...
<p>You should use the <code>$in</code> operator. </p> <p>Your code shall look like:</p> <pre><code>const chats: Mongo.Cursor&lt;Chat&gt; = Chats.find( { memberIds: {$in:['J65','J66','J67']}, { sort: { lastMessageCreatedAt: -1 }, transform: this.transformChat.bind(this), fields: { memberIds: 1, lastMe...
How to reference multiple sub-classes on the same element with SASS <p>I'm using the SMACSS method of writing my SCSS code, and I have a subclass that I want to reference if it also has another subclass.</p> <p>HTML</p> <pre><code>&lt;div class="parent-class parent-class-subclass1 parent-class-subclass2"&gt; </code><...
<p>you should do it like this</p> <pre><code>&lt;div class="parent-class subclass1 subclass2"&gt; .parent-class { &amp;.subclass1.subclass2 { //Styles here } } </code></pre> <p>or you can even do it like this</p> <pre><code>.parent-class { &amp;.subclass1 { //subclass1 Styles here &amp...
Dynamics CRM Tables : The purpose of these security tables:- SystemUserPrincipals, PrincipalEntityMap, PrincipalAttributeAccessMap? <p>i want to know the purpose of these dynamics CRM tables as i am trying to understand the internals of the dynamics CRM security model.</p>
<p>The following is a great article that's going to help you to understand how the security model works:</p> <p><a href="https://blogs.msdn.microsoft.com/crm/2007/04/05/crm-security-model-internals/" rel="nofollow">CRM Security Model Internals</a></p> <blockquote> <p>In this post I’ll describe some of the CRM Sec...
SAS EG : Selecting the most recent dataset from a library <p>I use <a href="/questions/tagged/sas" class="post-tag" title="show questions tagged &#39;sas&#39;" rel="tag">sas</a> EG V5.1. I need to select the most recent dataset saved within a permanent library. How can I do that without having to look at the library?</...
<p>You can use <code>dictionary tables</code>.</p> <p>Using modification (<code>modate</code>) or creation column (<code>crdate</code>).</p> <pre><code>proc sql; create table tables as select memname, modate from dictionary.tables where libname = 'SASHELP' order by modate desc; quit; </code></pre...
Why does PageSpeed Insights report "page reached the limit of 3 client redirects" when site is not redirecting? <p>After submitting a url to <a href="https://developers.google.com/speed/pagespeed/insights/" rel="nofollow">Google PageSpeed Insights</a>, I get the following response: </p> <blockquote> <p>Attempting to...
<p>The page has 5 redirects. Four of them are caused by Google.</p> <p>In the image below, the redirects are highlighted in yellow.</p> <p>The first redirect is the redirect from HTTP to HTTPS</p> <p>I see nothing technically wrong, I suspect it's a glitch in Google's PageSpeed.</p> <p>Try removing the 3 double cl...
Last Month Data Formula <p>I have a custom table that has the below information in MS SQL 2014. I am trying to come up with a way to calculate the following formula.</p> <blockquote> <p>ABS(LastMonthTotal + LastMonthNew – ThisMonthTotal) = Decoms</p> </blockquote> <p>i.e. ABS(AugustTotal + AugustNew – Septembe...
<p>Perfect opportunity to use a window function:</p> <pre><code>SELECT LAG(TotalCount) OVER (ORDER BY CreationMonth) AS LastMonthTotal ,LAG(NewCount) OVER (ORDER BY CreationMonth) AS LastMonthNew ,TotalCount AS ThisMonthTotal ,ABS(LAG(TotalCount) OVER (ORDER BY CreationMonth) + LAG (NewCount) OVER (ORDER BY Cr...
iOS10 NSLog is limited to 1024 chars strings <p>In iOS10 the NSlog are limited to 1024 characters has anybody know a workaround to print complete string.</p>
<p>I thinks this is a same question with [ <a href="http://stackoverflow.com/questions/39584707/nslog-on-devices-in-ios-10-xcode-8-seems-to-truncate-why]">NSLog on devices in iOS 10 / Xcode 8 seems to truncate? Why?</a>, I will also post my answer here, in case you want to use <code>printf</code> instead.</p> <p>Thi...
Login and Register page not working. Won't register or login <p>I have made a website and i needed a login and sign up page. When i try it it dosen't work. It keeps popping up with unable to register. Please could you help. Here is the register page</p> <pre><code> &lt;?php session_start(); if(isset($_SESSION['user...
<p>isset($_SESSION['users22']) this is creaing issue you cant use like this same for login page. Also i am assuming $con as DB connection <pre><code> session_start(); if(isset($_SESSION['users22']) &amp;&amp; $_SESSION['users22'] !="") { header("Location: Home1.php"); } include_once 'dbConnect.php'; if(isset($_P...
Why does the Spring csrf give me a 403 network error? <p>My apologies for the messy HTML syntax below. When I have the <code>http.authorizeRequest()</code> csrf enabled, I keep getting a 403 error. Of course, if I have <code>csrf.disable()</code>, everything works fine.</p> <p>It is my understanding that the <code>...
<p>Okay, so the Spring documentation isn't correct, at least not what I saw. I actually added the following to the <code>&lt;form:form&gt;</code> tag</p> <pre><code>&lt;input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" /&gt; </code></pre> <p>And now it works.</p>
How do you label flaky tests using junit? <p>How do I label flaky tests in junit xml syntax that jenkins uses to give us a report? jenkins gives me a nice report of tests that succeeeded and failed. I would like to know which tests are known to be flaky. </p>
<p>You label such tests <strong>not helpful</strong>. And your primary goal is to eliminate the "flakiness" of such tests - by identifying the root cause of the problem and either fixing production or test code; or both; or worst case by deleting or @Ignore'ing those tests.</p> <p>Disclaimer of course: jenkins can't t...
Input has required but form still submits <p>I'm using the required attribute from HTML5 validations. I don't have an idea why the form still submits even though the html5 validates the empty input field.</p> <p>Here's the Plunker link. <a href="http://plnkr.co/edit/evh0fCD5hdyoXXuxJrUy" rel="nofollow">http://plnkr.co...
<p>Of course it will submit, the required attribute will only trigger the validation in the field, it wont stop the submit. For this to work you have to do something like this: </p> <pre><code>if($scope.searchUser.$valid){ $http.get("https://api.github.com/users/" + username) .then(onUser...
JQuery .param() method for Angular 2? <p>Is there anything like this <a href="http://api.jquery.com/jquery.param/" rel="nofollow">$.param()</a> function from JQuery for Angular2?</p> <p>I know Angular 1 specifically has a service like it, <a href="https://docs.angularjs.org/api/ng/service/$httpParamSerializerJQLike" r...
<p>There is a built in serialize function, but its not exported.. So we need to go a little workaround..</p> <p>You could do it like this: <a href="https://plnkr.co/edit/ffoaMVbwSOIX5YNLo2ip?p=preview" rel="nofollow">https://plnkr.co/edit/ffoaMVbwSOIX5YNLo2ip?p=preview</a></p> <pre><code>import {Component, NgModule} ...
AWS Lambda function exited before completing request <p>I'm trying to follow the AWS guide for S3 and Lambda here</p> <p><a href="http://docs.aws.amazon.com/lambda/latest/dg/with-s3-example.html" rel="nofollow">http://docs.aws.amazon.com/lambda/latest/dg/with-s3-example.html</a></p> <p>I'm at the manual testing stage...
<p>Posting the answer for visibility.</p> <p>The runtime was set to nodejs rather than node4.3</p>
How do I json_decode string with special chars (" \\ " ) <p>I have a problem with encoding and decoding json data. In js I send query with data type 'json', it looks like this:</p> <pre><code>{\"front\":{\"0\":{\"type\":\"text\",\"width\":\"55px\",\"height\":\"27px\",\"top\":\"151px\",\"left\":\"86px\",\"zIndex\":\"1\...
<p>You might be storing malformed JSON data. Take a look at these pages (some useful resources right from PHP docs):</p> <ul> <li><a href="http://php.net/manual/en/function.json-encode.php" rel="nofollow">http://php.net/manual/en/function.json-encode.php</a></li> <li><a href="http://php.net/manual/en/json.constants.ph...
Git pull a branch from a different repository <p>I've few files in my current repository. I want to merge a remote branch from a different repository.</p> <ol> <li>Pull and merge a branch from <code>github.com/username/code.git</code> (branch loader)</li> <li>Then pull and merge a branch from <code>github.com/username...
<p>You can add other origins for your repository using</p> <pre><code>git remote add new_origin git@theUrlToRepo </code></pre> <p>You can now start pushing/pulling and basically doing all operations on both of your remotes.</p> <pre><code>git push origin master git push new_origin master git pull origin master git ...
Error occurred during initialization of VM while running jdevloper <p>When running java programs in javadeveloper IDE,</p> <p>Error is coming Error occurred during initialization of VM</p> <blockquote> <p>Error occurred during initialization of VM java/lang/ClassNotFoundException: error in opening JAR file C:\...
<p>Seems like your JDeveloper is pointing to a JRE instead of a full blown JDK. Try to reinstall JDeveloper pointing to the JDK instead.</p>
Streamwriter (cannot type full text) c# <p>the problem is when I print data to "M100.csv" file, I only see the only one line of:</p> <pre><code> writer1.WriteLine("{0} {1} {2} {3} {4} {5} {6}", houses[i].District, houses[i].Street, houses[i].Number, houses[i]....
<p>Declaring StreamWriter with the path-only constructor will either create or overwrite the file at the location. Since you're creating a new stream writer for each write, you are effectively truncating and restarting the file, and ultimately end with a single line of text. Without restructuring your code, you can fix...
Generate data with normally distributed noise and mean function <p>I created a numpy array with n values from 0 to 2pi. Now, I want to generate n test data points deviating from sin(x) normally distributed. </p> <p>So i figured I need to do something like this: <code>t = sin(x) + noise</code>. Where the noise must be ...
<p>The arguments to <a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.random.randn.html" rel="nofollow"><code>numpy.random.randn</code></a> are not the mean and standard deviation. For that, you want <a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.random.normal.html" rel="nofollow">...
Adding rows with values of "0" to a dataframe with missing data <p>I am fairly new to R and am currently working with a fairly large dataframe. Basically what I am trying to do is turn something like this:</p> <pre><code> Year Sample Species Catch 1 2016 1 a 9 2 2016 1 b 5 3 2016 ...
<p>How about this?</p> <pre><code>all.species &lt;- c('a','b', 'c','d','e','f','g','h','i','j','k') samples &lt;- split(df, df$Sample) new.df &lt;- NULL for (sample in samples) { missing.species &lt;- setdiff(all.species, unique(sample$Species)) sample &lt;- rbind(sample, data.frame(Year=unique(sample$Year), ...
Arithmetic overflow error on decimal field <p>I have a field cost with values <code>0.987878656435798654</code> , <code>0.765656787898767</code> I am trying to figure out what would be the datatype for this.</p> <p>When I give <code>decimal 15,15</code> and trying to load data it is throwing me an error</p> <blockqu...
<p>The problem is that you are not allocating any length to the value <em>before</em> the decimal. </p> <p><code>DECIMAL (15, 15)</code> means that it has a precision of 15 digits after the decimal, but only enough room for 15 digits total - thus leaving no room for values greater than <code>1</code>.</p> <p>This me...
How to use libraries, running at docker <p>Can anybody, please, explain me, how to use a library, which image's running at docker? And how the process is constructed in genereal: how python access the image or vice-versa( i mean, its not in the "lib" folder in python, right?)? And simply, what should i do, to be able t...
<p>Use Python's amazing <a href="https://virtualenv.pypa.io/en/stable/" rel="nofollow">VirtualEnv</a> module to bundle imports, essentially making them available at the image's build time.</p> <p>Then, in your application, use the Python "binary" of that virtualenv and enjoy hassle-free imports :)</p> <p>Here's a <a ...
Empty Spinner in fragment | Android <p>I am trying to show values in spinner from Arrayadapter in one of my fragments in the <em>onCreateView</em> in my public <em>final class Manual extends Fragment</em>:</p> <pre><code> public View onCreateView(LayoutInflater inflater, ViewGroup container, B...
<p>Declare The Array Like this:</p> <pre><code>private static final String[] opciones={"one","two","three","four","five"}; </code></pre> <p>The Spinner Code Here Should be like:-</p> <pre><code> Spinner spinner=(Spinner)findViewById(R.id.spinner); spinner.setOnItemSelectedListener(this); ArrayAdapter&lt;...
Reusable TableViewCell loads an old image <p>I have a dynamic tableview that can be searched through with a search box, and if I load an image in a cell in the background and the search text changes, the object in the cell may also change, and sometimes an old image that was loading in the background will finish and di...
<p>You need to do two things here</p> <p>1) in prepareforresue method Cancel current downloading request</p> <p>2) in prepareforresue method set image to nil</p> <p>Hope this will fix your issue</p>
LightSwitch Metadata Missing: DataService ApplicationData <p>I'm not sure if submitting question in right forum (LightSwitch or TFS). In my company we have a solution developed in Visual Studio 2012 LightSwitch and into App.Server layer we consume an ApplicationDataService.svc (OData) and a WCF Service. I created a bui...
<p>I solved it by myself. In LightSwitch VS2012, OData services consumers generate a .edmx file (Entity Framework data model) into the server tier project. Name of the service reference to such services (svc) into my project is ApplicationData. Due to .edmx file was accidentally excluded by somebody else from that proj...
Rails 5 - config.assets.compile should be true - why? <p>I am developing Rails 5 application and use assets pipeline. It work well in development mode, but if I try to run it in production mode, it can't load images &amp; styles correctly. I checked and found that it is because</p> <blockquote> <p>config.assets.comp...
<p>Precompile your assets first.</p> <p>Run <code>RAILS_ENV=production rake assets:precompile</code> to generate your stylesheets and js files in your public directory.</p>
Android cannot find BindingConversion in include tag <p>I have made a BindingConversion from boolean to visibility, however Android can't find it, but only when I use it in an include tag. It works at other elements like FrameLyout.</p> <p>In my abstract ViewModel:</p> <pre><code>@BindingConversion public static int ...
<p>I don't know why this is not working, but I think its like the layout tag in include. You can't use this tags for databinding. So I deleted the includes, used a viewstub and changed the layouts programmatically.</p>
database updating using php <p>well i just made a form in HTML witch accepts user inputs and a mysql database to store them, now in the php file everything goes well no errors but the problem is the data never displays in the database, here is the php file:</p> <pre><code>&lt;?php if(isset($_POST["submitacc"])){ ...
<p>Use mysqli_query() instead of query(). Also use WHERE clause in your $mysql variable. The WHERE clause specifies which record or records that should be updated. If you omit the WHERE clause, all records will be updated!</p> <p>Example: </p> <pre><code>if(mysqli_query($conn , $mysql)){ echo "Records were updat...
some error in redirecting from all old domain url to new domain url <p>When redirecting to old website url page to new website url, it result like this: www.newdomain.comabout.html/</p> <p>But I want like this: www.newdomain.com/about.htm</p> <p>My old website url is like this:<br> www.olddomain.com/about.html<br> ww...
<p>Try using the following code in your <code>.htaccess</code> file of olddomain:</p> <pre><code>RewriteEngine On RewriteCond %{HTTP_HOST} ^www\.olddomain\.com$ [NC] RewriteRule ^(.+\.htm)l$ http://www.newdomain.com/$1 [R=301,L] </code></pre>
Limit the Switch that has Internet, Without addition any network devices? <p>I buy a Cisco 2960X-48 Port Switch, and one Dedicated Internet from an ISP. I connect Internet Port to switch and so All of my switch ports has Internet. I want to manage and define login for each of 10 users in my work place to limit each use...
<p>In the Cisco IOS for your 2960X Switch, you would need to set up a <code>policy-map</code> and assign it to each user's port.</p> <blockquote> <p>This example shows how to create a policy map and attach it to an ingress port. In the configuration, the IP standard ACL permits traffic from network 10.1.0.0. For tra...
SQL joining 3 tables <p>Lets say I 3 tables called </p> <pre><code>UID | User | Task </code></pre> <p>UID and User have the fk relationship and join on UID.crossuserid = User.crossuserid (the same value) User and Task have the fk relationship and join on User.UserID = Task.UserID</p> <p>how would query so that I hav...
<p>Try this:</p> <pre><code>SELECT UID.USERNAME FROM UID LEFT JOIN USER ON UID.CROSSUSERID = USER.CROSSUSERID LEFT JOIN TASK ON USER.USERID = TASK.USERID WHERE TASK.TASKTYPEID = '3' </code></pre>
Beginning Python: For Loop- what do to afterwards <p>Found this exercise in a textbook online and am attempting to battle my way through it. I believe they intended it to be answered with a while loop, but I'm using a for loop instead which could be my problem.</p> <p>"Write a program that prompts the user to enter an...
<p>You want to check if there is an integer <code>root</code> such that <code>root ** pwr == user_input</code>. With a little math we can re-write the above statement as <code>root = user_input ** (1. / pwr)</code>. You've got a pretty small number of <code>pwr</code> values to choose from, so you can simply loop over ...
How to make sure [BsonId] field is named like property name in the database instead of `_id` <p>I'm using Mongo for some denormalized data storage, however found a minor annoyance that I would like to get fixed.</p> <p>Since my objects have their own <code>RegistrationCode</code> which are unique for every record I wo...
<p>As Evk stated, every document in a Mongo collection must have an _id field - see <a href="https://docs.mongodb.com/manual/reference/glossary/#term-id" rel="nofollow">MongoDB Reference Glossary</a>.</p> <p>Essentially what you are doing when adding the '[BsonId]' attibute is assigning the value of your RegistrationC...
pyvenv not working because ensurepip is not available <p>I upgraded from ubuntu 14.04 to ubuntu 16.04 a few days ago. When I try to create a virtual env by using </p> <pre><code>pyvenv .venv </code></pre> <p>or</p> <pre><code>python3 -m venv .venv </code></pre> <p>But there is an error:</p> <pre><code>The virtual ...
<p>It seems that it was a locale problem. Solved by executing:</p> <pre><code>export LC_ALL="en_US.UTF-8" export LC_CTYPE="en_US.UTF-8" sudo dpkg-reconfigure locales </code></pre> <p>found on this thread <a href="http://stackoverflow.com/questions/14547631/python-locale-error-unsupported-locale-setting">Python locale...
Submit php does not work <p>My contact form is not sending. someone could see what mistake I am making? I tried adding the method = "post", but also not worked.</p> <p>HTML:</p> <pre><code>&lt;form id="contactForm" novalidate class="s-form wow zoomInUp" data-wow-delay="0.5s"&gt; &lt;div class="s-relative"&gt; &lt...
<p>You have written <code>if(empty($_POST['name'])</code>. Check with <code>if(!empty)</code> to validate. </p>
Running multiple streams in same thread <p>Is it possible subscribe two different streams in a same thread other than caller thread?</p> <p>Suppose that I have two different observables and two different subscribers. And I call <code>subscribeOn(Schedulers.newThread())</code> on both observables. But I want them subsc...
<p>Yes you can:</p> <pre><code>Scheduler scheduler = Schedulers.from(Executors.newSingleThreadExecutor()); </code></pre> <p>Then apply <code>.subscribeOn(scheduler)</code> to both observables. One stream could block the other stream but this will depend of course on your observables and the subscriber request pa...
Upload png file to specific folder in unbuntu server using php <p>How do I upload a png file to specific folder with php? I've been trying to use this:</p> <pre><code>$target_file = "capes//" . basename($_POST["Username"] . ".png"); </code></pre> <p>but when users upload a png file it uploads it to the root directory...
<p>Are you trying to move an uploaded file (Example: <strong>Test.png</strong>) to root/capes/<strong>Test.png</strong>? <br> You have not gave much infomation, but we could help you more if we seen more of your code <br> Note that linux is Case sensitive unlike windows. Please check the following and report back:</p> ...
Why go is parsing my timestamp with Local location instead of UTC <p>I don't understand this behaviour (or the doc) of this: <a href="https://play.golang.org/p/vz2UTz-3Yy" rel="nofollow">https://play.golang.org/p/vz2UTz-3Yy</a></p> <p>On the playground, it return the expected results:</p> <pre><code>t = 2015-06-01 0...
<blockquote> <p>When parsing a time with a zone offset like -0700, if the offset corresponds to a time zone used by the current location (Local), then Parse uses that location and zone in the returned time. Otherwise it records the time as being in a fabricated location with time fixed at the given zone offset. [<a h...
How to create an rray of composites strings <p>Hi everyone: I have a collection of 50 strings that represent comments in a text file where each line represents a separate comment with different sentences . </p> <p>Each string is a user review of a product, and each string or review has several several sentences. </p> ...
<p>One of my first projects was similar to this. I believe your asking for help in getting the text file lines as an array.</p> <p>To open the file for reading: </p> <p><code>file = open("/path/to/file", "r")</code></p> <p>I would then split on spaces so: </p> <pre><code>for line in file: print line.split(' ...
APT package release or repository date <p>I have been searching for a way to obtain a timestamp for when a package was either released for general use or possibly when first loaded on a local repository. Something in either Shell or Python would be ideal, but I'm open to other options at this point. I know packages sup...
<p>The answer depends on what exactly you are looking for, and it's not clear from the question. Before reproducible builds were introduced, the date a package was built could be retrieved from the raw ar members such as:</p> <pre><code>ar tv pkgname_version_arch.deb </code></pre> <p>If you are looking for the date t...
How do I include package installed with Bower? <p>I've added Modernizr to my project using Bower:</p> <pre><code># bower install modernizr --save </code></pre> <p>and in looking at what it installs, it's not clear to me which file I need to use in my project. I would expect a <code>dist/</code> folder or perhaps a <...
<p>I'm assuming you want to use it on a webpage, so please correct me if I'm wrong on that count!</p> <p>I believe you're missing a build step; bower downloads all those files for you, but eventually they all (and any other packages you've installed with bower) need to be "bundled" up into a single .js file that you c...
Linear Layout does not fill the whole screen <p><br> <strong>Why the linear layout does not fill the whole screen?</strong> <br>As you can see I am using match parent in the linear layout.<br> If I delete the Scrollbar nothing changes. The button is not at the bottom of the screen. <br> <strong>main_activity.xml:</stro...
<blockquote> <p>Give <code>android:fillViewport="true"</code> to your ScrollView.</p> </blockquote> <p>Your xml will looks like below. <strong>Main_Activity.xml</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:...
How to get an array type [1,2] instead of (1, 2) in Objective-c? <p>I'm trying to send an array in post JSONModel call. I need convett my array to NSString and send the array in format: </p> <pre><code>[1, 2, 3] </code></pre> <p>but when I convert this to NSString and print my array, this has the format: </p> <pre>...
<pre><code>NSMutableArray *array= [NSMutableArray arrayWithObjects:@"1", @"2",@"3",@"4", nil]; NSData *jsond = [NSJSONSerialization dataWithJSONObject: array options:NSJSONWritingPrettyPrinted error:NULL]; NSString *json = [[NSString alloc] initWithData:jsond encoding:NSUTF8StringEncoding]; NSLog(@"%@", json); </code>...
execvp() not working in my shell <p>I am trying to make a tiny shell. My problem is that when I call <code>execvp()</code> - I get errors. For example, when I type in <code>ls -l</code> it returns <code>ls: invalid option -- '</code></p> <p>Can someone, please, help me understand why I am getting this error? For my co...
<p>Your problem is that <code>fgets()</code> <a href="http://linux.die.net/man/3/fgets" rel="nofollow">also reads the newline character</a>. As a result, the last argument of <code>execvp()</code> arguments array contains a newline, causing <code>ls</code> complain about an unrecognized argument: what you acctually pas...
the most accurate way to store date and time in mysql database <p>What is the best way to store date and time in the database? I tried using <code>now()</code> on localhost: it works, but on live server it counts far back as 8 hours ago and current timestamp does the same thing. What is the most accurate approach?</p> ...
<p>You are storing the time in the most accurate method. It might not be in the correct timezone, but it is (as far as the server can tell) exactly that time when saved. If the timezone is incorrect, you will have to tell MySQL which timezone is considered "local" by executing something like <code>SET time_zone = 'YOUR...
Scipy/numpy: two dense, one sparse dot product <p>Let's say we have a matrix <code>A</code> of size <code>NxN</code>, and <code>A</code> is sparse and <code>N</code> is very large. So we naturally want to store is as as scipy sparse matrix.</p> <p>We also have a dense numpy array <code>q</code> of size <code>NxK</code...
<p>So you have</p> <pre><code>(k,N) * (N,N) * (N,k) =&gt; (k,k) </code></pre> <p>One of those dot product results in a dense array; that times another dense is also dense. With a multiplication like this you quickly loose the sparsity.</p> <p>If <code>q</code> has a lot of 0s, and you want to preserve the sparse ma...
Fixed Time on a Clock <p>I'm attempting to make a javascript clock (done already) which displays a specific time, and the same time, to everyone who views it. Currently, it will display 16:... for me, and 21:.... for the other guy. This is due to timezones, obviously. But, I'd like for it to display one time for every ...
<p>If you want a single time for every viewer and you don't care what that time is, you should use UTC time. Change the getHours and getMinutes calls to getUTCHours and getUTCMinutes. (Some timezones are offset by 15, 30, or 45 minutes from ours).</p> <p>Technically, you should also change getSeconds to getUTCSecond...
Static Cast from ( Base Reference to Base Object ) to ( Derived Class Reference) <p>In the <code>main</code> function below , the first <code>static_cast</code> is valid as i am trying to cast a (base class reference to <code>Derived1</code> class) to a derived reference But why is the second cast printing with the val...
<p>A <code>static_cast</code> is a promise from you to the compiler that the base class really is a derived class -- no need for the computer to double check. You're telling the compiler that you know something it cannot know which guarantees this to be true. So when the instruction comes for the CPU to go access a v...
Angular 2 ngModel where Id is something <p>I have an array of objects like so...</p> <pre><code>this.survey = [ {id: 1, answer: ""}, {id: 2, answer: ""}, {id: 3, answer: ""}, {id: 4, answer: ""}, {id: 5, answer: ""}, {id: 6, answer: ""}, {id: 7, answer: ""}, {id: 8, ans...
<p>I assume its not possible without using the index.</p> <p>Possible way to go:</p> <pre><code>&lt;textarea name="comments" class="form-control" (change)="updateSurvey($event, 101)" [value]="getSurveyAnswer(101)"&gt;&lt;/textarea&gt; </code></pre> <p>in your component:</p> <pre><code>getSurveyAnswer(id: number): ...
Project in VS 2015 decompiled by dotpeek reporting ambiguous error on same class <p>i have some small app, created in C# and its working. But when i decompile it with jetbrains dotpeek and open it in Visual Studio 2015 it shows me error </p> <p><strong>The call is ambiguous between the following methods or properties ...
<p>A lot of times debuggers and decompillers give result code with errors. They are maded only for understanding and fixing problems in programs without source code. If you have sources - you can debug your app without decompilation and save a lot of time. If you want compare code (original/decompiled), you can use Win...
Permission denied for accessing file through restful api <p>In my web application, I implemented a method to download file in my controller:</p> <pre><code>@RequestMapping( value = "/ristore/foundation/xml/{filename}", method = RequestMethod.GET, produces = "application/xml") public ResponseEnt...
<p>Check following conditions:</p> <ol> <li>Tomcat must be started with risdev user in order access to this folder. </li> <li>The folder "/rsrch1/rists/moonshot/data/prod/foundation/xml/" and all files inside it must have risdev owner (or read/write permission by others or corresponding group). </li> </ol> <p>For ref...
SharePoint list item: Copy list-item-level permissions from one item to another <p>I’m running into the following scenario, which I am unsure how to tackle.</p> <p>I need to be able to copy the list-item-level permissions from one list item to another one in a separate list. In other words:</p> <p>List A contains ...
<p>The following example shows how to copy list item permissions via <code>SharePoint JSOM API</code>:</p> <blockquote> <p>Prerequisites: </p> <p>Unique permissions should be assigned for source and target list items</p> </blockquote> <pre><code>SP.SOD.executeFunc('SP.js', 'SP.ClientContext', function(){ ...
Database Creation before Insertion <p>I have an android application in which I am using Content Provider on top of the database. However, I see that database gets created only when I insert the first record in the database through the Insert of Content Provider. In this scenario, if there's an error in database creatio...
<p>Within our app we show a splash screen specifically for the purpose of creating the db and initialising some application singletons. I'd recommend something similar.</p> <p>You can start a db (on)Create or db (on)Upgrade by calling <code>SQLiteDatabase#getWritableDatabase</code> or equivalent. Remember to perform t...
HDFS Delegation token expired even after adding principle to command line <p>I'm running a spark streaming job in hadoop. The machine is kerberized and it ran fine for 42 Hours and fails due to HDFS token delegation expiry.</p> <p>I even have the crontab set up for kinit command that runs for every 8 hours and I have ...
<p>Issue Solved...! Added the following config to spark command line while initiating the job and it worked.</p> <blockquote> <p>--conf spark.hadoop.fs.hdfs.impl.disable.cache=true</p> </blockquote> <p>or you can change this at yarn config level to impact globally.</p> <p>I tested it its running fine for 3 days.</...
Selenium Python StaleElementReferenceException <p>I'm trying to download all the pdf on a webpage using Selenium Python with Chrome as browser but every time the session ends with this message:</p> <pre><code>StaleElementReferenceException: stale element reference: element is not attached to the page document (Sessi...
<p>You get stale element when you search for an element and before doing any action on it the page has changed/reloaded.</p> <p>Make sure the page is fully loaded before doing any actions in the page.</p> <p>So you need to add first a condition to wait for the page to be loaded an maybe check all requests are done.</...