input
stringlengths
51
42.3k
output
stringlengths
18
55k
EF6 code first add-migration creates unusual migration but application runs <p>I'm using EF6 in VS2015 and have many, many successful migrations as I have been developing - until now. I made a change to a table to specify the foreign key and ran add-migration. I was surprised to see that not only was the change I expe...
<p><a href="https://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.maxlengthattribute(v=vs.110).aspx" rel="nofollow">MaxLengthAttribute</a> doesn't have <code>[AttributeUsage (Inherited = True)]</code> annotation, so it is ignored at inherited classes, as you suggested. At this case you should r...
Navigate Between Activities (Android Studio) <p>I got a problem when I navigate between two activities, it shows me error and I don't know what is the problem. I am very sure that my code is correct, because it just simple Intent navigate by on click Button. </p> <p>When I Press the button to go to the next activity i...
<p>Something you have wants to to find a refwrence to that ripple component, you need to find out what. </p> <p>Otherwise, you can try to make sure you have added a reference to the support.v7.widget in the second activity and see if the exception goes away.</p> <p>Aside from that, we would need to see more code to h...
How can I make the FigureCanvas fill the entire Figure in a matplotlib widget embedded in a pyqt GUI? <p>I have attempted to make a GUI with embedded matplotlib widget in it. I just need the figure to be completely filled by the FigureCanvas, I have tried about 100 different things and nothing has changed the size of t...
<p>I figured it out after continued studying. I had made a mess early on in the project and had failed to carefully reread my code when changing the initial design. The issue was that I was creating a canvas widget and passing that widget to the MplWidget. The MplWidget correctly had its own canvas, and therefor did no...
multiplying 2 zoo series in R <p>The below is a small extract of the whole data, I have thousands of symbols over many years. . .both symbols and date range change from run to run</p> <p>I have 2 zoo series "returns" and "decFac".</p> <pre><code> &gt; tail(returns) AAPL DISCA I...
<p>zoo and xts objects will be aligned by index before operations:</p> <pre><code>library(xts) time = seq.Date(as.Date('2014-12-23'), as.Date('2014-12-31'), by = 'day') time = time[c(1,2,4,7:9)] AAPL = c( -0.0035479832, -0.0047206092, 0.0175226064, -0.0007020609, -0.0122776892, -0.0192020576 ) DISCA = c...
Java EE - Can't connect to database via JDBC at IntelliJ <p>I'm having problems trying to connect to a PostgreSQL database via JDBC in a Java EE web application. The same code that I'll show <strong>works</strong> on <em>Netbeans</em> and <em>Eclipse</em>, but not on IntelliJ.</p> <p>My Java EE application have the fo...
<p>This is not how you connect to a database in a Java EE application.</p> <p>Typically, you would have code that looks something like:</p> <pre><code> public class SomeService { @Resource(name="java:global/jdbc/myDataSource") private DataSource ds; public String performSomeQuery(...) { ...
Reliable Services seem to deactivate <p>I'm running into slowness in my stateful services that haven't had activity in awhile. It seems that the first call after some period of inactivity is incredibly slow (10+seconds). Subsequent calls do not suffer this problem. This seems to be a classic case of a service deacti...
<p>Service Fabric doesn't do anything in terms of deactivating or putting services to sleep. Let's look at what a running named instance of a Reliable Service written in C# on Windows really <em>is</em>:</p> <ul> <li>A .NET object instance running inside a process.</li> </ul> <p>That's all. Service Fabric won't shut ...
Using @Html.Raw and I see some border around my table <p>Service gives me signature value containing HTML tags like </p> <p><code>&lt;html&gt;&lt;body&gt;..</code></p> <p>I need to display this on UI and the best way as far as I know is <code>@Html.Raw</code>. I am working on a confidential project that's why I need ...
<p>It looks like browser-default styling of a :focus (or maybe :active?) selector. Try a different browser for comparison and/or try adding <code>:focus {outline: none;}</code> to your CSS.</p> <p><a href="https://css-tricks.com/almanac/selectors/f/focus/" rel="nofollow">https://css-tricks.com/almanac/selectors/f/foc...
Apple rejected an app that for use on non public api where there aren't any non pulic apis <p>This is the message I got from Apple for rejecting my app:</p> <blockquote> <p>Your app uses or references the following non-public APIs:</p> <p>didDetermineState:forRegion:<br> didEnterRegion:<br> didExitReg...
<p>I think the public apis you are mentioning about are those in <a href="https://developer.apple.com/reference/corelocation/cllocationmanagerdelegate?language=objc" rel="nofollow">CLLocationManagerDelegate</a>. If it is the case, take <code>didEnterRegion:</code>, for example, the api is actually <code>locationManager...
Proving for all elements of a list in coq <p>How can I prove that H and my goal are same for all elements of the list?</p> <pre><code>X : Type P : X -&gt; Prop l : list X H : forall n : X, ~ (In n l /\ ~ P n) ______________________________________(1/1) forall b : X, In b l -&gt; P b </code></pre> <p>The two statement...
<p>First of all, we need some imports:</p> <pre><code>Require Import Coq.Logic.Classical_Prop. Require Import Coq.Lists.List. </code></pre> <p>We reason "backwards" when applying lemmas to the goal. This means you need a lemma that has implication as its consequent, <em>not</em> premiss.</p> <p>We can <code>Search (...
In Apache Spark Scala, how to fill Vectors.dense in DataFrame from CSV? <p>world,</p> <p>I am new to spark.</p> <p>I noticed this online example:</p> <p><a href="http://spark.apache.org/docs/latest/ml-pipeline.html" rel="nofollow">http://spark.apache.org/docs/latest/ml-pipeline.html</a></p> <p>I am curious about th...
<p>The answer: Yes, it is possible</p> <p>If the CSV is on HDFS, you can use spark-csv to read it: <a href="http://www.sparktutorials.net/opening-csv-files-in-apache-spark---the-spark-data-sources-api-and-spark-csv" rel="nofollow">example</a>, or of its on the normal filesystem you can just read if with plain scala : ...
Client side cache busting using the CLI <p>We're using the <code>aurelia-cli</code>. The tasks include these: </p> <pre><code>build.json build.ts process-css.ts process-markup.ts process-sass.ts run.json run.ts test.json test.ts transpile.ts </code></pre> <p>How if at all do we do a cache-busting solution the with cl...
<h1>0.20.0 Support</h1> <p>It's my lucky day. <a href="https://github.com/aurelia/cli/releases/tag/0.20.0" rel="nofollow">An <code>aurelia-cli</code> release from 8 hours</a> ago says this: </p> <blockquote> <p>Features: Support bundle revision numbers</p> </blockquote> <h1>Walkthru</h1> <p>First, install 0.20.0 ...
MYSQL passing string into IN operator not working in nodejs <p>by right <code>SELECT topicFollowed FROM User WHERE id = 10000)</code> return "[0,2]" &lt;&lt;-string</p> <p>but when i execute <code>SELECT * from News WHERE topicId IN (SELECT topicFollowed FROM User WHERE id = 10000)</code> only 0 is pass in and 2 is n...
<p>Your <code>IN</code> list consists of <em>exactly</em> one item, a string of the form <code>'[0,2]'</code>. If that is what <code>topicId</code> looks like, then your query will work.</p> <p>In other words, you have a problem with your data structure. You shouldn't be storing lists of things in strings. The prop...
Display values in ListView using ObjectDataProvider <p>Hello all i'm trying to find out why my <code>ListView</code> is loading in blank.</p> <p>i've made a <code>ObjectDataProvider</code> that load from my controller a list of <code>Articulos</code> in a <code>DataTable</code></p> <p><strong>TrabajarArticulos.cs</st...
<p>It really depends on your <code>TrabajarArticulos</code> implementation . Here's some working sample code:</p> <p><strong>XAML:</strong></p> <pre><code>&lt;Window x:Class="WpfApplication286.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/w...
J2EE - Services Layer Design <p>I´m going to build Restful Services Layer (Middleware) using Java/Spring/Eclipse. The goal of the service layer is exposing tons methods, that today exists in different systems.</p> <p>The Middleware will have the standar layers for each Functional Unit, for example:</p> <ul> <li>User...
<p>I'd go with a micro services approach - breaking it down by functional units. Whether you use EARs or WARs depends on what application server you are deploying to. But since you specifically mentioned restful service endpoints, multiple web applications, each application exposing specific business functions would su...
docker-compose on windows directory sync <p>Running the <a href="https://docs.docker.com/compose/django/" rel="nofollow">django tutorial for docker compose</a>, but the command to init the django project is not working as expected.</p> <pre><code>$ docker-compose run web django-admin.py startproject composeexample . [...
<p>The fix was to uninstall Windows 10 and install a *nix system. The files then appear as per the tutorial.</p> <pre><code>~/docker/django-test $ ll total 60 drwxr-xr-x 4096 Sep 24 00:47 ./ drwxr-xr-x 4096 Sep 24 00:40 ../ drwxr-xr-x 4096 Sep 24 00:47 composeexample/ -rw-r--r-- 209 Sep 24 00:41 docker-compose.ym...
Error : The program 'django-admin' is currently not installed <p>But it is installed, coz when I run </p> <p><code>python -m django --version</code></p> <p>it shows </p> <p><code>1.10.1</code>.</p> <p>But when I try to start some project <code>django-admin startproject mysite</code> or check the version with <code>...
<p>Reinstall django:</p> <pre><code>sudo apt-get purge python-django sudo pip uninstall django sudo apt-get install python-django sudo pip install django --upgrade </code></pre> <p>Also you can use <a href="https://virtualenv.pypa.io/en/stable/" rel="nofollow">virtualenv</a> and <a href="https://virtualenvwrapper...
restoring mongo database from dump <p>I am not able to get the correct command to issue in order to restore a mongodb from a dump dir.<br> Any idea what is wrong and how to fix it? Thanks</p> <pre class="lang-js prettyprint-override"><code>appParent$ ls dir1 dir2 dump appParent$ ls dump/ meteor appParent$ mongores...
<p>Apart from the <code>-d</code> (database) parameter I think you may need to explicitly send the final <code>path</code> argument</p> <p>So the command would be (considering you are in the folder containing the <code>dump</code> folder):</p> <p><code>$ mongorestore --maintainInsertionOrder -h 127.0.0.1 --port 3001 ...
Check if image is binary <p>I tried to convert an image <code>jpg</code> file to binary image, I mean, only B&amp;W colors.</p> <p>I run <code>convert -monochromatic in.jpg out.jpg</code> and the result is visually satisfactory. </p> <p>Then I tried to check if the image really contains only B&amp;W colors. So I run ...
<p><a href="https://en.wikipedia.org/wiki/Monochromatic_color" rel="nofollow">Monochromatic colors</a> are all the colors (tints, tones, and shades) of a single hue. So monochromatic does not mean binary image.</p> <p>You convert a colored image to a binary image using thresholding and obviously you need to give a thr...
Android mysterious margin in some listview item <p>I'm writing a common listview with some custom views. Nothing is so special about it.</p> <p>But when I run this in my galaxy s7, a mysterious horizontal spacing is created in the center of the custom item view. </p> <p>Here is an abstract version of the custom item ...
<p>I found the solution. It wans't actually about anything special. It was about the nine-patch chat bubble which caused the issue.</p>
Clear textbox when tap RFID card? <p>I got 2 RFID cards, with different values e.g 123 and 456. When I click on <code>textbox1</code>, and then tap the first card into a machine, the <code>textbox1.text</code> will give me a text of 123. </p> <p>The question is how can I clear the first card value when I tap the secon...
<p>Bar-code scanners or such devices usually send key strokes. So you can handle <code>KeyPress</code> event of <code>TextBox</code> and check if the length of <code>Text</code> is the specific length which you expect, then clear the <code>Text</code>:</p> <pre><code>private void textBox1_KeyPress(object sender, KeyPr...
First Unique Character in a String <p>Given a string, find the first non-repeating character in it and return its index. If it doesn't exist, return -1.</p> <pre><code>first_unique('leetcode') # 0 first_unique('loveleetcode') # 2 </code></pre> <p>I came up with the following solution. How can I make it more effici...
<p>My solution uses <code>Counter</code> form the <code>collections</code> module.</p> <pre><code>from collections import Counter def first_unique(s): c = Counter(s) for i in range(len(s)): if c[s[i]] == 1: return i return -1 </code></pre>
I am getting path not found error but the path correct <p>When i run this script i am getting this error path not found in</p> <pre><code>Set objFolder = objFso.GetFolder (strpath) </code></pre> <p>Can anyone help what to change in the code?. My path was correct, but it keeps giving me this error.</p>
<p>Maybe the folder doesn't exist or you don't have access? Can you try putting \doc\DavWWWRoot\RegulationandCorpComms\Regulation and Corp Comms Library\Corp Comms\External Press Monitoring\2016 into the address bar of Windows Explorer and make sure you can navigate to the folder (and that it exists).</p>
Filtering content with select form options <p>Im developing a WordPress Theme i need filter content using a form with three selector, for example i've Region, Specialist, Place</p> <p>When user select one value from Region -> Specialist -> Place, user can see content from these three values selected</p> <ul> <li>If R...
<p>As you want to display data to your user according to drop down selection where all terms are separate in word press admin (no hierarchy)</p> <p>I suggest you to use Ajax functionality in which put one blank below all drop down with unique class/id on page load.</p> <p>Pass all selected value of drop down (term i...
FirebaseUI: fatal error: unexpectedly found nil while unwrapping an Optional value Using Storyboards and UI Label <p>While using FirebaseUI, I am attempting to implement a custom cell for my data from firebase. I would like to have a few custom labels in the cell like so: </p> <p><a href="http://i.stack.imgur.com/Egfm...
<p>Okay. So while trying for a while I figured it out.</p> <p>You need to set the dataSource by <code>self.dataSource = FirebaseCollectionViewDataSource(ref: self.firebaseRef, prototypeReuseIdentifier: reuseIdentifier, view: self.collectionView!)</code></p> <p>The one with the <strong>prototypeReuseIdentifier</strong...
.htaccess redirection rule to redirect similar URLs with different structure <p>I need to rewrite a rule in a .htaccess. I have users coming from google to my old site links that doesn't exist anymore.</p> <p>Old site:</p> <pre><code>oldsite.com/search/pdf/harry-potter-reviews </code></pre> <p>I need to redirect to:...
<p>For a more general approach you could use something like</p> <pre><code>RedirectMatch "^/search/pdf/docs/(.*)" "http://newsite.com/search/docs/$1" </code></pre> <p>or for your specific case</p> <pre><code>Redirect 301 "/search/pdf/harry-potter-reviews" "http://newsite.com/search/docs/harry+potter+reviews" </code>...
My JavaFx app perfomes quite slowly <p>I am doing a JavaFx project which is connected to documentum data storage . Recently I've noticed that at some specific points it performs quite slowly . Once it starts running it retrieves some data from documentum which is fairly fast considering the volume of data and creates ...
<p>Anything that has not to do with <code>JavaFX Thread</code> be done on an external <code>Thread</code>,especially database query stuff.</p> <blockquote> <p>Example structure of JavaFX Service<a href="https://docs.oracle.com/javafx/2/threads/jfxpub-threads.htm" rel="nofollow">[tutorial]</a>(<strong>the below is an...
Underlining repeated words in VB <p>Homework, I need to create a program that works like <a href="http://typeracer.com/" rel="nofollow">http://typeracer.com/</a>.</p> <p>Heres what I've done so far:</p> <pre><code>Dim strContent As String = "the texts the text the text" Dim arrNum As Integer = 0 Private Sub Form1_Lo...
<p>It doesn't get underlined because you have it set to Bold the text, not underline it. And I would imagine if you put a breakpoint at Timer1_Tick, you wouldn't hit it because you haven't started the timer; you need to enable the timer if it isn't already, and start it.</p> <p>Add this to Form1_Load</p> <pre><code>T...
Duplicate file differences when creating a patch with TortoiseSVN <p>I have an already existing SVN checked-in branch. <br><br> Using <em>TortoiseSVN</em>: </p> <ol> <li>I used <strong>SVN Checkout</strong> to get the branch onto my local computer.</li> <li>I merged a few lines of code into existing projects</li> <li...
<p>After conversing with many of my peers, I realized that I wasn't the only one to encounter the issue. When I asked them how they got around it, they informed me that they hand-edit the diffs when it occurs for them.</p> <p>So I wrote a simple GUI tool to do this for us, both the code and executable can be downloade...
Passing an ID thru a Request Laravel <p>What I want is to pass the logged on users id </p> <p>ArticleRequest.php <pre><code> namespace App\Http\Requests; use App\Http\Requests\Request; class ArticleRequest extends Request { /** * Determine if the user is authorized to make this re...
<p>Combine the <code>user_id</code> with the request params:</p> <pre><code>Article::create(['user_id' =&gt; \Auth::user()-&gt;id] + $request-&gt;all()); </code></pre> <p>Or if you have relationships set up:</p> <pre><code>Auth::user()-&gt;articles()-&gt;create($request-&gt;all()); </code></pre>
why 'abc'.indexOf([]) === 0? <p>I'm try to get an string index of another value</p> <pre><code>let index = 'any string'.indexOf([]); console.log(index); // 0 </code></pre> <p>Why the index value is <code>0</code>?</p>
<p><code>String.prototype.indexOf</code> converts any object, given as a search pattern, to a string. </p> <p>String representation of <code>[]</code> is <code>''</code> (empty string).<br> If you apply <code>indexOf('')</code> to any string, it will return 0. </p> <p><div class="snippet" data-lang="js" data-hid...
Angular 2 hide parent element on click on close button <p>I am new in Angular2, I want to hide parent element after clicking on the close icon. Below is my code:</p> <pre><code>@Component({ selector: 'add-search', template: ` &lt;input type='text' #newHero (keyup.enter)="addHero(newHero.value)" ...
<pre><code>&lt;div [hidden]="hero.hideElement" style="margin-right:2px" *ngFor="let hero of heroes" class="label label-primary"&gt;{{hero}} &lt;span (click)="hero.hideElement=!hero.hideElement" style='cursor:pointer; display:inline-block; padding:1px 2px;'&gt; &lt;i clas...
elasticsearch range aggregation with fixed buckets values <p>I need to create an aggregation, like "range" but I need to specify the "where" clause of each bucket.</p> <p>For example if we aggregate on an "age" field, what range agg offer is:</p> <ul> <li>bucket 1: to 10</li> <li>bucket 2: from 10 to 50</li> <li>buck...
<p>Only the first bucket would cause an issue since the range is discontinued, but all the other ones can be specified easily with a <code>from/to</code> constraint in <code>range</code> buckets. I suggest something like this:</p> <pre><code>{ "aggs" : { "age_ranges" : { "range" : { ...
C# RESTSharp client connect Drupal Rest_server Access denied for user anonymous <p>I was search this article <a href="http://stackoverflow.com/questions/39567883/consuming-drupal-restapi-with-c-sharp/39610884#39610884">Consuming Drupal RestApi with c#</a> And <a href="http://tylerfrankenstein.com/code/drupal-services-c...
<p>yes,I found the key,restful has bug at the request.addheader(cookie,cookie); change to :request.AddParameter(session_name,session_id,parametertype.cookie);</p>
Avoid NodeJS module "require" duplications <p>I have multiple NodeJS files in a <code>/libs</code> folders, for example:</p> <p><code>math.js</code>, <code>restapi.js</code>, <code>auth.js</code>, <code>push.js</code></p> <p>whereas <code>math.js</code> is the class that provides basic math functionalities and all th...
<p>auth.js</p> <pre><code>var math = require ('./math.js'); function A(){ return math.fooA(); } function B(){ return math.fooB(); } function C(){ return math.fooC(); } </code></pre>
what should printf("%.17g\n", .1) print? <p>I've often used the command-line program "printf" to test/predict what the C stdio library function will do.</p> <p>But I've recently found that doesn't work (any more?)-- at least on a recent linux/ubuntu release, the command-line printf (both the bash builtin and /usr/bin/...
<p>Following is about C in general and may/may not apply to <code>bash</code> or <code>posix</code> specifications.</p> <p><code>printf(" %.17f\n", .1)</code> is <em>expected</em> to print at least <code>DBL_DECIMAL_DIG</code> correct <em>significant digits</em>. <code>DBL_DECIMAL_DIG</code> is the precision guarant...
get last data query from calculate and group by <p>i am trying to make trial balance with general ledger data , the results of the trial balance in the can from the last calculation based debit-credit account name, and then group by based on each account name</p> <p>GEneral ledger : Kas : </p> <pre><code>Account | ...
<pre><code> sselect s.account, case when s.saldo &gt; 0 then s.saldo else 0 end as debet , case when s.saldo &lt; 0 then s.saldo * -1 else 0 end as kredit from ( select account, sum(case when debet &lt;&gt; 0 then debet else kredit * -1 end) saldo from generalledger group by account ) s wh...
How to stop an imageView loading a remote image? <p>Is there a way to tell an imageView to stop loading a remote image?</p> <p>This would be an image loaded with the image property of an imageView</p>
<p>I figured it out by setting the imageView.image = null;</p>
.htaccess replace question marks and slashes from URL <p>I'm trying to do this by using .htaccess</p> <p>Redirect: <code>http://example.com/en/signup?type=something</code></p> <p>To: <code>http://example.com/snapshots/en_signup_type=something.html</code></p> <p>Basically, convert all slashes and question marks to un...
<p>I found out how to do, there are actually a few more steps than I thought.</p> <ol> <li>Replace all slashes with underscores, <code>RewriteRule ^(.*)\/(.*)$ $1_$2 [R=301,L]</code>, based on the number of slashes we have, it will redirect the same amount of times, one redirection will convert one slash to one unders...
Querying data from AngularFire2 with combinelatest <p>I could achieve some filtering behaviour with my question <a href="http://stackoverflow.com/questions/39624799/querying-subset-from-angularfire2">querying subset from angularfire2</a>. Now I want to display these values as a list in Angular using ngFor. In my ts fil...
<p>Might be worth it to build out a sub component that takes an <code>animalId</code> which will then go fetch animal information for you, and then display it. That way you can reuse it in other places. Also you won't have to build out crazy switchMaps or some other complex Observable patterns to solve all in one go.</...
JQuery UI Selectmenu change fires on click <p>I have a selectmenu with custom rendering. Subsequent clicks will change the selected value to the first option (the unwanted behavior). In the code snippet, the initial selected value is "2", which is the 5th option. Click and select another option (not the first one), so...
<p>It appears you were following <a href="http://jqueryui.com/selectmenu/#custom_render" rel="nofollow">this example</a>. It was the lack of <code>wrapper</code> in your code that was creating the issue.</p> <p>When rendering, it was applying the wrapper to each <code>span</code> in your <code>li</code> element. So th...
Python multiprocessing lock strange behavior <p>I notice a behaviour in my code that I cannot explain. This is the code:</p> <pre><code>import multiprocessing from collections import deque LOCK = multiprocessing.Lock() data = deque(['apple', 'orange', 'melon']) def f(*args): with LOCK: data.rotate() ...
<p>As Tim Peters commented, the problem is not the <code>Lock</code> but that the <code>deque</code> is not shared across the processes but every process will have their own copy.</p> <p>There are some data structures provided by the <code>multiprocessing</code> module which will be shared across processes, e.g. <a hr...
Angular JS comment directive does not function properly <p>The following code does not seem to print the text out from the directive defined: </p> <pre><code>&lt;div ng-app="myApp"&gt; &lt;!-- directive: devComment --&gt; &lt;/div&gt; &lt;script&gt; app.directive("devComment", function(){ ...
<p>You've just got the wrong format for the directive name within your template. It should be</p> <pre><code>&lt;!-- directive: dev-comment --&gt; </code></pre> <p><em>(ed: actually, I just tested this and for comment directives, the name normalisation does not seem to happen so the real problem was no root element)<...
regex - merge repeated consecutive words preserving last space <p>I have a string like this</p> <p><code>{{TAG}} {{TAG}}{{TAG}} {{TAG}} some other text. {{TAG}} {{TAG}}</code></p> <p>and I am trying to merge multiple consecutive occurrences of <code>{{TAG}}</code> into one. So I have this regex <code>re.sub(r'(({{TAG...
<p>One simple way is that instead of <code>+</code> you can split the regex into two as</p> <pre><code>&gt;&gt;&gt; re.sub(r'(?:{{TAG}}\s*)*{{TAG}}', r'{{TAG}}', string) '{{TAG}} some other text. {{TAG}}' </code></pre> <ul> <li><p><code>(?:{{TAG}}\s*)*</code> Matches zero or more <code>{{TAG}}</code> with space at th...
why SELECT query cannot come first and then EDIT query <p>this web app is a table with member data and if I click edit, it will link to edit page that has selected the member data already so it should be SELECT first</p> <p>but why SELECT query cannot write first and then write EDIT query. I try to move the SELECT ...
<pre><code>Try this code public function editMember($id) { $sql = "SELECT * FROM member WHERE id = $id"; //SELECT $rs = $this-&gt;db-&gt;query($sql); //UPDATE if($this-&gt;input-&gt;post("btn") != null) { $arr = array( "name" =&gt; $this-&gt;input-&gt;post('member_name'...
pillow image TypeError: an integer is required (got type tuple) <p>I am a bit lost as to why this is happening any help would be greatly appreciated. So I am trying to take the median value of images and create a new image from them, but when trying to make newpix take in the values of my red green and blue median pixe...
<p>Problem is at the lines</p> <pre><code> red = z.getpixel((x,y)) blue = z.getpixel((x,y)) green = z.getpixel((x,y)) redPixels.append(red) greenPixels.append(green) bluePixels.append(blue) </code></pre> <p><code>red = z.getpixel((x,y))</code> will get all R,G,B data a...
Is it better to access directly resource.resx instead of ResourceManager? <p>I know two methods to get string from resource files.</p> <p>Method 1: Directly access.</p> <pre><code>string str = _NAMESPACE.Properties.Resources.HelloWorld; </code></pre> <p>Method 2: Via ResourceManager.</p> <pre><code>ResourceManager ...
<p>I believe the first method is better because when you use the second method you are creating a new instance of the resource manager which I would think is an unnecessary use of memory.</p> <p>Edit*</p> <p>After reading this article: <a href="https://msdn.microsoft.com/en-us/library/7k989cfy(v=vs.90).aspx" rel="nof...
searching a string and finding content of adjacent column <p>I have an excel sheet named "indications" in the same directory where the excel sheet "tool" which contains my macros are there. The excel sheet indications have around 400 rows and 20 columns of data.</p> <p>I have a macro that will take a string input from...
<p>For a <code>lookat:=xlWhole</code> match in a single column, I prefer the <a href="https://msdn.microsoft.com/en-us/library/office/ff194565.aspx" rel="nofollow">Excel Application object</a> use of the <a href="https://support.office.com/en-us/article/match-function-0600e189-9f3c-4e4f-98c1-943a0eb427ca" rel="nofollow...
cannot access child value Newtonsoft Json <p>I want to parse following string , bellow is my code , and below is my string</p> <pre><code> string jsn = Convert.ToString( @"{ 'TaxProfile':{'id':258658,'IncomeTypeStatus':[{'IncomeType':'0001','Statu...
<p>Your code looks like (I've removed code not related to exception and formatted JSON string): </p> <pre><code>var jsn = Convert.ToString( @"{ 'TaxProfile': { 'id': 258658, 'IncomeTypeStatus': [ { 'IncomeType': '0001', 'StatusCodeDesc': 'Ready Fo...
weirdly if else compares wrongly <pre><code>$comet = $this-&gt;model-&gt;getActiveComet($userId); $string = 'notificationComet'; if ($comet !== $string) { echo $comet; echo $string; echo "yes";exit; } </code></pre> <p>as shown in the code above, only if value of <code>$comet</code> doesn't match <code>$...
<p>Try to use the following...</p> <pre><code>$comet = $this-&gt;model-&gt;getActiveComet($userId); $string = 'notificationComet'; if ( strpos($comet,$string) === FALSE ) { echo $comet; echo $string; echo "yes";exit; } </code></pre> <p>I believe that would work.</p>
CSS Menu changes <p>I built this in Drupal8 using a Zymphonies theme, and was able to do almost everything I wanted, except for a few CSS things I can't figure out. The site is <a href="http://dev-astro-mktg.pantheonsite.io/" rel="nofollow">here</a>, and I need:</p> <ul> <li>To get rid of the white 1px border around t...
<p>Set your <code>border: 1px solid #a8a8a8;</code> to <code>border: 1px solid black;</code> to fix your first issue, that's in your custom-media.css file on line 40:</p> <pre><code> .menu-base-theme ul { border: 1px solid #a8a8a8; padding: 0; background-color: #fff; background: rgba(255, 255, 255, 0.7...
propagating a value from one route to another in flask <p>So, I am very new to flask and front end programming..</p> <p>I have a form: like this</p> <pre><code>&lt;form action="{{ url_for('search') }}" method="post"&gt; Showing values for: &lt;input type="text" name="name" value={{ name }} disabled&gt;&lt;br&g...
<p>Probably because you're missing quotes around the <code>value</code> for the first <code>input</code>.</p> <p>Also disabled inputs won't be passed, <a href="http://stackoverflow.com/questions/1355728/values-of-disabled-inputs-will-not-be-submited">values of disabled inputs will not be submited?</a></p>
Need to calculate count of child table rows based on same key between Master and Child table <p>Looking for some optimize query to get "Count" (same occurrence of MastId of @tblMaster table into @tblChild table.</p> <pre><code>Declare @tblMaster Table (MastId INT, MastDesc VARCHAR(10)) Insert Into @tblMaster Values(1...
<pre><code>select mastid,mastdesc,count(*) as cnt from master m join child c on c.mastid=m.mastid group by m.mastid,m.mastdesc </code></pre> <p>Update based on comment :</p> <p>100 K records is not very big deal,Group by can perform well if your data is indexed correctly..</p> <p>Say for example,if you have Primary...
How do I make my apk file android unity3d compatible with all android devices on google play <p>My apk file Supported devices only 12869 . Is their any way I can get more like 400,000 devices something like that. I am only doing this for android devices on google play.</p>
<p>The distibution of the versions of Android are reported on the <a href="https://developer.android.com/about/dashboards/index.html" rel="nofollow">Android Dashboard</a>. The Minimum API Level property in the Android Player Settings in the Unity Editor should be set to the lowest possible API level that your applicat...
Unable to delete 90 days older data from mysql via shell script <p>Below shell script : <strong>error choose 3 1,2 it's OK but mysql delete success. shell script can't delete</strong></p> <pre><code>#!/bin/bash selection= until [ "$selection" = "0" ]; do echo "==============================" echo "=========PR...
<p>Your script with errors. But you can user mysql script only, quite easy. If you need to delete row, older(newer) than 90 days:</p> <pre><code>SELECT STR_TO_DATE(CONCAT(DATE_FORMAT(now(),'%Y-%m-%d'),'-1'),'%Y-%m- %d')-INTERVAL 90 DAY; </code></pre> <p>Please check result, should by date you need. If not, correct ...
JS: How to find out who caused the window.onbeforeunload(): F5 or submit? <p>I work on a small web app and I need to show confirm dialog after user refreshes his browser. I do it using <code>window.onbeforeunload = function() { ...}</code>. The problem is that it is invoked not only on refreshes but after submits as we...
<p>You can write event handlers for various events that would navigate you away from the page and have an identifier to manage state. Then you can use this identifier in onbeforepageunload function to do whatever action you want to perform. Here is a code example that looks for input type submit and sets the identifier...
how to do on uncheck checkbox doesnot delete all <p>hello my function doesnot delete all one checkbox remains checked as i uncheked it but there is no effect on that i need help </p> <p>here is my code</p> <pre><code>if(array_key_exists('assigned_ids',$this-&gt;input-&gt;post())){ $select_assigned_ids = $this-&g...
<p>May be the problem is on your sql query</p> <pre><code>if ($this-&gt;input-&gt;post()) { $select_assigned_ids = $this-&gt;input-&gt;post('assigned_ids[]'); /* delete previous entries for user_id */ $q = 'Delete from section_permissions where section_id = 0 '; $this-&gt;section_permission_model-&gt;...
How can I pass variables to function from onClick in Meteor/React? <p>I have some code like so </p> <pre><code>goToEvent() { FlowRouter.go('/event/${id}'); } return ( {e.users.map( (id) =&gt; { &lt;ListItem key={id} primaryText="Event" onClick={this.goToEvent.bind(this)} /&gt; })} ); </code></pre> <p>I'm u...
<p>For react the solution is </p> <pre><code>return ( {e.users.map( (id) =&gt; { &lt;ListItem key={id} primaryText="Event" onClick={this.goToEvent.bind(this, id)} /&gt; })} ); </code></pre>
Import CSV file onto JTable <p>Trying to import a csv file onto my Jtable without using a CSV reader. Any Advise on how to approach this? </p> <pre><code>table = new JTable(); table.setModel(new DefaultTableModel( new Object[][] { }, new String[] { "ID", "Cou...
<p>try something like this:</p> <pre><code> import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.util.ArrayList; import java.util.List; import javax.swing.JTable; import javax.swing.table.DefaultTableModel; public class Test { public Test() { try { Buff...
CefSharp-WPF : Application is not rendered in other PC <p>I am new on CefSharp so I followed the <a href="http://www.codeproject.com/Articles/881315/Display-HTML-in-WPF-and-CefSharp-Tutorial-Part" rel="nofollow">first tutorial</a> of CefSharp-WPF that was made me creating a new application. </p> <p>However when I copi...
<p>It was address problem. I have added ti host as that domain but it is not real domain. </p>
How can I scroll programmatically a div in Angular 2 pages? <p>I have link top like:</p> <pre><code>&lt;a href="#scroll"&gt;Test&lt;/a&gt; </code></pre> <p>Onclick this i want to scroll page to div which contains id scroll</p> <pre><code>&lt;div id="#scroll"&gt;Testing scrolling in Angualar 2&lt;/div&gt; </code></pr...
<p>try this <a href="http://stackoverflow.com/questions/36468318/tracking-scroll-position-and-notifying-other-components-about-it-angular2">post</a> when you are on div, must transmit a signal to angular.</p>
Why does google.com page has six input element in the HTML source? <p>I was just inspecting the source HTML for <code>www.google.com</code> and I found out that they have multiple <code>&lt;input&gt;</code> fields. I am just curious that if anyone can tell my why do they do it? </p>
<p>Might contain certain server generated codes. Most of those input are hidden.</p>
How can i access array of objects which is my instance variable from a non static method? <p>My program is giving me null pointer even if my constructor has instantiated the array of object. Why am I getting the exception? Here is my code: when the main method runs the comparison line, it gives me a null pointer except...
<p>You get a <code>NullPointerException</code> because the <strong>global instance array</strong> is not initialized in the constructor. You have declared <code>std[]</code> in the class but in the constructor, you have declared a <strong>new</strong> array, which is a <strong>local</strong> array, of type <code>MPL</c...
All asm labels becoming symbols in executable file <p>When assembling an object using <code>nasm</code>, I'm finding that all labels are included as symbols in the resultant <code>.o</code> file, as well as the final binary.</p> <p>This makes sense for function entry points that I've declared <code>GLOBAL</code>, and ...
<p>As far as I can tell, it's just a limitation in nasm. See for example <a href="https://forum.nasm.us/index.php?topic=1951.0" rel="nofollow">this forum post</a> where the poster has approximately the same issue (although 32-bit rather than 64-bit ELF), and no solution is provided other than using a stripping tool.</p...
doGet() cannot get any data from model <p>I have a simple servlet app. In the servlet class, <code>doPost()</code> and <code>doGet()</code> basically get the same data from model class, however, <code>doGet()</code> cannot get any data.</p> <pre><code>public class ClickerServlet extends HttpServlet { ClickerModel...
<p>I my understanding, that you place the doGet() method in Results servlet, not same as Submit one.</p> <p>Submit Servlet:</p> <pre><code>@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String answer = request.ge...
How to count number of times word is repeated in C++ <p>Hi I am having some trouble with this code. </p>
<p>The best way to count unique words is to use <code>std::unordered_map&lt;std::string, int&gt;</code> and then increment values in the map: <code>wordMap[word]++;</code> Note that if this is the first occurrence of the word, default value would be created and it is 0, which suits the task well.</p> <p>Beside this, i...
Is there any limit to sell app from app store? <p>I am developing an iOS app and i want to sell that app to certain amount for example 100$ so is there any limit to sell or no limit and i want to sell products from my app so i am using in app Purchase so here also is there any limit can any one please answer me waitin...
<p>There are a couple of points apple wants you to keep in mind before you go for selling through in app purchase.</p> <ol> <li>It should be a digital content that you give away or unlock for the user upon purchase like the full content of your app, or more levels in a game, more ammunition, subscription to the appsto...
This is the Error : The model item passed into the dictionary is of type 'PagedList.PagedList`1[abcd.Models.xyz]' <h2>//The Controler looks like this :-</h2> <pre><code>namespace BusRentalSystem.Controllers { public class LocationsController : Controller { private RentalData db = new RentalData(); ...
<p>Your model is excepting</p> <pre><code>@model PagedList.IPagedList&lt;BusRentalSystem.Models.Location&gt; </code></pre> <p>Changing your view code to say this instead should fix it:</p> <pre><code>@model PagedList.IPagedList&lt;BusRentalSystem.Models.Location&gt; </code></pre>
Android Studio: Adding @+id through Design GUI Generates Errors <p><em>I have found a workaround for this, which I will be posting as an answer, but it still raises the question of why it happened in the first place.</em></p> <p>When I try to add a new id through the Design GUI, I type the name into the box:</p> <pre...
<p>Looking in the xml, the <code>@+id/</code> actually gets added <em>to the <code>@+id/id_sample</code></em>:</p> <pre><code>android:id=@+id/@+id/id_sample </code></pre> <p>which obviously gives the compiler a heart attack. Having figured out what was going on, it is easy (though tedious) enough to jump into the xml...
UiPath trigger on distributed systems <p>I want to use a trigger to start an automation project, that I have developed and it works on a single machine. I now want to roll that out company wide. Does each machine in the company need the robot service running on each desktop? Therefore each desktop needs a robot license...
<p>Yes, you need a Robot license on each machine where you want to run your automation. </p>
java printing nothing instead of 0 <pre><code> // Binomial Expansions String the_x, the_y; System.out.println("Binomial Expansions:"); for(int i=0; i&lt;=max; i++){ num = 1; r = i+1; xpow=i; ypow=0; System.out.print("(x + y)^"+i+" = "...
<p>Try this.</p> <pre><code>static String power(String v, int p) { switch (p) { case 0: return "1"; case 1: return v; default: return v + "^" + p; } } static String mult(int k, String... terms) { if (k == 0) return "0"; String r = "" + k; for (String t : terms) { if (t....
Find css class after parent div <p>there is any jquery which is find class after parent div, I am using class "trapezoid-two" and make jquery code but that create issue, so can any one tel me how to find css after parent div class('ban-menu1').</p> <p>HTML:-</p> <pre><code>&lt;div class="col-md-2 nopadding"&gt; &...
<p><code>ban-menu1</code> is a sibling of <code>.trapezoid-two</code> use <code>prev()</code> to help you add a class to it</p> <pre><code>$(document).ready(function(){ // svg path change $( ".trapezoid-two" ).hover( function() { $(this).find('path').attr('d','M0,0 L100,0 L100,100 L0,100z'); $(this).prev()...
is there any way to fetch data on same page in codeigniter <p>I am stuck in this code,please help me.</p> <pre><code>&lt;div class="box box-info"&gt; &lt;div class="box-header with-border"&gt; &lt;a href='admin_dashboard.php?option=borrow' class='btn btn-danger'&gt;borrow detail&lt;/a&gt;||&lt;a href='d...
<p>From what i understand i guess you need to convert your posted <code>php</code> code to <code>codeigniter</code>.Here is how you can do it:</p> <pre><code>$option = $this-&gt;input-&gt;get('option')?$this-&gt;input-&gt;get('option'):""; if($option=='borrow') { $this-&gt;load-&gt;view('borrow_detail.php'); ...
How to use pipe in ts not HTML <p>I adding text into html element from ts</p> <p>like this</p> <pre><code>this.legend.append('text') .attr('x', legendRectSize + legendSpacing) .attr('y', legendRectSize - legendSpacing) .text(function(d) { return d; }); </code></pre> <p>this will create html like </p> <pre><co...
<p>If Pipename is your custom pipe then if you want to use the same in your ts file then you can use below code</p> <pre><code>import {Pipename} from './pipename'; Pipename.prototype.transform(arguments);//this is how u can use your custom pipe </code></pre>
Trying to understand node.js callback when the function normally doesn't expect any parameters? <p>I am trying to work with node.js and node-java and trying to get my head wrapped around some concepts, and in particular how to write async method calls.</p> <p>I think that, for a function in Java, myclass.x():</p> <p>...
<p>If calling the method with one parameter and a callback is:</p> <pre><code>myclass.x(abc, function(err, data) { // ... }); </code></pre> <p>Then calling a method with only a callback would be:</p> <pre><code>myclass.x(function(err, data) { // ... }); </code></pre> <p>The <code>function(err, data) { }</code> ...
unable to display same page with error message in spring mvc <p>the idea is simple If my login fails user will be redirected to <code>/loginerror</code> but is not working as excepted</p> <p><strong>LoginController</strong></p> <pre><code> @RequestMapping(value = "/login", method = RequestMethod.GET) public S...
<p>the version of spring you are using does not support <code>&lt;form action="&lt;c:url value= "/j_spring_security_check"&gt;&lt;/c:url&gt;" method="post"&gt;</code> use /login as url instead <code>&lt;form action="&lt;c:url value= "/login"&gt;&lt;/c:url&gt;" method="post"&gt;</code> since you asked this link clear...
Uncaught TypeError: Cannot read property 'cities' of undefined [Geocomplete] <p>I am using this plugin in Rails but still have a problem with error in title.</p> <p>Definition of script:</p> <pre><code>script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=MY_API_KEY&amp;libraries=places&amp;se...
<p>You should also add the <code>jquery.geocomplete.js</code> script inorder to make the geo-complete work.</p> <p>Scripts:</p> <pre><code>&lt;script src="http://maps.googleapis.com/maps/api/js?libraries=places"&gt;&lt;/script&gt; &lt;script src="jquery.geocomplete.js"&gt;&lt;/script&gt; </code></pre> <p>You should ...
How to make a blur effect like the background like 3D touch <p>I need make a blur effect of my custom view, and just look like the same with 3D touch.</p> <p>PS: I didn't find the UIVisualEffectView support this effect.Our system only support three UIBlurEffectStyle,which are not the same with 3D touch. </p> <p>this ...
<p>Please add following code for backgroundView of customView...</p> <pre><code> UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight];// you have a list of options for UIBlurEffectStyle UIVisualEffectView *blurEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect]; blurE...
Cron job is not working in Godaddy cPanel? <p>I am using <code>Godaddy cPanel</code> and I want to <strong>run</strong> <code>crone_page.php</code> page <strong>once a day</strong>. And in this page I have added PHP email code and PDO insert query. I have created cron job using below command with common setting 0(M) 0(...
<p>Try to setup following cron in your account and check this again.</p> <pre><code>/usr/bin/php -q /home/user_name/public_html/folder_name/crone_page.php </code></pre>
Firebase retrieve data dynamically <h1>Question</h1> <p> I am trying to display data from my firebase depending on what day of the week it is. My firebase children have the title of 1,2,3,4,5,6,7 for the days of the isoWeek with a value of random words. My question is, how do I retrieve just mondays data if its monday...
<p>Yes this is definitely achievable!</p> <p>Try: <code>child.val()[variable]</code> </p> <p>In javascript, we can access an object's properties by either using dots or brackets. For example, <code>object.property</code> or <code>object["property"]</code>. </p> <p>Again, in your case, to access the firebase element ...
How to create a ssh key for a user using data bags in Chef <p>All,</p> <p>I have a user that I am creating using recipe in Chef. How can I create a ssh key for the user using data bags in chef.</p> <p>the recipe in default.rb is,</p> <pre><code>user "abc" do home "/home/abc" action[:create] mode 775 </code></p...
<p>The <code>user</code> resource only manages creating a user, as in the <code>/etc/passwd</code> entry. For managing ancillary stuff like SSH keys or sudo configurations you would need additional code. There are some community cookbooks that help with this, but you would have to evaluate if they meet your needs. User...
Git HEAD referring to branch vs to commit <p>According to <a href="https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell" rel="nofollow">Pro Git Book</a>:</p> <blockquote> <p>In Git, HEAD is a pointer to the local branch you’re currently on.</p> </blockquote> <p>This is consistent with <a href="http...
<p>The good definition is that HEAD is always pointing to what is check-outed. </p> <p>If you are working on a branch, it is pointing to this branch. So, when you check out another branch, HEAD is now pointing to this new branch. </p> <p>But you could also check out directly a commit, just to verify how things were i...
Elasticsearch - query building - is this the correct way of doing it? <p>I have a document which looks like this:</p> <pre><code>{ "foo": { "orgnr": "1" }, "bar": { "orgnr" : "2" }, "created": "2015-02-12", ... } </code></pre> <p>I have an API where a user can query for:</p> <ul> <li>orgnr (req...
<p>A <a href="https://www.elastic.co/guide/en/elasticsearch/reference/2.4/query-dsl-bool-query.html" rel="nofollow">bool query in filter context</a> is a fine way of doing it. The Should requires at least one clause to match.</p> <pre><code>POST _search { "query": { "constant_score": { "filter": { ...
Trying to create a crude send/receive through TCP in python <p>So far I can send files to my "fileserver" and retrieve files from there as well. But i can't do both at the same time. I have to comment out one of the other threads for them to work. As you will see in my code.</p> <p>SERVER CODE </p> <pre class="lang-p...
<p>On the serverside, you're trying to use the same connection for your two threads t and u.</p> <p>I think it might work if you listened for another connection in your <code>while True:</code> loop on the server, after you started your first thread.</p> <p>I always use the more high-level <code>socketserver</code> m...
Start and stop postgreSQL service through java code <p>I have one requirement where I need to start and stop postgreSQL service through java code. I have written below code but I am getting below error:</p> <pre><code> System error 5 has occurred. Access is denied. System error 5 has occurred. Access...
<p>In java there is a option to run windows cmd as administrator</p> <p>replace your code "<code>commands.add("cmd.exe");</code>" with below code and try</p> <pre><code>commands.add("runas /profile /user:ADMINUSERNAME \"cmd.exe"); </code></pre>
How to edit source codes on Yocto project, and rebuild it? <p>I'm new at Yocto project.</p> <p>The problem is rebuilding with source editing.</p> <p>The flow which I tried is below.</p> <ol> <li><p>Build Yocto Project ( bitbake core-image-weston )</p></li> <li><p>After building, I edited weston source code. ( build/...
<p>After recompiling the the package, you should also rerun the build of the image. Then the changes should be included:</p> <pre><code>bitbake -c compile -f weston bitbake core-image-weston </code></pre>
How to make a loading screen? <p>I'm writing UWP app. I downloading <code>JSON</code>, deserialize it and bind it.</p> <p>Here is code:</p> <pre><code>public async void Down() { WritingToTable wrt = new WritingToTable(); wrt.Writing(); RestAPI rest = new RestAPI("http://simplegames.com.ua/wp-json/wc/v1/"...
<p>There are plenty of ways you can create a loading screen in UWP. It all depends on what you want to achieve. From your question I understand that your goal is to block user interaction with the app while data is being loaded and show a UI that notifies the user about the loading operation.</p> <p>The simplest way ...
trouble taking image from USB cameras of same brand C# AFroge.net <p>I am trying to take images from 3 usb cameras of same brand. I am using AForge.net c# to do so. But my code is taking images from the last camera that i attached ignoring first 2. I tried to get the Ids of the camera and found this</p> <pre><code>@de...
<p>As far as I know the AForge-lib only works with devices that support DirectShow. Are your cameras of the same brand/type? </p>
Collect Images from Local Server(Acquia Dev Desktop) <p>I am try to collect data and images from local server (Acquia Dev Desktop) using this Angular Js code</p> <p><strong>controller</strong></p> <pre><code>var app = angular.module('App', []); app.controller('Ctrl', function($scope, $http) { $scope.images = [];...
<p>Well, sending HTML elements in a JSON doesn't seem good to but, anyway if you cannot change it...</p> <p>For my part, I would parse the html string with the built-in XML parser.</p> <p>Here is the code taken from <a href="http://stackoverflow.com/a/8412989/1153988">this answer</a></p> <p><div class="snippet" data...
Gradle gives NullPointerException when building project in Android Studio <p>Please may someone help me fix this <code>Gradle</code> (2.14.1) <code>NullPointerException</code> error that has started popping up in my Android Studio (2.2) after it crashed. I'm a newbie, so I don't know how to deal with this.</p> <p>I've...
<p>Nothing I tried on the Android Studio/SDK side worked.</p> <p>So I had to do the manual route. I:</p> <ul> <li>went to the <code>AndroidStudioProjects</code> directory and manually changed the name (just added "-backup" to the end of the directory name);</li> <li>made a new project in Android Studio with the origi...
Escape special characters while sourcing a file <p>I have a file with the following contents - </p> <pre><code>a=hello b='hi' c=['hi', 'hello'] </code></pre> <p>I want to source the contents of the file. But I get the following error - </p> <p><code>-bash: hello]: command not found</code></p> <p>How do I escape the...
<h3>Version 1: No bash arrays</h3> <p>I think what you are looking for is the <code>declare</code> command. For example, with your definitions in the file <code>file</code>:</p> <pre><code>$ cat file a=hello b='hi' c=['hi', 'hello'] </code></pre> <p>Let's run <code>declare</code> on each line of your file:</p> <pr...
Regex to validate Email IDs Fails? <p>We are using <code>regex</code> to validate Emails. But it seems like it is failing for <strong>abcd@q.com</strong> this Email ID. Can anyone please advise what is wrong in the given regex?</p> <p><strong>Regular Expression:</strong> </p> <pre><code>string sPattern = "^\\w+[\\w\\...
<pre><code>\w+([\\w\\-]*\\w+ </code></pre> <p>In this part, you want, between the <code>@</code> and the <code>.</code></p> <ul> <li>at least one alphanumeric char => <code>w+</code> </li> <li>0 or more alphanumeric char or <code>-</code> => <code>[\\w\\-]</code>*</li> <li>at least one alphanumeric char => <code>w+</...
How to secure grails API that uses Azure with Oauth? <p>I am new to grails and Azure. I have a grails API that uploads and downloads documents to Azure blob storage. The API is used by consumers who need to be authenticated using Oauth 2.0. I found a grails plugin <a href="https://grails.org/plugin/spring-security-oaut...
<p>We are using <a href="http://grails.org/plugin/spring-security-core" rel="nofollow">Spring Security Core Plugin</a> and <a href="https://grails.org/plugin/spring-security-oauth2-provider" rel="nofollow">OAuth2 Provider</a> to secure <code>Grails API</code>. It will secure the API's, by restricting access to authoriz...
Dependency conflict in pentaho data integration when an external jar is called from UDJC step <p>I have a spring project which is deployed in libext folder in Pentaho Data Integration and called from "User Defined Java Class" step. I get a <code>java.lang.NoSuchMethodError: org.springframework.jdbc.core.namedparam.Name...
<p>In addition to placing the jar file into /libext, you will also need to modify /launcher/launcher.properties to look for user defined libraries in libext. It will take effect on the next restart of Spoon.</p> <pre><code>libraries=../test:../lib:../libswt:../libext classpath=../:../ui:../ui/images:../lib:../libext <...
Hangfire with multiple servers <p>I am working on an application where I have multiple servers on different machines doing long operations for me. There is a windows service running on those machines written with hangfire/topshelf. Only one operation can run at a time per machine. Additionally I want to do some status ...
<p>If your task is to run some scheduled task on each server, I think, the best option is to implement it yourself, Hangfire don't support events handling, only command handling. I think, you reached the point of Hangfire possibilities and need to switch to more powerful and general tool.</p> <p>For events and their h...
error messages on implicit conversion to value classes <p>Define a method which accepts types: List[_ &lt;: AnyVal]</p> <pre><code>def foo(x : List[_ &lt;: AnyVal]) = x </code></pre> <p>Try to use an AnyRef:</p> <pre><code>foo(List(new Test)) error: type mismatch; found : Test required: AnyVal Note that implic...
<p>To answer your second question first. Try this:</p> <pre><code>class Temp implicit class Arrow[T](a:T) extends Temp{ def --&gt;[B](b:B) = (a,b) } def foo(x : List[_ &lt;: Temp]) = x scala&gt; foo(List(1 --&gt; 2)) res0: List[Temp] = List(Arrow@2e17a321) </code></pre> <p>This works as expected. It is not co...
What is the Java equivalent for C# `Interlocked.Exchange(Object, Object) : Object`? <p>What is the Java equivalent for C# <code>Interlocked.Exchange(Object, Object) : Object</code>? Is there a way in Java to perform the following actions in a single atomic step <em>without lock</em>: 1) store locally the reference of a...
<p>There's no operation to do this for an arbitrary variable, as far as I'm aware... but this is what the <a href="http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/AtomicReference.html"><code>AtomicReference</code></a> type is for:</p> <pre><code>private AtomicReference&lt;String&gt; stringReferenc...
How to give the user to create dynamic data? <p>I work in c# ,.Net 4.5.2 , WPF, Win7.</p> <p>I have a big list of class A. Class A contains 50~ different properties. I want the user to be able to choose 2 properties from the class, in order to create a graph which the first property is the X value and the second is th...
<p>here is a example (not yet tested)</p> <pre><code> List&lt;A&gt; yourData = new List&lt;A&gt;(); System.Reflection.PropertyInfo[] properties = typeof(A).GetProperties() .Where(x =&gt; x.PropertyType == typeof(double)) //do a sanity check if property is double .ToArray(); ...
How include git branch name in apk file name automatically <p>I'm looking for a way to include the <em>git branch name</em> into my android apk file name upon building it.</p> <p>I would like to name my apk file "ProjectName-<em>git branchname</em>.apk, automatically upon building it. "</p> <p>Example: "MyTestProject...
<p><a class='doc-link' href="http://stackoverflow.com/documentation/android/95/gradle-for-android/11578/changing-output-apk-name-and-add-version-name#t=201609230704044133176">This documentation topic</a> shows how to change .apk file name. <br><a href="http://stackoverflow.com/a/21016461/6507689">This stackoverflow pos...
Android: How to change specific name of the generated apk file in Android Studio? <p>By default IDE genarate a apk like <code>app-debug.apk</code> or <code>app-release.apk</code> file but I need to generate specific name of the <strong>Apk</strong> of the App.</p>
<p><strong>Step 1:</strong> Go to root of the main project, under <strong>app</strong> , right click on app and refactor the app into specific name (example iPlanter) and press okay then go to step 2 </p> <p><strong>Step 2:</strong> Go to Project Setting file which is <strong>setting.gradle file</strong> </p> <p>sett...
vis.js library is too big, how to get the part for timeline chart only <p>vis.js library is 1.6mb and minified file is 610k which is still too big. It takes quite a long time to download the library file to users' machine, especially for slow network connection. </p> <p>Currently I build timeline chart only by using t...
<p>As a alternative to building it yourself, there is a minified module that just contains the graph 2D and timeline modules, which is only 299KB. It is provided in the vis.js zip distribution as <code>vis-timeline-graph2d.min.js</code>. </p> <p>That is available in CDNJS: <a href="https://cdnjs.com/libraries/vis" rel...