input
stringlengths
51
42.3k
output
stringlengths
18
55k
ActiveRecord querying through multiple joins <p>So below are my models:</p> <p><strong>post.rb</strong></p> <pre><code>class Post &lt; ActiveRecord::Base has_many :taggings has_many :tags, through: :taggings has_many :collectables has_many :collections, through: :collectables end </code></pre> <p><strong>tag...
<p>try this:</p> <pre><code>def self.search(search) Collection.includes(posts: :tags).where(tags: {name: search}) end </code></pre>
Make a navbar fill top space (not body margin:0;) <p>I just started building a simple navbar and realized there is some sort of default padding/margin at the top of the page. I tried using margin:0 &amp; padding:0, but it only fixed the horizontal problem. I'm using chrome on OS X El Capitan.</p> <p><div class="snippe...
<p>Try this:</p> <pre><code>#navigation { width: 100%; height: auto; background-color: orange; position: absolute; top: 0px; } </code></pre>
404 Not Found @angular/platform-browser.js <p>I try setup ASP.NET MVC 5 (not Core) + Angular 2.0.0 + JSPM + SystemJS + <a href="https://github.com/frankwallis/plugin-typescript" rel="nofollow">TS Loader</a>. </p> <p>When I run app I get error:</p> <pre><code>Failed to load resource: the server responded with a statu...
<p>Seems like: <strong>'@angular/platform-browser': 'npm:@angular/platform-browser@2.0.0</strong> package is missing.</p> <pre><code>map: { "@angular/common": "npm:@angular/common@2.0.0", "@angular/compiler": "npm:@angular/compiler@2.0.0", ... ... '@angular/platform-browser': "npm:@angular/platfo...
Jquery Radio Button Detect Changes <p>I have multiple sets of radio buttons in my page. Each set has two options Type Text or Upload Image. The number of such sets is dynamically determined and are created within the web page using Jquery. Each of these two set of radio buttons is within a form.</p> <p>My problem is t...
<p>After several trials got the thing to work using a roundabout way. I first gave an unique name to each of the radio buttons. Then I detected if there is any change in any radio button. Then identified the name of the radio button that was changed. Using the name proceeded with the rest of the code -</p> <pre><code>...
Django return JSON with Logged in Cookie <p>I want to design a simple Django "RESTful" API without the need of using django-rest-framework.</p> <p>The endpoint is <code>/api/login</code> which accept only POST method with <code>username</code> and <code>password</code> in json. I want it to return <code>{"status" : 0}...
<p>I tested it out, that I can just use <code>return JsonResponse({'status' : 0})</code> because the cookies are registered with Django because of <code>authenticate</code>.</p>
Easy XDM - IFrame Navigation Breaks Socket <p>I'm using EasyXDM to handle cross-domain communication so that the parent knows both the size of the child and the location of the child. I've got the sizing working. The issue is when I navigate while inside the iframe I want to push the location back up to the parent. <...
<p>From everything I've seen there's no possible way to do what I'm after. It seems that the only solution for the problems I was ultimately trying to solve, pushing routing into the location hash of the parent, is to use the double iframe approach mentioned here.</p> <p><a href="http://stackoverflow.com/questions/15...
Rails Interactor rollbacks <p>I am using the <a href="https://github.com/collectiveidea/interactor" rel="nofollow">interactor gem</a> in my rails project. When one of the interactors within the organizer fails, the rollback method is called. The question is, is there any way this method can be aware of why the interact...
<p>You can just access the <code>context</code> inside <code>rollback</code> method. There is one catch - <code>rollback</code> of the "current" interactor won't be invoked. Take a look at the following code:</p> <pre><code>require "interactor" class Foo include Interactor def call end def rollback p "#...
CI3 logout session doesn't redirect <p>I'm trying to create a simple login/logout feature of a project and my problem is that when I try to logout, the page doesn't redirect to my original login page.</p> <p>My Admin model goes like this </p> <pre><code>public function __construct() { parent::__construct(); $...
<p>Try out the following function</p> <pre><code>public function logout(){ if($this-&gt;session-&gt;userdata('logged_in')){ foreach ($_SESSION as $key =&gt; $value) { unset($_SESSION[$key]); } $this-&gt;load-&gt;view('admin/index'); } } </code></pre> <p>here the <code>$thi...
UserDefault new syntax in swift iOS <p>I'm trying to do a code like this:</p> <pre><code>the key "firstUseValue" exists? if it does: is valueForKey("firstUseValue") true? print("USING FOR THE FIRST TIME") setValueForKey("firstUseValue", false) else print("I HAVE BEEN USED BEFORE") if it...
<p><strong>Swift 2</strong></p> <pre><code>// Set NSUserDefaults.standardUserDefaults().setInteger(123, forKey: "key") // Get NSUserDefaults.standardUserDefaults().integerForKey("key") </code></pre> <p><strong>Swift 3</strong></p> <pre><code>// Set UserDefaults.standard.set(123, forKey: "key") // Get UserDefaults.st...
Since Xcode 8 and iOS10, views are not sized properly on viewDidLayoutSubviews <p>It seems that with Xcode 8, on <code>viewDidLoad</code>, all viewcontroller subviews have the same size of 1000x1000. Strange thing, but okay, <code>viewDidLoad</code> has never been the better place to correctly size the views.</p> <p>B...
<p>Now, Interface Builder lets the user change dynamically the size of every view controllers in storyboard, to simulate the size of a certain device.</p> <p>Before this functionality, the user should set manually each view controller size. So the view controller was saved with a certain size, which was used in <code>...
How does hyphen, en-dash and em-dash gets stored in oracle database having character set WEISO98859P1? <p>I have a java web application which uses oracle database. Character set of my database is WEISO98859P1. The problem which i am facing is, The characters like en-dash and em-dash gets stored inverted ? or some other...
<p>You cannot store &ldquo;en-dash&rdquo; (&ndash;) and &ldquo;em-dash&rdquo; (&mdash;) in an Oracle database with character set WE8ISO8859P1, since these characters are not defined in that character set.</p> <p>The best thing would be to convert the database to character set WE8MSWIN1252. You can do that without chan...
Print List to console in Table format <p>I'm looking for a Freemarker template that can output a List to console in tabular format.</p> <pre><code>&lt;#list ["foo", "bar", "baz", "huhu", "lala", "keke", "koko", "fifi", "bubu"] as x&gt; ${x} &lt;/#list&gt; </code></pre> <p>I'm looking for console output like:</p> <pr...
<p>The nicest way of adding line breaks is probably with <code>?chunk(n)</code>. Also, the column width (which you haven't asked about) can for example be ensured with <code>?right_pad(n)</code>. So the example is:</p> <pre><code>&lt;#list ["foo", "bar", "baz", "huhu", "lala", "keke", "koko", "fifi", "bubu"]?chunk(3) ...
How to create new branch in a remote? <p>I have made a mistake with my git branch workflow</p> <p>I have the following local and remote branches setup:</p> <pre><code>master -&gt; origin/master iteration5 -&gt; origin/iteration5 iteration9 -&gt; origin/iteration5 </code></pre> <p>I need the upstream on my local bran...
<p>You can remove it with </p> <pre><code>git branch --unset-upstream iteration9 </code></pre> <p>then reset it by pushing to origin with the <code>--set-upstream</code> flag:</p> <pre><code>git push --set-upstream origin iteration9 </code></pre> <p>or you can set it with this command if the remote branch already e...
Get only device name from xinput -list <p>I've written a small program that toggles whether a device is enabled, mostly to run from a hotkey to enable/disable the touchpad since my hands always hit it while typing. I have it using <code>notify-send</code> to create a dialog box, however all I can currently do is say</p...
<p>In practice, yes, you can do that.</p> <pre><code>arrow=$'\xe2\x86\xb3' while IFS= read -r line; do if [[ $line = *"$arrow"* ]]; then content=${line#*"$arrow"} # delete everything before the arrow content=${line%%$'\t'*} # delete everything after first tab echo "Found content: $content" fi done ...
python ImportError: No module named cy_unity graphlab <p>I am new to python and I am trying to work on a project with deep learning and want to use graphlab library. I use sublime text for coding on windows 10. My code is only this line:</p> <p><code>import graphlab</code></p> <p>I get this error msg:</p> <p>Traceba...
<p>Try using <code>graphlab.get_dependencies()</code> in your interpreter. </p>
What is the proper way to convert XML to Java objects in spring integration? <p>I've been searching for a way to incorporate an XML to java object converter into my spring integration service. This is something that I'm sure must already exist, but the issue I'm having is I keep finding docs and tutorials based on old...
<p>Not sure what you are going to reach, but your StackTrace says everything you need and you have missed:</p> <pre><code>Could not convert constructor argument value of type [org.springframework.integration.xml.transformer.UnmarshallingTransformer] to required type [org.springframework.oxm.Unmarshaller] </code></pre>...
Angular: how to download file without showing access_token in url <p>My web application is secured by Oauth2. For ajax calls, the access_token has to be provided in the request folder. For example, here is one of the methods in factory.js:</p> <pre><code> service.getAll = function () { var url = SERVER + "/r...
<p>You should put the access token in the header instead of in the query parameter.</p> <p>This <a href="http://www.baeldung.com/rest-api-spring-oauth2-angularjs" rel="nofollow">tutorial</a> shows how this works in detail.</p> <p>Edit : Is there a way to add the token to the header of wondow.open(..) ?</p> <p>No, it...
Select data from same structure table <p>I have a table format like this :</p> <pre><code>CODE DESIGNER BRAND GENDER SIZE UNIT TYPE TOT M1001 JOE DIDI M 1.9 oz HH 88 </code></pre> <p>There are over one thousand tables in the same format. Each Row has a unique CODE....
<p>Temp table with dynamic sql will by far be the easiest if looking at "over one thousand tables"....</p> <p>Here is a block of code that will retrieve the names of all tables that have those 8 columns in them and then search for CODE = M1001 in each of those tables and if it exists put the record into the temp table...
I want the auto generated key from firebase whenever i push data <p>All the methods i have tried so far are only returning me the parents key and not the auto generated push key.</p> <pre><code>String key = rootref.child("user").push().getKey(); newUser.setUid(key); Log.i("#####",key); Map&lt;String, Object&gt; childU...
<p>I was checking your code and don't see the setValue. This is the reason why getKey returns "user". It should be like <code>rootref.child("user").push().setValue(UserObject)</code></p> <p>try this! I use this code. </p> <pre><code>rootref.push().setValue(UserObject).addOnCompleteListener(new OnCompleteListener&lt...
Unable to get React JS hello world working <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset="utf-8"&gt...
<p>Check the order in which scripts are loaded and you were loading <code>babel-core</code> <strong>asynchronously</strong>.. also you were seeing <code>&lt;</code> because of your syntax error <code>&lt;&lt;!DOCTYPE html&gt;</code>, it should be <code>&lt;!DOCTYPE html&gt;</code></p> <p><div class="snippet" data-lang...
How to use pytmx in pygame? <p>There was a question similar to this but the persons question wasn't regarding the same way I'm trying to implement <code>pytmx</code>, so this is the first time I've worked with <code>tiled</code>, or <code>pytmx</code> and I'm having trouble with the docs on <code>pytmx</code>.</p> <p>...
<p>There are a lot of things wrong with this code. - did you write it or get it from somewhere else? It may be that you need to make sure you understand Pygame better before you try to do something as advanced as using a Tiled map. Also, is this the whole code, or did you leave some out?</p> <p>To address the biggest...
Play MP3 files in order without HTML5 audio with JavaScript <p>I'm trying to play three MP3 files one after another using Javascript without the HTML5 audio tag. [I'm working within Articulate Storyline which is an authoring tool for eLearning. It supports Javascript within files but not HTML]</p> <p>So far, the best...
<p>You can use an event handler that listens for the audio play to end, and then play the next one etc.</p> <pre><code>function play(audio) { audio.play(); return new Promise(function(resolve, reject) { audio.addEventListener('ended', resolve); }); } function myFunction() { var audio1 = new Au...
Node.js reports URL as 200 instead of 404 <p>I have an node.js app useing express.js running at <a href="http://bartonlp.org:8080" rel="nofollow">http://bartonlp.org:8080</a>. I see this, for example, in my log output:</p> <pre><code>"GET http://www.baidu.com/?rnd=19712180733831423955225532 HTTP/1.0" 200 2749 </code>...
<p>That's not an "impossible URL." It's completely valid, although a full URL (e.g. <a href="http://example.org/foo" rel="nofollow">http://example.org/foo</a>) instead of just a path (<code>/foo</code>) is typically used for HTTP proxies where the full URL is the site the client wishes to visit via the proxy server.</p...
How to remove network self loops MATLAB <p>I have a file where there is a huge matrix (10903x3) forming a network with duplicated nodes and self-loops.</p> <p>I want to get the <code>Laplacian matrix</code> and for that first I compute the graph of the network.</p> <p>The steps I follow are:</p> <ul> <li><p>Remove d...
<p>If you are using the graph and digraph classes, you can use the option 'OmitSelfLoops' when you create the graph.</p> <p>Otherwise, self loops appear as nonzero elements on the diagonal of the adjacency matrix. So you can construct the adjacency matrix and zero out the diagonal to remove the self loops.</p>
Difference between dFdxFine and dFdxCoarse <p>From the OpenGL documentation:</p> <blockquote> <p>dFdxFine and dFdyFine calculate derivatives using local differencing based on on the value of p for the current fragment and its immediate neighbor(s).</p> <p>dFdxCoarse and dFdyCoarse calculate derivatives using lo...
<p>From the GLSL spec:</p> <blockquote> <p>It is typical to consider a 2x2 square of fragments or samples, and compute independent <strong>dFdxFine</strong> per row and independent <strong>dFdyFine</strong> per column, while computing only a single <strong>dFdxCoarse</strong> and a single <strong>dFdyCoarse</stron...
How can I define a space without using fixed dimensions? <p>First off, I'm new to Overflow, so forgive me if this is in the wrong spot. </p> <p>Here's my question: I'm learning CSS, and I'm currently styling the html for a simple test page. I need to move some text around so there's a good space between it and some fo...
<p>To set a fixed height and width of a div, while being responsive, I use the units vh and vw. For example, to set the height of a div to be 40% of the viewport (viewport is the user's visible area of a web page.), use:<br> <code>height = 40vh;</code><br> This way, even if you resize your browser or view it on a diffe...
Converting an integer to a double inside switch case <p>This program is for a payroll but i haven't got far yet</p> <pre><code>Console.WriteLine("What is your name"); string name = Console.ReadLine(); Console.WriteLine("What is your hourly rate\n1=6.53\n2=7.48\n3=8.89"); int hourlyRate = Convert.ToInt32(Console.ReadL...
<p>You are going to have to declare a variable as double to hold the actual rate. </p> <p>Since you are using hourlyRate to hold the "selection" you'll probably need another variable to hold the actual rate: like this:</p> <pre><code>Console.WriteLine("What is your name"); string name = Console.ReadLine(); Console.W...
gcc using X11 lib <p>I'm trying to compile C code under suse 11 with -lX11 option (gcc 3.4.3) : <code>gcc -L/home/user/myDir -lX11 myprog.c -o myprog</code></p> <p>The error is : <code>/usr/lib/ld : cannot find -lX11</code></p> <p>I tried many paths where X11 is mentioned : <code>/usr/lib/</code> , <code>/usr/lib/X11...
<p>solution : change : <code>/usr/lib/libX11.so.6</code> to <code>/usr/lib/libX11.so</code></p>
ViewPager slide is skipping first and last fragment <p>Hy, I am new to Android developing apps and i want to make an application using a view Pager with tabLayout.I also have a fragment that contains a list and I want to create this fragment on every page but with different data, depending on the tab selected. I almost...
<pre><code> viewPager = (ViewPager) findViewById(R.id.pager); final ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager()); viewPager.setAdapter(adapter); tabLayout.setupWithViewPager(viewPager) // link the given ViewPager and this TabLayout together so that changes...
A-frame js camera rotation with look-controls <p>I am trying to rotate camera with look-controls.Camera is rotating fine without look-controls.Can somebody tell me how can i rotate camera with look-controls?</p>
<p>You'll need to remove or disable <code>look-controls</code> if you're overriding camera rotation manually.</p> <p>You can remove the component temporarily with <code>el.removeAttribute('look-controls')</code> and add the component again afterward.</p> <p>Or use <code>el.setAttribute('look-controls', {enabled: fals...
NullPointerException in RecyclerView Adapter <p><strong>EDIT: The suggested duplicate question doesn't answer my question in any way, shape, or form.</strong></p> <p>I'm having trouble setting up my RecyclerView adapter. I get two errors:</p> <pre><code>09-19 20:01:38.601 22710-22710/com.yitter.android E/RecyclerView...
<p>presumably you reference to a file in your RecyclerView block in your xml layout file that not exist in your drawable or some other folder or file...check the error lines before this lines and you can see error in line #... then check...</p>
Host MEAN STACK APP using Github gh-pages <p><a href="https://github.com/shaneyvincent/MEAN-STACK-message-app" rel="nofollow">https://github.com/shaneyvincent/MEAN-STACK-message-app</a> &lt;-- the github <a href="https://shaneyvincent.github.io/MEAN-STACK-message-app/" rel="nofollow">https://shaneyvincent.github.io/MEA...
<p>Your <a href="https://github.com/shaneyvincent/MEAN-STACK-message-app/blob/master/index.js" rel="nofollow">index.js</a> is the first problem.</p> <p>Line #4 (<code>app.set('port', (process.env.PORT || 5000));</code>) will not work on Github Pages. It only allows for client-side languages or Jekyll, not server-side ...
How to remove a method from a compiled Java class/jar file? <p>I have a JAR file and there is a static class, I can't decompile it, it gets messed up. There is one method in it, that returns a class, that doesn't exist. No idea how, but I'm getting <code>NoClassDefFoundError</code>. Even though I'm not using that metho...
<p>I think you are mistaken: if that method would never be called, then the JVM would <strong>most likely not</strong> try to load that class.</p> <p>You see, the whole point of class loading - it happens <em>lazy</em>; when you load class X, and X needs Y, Z ... then Y and Z are only loaded when some code is executed...
R -- use binary df1 to group measurements in df2, then see if any measurements within each group meet a specific condition to output a new binary df3 <p>I'm trying to translate some old Excel functions to R, and this final step in identifying insect outbreaks is the most challenging for me. Input will include two times...
<p>Here is how I would have asked your question. I have three data frames, <code>A</code>, <code>B</code>, and <code>C</code>. I need to convert <code>A</code> into <code>C</code> using values from <code>B</code>. Here are the data frames:</p> <pre><code>A &lt;- data.frame(c1=c(0, 1, 1, 0, 1, 1), c2=c(0, 1, 1, 1, 1...
Crop section of image without sticking out <p>I am successfully achieving my goal but in so doing the divs stick outside the normal area and require scrolling. How can I achieve this sort of masking while keeping everything contained horizontally. I've tried altering the position of various elements and can't seem to a...
<p>I am having a difficult time recreating the issue in your fiddle, might be a lack of the image within the orange div. But try the following: </p> <p>You would have to utilize the <code>overflow: hidden</code> property.</p> <p>By doing this you hide the extra and disable the scrolling which sounds like what you nee...
Spring Boot on Android? <p><strong>Is it possible to run Spring Boot on an Android device?</strong> </p> <p>Right now I am successfully running a web service on localhost using Spring Boot which I've got building in IntelliJ IDEA. I need to get the same web service code running on an Android device. Is it possible ...
<p>Short answer is you're not gonna be able to directly run your spring boot application on your android phone. Spring boot is meant as a wrapper to quickly bootstrap Spring applications and is going to best serve you when building web based applications. As I see it you have two options.</p> <ol> <li>Deploy your ja...
Why am I seeing an extra space after the bullet in UL in Chrome <p>Running Windows 7, Chrome Version 53.0.2785.116 m</p> <p>It appears that a huge gap has been added to ul lists between the bullet and the first character of the li item. I am using list-style-position: inside; and that is what appears to be adding the ...
<p>In the meantime, I might suggest the following workaround:</p> <pre><code>li:before { content: "\a0"; display: inline-block; width: 0; margin-left: -.5em; margin-right: -.5em; } </code></pre> <p>For example:</p> <p><a href="http://dojo.telerik.com/AseNe" rel="nofollow">http://dojo.telerik.com/...
Align ListBox in Frame wxpython <p>I'm trying to figure out how to align a ListBox properly. As soon as i insert the lines of ListBox, the layout transforms into a mess.</p> <pre><code>#!/usr/bin/python # -*- coding: utf-8 -*- import wx oplist=[] with open("options.txt","r") as f: for line in f: oplist.ap...
<p>The listbox is being parented to the frame by using self.</p> <pre><code>self.flistbox= wx.ListBox( self,choices=oplist, size=(100,100), name="Field", wx.ALIGN_CENTER_HORIZONTAL) </code></pre> <p>It should be parented to the panel by using p like the other controls.</p> <pre><code>self.flistbox= wx.ListBox( ...
SQLite Not preserving my leading zeroes in a prepared statement <p>I'm having a hard time getting leading zeroes to stick.</p> <p>I have a prepared statement that looks like this:</p> <pre><code>SQLiteCommand insertSQL = new SQLiteCommand(@"INSERT INTO Inventory( AssetTag, Vendor, Device, Attribute, Devic...
<p>Probably you are falling into the same trap described in <a href="https://www.mail-archive.com/sqlite-users@mailinglists.sqlite.org/msg78271.html" rel="nofollow">this thread</a>.</p> <p>Briefly, SQLite does not understand the "<code>STRING</code>" datatype, and in that case it assumes a default <code>NUMERIC</code>...
Swift - Picking pixel colour of UIImage - memory crash <p>I want to pick colour of specific pixel of UIImage in Swift 3 and this method is called ~10k times.</p> <pre><code> func pixelColour(_ pixelPosition: CGPoint) { if !CGRect(x: 0.0, y: 0.0, width: self.size.width, height: self.size.height).contains(pixelPosi...
<p>You have not shown how <code>pixelColour</code> is called, but I presume that it is in some sort of loop. If so, surround your repeated call to <code>pixelColour</code> with an <code>autoreleasepool{...}</code> call to release the accumulated memory each time through your loop:</p> <pre><code>let p = // next CGPoin...
REGEX mistake in java <p>I have two line that are as the same but they have two different results!</p> <pre><code>public static String data = "Rome:Jan 81.2,Feb 63.2,Mar 70.3,Apr 55.7,May 53.0,Jun 36.4,Jul 17.5,Aug 27.5,Sep 60.9,Oct 117.7,Nov 111.0,Dec 97.9" + "\n" + "Lo...
<p>When you call <code>Matcher matcher=checkExists("\\s(.*?),", splitData);</code> you are executing <code>find()</code> for the first time, and then you use <code>while (matcher.find())</code> which means than you just have lost the first match cause you are executing <code>find</code> after the first <code>find</cod...
R For loop fails applying max function <p>I premise I'm new with R and actually I'm trying to get the fundamentals. Currently I'm workin on a large dataframe (called "ppl") which I have to edit in order to filter some rows. Each row is included in a group and it is characterized by an intensity (into) value and a samp...
<p>Not sure if I follow your question. But maybe this will get you started.</p> <pre><code>library(dplyr) ppl %&gt;% group_by(grp) %&gt;% filter(into == max(into)) </code></pre>
Reporting memory leaks on shutdown with a console application <p>I've created a console application and set ReportMemoryLeaksOnShutdown := True.</p> <p>I've created a TStringList but did not free it. </p> <p>When the program finishes executing, I see the memory leak for a brief second but then the console closes. </p...
<p>That is a bug in recent Delphi versions. I just checked it in that recent free Delphi 10.1 Starter and it behaves as you describe - but as it provides no RTL sources I can not check the exact reason.</p> <p>In Delphi XE2 it behaves as expected: creates the task-modal dialog and waits for you to react, just like des...
Can't get program to print "not in sentence" when word not in sentence <p>I have a program that asks for input of a sentence, then asks for a word, and tells you the position of that word:</p> <pre><code>sentence = input("enter sentence: ").lower() askedword = input("enter word to locate position: ").lower() words = s...
<p>Lists are sequences, as such you can use <a href="https://docs.python.org/3.5/library/stdtypes.html#common-sequence-operations" rel="nofollow">the <code>in</code> operation</a> on them to test for membership in the <code>words</code> list. If inside, find the position inside the sentence with <code>words.index</code...
Copy records from current day between tables on different databases <p>As the title says, I want to copy all of the current days records from our production database to our development database. I have view access to the production database and db_owner rights to the development database. I'm writing a stored procedure...
<p>This is too long for a comment.</p> <p>One the <em>development</em> server, create a linked server to the production server. This should give you read access to everything that you need access to.</p> <p>Then, do the work on the <em>development</em> server. After all, that is a safer place to run scripts than on...
Is there an abstract state in Angular2 Router? <p>I'm looking for similar solution to <a href="https://github.com/angular-ui/ui-router/wiki/nested-states-%26-nested-views#abstract-states" rel="nofollow">ui-router abstract state</a> in Angular2 Router. </p> <p>To have "<em>virtual</em>" parent state to resolve some com...
<p>A route doesn't need to be associated with a component. It can just have children with an empty path. You can use this "empty" route for things like guards or resolves.</p> <p>One thing I didn't know until testing right now, is that <a href="https://angular.io/docs/ts/latest/api/router/index/Resolve-interface.html"...
Counting words in Word document, including footnores <p>I periodically receive long documents that include footnotes and am trying to find a way using VBA to count the number of words on each page, including footnotes. It doesn't matter if a footnote spills over onto the next page, I just the word count including foot...
<p>I think what you will need to do is iterate into each of the <code>StoryRanges</code> and update a counter. Here is a small example that should serve as an example, however, you will likely need to tweak it for your specific case (review my note about the enum for StoryRanges)</p> <p>Here's the code:</p> <pre><cod...
Custom Adapter for ListView inside Fragment <p>So I was following the answer of @AndiGeeky on <a href="http://stackoverflow.com/questions/32475996/custom-adapter-for-listview-in-fragment-android">custom adapter for listview in fragment Android</a></p> <p>But it did not work. Here is my code.</p> <pre><code>public cla...
<pre><code>@Override public View getView(final int position, View convertView, ViewGroup parent) { View view = convertView; Holder holder; if (view == null) { LayoutInflater inflater= LayoutInflater.from(parent.getContext()); view = inflater.inflate(layoutResourceId, parent, false); ...
Plotting multiple arrays in maple <p>I'm trying to plot 4 data-sets in a single coordinate-system. I can plot every single one of them by themselves. However when I try to plot 2 or more with the same plot function I get an error. I can't use lists since I want to scale the arrays up to 2*10000, which a list can't. I'm...
<p>Your problem is that your use of <code>pair</code> and <code>zip</code> is not going to produce Arrays <code>P[i]</code> whose layout is valid for plotting. (Perhaps you cribbed that bit of code from something which was intended to produce a list of lists instead of an Array.)</p> <p>Instead, you could construct th...
R Shiny how to display a pdf file generated in "downloadHandler" <p>I am new to shiny and was wondering if there is a way to display a pdf file generated in "downloadHandler"?</p> <p>I am using a package to do some biological analysis, and I can make it create a pdf file in downloadHandler. However, I am still struggl...
<p>If you intend to display the pdf, you should not use <code>downloadHandler</code>. Instead, just use your pdf printing function to generate the pdf file, but the key is </p> <ol> <li>Create a <code>www</code> folder under your Shiny project root</li> <li>Point the file argument of <code>msaPrettyPrint</code> to <co...
Anonymous Login & Username: Firebase + AuthUI <p>I am fairly new to Firebase and Firebase Auth UI and got two questions:</p> <ol> <li>I am using Firebase Auth UI for a simple login activity. How can I add a anonymous login option to the screen? The option is activated in the Firebase console.</li> <li>How can I add a ...
<p>You can find all possible Firebase login implementations from the <a href="https://github.com/firebase/quickstart-android/tree/master/auth/app/src/main/java/com/google/firebase/quickstart/auth" rel="nofollow">link</a>.</p> <blockquote> <p><strong>Q1.</strong> I am using Firebase Auth UI for a simple login activit...
Can't print contents after scraping site <p>I am unable to print contents after scraping a website using selenium. I need to scrape a table. Here's what I am trying to do:</p> <pre><code>table = driver.find_element_by_xpath('//div[@class="line-chart"]/div/div[1]/div/div/table/tbody') print table.text </code></pre> <...
<p>It's hard to say, why <code>.text</code> is not working in your case, may be its designing issue. But you can try also using <code>get_attribute()</code> to scrap text as below :-</p> <pre><code>table.get_attribute("textContent") </code></pre>
numpy binary notation quick generation <p>Suppose, I have a <code>numpy</code> vector with <code>n</code> elements, so I'd like to encode numbers in this vector as a binary notation, so resulting shape will be <code>(n,m)</code> where <code>m</code> is <code>log2(maxnumber)</code> for example:</p> <pre><code>x = nump...
<p>Here us one way using <code>np.unpackbits</code> and broadcasting:</p> <pre><code>&gt;&gt;&gt; max_size = np.ceil(np.log2(x.max())).astype(int) &gt;&gt;&gt; np.unpackbits(x[:,None].astype(np.uint8), axis=1)[:,-max_size:] array([[0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 1], [1, 0, 0, 0, 0, 1, 1]], dtyp...
Constructing an edge list from the second column of a two columnar file with relationships derived from the first column <p>I have a problem, I have a file with several million lines arranged like so:</p> <pre><code>1 Protein_A 1 Protein_B 2 Protein_A 3 Protein_C 4 Protein_A 4 Protein_B 4 Protein...
<p>Rather easy using python and some smart modules. I have embedded the file contents in a string. Just replace by <code>data = open("input.txt")</code> to read from a file (iterable as well).</p> <p>I create a dictionary with number as key and list of proteins matching the number as values.</p> <p>Once built, I use ...
Issue with leaflet.js "viewreset" map not zooming out properly <p>I am new to Leaflet.js. I am trying add a layer to an OSM using Leaflet and D3. I can see one dot but when I zoom out to see if other dots are showing the map is does not redraw properly and I'm getting a "TypeError: t is undefined" message as well. </p>...
<p>The issue was that I had some null rows in my tsv, I thought the if (d.SoundLat &amp;&amp; d.SoundLong) had caught the nulls but apparently not.</p>
Mongoose extract first subarray element after filtering <p>I have array in subdocument like this</p> <pre><code> { "_id" : ObjectId("512e28984815cbfcb21646a7"), "descDay" : [ { "language" : "en", "desc": "day description" }, { "language" : "es", ...
<p>You can use <a href="https://docs.mongodb.com/manual/reference/operator/aggregation/unwind/#pipe._S_unwind" rel="nofollow"><code>$unwind</code></a> to unwind the single-element <code>descDay</code> array into an object:</p> <pre><code>db.test.aggregate([ { $project: { descDay: {$filter: { in...
yii Ajax call not going to correct action <p> I have the following link to make my ajax call in yii2:</p> <pre class="lang-php prettyprint-override"><code>echo Html::a('Load more','ajaxShowMoreProducts', [ 'onclick'=&gt;"console.log('Load more'); $.ajax({ type:'POST', cache: false, ...
<p>In yii2 you should use the proper notation for action url (in url calling si not used the camelNotation but the words are separated by <code>-</code> (minus)</p> <pre><code> echo Html::a('Load more','ajax-show-more-products', [ </code></pre> <p>and in ajax url too</p> <pre><code> url: 'ajax-show-more-products',...
redux-form and react widgets' calendar - invalid prop value of type String <p>I want to use react-widgets calendar as input for start date and end date, simplest implementation works:</p> <pre><code>const TripValidationForm = React.createClass({ FormDatepicker : ({input}) =&gt; { return (&lt;Calendar {...input} ...
<p>looks like the warnings are coming from the props validation on the react widget calendar source, not much you can do unless you want to modify the source. Also this warnings are only shown in dev mode, if you bundle your code for production you shouldn't see any of this warnings</p>
Git DOES NOT require username and password. How can I change it to do so? <p>It seems as though the <a href="http://stackoverflow.com/q/6565357/4089351">common scenario</a> is to be in a safe computer, and receive prompts for username and password when pushing branches to GitHub from RStudio.</p> <p>I have the reverse...
<p>First, do:</p> <pre><code>git config credential.helper </code></pre> <p>If that gives you any output, then you have a credential helper defined, and it could be caching your credentials.</p> <p>To disable the helper, do:</p> <pre><code>git config --unset credential.helper </code></pre> <p>Depending on where the...
'Project needs to be deployed before it can be started' after successful deploy <p>I'm trying to remote debug a new background IOT app on my Raspberry Pi 3 in VS2015 Update 3. At first I had trouble with 'Command failed: 0x800705b4', which I solved by changing the remote machine name to the IP address and the '8116' po...
<p>Somehow it's working now after changing the device name, changing the administrator password (p@ssw0rd) to something new, and setting a remote debugging pin. I used the dns name via the automatic find option and it worked, even though it needed the IP before.</p>
Using multi-valued parameters together in main query <p>I have a report that uses two multi-value parameters in the query.</p> <p><strong>@garageId</strong> and <strong>@createdYear</strong> are both set as multi-value parameters with a default value of zero(0).</p> <p>If I run it in SQL Server Management Studio, lik...
<p>SSRS converts multi-value parameters to a list of items when running the query.</p> <p>If <code>@garageId = 1, 2, 3</code> and <code>@createdYear = 2015, 2016</code> then your <strong>WHERE</strong> conditions:</p> <pre><code>WHERE type = 1 AND (mc.garageId IN(@garageId) OR @garageId IN(0)) AND (ml.createdYear I...
Pandas/python and working with a column, in a dataframe, with a date <p>I am currently working on a Python/Pandas data science project for fun. The data that I am looking at has a Date column where the date looks like the following: 2016-07-16. The data type is also an object. What I want to do is go through each date ...
<p>IMO there is no need to add a new column:</p> <pre><code>In [132]: df Out[132]: Date Deaths Country 0 2002-01-01 2 India 1 2002-01-02 0 Pakistan 2 2001-01-02 1 France In [217]: df.groupby(df.Date.dt.year)['Deaths'].sum() Out[217]: Date 2001 1 2002 2 Name: Deaths, dtype: i...
Build react-router url from input <p>How do I add the value from the input field to the url string? In the example below <code>this.refs.foo</code> is <code>undefined</code>.</p> <pre><code>export class searchTest Component { render() { return ( &lt;div&gt; &lt;input ref="foo"/&gt; &lt;Link...
<p><code>this.refs.foo</code> does not exist on the first render, it is created after the first render. You need a safe default, perhaps by pulling out value into a variable before the return statement:</p> <pre><code>export class searchTest Component { render() { var value = this.refs.foo ? this.refs.foo.value ...
Android. Google Play Services Saved games API <p>I'm on the way to implement the Cloud Backup of progress that player achieved in the game so Saved Games function provided by Google Play Services looks like what I need.<br> After reading <a href="https://developers.google.com/games/services/android/savedgames" rel="nof...
<p>I think Google Play Games support automatic saving and loading. According to this video: <a href="https://www.youtube.com/watch?v=QF8gPZa6A0k" rel="nofollow">Game On!: Cloud Save</a></p> <p>7:26 of the video:</p> <blockquote> <p>"the game does save to the cloud automatically"</p> </blockquote> <p>and 7:55 of th...
How can I call a method with weaker side effect guarantee? <p>I've got this from the Lock checker:</p> <pre><code>Error:(52, 30) java: [method.guarantee.violated] @ReleasesNoLocks method proc() calls method unfree() with a weaker @MayReleaseLocks side effect guarantee </code></pre> <p>I could post the code but it doe...
<p>Your code looks something like this:</p> <pre><code>@ReleasesNoLocks void proc() { ... unfree(); // line 52 ... } void unfree() { // arbitrary code that might include someLock.unlock(); } </code></pre> <p>The documentation for <a href="https://types.cs.washington.edu/checker-framework/current/api/org/che...
How to insert data from model to table in spring boot <p>I am trying to insert into the table from a model but I am getting the following error.</p> <pre><code>There was an unexpected error (type=Internal Server Error, status=500). StatementCallback; bad SQL grammar [INSERT INTO user_sample(user_id) VALUES(?); sampl...
<p>With Spring Boot you don't need to write your inserts <code>manually</code>, just leverage the power of JPA: <a href="https://spring.io/guides/gs/accessing-data-jpa/" rel="nofollow">https://spring.io/guides/gs/accessing-data-jpa/</a></p>
Why path.subtracted(path2) is linking my path? How can I delinking? <p>I am working on a simple Paint application using pyqt5. My goal is:</p> <p><strong>1</strong>. Draw freely according to mouse events. It's done!</p> <p><strong>2</strong>. Erase freely according to mouse events. It isn't work as expected!</p> <p>...
<p>I've had same problem several and several times.</p> <p>After some headache and a thousand unsuccessful researches about this specific problem I've come to on answer.</p> <ol> <li>Forget having only one path</li> <li>You cant subtract without closing the path turning it into a closed polygon</li> <li>Think as havi...
Multiple integer arguments with getopt? <p>What is the best way to handle multiple integer arguments while using getopt? I have to be able to enter something like this on the command line: <code>calc -a 100 50</code> and it will add up 100 and 50.</p> <pre><code> while ((opt = getopt(argc, argv, "adms")) != -1) ...
<p>I think that the interface you're after is probably:</p> <pre><code>./program -a 100 50 </code></pre> <p>which accepts a single option <code>-a</code> (alternatives <code>-m</code>, <code>-s</code> and <code>-d</code>), and then processes the other arguments as a list of numbers, rather than as values attached to ...
Add text between patterns using AWK <p>INPUT:</p> <pre><code>Define { abcd **pattern** xyzs wedlenle jqwd sadjkjnd } Define { abcd asjdanja xyzs wedlenle jqwd sadjkjnd } Define { abcd **pattern** xyzs wedlenle jqwd sadjkjnd ADD LINE HERE } </code></pre> <p>Expe...
<pre><code>$ cat test.awk BEGIN { RS=ORS="}" } { # BELOW don't print: print: print $0 ($0 !~ /ADD LINE/ &amp;&amp; $0 ~ /PATTERN/? " ADD LINE HERE\n" :"") } </code></pre> <p>Test file:</p> <pre><code>$ cat &gt; test.txt Define { has PATTERN no add line so add it here } Def...
Error : Actual and formal argument lists differ in length? <p>I'm trying to complete the class which models an shopping cart.</p> <p>Here's my code:</p> <pre><code>public class ShoppingCart { private double price; private double subTotal; private double cart; /** * initializing variable named su...
<p>You are getting this error because the method requires a double to be passed in, but you are calling it with no parameters.</p> <p>You can change your getSubtotal method to look like this and it will simply return the value of your subtotal variable after the additions:</p> <pre><code>public double getSubtotal() {...
Laravel: how to hide blade statements? <p>I am setting variables <code>$registered</code> and <code>$paid</code> in blade. This results in the values being output being displayed. How do I hide the output? </p> <p><strong>Blade:</strong></p> <pre><code> @foreach( $user-&gt;attendees as $attendee ) {{ ...
<p>Blade is a template engine, therefore it doesn't expect you to define variables, it expects those variables to already be defined.</p> <p><code>{{ data }}</code> is equivalent to <code>&lt;?php echo data ?&gt;</code> in Blade 4 and <code>&lt;?php echo htmlentities(data) ?&gt;</code> in Blade 5. So yes, this will n...
Angular 2.0.0 Metadata_resolver weird behavior <p>I'm migrating my app from angular2 RC5 with <a href="https://github.com/preboot/angular2-webpack">angular-webpack</a> scaffolding to angular 2 2.0.0 with angular cli beta 14.</p> <p>I'm fighting with those errors: </p> <blockquote> <p>Uncaught Error: Can't resolve a...
<p>environment.ts</p> <pre><code>// Angular 2 // rc2 workaround import { enableDebugTools, disableDebugTools } from '@angular/platform-browser'; import { enableProdMode, ApplicationRef } from '@angular/core'; // Environment Providers let PROVIDERS: any[] = [ // common env directives ]; // Angular debug tools in the...
CSS Scroller Stopped <p>We have a simple image scroller on our homepage. It suddenly stopped working. I did not write the code but while hunting down the problem I noticed the HTML links to an old version of javascript, jquery-1.3.2.min.js.</p> <p>Hoping the old javascript was the problem, I downloaded jquery-3.1.0.mi...
<p>It looks like you got your <code>&lt;script&gt;</code> tag path incorrect. I replaced it with a CDN and it works.</p> <p>A the bottom of the <code>&lt;body&gt;</code> tag, </p> <p><strong>Replace:</strong></p> <pre><code>&lt;script type="text/javascript" src="js/jquery-3.1.0.min.js"&gt;&lt;/script&gt; </code></pr...
Show loading gif when DataTable has been cleared <p>I have several options for my JQuery datatable which will clear the DataTable and load new data via WebSockets. Therefore I clear the Table contents with <code>fnClearTable()</code>and a few moments later I get the new data via my WebSocket. </p> <p><strong>This can ...
<p>One way to achieve it is if you have 2 divs (I assume that your divs are properly styled to the content inside of them):</p> <pre><code>&lt;div id="profitList"&gt; your table content &lt;/div&gt; &lt;div id="profitListLoading"&gt; show loading here &lt;/div&gt; </code></pre> <p>Then in your handler:</p> <pre><cod...
Can't save PipelineModel in Spark for Decision Trees <p>While trying to save a model pipeline that comes from a pipeline with one estimator -- a decision tree -- I have this error:</p> <pre><code>Exception in thread "main" java.lang.UnsupportedOperationException: Pipeline write will fail on this Pipeline because it co...
<p>It is not a bug. It is a normal behavior if <code>PipelineModel</code> contains a stage which doesn't implement <a href="https://spark.apache.org/docs/latest/api/scala/index.html#org.apache.spark.ml.util.MLWritable" rel="nofollow"><code>MLWritable</code></a>.</p> <p>How to fix it? Update your Spark installation to ...
PHP - How to inherit parents constructor and include self destructor <p>in example I want to create a class with constructors, but it should also inherit parent's constructors. I will show you an example.</p> <pre><code>&lt;?php class Parent{ public $var1; public $var2; public function __construct($var1, $...
<p>From your sample code you can do: </p> <p> <pre><code>class Child1 extends Parent{ public $var3; public $var4; public function __construct($var1, $var2, $var3, $var4){ parent::__construct($var1, $var2); $this-&gt;var3 = $var3; $this-&gt;var4 = $var4; }; }; </code></pre> <p>...
Google maps only load the first time, second time it is gray <p>I have created an Ionic 2 / Angular 2 App. I have integrated Google Maps and it works fine. However the second time the Google Maps appears completely gray. I have searched the internet and tried different solutions to solve it. However, none of the soluti...
<p>I didn't have exactly the same issue, but something similar happen when using LeafletJS in my Ionic 2 app, and a call to their <code>invalidateSize</code> function on a small timeout fixed the issue for my app. Here's an example:</p> <pre><code>ionViewLoaded() { console.log('ObservationDetails.ionViewLoaded'); ...
Configurable port number when using Kestrel? <p>I have done the following but it still doesn't work. Running <code>dotnet myapp.dll</code> still shows it's listening <a href="http://localhost:5000" rel="nofollow">http://localhost:5000</a>.</p> <ol> <li>Create <strong>hosting.json</strong></li> </ol> <p>Code:</p> <pr...
<ol> <li><p>You need to change order: <code>.SetBasePath</code> should be called before file reading</p> <pre><code>var config = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("hosting.json", optional: true, reloadOnChange: true) .Build(); </code></pre></li> <li><p>Us...
add data in ontology with owl api using html form in eclipse <p>I am using OWL Api 3.5 in eclipse kepler with a simple ontology in Protege 4. I have uploaded an ontology from local files and add new class "clsN" in it with individual "M2". what I want is to add this class "clsN" and individual "M2" in ontology through ...
<p>The only thing missing is </p> <pre><code>m.saveOntology(o); </code></pre> <p>to save the newly added class and individual in your file.</p>
Bash "set -e" and negated return code <p>I have a shell script which checks for windows line endings. </p> <pre><code>set -e (! git ls-files | xargs grep -I $'\r') </code></pre> <p>I am using the "!" character to negate the return code of the command. Grep will return code 0 when a file with carriage return is fou...
<p>Your problem has nothing to do with <code>xargs</code>.</p> <p>The <code>-e</code> option of bash is a little tricky.</p> <blockquote> <p><strong>-e</strong> Exit immediately if a <em>pipeline</em> (which may consist of a single <em>simple command</em>), a <em>list</em>, or a <em>compound comman...
ionic 2 hide item based on navparams <p>I want to hide/show a list item on page load based on navparams, I have this code:</p> <p>HTML</p> <pre><code>&lt;button ion-item (tap)="goToPage2()" [hidden]="shouldHide"&gt;Page 2&lt;/button&gt; </code></pre> <p>TS</p> <pre><code>export class Page1 { public firstParam:an...
<p>HTML</p> <pre><code>&lt;button ion-item (tap)="goToPage2()" *ngIf="shouldHide"&gt;Page 2&lt;/button&gt; </code></pre> <p>Ts</p> <pre><code>export class Page1 { public firstParam:any; public shouldHide:boolean; constructor(public navCtrl: NavController, params: NavParams) { this.shouldHide = false; thi...
Best way to return a String as a parameter in Java <p>I frequently encounter a situation where I want to return several values from a Java method, and it's not worth creating a class/object just for that purpose. In my specific current case, I have a number of input-validation methods which compute intermediate results...
<p>The problem is your resistance to creating another class. I'm not saying your question is invalid, but if you want to return a bunch of values and your function is aware of the Single Responsibility Principle, then those values are related. Since they are related, you will have other things that want to operate on...
Pick a random weighted element, with sample, no replacement <p>Given a structure representing a reward in a loot table, where a is the reward type, and 2 is an integer weighting that means that a is twice as likely to get pulled out then d.</p> <pre><code>Map{ "a" -&gt; 2 "b" -&gt; 2 "c" -&gt; 2 "d" -&gt; 1 ...
<p>Look at <a href="https://en.wikipedia.org/wiki/Stochastic_universal_sampling" rel="nofollow">Stochastic universal sampling</a> and <a href="https://en.wikipedia.org/wiki/Fitness_proportionate_selection" rel="nofollow">Fitness proportionate selection</a>. The simple approach for taking one sample according to the wei...
System.Web.PreapplicationStartMethod Not firing ASP.NET MVC4 <p>I have used this method before in the assemblyInfo.cs folder of an asp.net mvc4 project. I am starting a new application and putting together the foundation and so far I have added ninject and log4net. </p> <p>Now I am trying to call a static method from ...
<p>I basically just created a new project and made sure the preapplicationstartmethod worked. After verification, I slowly added the additional items: areas, ninject, and log4net testing the functionality after each addition. Each time it worked fine.</p> <p>Not entirely sure what was the original problem, but the onl...
Angular2: + operator converting number types to strings <p>Can anyone explain why the '+' operator in my binding is concatenating my variables as strings, whereas other arithmetic operators such as -, * and / are correctly doing the arithmetic operations on them as numbers, which is their type in the associated typescr...
<p>Remove quotes, <code>voteCount</code> and <code>myVote</code> are interpreted as <code>string</code> when you use double quotes to assign value, even though you explicitly declared them as <code>number</code>. This should work:</p> <pre><code>&lt;ui-voter voteCount=20 myVote=0&gt;&lt;/ui-voter&gt; </code></pre> <p...
iOS: How to check FIRUser emailVerified without asking user to login again <p>Let's say, the user has already logged in on the mobile device. The user then uses a personal computer to do the email verification.</p> <p>I am aware that the next time the user logs in, the emailVerified bool will be up to date. </p> <p...
<p>I discovered there is this function for currentUser:</p> <pre><code>public func reloadWithCompletion(completion: FIRUserProfileChangeCallback?) </code></pre>
Python ImageIO Gif Set Delay Between Frames <p>I am using ImageIO: <a href="https://imageio.readthedocs.io/en/latest/userapi.html" rel="nofollow">https://imageio.readthedocs.io/en/latest/userapi.html</a> , and I want to know how to set delay between frames in a gif.</p> <p>Here are the relevant parts of my code.</p> ...
<p>Found it using <code>imageio.help("GIF")</code> you would pass in something like</p> <p><code>imageio.mimsave(args.output + '.gif', ARR_ARR, fps=$FRAMESPERSECOND)</code></p> <p>And that seems to work.</p>
Messed up project directory; do we rebase? <p>My partner and I are working on a team project. Our project directory is supposed to look like this:</p> <blockquote> <pre><code> PERSON __|____________________ | | INSERT_PERSON DELETE_PERSON </code></pre> </blockquote> <p>Where "Person" ...
<p>You have two options: the simple solution, and the rewrite-history solution.</p> <h2>The Simple Solution</h2> <p>The simplest solution is to just continue as you would have, and fix the issue after the fact. After your partner merges the "Delete Person" branch, you can do:</p> <pre><code>git checkout master # or ...
Not able to use datepipe with locale format <p>I am building website using angular2 final and webpack cli. I have requirement to display date in locale nl-NL, my html code looks like:</p> <pre><code>{{eventDate | date:'d MMMM y'}} </code></pre> <p>it displays date like:</p> <p><code>5 January 2016</code></p> <p>It ...
<p>Since RC6, there is an option to set default locale. You can do it in your <code>AppModule</code>, first you need to import <code>LOCALE_ID</code>:</p> <pre><code>import { LOCALE_ID } from '@angular/core'; </code></pre> <p>Then you can change its default <code>us-US</code> value in your module's <code>providers</c...
DB first Entity Framework query incredibly slow <p>I am new to databases, and to EF. I am using EF within an ASP.NET Core MVC project. The implementation code below is from a Controller, aiming to combine data from two tables into a summary.</p> <p>The database has tables: Batch, Doc.</p> <p>Batch has many columns, i...
<p>I think you're hitting the database once per batch. If you have many batches that is expensive. You can get all documents in one go from db.</p> <pre><code>var batchDict = batches.ToDictionary(b =&gt; b.BatchId); var documents = _context.DocTable.Where(doc =&gt; batchDict.Keys.Contains(doc.BatchId)); BatchViewModel...
git CLI commands error after upgrading to XCode 8 <p>I saw App Store reporting an upgrade to XCode 8 this morning and unfortunately, took the bait. Now, none of the git CLI commands are working. Tried searching on SO and Google but did not find anything helpful, though I did find recent posts of other issues after upgr...
<p>Looks like this is not related to XCode. I found the following after some searching: <a href="https://forums.developer.apple.com/thread/7862" rel="nofollow">https://forums.developer.apple.com/thread/7862</a></p> <p>So, libwep is used by WebSense, an application that is installed by default on all computers in the c...
ionic 2 not updating the Counter property in html <p>I have this simple example which does update the Counter value in my HomePage class.</p> <p>But in the html view:</p> <pre><code> &lt;p&gt;{{Counter}}&lt;/p&gt; </code></pre> <p>this remains zero.</p> <p>The method:</p> <pre><code> ondrag(event, item) { let...
<p>This topic was already discussed in another SO thread: <a href="http://stackoverflow.com/a/35106069/2256927">http://stackoverflow.com/a/35106069/2256927</a></p> <p>This might resolve your problem! </p>
Git Hard Reset on a single file confusion <p>I am a newbie in git and currently trying out various combinations to understand git.</p> <p>I cloned my repository which had two files. Now i made changes to one file (let's say "first.txt") and committed it to staging.</p> <p>After this step i wanted to reset the "first....
<p>Commits represent changes of entire repository. If you want to work with restoring single file to its some other version checking out and commiting is the best option. Otherwise you have to restore entire repo to its remote like this:</p> <pre><code>git reset --hard origin/master git pull origin master </code></pre...
Why do I see a "400 (Bad Request)" in my developer console when sign-in to Firebase Authentication fails? <p>I'm using the method signInWithEmailAndPassword to validate a user in my angular based application, I wrote this code:</p> <pre><code>firebase.auth().signInWithEmailAndPassword(email, password).then( functi...
<p>This HTTP request is how Firebase Authentication verifies the user credentials. The SDK/client then turns it into the error with an <code>errorCode</code> and <code>errorMessage</code> that you handle.</p> <p>You can see that if you look in the body of the response:</p> <pre><code>{ "error": { "errors": [ { ...
Transfering content of mdb tables to SQL Server repeatedly <p>I need to create a facility to enable users to repeatedly transfer the contents of tables in an <code>.mdb</code> to identically structured tables in SQL Server (emphasis on 'user' and 'repeatedly').</p> <ul> <li>I wish to avoid the 'built-in' management ...
<p>You don't need to insert the rows one by one.</p> <p>Link the SQL Server tables into Access with something like</p> <pre><code>DoCmd.TransferDatabase _ TransferType:=acLink, _ DatabaseType:="ODBC", _ DatabaseName:="your ODBC connect string", _ ObjectType:=acTable, _ Source:="dbo.Table1", _ ...
PROC TABULATE Rearrange header subgroups independent of the data <p>This is a follow up to a <a href="http://stackoverflow.com/questions/39479668/sas-proc-tabulate-rearrange-header-subgroups/">previous question</a> which considered only a single variable with two subgroups. In that question, the solution was to order ...
<p>No workaround or reinventing the wheel required - this is exactly what classdata datasets are for:</p> <pre><code>data example; input group (var1-var4) ($1. +1); datalines; 1 Y Y N Y 1 N Y N N 2 Y N Y N 2 Y Y Y N 3 N N N Y 3 N Y Y N ; run; data classtypes; do group = 1 to 3;...
Specify data to be graphed by one parameter <p>I want to be able to graph some points based on if one parameter is true in a data frame. I want to only use the position coordinates if in the "Time" column is equal to 2. How do I write this in R? </p>
<p>In the future it'd helpful to <code>dput</code> some data. The packages <code>dplyr</code> and <code>ggplot2</code> are two popular packages you might want to look into.</p> <pre><code>library(dplyr) library(ggplot2) </code></pre> <p>Create something that your data might look like:</p> <pre><code>df &lt;- data.fr...
Return the first n records per group Oracle SQL <h2>My problem</h2> <p>I want to return the top n rows per group ordered by a date in Oracle 10g</p> <h2>My table</h2> <pre><code>EMPLOYEE|START_DATE|DEPARTMENT Amy |01-02-1901|Sales Edwina |01-02-1902|Mergers Tawnee |01-02-1904|Legal Trudy |01-02-1998|Sales Ta...
<p>Consider this non-Windows function approach using a count correlated aggregate query. The idea is to run a department rank subquery and then use that in a derived table that filters outer query by this department rank. Please note your desired results do not return by ordered <code>START_DATE</code> but simply query...
How to add multiple values as an object to a single parameter in a jQuery ajax request? <p>I'm trying to add multiple values to a specific data parameter <code>'category_values'</code> when check boxes are checked. </p> <pre><code>category = [] jQuery('#rpd_filter_categ:checked').map(function() { ...
<p>Your fields all appear to have the same id (<code>rpd_filter_categ</code>) but ids should be unique so it would be better to use this as a class name.</p> <p>Using the class you could get your categories like this:</p> <pre><code>var categories = []; jQuery('.rpd_filter_categ:checked').each(function() { categori...
MAVEN - Setting Path in Redhat so the maven commands can be run from anywhere <p>I have just installed Maven on Redhat, the apache-maven-3.3.9 is located in /root/, I ran the following command to set the path (JDK java home path already set and when I type $PATH the below path does show, along with when I type mvn --ve...
<p>You need to add it to your <code>~/.profile</code> file. </p> <pre><code>export PATH=$PATH:/root/apache-maven-3.3.9/bin </code></pre> <p>so that when you exit the terminal and start a new terminal instance path is not lost</p>