input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Programatically set app setting / env variable during Azure (Kudu) deployment <h1>Summary</h1>
<p>I'm trying to deploy an MVC5 web app to Azure. I need to set WEBSITE_NODE_DEFAULT_VERSION programatically to ensure all configuration is atomically contained in the repo. When I try to set that app setting / env variable ... | <p>Turns out that when I created the Azure web app, it pre-set the WEBSITE_NODE_DEFAULT_VERSION in the portal (portal.azure.com). So the UI was superseding my programmatic requests to set the app setting.</p>
<p>After deleting that app setting in the portal (below is a screenshot after removing the setting), I tried ... |
How to create text file for writing <p>I've a problem to write text in a file. What I've done so far is the following: I have a string with the text to store and the file name also as a string.</p>
<pre><code>let someText = "abcd"
let fileName = "file:///xxx"
</code></pre>
<p>Of course "xxx" is a .txt file under the ... | <p>I recently ran into some problems by trying to just do: </p>
<pre><code>"my string".writeToURL...
</code></pre>
<p>Which is how many of the tutorial show you how to do it. Eventually I came up with this method (is swift 2.3 for which i apologize). I kept getting an error saying I did not have permission to write. ... |
How can I make columns full height of window between header and footer with CSS and prevent underwrap <p>I want to make a simple HTML layout using CSS where I have a header, two columns where the column on the right is a fixed width (say 100px for now). The left column will at some point have generated content, it shou... | <p>Try this change to .content</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>.content {
background-color: BlanchedAlmond ;
float:left;
width: 95%;
margin-right:... |
WordPress replaces html code with characters <p>Today I got one very bad experience with WordPress. After long normal work it started replacing <code>&lt;</code> html code with <code><</code> symbols. With other symbols situation is the same.</p>
| <p>You'll need to specify where these symbols are being used that it changes it. Without any clarification, I'm going to assume you using them in the WYSIWYG editor on a post/page. In this case, you may need to switch from the "Visual" to "Text" tab.</p>
<p>Here is a link describing what I'm talking about: <a href="ht... |
Convolution Error in MATLAB <p>I have no idea why I don't get an identical image of 'ada.jpg' when I run the code below:</p>
<pre><code>clear;
I = rgb2gray(imread('ada.jpg'));
figure(1)
imshow(I)
M = int8([0 0 0 ; 0 1 0 ; 0 0 0]);
C = convn(M, I);
figure(2)
imshow(C)
</code></pre>
<p>Here the two images:
<a href="htt... | <p>The issue is that your input image data <code>I</code> has values between <code>0</code> and <code>255</code> and is of datatype <code>uint8</code>. After convolution, the output is a <code>double</code> and still has values between <code>0</code> and <code>255</code>.</p>
<p>The default for <code>imshow</code> whe... |
Importing Templates in Meteor During Routing with Iron Router <p>One of the benefits to Meteor is that you only need to load content when it needs to be rendered, e.g. if you have a template file in /imports/ui/client it is not loaded unless you import it somewhere. However, when using Iron Router I've been unable to d... | <pre><code>import '/imports/ui/client/home.js';
Router.route('/', function () {
this.render('home');
});
</code></pre>
<p>This is the 'standard' way as mentioned in most of the <a href="https://themeteorchef.com/snippets/understanding-the-imports-directory/" rel="nofollow">examples</a>, though I see no harm in you... |
Convert Row to Column mySQL with ID (not pivoting) <p>I have a value store in a database like this:</p>
<pre><code>ID | Date | Value
----------------------------------------------
1 | 11/20 | 1
1 | 11/21 | 2
2 | 11/20 | 10
2 | 11/21 | 20
</code></pre>
<p>However... | <pre><code>select
case when id=1 then count(Id) else 0 end) as Value1,
case when id=2 then count(Id) else 0 end) as Value2
from ESYNC_TAGSHISTORY
</code></pre>
<p>This is not exact but try this kind of query you will get result</p>
|
Cannot find symbol getCurrentActivity when building an Android module for React-Native <p><a href="https://github.com/mmazzarolo/react-native-getactivity-test/" rel="nofollow">First of all, here is a test repo to replicate my issue</a> </p>
<p>Hello there,
I'm trying to create a simple Android module for React-Native... | <pre><code> @ReactMethod
public void start(final Callback callback) {
Activity currentActivity = getCurrentActivity();
this.mBeaconManager.connect(new BeaconManager.ServiceReadyCallback() {
@Override
public void onServiceReady() {
mBeaconManager.startRanging(region);
call... |
Compress a 2D array into a 1D Array <p>i have a quad (2D array) which is composed of numbers which ranges from 0 to 255
and the most frequent value of the array ( in my case 2) is the background value</p>
<p>i have to put all the values of the array except the background value ( i have to ignore all cases that contai... | <p>A simple approach using <code>std::vector</code></p>
<pre><code>std::vector<int> result;
for (int i = 0; i<MAXL;i++)
{
for (int j=0; j<MAXC;j++)
{
if (image1[i][j] != BackColor) // Notice !=
{
result.push_back(i+1);
result.push_back(j+1);
resu... |
How to achieve this underline or bottom border effect without editing line-height? <p><img src="http://i.imgur.com/ok6FaOu.png" alt="like the orange underline here"></p>
<p>I would like to achieve this underline, but without messing the line height.</p>
<p>If I use text-decoration:underline; its too close to the text... | <p>I sometimes use an :after or :before pseudo element for that sort of thing. That way I can be knit picky about how far away it is.</p>
<p>The pseudo element can be absolute positioned to ensure that.</p>
<p>So for a general example:</p>
<pre><code>.nav-bar-item:after {
content: '';
position: absolute;
... |
Display image 5 second after hidden <pre><code>override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
// Set the image view in the starting location
moveobj.frame = CGRect(x: 100, y: 100, width: /* some width */,
height: /* some height */)
UIView.animate(w... | <p>Well all you'd have to do is chain a new animation to the finish that does the opposite of the previous animation (move back to the original location and unhide) - Courtesy of @Rob's comment. </p>
<p>It'd just be:</p>
<pre><code>override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
... |
Speeding up nested loops in python <p>How can I speed up this code in python?</p>
<pre><code>while ( norm_corr > corr_len ):
correlation = 0.0
for i in xrange(6):
for j in xrange(6):
correlation += (p[i] * T_n[j][i]) * ((F[j] - Fbar) * (F[i] - Fbar))
Integral += correlation... | <p>The way to do these things quickly is to use Numpy's built-in functions and operators to perform the operations. Numpy is implemented internally with optimized C code and if you set up your computation properly, it will run much faster.</p>
<p>But leveraging Numpy effectively can sometimes be tricky. It's called "v... |
Remove Duplicated Entries From an Array <p>For removing the duplicated entries I know I have to use <code>array_unique()</code> but unfortunately by using this I got unexpected result(s). My PHP code is this:</p>
<pre><code> $query = $db->query("
SELECT sid,father_contact,residential_contact
FROM ".TABLE_PREFIX.... | <p>You can try to do it via array structures. Just to give you an idea:</p>
<pre><code>$phones = [];
while ($s = $db->fetch_array($query))
{
if (!empty($s['father_contact']))
{
$phones[] = $s['father_contact'];
}
if (!empty($s['residential_contact']))
{
$phones[] = $s['residenti... |
Strange CDATA behavior in XHTML with JavaScript <p>i'm using blogger and i want to make my own template from scratch so i began to understand the very basic structure of how things are.
In my journey through this i encounter the CDATA thing
And i wanted to test this code.</p>
<pre><code><html>
<head>
... | <p>Blogger parses the XML templates as XML, so they need to be valid XML to work with Blogger's backend.</p>
<p>However, when Blogger serves the resulting page to the browser it says that the Content-Type is <code>text/html; charset=UTF-8</code> (which is wrong, because it is XHTML (but see below)).</p>
<p>HTML and X... |
Go slices and loops: Multilple loop through slice items while reducing the items with 1 each on each loop <p>I have a slice of ints that I want to loop through multiple times, but each time I do another loop, I want to exclude the item from the parent loop.</p>
<p>Something like this:</p>
<pre><code>func main() {
... | <p>You don't seem to know that what you are doing is called <em>generating permutations</em>. Otherwise it would be easy to google an efficient algorithm for doing it.</p>
|
exception thrown when creating an array c++ <p>Im basically generating a array for a flat plane in my game using this algorithm, but I couldn't get it to work as there is a exception when I run the program. (GLuint is just unsigned int in opengl)</p>
<pre><code>const GLuint planeDimension = 30.0f;
const GLuint half = ... | <p>You're accessing outside the array in your loop. Your loop has as one iteration for each element in <code>planeVertices</code>. But you're incrementing <code>counter</code> 3 times each time through the loop. So about 1/3 of the way through all the loops <code>counter</code> will reach the end of the array, then you... |
XSLT grouping by sibling node value <p>In the following sample XML subsides should be grouped to "Number"-node value. I already tried grouping the Muenchian method but couldn't get it done yet. The XSLT must be in 1.0. For every Number-node a box should be created and each value should be grouped to it. Problems is als... | <p>If you want to group the <code>DATA</code> elements by <code>Number</code>, you need to make your key match <code>DATA</code> and use <code>Number</code>.</p>
<p>Try the following stylesheet:</p>
<p><strong>XSLT 1.0</strong></p>
<pre><code><xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Tr... |
Why Python pickling library complain about class member that doesn't exist? <p>I have the following simple class definition:</p>
<pre><code>def apmSimUp(i):
return APMSim(i)
def simDown(sim):
sim.close()
class APMSimFixture(TestCase):
def setUp(self):
self.pool = multiprocessing.Pool()
s... | <p>It would help to see how your class looks, but if it has methods from <code>multiprocessing</code> you may have issues just pickling it by default. Multiprocessing objects can use locks as well, and these are (obviously) unpickle-able.</p>
<p>You can customize pickling with the <a href="https://docs.python.org/dev/... |
Rx - CombineLatest Queue <p>I am trying to achieve Queue like functionality using Rx (I know I can accomplish it using a Queue + Locking, but trying to learn + use Rx as I don't get many opportunities to use it).</p>
<p>Functionality is, I want to take some action on an event to do, but only want to process one at a t... | <p>If you are willing to mix in TPL DataFlow Blocks you can do what you want. Though I must say it's a bit non-Rxish.</p>
<pre><code>var source = Observable.Interval(TimeSpan.FromSeconds(1));
var queue = new BroadcastBlock<long>(null);
var subscription = queue.AsObservable().DistinctUntilChanged().Subscribe(l =... |
C# and Javascript - How to Add Remove Objects To A Javascript Array and Postback to Server? <p>I have a form where there is a section for a user to add multiple appointment dates. This section of the form has the following fields: startdate, enddate and a add button.</p>
<pre><code> <form action="/someaction">
... | <blockquote>
<p>How do I remove the object from the array. I have a data-id attribute on the delete link but what can I use to uniquely identify the object.</p>
</blockquote>
<p>Because you create a new table row you need to:</p>
<ul>
<li>delegate event (i.e.: $(document).on('click', '.js-delete', function (e) {)</... |
I don't understand what args[0][0]-'!' means <p>I stumbled upon this block of code and I want to understand what
<code>args[0][0]-'!'</code> means?</p>
<pre><code>else if (args[0][0]-'!' ==0)
{ int x = args[0][1]- '0';
int z = args[0][2]- '0';
if(x>count) //second letter check
{
printf("\nNo S... | <p><code>args</code> is a <code>char**</code>, or in other words, an array of strings (character arrays). So:</p>
<pre><code>args[0] // first string in args
args[0][0] // first character of first string in args
args[0][0]-'!' // value of subtracting the character value of ! from
... |
Why i can't declare and then assign value to a variable in a class without any method IN JAVA <p>It may sounds crazy but what i really want to do is just declare and initialize a member variable within a public class and then re-assign this variable with another value which is quite realistic in C. But it fails in Java... | <p>Generally, in object oriented programming the 'class' represents a description of a particular object. If we use the analogy of a car, think of it as the 'blueprint'. </p>
<p>The blueprint does a number of things:</p>
<ul>
<li>Describes what kind of properties the object can have (so a car might have color and spe... |
Loading font-family from disk to PrivateFontCollection <p>I'm using the following code to load a font into memory for generating an image with GDI+:</p>
<pre><code>var fontCollection = new PrivateFontCollection();
fontCollection.AddFontFile(Server.MapPath("~/fonts/abraham-webfont.ttf"));
fontCollection.Families.Count(... | <p>Answer from Hans Passant solved the problem:</p>
<p><em>PrivateFontCollection is notoriously flakey. One failure mode that's pretty common today is that the font is actually an OpenType font with TrueType outlines. GDI+ only supports "pure" ones. The shoe fits, the web says that Abraham is an OpenType font. Works i... |
UICollectionView not loading fully until I scroll <p>I have a collection view that I want to display hourly weather in. I seem to have a problem with loading the cell, and for some reason scrolling forwards and then back loads the cell fully. Before I scroll the collection view, all of the constraints do not work and o... | <p>Seems like you populate your cells asynchronously, if so then add a mycollectionview.reloadData() at the end.</p>
|
Cannot resolve Mockito dependency in Gradle <p>Although I saw two different posts with this error message nothing worked with me:</p>
<blockquote>
<p>Error:(25, 17) Failed to resolve: org.mockito:mockito-core:1.10.19</p>
</blockquote>
<p>I tried to change the Mockito dependency using compile, androidTestCompile and... | <p>I found the solution.
In most of the tutorials is written to add mockito-core.
Instead adding mockito-all fixed my problem, making gradle compiling without mistakes</p>
|
Insert empty row into jtable if lowest row gets edited <p>Is there a way to insert always an empty row if the lowest row gets edited?<br>
I always want to have a free row on the bottom and if someone edits the lowest row, there should be automatically inserted a new one. </p>
<p>I use that AbstractTableModel:</p>
<pr... | <p>Suggestions:</p>
<ul>
<li>Change your table model to use an ArrayList as its data nucleus, not an inflexible 2D array.</li>
<li>The generic type of the ArrayList should be a class that holds the data of a single row of your JTable.</li>
<li>It should have an empty default state that signifies a row devoid of data.<... |
How to process panel data for use in a recurrent neural network (RNN) <p>I have been doing some research on recurrent neural networks, but I am having trouble understanding if and how they could be used to analyze panel data (meaning cross-sectional data that is captured at different periods in time for several subject... | <p>I find no reason in being able to train neural network with panel data. What neural network does is that it maps one set of values with other set of values who have non-linear relation. In a time series a value at a particular instance depends on previous occuring values. Example: your pronunciation of a letter may ... |
How can I create a CSS3 overflow hidden unmasking spotlight effect with rotation? <p>I want to create an effect whereby I have a static image, and that image is being unmasked by a rotating mask. I understand there is no way to do native masking in HTML5/CSS (that works in all browsers) so I'm using the mask:overflow m... | <p>Here is my try :</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 {
width: 400px;
height: 300px;
background-image: url(http://placekitten.com/800/600);
... |
Looping through table to calculate separations - Python <p>Okay so I have a table of xy coordinates for a bunch of different points like this:</p>
<blockquote>
<pre><code> ID X Y
1 403.294 111.401
2 1771.424 62.183
3 804.812 71.674
4 2066.54 43.456
5 ... | <p>The error occurs because math.sqrt() can only take a float value, if you pass an np.array it will attempt to convert to a float. This only works if the array contains a single value.</p>
<pre><code>> math.sqrt(np.array([2]))
1.4142135623730951
> math.sqrt(np.array([2,1])) Traceback (most recent call last):
... |
Display: flex won't work in firefox or safari <p>I've seen this issue several places on here, but the solutions always had some little fix (e.g. including -moz-, typos, etc), all of which (I believe) I have checked. I'm trying to use flex to center some text vertically within its container. It works 100% in Chrome, but... | <p>Why don't you set their heights to be the same, and then the second container set to vertically align in the center. I would use a plugin like matchHeight.js. It's super easy and you just put a matching data tag on each element and it will set the heights. for example and . That will match the heights for you and t... |
Spread operator in PhpStorm <p>my problem is that PhpStorm "red strikes" a spread operator in this line : <code>if(Math.max(...yearstab) !== (date + 2))</code>. I'd like to know if you found a way to prevent problems like that. Thanks.</p>
| <p>Since spread operator was introduced in the <a href="http://www.ecma-international.org/ecma-262/6.0/#sec-array-initializer" rel="nofollow">ECMAScript 2015 (6th Edition, ECMA-262)</a> you need to tell PhpStorm that you're using this version. </p>
<p>You can do this by going in the project settings, "Languages & ... |
User input in my code is not working, what am I doing wrong? <p>My assignment is to take an array of ten numbers of the user input, and then find the lowest and highest numbers.</p>
<p>I have done it according to class notes, but it is not working on netbeans.</p>
<pre><code>import static java.lang.System.in;
import ... | <p>Your problem is you are incrementing <code>i</code> in the for loop and not <code>x</code> in the first for loop. That makes it run forever with <code>x==1</code>. Each time the loop code runs you are changing <code>i</code> which has no effect on the loop condition <code>x<numbers.length</code>.</p>
<p>You'll a... |
Refreshing Spark Properties on a Running Streaming job <p>I want to update the spark properties of a currently running spark streaming job.</p>
<p>I have set some properties on SparkConf in the programs and some on spark-defaults.conf.</p>
<p>How do i update them so that my curently running job will pick them?</p>
<... | <p>Usually it is not possible to refresh configuration during runtime. Only certain SQL options can be changed with active context.</p>
<p>Otherwise:</p>
<ul>
<li>modify configuration</li>
<li>restart app</li>
</ul>
|
How does Angular 2 know the parent instance without any explicit code? <p>Could anyone shed some light on me please. I have followed <a href="https://gist.github.com/nickjohnson-dev/bec769ee72fa2e8510323dce784cfab9" rel="nofollow">this example</a> to sketch out a simple wizard app in Angular 2. It works like a charm, e... | <p>In Angular 2, every component has its own injector. These 'injectors' form a tree that mirrors the tree of the components themselves. This means that when you ask for a service in a component, the Angular DI system tries to find a provider for that service first in the injector of that component, and then in the inj... |
Sentinel not working properly <pre><code>def load():
global name
global count
global shares
global pp
global sp
global commission
name=input("Enter stock name OR -999 to Quit: ")
count =0
while name != '-999':
count=count+1
shares=int(input("Enter number of shares... | <p>Remove <code>calc()</code> and <code>display()</code> from <code>main()</code>. You're already doing those things in <code>load()</code>.</p>
|
how to use retrofit 2 to send file and other params together <p>I am looking for an example how could I send file and other params together to server.</p>
<p>I have to send server JSON which </p>
<pre><code>{
"title": "title",
"file": "uploaded file instance",
"location": {
"lat": 48.8583,
... | <p>Use <code>gson</code> and create a model class for the location.</p>
<p>Add the following dependencies to your <code>build.gradle</code>.</p>
<pre><code>compile 'com.squareup.retrofit2:converter-gson:2.0.0'
compile 'com.google.code.gson:gson:2.5'
</code></pre>
<p>Create a model to represent the location.</p>
<pr... |
How can i split a string based on word boundary in R? <p>How can i split a string based on space/word boundary in R? </p>
<pre><code>t = "ID=gene:Bra032485;biotype=protein_coding;description=AT5G40170 (E%3D6e-176) AtRLP54 | AtRLP54 (Receptor Like Protein 54)%3B kinase/ protein binding ;gene_id=Bra032485;logic_name=gle... | <pre><code>> strsplit(t, " ")[[1]][1]
[1] "ID=gene:Bra032485;biotype=protein_coding;description=AT5G40170"
</code></pre>
|
Error CS1501: No overload for method `PopulateWithData' takes `2' arguments <p>HI Apologies in advance for a for asking this question, I'm only learning c# and i can't get my head around the arguments passed into the method.</p>
<p>I keep getting an error in xamarin studio on one of the prebuilt apps.</p>
<p><a href=... | <p>Generally, when dealing with methods, functions, subroutines etc, you have to match the arguments you pass when calling them.</p>
<p>For instance, if you have (or declared) a function like this:</p>
<pre><code>void myFunction(int a, int b) { ... }
</code></pre>
<p>You have to call it passing 2 ints (no less, no m... |
How can I get text-decoration: underline to ignore descenders <p>I've seen it around, most recently here: <a href="http://pitchfork.com/news/67863-amazon-launches-new-streaming-service-undercutting-spotify-and-apple-music/" rel="nofollow">http://pitchfork.com/news/67863-amazon-launches-new-streaming-service-undercuttin... | <p>If you inspect that element in the site, you will find out that it isn't really a text decoration but a line simulation of it, because text decoration is inactive. </p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippe... |
JDBC Instrumentation and ORA-01000: maximum open cursors exceeded <p>I am trying to better instrument which web applications make use of Oracle (11g) connections in our Tomcat JDBC connection pool when a connection is <strong>created</strong> and <strong>closed</strong>; this way, we can see what applications are using... | <p>So Mr. Poole's statement: "<em>that query looks like it's getting fake metadata</em>" set off a bell in my head. </p>
<p>I started to wonder if it was some unknown remnant of the validation query being run on the <code>testOnBorrow</code> attribute of the pool's datasource (even though the validation query is defi... |
Get local network hostnames in iOS <p>I would like to get All device name in entire local network. I just been searching over 2 days and haven't find a solution yet.</p>
<p>I can able to get Bonjour services with using NSNetServiceBrowser. What i am trying to do is same as Fing app ( in app store) does. </p>
<p>As sc... | <p>Seems like <code>NEHotspotHelper</code> is what you're looking for. Specifically a <code>class func supportedNetworkInterfaces() -> [Any]</code> method.</p>
<p>In order to make it work, you'll need to accomplish some additional steps. Please, check <a href="http://stackoverflow.com/a/39189063/1090309">this quest... |
connecting to a remote server and downloading and extracting binary tar file using python <p>I would like to connect to a remote server, download and extract binary tar file into a specific directory on that host. I am using python 2.6.8</p>
<ol>
<li>What would be a simple way to ssh to that server?</li>
<li><p>I see ... | <p>There are 2 errors here:</p>
<ul>
<li><code>urllib.urlretrieve</code> (or <code>urllib.requests.urlretrieve</code> in Python 3) returns a <code>tuple</code>: filename, httprequest. You have to unpack the result in 2 values (or in the original <code>fullfilename</code>)</li>
<li>download is OK but the <code>tarfile<... |
getEventsForDay() formatting issues with datepicker return value <p>I'm trying to use the Calendar API to pull up some events based on datepicker output. The issue that i'm facing with my AppScript is formatting properly the value that i get from the datepicker that will serve as input for the getEventsForDay() functio... | <p>Since <code>new Date()</code> returns the Date object in UTC and not the local timezone, you may be querying the wrong day and hence the empty object if the other day does not have any events.</p>
<p>You can covert the date to the current timezone like</p>
<pre><code>date.setTime(date.getTime() + date.getTimezoneO... |
List of NetSuite GL Posting Transactions and their recordtypes <p>I'm wondering if anyone knows a way to obtain a list of NetSuite GL Posting transactions and their recordtypes. I've created a savedsearch in my account against transactions and set the posting field to true, then grouped by recordtype. This gives me a... | <p>I would recommend to go through help topic <code>Understanding General Ledger Impact of Transactions</code> or SuiteAnswer Id 7821</p>
|
Put a text on top of a button - android <p>i have a regular android button </p>
<pre><code><Button
android:id="@+id/btn_0"
style="@style/def_button_numb"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="0" />
</code></pre>
<p>First:
I need to put so... | <p>you can simply add this code</p>
<p>android:text="SEND DATA TO FRAGMENT B"</p>
|
"No route found" error with Asana Connect <p>As per <a href="https://asana.com/developers/documentation/getting-started/auth#quick-reference" rel="nofollow">this</a>, I'm trying to use the code received from the authorization endpoint to exchange for a token, using the Authorization Code Grant flow. I first issue this... | <p>It has to be a POST. I was using a GET call.</p>
|
Timing blocks of code - Python <p>I'm trying to measure the time it takes to run a block of instructions in Python, but I don't want to write things like:</p>
<pre><code>start = time.clock()
...
<lines of code>
...
time_elapsed = time.clock() - start
</code></pre>
<p>Instead, I want to know if there is a way I ... | <p>This would be a good use of a decorator. You could write a decorator that does that like this</p>
<pre><code>import time
def timer(func):
def wrapper(*args, **kwargs):
start = time.time()
func(*args, **kwargs)
print('The function ran for', time.time() - start)
return wrapper
@tim... |
How do I set up a Kubernetes Ingress rule with a regex path? <p>I'd like to use regex in the path of an Ingress rule, but I haven't been able to get it to work. <a href="https://github.com/nginxinc/kubernetes-ingress/blob/master/examples/complete-example/cafe-ingress.yaml" rel="nofollow">For example</a>:</p>
<pre><cod... | <p>I don't think there is an option to use regexp in Ingress objects. Ingress is designed to work with multiple IngressController implementations, both provided by cloud services or by self-hosted ingress like nginx one from kubernetes/contrib (which I use on my setup). Thus ingress should cover features that are comm... |
Count the number of times a player plays a game in a different difficulty level <p>I have a xml and xslt files like below. And Im showing in a table the gamename and the player name. But now Im trying to do one thing and Im not see how.</p>
<p>I want to show how many times a player played a game in a novice, easy, med... | <p>Here is an adaption of what you tried, assuming an XSLT 2.0 processor as it uses <code>for-each-group</code>:</p>
<pre><code><html xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:version="2.0">
<table>
<tr>
<th>GameName</th>
<th>Player</th... |
How many records BizTalk EDI Batching Service can handle? <p>I have a BizTalk application deployed to assembly X12 834 files.
it works fine to assembly a valid EDI file with about 100K records, the final file generated is about 70-80M. </p>
<p>But when the record count reached to about 1.2M, the performance of batchin... | <p>I don't think the built-in batching is appropriate for such amounts of data. </p>
<p>Is there any reason why you need such big batches? I do quite a lot of EDI, but have never encountered such a requirements.</p>
<p>I don't know whether this is applicable for you, but you can actually bypass the entire built-in ED... |
OSError: .pynative/... : file too short <p>When I try to apply OCRopus (a python-based OCR tool) to a TIFF image, I get the following python error:</p>
<pre><code> Traceback (most recent call last):
File "/usr/local/bin/ocropus-nlbin", line 10, in <module>
import ocrolib
File "/usr/local/lib/python2.7... | <p>Problem solved.
I saw other people having trouble (on diverse matters) with: </p>
<blockquote>
<p>OSError:<strong>[X]</strong>... : file too short</p>
</blockquote>
<p>My suggestion is: whatever you are doing, check for hidden directories named [X] in the current directory and delete them.</p>
|
Eloquent, combine row columns in where statement <p>let's say I've got a database containing some films, with the date that they have first been released in a column and the number of months for which I should be showing them in the cinemas in another colum. </p>
<p>What I would like to do is get all the cinemas that ... | <p>I am not sure it makes sense to add months to a date like you do it, but a calculation based on two columns and a passed parameter could look the following: </p>
<pre><code>Cinemas::whereHas('films', function($q){
$q->whereRaw('date_created >= (? + showing_months)', [Carbon::now()]);
})->get();
</code>... |
Git rebase one branch on top of another branch <p>In my git repo, I have a <code>Master</code> branch. One of the remote devs created a branch <code>Branch1</code> and had a bunch of commits on it. I branched from <code>Branch1</code>, creating a new branch called <code>Branch2</code> (<code>git checkout -b Branch2 Bra... | <p>First backup your current <code>Branch2</code>:</p>
<pre><code># from Branch2
git checkout -b Branch2_backup
</code></pre>
<p>Then rebase <code>Branch2</code> on <code>Branch1</code>:</p>
<pre><code># from Branch2
git fetch origin # update all tracking branches, including Branch1
git rebase origin/Branc... |
What is the meaning of the object in the python classes <p>what is the meaning of the following command:</p>
<pre><code>def run_initial(self) -> object:
</code></pre>
<p>I don't know why he put <code>object</code> after the arrow. What is the meaning of the object here?</p>
| <p>They are type annotations.</p>
<p>Type annotations are type hints that were brought in with <a href="https://www.python.org/dev/peps/pep-0484/" rel="nofollow">pep-0484</a>. They were made to allow developers to use third party tools or modules that consume these to give more information to the user about types for ... |
Multiple Linear Regression-Interactions Between Transformed Quadratic Variable and Factor Variable <p>I have a multiple linear regression as seen below that contains interaction terms, where some of my terms are factor variables (season, month, holiday, weekday, weathersit)</p>
<pre><code>regwithint=lm(casual~season:t... | <p>First, let's establish that <code>I()</code> works fine with factor variable interactions:</p>
<pre><code>data(iris)
reg <- lm(Sepal.Length~Species:I(Petal.Length^2), data=iris)
summary(reg)
</code></pre>
<blockquote>
<pre><code>Call:
lm(formula = Sepal.Length ~ Species:I(Petal.Length^2), data = iris)
Residual... |
Spark: Caching an RDD/DF for use across multiple programs <p>I have a dataset that is being read from multiple programs. Instead of reading this dataset into memory a number of times each day, is there a way for spark to effectively cache the dataset, allowing any program to call upon it? </p>
| <p>RDDs and Datasets cannot be shared between application (at least, there is no official API to share memory)</p>
<p>However, you may be interested in Data Grid. Look at <a href="http://ignite.apache.org/" rel="nofollow">Apache Ignite</a>. You can i.e. load data to Spark, preprocess it and save to grid. Then, in othe... |
How to use rfind() to separate and print string according to username? <p>I don't ask many questions here, so I hope this is specific enough to be answered. </p>
<p>I'm working on a project for a Software Construction class I am in, and am having trouble with part of the assignment. Basically we are writing a program ... | <p>This should provide some insight.</p>
<pre><code>#include <iostream>
#include <string>
template<class Func>
void reverse_iterate_messages(std::string const& buffer, Func&& f)
{
auto current = buffer.size();
while (current)
{
auto pos = buffer.rfind("%(", current -... |
ng-disabled not working properly 5 <p>As Question and Answer related to ng-disabled didn't help, so I am writing this question for help.</p>
<p>The problem is in my angularjs app ng-disabled is not working properly.</p>
<p>Here is the jsfiddle of the problem <br>
<a href="http://fiddle.jshell.net/80cLw91j/" rel="nofo... | <p>Answer is pretty simple. You facing <a href="http://stackoverflow.com/a/17607794/511374">Angular scope dot problem</a> and <a href="http://fiddle.jshell.net/wr894tau/" rel="nofollow">here</a> is jsfiddle for you. </p>
|
django-pipeline throwing ValueError: the file could not be found <p>When running <code>python manage.py collectstatic --noinput</code> I'm getting the following error:</p>
<pre><code>Post-processing 'jquery-ui-dist/jquery-ui.css' failed!
Traceback (most recent call last):
File "manage_local.py", line 10, in <module... | <p>Your problem is related to <a href="https://code.djangoproject.com/ticket/21080" rel="nofollow">this bug</a> on the Django project.</p>
<p>In short, django-pipeline is post-processing the <code>url()</code> calls with Django's <code>CachedStaticFilesStorage</code> to append the md5 checksum to the filename (<a href... |
How to fix error in trying to implement Google Maps after updating SDK in Android Studio? <p>After updating the Android SDK, GooglePlayServices isn't working anymore. I went back to test a maps app I had and updated play services from 8.4.0 to 9.6.1 because of other dependency update requirements. I am using build tool... | <p>In order to use maps, it's better to use the split of play services:</p>
<pre><code>compile 'com.google.android.gms:play-services-maps:9.6.1'
</code></pre>
<p>if using Gps etc add also:</p>
<pre><code>compile 'com.google.android.gms:play-services-location:9.6.1'
</code></pre>
|
Scene rendering black when entering VR mode in A-Frame <p>I am using A-Frame 0.3.0. Everything renders fine on the screen, but when I enter VR mode, it renders black. I have tried the latest Chromium and Firefox Nightly builds from September. Even the A-Frame examples do not working.</p>
<pre><code><script src="htt... | <p>This is because the September 2016 builds of Chromium and Firefox Nightly were updated to use the new WebVR 1.1 API spec, whereas A-Frame was working on WebVR 1.0 API spec.</p>
<p>This has been updated in A-Frame v0.3.2, where we have bumped VREffect to match the latest API changes.</p>
<pre><code><script src="... |
Non-type template arguments explicit instantiation in source file <p>I am wrapping a library into my class design. I would like to call a template method with unsigned int non-type parameter provided in the library in my class constructor. </p>
<pre><code>#include <iostream>
#include <bar.h> // template h... | <p>I wouldn't recommend separating the implementation of a template class into a source file. If I understand your situation correctly then I don't think it's possible to do that unless you instantiate all possible values of the template parameter, which is impossible for an <code>unsigned</code>.</p>
|
Submitting form with AJAX not working. It ignores ajax <p>I've never used Ajax before, but from researching and other posts here it looks like it should be able to run a form submit code without having to reload the page, but it doesn't seem to work.</p>
<p>It just redirects to ajax_submit.php as if the js file isn't ... | <p><code>form.serialize()</code> doesn't know which button was used to submit the form, so it can't include any buttons in the result. So when the PHP script checks which submit button is set in <code>$_POST</code>, neither of them will match.</p>
<p>Instead of using a handler on the <code>submit</code> event, use a c... |
Symfony2 redirect from old url to new url <p>I am using Symfony 2.8 and I've created a section (on the Admin Bundle) to register old paths and the new paths where to redirect when accessing the first ones. For example: My domain is <code>www.mypage.com</code>. My old webpage "About us" route was: <code>www.mypage.com/a... | <p>To do that, you can use the eventlistener of symfony2. </p>
<p>Referer to : <a href="https://github.com/adashbob/ecommerce/blob/master/src/Ecommerce/FrontBundle/Resources/config/services/listeners_services.yml" rel="nofollow">declare a eventlistener</a></p>
<p><a href="https://github.com/adashbob/ecommerce/blob/ma... |
Is there a way to hide the side bar in Sublime Text 2? <p>Is there a way to hide the side bar that shows you what line you're on in <code>Sublime Text 2</code>?</p>
<p>Here is the bar:
<a href="https://i.stack.imgur.com/vbuwt.png" rel="nofollow"><img src="https://i.stack.imgur.com/vbuwt.png" alt="enter image descripti... | <p>Add <code>"gutter":false</code> to user preferences.</p>
|
Assigning variables values in a better way <p>I have a written a bash script which uses number of parameters.
I have assigned variables in the following format.</p>
<pre><code>x=$1
y=$2
z=$3
k=$4
</code></pre>
<p>The arguments are optional, and it runs without them as well
For example :</p>
<pre><code>./myscript.sh
... | <p>You can use <code>read</code> combined with herestring and the quote reconstruction ability of <code>printf</code>:</p>
<pre><code>read x y z k <<<$(printf " %q" "$@")
</code></pre>
<p>By example:</p>
<pre><code>$ cat example.bash
#!/bin/bash
read x y z k <<<$(printf " %q" "$@")
echo "x=[$x]"
ec... |
unable to set property 'visibility' or 'display' <p>I have a dropdownlist box in the datagrid and I need to hide or show it. I can get the element. However I get an error 'Unable to set property 'display' of undefined or null reference. when I want to hide it. I tried to use visibility and it has same type of error to... | <p>This should work</p>
<pre><code>function NeedChange(id) {
var dropID = document.getElementById(id);
if (dropID!=undefined ){
//dropID.style.visibility="hidden";
$("#dropID").removeClass("show");
}
}
</code></pre>
|
check if nested form records are null <p>Can I check if some record in the nested form is null? I am trying this but it does not work</p>
<pre><code><%= f.fields_for :detallepromo do |builder| %>
<% if builder.Monto == nil %>
<div class="well center-block">
<div class="form-group">
... | <p>how, if like this:</p>
<pre><code> <% if :detallepromo? %>
<p>bla.bla..</p>
<% else %>
<%= f.fields_for :detallepromo do |builder| %>
<div class="well center-block">
<div class="form-group">
<h3 class="col-md-5">Promocion Ba... |
Inserting data into database with python/sqlite3 by recognising the column name <p>I've got a problem that I don't know how to solve, I've tried many solutions but always getting that Operational error: near...</p>
<pre><code>def insert_medicine_to_table():
con = sqlite3.connect('med_db3.db')
cur = con... | <p>The problem causing your error is that your SQL isn't valid. The statement you are trying to execute is:</p>
<pre><code>INSERT INTO medicines présentation VALUES (?)
</code></pre>
<p>The statement you want to execute is:</p>
<pre><code>INSERT INTO medicines ("présentation") VALUES (?)
</code></pre>
<p>As far a... |
How to reference ASP.Net Identity User Email property as Foreign Key <p>New to coding so please bare with me, and apologies in advance for the worlds longest question.</p>
<p>Trying to reference the Email property of an ASP.Net Identity User as a Foreign Key but keep getting an error message</p>
<p>using MVC6, EF7</p... | <p>Try this Model</p>
<pre><code>public class AppAccount
{
public string AppAccountID { get; set; }
public string AccountType { get; set; }
public DateTime DateCreated { get; set; }
[ForeignKey("UserId")
public virtual ApplicationUser AppUser { get; set; }
}
</code></pre>
|
What are interviewers looking for when they ask "How would you test this"? <p>In a Software Engineering interview, oftentimes I come across the question "How would you test this?" after writing out the solution to their coding prompt. They always state they are not interested in functional/unit type of testing, so what... | <p>I don't think this question belongs here, but unless someone removes it I'll say what I'm thinking:</p>
<p>Most likely what a hiring manager would like to see is that you test for standard and corner cases, firstly to ensure that your solution works in all cases (especially to see that you've considered the corner ... |
Does Spring Data for MongoDB allow documents with optional fields? <p>Can I have a nullable field that:
- if its value is null, we wouldn't store the field (name or value) on the document, and
- if its value is non-null, we would store the field name and value on it. </p>
| <p>Yes, it does, just do not set the property while creating the model and that field and the value will not be inserted in mongodb document. The fields for which the values are set, only those will be stored in the mongodb document.</p>
<pre><code>package org.scalar.test;
import org.scalar.model.Product;
import org.... |
How do I pass the jQuery selection object into a function being called by the selection? <p>New to jQuery and I don't know how else to say it.</p>
<p>When the function below is within the jquery selection, it works fine. When I try to break out the function I'm not sure what object/variable needs to be passed into the... | <p>To further explain Adeno's answer in the comments:</p>
<p><a href="http://api.jquery.com/text/" rel="nofollow">From the docs:</a></p>
<blockquote>
<p>.text( function )</p>
<p>function</p>
<p>Type: Function( Integer index, <strong>String text</strong> ) => String
A function returning the text content ... |
2 different post layouts in a loop <p>I have just created thus BEAUTIFUL loop</p>
<pre><code> <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="row sectionrow" onclick="void(0)">
<div class="col-sm-4 sectionrecipes" style="background-image:url('<?php echo the_field(backgro... | <pre><code>1. First declare a variable Outside the loop (like as $i =1),
</code></pre>
<ol start="2">
<li><p>Then check the condition.
Mode of i</p>
<pre><code>example:
if($i% 2 == 0) {
-----layout First code-----
}else
{
-----layout Second code-----
}
</code></pre></li>
<li>Increment the variable value ($i... |
How to generate debug information in gcc/clang with separated compilation/link process in Makefile (-c -g)? <p>I had made a Makefile from Hilton Lipschitz's <a href="http://hiltmon.com/blog/2015/09/28/the-simple-c-plus-plus-makefile-executable-edition/" rel="nofollow">blog</a>, and made little changes to it in order to... | <p>You need to add <code>-g</code> to the linker recipe as well in order to generate .dSYM files, the standard way would be to add</p>
<pre><code>debug: LDFLAGS += -g
</code></pre>
<p>but the example you're following defines its own variables for no good reason, it looks like <code>LIB</code> should work however.</p>... |
Academic-setting clarification of the term "Standard Input" in Java and verifying Input <p>Was instructed, for a university-level assignment, to receive user input through "standard input". Google was a bit scarce as to what precisely this means. </p>
<p>While I could (and for the sake of my grade, will) go to my prof... | <blockquote>
<p>Was instructed, for a university-level assignment, to receive user
input through "standard input". Google was a bit scarce as to what
precisely this means.</p>
</blockquote>
<p>This would generally mean the input to the program you are writing will come from a file or from input the user types at... |
Copy-Item is not working <p>I have a script that is finding a few files and the copying them. This is part of a psake build script.</p>
<p>The command is:</p>
<pre><code>Get-ChildItem -Path "$sourceFolder" -Include "*.ispac" -Recurse `
| Select-Object -ExpandProperty FullName `
| Copy-Item -Destination "$case... | <p>modify your code like this</p>
<pre><code> Get-ChildItem -Path "$sourceFolder" -Include "*.ispac" -Recurse -File | foreach{Copy-Item $_.FullName -Destination (("$caseFolder\") + $_.Name) -Force -Verbose }
</code></pre>
|
Vue Router Error <p>Trying set up Vue Router. Not sure what I am doing wrong. Getting the error </p>
<p><code>Failed to mount component: template or render function not defined. (found in root instance)</code></p>
<p>Again, I'm coming to Vue from React and while they are pretty similar there are small things that are... | <p>Assuming you have the components properly, you still need a small update.</p>
<p>When loading vue router as module system, the application should be initialized with the following way:</p>
<pre><code>new Vue({
el: '#app',
router,
render: h => h(App)
});
</code></pre>
|
Fragment doesn't fill screen properly <p>I'm instantiating a Fragment inside another Fragment. The inner fragment has its layout defined as <code>match_parent</code> for width and height. And their parent too.</p>
<p>This is the code for main Fragment. CustomFragment which is inside is the inner Fragment. Its a regula... | <ol>
<li>please make sure, your the container for second fragment (if any) is also <code>match_parent</code></li>
<li>try give fragment different background color (ie. android:color/red) to check if fragment actually already full screen, but have transparent background. and your calendar view is only reside on small pr... |
Split column with tidyr with different lenghts <p>I want to separate a column with tidyr to extract the grade level. The Column looks like this:</p>
<pre><code>School.Name
School A ES
SchoolB MS
</code></pre>
<p>The is no standard way the schools are named, so when I use separate </p>
<pre><code>separate(DF, School.... | <p>try <code>?separate</code>:</p>
<pre><code>separate(DF, School.name, c("School.Name","Number","Grade Level"), fill = "left")
</code></pre>
<p>Then you got result like :</p>
<pre><code> School.Name Number Grade Level
1 school A ES
2 <NA> schoolB MS
</code></pre>
<p><str... |
elif statement not working as expected <p>I'm trying to look through multiple sources to see which one has a specific entry.</p>
<p>My input looks like:</p>
<pre><code>json_str2 = urllib2.urlopen(URL2).read()
u = json.loads(json_str2)
#load all five results
One = u['flightStatuses'][0]
Two = u['flightStatuses'][1]
Th... | <p>You should write this as a loop over the five flight statuses instead of using five variables and five conditions.</p>
<pre><code>results = json.loads(urllib2.urlopen(URL2).read())['flightStstuses']
for result in results:
if result['flightNumber'] == str(FlEnd):
fnumber = result['flightId']
brea... |
1st principal component of 3 points on a line <p>I am a little bit confused on the first principal directions. Say I have three points in a two dimensional euclidean space: (1,1), (2,2), and (3,3) and I want to calculate the first principal component. </p>
<p>First I see that the center is (2,2) so I move all points t... | <p>The steps you write is correct but you misunderstand some concepts. "Mean shift" part has no problem but you got it wrong about covariance matrix. Since the original data is in 2D, then the covariance matrix should between these two dimensions including all six values, that is (-1,0,1) in x axis and (-1,0,1) in y ax... |
Mysql query on Javascript <p>I'm trying to use Javascript, PHP and MySql all together and get some results. I've done something about it but it does not work as I expected. Hope there is someone to help me.</p>
<p>Basically I've created a category table, which includes catID, catName, catDesc, and catPar.</p>
<p>In t... | <p>The problem is that the ajax call returns nothing when the subcategory has no other subcategories, try sending an empty select list, for example:</p>
<pre><code> <?php }else { ?>
<select id="sub_category" name="sub_category">
<option name="sub_category" id="cat" value="0">No subcategor... |
Bash loop over files in hdfs directory <p>I need to loop over all csv files in a Hadoop file system. I can list all of the files in a HDFS directory with</p>
<pre><code>> hadoop fs -ls /path/to/directory
Found 2 items
drwxr-xr-x - hadoop hadoop 2 2016-10-12 16:20 /path/to/directory/tmp
-rwxr-xr-x 3 had... | <p>This should work</p>
<pre><code>for filename in `hadoop fs -ls /path/to/directory | awk '{print $NF}' | grep .csv$ | tr '\n' ' '`
do echo $filename; done
</code></pre>
|
self executing function assigned to a variable <p>I have found an example to run a server using Express but I don't understand 'why' it works.</p>
<p>The code is the following:</p>
<pre><code>var server = app.listen(3000, function() {
console.log('Listening on port 3000');
});
</code></pre>
<p>The result of this v... | <p>In Javascript <code>app.listen()</code> is a method call that executes the <code>listen()</code> method on the <code>app</code> object. The return value from that method call is then assigned to your <code>server</code> variable.</p>
<p>So, putting it all together with your code:</p>
<pre><code>var server = app.l... |
Get rid of duplicate items in ComboBox from a BLOB database <p>I am getting duplicate items in a combobox that displays saved BLOBs in my database.</p>
<pre><code>Private Sub refreshBLOBList()
Dim getBLOBListCommand As New SqlCommand( _
"SELECT DISTINCT FileName FROM DocumentStorage", dbConnection)
Dim... | <p>I needed to call BLOBlist.items.clear() before I added items otherwise I will add the distinct ones again.</p>
|
Adding Position: fixed; ruins the header <p>When I add:</p>
<pre><code>* {
margin: 0;
padding: 0;
position: fixed;
}
</code></pre>
<p>the whole banner messes up and ends with a piece of the code.
I've been experimenting on popular websites, and when this one came along I've been having a lot of trouble, b... | <p>Wooahh you've added position fixed onto every single element of the page with this line:</p>
<pre><code>* {
margin: 0;
padding: 0;
position: fixed;
}
</code></pre>
<p>You should only add position fixed to the element you want to be fixed. If its the top nav then something like this.</p>
<pre><code>nav... |
RESTFul Web Service with Ajax <p>I am new to web services and I am trying to use RESTFul webservices.
I am trying to pass parameter to RESTFul web server in Java from ajax.
Here is what I did </p>
<p>index.html </p>
<pre><code><!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>... | <p>You are getting 404 because <code>/Rest</code> is no where registered in any paths</p>
<ol>
<li>Your context path is <code>/Example</code></li>
<li>Then you controller is mapped to <code>/controller</code></li>
</ol>
<p>So You don't have a mapping to resolve <code>/Rest</code> since your controller is is bound to ... |
missing rows when exporting query in Ms Access to MS Excel - VBA <p>I have a query in Ms Access that runs with 227,288 rows.<br>
I made a command button which can export the query into excel. I've searched and found this code </p>
<pre><code>Private Sub Export_Click()
Dim rst As DAO.Recordset
Dim excel... | <p>Assuming that you're running the Export_Click code from within Microsoft Access, you can use the following code to invoke the "Output To" action of the DoCmd object:</p>
<pre><code>Private Sub Export_Click()
DoCmd.OutputTo acOutputQuery, "acct file", acFormatXLSX, , True
End Sub
</code></pre>
|
Why are file descriptors 1 and 2 ready for reading on manual input but not so on input redirection? <p>This question is a follow-up of '<a href="http://stackoverflow.com/q/39989647/1175080">Why does select() say that stdout and stderr are ready for reading and stdin is ready for writing?</a>' which got closed as a dupl... | <p>When you don't redirect them, file descriptors 0, 1 and 2 are all your terminal. And you can read from or write to any of them - try it! (Strictly speaking, the file descriptor is not the terminal, it just refers to the terminal)</p>
<p>When you type stuff in your terminal, your terminal is ready for reading, so al... |
No suitable HttpMessageConverter found error while executing rest service that takes multipart parameters <p>I am using Spring Integration in my project. I am trying to execute a rest service which takes multipart/formdata input parameters. I am using int-http:outbound-gateway to execute rest service. The following is ... | <p>Your problem is because you wrap one message to another. </p>
<p>What your <code>buildMessageForMultipart(multipartMap);</code> does? </p>
<p>I'm sure the simple map as payload and those header would be enough. </p>
<p>Not sure what is the point to wrap one message to another.</p>
|
tvOS: Anyway to display a subtitle outside of the AVPlayer? <p>So the scenario is that there is a view where the user can enable/disable subtitles in an app I'm helping to develop. </p>
<p>On that view there is a sample text saying "This is what captions look like", and at the moment it's just a basic, unstyled <code>... | <p>So I figured it out! It basically makes use a combination of the <a href="https://developer.apple.com/reference/mediaaccessibility/1658096-media_accessibility_function" rel="nofollow">Media Accessibility API</a>, which allows you to get the values the user has chosen for their captions/subtitle settings, Attributed ... |
How would you render this simple UI using Ract js? <p>I am new to React and I want to render the UI shown in the picture. </p>
<p>Description:
The UI consists of two main components the sidenav and the display container. The side nav shows the title and the number of questions/answers pairs in for that given tab. When... | <p>Had you read reac-router tutorial ? if not here's the <a href="https://github.com/reactjs/react-router-tutorial/tree/master/lessons/01-setting-up" rel="nofollow">link</a>.</p>
<p>Please read it careful, after that, you will have a good understanding how to acomplish your requirement using react router Links in the ... |
Using Hour and Minutes in Comparison <p>I have a table that has date and hours and i am looking to get in my <code>output > ></code> all with a particular date and hour and minutes of that day. </p>
<p>A particular person on the table can have a <code>date_added</code> of <code>10/12/2016 9:38:04 PM</code> </p>
... | <p>set date to variable datetime before</p>
<pre><code> declare @dateParam datetime
set @dateParam ='2016-12-10 9:25:04 PM'
s.date_added >= @dateParam
s.date_added >= @dateParam
</code></pre>
<p>example comparison with just hour</p>
<pre><code> if datepart(hh, @dateParam) >= datepart(hh, s.date_a... |
How to sequentially execute resolve for parent's route and then for children routes? <p>Here is my simplified routes for angular2 project:</p>
<pre><code>export const ROUTES: Routes = [
{
path: "user/:user_id",
component: UserAuthComponent,
resolve: {
_auth: UserAuthResolver
},
children: [
... | <p>Apparently, this was a <a href="https://github.com/angular/angular/issues/12148" rel="nofollow">known bug</a> and is <a href="https://github.com/angular/angular/issues/12032" rel="nofollow">fixed</a> in new <strong>2.1.0</strong> release. </p>
<p>I've confirmed that this release indeed solves the issue.</p>
|
Placing Labels programmatically over an ImageView <p>I'm making an app to solve sudokus, so in the app I'm using an Imageview that displays an empty 9x9 grid which I've placed within a relative layout. I'm trying to create the interface programmatically, so what I want to know is how can I places labels on top of the I... | <p>You can use Absolute layout to position label over other children (your grid) of the layout (has to be older child).</p>
|
php convert user input time to hh:mm:ss <p>I have an input field for time of day which is handled by a php script.</p>
<p>I want the user to be able to enter things like:</p>
<pre><code>6PM
6:30
520
1520
3p
</code></pre>
<p>and get out a valid time for mysql:</p>
<pre><code>06:00:00
06:30:00
05:20:00
15:20:00
15:00... | <p>jQuery Timepicker is a plugin to help users easily input time entries (<a href="http://www.jqueryscript.net/tags.php?/Time%20Picker/" rel="nofollow">http://www.jqueryscript.net/tags.php?/Time%20Picker/</a>)</p>
|
ActiveRecord mapping to table name with schema name as prefix <p>Has anyone experienced this issue on mapping table in ActiveRecord when table name need a schema name as a prefix (oracle)? </p>
<ol>
<li><p>Gemfile</p>
<pre><code>gem 'activerecord', '4.2.4'
gem 'activerecord-oracle_enhanced-adapter', '1.6.7'
....
</co... | <p>It looks like the problem is that you're trying to use both <code>self.table_name_prefix=</code> and <code>self.table_name=</code> together when you should be using one OR the other.</p>
<p>First let's consider how both <code>self.table_name_prefix=</code> and <code>self.table_name=</code> work.</p>
<hr>
<h3>self... |
C lang sizeof(char[]) get static size <p>I want to get char array size but I cant do that</p>
<p>let see</p>
<pre><code>#define MAX 64
char value[MAX]
value = "hi" //or something initialization
sizeof("hi") //result = 3
sizeof(value) // result = 64
</code></pre>
<p>I want to get <code>sizeof("hi") == sizeo... | <p>In the snippet that you've included, you're actually setting the size of <code>value</code> to 64. As a result <code>sizeof(value)</code> will return 64 * <code>sizeof(char)</code>.
This is correct, regardless of what you're putting into the array <code>value</code>.</p>
<p>Perhaps what you're trying to do is to ge... |
Is JavaScript Proxy supposed to intercept direct changes to underlying object like Object.Observe? <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe" rel="nofollow">MDN for Object.Observe</a> says that Observe is now obsolete and we should use "more general Prox... | <blockquote>
<p><code>o.p2 = 'v2'; // is this supposed to log o, "p2", "v2" in ECMA standard ?</code></p>
</blockquote>
<p>No, using that particular pattern.</p>
<p>Set the value at the <code>Proxy</code> object, and value will be set at <code>target</code> object.</p>
<p>Though you can also define <code>getter</c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.