input_text_instruct
stringlengths
288
45.8k
output_text
stringlengths
37
33.2k
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: calculate the average value across indicies of a hash map<p>I tried writing this code to test out my idea on how to calculate the average value across like i...
<p>Maybe I misunderstood you, but you are not computing the average because for each array in your map, you are not taking into account all its positions. You are using the key and that makes absolutely no sense. Anyways, your code is very confusing. What you need to do is simply one loop inside the other. One going th...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Install vim without root privilege<p>There are several posts on the internet about this, but I haven't found a suitable solution for my case.</p> <p>This is...
<p>As guessed by Kaz in the comment above, ncurses does have the <code>--without-ada</code> option in its <code>./configure</code> to disable the Ada build. This allowed me to install ncurses and consequently vim !</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why Google crawler and Markup Validator sees this as an error?<p>For days now I try to figure out why I get this error from <a href="http://validator.w3.org/...
<p>Your errors are all minor but are caused by:</p> <p>1) The p tag is automatically closed by the client because it hits the <code>&lt;ul&gt;</code> tag, so in effect your statement is:</p> <p><code>&lt;p&gt; ... &lt;/p&gt; &lt;ul&gt; ... &lt;/ul&gt; &lt;/p&gt;</code></p> <p>This is because List elements should not...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to rollback in entitymanager createNativeMethod<p>I am using native method of entity manager and I want to rollback when some error occurs.For this I tri...
<p>The problem seems to be that the <code>EntityManager</code> is not injected by Spring. The <code>EntityManager</code> instance is created by your utility class <code>entityManagerUtil.entityManager()</code>. This means, that everytime when you use a new <code>EntityManager</code>, they are not part of your method tr...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: interpreter versus compiler's final code product<p>I'm trying to understand the difference between compilers and interpreters.</p> <p>I understand that a co...
<p>A compiler parses the language and generates machine code.</p> <p>An interpreter parses the language and executes the program straight away by calling specialized functions, it does not generate code.</p> <p>For example, <code>A= B + C</code> makes a compiler generate</p> <pre><code>Load R0, $B; Load R1, $C; Add...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Flutter Web - How do I retain an absolute value when iterating a list of objects?<p>I have a list of dictionaries within which I have an id. I iterate over t...
<p>Try with <code>for(final product in productList){...}</code></p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to switch IAM roles for AWS Cognito User belonging to multiple User Pool groups?<p>I have a web application built with AWS Amplify and Cognito used for a...
<p>After including the <code>Logins</code> property in the parameters to <code>getCredentialsForIdentity</code> it worked:</p> <pre><code>async function switchRoles(region, identityId, roleArn, cognitoArn) { const user = await Auth.currentUserPoolUser(); const cognitoidentity = new AWS.CognitoIdentity({ apiVersion...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: My custom template for my content type won't work in Drupal 7 - Bootstrap Theme<p>I am using bootstrap theme on Drupal 7. My subtheme has some templates that...
<p>Try copying node.tpl.php from the parent theme into the child theme and re-naming that according to naming conventions here <a href="https://www.drupal.org/node/1089656" rel="nofollow">https://www.drupal.org/node/1089656</a></p> <p>i.e. node--spokesmodel.tpl.php</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: MySQL,PhP, and Flash As3 Data is not loading properly?<p>For some reason the PHP variables are loading very improperly. So this is what happens:</p> <p>In m...
<p>Add ampersand between prints</p> <pre><code>print "thetesting=$testing"; print "&amp;"; print "theuserbio=$userbio"; </code></pre> <p>And check that you have this line:</p> <pre><code>urlloader.dataFormat = URLLoaderDataFormat.VARIABLES; </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: remove blank lines from multiple files within a specific directory<p>I would like to use a batch file to delete all blank lines in multiple files in the dire...
<p>I've decided to include all the explanations as comments. There are some ways of doing it without a rename/move operation, but are not as reliable as this. Anyway, at the end, files will have the same name but no empty lines.</p> <pre class="lang-dos prettyprint-override"><code>@echo off setlocal enableextensio...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Creating multiple variables "name + i" in a for loop (JAVA)<p>Hey is there a way to create multiple variables in a for loop? Here is an example of what i "wa...
<p>You can do it using a 2-D array as shown below:</p> <pre><code>import java.util.Arrays; public class Main { public static void main(String[] args) { int[][] arr = new int[10][]; for (int i = 0; i &lt; arr.length; i++) { arr[i] = new int[i + 1]; for (int j = 0; j &lt; arr...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: location.reload reloads most things<p>I'm creating a multi-language site that knows the user's "navigation language" by a cookie I set called <code>nav_lang<...
<p>reload() method reloads from the browser cache. You can force the the reload to get the page from server by setting the forceGet parameter to true: location.reload(true);</p> <p>in your case, you need to setup expiration time for css, js, images and font in either .htaccess file in web directory or in apache's virt...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is the meaning of the % character in vim?<p>The vim <a href="http://vim.wikia.com/wiki/Search_and_replace" rel="nofollow">wikia</a> page provides the fo...
<p>Learn how to look up commands and navigate the built-in <code>:help</code>; it is comprehensive and offers many tips. You won't learn Vim as fast as other editors, but if you commit to continuous learning, it'll prove a very powerful and efficient editor.</p> <p>Here's how you would have found the information:</p> ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Return table in stored procedure postgresql<p>I want to return the whole table with <em>stored procedure</em> not <em>function</em></p> <p>my code is:</p> ...
<p>Stored procedures aren't meant to return anything, use a function. And you don't need PL/pgSQL for that either:</p> <pre><code>create or replace FUNCTION public.test() returns TABLE (id numeric, test varchar) AS $func$ SELECT * FROM public.test; $func$ LANGUAGE sql; </code></pre> <p>As you return all co...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Display different names for values in Struts2 select tag<p>I have the following enum</p> <pre class="lang-java prettyprint-override"><code>public enum Accou...
<p>In S2 instead of hard-coding your enum values into list in a JSP you can directly retrieve values from the enum itself using <code>@package.Enum@values()</code> notation. And use <code>listValue</code> attribute to show whatever you want based on some conditions.</p> <p>For example:</p> <pre class="lang-xml pretty...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to enable @UseAdviceWith in Camel tests<p>I'm new to Camel and I'm trying to write some tests that use Spring context and @UseAdviceWith annotation. What...
<blockquote> <p>What is the difference </p> </blockquote> <ul> <li><code>@BootstrapWith</code> was <strong>introduced with Spring 4.1</strong></li> <li>For older Spring versions use <code>@ContextConfiguration</code>s <code>loader</code> parameter </li> </ul> <p>Both of them are Spring annotations, not Camel!</p> ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to calculate total size of all css,js and html pages separately uing shell script?<p>I have the following code in shell script <br></p> <pre><code>find ...
<p>You could use <code>awk</code>:</p> <pre><code>find . -name "*.css" -type f -printf '%s\n' | awk '{ tot+=$0 } END { print tot }' </code></pre> <p>Or in pure <code>bash</code>:</p> <pre><code>total=0 while read -r s; do total=$(( total+s )) done &lt; &lt;(find . -name "*.css" -type f -printf '%s\n') echo $tot...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get NSDate from start of 7 days ago<p>I'm trying to do some simple 7 day history plotting. Given the current <code>NSDate.date</code>, I want to get the NSDa...
<p>To construct a new date you should know not only a day but also a month and a year. So you should add NSYearCalendarUnit | NSMonthCalendarUnit. Also you should setup calendar and probably timezone properties of NSDateComponents's instance:</p> <pre><code>NSDateComponents *comps = [NSCalendar.currentCalendar compone...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to search with LINQ entites having string[] array properties and find these containing any of string from string[] array?<p>With EF Core 2.2 I am having ...
<p>If I make a list similar at your DB protocol Than this codes work for me.</p> <pre><code>using System.Collections.Generic; using System.Linq; namespace ConsoleApp2 { class BuilderClass { List&lt;BasketModel&gt; baskets; public BuilderClass() { baskets = new List&lt;Bask...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can i make electron run code in the right order?<p>When i call this function <code>logout(true)</code> in my back end electron code the dialog box shows ...
<p>Many thanks to Andrea Franchini's answer for putting me on the right tracks but it appears that ready-to-show is only sent once however after some research i found this solution which worked for me:</p> <pre><code>function logout(authFail) { win.loadFile(path.join(__dirname, 'src','login.html')); currentusernam...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Change strings to make them equal<p>Referring to question <a href="http://www.careercup.com/question?id=5683649722712064">HERE</a></p> <blockquote> <p>We ...
<p>You have two atomic operations:</p> <ol> <li><p>swap consecutive with cost 1</p></li> <li><p>swap first and last with cost 1</p></li> </ol> <p>One interesting fact: </p> <ol> <li>and 2. are the same if the strings end would be attached to the strings begin (circular string)</li> </ol> <p>So we can derive a more ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Using cookies with Brython<p>I’m currently trying to handle cookies with Brython but I’m having some trouble. I’ve found the <code>local_storage</code> modul...
<p>So, it turns out it was pretty simple. The code is pretty much the same as in JavaScript.</p> <p>Here is some sample code for creating a cookie named <code>foo</code> with the value <code>bar</code>:</p> <pre><code>from browser import document document.cookie = 'foo=bar; Path=/' </code></pre> <p>And that’s it!</...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: NullPointerException trying retrieve @ManyToOne Parent Field - Spring Boot<p>i'm trying to get a field from parent entity in a @ManyToOne relationship, but i...
<p><code>Imagem.album</code> remains null because code given in unit test never writes to that field. Only one side of the relation is set via <code>album1.getImagens().add(imagem)</code>.</p> <pre><code>//Imagem.album is not set in this loop: for (int i = 0; i &lt; 4; i++) { Imagem imagem = new Imagem("url" + i, ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Iterate through folder passed as argument<p>So a bit of background: I have one of those old mp3 players that if you just drag and drop a whole folder, it the...
<p>The loop will allow each file to be copied completely before the next file copy will start, so no need to put in the timeout.</p> <pre><code>@echo off echo mvp3... if "%~1"=="" echo Param 1 empty &amp; goto :eof if "%~2"=="" echo Param 2 empty &amp; goto :eof for /r %%a in (%~1\*) do echo move /Y "%%a" "%~dpn2" </...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: MSSQL Avg of two int.Max is int.Max + 1. Why?<p>Strange behaviour became visible during a unit test. </p> <p>An int table in mssql has two entries, each of ...
<p>The reason is because you're using <code>real</code>, which can only hold 7 digits (your value has 10).</p> <p>If you run <code>CONVERT(real,2147483647)</code> you'll find that the return value is <code>2.147484E+09</code>. As a <code>bigint</code> that value is <code>2147483648</code> <strong><em>not</em></strong>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Loading a big script into neo4j IDE<p>I have a very large .cypher file of 20K lines. When I use the IDE it will only accept 400 lines at a time. this is very...
<p>Have you tried the neo4j-shell? You can usually paste it in there, or pipe it into the shell if you are on Linux/OSX...</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Calling Java function from Qt C++<p>Is it possible to call java function from Qt Application and if so, how? Do I need to update java source for such task? I...
<p>First of all think twice before calling java from C/C++. For Android it allow you call some API function of OS, but you pay with perfomance and some hard catching errors.</p> <p>Qt designed pretty easy way for calling Java: package - androidextra But if you need call it on desktop there is a way to avoid it: JNI(as...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Error handling of PipelineModel.load(PATH) if path doesn't exist Pyspark<p>I want to do an error handling of PipelineModel.load(PATH) i.e want to check if pa...
<pre><code>try: pipelineModel = PipelineModel.load(S3LOC) except Exception as e: print('Exception Message ',e.args) print('Model is not deployed') sys.exit(0) </code></pre> <p>This snippet worked for me</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: LWJGL draw rect over texture<p>I use the following to draw the texture quads</p> <pre><code>tex.bind(); glTranslatef(x, y, 0); glBegin(GL_QUADS); ...
<p>Two things:</p> <ol> <li><p>Whenever you draw using color instead of textures, make sure to disable <code>GL_TEXTURE_2D</code> by calling <code>glDisable(GL_TEXTURE_2D);</code> before the rendering call (in your case before <code>case MENU:</code>). But don't forget to enable it again as soon as you're finished and...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Wrong number of arguments (0 for 1..2) with rails 4.2.0<p>I want use gem 'stuff-classifier' in my rails project. Firstly i tested this in new project with ra...
<p>This has nothing to do with your invocation of <code>StuffClassifier::Bayes.new</code>, and everything to do with your attempt to have ActiveRecord serialize it.</p> <p>All of the code involved is open source, and if you look at your stack trace, you'll see the line that causes the error is:</p> <blockquote> <p>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What Does FFmpeg Exit Code -1073741819 Mean?<p>I'm using FFmpeg 4.2.2 on Windows to mix two audio tracks, however the filter I am using is causing FFmpeg to ...
<p><code>1073741819</code> is <code>ffffffffc0000005</code> so it's an Access Violation Windows exception.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Set to foreground a third party dialog in a Windows Form Application<p>Good morning.</p> <p>I'm going nuts looking forward to a solution to a very corner-ca...
<p>I finally found a tricky/partial solution to my problem.<br> Unlike said before, (at least for Canon scanners) it seems that <em>drivers dialog message boxes are children of my main process windows</em>; with some <strong>User32.dll interop</strong> <em>black magic</em> and a timer I finally moved that damn little w...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Filtering results by user name<p>I have this code:</p> <pre><code>// GET: Teachers/Edit/5 public ActionResult Edit(Guid? id) { if (id == null) { ...
<p>You can use <code>SingleOrDefault</code>:</p> <pre><code>db.teachers.SingleOrDefault(x =&gt; x.ID == id &amp;&amp; x.UserName == username); </code></pre> <p>It returns a single, specific element of a sequence, or a default value if that element is not found. It will throw exception if there is more than one elemen...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Fluent nHibernate Query => QueryOver, Join, Distinct<p>I try to change that query to <code>QueryOver&lt;&gt;</code> to be able to do the <code>Distinct</code...
<p>As written by @fex, you can't simply do a <code>new List&lt;Receivers&gt;</code>. The problem is that you can't mix QueryOver with "LINQ" (the <code>t.Count(...)</code> part). The QueryOver "parser" tries to execute "locally" the <code>t.Count(...)</code> instead of executing it in SQL.</p> <p>As written by someone...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: FLASH banks and processor core instruction fetching stm32f7<p>I am learning my way through smth32f746ng microcontroller, and ran in to few questions regardin...
<p>You setup the vector table and the address at offset 0x004 in that table is the reset vector which determines where it fetches the first instruction. So its up to you which one.</p> <p>the ARM docs tell you how the vector table works. that address 0x00000004 in the arm address space is the reset vector. the ST d...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: GetAdditionalResourcesFromAssemblies failed unexpected<p>I just installed Xamarin 3.9.289 (newest version). When using both Visual Studio 2013 or Xamarin Stu...
<p>The problem was that my sample project was called "Xamarin" - looking at the disassembled code of the build dll shows that it is searching for that string internally and sadly starts from the left, not the right.</p> <p>The fix is easy: Rename the project.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Changing default OpenGL context profile version<p>To create an OpenGL context with profile version 3.2, I need to add the attributes to the pixel format when...
<p>Pixel formats associated with OpenGL contexts (the proper terminology here is <em>"default framebuffer"</em>) are always immutable. OpenGL itself does not control or dictate this, it is actually the window system API (e.g. WGL, GLX, EGL, NSOpenGL) that impose this restriction.</p> <p>The only way I see around this ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: In-App Purchases show red bullets on Localizations languages in App Store Connect<p><a href="https://i.stack.imgur.com/1T9E1.png" rel="nofollow noreferrer"><...
<p>I have no idea but this happens when I got a review rejection.</p> <p>Below step is to mitigate the issue. </p> <ol> <li>Just cut (for paste later) a description of an item.</li> <li>Click Save.</li> <li>Paste description to the item.</li> <li>Click Save again.</li> <li>Now the item turns to yellow.</li> <li>Go ou...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to extract the p.value and estimate from cor.test() in a data.frame?<p>In this example, I have temperatures values from 50 different sites, and I would l...
<p>First of all, I'm guessing you had a typo in your code (you should have <code>rnorm(5000</code> if you want unique values. Otherwise you're going to cycle through those 500 numbers 10 times.</p> <p>Anyway, a simple way of doing this would be:</p> <pre><code>data &lt;- matrix(rnorm(5000, 10:30, sd=5), nrow = 100, ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why won't my simple Connection Pool execute these simple put statements?<p>I posted a question regarding how to effectively manage threads here <a href="http...
<p>Your code is correct and the block is successfully pushed to the pool. However, before it gets executed, the program terminates and kills the pool. That's why you don't see any output - it did not have enough time to execute the job.</p> <p>You can either add <code>sleep</code> statement at the end or, for more ele...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is it dangerous to read global variables from separate threads at potentially the same time?<p>So I'm writing this neat little program to teach myself thread...
<p>§1.10 [intro.multithread] (quoting N4140):</p> <blockquote> <p>6 Two expression evaluations <em>conflict</em> if one of them modifies a memory location (1.7) and the other one accesses or modifies the same memory location.</p> <p>23 Two actions are <em>potentially concurrent</em> if</p> <ul> <li>t...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: View datasource returns entries even user has no access to due readers fields<p>I have encountered very strange behaviour I cant explain but I need to. On th...
<p>In the View Settings there's a property somewhere that basically says "don't show empty categories". That's possibly what's happening. The Readers fields are working but there are pieces of the secured documents inside the view index itself and that's available to more users because of categories. So in the clien...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Creating a Ninject Kernel in Global.asax where a binding has a dependency on HttpContext<p>I keep getting an error "System.Web.HttpException: Request is not ...
<p>Do your think, that access to the <code>HttpContext</code> from <code>Business</code> layer is good idea? Maybe you can spend some time on refactoring? For example, something like <a href="http://blog.8thlight.com/uncle-bob/2012/08/13/the-clean-architecture.html" rel="nofollow">this</a>. </p> <p>From application pe...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How save all the results of a php query to a .txt file?<p>My query gives me a result in an array :</p> <pre><code>$donnnes = Table ( [0] =&gt; Table ( [sku...
<p>Why are you using fputcsv on a .txt file? use fwrite instead. </p> <p>replace</p> <pre><code>fputcsv($fp, $data_final, "\n"); </code></pre> <p>with </p> <pre><code>foreach($data_final as $data){ fwrite($fp,$data."\n"); } </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I match xyzIj sets to pose data?<p>I am trying to work with the Google Project Tango tablet, I currently am sending data from my tablet to Epic's Unre...
<p>Lets start with a few basics</p> <p>1) Have you created, and subsequently loaded an ADF before capturing data ?</p> <p>2) Are you capturing poses relative to the ADF or the Session sart - the former is more accurate</p> <p>3) There shouldn't be too much drift in rotation - those sensors are reasonably accurate ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Partial View different model<p>I am trying to use a partial view that uses a different model than the one used in the main view. The partial view has to show...
<p>Just call the action that renders the partial view in Index.cshtml.</p> <pre><code>@Html.Action("_LatestProducts", "Product") </code></pre> <p>Second parameter is the name of the controller that has the _LatestProducts method. </p> <hr> <p><em>Just a reminder: Names with <code>_</code> prefix is for partial view...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: default dict counts for spaces in python<p>why does default dict count for the number of empty spaces in my list?</p> <p>I calculate the number of times a c...
<p>To answer the specific question:</p> <blockquote> <p>why does default dict count for the number of empty spaces in my list?</p> </blockquote> <p>Because <strong>the spaces are still characters</strong>. For example:</p> <pre><code>&gt;&gt;&gt; list('big data examiner') ['b', 'i', 'g', ' ', 'd', 'a', 't', 'a', '...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Convert char to date - Hive<p>I need concat 2 columns char in 1 column date. I tried it:</p> <pre><code>INSERT INTO tb_teste PARTITION (dt_originacao_fcdr) ...
<p>You can <code>concat</code> two fields then <code>unix_timestamp</code> and by using <code>from_unixtimestamp</code> function we can format the output timestamp.</p> <pre><code>with cte as (select stack(1,"20190303","131615") as (dt,hr)) --sample data select timestamp( --cast to timestamp from_unixtime(uni...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to remove blank space in UI xml in Android?<p>I have implemented the class and draw in canvas in xml. But I am facing blank space at the bottom of the UI...
<p>You can use the Hierarchy Viewer to investigate:</p> <p><a href="https://developer.android.com/studio/profile/hierarchy-viewer" rel="nofollow noreferrer">https://developer.android.com/studio/profile/hierarchy-viewer</a></p> <p><img src="https://developer.android.com/images/developing/hv_treeview_screenshot.png" al...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Reading image from private storage android<p>I have stored some image in the device private storage like:</p> <pre><code> InputStream inputStream = respo...
<p>What you need here is <a href="http://developer.android.com/reference/android/graphics/BitmapFactory.html#decodeStream(java.io.InputStream)" rel="nofollow"><code>BitmapFactory.decodeStream(String name)</code></a>.</p> <p>First, get an inputstream:</p> <pre><code>InputStream input = openFileInput("someImage.jpeg");...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Group list into equivalency classes<p>Suppose I have a list of things and a function that takes two args and says if they're equivalent, what's the most effi...
<p>I think your approach is fine. Using a dictionary to store representatives might be a bit cleaner:</p> <pre><code>def groupIntoEquivalencyClasses(aList, aEquals): classesByReps = {} for tElem in aList: tFound = False for rep in classesByReps.keys(): if aEquals(tElem, rep): tFound = True ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Extension Methods and Duck Typing<p>Why do I get an error when trying to call <code>transform</code> on an string?</p> <pre><code>type Truck = Truck type C...
<p>Unfortunately, extension members are not usable from member constraints. This could be implemented in the compiler, but I doubt it will be any time soon &mdash; as far as I can tell, member constraints are a low-priority feature for the F# team.</p> <p>Edit: for your own types: what happens is that when you define ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ASP.Net MVC 5 w/identity 2.2.0 Log off not working<p>I am using a the basic login on a test ASP.Net MVC 5 site (for an internet site). </p> <p>The login wor...
<p>I had this problem before, change:</p> <pre><code>AuthenticationManager.SignOut(); </code></pre> <p>To:</p> <pre><code>AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie); </code></pre> <p>Assuming that you are using <strong>ApplicationCookie</strong> to store your login information. </p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Typedef struct declared as two types: "typedef struct x { .. } X, *XPointer"<p>Sorry if this has been asked before, I wasn't really even sure what to search ...
<p>The <a href="https://www.kernel.org/doc/Documentation/CodingStyle" rel="noreferrer">Linux kernel coding style</a> says to avoid these kinds of typedefs:</p> <blockquote> <h3>Chapter 5: Typedefs</h3> <p>Please don't use things like &quot;vps_t&quot;.</p> <p>It's a <em>mistake</em> to use typedef for structures and po...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: I want to write the contents of row 0 as the column name. What should I do? (pandas columns problem)<p>In the df structure below</p> <p><a href="https://i.s...
<p>This might help</p> <p><code>header = df.iloc[0] new_df = pd.DataFrame(df.values[1:], columns=header) </code></p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: bootstrap-ui modal not showing the grey background behind it, (modal-backdrop class is not added on open)<p>for some reason my modal is opened without the gr...
<p>fixed,<br> i added <code>windowTemplateUrl</code> to the <code>$modal.open({..})</code> options object<br> which overrides the modal main window : <a href="https://github.com/angular-ui/bootstrap/blob/master/template/modal/window.html" rel="nofollow">https://github.com/angular-ui/bootstrap/blob/master/template/modal...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Map mouse click for one application<p>I'm trying the add the "play/pause on click" to the VLC media player using the AutoHotkey (v1.1.10).</p> <p>I have man...
<p>Try the tilde (<code>~</code>) <a href="http://ahkscript.org/docs/Hotkeys.htm#Symbols" rel="nofollow">prefix</a>:</p> <pre><code>SetTitleMatchMode, 2 #IfWinActive, VLC media player ~LButton:: MouseGetPos,XX,YY WinGetPos,,,WW,HH, A if ((XX &gt;= WW*0.20) and (XX &lt;= WW*0.80) and (YY &gt;= HH*0.20) and (YY &lt;= ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: JQUERY: Hide item with click and hover<p>I need to select the first item in the first list and hide the element. After hiding the first elements of the list ...
<p>I think this is what you want. You can only create the <code>hover</code> event after the click.</p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>$( "#first" ).click(function() { $( this ).delay(2000).slideUp...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to combine all children of two peers into one XML node?<p>I have three XML files concatenated into one, such that it looks like this:</p> <pre><code>&lt...
<p>I believe the simplest way would be:</p> <p><strong>XSLT 1.0</strong></p> <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:wd="urn:com.workday/bsvc"&gt; &lt;xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/&gt; &lt;xsl:strip-space elements="*"/&...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Apache Camel Bindy: Unexpected / unmapped characters found at the end of the fixed-length record at line : 2<p>Getting following exception in Camel:</p> <pr...
<p>This can be overcome by applying the following code on your POJO class. This is basically telling Bindy to ignore characters that comes after the last mapped fixed length data as per POJO. </p> <p><code>@FixedLengthRecord(ignoreTrailingChars = true)</code></p> <p>You can perhaps open your file in notepad++ after e...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Internet Explorer not showing divs in a row correctly<p>I unfortunately have to support later versions of IE (10 + 9) and have a current setup with divs that...
<p>Thanks for the responses everyone, what I ended up doing was setting a height to the card and it worked to solve the lone card showing up on a row on it's own. </p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to enable options using checkboxes and saving them through local storage?<p>I started learning jQuery and Javascript not so long ago, and I have encounte...
<p>Change all your:</p> <pre><code> $('#reasonDrop option[value=103^1]') </code></pre> <p>to </p> <pre><code>$("#reasonDrop option[value='103^1']") </code></pre> <p>You're missing the correct quotation marks.</p> <p>Working example: <a href="http://jsfiddle.net/krfud885/" rel="nofollow">jsfiddle</a></p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Method modifiers in Java<p>I am writing code to match a method declaration given a string, or line. This is where my question came up. When trying to match ...
<p>Both are same But as Generally we can write access modifier first then write Others modifiers.</p> <p>Access modifiers: </p> <ul> <li>public</li> <li>private </li> <li>protected</li> <li>default (Package access)</li> </ul> <p>Other modifiers for members of class : </p> <ul> <li>static</li> <li>final</li> <li>abs...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Function click on li element<p>I have a menu with li elements, after click on the one of the elements I like to run a function click and display alert with a...
<p><a href="https://jsfiddle.net/pgsf6fot/" rel="nofollow">https://jsfiddle.net/pgsf6fot/</a></p> <pre><code>$(document).ready(function() { $("#mainmenu li").click(function() { alert( $(this).attr('id') ); }); }); </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: TypeScript handling type array or single value<p>I have an interface like this. And I am wondering what is the best case to handle this case:</p> <pre><code...
<p>I have settled with:</p> <pre><code>interface Ia { a: string } let a: Ia | Ia[] if (Array.isArray(a)){ a = [a] } console.log(a[0].a) </code></pre> <p>Thank you @kaya3 and @maciej-sikora for suggestions</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: IO exception while copying 38GB of file from Local to HDFS<p>I am trying to load 38GB of file from local server to HDFS, I am getting below error while file ...
<p>Issue got resolved, its a disk issue,</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Splitting the values in column using regex<p>I have data.frame with two columns like the following</p> <pre><code>dat ID De...
<p>Here's an option with tidyr:</p> <pre><code>library(tidyr) # specify the new column names: vars &lt;- c("Description", "gn", "os") # then separate the "Details" column according to regex and drop extra columns: separate(dat, Details, into = vars, sep = "[A-Za-z]+=", extra = "drop") # ID Description gn ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: mysql how to select multiple values by email or unique value in column<p>I want to <strong>select firsname, mobileno, city,employee-name ect.. by email or by...
<p>Your question title says it all. Use <code>OR</code> instead of <code>AND</code>:</p> <pre><code>$sql = mysql_query("SELECT firstname,Mobileno,City,Employee-Name FROM `clients` WHERE email = '$email' OR code = '$code'") </code></pre> <p><code>OR</c...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Swift: Sending network request one after another<p>I want to send requests one after the other. Wait for the response from the first to send the second.</p> ...
<h1>A simple network layer utilizing Combine</h1> <p>This answer is heavily influenced by <a href="https://www.vadimbulavin.com/modern-networking-in-swift-5-with-urlsession-combine-framework-and-codable/" rel="nofollow noreferrer">this post</a>. I removed unnecessary code where possible and added code where needed to ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why would iron-router ignore waitOn?<p><code>onAfterAction</code> is run twice, once before the data arrives, and once after. Why is it run before the data a...
<p>You don't have a <code>loadingTemplate</code> defined. Iron Router can't use the loading template if you don't have one so the effect is the waiting effect of <code>waitOn</code> is ignored.</p> <p>Simply add the loadingTemplate and it should work.</p> <p>The <code>onAfterAction</code> is run once and after. The f...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Changing to newsequentialid() on an existing table with 4 million records<p>My Question is almost the same like <a href="https://stackoverflow.com/questions/...
<p>It will have less <em>fragmentation</em> so you could say its' more compact. But it will still be the same size per key (16 bytes + overhead) for a guid key. The benefit of using a sequential guid vs a nonsequential guid is that you have less chances for a page split. A page split is where a logical page has to have...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: jwplayer convert <object> to javascript<p>I am trying to convert the code below:</p> <pre><code>&lt;object data="http://www.primcast.com/jwplayer5/player.sw...
<p>This code:</p> <pre><code>file: "MarinaFM2", streamer: "rtmp://38.96.175.16:1935/live", </code></pre> <p>Needs to be:</p> <pre><code>file: "rtmp://38.96.175.16:1935/live/MarinaFM2", </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Android tab fragment not calling OnCreateView switching from tab2 to tab1<p>This is the autogenerated code from android studio when selecting a 3 tabbed layo...
<p><strong>Viewpager</strong> has one public method named <strong>setOffScreenPageLimit()</strong> which indicates the number of pages that will be retained to either side of the current page in the view hierarchy in an idle state.</p> <p>When you use the default implementation of setOffscreenPageLimit() it is only lo...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Change a buttons style-class on partial refresh<p>I have a series of buttons in a panel (id="panelButtons") which is nested inside another panel (id="panelVi...
<p>The reason it is not working is because the bootstrap theme is overriding your styleClass, You need to disable the theme on the buttons</p> <pre><code>&lt;xp:button value="Home" id="button1" disableTheme="true"&gt; </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Node.js - Certain headers are not being set<p>As i stated in the title, I tried setting headers in node.js, but some of them just would not stick/would get o...
<p>What you are experiencing is specific to Next.js framework.</p> <p>Regarding 'X-Powered-By', this is expected, as per the <a href="https://nextjs.org/docs/api-reference/next.config.js/disabling-x-powered-by" rel="nofollow noreferrer">Next.js docs</a></p> <blockquote> <p>By default Next.js will add x-powered-by t...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: for-loop interruption slows down OpenCL kernel<p>Learning OpenCL implementing program which finds 8 most similar pixels within 10 pixels radius for every pix...
<p>Try to maintain memory access order, just before global writing</p> <pre><code> // here barrier(CLK_GLOBAL_MEM_FENCE); //copy results from private memory to global: const long p = ( x * height + y ) * BEST; </code></pre> <p>if your performance problem is originating from memory access pattern, this should ease...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Generate a new variable based on values change in another variable r<p>I asked something very similar [enter link description here][1] but I have a better un...
<p>In order to solve this, I broke the problem down into two steps. First identify the Blank to answer lines. Then once the first tries are identified then assign the change of answers to the remaining lines.</p> <pre><code>#rows that are not the first answer are assigned a "NA" test&lt;-data %&gt;% group_by(id,it...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: dynamically created jQueryUI spinner not working<p><a href="http://jsfiddle.net/BsgCr/20/" rel="nofollow">Fiddle Example</a></p> <p>I have multiple spinners...
<p>The problem with your code is you are appending the already initiated spinner html block in your code and you are trying to re-initialize the Spinner for that block.</p> <p>So, Your <code>var area = $('.area').last()</code> will result,</p> <pre><code>&lt;div class="area"&gt; &lt;span class="ui-spinner ui-widget ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get the offset produced by zoom relative to the mouse<p>I'm trying to implement a 2D game which features zoom to the mouse. It's all organized like this:</p>...
<p><strong>SOLVED</strong></p> <p>I'll post the answer that worked to me in case anyone has the same problem.</p> <p>The quid of the question resides in the way the offset is stored (un-scaled).</p> <p>It was a little strange because the zoom was done in a different part of the code, so what we would usually do with ma...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: C: I made a program to sort an array in ascending order and cannot figure the reason for a certain step in the for loops<p>I am making a program to sort numb...
<p>In the first iteration of the <code>i</code> loop, the greatest element is bubbled to the end of the <code>n</code> elements in the array. After that, we know the last element is done. So we only need to do the <code>n-1</code> remaining elements.</p> <p>In the second iteration of the <code>i</code> loop, the next ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Call controller function from outside<p>I need to access (call and/or modify) the scope of a controller from outside of it.<br> Following <a href="https://st...
<p>you forgot to add</p> <pre><code>scope.$apply() </code></pre> <p><a href="http://jsfiddle.net/o2b0bdbr/" rel="nofollow">http://jsfiddle.net/o2b0bdbr/</a> you are outside of angulars digest cycle so you need to let him know that something happen to on of his scopes</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Regex to allow only whitespace, letters and certain characters<p>I need to allow only whitespace, letters, numbers and <code>. , ! ? ( ) $ % *</code> </p> <...
<p>Your syntax is incorrect, the end of string <code>$</code> anchor should be placed inside of the delimiters. You also need to precede your character class with a <a href="http://www.rexegg.com/regex-quantifiers.html#basics" rel="nofollow"><strong>quantifier</strong></a> and anchor the entire pattern.</p> <p>The fol...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to use opencv::split(). Get crash<p>How to use split() correctly? Why I get crash after doing splitting image to std::vector of channels?</p> <pre><code...
<p>std::vector Ichannels(3); fixes crash</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do would I register this in Castle Windsor?<pre><code>public interface IDo { ... details } public class DoOneThing : IDo { ... } public class Do...
<p>You can use the typed <code>Dependency.OnComponent</code> as mentioned in <a href="https://stackoverflow.com/a/18028790/580951">Castle Windsor - multiple implementation of an interface</a>.</p> <p>See also: <a href="http://docs.castleproject.org/Windsor.Inline-Dependencies.ashx" rel="nofollow noreferrer">Castle Pro...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to use this IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication(); in WP 8.1<pre><code>IsolatedStorageFile isoStore = IsolatedS...
<p>You can get the local storage folder with ApplicationData.LocalFolder or the roaming folder with ApplicationData.RoamingFolder.</p> <pre><code>Windows.Storage.StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder; Windows.Storage.StorageFolder roamingFolder = Windows.Storage.ApplicationDat...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Nessus port scanning crashes AWS instance<p>I am trying to do a port scan on AWS instance using Nessus software . Once I start scanning the instance getting ...
<p>Under no circumstances should you either use an AWS instance to run port scans, or port scan an AWS instance without obtaining permission first. Submit a support ticket. It is very likely that Amazon are simply shutting down your unauthorised activity with their security mechanisms. This is a really bad idea. </p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: R data.table apply function with multiple column input over all rows and get reasonable output<p>I'm trying to apply a function to all rows of a data.table w...
<p>If you want to create 4 columns for your data.table, something like the following will work</p> <pre><code>test_func = function(day){ delta = day - d0 if(delta == 0 ){ rcomb = list(0, 100, 1,0) } else if(delta != 100 ){ rcomb &lt;- list(c(0,delta), c(100,delta), c(0,1), c(0,0)) } r...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pivot_table in pandas with a rowid sequence<p>I have data like this:</p> <pre><code>ID Cue trial time accuracy A apple copy...
<p>Copy column <code>Cue</code> to new <code>Cue1</code> for second position by <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.insert.html" rel="nofollow noreferrer"><code>DataFrame.insert</code></a>, unpivot by <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pand...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: wait till anchor tag onclick function response is true<p>I searched a lot for this but no solution yet. Here is my code.</p> <pre><code>&lt;a href="#second"...
<p>Why dont you try like this. Take one dummy a-tag for 'Second'. If on click of <code>dummy-second</code> the <code>function slide()</code> returns true, than by using jquery's <code>trigger</code> event you can fire a click event to activate Slider</p> <p>You can hide and show <code>slidersecond</code> &amp; <code>d...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Uncaught Error: Can't resolve all parameters for SignupComponent: ([object Object], ?). at syntaxError (compiler.js:2175)<p>Please help me to solve this prob...
<p>Hello Rushikesh Gadekar, Your Problem is that Angular doesn't provide your backend-service for the constructor of your signup-component. To solve this Problem you have to go to: <strong>app.module.ts</strong> </p> <p>And insert your Service to your providors.</p> <p>Here's an Example how this could look like. </p>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Regex named groups in golang<p>I need help with integrating a regex with golang. I want to parse logfiles and created a regex which looks quite fine on <a hr...
<p><strong>Single match solution</strong></p> <p>Since you defined capturing groups and need to extract their values, you need to use <code>.FindStringSubmatch</code>, see <a href="https://play.golang.org/p/Qoej-mZ0UzX" rel="nofollow noreferrer">this Go lang demo</a>:</p> <pre class="lang-golang prettyprint-override"><...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to copy Tomcat logs to Jenkins & display them after each deployment<p>I'm using Jenkins for building &amp; deploying a Java app to Tomcat. I use the <a h...
<p>On *nix, you can use <strong>Execute Shell</strong> build step to <code>scp</code> files from remote machine back Jenkins's <code>workspace</code> </p> <p><code>scp login@remote.server:/path/to/catalina.log ${WORKSPACE}/catalina.log</code></p> <p>Once they are in Jenkins workspace, you can just <code>cat</code> t...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Adding data to json object dynamically using angularjs<p><strong>This is MY program for dynamically adding name contact to json data</strong> The program is ...
<p>To handle my <em>localstorage</em> I created a neat little service API. It can write, delete, clear and use timestamps to expire objects. </p> <p>Maybe this will help you:</p> <pre><code>'use strict'; /** * storage wrapper for session- or local-storage operations */ app.factory('StorageService', function( ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Basic Loop Help - Powershell<p>Complete Powershell Noobie here. </p> <p>I have a <code>.bat</code> file that I would like to convert to Powershell. </p> <p...
<p>You can run this in the while loop to keep asking for credentials until they are valid.</p> <ul> <li>Take credentials</li> <li>Run powershell with new creds</li> <li>If fails, ask for new credentials. Break out of the loop if no.</li> </ul> <pre><code>while ($true) { $userCreds = Get-Credential "$env:USERDNSDOM...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Rails how to seed a table in seeds.rb with data from another table<p>I have 2 tables in my app with a one-to-one relationship. Here is the schema for the two...
<p>You could store your 80 users in an array and as you create new customers, simply use one of those. When you loop through to create your customers, I just have a variable <code>i</code> that's an integer that will reference a user from the array. </p> <pre><code>users = [] 80.times do username = "#{Faker:...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: converting json bool values to C# bool values<p>I ma trying to convert json boolean value string to C# equivalent. This is my code:</p> <pre><code> string ...
<p>The json value in your JSON string is literally the string <code>true</code>. For it to be parsed as a bool, you should declare it as a bool by removing the quotes:</p> <pre><code>string jsonResponseString = "{boolvalue: true}"; </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Excel 2010 E-mail VBA send entire workbook<p>I have been looking for a VBA that can send the entire workbook.</p> <p>I found this </p> <pre><code> Sub M...
<p><em>I'm assuming you don't want to save it so work with [ <a href="https://docs.microsoft.com/en-us/office/vba/api/excel.dialogs" rel="nofollow noreferrer">Application.Dialogs MSDN </a> ]</em></p> <p><em>Example 1</em></p> <pre><code>Option Explicit Public Sub example() Application.Dialogs(xlDialogSendMail).Sh...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: R - Counting total occurrences of word from list that appears in data frame, and grouped<p>I have a data frame like this:</p> <pre><code>ID Word 1 Tree...
<p>We can create a logical index and get the <code>sum</code> grouped by 'ID'. Not sure whether the 'v1' is <code>vector</code> or <code>list</code> (if it is <code>list</code>, then <code>unlist(v1)</code> and use it with the same code)</p> <pre><code>library(dplyr) df1 %&gt;% group_by(ID) %&gt;% summarise(C...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: i want spring-boot-starter-webflux is post connection get requestBody<p>Think I'll do it craze :(</p> <p>because <code>ServerRequest</code>, Spent a day.</p...
<p>What you are printing is Monos and not the content inside Monos. Try printing content instead of Monos. For testing you can do something like this as well.</p> <pre><code>return serverRequest .bodyToMono(Name.class) .map(name-&gt; { System.out.println(name); return name; ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: When to use async in generic libraries?<p>I was recently looking for nice example of generic repository pattern and was confused by a totally different topic...
<blockquote> <p>I was recently looking for nice example of generic repository pattern</p> </blockquote> <p>The generic repository pattern is generally considered an antipattern, precisely because it's too generic. Personally, I prefer a ports-and-adapters style of data layer abstraction, which lets the app define th...