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: Render html conditionally based on route in Razor Pages<p>Let's say I have the following Razor file <code>_Layout.cshtml</code>. How do I write the commented...
<p>In Razor Pages you can use <code>ViewContext.RouteData.Values["page"]</code>, also in the _Layout file. If the URL is e.g. <code>https://localhost:44359/Help/About</code> then it will produce <code>/Help/About</code>.</p> <p>Using your code:</p> <pre><code>@{ string page = ViewContext.RouteData.Values["page"] ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: A simple regex expression to omit leading zeros<p>I would think this should be really simple..</p> <p>I want to do this:</p> <pre><code>date_num = '09'.gsu...
<pre><code>\A0+(?=\d) </code></pre> <p>I haven't used ruby but if Regex is still Regex then that right there should match just leading 0's. The ^ tells it to look at the front of the string and then looks for a group of 0's to be the first elements. It will match 00000032423 but not 23000000</p> <p>EDIT: Added John a...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to solve this in less than O(N)?<p>I have an array of sorted (ascending order) elements as input. I want to find out whether these elements make a series...
<p>Clearly you need an O(N) traversal in order to yield <code>true</code>.</p> <p>The optimisation you can make is to yield a <code>false</code> as soon as possible.</p> <p>I conject (and think the proof would be hard but is true if the numbers are arithmetically distributed) that adjacent larger number pairs (<em>a<...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: select options as progress bar and price range<p>I'm interesting how I can transform select options to progress bar year range. Example of what I want to rea...
<h1>UPDATE 2</h1> <p><a href="http://ghusse.github.io/jQRangeSlider/" rel="nofollow noreferrer">jQRangeSlider</a> looks pretty cool! It seems way more powerful and customizable!</p> <h1>UPDATE 1</h1> <p>I've updated my fiddle to support values from a <code>&lt;select&gt;</code> element. It's not perfect, just a proo...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: In Mysql how do I count # of blank cells in a row<p>I am wondering how to count the number of times there is an empty cell in a row.</p> <p>for example </p...
<p>I used <code>CASE</code> Statement to get the empty values, then I get the sum of the <code>col</code> to <code>col9</code>. See Below:</p> <pre><code>SELECT unique, (CASE col='' THEN 1 else 0 END + CASE col1='' THEN 1 else 0 END + CASE col2='' THEN 1 else 0 END + CA...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Setting up email for site hosted by IIS<p>I have just registered a domain, wirederp.dk, which runs on a IIS 7 (Windows 2008 R2).</p> <p>In order to purchase...
<p>Most domain registrars let you use an email forwarding service. If you setup a forwarding of info@wirederp.dk to your real email address you can get the domain ownership email from the ssl provider.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Shared Folder is missing in the Office My Addin ribbon suddenly in Angular Office Addin Project<p>I am currently working with an office word addin using Angu...
<p>After scratching my head for a few minutes, I was able to fix this. The issue was related to a recent change in the <code>manifest.xml</code> file. In the <code>manifest.xml</code> file, under the <code>Resources</code> section, we have <code>&lt;bt:Urls&gt;</code>, that is where we provide the <code>Urls</code>. Be...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to serve PNG to HtmlImageLoadEventArgs callback as byte[]?<p>I am using <a href="https://htmlrenderer.codeplex.com/" rel="nofollow">HTML Renderer</a> to ...
<p>Ok, I found it out. The image type must be of type <code>PdfSharp.Drawing.XImage</code>. The easiest way is to load the PNG fila as a <code>System.Drawing.Image</code>.</p> <pre><code>using (var mem = new MemoryStream(img.Data)) { System.Drawing.Image sysImg = System.Drawing.Image.FromStream(mem, false, true); ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: androidx.navigation:navigation-fragment:2.2.0, get "You must call removeView() on the child's parent first." on navController.popBackStack()<p>I like use dat...
<p>The solution is just to add this code to every fragment:</p> <pre><code>@Override public void onDestroyView() { super.onDestroyView(); if(binding.getRoot().getParent() != null) ((ViewGroup)binding.getRoot().getParent()).removeView(binding.getRoot()); } </code></pre> <p>I really recommend you to cre...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Create a circle avatar image in .net<p>I want to create a default avatar image which is a circle with initials in it. I want to do this on the server side as...
<p>I ended up doing this. Thanks for pointing me in the right direction TaW </p> <pre><code>public ActionResult Avatar() { using (var bitmap = new Bitmap(50, 50)) { using (Graphics g = Graphics.FromImage(bitmap)) { g.Clear(Color.Whi...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: OracleCommand ExecuteNonQuery with Async<pre><code>Public Function ExecuteNonQuery(ByVal cmd As OracleCommand) As Integer ' no of affected rows ... D...
<p>Simple enough to refactor to using <code>Async</code> and <code>Await</code> since <code>DbConnection</code> and <code>DbCommand</code> should have the asynchronous API available.</p> <pre><code>Public Async Function ExecuteNonQueryAsync(ByVal cmd As DbCommand) As Task(Of Integer) ' no of affected rows ... ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Change Cell Reference Within a Repetition<p>I need to transpose data on a single row into a table. What I'm doing is taking a base inventory item and creatin...
<p>try:</p> <pre><code>=INDEX(TRANSPOSE(IF(F4:J4&lt;&gt;""; C4&amp;"-"&amp;F4:J4; ))) </code></pre> <p><a href="https://i.stack.imgur.com/qRNrI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qRNrI.png" alt="0"></a></p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: validate only one field with certain button<p>I have the following rendered form:</p> <pre><code> &lt;div class="form-row clearfix"&gt; &...
<p>Apply/attach rules on the fly when click event occurs.</p> <pre><code>$('#find-addresses').on('click', function(){ $('[name="Postcode"]').rules('add', { required: true, email: true }); $('#Other_Form_Fields').rules('remove'); $('#request-brochure-form').valid(); // trigger ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to reverse numbers in a list<p>I have a code that first takes an integer from a scanner and then breaks it down into digits and then stores them in a lis...
<p>You can reverse a list in-place using <a href="http://docs.oracle.com/javase/8/docs/api/java/util/Collections.html#reverse%28java.util.List%29" rel="nofollow" title="reverse"><code>Collections.reverse(list)</code></a>.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: EXTJS 5.1 WIDGET IN GRID COLUMN HEADER<p>Is it possible to insert custom widget (for example button or checkbox) in gridpanel column header?</p> <p>From doc...
<p>The short answer is 'yes'.</p> <p>You can extend the grid column, then make an afterrender listener.</p> <p>In the listener, get the column's innerEl = (component.getEl().down('column-header-inner').</p> <p>Then, make a new component like button/checkbox, columnComponent.headerButton = new Ext.button.Button()</p>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Add/Remove classes from navigation loaded with Jquery<p>I am loading in the content of my sidebar navigation with jquery from a nav-content.html file so I do...
<p>Two things to get you on the right path.</p> <p>1) jQuery's <code>get()</code> does not load an HTML file. You might mean to use <code>load()</code> to get your sidebar content: <a href="https://api.jquery.com/load/" rel="nofollow noreferrer">https://api.jquery.com/load/</a></p> <p>2) <code>$(document).ready</code...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: allow_url_fopen is on, but doesn't work<p>I've a problem with a fetch in my server.</p> <p>I'm trying to get all content from a url, and save it in a variab...
<p>You are just looking for a certain name in the url? <br>This will work better. </p> <pre><code>if(stripos('http://www.filmaffinity.com',$url)){} </code></pre> <p>you may want to try:<br></p> <pre><code>file_get_contents($url) </code></pre> <p>You may want to try encoding the url:<br></p> <pre><code>$url = urlen...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Load a bmp file into a TSpeedButton<p>Using Embarcadero C++Builder, does anyone know how to manually load a <code>.bmp</code> file into a <code>TSpeedButton<...
<p>The <a href="http://docwiki.embarcadero.com/Libraries/en/Vcl.Buttons.TSpeedButton.Glyph" rel="nofollow noreferrer"><code>Glyph</code></a> property is a <a href="http://docwiki.embarcadero.com/Libraries/en/Vcl.Graphics.TBitmap" rel="nofollow noreferrer"><code>TBitmap</code></a>, so you can use the <a href="http://doc...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to write data that has been read and parsed into another file?<p>I want to write a python script that reads a file like this:</p> <pre><code>test.com|te...
<p>I hope that below code been useful :</p> <pre><code>with open('domains') as fp: for line in list(fp): line1 = line.rstrip("\n").split("|") baseDomain = line1[0] print(baseDomain) for lbl in line1: domain = lbl.split(',') try: print(domain[1]+'.'+baseDomain) except IndexEr...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is it possible to select an Action with AttributeRouting in .NET MVC based on the Media Type of the Accept header?<p>I want to select an Action of my Control...
<p>After searching around the Internet for awhile, I came up with the idea that this would be best accomplished by creating an <code>ActionMethodSelectorAttribute</code>.</p> <p>The following is a very naive, first-pass implementation of a <code>ProducesAttribute</code> that I wrote with the eventual intent of mimicki...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Installing laravel using Zend Server 8.0.1 PHP 5.6.4 CLI stopped working<p>I have Installed <strong><em>Zend Server 8.0.1</em></strong> with <strong><em>PHP ...
<p>It is a bug with Zend Server 8.x, PHP 5.6 and composer running on Windows that Zend is aware of (see <a href="http://forums.zend.com/viewtopic.php?f=8&amp;p=245953" rel="nofollow">http://forums.zend.com/viewtopic.php?f=8&amp;p=245953</a>).</p> <p>Using older version of composer.phar works for me. Get the composer.p...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Multiple Models from Single Controller<p>I'm new to laravel and a bit rusty in general so bear with me. I'm wondering what the best way to do this is.</p> <p...
<p>Controller are just files to have a better clean code, but they're not really assigned to a Model, you can have UserController but throw whatever you want in there and get whatever model you want from there:</p> <pre class="lang-php prettyprint-override"><code>class UserController { public function getPhotos(Re...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to understand part and partition of ClickHouse?<p>I see that clickhouse created multiple directories for each partition key. </p> <p><a href="https://cl...
<p>Parts -- pieces of a table which stores rows. One part = one folder with columns.</p> <p>Partitions are virtual entities. They don't have physical representation. But you can say that these parts belong to the same partition. </p> <hr> <p>Select does not care about partitions. </p> <p>Select is not aware about p...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I get the correct output for the try/catch statement?<p>I want to add a new item in the list by inputting the number for the position of the list. Whe...
<p>You read <em>pos</em> as ;</p> <pre><code>pos = input.getInputType(); </code></pre> <p>This might cause <em>IndexOutOfBoundsException</em> at all times. Instead you might want to convert EditText content into int somewhere around this line of code ;</p> <pre><code>pos = Integer.parseInt(input.getText().toString()...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Filling the second combo box based on the first combo box<p>I want to fill the second combo box based on the first combo box.<br> The first combo box have th...
<p>Your code as it stands isn't working because you are searching <code>Column B</code>, the column with the numeric values, for a match to the names. To fix, use the <code>OFFSET</code> function to check the cell to the left. For example:</p> <pre><code>Private Sub ComboBox1_change() Set rngItems = Sheet1.Range("B1:...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Manifest and setup issues getting Robolectric working with Android Studio 1.1.0<p>I am trying to get Robolectric tests up and working in our current project,...
<p>I wrote a step by step guide how to enable robolectric with android studio 1.1.0 <a href="http://nenick-android.blogspot.de/2015/02/android-studio-110-beta-4-and.html">http://nenick-android.blogspot.de/2015/02/android-studio-110-beta-4-and.html</a> I guess you will find an answer for your issue. And an example <a hr...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python lmfit: Model object trys to use "self" as free variable<p>I am using the Python module "lmfit" to fit a function to some data. The variables should ha...
<p>Since <code>fit_func</code> is not using self, make it a static method:</p> <pre><code>@staticmethod def fit_func(x, a, b): return a * x + b </code></pre> <p>This way you don't have to worry about <code>self</code>.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to migrate from old PHP database handler library to PDO without any code breaking?<p>I used the <code>AdoDb</code> database handler library for my projec...
<p>So, your question is about extending or wrapping. It is generally good practice not to extend classes you don't own. For instance, any change in the PDO class could, unpredictable, break your extended class. You do not control the changes. So since you don't own the PDO class I would suggest wrapping it.</p> <p>Mak...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I pick a random word in from a list in a loop?<p>Hello I am a learning python and my question is I have some words in a list I want to randomly sele...
<p><code>random.choice(x)</code> will choose from <code>x</code>, and <code>x</code> is an individual word from <code>randomwords</code>.</p> <p>If you want to choose from <code>randomwords</code>, do it:</p> <pre><code>for x in randomwords: time.sleep(1) print(random.choice(randomwords)) </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: expose container port in user define bridge network<p>I am creating a nginx container from dockerfile as shown below.</p> <p>I have performed following sequ...
<p>All steps looks good except <code>docker run</code> </p> <p>you are providing <code>/bin/bash</code> as entrypoint which overwrites existing <code>CMD</code> for nginx. </p> <p>Kindly start without <code>/bin/bash</code> should be working <strong>or</strong> provide valid entrypoint which start nginx service insi...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Making label tag center<p>I'm trying to align my label tag's to center under the text but it won't budge. What should I change? I honestly have no idea why t...
<p>I'm assuming you want the form (labels &amp; input) centered, in which case you could add margin to your form:</p> <pre><code>form { margin: auto; } </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Matlab-Using a function to command a function generator<p>I have this function to send a command via GPIB connection to a Function generator (Stanford Resear...
<p>I guess there is no need for the <code>'VP'</code> at the end of the offset definition. An offset is just a voltage, specifying Vpp or Vrms doesn't really make sense.</p> <p>Try:</p> <pre><code>Offs_str = ['OFFS' num2str(Offs)]; </code></pre> <p>For the amplitude, in the manual it seems that there is a space betw...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Changing the acceptance key (autosuggest-accept) - ZSH shell on mac<p>on > <code>zsh</code> <code>mac</code> <code>terminal</code><br> if i type <code>c</cod...
<p>You can change bindkey for <em>autosuggest-accept</em> widget.</p> <pre><code>bindkey '`' autosuggest-accept </code></pre> <p>Note that this will disable your ability to type ` character directly though. If you want to execute the autosuggest immediately after hitting `, change <code>autosuggest-accept</code> to <...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Need assistance restructuring an N-Tier MVC/WEB.API app<p>Currently have the following N-Tiers:</p> <pre><code>MVC/API UI &lt;-&gt; BLL / DAL / NLL / Model ...
<p>Doing wrong at the following line:</p> <pre><code>private readonly DbContext _oDBContext = _oDataBaseContext.dbContext(); </code></pre> <p>(1) instead it should be like following:</p> <pre><code>public class SiteAdminAPIController : Controller { private readonly DataBaseContext _oDataBaseContext = new DataBas...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I get an instance of a class that extends a JPanel to display in another classes JPanel?<p>incomePanel displays inside of IncomeAndSpendingPanel, but ...
<p>Lots to say here...firstly you probably need to be using a JFrame so please read about top level containers <a href="https://docs.oracle.com/javase/tutorial/uiswing/components/toplevel.html" rel="nofollow noreferrer">here</a>. </p> <p>Also since you are using inheritance you definitely need to move all those base c...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Formatting x-axis labels as time values in Chart.js<p><a href="https://i.stack.imgur.com/0WX0L.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur...
<p>All you need is to define your <code>xAxis</code> as a <a href="https://www.chartjs.org/docs/latest/axes/cartesian/time.html" rel="nofollow noreferrer">time cartesian axis</a> with a 'day' unit.</p> <p>The default <a href="https://www.chartjs.org/docs/latest/axes/cartesian/time.html#display-formats" rel="nofollow n...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to search for query results which also match a filter in Hibernate search<p>I am using Hibernate Search 6, with an elastic search backend.<br> I am using...
<p>Maybe something like this?</p> <pre class="lang-java prettyprint-override"><code>Search.session(entityManager).search(Book.class) .predicate(f -&gt; f.bool(b -&gt; { b.must(f.match().field("inStock").matching(true)); if (query != null &amp;&amp; !query.trim().isEmpty()) { ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Singleton implementation in C++ not yielding the same class instance when calling the getInstance function<pre><code>class Game { public: static...
<blockquote> <p>... which creates a 'new Game' and the game starts as normal</p> </blockquote> <p>So you are starting the Game from inside the <code>Game</code> constructor.<br> I assume you have some kind of loop inside, meaning your constructor <strong>will never actually return</strong>.</p> <p>So the assignment...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Using SQL to filter specific value and then remove duplicate row<p>Let say I have a table called ‘ABC’ in access database with the following settings :</p> ...
<p>Assuming one or more of your columns is a primary key, you can use:</p> <pre><code>delete from t where t.Mid = "" and t.des &gt; (select min(t2.des) from t as t2 where t2.Mid = t.Mid and t2.Order = t.Order ); </code></pre> <p>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to compare column of two table and insert a value into new table based on comparison in stored procedure in SQL Server<p>I want to create a procedure whi...
<p>Sounds like you want something like this?</p> <pre><code>TRUNCATE table3; INSERT INTO table3 (ID, ItemCheck) SELECT ID, CASE WHEN EXISTS (SELECT 1 FROM table2 t2 WHERE ID = t.ID) THEN 'T' ELSE 'F' END FROM table1 t </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: RE to extract middle of line with or without a particuar word on the end<p>I'm trying to extract a string in the middle of a line with or without a particula...
<p>You may use a lazy quantifier (<code>.+?</code>) as in</p> <pre><code>[^-]*- (.+?)(?:THIS|$) </code></pre> <p>See <a href="https://regex101.com/r/jQqFPO/1/" rel="nofollow noreferrer"><strong>a demo on regex101.com</strong></a>.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Recursive macro Elixir<p>I am playing around with Elixir macros - specifically macros that call themselves which is something that I do often in Scheme. I ha...
<p><strong>TL;DR:</strong> this is impossible.</p> <hr> <p>Macros in <a href="/questions/tagged/elixir" class="post-tag" title="show questions tagged &#39;elixir&#39;" rel="tag">elixir</a> are not what you expect them to be. When a compiler sees a macro, it calls it <strong>during a compilation time</strong> <em>and<...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a way to get the functionality of ML Kit in the web browser?<p>I'm developing a cross-platform app (iOS/Android/web) and am loving the fast, cheap o...
<p>Unfortunately, it does not seem like ML Kit allows you to export models created using it, only import models. However, tensorflow.js lets you run TensorFlow models on the web. If you are looking for an easy way to create models there are several web-based programs which allow you to easily create ML models and expor...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Create a rounded shape<p>I want to create a shape like the image below through xml. Searched a lot to make the corners smooth but not able to make it circula...
<p>try like this: create a android xml in drawable folder like this:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" &gt; &lt;corners android:bottomLeftRadius="10dp" android:bottomRightRa...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Undefined method error for scope on STI subclass<h2>The Setup</h2> <p>I have an STI setup like so:</p> <pre><code>class Transaction &lt; ActiveRecord::Base...
<p>I created an isolated test for your issue here:<a href="https://gist.github.com/aalvarado/4ce836699d0ffb8b3782#file-sti_scope-rb" rel="nofollow">https://gist.github.com/aalvarado/4ce836699d0ffb8b3782#file-sti_scope-rb</a> and it has the error you mentioned.</p> <p>I came across this post from pivotal <a href="http:...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Having trouble changing color by pressing left or right button<p>I'm having trouble changing change the color when you from left to right button. Holding dow...
<p>For each point you add to <code>g_points</code> you need to remember what color the point was created as. So you can create another array to keep track of the point colors.</p> <pre><code>var g_points = []; // The array for the position of a mouse mousePressed var g_colors = []; </code></pre> <p>And add the color...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to compare a specific column in two csv files and output differences to a third file<p>I have two csv files named <code>test1.csv</code> and <code>test2....
<p>See below.</p> <p>The idea is to read the names into s python <a href="https://docs.python.org/3/tutorial/datastructures.html#sets" rel="nofollow noreferrer">set</a> data structure and find the new names by doing set substruction. </p> <p>1.csv: </p> <pre><code>Name Number A 12 B 34 C 45 </code></pre> <p>2.csv...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to share an Image and Text on whatsapp to a specific number?<p>I already know how to send it on whatsapp but not to a number, the way I'm doing I got a l...
<p>You can send a message to the particular user by using the following code,</p> <pre><code>Intent sendIntent = new Intent("android.intent.action.MAIN"); sendIntent.putExtra(Intent.EXTRA_STREAM, FileProvider.getUriForFile(context1, BuildConfig.APPLICATION_ID + ".provider", new File("ImageUrl"))); sen...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Which is the right MOC parameter for RestKit's managedObjectRequestOperationWithRequest: service<p>I used RestKit integrated with CoreData in my project. To ...
<p>Your question isn't really about RestKit or this method as such, it's about Core Data thread confinement. You have a responsibility to only use a managed object context from the designated thread, and if you ask an API to do something on a context it is again your responsibility to pass the correct one for the threa...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Todo.App is used in Todo.UWP.MainPage but who invokes Todo.UWP.App?<p>I created a brand new Xamarin.Forms solution consisting of 2 projects:</p> <ul> <li>NE...
<blockquote> <p>I am wondering what the purpose of Todo.UWP.App is because I have not noticed any part of the source code that instantiates it.</p> </blockquote> <p>It's designed by Xamarin Forms Application ,it not directly load <code>MainPage</code>in <code>Todo.UWP</code>.Because Xamarin forms is a cross-platform...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Select count(*) taking long time on MySql table<p>we have table in MySql DB with size approximately 35 giga bytes</p> <p>I ran a simple query</p> <pre><cod...
<p>It's probably an InnoDB table. Since InnoDB supports transactions, the table is never in a static state, parts of it can always be changing. The count() has to walk through and count every record, which is why it takes so long. Even then, it's more of an estimate, depending on the activity on the table.</p> <p>A qu...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Find dataframe rows with all of list of strings in any of list of columns<p>I have a list of three terms that might appear in any of three columns. I'd like ...
<p>Use <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.isin.html" rel="nofollow noreferrer"><code>DataFrame.isin</code></a> in filtered columns by filtered values and for test all <code>True</code> per rows add <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Ruby invoking attr method with array of attributes<p>Please explain me why i should define <code>attr_list</code> before <code>attr</code>? I can not underst...
<p>Unlike a def, a class is executed line by line immediately after you hit return to run your program:</p> <pre><code>class Dog x = 10 puts x end --output:-- 10 </code></pre> <p>...</p> <pre><code>class Dog puts x x=10 end --output:-- 1.rb:2:in `&lt;class:Dog&gt;': undefined local variable or method `x' ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What are the 'subtle changes' in Google Spreadsheets API?<p>Google is <a href="https://support.google.com/docs/answer/6082736" rel="nofollow">upgrading old s...
<p>Well one thing that changed is it no longer suports the old way of authenticating. You now have to use OAuth. I think this is where my problem was.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Objective C: Own controls for a blog<p>i want to make an app for a little blog. (Looks little bit like the facebook timeline)</p> <p>There is already a webs...
<pre><code>NSString * nibName = @"MyCustomView"; [[[NSBundle mainBundle] loadNibNamed:nibName owner:self options:nil] firstObject]; </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: push in the Angular not able to produce expected result<p>I am new to angular learning the push. </p> <p>I am using a textbox to add data to the table. and ...
<p><a href="https://stackblitz.com/edit/angular-vqdyvb?file=src%2Fapp%2Fapp.component.ts" rel="nofollow noreferrer">Try this demo</a>:</p> <pre><code>export class AppComponent { users = [ {name: 'shan'} ] addToTable(data){ this.users.push( {name: data.value} ) data.value = '' } } </cod...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Django how to make model for user model<p>I'm developing to-list app with registration . I have two models : Model for <strong>User</strong> and Model for <s...
<p>Maybe you should add relation to CustomUser in Task model and filter tasks by owner in view before to render data to template?</p> <pre class="lang-py prettyprint-override"><code> class Task(models.Model): title=models.IntegerField() date = models.DateTimeField(default=datetime.now,blank=True) is_publis...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Better way to position elements in a grid<p>I try to have a header on my application, where the left item (A) is aligned to the left side of the header, the ...
<p>Assuming you are using <code>material-ui</code> Grid component. You can do something like this</p> <pre><code>&lt;Grid container direction="row" justify="space-between" alignItems="center"&gt; &lt;div&gt;A&lt;/div&gt; &lt;div&gt;B&lt;/div&gt; &lt;div&gt;C&lt;/div&gt; &lt;/Grid&gt; </code></pre> <...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Group the word count of a data frame according to the diferent labels stored in a column<p>I would like to know which are the most representative words for t...
<p>You can do:</p> <pre class="lang-py prettyprint-override"><code>from collections import Counter df["Q"]=df["Q1"].str.cat(df["Q2"], sep=" ").str.cat(df["Q3"], sep=" ").str.lower() df["Q"]=df["Q"].str.split("[^\w]").apply(Counter) </code></pre> <p>This will basically do the following:</p> <p>(1) concat all the <c...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Unable to catch/throw error when executing a list of promises in a Sequelize transaction?<p>In the below code I am trying to <code>upsert</code> to user reco...
<p>you are not returning your promises correctly. try this;</p> <pre><code>async function submitUsers(users) { return db.sequelize.transaction((tx) =&gt; { const queries = users.map((user, index) =&gt; { if (index == 1) { user.user_id = null; } return User.upsert(user, tx); ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Volley sends null parameters to server when using post method<p>I used volley for connect to Wordpress site. It worked correctly .But Volley send null parame...
<p>I solved it by replacing ' with " in PHP code. :D</p> <pre><code>$tellenc = $_POST["username"]; $passenc = $_POST["pass"]; $serialdiviceenc= $_POST["serial"]; </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to pass delegates and "normal type" arguments in a function<p>I will explain my problem directly with code. Initially, I had the code below:</p> <pre><c...
<p>Simple; pass <code>x</code> as the first argument:</p> <pre><code>static void main() { List&lt;string&gt; x = new List&lt;string&gt;(); double a,b,c = 0; string d = " "; Function(x, () =&gt; A.MethodX(a,b,c)); } </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How i can select element after some elements<p>I have some elements HTML and JavaScript but I can't selected the element after main element </p> <pre class=...
<p>In your HTML <code>item</code> is <strong>inside</strong> the <code>widget</code>, so this should work</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var _ = document.quer...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: MySQL Multiple counts in one query with case<p>Good day,</p> <p>I have compiled the following query.</p> <pre><code>SELECT COUNT(CASE WHEN `booking_cre...
<p>I guess there is problem with quotes in query : Try below:</p> <pre><code>SELECT COUNT(CASE WHEN booking_creationdate LIKE '2020-01-31%' THEN 1 END) AS "2020-01-31", COUNT(CASE WHEN booking_creationdate LIKE '2020-02-05%' THEN 1 END) AS "2020-02-05" FROM bookingstable AND booking_location = 4 </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: UIView: how to set property before initWithFrame is called?<p>I have some <code>MyView</code> as a subclass of <code>UIView</code> with following methods:</p...
<p>You can't set a property on the object before you call the initialiser because until that has been called the object does not exist. If the initialiser needs access to a property, you will need to supply it as a parameter (since it is a <em>requirement</em> for successful creation of your object).</p> <pre><code>- (...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a way to add samesite value to a cookie in jquery?<p>I have been trying a few variations of syntax to attempt to get the cookie to update with the s...
<p>Looks like the Jquery Cookie Plugin is unmaintained and it's from 2014, reading the docs, it doesn't support that.</p> <p>So, what are your options?</p> <ol> <li>Fork and modify yourself the plugin to add the functionality.</li> <li>Switch to <a href="https://github.com/js-cookie/js-cookie#samesite" rel="nofollow ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Inverting a Hierarchy with Linq<p>Given the class</p> <pre><code>public class Article { public string Title { get; set; } public List&lt;string&gt; ...
<p>If you specifically need it as a dictionary from tags to articles, you could use something like this.</p> <pre><code>var map = articles.SelectMany(a =&gt; a.Tags.Select(t =&gt; new { t, a })) .GroupBy(x =&gt; x.t, x =&gt; x.a) .ToDictionary(g =&gt; g.Key, g =&gt; g.ToList()); </code></pre> <p>Though it wou...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Read and modify value stored in separate file using form and PHP<p>I'm new to PHP so excuse me in advance! I have done the following code to show two differe...
<p>I would use JSON. </p> <p>vars.json:</p> <pre><code>{ "status": 1 } </code></pre> <p>then on your PHP:</p> <pre><code>&lt;?php $json = json_decode(file_get_contents("vars.json")); $href = ($json-&gt;status) ? "pageA.php" : "pageB.php"; ?&gt; &lt;a class="button" href="&lt;?= $href ?&gt;"&gt;Read more&lt;/a&g...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Symfony 2 : How to render a template outside a controller or in a service?<p>How to render a template outside a controller or in a service?</p> <p>I've been...
<p>Inject only @twig and pass the rendered template to the mailer body:</p> <pre><code>&lt;?php namespace Acme\Bundle\ContractBundle\Event; use Acme\Bundle\ContractBundle\Event\ContractEvent; class ContractListener { protected $twig; protected $mailer; public function __construct(\Twig_Environment $twi...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to exclude particular worksheet names from looping?<p>I have a scenario where I have an Excel workbook in whiche are multiple worksheets.</p> <p>For exa...
<p>Of yourse you need to test each name on its own</p> <pre><code>If ws.Name &lt;&gt; "Main" And ws.Name &lt;&gt; "Sheet 3" And ws.Name &lt;&gt; "Sheet 5" Then </code></pre> <p>otherwise you are testing for <em>one</em> sheet that is actually named <code>Main , Sheet 3, Sheet 5</code>.</p> <p><em>Make sure to get th...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PySpark first and last function over a partition in one go<p>I have pyspark code like this,</p> <pre><code>spark_df = spark_df.orderBy('id', 'a1', 'c1') out...
<p>When using <code>orderBy</code> with Window you need to specify frame boundaries as <code>ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING</code> otherwise the <code>last</code> function will only get last value between <code>UNBOUNDED PRECEDING</code> and <code>CURRENT ROW</code> (the default frame bounds w...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Syntaxerror in CREATE TABLE without any table creation but in procedure creation<p>I'm using Microsoft Access 2003, new to SQL tho. I have no idea why this w...
<p>Microsoft Access 2003 does not support stored procedure as sql. You can use <a href="https://docs.microsoft.com/en-us/office/client-developer/access/desktop-database-reference/create-procedure-statement-microsoft-access-sql" rel="nofollow noreferrer">Microsoft Access Procedure Creation</a> for creating the same</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I run through three separate arrays in the same for loop?<p>I have three arrays I am trying to run through and I want to use the values from all thre...
<p>If you are always sure the arrays will be equal in length, then you are better to just loop through one of the arrays and use it's index to reference the others:</p> <pre><code>for (index, name) in enumerate(Name) { makeUser(name, userAge: Age[index], userGender: Gender[index]) } </code></pre> <p>However, I wo...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pinvoke cdecl convention with char**<p>In summary: I`m trying to use a C++ dll with <strong>cdecl calling convention</strong> all ran fine unless i get to th...
<p>This is not an issue with the calling convention. The problem is in the buffer handling. </p> <p>There's really only one sensible way to interpret the C++ argument types and the apparent intent to return an array of bytes. That is that the buffer is allocated and populated by the callee, and its address returned in...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Change the size of the background image codewise from a label in swift<p>In the app that I am making I have some background images for some labels. The image...
<p>It is easier to have a container UIView with size of 250 x 275 that will contain 2 subviews with same size: </p> <p>1) a UIImageView with your image (set its contentMode to UIViewContentModeScaleAspectFit) </p> <p>2) UILabel with your text. It will be on top of the UIImageView to stay visible.</p> <p>You would po...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to add values in Python Array on Run-time?<p>I have a program that reads the digital pins of Arduino Board. The Board returns output if Digital Pin is PU...
<p>The issue is in these lines:</p> <pre><code>data[i].append(1) data[i].append(0) </code></pre> <p>Below is the right way to write these lines:</p> <pre><code>data.append(1) data.append(0) </code></pre> <p>Final Code without error:</p> <pre><code>from serial import Serial import time arduinodata = Serial("COM4",...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: NullPointerException in adapter holding viewholders<p>ElementAdapter class</p> <pre class="lang-java prettyprint-override"><code>package com.example.sierend...
<p>your not init <strong>mElementList</strong> before passed to adapter so when adapter call size method will throw null pointer </p> <p>edit your code here </p> <pre><code> @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: iBeacon - can detect using startRangingBeacons but not for didEnterRegion<p>I need to detect when the device enters or exits a region and performs some actio...
<p>You are trying to change the UI in the location manager callback - that's a big no no since those callbacks are usually not on the main thread. Wrap each UI change in a dispatch block to the main thread and see if that changes anything.</p> <p>Ah, I had the same issue a few days ago. You need to implement:</p> <pr...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: MVC Query doesn't fetch all records from the database<p>The DB stores several accounts: [winnie, winnie9, winnie10], however the query only returns one recor...
<p>in the method <code>getCertainApprovedUser()</code>, you are returning a value in the foreach. This breaks immediatly the loop at the first iteration.</p> <p>Changes your loop to something like :</p> <pre><code>$result = []; // initialize an empty array foreach ($users as $user) { // add a user to that array ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I combine multiple models into a single serializer?<p>it was necessary to combine several models(4) in one serializer, but there were problems with th...
<p>The way you are providing data to your serializer, <code>many=True</code> is not correct argument for it. Its a single object that you are passing to your serializer. Your view should be like this.</p> <pre><code>class FiltersView(views.APIView): def get(self, request, *args, **kwargs): filters = {} ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Trying to define an index within Elasticsearch for py-image-dedup<p>I'm trying to get py-image-dedup working (<a href="https://github.com/markusressel/py-ima...
<p>you are trying to use types, which have been deprecated: <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.html" rel="nofollow noreferrer">https://www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.html</a></p> <p>Please drop the <code>image</code> type ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Whats the difference between CQL data type VARCHAR vs TEXT?<ol> <li>Difference between CQL data type TEXT vs Varchar ?</li> <li>Any functional limitations ?<...
<ol> <li><p>No. As you can see in the <a href="http://www.datastax.com/documentation/cql/3.1/cql/cql_reference/cql_data_types_c.html" rel="nofollow noreferrer">CQL data types</a> doc, both <code>text</code> and <code>varchar</code> are UTF-8 strings.</p></li> <li><p>No. I answered a similar question here: <a href="ht...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pass multiple args to function<p>I want to pass multiple values to a function in uploadify.</p> <p>The way you call a function is like this</p> <pre><code>...
<p>You can use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply" rel="nofollow"><code>Function.prototype.apply()</code></a> to pass arguments to a function as an array. </p> <pre><code>$('#id').uploadify.apply(null, ['upload'].concat(imagesToUpload)); </code></p...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why is this hover effect pushing the other elements that are next to it away?<p>I have divs that contain each individual arrow (one for the greater than text...
<p>You give the <code>width</code> and <code>height</code> only on hover.. try to give the styles to the arrows anyway, and on hover only change the <code>background-color</code></p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to pass ENUM variable as input for POSTGRESQL functions<p>I have a function in MySQL which works fine:</p> <pre><code>CREATE PROCEDURE `Accounts_Activ...
<p>Create an enum data type:</p> <pre><code>CREATE TYPE atype AS ENUM ('TRAINING', 'ELZA'); </code></pre> <p>Then you can use it as function parameter:</p> <pre><code>CREATE FUNCTION Accounts_Active( IN_DeptName text, IN_Src atype ) RETURNS void ... </code></pre> <p>When using enums, remember that you can add...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to stream subprocess output with a user prompt?<p>Here's my subprocess call:</p> <pre><code>def myrun(cmd): p = subprocess.Popen(cmd, stdout=subproces...
<p>This is basically because of the buffering that is there normally at whatever your <code>cmd</code> program has. You have to disable the default buffering happening at that program in order to attain what you are looking for.</p> <p>In case it is a python file you are running through the cmd like the following, you...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to apply input type to ng2-smart-table<p>I want to apply a type='number' after "add new" button will show a corresponding rows, but have strings only. Wh...
<p>There is no way to add type number to the input-editor by default <a href="https://github.com/akveo/ng2-smart-table/blob/master/projects/ng2-smart-table/src/lib/components/cell/cell-editors/input-editor.component.ts" rel="nofollow noreferrer">https://github.com/akveo/ng2-smart-table/blob/master/projects/ng2-smart-ta...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PyQt file browsing - setting a default option?<p>I've been trying to implement a file browsing widget in the GUI I'm designing. I am using the QFileDialog mo...
<p>If the cancel button is selected from the <code>QFileDialog</code> filenames variable will be a null <code>QString</code> so, you could:</p> <pre><code>filenames = QFileDialog.getOpenFileName() if (filenames.isNull()): self.lineEdit.setText(_translate("ROIGUI", filenames, None)) else: # The alternative code...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Events in Blazor RenderTreeBuilder<p>I am having trouble using event binding on a Blazor component using the RenderTreeBuilder. I understand how to trigger e...
<p>I've improve a little bit on your html element and rest as follows:</p> <pre class="lang-html prettyprint-override"><code> &lt;input type=&quot;text&quot; @bind-value=&quot;InputValue&quot; @bind-value:event=&quot;oninput&quot; @onkeyup=&quot;ChangeCounter&quot; /&gt; &lt;p&gt;@InputValue&lt;/p&gt; &lt;p...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Grouping Start Dates<p>Example of what I am trying to do:</p> <p>I have 10 employees. They all started on different days throughout the year. Each get paid ...
<p>You can use <code>row_number()</code>:</p> <pre><code>select row_number() over(partition by EmployeeId order by PaycheckDate) week, EmployeeId, PaycheckDate, Amount from mytable order by week, EmployeeId </code></pre> <p>If you want just the first 13 weeks per employee, then:</p> <pre><code>select...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: javascript (angularjs) check if value exists in js object<p>I have the following object </p> <pre><code>{ 0 : false, 1 : true, 2 : false } </code></pr...
<p>Hope this is what you are looking for. </p> <pre><code>function containsFalse(obj){ for(var prop in obj){ if(obj[prop] === false) return true; } return false; } </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Mod_Spdy not running on Centos<p>I'm setting up Apache on Centos the way I have done in the past, but for some reason mod_spdy is not running. I'm following ...
<p>Ok it seems the issue is that Chrome 40.x dropped support for SPDY/3 and only supports SPDY/3.1, but the mod_spdy module for Apache only supports SPDY/3, so basically no SPDY for Chrome users if you use Apache as a web server.</p> <p>mod_spdy is currently in a bad state where either Google nor Apache is maintaining...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to fix the error lines override bar c3 js<p>I am working on a project and use c3 js library (don't use d3 js) And now I'm having a problem, that is when ...
<p>1st try setting the gridlines</p> <pre><code>grid: { lines: { front: false } } </code></pre> <p>The above really should work per <a href="https://github.com/c3js/c3/issues/462" rel="nofollow noreferrer">https://github.com/c3js/c3/issues/462</a></p> <p>If this doesn't work did you pick up the c3.css file -...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Passing option id value to controller and retrieve from another blade view via onclick<p>how do i pass my two option selected id to controller via onclick an...
<p>My ideal is fill a placeholder for params <code>cuid</code> and <code>stid</code> in <code>route</code> method and replace by selected value.</p> <pre><code>onclick="openNewWindow('{{ route('reporting.branchCheckBoxList', ['cuid' =&gt; '_cuid_', 'stid' =&gt; '_stid_']) }}'.replace('_cuid_', document.getElementById(...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: GDB core backtrace Bogus addresses<p>When I compile same code with g++ with -o2 flag I can backtrace successfully without any Bogus adresses. Like;</p> <pre...
<p>With gcc 4.8 you can use -Og switch, to enable all optimizations that do not interfere with debugging.</p> <p>Also make sure you enabled debug info (-g switch). If you updated your compiler to newer release, you should also update the debugger. Another thing you may try is to make sure gcc generates debug info in c...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Merging Dataframes using Pandas<p>I am trying to merge two dataframes together to create one concise dataframe. The first dataframe holds all possible names ...
<p>This is how I managed, it required two merges! Keep in mind it's against good practices to have multiple columns with the same name.</p> <pre><code>import pandas as pd df1 = pd.DataFrame({'router_name':[1,2,3,4],'firewall':['firewall1','firewall2','firewall3','firewall4']}) df2 = pd.DataFrame({'device_name':[2,3,'f...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PHP: Group array by index (every 1,2,3,nth...)<p>I can't figure it out how to convert array to different group, like every 1 , 2 , 3,...nth.</p> <p>Somethin...
<p>Loop the array and add every third item in each array.<br> I use a counter <code>$i</code> that counts and I use the modulo of 3 (number of groups) to know what array to store it in.</p> <pre><code>$number_of_group=3; $data = ['a','b','c','d','e','f','g','h','i']; $i = 0; foreach($data as $item){ $new[$i][] = ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: TypeScript require with type checking<p>I am using TypeScript v1.4.1 and would like to require an external module (in this case "chai") and have it be type c...
<p>Use the <a href="http://www.typescriptlang.org/Handbook#modules-going-external" rel="noreferrer"><code>import</code></a> keyword with <code>require</code> instead of <code>var</code></p> <pre><code>import chai = require('chai'); </code></pre> <p>And compile with <code>--module commonjs</code> if you're not already...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Haskell Function for Products of Adjacent Elements in List<p>I am trying to create a Haskell function where the input is a list of integers, and the output i...
<p>Let’s evaluate <code>productsList [1..3]</code> step by step:</p> <pre class="lang-hs prettyprint-override"><code>productsList [1..3] = productsList (1:2:[3]) = [1*2] ++ productsList [3] = [1*2] ++ [] = [1*2] </code></pre> <p>So the issue here is that the <code>productsList (x:y:xs) = [x * y] ++ productsList xs</c...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Observable.Window and .Zip not functioning like I would expect<p>I'm trying to turn an <code>IEnumerable</code> into an <code>IObservable</code> that deliver...
<p>The problem is occurring because of how <code>Window</code> works with a count - and this one isn't particularly intuitive!</p> <p>As you know, <code>Window</code> serves a stream of streams. However, with a count, the child streams are &quot;warm&quot; - i.e. when an observer of this stream receives a new window in...