input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
JNI: UnsatisfiedLinkError <p>I'm trying to test out some JNI code integrating a Java class with some ROS functionality and I'm struggling to get the Java methods linked up correctly. I've got the native code compiled against the JNI interface correctly (or so I think) but at runtime I get an <code>UnsatisifiedLinkError... | <p>I have no clue why but refactoring the above code slightly caused it to work. If I take the native methods out of the main classand put them in a separate class (thus removing the static modifier on the native methods) which is invoked by the main class, it all links and works fine. I'm not certain nor do I even hav... |
Ordering clauses of a left join <p>I'm trying to join some tables with a query like below. Because I want to get the c.name ideally that the b table refers to. If the b table doesn't have rows in the result set or the b row doesn't refer to c, then just get the c.name that a table refers to.</p>
<pre><code>SELECT a.*,... | <p>I think this should help:</p>
<pre><code>SELECT a.*, c.name
FROM a
LEFT JOIN b ON a.b_id = b.id
LEFT JOIN c ON c.id = COALESCE(b.c_id, a.c_id)
</code></pre>
<p>When <code>b.c_id</code> is NULL, then <code>a.c_id</code> will be used. Otherwise <code>b.c_id</code> will be used. </p>
<p>It's not about speed. <cod... |
Stop Yii2 Pjax Gridview from changing base URL for pagination when using action button <p>I am adapting <a href="http://www.gdomc.com/0512/yii2-pjax-gridview-action-buttons-issue/" rel="nofollow">this code</a>. It is a Yii2 Gridview with Pjax and action buttons. When I press the delete button, the pjax loads the delete... | <p>So the problem was that the demo/delete route was sending a 500 error back to PJAX. When I added a null check on the model that was being deleted, the project started working fine.</p>
|
CSS two columns 100% width with same height (a square) <p>Hi i'm trying to create a gridview with two columns with square elements (same width same height dinanicaly,height depend on the width of screen) .This is a working example but the two columns dont cover all the width. Any idea how to do this?</p>
<p><div class... | <p>When you use <code>width: 40vw;</code>, they take 40% of the window's width which is 80% each row, so it is expected to leaving another 20% is blank.</p>
<p>What you need is using a <code>width: 50%;</code> that makes 2 boxes will fill the full 100%, <strong>but</strong> since they are also having a <code>margin: 2... |
SAS Teradata ODBC timestamp <p>I'm trying to make my SAS Teradata query a little more efficient.
I can get the where timestamp filter in the outer nest to work but it doesnt work when i try to place it in the inner nest. I know i'm overlooking something really simple. Thanks for the help!</p>
<pre><code>SELECT *
FR... | <p>When using pass through, you need to 'pass through' valid syntax for the underlying database. In this case you are looking for:</p>
<pre><code>proc sql;
SELECT *
FROM CONNECTION TO ODBC
(
SELECT name, ID, timestamp
FROM TD.table
WHERE ... |
What is untrackOutstandingTimeouts setting for in Protractor? <p>In the Protractor reference configuration, there is the <a href="https://github.com/angular/protractor/blob/9144494a28dac5a0409de4c5384e933f2d2f8156/docs/referenceConf.js#L303"><code>untrackOutstandingTimeouts</code> setting</a> mentioned:</p>
<pre><code... | <p>The outstanding timeouts are tracked so that the Protractor errors can report them. You won't get timeout information in your errors if you turn this off. </p>
<p>You might need to turn it off, however, if you decorate your <code>$timeout</code> object (for whatever reason you need to decorate it for), since Protra... |
Ignite Local Entries and Spilled to Disk Entries <p>For apache Ignite, when a key-value cache is spilled to disk is it spilled a key at a time or will it spill part of the value to disk?</p>
<p>In addition, for IgniteCache.localentries() will that automatically read all the values from disk or is there a way to traver... | <p>Eviction happens on per-entry basis. E.g., you can't remove only half of the value from memory.</p>
<p>As for <code>localEntries</code> method, its behavior depends on provided <code>CachePeekMode</code>(s). For example, to get entries from all storage layers, call it like this:</p>
<pre><code>cache.localEntries(C... |
How do I return only those searched records whose isActive property is true? <p>In an ember app and I'm trying to return records that match the search term and isActive equals true. The search part works, I just can't get the isActive true to work with the rest of it.</p>
<pre><code>filterDecks(search) {
if (search... | <p>you can include <code>isActive</code> condition along with searchterm.</p>
<pre><code>let decks = this.store.peekAll('deck').filter((item) => {
let title = (item.get('title') || '').toLowerCase();
let description = (item.get('description') || '').toLowerCase();
let tags = (item.get('tags') || []).toS... |
Getting value from json object in jquery ajax call and replacing div content with a property from the object <p>I'm working on a website that, among other things, have items with prices that are pulled from "outside" on controller level.
Controller then returns the Json object to the Ajax complete function and one of t... | <p>First of all <code>complete</code> is a property of your settings object of your ajax call, not an event on the xhr object.</p>
<p>This should work fine.</p>
<pre><code>$.ajax({
type: "GET",
url: "@Url.Action("GetPrice", "YourControllerNameHere")",
data: { Id: id, Exterior: exterior }, ... |
Complete example of Polymer Two Way Binding <p>The polymer documentation has the following two way binding example:</p>
<pre><code> <script>
Polymer({
is: 'custom-element',
properties: {
someProp: {
type: String,
notify: true
}
}
... | <p>Here are some examples on js fiddle that demonstrate different ways of binding:</p>
<ul>
<li><p>Two-way binding:</p>
<pre>https://jsfiddle.net/tej70osf/</pre></li>
<li><p>One-way binding: notify is <strong>not set</strong> on value property of the child element:</p>
<pre>https://jsfiddle.net/tej70osf/1/</pre></li... |
Perl module Config::IniFiles error <p>I am using Config::IniFiles module in my script to read the configuration file. I am getting the below error when executing the script.</p>
<pre><code>List::Util version 1.33 required--this is only version 1.21 at /usr/lib/perl5/site_perl/5.8.8/Config/IniFiles.pm line 14.
BEGIN fa... | <p>The message is pretty self explanatory.</p>
<blockquote>
<p>List::Util version 1.33 required--this is only version 1.21</p>
</blockquote>
<p>One of the modules requires List::Util version 1.33, but you're loading an install of version 1.21. You need to install a newer version of List::Util.</p>
<p>You should us... |
VBA Excel Macro won't email out - error <p>I have the following code to test to email out to specified email addresses. At present it won't work. </p>
<p>It says "Label not defined". </p>
<pre><code> Sub GHF()
Dim CDO_Mail As Object
Dim CDO_Config As Object
Dim SMTP_Config As Variant
Dim strSubjec... | <p>From address & Password</p>
<pre><code> .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "xyz@Email.com"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "123456"
</code></pre>
|
Odoo qweb call python method <p>I want to modify the RFQ report and in that I wanted to call a python method from the Qweb report, </p>
<p>here is some sample code,</p>
<pre><code><span t-field ="o.my_custom_fuction()" />
</code></pre>
<p>and my python function is like</p>
<pre><code>@api.model
def my_custom_... | <blockquote>
<blockquote>
<p>The t-field directive can only be used when performing field access (a.b) on a "smart" record (result of the browse method). </p>
</blockquote>
</blockquote>
<p>To call that function You will need to use <code>t-esc</code> (takes an expression, evaluates it and prints the content):... |
XMLHttpRequest Progress Events within a Promise <p>I'm having trouble finding any solutions for tracking the upload progress event of an <code>XMLHttpRequest</code> object inside of a <code>Promise</code>.</p>
<p>Here is an example of the code that I'm using to create async requests:</p>
<pre><code>var request = func... | <p>Unfortunately base promises don't have a way of representing any kind of progress. They are only pass/fail and can only send one result. You can think of them more as a delayed function return rather than a callback. You will probably need to accept a progress callback from your function and send that information ou... |
packaging maven project with external jar <p>I've been trying to make a runnable jar from my project (in Intellij IDEA) which has a dependency to an oracle (driver -> ojdbc6) jar. When I package the project with all of the dependencies, the only one what will be excluded is the jar. Which means my db queries are going ... | <p>Short Solution: Try using the below:</p>
<pre><code><dependency>
<groupId>LIB_NAME</groupId>
<artifactId>LIB_NAME</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${basedir}/WebContent/WEB-INF/lib/YOUR_LIB.jar</systemPat... |
How to pass a custom field to CreateRecurringPaymentsProfile? <p>All is in the title, I tried a lot of possibilities but I didn't find a way to do this. My goal is to get some data in IPN allowing me to know which offer the user choose.</p>
<p>I know how to do it with SetExpressCheckout and it works in express_checkou... | <p>Well, the custom field of BillingAgreement is ignored for CreateRecurringPaymentsProfile, I don't understand why but I decide to use the ProfileReference field as suggested here: <a href="http://stackoverflow.com/questions/14702419/paypal-ipn-custom-field-missing?rq=1">PAYPAL IPN custom field missing</a></p>
|
Open Activity without bothering user <p>i m running the Google-API connection and functions to gather Information over it in a Activity. Every time i would like to update my stored information(stored in static int variable) i start the Activity by an Intent. </p>
<p>I use a style to make the Activity-Form transparent:... | <p>There is no way to "stealth run" an activity. Activities are meant for the user to see and interact with, that's their functionality.</p>
<p>If you wish to run something in the background, you would need to use a Service (<a href="https://developer.android.com/guide/components/services.html" rel="nofollow">https://... |
SemaphoreSlim Await Priority <p>I am wondering if SemaphoreSlim has anything like a priority when calling Await.</p>
<p>I have not been able to find anything, but maybe someone has done something like this before.</p>
<p>The idea is, that if I need to, an await can be called on the Semaphore later on with a higher pr... | <p>No, there are no priorities in <code>SemaphoreSlim</code>, whether you're using synchronous or asynchronous locking.</p>
<p>There is very rarely ever a need for priorities with asynchronous locks. Usually these kinds of problems have more elegant solutions if you take a step back and look at the bigger picture.</p>... |
Storing Unsigned Char as Binary in File with C++? <p>I have written the following code to print the data in Pin and Pout to a file:</p>
<pre><code>void run() {
while ( in.readable() >= 17*11*12+SIZE_RSPACKET &&
out.writable() >= 1 ) {
u8 *pin = in.rd()+17*11*12, *pend=pin+SIZE_RSPACKET;
u8 *pout=... | <p>Use <code>fwrite</code> for writing internal representation of data to a file: </p>
<pre><code>fwrite(&pin[0], 1, sizeof(pin), F);
</code></pre>
<p>Also, open the file in a <em>binary</em> mode to avoid translations, such as the value <code>0x0d</code> being replaced by <code>0x0d, 0x0a</code>. </p>
<p>The ... |
Find Connection leak in Java application <p>I have an application which starts giving me internal server error after some time, Some people I asked told me that this can be because of Connection leak in my application. I started searching and found this query to simulate connection leak.</p>
<p><code>select LAST_CALL_... | <p>If you need to find out leaks you can use profilers like <a href="https://www.yourkit.com/docs/java/help/builtin_probes.jsp" rel="nofollow"><code>yourkit</code></a> or <a href="https://www.ej-technologies.com/products/jprofiler/overview.html" rel="nofollow"><code>jprofiler</code></a> which is able to track socket/jd... |
conditional formatting to highlight cells based on cell value of same cell of different sheet <p>I have sheet 1 as data. Sheet 2 as 'Adjustments'. The formula in sheet2!a1 is <code>=sheet1!a1</code>. This is throughout all cells in sheet2. The idea is that a user can make an adjustment in sheet2 by adding to result/zer... | <p>Use the sheets change event to do this msdn.microsoft.com/en-us/library/office/ff839775.aspx </p>
|
New issue with estpost tabulate <p>I use estpost tabulate to export several results to Latex from Stata.</p>
<p>I think my system admin installed a new version of something and now this function no longer works. </p>
<p>Try this code from the estout webpage:</p>
<pre><code>sysuse auto, clear
//(1978 Automobile Data... | <p>try</p>
<pre><code>esttab ., cell(colpct(fmt(2))) unstack noobs
</code></pre>
<p>note the <code>.</code></p>
<p>if you want to name your stored output, simply use:</p>
<pre><code>estpost tabulate rep78 foreign
#store the output
eststo my_output
esttab my_output, cell(colpct(fmt(2))) unstack noobs
</code></pre>
|
angular 1 : populate table with ng-repeat using a 2-d array from server's json <p>I'm unfamiliar with angular. But the front end dev working my project insists he wants the json in this way:</p>
<pre><code>{
"data": [{
"area1": {
"rows": [{
"the_desc": "A value 1",
"value": "sample ... | <p>As a front-end dev, I would choose the first structure as well. In any case, you'd have to use nested ng-repeat like so:</p>
<pre><code><div class="area" ng-repeat="area in data">
<div class="row" ng-repeat="row in area.rows">
<p class="description">{{::row.the_desc}}</p>
... |
Angularjs get variable in the view <p>Im trying to catch the variables fromcontroller to use it in the view. but it wont work, but i do know that it exists ( debug on the picture below).</p>
<p>problem: I dont get anything in the view.</p>
<p>note: it might be cause the structure,
main structure is from: <a href="h... | <p>Problem is with the module, you are missing the dependency injection part <code>[]</code>, </p>
<pre><code> angular
.module('core',[])
.controller('HeaderController', HeaderController);
</code></pre>
<p><a href="https://plnkr.co/edit/MtYL1lqNpeHNlVC2uiVQ?p=preview" rel="nofollow"><code>DEMO APP</code></a... |
A server program that spins off 3 threads <p>I am trying to write a server program that spins off 3 threads and accepts 3 incoming connections from a client.</p>
<p>Here is the current code:</p>
<pre><code>#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>... | <p>The problem is that you spawn off three threads to handle the single connection returned by <code>accept</code>.</p>
<p>Since you want to accept three connections, move your <code>accept</code> call into each thread.</p>
|
How can I pass integer through the buffer? <p>I want to create a socket that can read some numbers rather than string so that I can perform some manipulations on them.
How can I send integer instead of string
This is my current program:</p>
<pre><code> int main(int argc, char *argv[])
{
int sockfd, newsockfd, port, ... | <p>The problem is two-fold:</p>
<p>The first problem is that the declaration <code>void* buffer[256]</code> declares <code>buffer</code> to be an array of 256 pointers to <code>void</code>, not really what's intended I guess. Instead if you want an array of 256 bytes just do <code>char buffer[256]</code>.</p>
<p>The ... |
cakephp query builder not working <p>I have a query</p>
<pre><code>$p = $this->Products
->findById($id)
->select(['name'])
->contain(['Categories.Sizes' => function($q) {
return $q->select(['id', 'name']);
}
]);
</code></pre>
<p>which is only returning product's name and not the... | <p>According to the CakePHP 3 book, in the area "<a href="http://book.cakephp.org/3.0/en/orm/query-builder.html#selecting-rows-from-a-table" rel="nofollow">Selecting Rows From A Table</a>", you can specify which fields you want returned by including them in a <code>select</code> array:</p>
<pre><code>$query = $article... |
Misaligned Columns in Excel <p>I have a spreadsheet with 32,000 rows of data. Each row contains some key-value pairs. Some key-value pairs are missing in certain rows. When a key-value pair is missing, it is replaced by the key-value pair to the immediate right. For this reason, the columns are misaligned. I would like... | <p>I would have a 0 options (or NA) option. So instead of setting the size value to not be there, set the size value to be 0. To easily figure out which ones don't have this value, you could do a filter-> sort -> copy paste, then initialize all of them as default. It will expand the amount of data you need to store, bu... |
Modifying a list in AngularJS <p>Attempting to make list items clickable without a checkbox. I want those items to to get a strike through when clicked and still have the delete option at the end. This functions properly, but I can't seem to maintain that when I try to make the items clickable. How do I need to modify ... | <p>Why not to move the checkbox behavior to the item wrapper? In this case, if click on the trash, the outer click handler will not be triggered because we stop event from further propagation.</p>
<pre><code><div class="list-group">
<span data-ng-repeat="item in vm.list.items|orderBy:'name'" class="list-g... |
Serving a web app from a nested folder in ASP.NET as if it was root <p>I am working with an Angular 2 app that is being served with a simple ASP.NET WebApplication. </p>
<p>The whole code is bundled into 1 folder with webpack. Currently when I want to (re)deploy the ng app I have to delete old bundle and index.html fi... | <p>you may set base tag in your html.</p>
<pre><code> <head>
<base href="/dist/" >
</head>
</code></pre>
<p>so all the URL will be relative to that.</p>
<p>And you may access your application by navigating to </p>
<pre><code> <root url>/dist/index.html
</code></pre>
<p>Hope this ... |
gooey module not installing correctly <pre><code>C:\Python34\Scripts>pip install Gooey
Collecting Gooey
Using cached Gooey-0.9.2.3.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Haeshan\AppData\Lo... | <p>Looks like you're using Python 3.4 but Gooey only supports Python 2:</p>
<p><a href="https://github.com/chriskiehl/Gooey/issues/65" rel="nofollow">https://github.com/chriskiehl/Gooey/issues/65</a></p>
<p><a href="http://python3porting.com/differences.html#except" rel="nofollow">http://python3porting.com/difference... |
create a Postgres function which returns a table <p>I have this function</p>
<pre><code>CREATE OR REPLACE FUNCTION public.getusers(in user_id numeric)
RETURNS SETOF record
AS
$BODY$
DECLARE
ids character varying;
BEGIN
CREATE or REPLACE TEMP VIEW test AS
SELECT fx.*,EXTRACT(epoch FROM fx.time -(fx... | <p>In 2nd, 3rd and 4th part of your <code>INTERSECT</code> query you are trying to access a field from table <code>f2</code> in the <code>WHERE</code> part which is not visible there. You probably mean to respectively type:</p>
<pre><code>u1."userID" = user_id -- second
f3."userID" = user_id -- third
u3."userID" = use... |
Angular-Fullstack Login / Logout without redirect <p>Is there a way to use the authentication module of Angular-Fullstack for login / logout that does not redirect?</p>
<p>I would like to do other stuff in the callback instead. The redirect disturbs my process.</p>
| <p>Would redirect users to original request after authentication work for you? if so see: <a href="http://stackoverflow.com/questions/29725524/how-to-redirect-users-to-original-request-after-authentication-angular-fullstac">How to redirect users to original request after authentication, Angular-Fullstack Yeoman?</a></p... |
Why does my SKSpriteNode slows down when it touches the boundaries? <pre><code>physicsWorld.gravity = CGVector(dx: 0.0, dy: 0.0)
let dodge = childNodeWithName(Dodge) as! SKSpriteNode
dodge.physicsBody!.applyImpulse(CGVector(dx: 100.0, dy: -100))
</code></pre>
<p>When the ball touches the boundaries that I set, it slo... | <p>Have you tried setting the friction to 0 on your edge based physics body? (The edge of the screen) This could be causing the problem. Even though your volume based physics body has no friction (The ball) friction will still be caused unless your edge based boundary (the edge of the screen) also has no friction set. ... |
Read data from binary file python <p>I have a binary file with this format:</p>
<p><a href="http://i.stack.imgur.com/qHVBs.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/qHVBs.jpg" alt="enter image description here"></a></p>
<p>and i use this code to open it:</p>
<pre><code>import numpy as np
f = open("auth... | <p>The data structure stored in this file is hierarchical, rather than "flat": child arrays of different length are stored within each parent element. It is not possible to represent such a data structure using numpy arrays (even recarrays), and therefore it is not possible to read the file with <code>np.fromfile()</co... |
Log specific property value from object <p>I have this object:</p>
<p><code>choices: {'Frederico' : true, 'Roberto' : false, 'Carlos' : false}</code></p>
<p>and I am trying to log only the property that has a true value</p>
<pre><code>for(var keyProperty in choices) {
if(choices.hasOwnProperty(keyProperty)) {
... | <p>Check for true:</p>
<pre><code>for(var keyProperty in choices) {
if(choices.hasOwnProperty(keyProperty) && choices[keyProperty] === true) {
console.log(choices[keyProperty]);
}
}
</code></pre>
|
Webtools and developer tools issue on Phalcon framework <p>I installed phalcon 3.0.1-14 on an Ubuntu 14.04 box. Also installed Phalcon DevTools (3.0.1).
Initially, I enabled the webtools and when I visit that page, some warnings appear all the time:</p>
<pre><code>Cannot bind an instance to a static closure in /home/p... | <blockquote>
<p>Cannot bind an instance to a static closure</p>
</blockquote>
<p><a href="https://github.com/phalcon/cphalcon/issues/11029" rel="nofollow">https://github.com/phalcon/cphalcon/issues/11029</a></p>
<blockquote>
<p>Catchable fatal error: Argument 1 passed to Phalcon\Mvc\Model::validate()</p>
</blockq... |
How to apply vba code which highlights active selected cell to all active sheets? <p>I am currently trying to apply this code below to active sheets by converting it to macro. However I am having trouble with for each function. </p>
<p>This is the original code. </p>
<pre><code>Sub Worksheet_SelectionChange(ByVal Tar... | <p>Replace </p>
<pre><code>This.Workbook.Worksheets
</code></pre>
<p>By </p>
<pre><code>ThisWorkbook.Worksheets
</code></pre>
<p>The object <code>This</code> does not exists in vba. However there is a global property called <code>ThisWorkbook</code> (in one word).</p>
<p>However, your code have an other problem, w... |
A java Error Exception has occured while trying to execute Selenium Webdriver <p>I am trying to run below code but getting an error message. Any one can help me out here to fix it. Note that I am using <code>Selenium 3.0.0 beta3</code> version and <code>JDK1.7</code>.Thanks in advance.</p>
<p><strong>Source code :</st... | <p>As per <a href="https://raw.githubusercontent.com/SeleniumHQ/selenium/master/java/CHANGELOG" rel="nofollow">Selenium ChangeLog</a>, from Selenium v3.0.0-beta1, the minimum required Java version is 1.8</p>
<blockquote>
<h1>v3.0.0-beta1</h1>
<p>IMPORTANT CHANGES</p>
<ul>
<li>Minimum java version is now ... |
Show Dialog with Material Design Lite and Angular2 <p>I want to show a dialog with angular2 as shown in this example: <a href="https://getmdl.io/components/index.html#dialog-section" rel="nofollow">https://getmdl.io/components/index.html#dialog-section</a></p>
<p>Therefore I am using the dialog polyfill here: <a href=... | <p>Yes you're missing this thing:</p>
<pre><code>@ViewChild('target', {read: ViewContainerRef}) target;
this.componentRef = this.target.createComponent(factory, 0, injector);
</code></pre>
<p>instead of injecting component next to host tag (<code>viewContainerRef</code>)</p>
<p>See working <strong><a href="http://p... |
How to shard across a cluster of nodes based on the value of String? <p>I would like to create a distributed system where the data is sharded across all the nodes. I know there are libraries like Hazelcast or Apache Ignite that do the work for you. In my case, for each sharding key I need to create a socket subscriptio... | <p>This sounds like a use case for continuous queries: <a href="https://apacheignite.readme.io/docs/continuous-queries" rel="nofollow">https://apacheignite.readme.io/docs/continuous-queries</a></p>
|
How to make the user input come up as dots in Java <p>is there any way to display â¢â¢â¢'s when a user is typing in the console? My program has a user entering a password for a MySQL database but I want it to show â¢â¢â¢'s instead of their password when they type. </p>
| <p>You can use <a href="https://docs.oracle.com/javase/8/docs/api/java/io/Console.html#readPassword--" rel="nofollow">Console.readPassword()</a> to disable echoing. I don't think there's any way to get a substitute character without JNI though.</p>
|
App Crashes while switching from one Activity to another <p>Aim: Building app on Google API to fetch the data about the books the user searches</p>
<p>Problem Explanation:</p>
<p>Whenever I hit the submit Button, my app crashes.<br>
This is my first approach in making a network request app and I need guidance.</p>
<... | <p>I don't know how your code gets compiled when you have overridden <code>onCreate()</code> in Request class and the Request class isn't extending Activity or AppCompatActivity.
Secondly, this line :</p>
<pre><code>Intent i = getIntent();
String text = i.getStringExtra ("text");
</code></pre>
<p>should be inside th... |
How to find the source of global(ish) variable? <p>I inherited some large and unwieldy python code. In one file its using a list of commands imported from another file. Looking at it with pdb this commands variable ends up in the global namespace. However there's another file that doesn't look like its even being us... | <p>To get the module of the <code>commands</code> object, you could try:</p>
<pre><code>import inspect
inspect.getmodule(commands)
</code></pre>
|
Complex attribute that holds another complex attribute <p>As per the <a href="https://tools.ietf.org/html/rfc7643#section-2.3.8" rel="nofollow">RFC7643 section 2.3.8</a></p>
<blockquote>
<p>A complex attribute MUST NOT contain sub-attributes that have sub-attributes (i.e., that are complex).</p>
</blockquote>
<p>Bu... | <p>For all schema definitions, Complex Attributes may contain another Complex Attribute.
In the <a href="https://tools.ietf.org/html/rfc7643#section-7" rel="nofollow">RFC7643 section 7</a> we can read</p>
<blockquote>
<p>Unlike other core resources, the "Schema" resource MAY contain a
complex object within a su... |
Validation Loss and Accuracy in LSTM Networks with Keras <p>I run the example code for LSTM networks that uses imdb dataset in Keras. One can find the code in the following link.
<a href="https://github.com/fchollet/keras/blob/master/examples/imdb_lstm.py" rel="nofollow">imdb_lstm.py</a></p>
<p>My problem is that as ... | <ol>
<li><p><strong>When to stop training:</strong> it's an usual way to stop training when a some metric computed on validation data starts to grow. This an usual indicator of overfitting. But please notice that you are using a dropout technique - which results in training slightly different model during every epochs ... |
How to add Laravel username to the access log of nginx? <p>Anyone has an idea of how to include the Laravel's username of my users into the access log?
I'm using Laravel 5.2 with Nginx on Ubuntu 16.04.</p>
<p>I know how to add data to the access log in Nginx, but, how do I pass information (in this case the username) ... | <p>I may be wrong here, but as far as I know it is not possible. The access log is written by the server (nginx) to log activity on the server, not to log specifics of the application that runs on the server.</p>
<p>If you need to log which users access you Laravel application, you should probably create a separate lo... |
get_headers Connection time out <p>I get this error message: <code>get_headers failed to open stream: Connection timeout</code></p>
<p>Here is the code:</p>
<pre><code>$file_headers = @get_headers('http://www.example.fr');
print_r(get_headers('http://www.example.fr'));
if ( strpos( $file_headers[0], "200" )) {
e... | <p>The program was not able to open the stream within the time limit -- a system default value, often 60 seconds. Check to see that the file exists and is readable. Note that you call <strong>get_headers</strong> a second time (in the <strong>print</strong> statement), while the <strong>file_headers</strong> stream i... |
What happens if I use LAPolicyDeviceOwnerAuthentication on iOS 8? <p>In my app, I would like to know if the user has setup a passcode or fingerprint (touchID). There's a pretty easy method just for that: <code>[LAContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthentication error:error]</code>.</p>
<p>However, <a href="... | <p>I use code similar to this:</p>
<pre><code>LAPolicy localAuthPolicy = LAPolicyDeviceOwnerAuthenticationWithBiometrics;
if (![[UIDevice currentDevice].systemVersion hasPrefix:@"8."]) {
localAuthPolicy = LAPolicyDeviceOwnerAuthentication;
}
</code></pre>
<p>This ensures I only use <code>LAPolicyDeviceOwnerAuthen... |
Unable to target materialize select dropdown list item <p><strong>My HTML</strong></p>
<pre><code><div id="address-book" class="col s6">
<label>ADDRESS BOOK</label>
<select class="clean-input">
<option disabled selected>Choose Address</option>
<option>Saved address 1<... | <p>you need use <code>.dropdown-button</code> class instead of <code>.select-dropdown</code></p>
<p>see more info about materalize dropdowns <a href="http://materializecss.com/dropdown.html" rel="nofollow">here</a></p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
... |
Is there an API for the Firebase Console? <p>I am playing with Firebase and I need to add multiple (iOS/Android) applications to my project for them to use the same database.
I can do it via the Firebase Console website, BUT can it be done via an API?</p>
| <p>There is no public API to create Firebase projects or applications in Firebase projects.</p>
|
PHP Firebase help - Set up JWT <p>On my server I am running a few PHP files that read my Firebase Realtime Database. According to <a href="https://firebase.google.com/docs/auth/server/create-custom-tokens#create_custom_tokens_using_a_third-party_jwt_library" rel="nofollow">Firebase's documents</a> I need to set up cust... | <p>firebase/php-jwt library uses composer. Composer is a dependency manager for PHP similar to Maven in java if you come from android development background. You would need to know how to import classes in php using require/include functions of php. You would need some experience with php to use composer.</p>
<p>In or... |
How does GetItem/BatchGetItem compare to Querying and Scanning a DynamoDB table in terms of efficiency? <p>Specifically, when is it better to use one or the other? I am using BatchGetItem now and it seems pretty damn slow.</p>
| <p>In terms of efficiency for retrieving a single item, for which you know the partition key (and sort key if one is used in the table), GetItem is more efficient than querying or scanning. BatchGetItem is a convenient way of retrieving a bunch of items for which you know the partition/sort key and it's only more effic... |
Android, TabLayout icon color doesn't change when dragging <p>So, I have code like this:</p>
<pre><code>tabLayout.setOnTabSelectedListener(
new TabLayout.ViewPagerOnTabSelectedListener(tabViewPager) {
@Override
public void onTabSelected(TabLayout.Tab tab) {
super.onTabS... | <p>That is not how it should be done. <a href="https://developer.android.com/reference/android/support/design/widget/TabLayout.html" rel="nofollow"><code>TabLayout</code></a> can choose the icon based on <a href="https://developer.android.com/reference/android/graphics/drawable/StateListDrawable.html#attr_android:state... |
ReadP recursive parsing <p>In a <a href="http://en.wikibooks.org/wiki/Haskell/ParseExps" rel="nofollow">wikibooks article</a> about parsing a string like <code>"(a*b+c^d)"</code> into a tree using <a href="https://hackage.haskell.org/package/base-4.9.0.0/docs/Text-ParserCombinators-ReadP.html" rel="nofollow">ReadP</a>,... | <p>Let's look at the definition of <code>this</code> (I find it easier to work with the <code>do</code> notation):</p>
<pre><code>let this = p +++ do a <- p +++ brackets tree
char name
b <- this
return (Branch op a b)
in this
</code></pre>
<p>So here,... |
SQL : How to sum multiple bit columns in a row <p>I have a data structure that has repeating bit columns per row</p>
<p><a href="http://i.stack.imgur.com/zUfUv.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/zUfUv.jpg" alt="enter image description here"></a></p>
<p>How to I get the total number of Trues for ea... | <p>For educational purposes here is the version with <code>UNPIVOT</code>:</p>
<pre><code>DECLARE @t TABLE (id INT, ok1112 bit, ok1213 BIT, ok1314 BIT, ok1415 BIT, ok1516 BIT)
INSERT INTO @t VALUES
(3, 1, 1, 0, 0, 0),
(17, 0, 0, 0, 0, 0),
(21, 0, 0, 1, 1, 1),
(24, 1, 1, 0, 0, 0)
SELECT id, SUM(CAST(a AS int)) AS Tota... |
Doing a three table join in MySQL <p>This is my table</p>
<pre><code>program_join ('program_join_id, member_ID, program_schedule_id');
program_schedule (program_scedule_id, program_id, datetime');
program ('program_id, program_name);
</code></pre>
<p>This is my mysql</p>
<pre><code>$mySql = "SELECT
pr... | <p>Just use joins to get the program_name from the program table:</p>
<pre><code>SELECT
pj.program_join_id,
m.member_username,
p.program_name,
ps.datetime
FROM program_join pj
INNER JOIN member m ON pj.member_ID=m.member_ID
INNER JOIN program_schedule ps ON ps.program_schedule_id = pj.program_schedule_id
INNER JOIN... |
How to handle the case where the element copied by std::copy might be outside of the vector <p>I have a vector of undetermined length, <code>vSignal</code>.</p>
<p>I need to copy a part of <code>vSignal</code> into my dictionnary vector:</p>
<pre><code>std::copy(vSignalIt1-n1, vSignalIt1, vDictionnary.begin());
</cod... | <p>You can use</p>
<pre><code>const auto n2 = std::min(n1, std::distance(vSignal.begin(), vSignalIt1));
std::copy(vSignalIt1 - n2, vSignalIt1, vDictionnary.begin());
std::fill(vDictionnary.begin() + n2, vDictionnary.end(), 0);
</code></pre>
|
Searching to End of String in Regex <p>I am trying to extract all sequences of '1's from a string of binary digits (0 and 1) and get them into a <code>list</code>. <br/>For example the string may be of the form <code>001111000110000111111</code>. And I am looking for a list that looks like this <code>["1111", "11", "11... | <p>What you are trying:</p>
<pre><code>([1]+?)0
</code></pre>
<p><img src="https://www.debuggex.com/i/bHmtnovezOT8omWZ.png" alt="Regular expression visualization"></p>
<p><a href="https://regex101.com/r/fJ7lN1/1" rel="nofollow">Regex101 Demo</a></p>
<pre><code>([1]+?)0|$
</code></pre>
<p><img src="https://www.debu... |
Dynamic form input fields in Cakephp 3 <p>I have seen this: <a href="https://waltherlalk.com/blog/dynamic-form-input-fields" rel="nofollow">https://waltherlalk.com/blog/dynamic-form-input-fields</a> and have been active in this: <a href="http://stackoverflow.com/questions/22949366/dynamically-add-form-field-rows-cakeph... | <p>Change from <strong><a href="http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#field-naming-conventions" rel="nofollow">CakePHP 2</a></strong> to <strong><a href="http://book.cakephp.org/3.0/en/views/helpers/form.html#field-naming-conventions" rel="nofollow">CakePHP 3</a></strong> fields name conventio... |
form javascript submit event <p>I want to manage a form only with javascript, but the eventlistener doesn't worked for me. What's wrong?</p>
<p>My form:</p>
<pre><code><script src="init.js"></script>
<div id="search_box">
<form id="search_form">
<input type="search" name="search... | <p>The form's <code>submit</code> event will go to the form's action (no action = the current URL) and reload the page.</p>
<p>If you're handling it with JavaScript, accept the event argument and call <code>preventDefault</code> on it to prevent the default behavior:</p>
<pre><code>function search(e) {
e.preventD... |
Get feature and class names into decision tree using export graphviz <p>Good Afternoon,</p>
<p>I am working on a decision tree classifier and am having trouble visualizing it. I can output the decision tree, however I cannot get my feature or class names/labels into it. My data is in a pandas dataframe format which I ... | <p>The class names are stored in <code>decision_tree_classifier.classes_</code>, i.e. the <code>classes_</code> attribute of your <code>DecisionTreeClassifier</code> instance. And the feature names should be the columns of your input dataframe. For your case you will have </p>
<pre><code>classe_names = decision_tree_c... |
ng-tags-input with allowed-tags-pattern option doesn't work <p>I want tagname to only be in Upper case, Lower Case, Number, Characters: +_- and defined the tag-input as below with <code>allowed-tags-pattern="[A-Za-z0-9+_-]+"</code></p>
<p>My try:</p>
<pre><code><tags-input ng-model="selectedTags"
display-pro... | <p>Try this regular expression <strong>^[A-Z|a-z|0-9|+_-]+$</strong></p>
<pre><code><tags-input ng-model="tags" allowed-tags-pattern="^[A-Z|a-z|0-9|\+\_\-]+$">
<auto-complete source="loadTags($query)"></auto-complete>
</tags-input>
</code></pre>
<p>Here is a working plunker: <a href="http... |
How to capture Karma return/exit code? <p>I am trying to execute some unit test on Bamboo CI. As suggested in Karma config, I do have <code>SingleRun = true.</code>
The reporter used is "progress".
Since we build our application using Angular CLI, so I am taking advantage of <code>ng test --build=false</code> command w... | <p>Now able to find correct status by Karma.
Issue - When we were executing Karma via ng test. all exit statuses returned by karma were being consumed by ng. So, we used to get "Success" as long as we are able to run tests (irrespective of test failures)</p>
<p>Solution - Call karma directly. This way we can handle e... |
search a file for text using input from another file with a twist [Python] <p>I want to use a queryfile.txt as the source file, which will be used for searching and matching each line to a datafile.txt. But the datafile.txt has a different structure.</p>
<p>queryfile.txt should look like this:</p>
<pre><code>Gina Coo... | <p>Rewrite this:</p>
<pre><code>with open('datafile.txt', 'r') as data_file:
data_addresses = set(names.rstrip() for names in data_file)
</code></pre>
<p>To this:</p>
<pre><code>with open('datafile.txt', 'r') as data_file:
data = data_file.readlines()
data_addresses = list(filter(None, [line for line ... |
Spring OAuth2.0: Where does spring store the access token? <p>I am using <code>Spring Oauth2.0</code> using Google as authorization provider. I have the following configuration in my <code>application.yml</code> file</p>
<pre><code>security:
oauth2:
client:
clientId: xxxxxxxxxxxxxxxxxxxx
clientSecret... | <p>You can see <a href="https://spring.io/guides/tutorials/spring-boot-oauth2/" rel="nofollow">this</a> documentation about Spring and social login, then when you get more experience could try to put an auth micro service that store your tokens on redis. I use a gateway pattern with Outlook and have to specify a url in... |
Press Enter after I scanned a CodeBar <p>I'm looking the way to press Enter after I finish writing in a input, I'm scanning codebars in my input but after the code is insert it in the input I want to automatic press enter and call my function. This is my code for my input:</p>
<pre><code> <div class="form-group">... | <p>If you cannot read a <code>\r</code> (Carriage Return) or <code>\n</code> (New Line) from your scanner, you could conditionally perform actions when enough characters have been entered in the field. For example if your Barcode has 32 characters:</p>
<pre><code>$("#Id_Componente").keyup(function(e){
if($(this).val... |
Java regex text replace <p>I have text like this</p>
<pre><code>Some. / text to-match (1)
</code></pre>
<p>I wanna replace <code>./()</code> for <code>_</code> has next</p>
<pre><code>Some_text_to_match_1
</code></pre>
<p>How do it the pattern?</p>
| <p>You may trim the string from non-word chars on both ends (with <code>.replaceAll("^\\W+|\\W+$", "")</code>), and then replace 1 or more non-word character chunks with <code>_</code> inside the string (with <code>.replaceAll("\\W+", "_")</code>):</p>
<pre><code>String s = "Some. / text to-match (1)";
s = s.replaceAl... |
Using "$http.get" in ionic App, Response not get proper format <p>I am using "$http.get" for send request. My API response in browser, it returns what i want. But in Ionic App, it return HTML body tag text.</p>
<p>My Code is:</p>
<pre><code> var params = {
email: 'test@gmail.com',
password: '123'
... | <p>If you want the <strong>$http.get</strong>, this should work.</p>
<pre><code>var params = {
email: 'test@gmail.com',
password: '123'
}
$http.get("https://www.nepalivivah.com/API/index.php/accessapi/loginapi").then(function (data) {
alert(JSON.stringify(data));
}).error(function (err) {
alert(JSON.s... |
Do dark images have smaller size? <p>We know that different colors are formed using RGB components ranging between 0 and 255. The black color has (0,0,0) composition and white has (255,255,255) composition. Does that have any effect on image size? Are darker images smaller in size than brighter ones. I took two frames ... | <p>This is likely due to how the compression algorithm has dealt with the 2 images. <code>png</code> format should be lossless compression but it is still compressed. So if you do a diff on the 1 files you will see a small change in the header indicating they were created at different times. But the main change is in t... |
How to change the color of the bar in barchart if the data is negative - Angular Charts <p>I have created a horizontal barchart with Angular Charts.The HTML looks like this: </p>
<pre><code> <canvas id="base" class="chart-horizontal-bar"
chart-data="vm.chartData"
chart-labels="vm.chartLa... | <p>I would loop through your <code>chartData</code> and using a condition build out your array for colors. Fair warning, I'm not familiar with Angular Charts, so <code>vm.chartColors</code> may not be the right syntax, but the idea here holds, which is to build an array of your colors based on negative/positive numbers... |
Find all occurences of a specified match of two numbers in numpy array <p>what i need to achieve is to get array of all indexes, where in my data array filled with zeros and ones is step from zero to one. I need very quick solution, because i have to work with milions of arrays of hundrets milions length. It will be ru... | <p>try this:</p>
<pre><code>In [23]: np.where(np.diff(a)==1)[0] + 1
Out[23]: array([ 3, 9, 13], dtype=int64)
</code></pre>
<p>Timing for 100M element array:</p>
<pre><code>In [46]: a = np.random.choice([0,1], 10**8)
In [47]: %timeit np.nonzero((a[1:] - a[:-1]) == 1)[0] + 1
1 loop, best of 3: 1.46 s per loop
In [4... |
What is the "routeName" in route() function of Laravel? <p>In <a href="https://laravel.com/docs/5.3/helpers#method-route" rel="nofollow">official doc</a>:</p>
<pre><code>$url = route('routeName');
</code></pre>
<p>In my daily usage of Laravel, I always write route as:</p>
<pre><code>Route::get('/', function () {
... | <p>Well, it's route name. You can name your routes with <a href="https://laravel.com/docs/5.3/routing#named-routes" rel="nofollow"><code>name()</code></a> method or with <a href="https://laravel.com/docs/5.3/routing#named-routes" rel="nofollow"><code>as</code></a> option:</p>
<pre><code>Route::get('user/profile', 'Use... |
microservices: C:\....m2\repository\org\glassfish\jersey\core\jersey-client\2.22.1\jersey-client-2.22.1.jar; invalid LOC header (bad signature) <p>I was looking to developed the <code>microservices</code> example by following the link: <a href="https://github.com/bjedrzejewski/tasklist-service" rel="nofollow">https://g... | <p>I've had experinced this issue and as per research this error mainly occurs if the jar file may be corrupted. Try removing the all content of your</p>
<pre><code> C:\Users\[your username]\.m2\repository\ folder.
</code></pre>
<p>Then right click your project, select Maven, Update Project, check on Force Update of... |
Java - Extracting call number from a String. Regular expressions? <h2><strong>Example inputs:</strong></h2>
<p><code>"Undergraduate CT275.P648 R53 2008"</code>, </p>
<p><code>"Science Center QR. 123 G45 2001"</code>, </p>
<p><code>"Grainger 134 P 123 1995"</code>. </p>
<p>I am trying to extract the call number from... | <p>Some simple code that should get you close to where you want to be would be to simply EXTRACT the digits:</p>
<pre><code> String str1= "Undergraduate CT275.P648 R53 2008";
String str2= "Science Center QR. 123 G45 2001";
String str3= "Grainger 134 P 123 1995";
str1 = str1.trim();
str1 = str1.repl... |
Sending few values at the same time over bluetooth <p>I am working on a Bluetooth based application and I am having problems when I try to send data from the iPhone to the other device.</p>
<p>I have no problem when I have to send just one value, using something like this:</p>
<pre><code>- (void)sendData:(NSInteger)m... | <p>You can't use <code>sizeof(bytes)</code> to get the number of bytes in the array. It's simply going to return <code>4</code> since that is the size of a <code>char *</code>.</p>
<p>One options would be to use <code>sizeof(mel) + sizeof(interval)</code> instead of <code>sizeof(bytes)</code>.</p>
|
How can I convert India standard time to users timezone <p>I am storing the user <strong>viewdatetime</strong> column from my server time (India), and I want to convert this time depending on the users country. I can get the user country and some details by this steps
<a href="http://stackoverflow.com/questions/1255316... | <p>The best way to do it would be using moment.js library (<a href="http://momentjs.com/" rel="nofollow">http://momentjs.com/</a>) and benefit from its Multiple Locale Support.
You should really handle this stuff on client-side (thus JavaScript) instead of server-side (PHP). I hope this answer will be useful.</p>
|
iOS; Post image from UIImageView to PHP <p>I'm developing an iOS app with Xcode and Swift.</p>
<p>I usually take this code to POST data to PHP:</p>
<pre><code>let requestImage = NSMutableURLRequest(URL: NSURL(string: "http://example.com/postData.php")!)
requestData.HTTPMethod = "POST"
let postStringImage = "name=\(na... | <p>You have a PHP script that accepts multipart/form-data. Because this you need your POST request to be a multipart/form-data.
Try this example:</p>
<p><a href="http://stackoverflow.com/a/24252378/2441775">http://stackoverflow.com/a/24252378/2441775</a></p>
<p>If you have any question, feel free to request again. I'... |
How to validate required fields in class properties? <p>I wanted a simple way to ensure that some properties in a class contained values and/or were within a range (ie: not more than 50 characters long). I used the question and answer on <a href="http://stackoverflow.com/questions/21027865/how-to-validate-class-propert... | <p>Add a new method into the Person class to perform the validation. The new "Validate" method works for required values, range, and string length.</p>
<p><strong>Person.cs</strong></p>
<pre><code>using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
public class Person {
... |
Only the first mail have information on a for loop Mail::send Laravel <p>I have a hello world template and I'm trying to send emails with this template in a for loop, I receipt the three mails but only the first mail shows the "hello world" and the other are empty. HELP!!!</p>
<pre><code>function testMail(Request $req... | <p>Well, I never thought that the problem was on my template. The "include_once"</p>
<pre><code><!DOCTYPE html>
<html lang="en">
<body id="body">
<?php include_once 'components/invoice_template.php';?>
</body>
</html>
</code></pre>
<p>For this:</p>
<pre><code><!DOCTYPE ... |
Compiler error when using pattern matching on list of pairs in scala <p>I'm learning Scala pattern matching and encountered the following issue:</p>
<p>Suppose i have the list of integers and using pattern matching to match the last element:</p>
<pre><code>val list = 1 :: 2 :: 3 :: Nil
list match {
case xs :+ 3 ... | <p>You need to enclose the appended pair with parenthesis. The method :+ accepts one parameter. If you dont have extra parenthesis, two parameters are being assumed.</p>
<pre><code>list match {
case xs :+ (('c', 3)) => println("Matched")
case _ => println("Not mathed")
}
</code></pre>
|
Python: Create a user and send email with account details to the user <p>Here is a script I have written which will create a new user account. I am trying to get help in adding a bit more to it. </p>
<p>I want to have it also send an email to the new user that is created. Ideally, the program will ask the user creatin... | <p>You can easily send mails with gmail and smtplib (you maybe need to install it first). This way you can send any message you want. </p>
<pre><code>import smtplib
toaddrs = raw_input('what is your e mail?')
fromaddr = 'youremail@email.com'
msg = 'the message you want to send'
server.starttls()
server.login(fromadd... |
Classpath for Java archive within .ear file from a web application on JBoss 6.2 <h1>Background</h1>
<p>Running a J2EE application on JBoss. The Content Repository contains:</p>
<ul>
<li>WebApp.war</li>
<li>ReportService.ear</li>
<li>additional .jar files</li>
</ul>
<p>The <code>ReportService.ear</code> file contains... | <p>Change:</p>
<pre><code>Thread.currentThread().getContextClassLoader().getResource(filename)
</code></pre>
<p>to:</p>
<pre><code>getClass().getResource(filename)
</code></pre>
|
Vertically align thumbnail images to the top - CSS <p>Client is uploading thumbnail images of different heights and my image gallery seems to not be aligning things to the top. I have been spinning my wheels for a while trying to find the issue. Any help much appreciated.</p>
<p>Here's a link, you'll see how the tal... | <p>I have a solution for that </p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>.image-container{
width: 200px;
height: 200px;
border: 2px solid #a29e9e;
... |
slf4j with log4j2 creates log files but does not write to it <p>I have a Spring Boot app that I am trying to setup logging using SLF4J and Log4J2.</p>
<p>Here is a snippet from application</p>
<pre><code>package hello;
import java.util.concurrent.atomic.AtomicLong;
import org.slf4j.Logger;
import org.slf4j.LoggerFact... | <p>The configuration file as shown doesn't have closing <code></Loggers</code> and <code></Configuration ></code> tags. This may prevent the XML from being parsed, and log4j will install a default configuration that only logs to the console at error level. </p>
<p>If the configuration file is not found or pro... |
order an array based on input - php <p>Is there any way in <code>PHP</code> to have an array and order it by most similar to a certain string.</p>
<p>For example:</p>
<pre><code>$array = array("Bob", "Brad", "Britney");
$userinput = "Bradley123";
/*
function that changes the array to be
array("Brad","Britney","Bob")... | <p>I've done some research, here is a way that you could do it:</p>
<pre><code>$array = array(0 => 'blue', 1 => 'reds', 2 => 'green', 3 => 'reds');
//Words to be searched from.
$res = array("percent" => "0", "word" => "N/A");
//Result, this is an array for the bellow loop to talk to.
foreach($arra... |
PyQt - trouble with reimplementing data method of QSqlTableModel <p>I'm a newbie with python and mainly with pyqt. The problem is simple: I have a <code>QTableView</code> and I want to "simply" change the color of some rows. Reading all around I found that the simplest solution should be to override the data method in ... | <p>Your implementation is broken in a couple of ways: (1) it always returns <code>None</code> for any unspecified roles, (2) it creates a new instance of <code>QSqlTableModel</code> every time the display role is requested, instead of calling the base-class method.</p>
<p>The implementation should probably be somethin... |
jQuery DataTables adding dynamic headers and table row's not showing <p>I am having an issue with rendering my <code>jQuery DataTable</code> correctly. I am dynamically generating the <code>headers</code> for my table from a CSV Data source. From there I am just adding the corresponding table data from the CSV.</p>
<p... | <h3>Solved:</h3>
<p>The issue was the fact that there was not enough data in my rows depending on the number of headers. Which was causing the error within the <code>DOM</code> - a simple edit and fixing the loop allowed me to achieve the correct result. </p>
<pre><code>(function Launch() {
//console.log("Inside the ... |
What is the difference between these two asynchronous methods? <p>What's difference between this two asynchronous methods? If didn't, In which situation this two kind of methods can was different?</p>
<p>Thanks.</p>
<pre><code>public async Task<int> MyMethod1Async()
{
return 1;
}
public async Task<int&g... | <p>The first method returns an already completed task with a <code>Result</code> of <code>1</code>. </p>
<p>The second method returns a <code>Task<int></code> that will never complete.</p>
|
Team member deleted "Release" configuration. How would I recreate it? <p>I had a team member delete the release configuration from one of our projects. While I do have the removal in source control, there were many changes to the solution in the offending commit. I figured it would be easier to recreate the profile rat... | <p>You'll need to go through each project in the solution and individually check the build settings for that project. You can do this by right-clicking the project in the solution explorer and selecting properties. Navigate to the Build tab:</p>
<p><a href="http://i.stack.imgur.com/CooLF.png" rel="nofollow"><img src... |
Why does Retrofit 2.0.2 fail with "unexpected end of stream on okhttp3.address" when using @Query in POST call? <p>I have the following api endpoint defined:</p>
<pre><code>@POST("api/ResetPassword")
Call<Envelope> resetPassword(@Query("email") String email);
</code></pre>
<p>which fails with the error message:... | <p>Changed our endpoint from a POST to a GET and the call now works.</p>
<p>Did I miss the explanation of why @Query and POST don't work together with Retrofit/okhttp ?</p>
<p>Searching on the subject it doesn't appear to be prohibited in general though it might not be best practice.</p>
|
Set a default value after the model was created in Waterline <p>Is there a possibility to set a default value for an attribute after the model entity was created?</p>
<p>The attribute didn't exist before.</p>
| <p>Use <a href="http://sailsjs.org/documentation/concepts/models-and-orm/attributes#?attribute-options" rel="nofollow"><strong>defaultsTo</strong></a>.</p>
<blockquote>
<p>When a record is created, if no value was supplied, the record will be
created with the specified defaultsTo value. The supplied value can
al... |
How to extract files from corrupted svn revisions files ("myproject\db\revs\0" directory) <p>I have some SVN files which restored from corrupted HDD and as a consequence corrupted SVN.<br></p>
<p>Is it possible to extract files from SVN revisions database files directly?</p>
<p>E.g. I have "MyProject\db\revs\0" and I... | <p>You won't be able to recover this repository in case there are missing revisions and this repository had less than 1000 revisions. Revisions don't contain files, they contain changes. Therefore, to construct a file as it was in revision X, it is required to have all the revisions where this files was changed.</p>
<... |
How to access element node in react redux <p>How do I access the <code>li</code> element in the click handler to add a class when it is clicked?</p>
<pre><code>const Type = React.createClass({
clickHandler: function () {
...
},
render () {
const classType = `cell type type-${this.props.name}`
return ... | <p>The most "React-ful" way to do this would be to store the <code>li</code> class name or status in component state (or Redux I guess if that's your thing) and modify it via the click handler.</p>
<pre><code>const Type = React.createClass({
clickHandler: function () {
this.setState({wasClicked: true});
},
r... |
Guzzle Error with Laravel. ClientException in RequestException.php line 107: <p>Here is my constructor</p>
<pre><code>public function __construct()
{
$this->jar = new \GuzzleHttp\Cookie\CookieJar();
$this->guzzle_instance = new \GuzzleHttp\Client([
'base_uri' => API_URI,
'cookies' =>... | <p>I've modified your function and put your request into a try/catch so that you can handle other responses than 200 explicitly....</p>
<pre><code>protected function processRequest($method, $sub_uri, $body = null, $headers = null)
{
try {
$this->response = $this->guzzle_instance->request($method,... |
Frame height prints 0 <p>As the question states, when I tried to set an image view inside a UIView class, to have a corner Radius of its frame height divided by 2, it wasn't working, so I decided to print the frame height and it was 0. </p>
<p>The height or width for every view in this class prints 0 I don't know why.... | <p>By default a view will have no size whatsoever. You have to set some sort of constraints or the view's frame.</p>
<p><strong>1. Constraints:</strong>
When setting constraints in <code>viewDidLoad()</code>, the view will not instantly gain a size. In order to read the size, you'll have to read it in another functio... |
couchdb GET /_stats response interpretation <p>So we've been trying to make sense of the _stats that couchdb seems to return if you make a GET call to /_stats. The problem is that the units for these entities is not very well defined. For example, this is an example of what's returned for httpd.requests:</p>
<pre><cod... | <p>The <a href="https://wiki.apache.org/couchdb/Runtime_Statistics" rel="nofollow">wiki</a> says: </p>
<blockquote>
<p>Each metric is aggregated over four periods time. In the default
output of /_stats the period of time is since CouchDB was started.
[...] aggregate values are calculated on a per-second basis</p... |
Using WPF, how do you change color of a cell based on its value? <p>Looks like this question has been asked a few times, but none of the answers fit my scenario...</p>
<p>I'm using a grid, and the ItemsSource is a custom struct named Record. </p>
<p><a href="http://i.stack.imgur.com/L0peW.png" rel="nofollow"><img src... | <p>I think this is still a xaml only solution but suggesting you the right thing here - </p>
<pre><code><DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=PROPERTY_NAME}" Value="DESIRED_VALUE"&... |
Wrapping or Copying During User-Defined Casts <p>I have a custom collection class that implements <code>IDictionary<TKey, TValue></code> and actually uses <code>System.Collections.Generic.Dictionary<TKey, TValue></code> as the underlying storage for my custom collection. I wanted an implicit cast to Dictio... | <p>Aside from performance, the only concern is mutability. As your implementation is not immutable, the first way is probably more correct as it allows direct mutability of the underlying dictionary. </p>
|
execute npm install, when branching in TFS with Visual Studio <p>Is there a way I can hook an <code>npm install</code> when I branch in Source Control explorer? Or if I can access a powershell window to run a script to do that for me?</p>
| <p>No, there is no way to run npm install when you create branch. If you have a large amount of projects need to run npm install after branch, you can create a powershell or batch script to do this just as you mentioned in your question.</p>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.