input
stringlengths
51
42.3k
output
stringlengths
18
55k
How to change all negative numbers to positive python? <p>In python 3, how can we change a list of numbers (such as 4, 1, -7, 1, -3) and change all of the negative signs into positive signs?</p>
<p>I think you are looking for the <code>abs</code> <a href="https://docs.python.org/2/library/functions.html#abs" rel="nofollow">function</a>.</p>
Java Cookie in two war <p>I have two war deployed on my web server lets say A.war and B.war &amp; my web application is combination of both the war i.e A and B.war </p> <p>Now I want to generate the cookies on java side of A war services and want to get the same cookie while I m accessing serivces of B war.</p> <p>I ...
<p>Cookies by default are per domain. Normally, load balancer will be having the public URL and web servers will be behind it serving the static content. Application server like for Java will either be behind load balancer directly or through web server. So Essentially as long as all deployed applications are hosted on...
Django+heroku: django logs appear, app logs don't <p>I read all the StackOverflow answers, all the blog posts on the subject, and tried everything twice, but I still can't get my Django app's log messsages to appear in the heroku log (Django's own messages do appear).</p> <p>Can anyone please paste a full LOGGING conf...
<p>Here is a configuration that worked for me (OP):</p> <pre><code>LOGGING = { "version": 1, "disable_existing_loggers": False, 'formatters': { 'simple': { 'format': '%(levelname)s [%(name)s:%(lineno)s] %(message)s' }, }, 'handlers': { 'console': { 'l...
Warning: Illegal string offset 'enabled' in <p>We are trying to break up a form into several pages using jQuery steps. The error points to the form that we're trying to create. Call to the form initially looks like this:</p> <pre><code>$enable_paid_submission = houzez_option('enable_paid_submission'); $user_pack_id ...
<p>It looks like you are expecting the the function call to <code>houzez_option()</code> to return an array. It would seem from the error that you are getting that it is not. Without seeing what the <code>houzez_option()</code> code looks like it is impossible to tell you why it is not.</p> <p>You could still improve ...
Spring security lead to error for PUT and POST request through Ajax <p>I have a small ajax request which is lead to exeption <code>PUT http://localhost:8080/carwash/add 405 (Method Not Allowed)</code>. Can you explaim me where is a problem? </p> <p><strong>Ajax request</strong>:</p> <pre><code>$.ajax({ url: '...
<p>To make an AJAX/JSON request with CSRF enabled you have to pass CSRF token as a HTTP Request Header, not a parameter or other data.</p> <p>On the page, your meta tags should look like these:</p> <pre><code>&lt;meta name="_csrf" content="${_csrf.token}"/&gt; &lt;meta name="_csrf_header" content="${_csrf.headerName}...
How to create a DSL Groovy config file using an arbitrary Map (dynamic object) <p><strong>How do I convert an arbitrary Groovy map / list to the config style DSL syntax that Groovy provides?</strong></p> <p>Example:</p> <pre><code>def config = [ 'test': 'lalala', 'nestedObject': [ foo1: 'foo1 val', ...
<p>If you know the nested Map structure in advance, your solution will work. If you need to do this on an unknown arbitrary nested Map structure, try something like this:</p> <pre><code>import groovy.util.ConfigObject def mapToConfig mapToConfig = { Map map -&gt; map.collectEntries { k, v -&gt; v instance...
Mysql - Primary key listing in the wrong order <p>Usually do the query:</p> <pre><code>select * from table </code></pre> <p>It should be listed ordered by the primary key in ascending order, but it does not. I think it's a problem in my primary key, but have used the commands to repair and it did not work.</p>
<p>MySQL makes absolutely no guarantee about what order the data comes to you unless you provide an <code>ORDER BY</code> statement. </p> <p>For example...</p> <pre><code>SELECT * FROM foo ORDER BY id ASC; </code></pre> <p>This is the only way to guarantee that your data comes back sorted by ID. Otherwise (depending...
How to access DLL in bin folder of ASP.NET MVC project? <p>I am trying to use the following to access a DLL in the project's bin folder:</p> <pre><code> [HttpPost] public ActionResult EncryptFile() { Assembly SampleAssembly; var dllFile = new FileInfo(@".\\bin\\encr...
<p>Do</p> <pre><code>Assembly SampleAssembly = Assembly.LoadFile(Server.MapPath(@"~/bin/encrypt.dll")); </code></pre>
Applying ST_Intersection on a list of geometries <p>I'm new to postgis, so, sorry if this is a dumb question.</p> <p>I have a list of polygons in a table and I want to find the intersetion between all of them. I can do a ST_Union without problems like so:</p> <p><code>select ST_Union(t.geom) from mytable t</code></p>...
<p>You can use a <a href="https://www.postgresql.org/docs/current/static/queries-with.html" rel="nofollow"><code>WITH RECURSIVE</code> common table expression</a> to process each element of a <code>geometry[]</code> with a running result.</p> <p>Here is some example data, based on overlapped buffered random locations ...
How does the Extensible Service Proxy authenticate users? <p>We are trying to implement the authentication options outlined here:</p> <p><a href="https://cloud.google.com/endpoints/docs/authenticating-users" rel="nofollow">https://cloud.google.com/endpoints/docs/authenticating-users</a></p> <p>We are using Cloud Endp...
<p>There is a cache for JWT authentication results. I believe results are cached for 5 minutes, though this is subject to change.</p>
Python - Function Calls involving Object Inheritance <p>Suppose I have a parent class <code>foo</code> and an inheriting class <code>bar</code> defined as such:</p> <pre><code>class foo(object): def __init__(self, args): for key in args.keys(): setattr(self, key, args[key]) self.subinit() ...
<p>To answer my own question, I ran a test after adjusting the example a little:</p> <pre><code>class foo(object): def __init__(self, args): for key in args.keys(): setattr(self, key, args[key]) self.subinit() def subinit(self): pass </code></pre> <hr> <pre><code>class bar(foo): ...
toggleClass: How does this CSS work? <p>I am using the following animations (reimplemented with Ember JS), but failing to understanding how this CSS works. Refer to the link below.</p> <p><a href="https://codepen.io/designcouch/pen/Atyop" rel="nofollow">https://codepen.io/designcouch/pen/Atyop</a></p> <pre><code>#na...
<p><code>toggleClass('open')</code> adds/removes the class 'open' to the div. When 'open' is added to the div, each span element inside of the div is changed in a different way through the pseudo <code>nth-child()</code> selector. The full CSS for <code>#nav-icon3</code> is here:</p> <pre><code>/* Icon 3 */ #nav-icon...
Create pdf from html and php <p>I have researched this question on stackoverflow, but I'm confused by the answers. I've created an application in php that produces a report. I'd like for the report to be created as a pdf on a button push. </p> <p>Using google chrome and firefox manually to 'file>print as pdf' renders ...
<p>If you have time to look at server side stuff, check out <a href="http://phantomjs.org/" rel="nofollow">phantomjs</a>, can generate a PDF from html in one line using the rasterize.js example:</p> <p>e.g </p> <pre><code>phantomjs rasterize.js index.html index.pdf A4 </code></pre> <p>I normally create the HTML usin...
How can I divide a div element's content with CSS selector? <p>Let's say i have something like that:</p> <pre><code>&lt;div class="c1"&gt; BlahBlahBlah Some text that I want to fetch. &lt;br/&gt; &lt;div class="c2"&gt;something does not important.&lt;/div&gt; &lt;a href="blabla.html"&gt;a link text&lt;...
<p>Simple answer. You can't. CSS selectors target Nodes, not specific letters in some text. There are small exceptions when you consider pseudo selectors, but you can't accomplish what you want with CSS alone.</p> <p>The best advice I have is to modify the HTML and wrap the content you want to target in a <code>&lt;sp...
VBA Textbox invisible characters <p>When I put text from a spreadsheet into a form textbox the text has an extra character.</p> <p>I placed the contents of the textbox in a cell alongside the original text from a spreadsheet cell. When I do a <code>LEN()</code> function on both the original text and the textbox text, ...
<p>Excel uses <code>vbLf</code> as the <a href="http://stackoverflow.com/q/8613850/11683">line break character</a> in cells. The <code>vbCr</code> character is not used for line breaking and <a href="http://stackoverflow.com/questions/8613850/c-sharp-excel-interop-put-a-line-break-in-the-text-of-a-cell-in-a-excel#comme...
Push objects to Array in nested loop <p>I'm having difficulties sending a populated array after two nested loops has completed iterating. I'm using the Async npm library and trying to use the async.forEach completion callback to send the entire array. The inner array iterates over 5 objects, which constitutes a "course...
<p>You must nest your callbacks inside each other. With the async library, the last argument of many of the calls is the "final callback", which lets you know when everything is done. </p> <p>You're outer <code>async.forEach</code> looks good, where the final callback of <code>sendResponse</code> is the final argument...
How to determine if union case property was named by compiler <p>F# lets you optionally name union case properties. If you don't, the compiler will automatically pick a name for you during compilation (Item1...n).</p> <pre><code>type Foo = | Nothing | AutomaticallyNamed of string | Named of nameOfProperty: string </co...
<p>Quite interesting question. It turns out that the case fields are not in fact stored as a <code>System.Tuple</code>, but are compiled into standard .NET properties with a backing field on the nested class representing the union case.</p> <p>If you look at the generated code in ILSpy or similar disassembler, you'll ...
Mocha assertion error: expected {} to be a string <p>I've been beating my head all morning on this and I'm pretty sure I'm just missing something simple. It appears I'm getting a new object ({}) for a return value when I'm expecting a string, but even if I hard code a string for a return value I get the same error. <...
<p>you are not executing the function</p> <p>change </p> <p><code>expect(getUserName).to.be.a('string');</code></p> <p>to</p> <p><code>expect(getUserName()).to.be.a('string');</code></p> <p><strong>edit</strong></p> <p>I din't figure out that your are exporting an object</p> <p><code>exports.getUsername = functi...
clients connecting to TCP iterative server even after backlog queue is full <p>Here's an iterative server I've created to handle basic client-server chat application.</p> <p>I am trying to run <em>TCPserver</em> on a terminal window and <em>TCPclient</em> on multiple terminal windows.</p> <p>More than 5 the clients a...
<p>The backlog is the "queue of <em>pending</em> connections" -- once you accept a connection, it is no longer pending, and comes off the queue, leaving room for 5 more pending connections.</p> <p>If you want to limit to 5 connections, then you need to count how many you have accepted (and not closed). Any more attemp...
How can I change text in a div which has no id <p>How do I use jquery to change the text "This is the text to change"</p> <pre><code>&lt;div class="MyDiv"&gt; &lt;div&gt; This is the text to change &lt;/div&gt; &lt;/div&gt; </code></pre>
<p>You can use <code>#MyDiv &gt; div</code> selector like following.</p> <pre><code>$('#MyDiv &gt; div').text('changed text'); </code></pre>
How to pass a Value from MVC Controller to Angular .html View <p>I am using angularjs with Asp.net MVC to check the write access of a folder for users. If the user has the write access then I want to show a div which has a link. I have a Div in SampleView.Html and I have a method which checks for user's write access in...
<p>If your using angular you should make SampleView.Html a directive and inject a service that can call your mvc AccessPackerPlanTemplate method to get the information or better yet create an angular rule service that can wrap and all your rule logic and cache results.</p> <p>Step 1: create the directive to wrap DivPa...
pass test spec to another test spec <p>How would I pass one test spec to another as to continue a flow. For example say I have a success login spec, that logs into my site and says returns whether it pass. How could I pass that spec to a spec that tests my checkout process which requires you to be logged in? I'm using ...
<p>You dont have to pass any spec. What you need to do is use mocha hooks as described <a href="https://mochajs.org/" rel="nofollow">here</a></p> <p>You'll have to write login and access spec in a </p> <pre><code>before(function() { // runs before all tests in this block }); </code></pre> <p>or </p> <pre><cod...
Forcing login on phpMyAdmin using cookies <p>Hello again StackExchange users. Todays problem is a little more complex then usual for my. I am developing a web based hosting panel for a server that my company just set up and they would like to manage web pages from the internet. The rest of the control panel is working ...
<p>This sounds exactly like what the auth_type signon was designed to address. Is there a particular reason you're not using that?</p> <p>Failing that, the <a href="https://docs.phpmyadmin.net/en/latest/faq.html#which-parameters-can-i-use-in-the-url-that-starts-phpmyadmin" rel="nofollow">documentation</a> shows how yo...
Can a pure function call external function? <p>Can a pure function call an external method?</p> <p>for example:</p> <pre><code>class Dog { function jump(name) { return "a dog named " + name + " jumped!" } function jumpTwice(names) { var result = []; for (var i = 0; i &lt; 2; i++) { result.pu...
<h2>When you can</h2> <p>A pure <code>f</code> function can call any other function/method <code>g0...gn</code>. But <code>g0...gn</code> must be <strong>pure</strong> as well.</p> <h2>When you cannot</h2> <p>As soon as you get a pure function <code>f</code> and you invoke a <strong>non pure</strong> function <code>...
How to share params variables in child/parent components in Angular2 rc6 without using @Output? <p>I need to access a Params variable sent to a child component in the parent component.</p> <p>I have the following structure:</p> <p>Routing: (excerpt)</p> <pre><code> { path: 'song', component: SongExercis...
<p>You could create a shared service or use <strong>Ngrx store</strong>, inspired by Redux for Angular2. </p> <p>There you can read about it - <a href="https://gist.github.com/btroncone/a6e4347326749f938510" rel="nofollow">https://gist.github.com/btroncone/a6e4347326749f938510</a></p> <p>The advantage of this solutio...
ajax php sql without refreshing <p>I'm not familiar with ajax and I'm trying to submit a form using one PHP page and ajax so that after form is submitted/updated the page doesn't refresh completly. the php page is loaded on a div section of a parent page. </p> <p>Can someone point me in the right direction how to subm...
<p>First things first, swap to PDO, ASAP. This will save you TONS of time and can help with SQL execution time, when used correctly (You can find a quick PDO tutorial <a href="http://code.tutsplus.com/tutorials/why-you-should-be-using-phps-pdo-for-database-access--net-12059" rel="nofollow">here</a>). To answer question...
AlarmManager + Service on Idle (screen off) <p>I call my Service with alarm manager</p> <p>like this:</p> <pre><code> alarmManage.setExact(AlarmManager.RTC_WAKEUP, Calendar.getInstance().getTimeInMillis() + getPoolingInterval(), pendingIntentPolling); </code></pre> <p>On my <strong>ServicePooling</strong> i reschedu...
<p>This is a bad idea to use <code>Service</code> for <code>AlarmManager</code> nowadays. Use <code>WakefulBroadcastReceiver</code> instead. your device fall asleep then unplugged.</p> <pre><code>public class BRMine extends WakefulBroadcastReceiver { public static final String INTENT_FILTER = "com.example.BRMine";...
CORS Issue same controller, one method is ok, other one is not <p>Very strange error I'm experiencing.</p> <p>I have two methods in controller which are called by angular js http get event. </p> <p>First one works fine, second one is throwing CORS error, not sure how is that possible since both of them are in same co...
<p>Calling methods using CORS from a Web browser makes Web API being called first with an <code>OPTIONS</code> request (example <a href="https://docs.asp.net/en/latest/security/cors.html" rel="nofollow">at the end of this article</a>).</p> <p>This way, the browser <strong>knows</strong> if it can call the requested AP...
How to (re)initialize tooltip with different options depending on screen size? <p>So I'm using the tooltipster.js library for tooltips and trying to change the default distance of the tooltip on different screen sizes.</p> <p>So here is how the default init looks:</p> <pre><code> $(inputTooltipTrigger).tooltipster({...
<p>Use the <code>destroy</code> <a href="http://iamceege.github.io/tooltipster/#methods" rel="nofollow">method</a> first, then re-initialize the tooltip:</p> <pre><code>$(window).resize(function() { if ($(this).width() &gt; 641) { $(inputTooltipTrigger).tooltipster('destroy'); // no callback method, so t...
all subjects in same table in my sheetmark <p>What do I need to change from below code in order to get all the subjects in the same table?</p> <pre><code>&lt;?php include('grade.php'); $mysubject = $grade-&gt;getsubject(); ?&gt; &lt;p&gt;This is a template for a simple marketing or informational website. It in...
<blockquote> <p>i have every subject in différent table</p> </blockquote> <p>The problem is, in each iteration of <code>foreach</code> loop you're creating a new table. If you want to display all the subjects under one table, just take the <code>&lt;table&gt;</code> outside of your <code>foreach</code> loop, like t...
How to reference named column in excel VBA <p>Have a spread sheet where column A is named "Michael". I am getting the row number of the last occupied row. This code works: <code>LRow = Worksheets("Head").Range("A" &amp; Rows.Count).End(xlUp).Row</code></p> <p>This code does not work: <code>LRow = Worksheets(...
<p>You would refer to the column and row count of the range inside Cells() range object:</p> <pre><code>LRow = Cells(Range("micheal").Rows.count, Range("micheal").Column).End(xlUp).Row </code></pre>
How to using OpenStreetMap library on GitHub <p>I am a beginner in Android, and I need to import <a href="https://en.wikipedia.org/wiki/OpenStreetMap" rel="nofollow">OpenStreetMap</a> in my application. I have not found a way to do it. This is the library that I need: <a href="https://github.com/MKergall/osmbonuspack" ...
<p>First of all go to: <a href="https://github.com/osmdroid/osmdroid" rel="nofollow">https://github.com/osmdroid/osmdroid</a></p> <p>Here's an official repository of OpenStreetMap for Android. Add this to bookmark, as you would find nice <code>wiki</code> documentation and similar <code>issues</code> to future yours.<...
Android - make a button display a value on screen and playing sound correctly <p>I'm doing the Udacity's android beginner course (even thou I'm not beginner to programming) and decided to fool around a little.</p> <p>I've managed to make a button either change the value on screen (by adding +1 value) or to play a soun...
<p>It seems that you have define two ClickListeners for same button. The first one calls increment method and the second one is defined inside media player method. That listener is not required.</p> <pre><code>//Somewhere in oncreate .. Not required if xml has onclick specified Button play_button = (Button)this.findVi...
Form Closing Event <p>I have a base form class that I have my forums inherit. Is it possible to execute the code from the base form before I execute the code in the inherited forms? I have a check to see if they want to close in the base class and I want nothing to execute till they say yes to the popup form. How can I...
<p>Assuming you are already setting the e.Cancel property to true or false in the FormClosing event in your base class, you would just have to check the e.Cancel value in the inherited form:</p> <pre><code>Protected Overrides Sub OnFormClosing(e As FormClosingEventArgs) MyBase.OnFormClosing(e) If Not e.Cancel The...
How to properly assign correlated types to methods <p>I'm trying to better understand the type inferance rules and I have a contrived example that is stumping me:</p> <p><strong>The setup:</strong></p> <pre><code>interface Model{ label?: string; } interface View&lt;T&gt;{ cid?: string; model?: T; } clas...
<p>If you don't mind getting back <code>View&lt;T&gt;</code> instead of the more specific type which you pass in the generic constraint, then you can just do:</p> <pre><code>findWithModel&lt;TModel extends Model&gt;(value: TModel): View&lt;TModel&gt; { ... } let trial1 = f.findWithModel(model); // type of trail1 ...
SVG icon animation leaves a pixel gap <p>I'm working on SVG animations with CSS and I've noticed that with my line drawing animations, any SVG rect (#clipboard-border and #clipboard-clip-border) stroke always excludes a bit of the top-left corner, which makes it an incomplete rectangle.</p> <p>I've tried adjusting the...
<p>Just add <code>stroke-linecap: square;</code> to the CSS declarations for the SVG object.</p> <pre><code>svg { display: inline-block; width: 120px; margin: 3% auto; padding: 0px 100px; stroke-linecap: square; /* &lt;-- Add this */ } </code></pre> <p><strong>Example:</strong></p> <p>Here's an SVG with t...
JCombobox drop-down list is not large enough to show all items <p>When I run the application and I click on the JCombobox for the first time, the drop-down list looks like this </p> <p><a href="http://i.stack.imgur.com/PGK3x.png" rel="nofollow"><img src="http://i.stack.imgur.com/PGK3x.png" alt="enter image description...
<p>SOLVED: I was adding the JComboBox instance to the panel before adding the items to the JComboBox.</p>
Multiple copies of record shown on dgv vb.net <p>I have created a form that displays data in a dataGridView for deletion. If a user types the ID number of a record in a textbox and then clicks on a view button the dataGridView is supposed to display only one instance of the record yet mine is displaying multiple instan...
<p>Every time you click, you are running the SQL again which appends to the existing rows in the <code>DataTable</code>. Since you appear to have a persistent <code>DataSet/DataTable</code>, you dont need to run a new query.</p> <p>When/where you set those up, fill the DataSet:</p> <pre><code>Dim SQL = "SELECT a,b,c...
I don't understand this python build synax "python3 setup.py build" <p>Can someone please explain this build syntax here?</p> <pre><code>python3 setup.py build sudo python3 setup.py install </code></pre> <p>Source: <a href="http://askubuntu.com/a/406410/327339">http://askubuntu.com/a/406410/327339</a></p> <p>I just ...
<p>From my use of Python in the terminal, this command tells Python 'python3', so whatever version of Python 3.x your system is running, 'setup.py' is the Python script you're running and 'build' and 'install' are part of the distutils module to make it easier to install modules.</p>
How can I remove the hover colour from html select object? <p>I'm trying to make a simple colour picker using html/css with just four colours - so far so good.</p> <p>What's annoying me is that when you hover over an option in the dropdown, it changes to blue because of the hover state - but I can't seem to disable th...
<p>In addition to the problems you are already facing, your current design falls apart entirely when viewed on mobile. Mobile devices generally present a special UI overlay featuring the available options and a radio button for each, and in this case it's just four blank options.</p> <p>Consider instead using... radio...
Spark Kafka Receiver is not picking data from all partitions <p>I have created a Kafka topic with 5 partitions. And I am using createStream receiver API like following. But somehow only one receiver is getting the input data. Rest of receivers are not processign anything. Can you please help?</p> <pre><code>JavaPa...
<p>There is one issue with the above code. The <strong><code>kafkaTopicMap</code></strong> parameter in <strong><code>KafkaUtils.createStream</code></strong> method specify <strong><code>Map of (topic_name -&gt; numPartitions) to consume. Each partition is consumed in its own thread</code></strong>.</p> <p>Try the bel...
Generate an array of regression models without for loop <p>I have a data set with columns Y, X1, X2 and V. While Y, X1 and X2 are continuous, V is a categorical variable. Assuming V has 10 categories, I want to create 10 linear regression models and store the results (coefficients, p-values, R-Sq, etc) in another table...
<p>The base R function <code>by</code> is what you want.</p> <pre><code># make up some sample data dataSet &lt;- data.frame(Y = iris$Sepal.Length, X1 = iris$Sepal.Width, X2 = iris$Petal.Length, V = iris$Species) # apply the `lm` function by the value...
How to use pymongo command updateUser <p>How do i use pymongo command updateUser ?</p> <p>I've tried the following commands but with no success:</p> <pre><code>db.command({'updateUser': 'my_user','update':{'$set':{"pwd":"my_pwd"}}}) </code></pre> <p>And </p> <pre><code>db.command('updateUser', {"updateUser":"my_use...
<p>The python code is executing the MongoDB command "updateUser" on the database side. The command being executed in your code doesn't match the syntax shown in the <a href="https://docs.mongodb.com/manual/reference/command/updateUser/" rel="nofollow">updateUser documentation</a>.</p> <p>Try the following: </p> <pre>...
Create an external link in a comment in Asana <p>I'm trying to create a link to a document in a shared company drive. I cannot upload the document (confidentiality) to Asana servers. Also, I am not referring to a "@" + task or person type of link. I do not want to link to a workspace or a task. I am referring to a ...
<p>Unfortunately we do not support this at this time. Even if we did provide support for links, linking to local files is a security risk and so we probably wouldn't support that use case.</p>
Android- Retrofit - java.lang.NullPointerException: Attempt to invoke virtual method <p>I am trying to parse following JSON using Retrofit in android.</p> <pre><code>{ "message": false, "suggestions": false, "vehicle": { "parked": true, "uin": "15", "vin": "WBAEG1312MCB42267", "make": "Bmw", "mod...
<p>You're getting response of <code>VehicleModel</code> json from server. So replace <code>VehicleJsonResponse</code> in <code>VehicleRequestInterface</code> with <code>VehicleModel</code> and it should work as expected.</p>
Xamarin Forms: IOC in FreshMvvm <p>I am using Freshmvvm for my Xamarin forms project. I am using a camera and want to use platform specific features. So, I was wondering how can I use IOC controls to use platform specific feature. </p> <pre><code>Freshmvvm.FreshIOC.Container.Register&lt;ICamera,Camera&gt;(); </code></...
<p>I think what you're after is the <a href="https://developer.xamarin.com/guides/xamarin-forms/dependency-service/" rel="nofollow">Dependency Service</a>. This enables you to access native feature.</p> <p>This way you have to create an interface in your shared code for instance <code>ICamera</code>.</p> <pre><code>p...
bash script run Java app which uses Scanner <p>Have a shell script which compiles/executes multiple Java applications and captures the output of each app. to a file.<br><br> The script was working fine until I ran into a series of applications which require an input via the Scanner class in Java.</p> <p>One thing I th...
<p>You can override Scanner with a custom implementation that doesn't build. Example:</p> <p>Directory Structure:</p> <pre><code>/Tester.java /java/util/Scanner.java </code></pre> <p>Then, inside <code>Tester.java</code> you have:</p> <pre><code>import java.util.Scanner: class Tester { public static void ...
Angular2 Service not persisting data <p>This is my first Angular app and it's based on the <a href="https://angular.io/docs/ts/latest/tutorial/" rel="nofollow">tutorial</a>.</p> <p>I created a <code>CartService</code> to manage my shopping cart, a <code>CartComponent</code> to show in my navbar, and a <code>CartReview...
<p>All the code posted above seems to be correct (or correct enough for now).</p> <p>My trouble was that I was navigating my routes with <code>href="the-defined-route"</code>.</p> <p>The correct way is to access the <code>[routerLink]</code> directive like this:</p> <p><code>[routerLink]="['/the-defined-route']"</co...
How to change select2 multiselect control's delimiter to semi-colon? <p>I'm trying to use Select2 jQuery library on MultiSelect control. The controls works fine, but I need to change the default delimiter (separator) of values that select2 uses for Multiselect controls.</p> <p>Currently output of retrieving the value ...
<p>Since you mentioned your option values may contain commas, my original Answer will not work. Try this instead (I've added commas to your option values for demo purposes):</p> <pre><code>$("#result").text('Output: ' + $("#example1").select2("val").join(';')); </code></pre> <p><br></p> <p><div class="snippet" data...
SQL group by values stored in arrays <p>I use OrientDB. I have a table like this:</p> <pre><code> NAME | CATEGORIES ------------------- N1 | [A,B] N2 | [C] N3 | [C,A] N4 | [A,B] </code></pre> <p>And I would like to build a query that returns a list of categories, and for each category a list of re...
<p>I reproduced your structure with this command</p> <pre><code>create class test extends v create property test.name string create property test.categories embeddelist string insert into test(name,categories) values ("N1",["A","B"]),("N2",["C"]),("N3",["C","A"]),("N4",["A","B"]) </code></pre> <p><a href="http://i.s...
Android: java.lang.NoClassDefFoundError <p>I am attempting to use the JTransforms library to compute a math function (DoubleFFT_1D) in an Android app (using the latest Android Studio). I am using the .jar file provided from the JTransforms <a href="https://github.com/wendykierp/JTransforms" rel="nofollow">website</a> ...
<p>Ultimately, I found a solution. I ignored the .jar file and just compiled the source straight into the project. Procedure: - pulled the full git repository for Jtransforms, - converted it from a Maven project to a Gradle project ("gradle init"), - imported it as a module into my project and then - compiled it i...
puppet code deleted a file, instead of replacing <p>I am having issues with puppet modules, and this modules should replace <code>/etc/ssh/sshd_config</code> file based on Redhat version. So the issue is, after applying the code, puppet deleted the file, instead of replacing it.</p> <p>someone please suggest any wrong...
<pre><code>file { "/etc/ssh/sshd_config": ensure =&gt; file, &lt;----- this is missing owner =&gt; root, group =&gt; root, mode =&gt; '0644', source =&gt; "puppet:///modules/os_vul/${::sshconfigfile}", require =&gt; Package["openssh-server"], notify =&gt; Service["sshd"], } </code></pre> <p>Mig...
Time keeping table for employee clocking <p>I must make a time clocking application for employees. Every employee is identified by a ticket which is scanned when they arrive and leave the building. Unfortunately I can not know for sure if they arrive or leave because of a law(they work in underground). </p> <p>I am th...
<p>If I were to implement such task I would use a clean-up technique.</p> <p>I would go through recent data (let's say yesterday's) and remove (or mark <code>useless</code>) all suspicious rows. Later I can use a simple <code>JOIN</code> to read "arriving" and "leaving" rows as one:</p> <pre><code>SELECT * FROM Ticke...
Download an excel file from an html file in java <p>I'm using Webdriver to perform all the UI actions. I want to download an excel file on Click operation of a WebElement. The below is the html code of the application.</p> <pre><code>&lt;span class="excel ExcelLink" onclick="document.expForm.submit();"&gt;Download Exc...
<p>can u post full link to website? I think you are getting into this from wrong way. See that this element isnt anchor with href button but i suppose its form that redirects U to the file ( maybe file isn't on server just generated for download and than destroyed?). Have U tried executing onclick function??</p> <pre...
Puts and times method on numbers <p>This code:</p> <pre><code>puts 1.times { puts 2.times { puts 3.times { puts 4 } } } </code></pre> <p>Outputs this:</p> <pre><code>4 4 4 3 4 4 4 3 2 1 </code></pre> <p>I would expect Ruby to output the return value of the <code>times</code> method, but it doesn't seem to do that. ...
<p>You've got a (quasi) loop within a loop within a loop so Ruby's doing exactly what you're asking of it. The way these loops are evaluated is, generally speaking, from the inside out.</p> <p>The return value from <code>times</code> is the number given in the first place, so <code>3.times</code> returns <code>3</code...
RecyclerView with enlarged first visible item <p>I want to find solution for RecyclerView with enlarged first visible item like <a href="https://dribbble.com/shots/2951375-Swipe-cards-interaction-professional-project" rel="nofollow">here</a>.</p> <p>I started with adding ScrollListener to RecyclerView and catching IDL...
<p>It looks to me like they have a scroll listener that as it offsets in the X direction it grows by an equal number of pixels in the Y position. Then Set a minHeight and maxHeight on your image view so it never shrinks or grows passed the sizes you are looking for.</p>
For what uses Spring Boot framework? <p>What useful facilities does Spring Boot framework have, and which of these are widely applicable in practice?</p>
<p>Two best things about Spring Boot are</p> <ul> <li>It's pure Java. You can run it without XML</li> <li>Built-in tomcat app server. You can run it without setting up an app server</li> </ul> <p>So it's both correct and simple to use now. I recommend trying one of the many github examples, the one I want to recommen...
C and libappindicator - Creating multiple indicators <p>I'm programming a simple indicator that is supposed to show an icon for each CPU Core in the Unity panel, that will change color depending on the temperature range.</p> <p>That would require me to have more than one AppIndicator on the same program, since I think...
<p>That in a loop is just bad:</p> <pre><code>char IndicatorName[TEMPI_MAX_CHARS]; snprintf(IndicatorName, TEMPI_MAX_CHARS,"TempI_Core %u",i); TempI_Main.Core[i].Gtk_Menu_Root_Description=gtk_menu_item_new_with_label(IndicatorName); ... TempI_Main.Core[i].Gtk_Indicator=app_indicator_new(IndicatorName, ... </code></pre...
xslt: how to select an element from a variable <p>For an input as below:</p> <pre><code>&lt;Classes&gt; &lt;ClassOfService Cabin="Y" Status="6"&gt;S&lt;/ClassOfService&gt; &lt;ClassOfService Cabin="Y" Status="5"&gt;N&lt;/ClassOfService&gt; &lt;ClassOfService Cabin="Y" Status="1"&gt;Q&lt;/ClassOfService&gt; &lt...
<blockquote> <p>I want to get the first, in order of bottom to top, ClassOfService value which has stauts >=3.</p> </blockquote> <p>I think that "<em>first, in order of bottom to top</em>" means <em>last, in document order</em> (which is the <a href="https://www.w3.org/TR/xpath/#dt-document-order" rel="nofollow">o...
Node js insert Mysql doesnt work <p>this is part of the code i use</p> <pre><code>var insertedData = { name: 'testname', score: '1337' }; connect.query('INSERT INTO table SET ?', insertedData, function(error, result){ </code></pre> <p>and this is the error i got</p> <blockquote> <p>{ [Error: ER...
<p><code>table</code> is a reserved word in MySQL. I'd advise to rename your table to something else. If this is absolutely not a possibility for you, you can escape it with backticks:</p> <pre><code>connect.query('INSERT INTO `table` SET ?', insertedData, function(error, result){ </code></pre>
Generating ECDSA signature with Node.js/crypto <p>I have code that generates a concatenated (r-s) signature for the ECDSA signature using <code>jsrsasign</code> and a key in JWK format:</p> <pre><code>const sig = new Signature({ alg: 'SHA256withECDSA' }); sig.init(KEYUTIL.getKey(key)); sig.updateHex(dataBuffer.toStrin...
<p>The answer turns out to be that the Node <code>crypto</code> module generates ASN.1/DER signatures, while other APIs like <code>jsrsasign</code> and <code>SubtleCrypto</code> produce a “concatenated” signature. In both cases, the signature is a concatenation of <code>(r, s)</code>. The difference is that ASN.1 d...
HttpResponseMessage Compression Issue <p>I have a web application written in ASP.NET. All is working okay, except that I would like to compress the data being returned. The data is basically a List of custom models. Currently I do something like:</p> <pre><code>string json_string = new JavaScriptSerializer().Serialize...
<p>So in your code you wrote the compressed content to your <code>MemoryStream</code> but your <code>json_string</code> is still your original <code>json_string</code> which then you added that original string as response but marked it as compressed gzip format. </p> <p>So in the end Chrome tries to decode a pure stri...
Reading and parsing large files <p>I have very large file which I need to parse and read the data between the "BEGIN DATA" and "END DATA" delimiters, then do something like decoding the block. </p> <p>I can open the file easily using the "fs" library like so:</p> <pre><code> fs.readFile(files[0], 'utf8', function (e...
<p>Easiest way is to use a stream library coupled to node's <code>fs.createReadStream</code>, in your case the <code>splitBy</code> method in <a href="http://highlandjs.org/#splitBy" rel="nofollow">Highland.js</a> would be suitable:</p> <pre><code>_(fs.createReadStream(files[0], { encoding: 'utf8' })) .splitBy('----...
cloudant Java Client getDocsAs() <p>I am trying to use the Java Client API, specifically <code>getViewRequestBuilder</code> with <code>getDocAs()</code></p> <p>My Cloudant data looks like this:</p> <pre><code>{ "_id": "30984feadf2246a68d97cbeff8bf06a0", "_rev": "1-8df71f2f874f9228fffb831779063fa9", "correlation...
<p>The reason why this isn't working as you expect is because you are attempting to get the document that you have included in the view results as the an instance of <code>Email</code>. So the first thing to do is remove <code>includeDocs(true)</code> from your query.</p> <p>Next what you should be doing is typing the...
JSQMessagesViewController message view error <p>I have an app that is error-free when I run in <strong>Debug</strong> mode, but when I run it in <strong>Release</strong> mode, I get this error when the message view tries to display messages:</p> <pre><code>2016-09-14 16:17:31.305 MyApp[70800:1072070] -[_TtCs19_NSConti...
<p>It looks like the issue is in relation to the message hash of the message. Make sure that you have your message object set up correctly. In that it adheres to the</p> <blockquote> <p><code>JSQMessageData</code> protocol</p> </blockquote>
Reset Keychain in swift and IOS 10 crash <p>The problem happen on only in Xcode 8 and IOS 10. If I use XCode 8 and IOS 9 it is working perfectly.</p> <pre><code>func resetKeychain() { if !self.keychainItemData.isEmpty { let tempDict = self.dictToSecItemData(self.keychainItemData) var junk = noErr ...
<p>In your Xcode Project, go to the app target and then to Capabilities. Turn on Keychain Sharing. That should do the trick!</p>
Converting into Generic class <p>I have trouble understanding generics concept. I need to convert class DataSet into its generic form. I especially don't get what to do with the fields of DataSet. I do understand that we have to substitute all the signatures with T.</p> <pre><code>/** Computes the average of a set ...
<p>Start by asking yourself the question "This is supposed to be a set of ???". In your case, it's probably a set of a subclass of <code>Measurable</code>.</p> <p>Now that you have this, you should be able to work out where to put the generic types.</p>
Crashing android application <p>I'm using android studio I have tried to create an <code>AlertDialog</code> when button is clicked, but when I try to run, the app crash. Please show me clearly the solution.</p> <p>Ps: the Button is inside the card view.</p> <p>Main java :</p> <pre><code>public class MainActivity ext...
<pre><code> public void onClick(View v) { AlertDialog.Builder a_builder = new AlertDialog.Builder(MainActivity.this); a_builder.setCancelable(false); a_builder.setTitle("Alert !"); a_builder.setMessage("do you want to call!!!"); a_builder.setPositiveButton("Yes", new DialogInt...
Should Auth-Only Credit Card Transactions be Stored Separately from Auth-Capture Transactions in a Database? <h2>Background</h2> <p>I've built an e-commerce application that connects to Authorize.net's payment gateway. Administrators can process credit cards in the following ways:</p> <ol> <li>"Capture" transaction ...
<p>I would avoid the temptation to lose data/flexibility for the sake of simplicity; if you update the original row how would you determine the date/time of the auth &amp; capture(s) independently? How many captures were made? What were the individual auth codes and other new values returned from the gateway API for ...
Angular2 CLI issue with static resources and context <p>I have an Angular2 CLI project which has been working great. I have a page like so: <code>http://localhost:4200/home</code> and an image file here: <code>http://localhost:4200/img/myimage.jpg</code>. I would now like to change the context these are both located...
<p>Setting up <code>base href</code> using environment file using <code>Angular CLI</code></p> <p><strong>index.html</strong></p> <pre><code> &lt;base href="{{environment.path}}" /&gt; </code></pre> <p><strong>environment.ts</strong></p> <pre><code> export const environment = { ... path: '/myapp/' }; ...
Dynamically changing schema in Entity Framework Core <p>I have an issue with working with EF Core. I want to separate data for different companies in my project's database via schema-mechanism. My question is how I can change schema name in runtime? I've found <a href="http://stackoverflow.com/questions/37180426/how-to...
<p>There are a couple ways to do this:</p> <ul> <li>Build the model externally and pass it in via <code>DbContextOptionsBuilder.UseModel()</code></li> <li>Replace the <code>IModelCacheKeyFactory</code> service with one that takes the schema into account</li> </ul>
Game of Life using React-Redux <p>Currently I am working on <a href="https://www.freecodecamp.com/challenges/build-the-game-of-life" rel="nofollow">Building Game of Life in FCC</a> and I thought this would be a great project to test my knowledge on React-Redux.</p> <p>Since I am a new to Redux, I am having difficulty ...
<p>I would suggest that you make your hierarchy like this. I'm going to represent the component hierarchy as a JSON-like syntax just so that you can understand:</p> <pre><code>App (smart) { dispatchProps: { ...gameControlActions, // gets passed into GameControls onCellClick, // gets passed down to Board, and...
htaccess RewriteCond wildcard and strip <p>Example URL's:</p> <pre><code> http://domain.com/guest/book3/book21.php?title.htm http://domain.com/guest/book391/book418.php?title.htm http://domain.com/guest/book15/book1049.php?title.htm </code></pre> <p>These all need to redirect to one URL:</p> <pre><code>http://doma...
<p>You don't need to use a <code>RewriteCond</code> as you can do this in <code>RewriteRule</code> itself:</p> <pre><code>RewriteRule ^guest/book\d+/book\d+ /new/? [NC,R=301,L] </code></pre> <p><code>?</code> in the end will strip off previous query string.</p>
Lumen: Using Models without Eloquent <p>Is it possible to have Eloquent disabled in lumen bootstrap file and still use Lumen (Eloquent) Models?</p>
<p><strong>Short answer</strong>: Thanks to @El_Matella for his correct answer. It's impossible to use Lumen Models without having Eloquent enabled.</p> <p><strong>Description of problem I faced</strong>: I was unable to use lumen models while having eloquent disabled. I added a custom validator in AppServiceProvider ...
WebApi forward stream to other service <p>I have a problem with .NET Core 1.0 and WebAPI. I wanted to do simple controller that will forward data stream coming into PUT method to another REST service without any need to store this data in memory. In classic ASP.NET WebAPI there is no problem to do this using this code:...
<p>Can you try this initialized the payload inside the <code>using</code>:</p> <pre><code> public async Task Put(string id) { Stream fileContent = Request.Body; using (var handler = new HttpClientHandler() { Credentials = new NetworkCredential("XXX", "XXX") }) { using (var cl...
How to authenticate to Hadoop from command line? Removing `ls: SIMPLE authentication is not enabled` error <p>I am setting up Kerberos authentication on a Hadoop cluster. From a machine outside the cluster, whenever I do <code>hadoop fs -ls</code>, I get the following message: <code>ls: SIMPLE authentication is not en...
<p>Try below steps</p> <p><code>Server</code></p> <pre><code>kadmin.local addprinc user@realm.com </code></pre> <p><code>Client</code></p> <pre><code>kinit user@realm.com </code></pre> <p><code>klist</code> to view the principals</p>
How to read from STDIN on Hacker Rank code challenge in Ruby? <p>Just had this problem for a tech interview. Took me a good 25 minutes before I found out how to get the input for my method. The is the gist of instructions they give for how to use their platform:</p> <blockquote> <p>The first stdin will be a integer ...
<p>Just do <code>data = STDIN.read</code> for single line inputs. </p> <p>And for multi line inputs, do </p> <pre><code>STDIN.read.split("\n").each do |a| puts a end </code></pre>
How to create database if not exist in c# Winforms <p>I want to create a database if it does not exist. I am trying to do it with this code but it has errors and I get this message</p> <p><a href="http://i.stack.imgur.com/UcQLi.jpg" rel="nofollow">enter image description here</a> </p> <p>Please help.</p> <p>Code:</p...
<p>Based on this support article <a href="https://support.microsoft.com/en-us/kb/307283" rel="nofollow">https://support.microsoft.com/en-us/kb/307283</a> which has a similar database creation script I suggest removing the "CONTAINMENT = NONE" section. </p> <p>By default, all SQL Server 2012 and later databases have a ...
Getting the value of input text which is created through javascript <p>I have done an option / list box in html form in which if i click 'Other' option, it will display an additional text field. I create the additional text field through javascript. The code is as below</p> <pre><code>&lt;select name="how" class="subt...
<p>Plain JS:</p> <pre><code>var val = document.getElementById('othr').value </code></pre> <p>More info: <a href="http://stackoverflow.com/a/11563667/4669619">http://stackoverflow.com/a/11563667/4669619</a></p> <p>jQuery:</p> <pre><code>var val = = $('#othr').val(); </code></pre> <p>More info: <a href="http://stac...
Regular Expression still allowing decimal at the end <p>Hey Everyone I'm working in angular and I am trying to create a filter that just allows numbers in the format of <code>"any amount of digits . any amount of digits"</code> Otherwise is will prevent the entry if it's not in the format of <code>[0-9.]</code>. The pa...
<p>I will reference an <a href="http://www.regular-expressions.info/floatingpoint.html" rel="nofollow">article on floating point and regex</a> which was written by people way smarter than me. Here is the regex suggested there:</p> <pre><code>^[-+]?[0-9]*\.?[0-9]+$ </code></pre> <p>And an explanation - it defines...
Parsing float in java with valid characters <p>I try to make sure that a string is a valid float in java and don't want to use Regex. The very first thing that comes to my mid is either use the <code>Float.valueOf(String)</code> with is equivalent to <code>Float.parseFloat(String)</code>. These functions don't throw a...
<p>I would go with @holtc solution and convert the original string to a float (then you know it's valid in Java) and then back to string to communicate to other systems:</p> <pre><code>String originalString = "4.f"; Float floatNum = Float.parseFloat(originalString); String newString = floatNum.toString(); </code></pre...
How to make BroadcastReciever not restart when the app is closed and started? <p>I want to have an app that creates a task that runs every 2 hours when the app is started, but when I close the app and open it again my onReceive gets called.</p> <pre><code>AlarmManager alarmManager=(AlarmManager) getSystemService(Conte...
<p>Well the problem is if you're killing your Activity all variables will be crushed. That means you have to do this kind of thing in the BroadcastReceiver itself.</p> <p>you could define a new Variable in your <code>AlarmReceiver</code> class:<br /> <code>private Long LastTime = 0;</code><br /><br /> then you put thi...
Initiating Solver without the Mouse <p>Without the mouse, I can show the <code>Format Cells</code> dialog box by touching <kbd>Ctrl</kbd> + <kbd>1</kbd></p> <p>How can I show the <code>Solver Parameters</code> dialog without using the mouse ??</p> <p><a href="http://i.stack.imgur.com/nHVBU.png" rel="nofollow"><img sr...
<p>On my copy of Excel, you could use Alt-A (to get to the Data menu) and then Y2 to get to Solver. (The "Y2" part will almost certainly be dependent on what other addins are enabled.)</p>
Jenkins pipeline using upstream and downstream dependency <p>I had some jenkins standalone jobs to build, package and deploy. Now I am connecting them and making 'build' job trigger 'package' job , and 'package' job to trigger 'deploy' job and am passing the required parameters between them.I can also see them neatly i...
<p>In Jenkins context, a <a href="https://jenkins.io/doc/pipeline/" rel="nofollow">pipeline</a> is a job that defines a workflow using pipeline DSL (here, based on Groovy). A pipeline aims to define a bunch of steps (e.g. <code>build</code> + <code>package</code> + <code>deploy</code> in your case) in a single place, a...
Global install of R-packages fails <p>I am running cmd-line R (version 3.3.1) without any problem. Installing any package locally from either CRAN or GitHub (i.e. for the user running the session) is ok. </p> <p>However, in order to install pagkages globally, I use:</p> <pre><code>$ sudo su -l -c "/usr/bin/R -e \"in...
<p>Well it seems that <code>/usr/bin</code> is not in your <code>$PATH</code> when you use sudo (<code>$PATH</code> from <code>/etc/sudoers</code> is used by sudo, <code>etc/profile</code> is not loaded.). </p> <p>One workaround is to use <code>su -</code> and then execute the installation (<code>etc/profile</code> sh...
How do make a shape with 4 beveled edges <p>I'm trying to make a shape with four negatively curved corners, and I tried the radial gradients. However, only one of the corners is being applied, and I can't figure out why. <a href="https://jsfiddle.net/xiej/1Lqysaho/1/" rel="nofollow">https://jsfiddle.net/xiej/1Lqysaho/1...
<p>The last color stop of each radial gradient is covering up the rest of the square, think of them layering over each other. I'm not sure that my fix is the best way to get the shape you're looking for, but I think this will make the shape at least! I shortened the stops to end the radial gradient before it would cove...
Functions being exponentially repeated in my js file <p>I'm running a site using Node, Express and MongoDB. I generate containers after an ajax call to get the data to fill them with, and each of the containers has a button which makes another ajax call specific to a recipe it's getting detailed information on. The fi...
<p>This line:</p> <pre><code>$('.details').click(get_data_for_popover_and_display); </code></pre> <p>hooks up a <strong>new</strong> event handler on all <code>.detail</code> elements that will call <code>get_data_for_popover_and_display</code>, <strong>even if</strong> that element already has an event handler calli...
What's the proper way to dispose of a new form without it closing immediately? <p>So in my apps, I tend to create new instances of forms on the fly, then use Form.Show() to display them (non modal).</p> <pre class="lang-cs prettyprint-override"><code>private void test_click(object sender, EventArgs e) { var form =...
<p>Hmm, "code cracker" appears to be a very appropriate term for that tool, its advice certainly made you write code that breaks your program. Golden Rule is to <em>never</em> trust IDisposable advice from a static code analysis tool, none of them ever have sufficient insight in code <em>execution</em>. They can neve...
Access denied error when trying to install an extension in team foundation (2015 Update 3) on premises <p>I'm trying to install an extension by using the web access in team foundation (2015 Update 3) on premises, but it always give me an Access Denied error (either with a custom extension or one downloaded from the mar...
<p>Usually you are lacking of the permission.Try to add your user account to <strong>Build Administrator Group</strong> then try the install again.</p> <p>You can also use <a href="https://www.visualstudio.com/en-us/docs/setup-admin/command-line/tfssecurity-cmd" rel="nofollow">tfssecurity command</a> to give your acc...
reading large file and splitby method <p>I'm trying to use the <code>splitby</code> method in <code>highland.js</code> to extract the data between the begin and end delimiters.</p> <pre><code> -----BEGIN DATA----- MIIEzDCCArSgAwIBAgIVCugKYzMN5ra8zPWxYE8pUU9SxjYSMA0GCSqGSIb3DQEB CwUAMHAxCzAJBgNVB...
<p>There are really three concerns here.</p> <ol> <li>Reading the content data from files</li> <li>Extracting the delimited chunks</li> <li>Getting the resulting data out of the stream</li> </ol> <p>First you need to read the contents of each file. Note that wrapped <code>readFile</code> will emit <code>Buffers</code...
Nexus: query all timestamped versions of a snapshot version <p>I would like to query all timestamped version of a snapshot. For example, if version is 1.0-SNAPSHOT, and there are three snapshot builds (1.0-20160913.135022-1, 1.0-20160914.101629-2 and 1.0-20160914.143734-3), I would like to list all three snapshot build...
<p>Got following response from Sonatype support team that serves </p> <blockquote> <p>You can use the REST API for this. Specifically the "/service/local/repositories//content" endpoint: <code>curl -u admin:admin123 -H "Accept: application/json" http://localhost:8081/nexus/service/local/repositories/snapshots/cont...
Configuring Glimpse SQL Tab with N-Layer Architecture <p>I know it's often question regarding disabled SQL tab in Glimpse but I really can't make it work. I have N projects in Solution. Web and Database are seperated. I installed: </p> <p><strong>Glimpse, Glimpse.EF6, Glimpse.MVC, Glimpse.Ado</strong> to Web project,...
<p>Seems that problem was very stupid. I tried to test Glimpse SQL tab with Elmah and not with actual data that was posted or received. When I created View with form with simple data post SQL TAB start working.</p>
ASP.NET & Ajax - How to pass value from ajax to action? <p>I have a few checkboxes on my page. I have some jquery in place to ensure that only one checkbox is checked at a time. I have assigned a specific value to each checkbox. The below ajax finds the checkbox that is checked and I'm grabbing the value associated to ...
<p>You can pass a javascript object with name <code>PaymentID</code> ( <em>same name as your action method parameter</em>)</p> <pre><code> data: { PaymentID: PaymentID }, </code></pre> <p>You do not need to specify <code>contentType</code> as you are sending a simply object. Also you do not necessarily need to specif...
If Console class derived from object why i cant use object method on it? <p>I Read this (from MSDN):</p> <p>Inheritance Hierarchy</p> <p>System.Object</p> <p>System.Console</p> <p>But i get an error while trying to write:</p> <p>Console.Tostring(); why?</p> <p>If its derived from object it should contain object m...
<p>Actually <code>Console</code> is a static class (as you can see on <a href="https://msdn.microsoft.com/es-es/library/system.console(v=vs.110).aspx" rel="nofollow">MSDN</a>) and <code>ToString()</code> is an instance method. You can only invoke it from an instance of an Object, but you can't create instances of stati...
Order Entity Framework query by rowversion property, in store and in memory <p>Assume I have an entity in my (Code First) Entity Framework model that looks like this:</p> <pre><code>public class Foo { [Key] [MaxLength(50)] public string FooId { get; set; } [Timestamp] [ConcurrencyCheck] public byte[] Vers...
<p>I ended up implementing the solution <a href="http://stackoverflow.com/questions/39500470/order-entity-framework-query-by-rowversion-property-in-store-and-in-memory#comment66340236_39500470">jnm2 suggested</a>: writing an <code>ExpressionVisitor</code> to rewrite the query from the predicate-only overload used by no...
Encode attribute newlines in XMLEventWriter <p>I am doing some surgical XML transformations using <code>XMLEventReader</code> and <code>XMLEventWriter</code>. For the most part, I just write the events as they are read:</p> <pre><code>import javax.xml.stream.*; import javax.xml.stream.events.XMLEvent; import java.io....
<p>Well, I suggest you implement your own Writer:</p> <pre><code>public class EscappingNLWriter extends FilterWriter { public EscappingNLWriter(Writer out) {super(out);} public void write(c) { if (c=='\n') { out.write("&amp;#10;"); } else { o...
Buffered StreamWriter for writing over a long period of time <p>I've got a program that will be running over a long duration (hours), and regularly writing output to a text file.</p> <p>I'm looking to use a TextWriter implementation to write to the file, and I am concerned that keeping the file locked open during the ...
<p>Personally I would use one of the File.Appendxxx routines, which open the file, append the data and then close it again.</p> <p>If I'm writing at such a rate that the cost of all this opening and closing is too high, then I add some kind of memory-based queue and flush it periodically.</p> <p>If you're doing text-...
Error formatting a string: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.. with here string <p>I am using Powershell here-strings to format a HTML body but get the error below:</p> <pre><code>Error formatting a string: Index (zero based) must be greater than or eq...
<p>You can use variables directly into the string block:</p> <pre><code> $my_html = @" &lt;html&gt; &lt;head&gt;&lt;/head&gt; &lt;body&gt; &lt;p&gt;You have been invited to the following SharePoint site:&lt;/p&gt;&lt;a href=$url&gt;$siteTitle&lt;/a&gt; &lt;p&gt;If you are ...
Garbage Collection After System.Exit <p>I was reading about Java's garbage collection <a href="http://stackoverflow.com/questions/13126833/does-the-garbage-collector-work-on-static-variables-or-methods-in-java">here</a> and <a href="http://stackoverflow.com/questions/453023/are-static-fields-open-for-garbage-collection...
<blockquote> <p>if I were to call <code>System.exit(0)</code> right after the last employee object was inserted, when does the GC run to free up memory?</p> </blockquote> <p>When the JVM exits, it doesn't need to run its own garbage collector in order to free up memory. The operating system reclaims the process' mem...
R: adding multiple regression lines and loess curve to plot <pre><code>mod = lm(iris$Petal.Length ~ iris$Petal.Width + iris$Species) plot(iris$Petal.Length ~ iris$Petal.Width, col = iris$Species) abline(mod) </code></pre> <p><a href="http://i.stack.imgur.com/5EFZk.png" rel="nofollow"><img src="http://i.stack.imgur.com...
<p>A ggplot one-liner:</p> <pre><code>library(ggplot2) ggplot(iris, aes(Petal.Width, Petal.Length, color=Species)) + geom_point() + geom_smooth(method='lm', formula=y~x) </code></pre> <p>Leave out the arguments to <code>geom_smooth()</code> and you would get the LOESS line. However, the data here are so scant that t...