input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Build translated Sphinx docs in separate directories <p>I work on a documentation that will be published in different languages. It is one of the reasons I use Sphinx.</p>
<p>I know how generate the translated version but with the setting described in the <a href="http://www.sphinx-doc.org/en/stable/intl.html" rel="no... | <p>I found a working solution by replacing the Makefile by a custom Python script (build.py).</p>
<p>Using <code>sys.argv</code>, I emulate the <code>make target</code> behaviour. I added several options for the language. Using the subprocess module, precisely its <code>call()</code> function, I am able to run command... |
how to use an if statement inside echo php <p>Okay so I have a for loop that displays books and their associated sales info...I have it displaying correctly..I have a for loop that goes through an array and displays the information. What I would like to do is have the for loop only display information about a hardcover... | <p>You could improve your code by using the <code>foreach</code> syntax. The <code>if</code> condition you suggested is close, but the <code>!</code> operator is actually acting on the array element, not on the equation. </p>
<p>I would also suggest closing the PHP tag to generate the HTML, instead of using <code>echo... |
How to detect if SimpleDB domain contains the requested item? <p>The <a href="http://docs.aws.amazon.com/sdkforruby/api/Aws/SimpleDB/Client.html#get_attributes-instance_method" rel="nofollow">AWS SimpleDB documentation</a> for the Ruby SDK provides the following example with regard to using the <code>get_attributes</co... | <p>I have never used AWS SimpleDB before but from the little knowledge I have about replication from Amazon's DynamoDB the data is usually eventually consistent - while any of the replicas handles your request to read the attributes, the process of replication the previously written data can still take place across the... |
How to generate a random name with a preceding nametag in Screeps? <p>In the Programming Game Screeps I spawn creeps by using:</p>
<pre><code>if(transporters.length < 0 && harvesters.length > 2) {
var newName = Game.spawns['SpawnZone'].createCreep([WORK,CARRY,MOVE], undefined, {role: 'transporter'});
con... | <p>You could implement a function that will generate the name in the format you want and replace <code>undefined</code> with the generated name. From Screeps <a href="http://support.screeps.com/hc/en-us/articles/205990342-StructureSpawn#createCreep" rel="nofollow">documentation</a>:</p>
<blockquote>
<p><strong>creat... |
Angular 2 + ng test: 'X' is not a known component <p>I created a new project with Angular 2.0 RTM with Angular CLI 1.0.0-beta 16:</p>
<p><code>ng init</code></p>
<p>and then ran:</p>
<p><code>ng generate component my-new-component</code></p>
<p>and then ran:</p>
<p><code>ng test</code></p>
<p>and got this:</p>
<... | <p>I was facing the same issue and it turn out that for tests you need to declare used components as well:</p>
<pre><code> beforeEach(() => {
TestBed.configureTestingModule({
declarations: [
AppComponent,
MyNewComponent
],
});
</code></pre>
|
What is the most efficient way to check if there are any char duplicates in a String? <p>I am trying to find an efficient way to check if there are any duplicate chars in a String. For example, how could I most efficiently check if a String contains more than one period?</p>
<p>My attempt:</p>
<pre><code>if (str.inde... | <p>First, don't calculate the same value more than once (<code>str.indexOf(".")</code>). Also, creating a throwaway substring is expensive.</p>
<p>There's also a second <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#indexOf(int,%20int)" rel="nofollow"><code>indexOf()</code></a> taking a starti... |
how to update a collection in mongodb <p>I had a json which is inserted in my mongo collection.Now I want to update the same json that is inserted in the collection,in such a way that I need to add new data element to that collection using the id which will be generated earlier.
eg:</p>
<pre><code>{
"name":"sam",
"a... | <pre><code>db.<collection_name>.update(
{ _id: 5sq8uye1236g },
{ $set:
{
"token": "12345"
}
}
)
</code></pre>
<p><a href="https://docs.mongodb.com/manual/reference/operator/update/set/" rel="nofollow">https://docs.mongodb.com/manual/reference/operator/update/set/</a></p>
|
Creating a sublist from a linked list based on position? <p>I'm trying to type a function that takes 2 linked list. One has the values to be printed and the second has positions for the linked list values to be printed. It gives me an error that i put as comment in the code.</p>
<p>Structs</p>
<pre><code>typedef int ... | <p>There are bunch of bad practices in the code which makes understanding (and hence debugging and maintaining) such code very difficult for you and for us.</p>
<ul>
<li>You are creating a pointer typdef when there is no intention to hide the actual data behind the pointer</li>
<li>You are creating a linked list of po... |
Hello world program for React Native throw "Could not parse the simulator list output" on MAC <p>I just started learning React Native and was trying to run my hello world app using the steps given in <a href="https://facebook.github.io/react-native/docs/getting-started.html#content" rel="nofollow">https://facebook.gith... | <p>I realized that I was using beta version of XCode. Once I installed the latest version of XCode then all error were gone and App were launched in simulator. </p>
|
metadata tag not found with describeType in production <p>I am using describeType and am able to get all of the variable and accessor metadata tags just fine in local debug, local test suite or local air build. Our web app running this code also sees the metadata just fine in production (running with browser plugin). ... | <p>so it turns out my "only thought" was the correct answer. after digging deeper I found that the keep-as3-metadata that was on our compiler options was not up to date in our grade build scripts and didn't include the tags we were using for this. Thank god!!! LOL.</p>
|
Custom Transition (Animation) between two Activities Android <p>I have an activity with 4 views inside. (<a href="http://i.stack.imgur.com/0aRpU.jpg" rel="nofollow">http://i.stack.imgur.com/0aRpU.jpg</a>).
I want to make an animation that when i click one of the 4 views (e.g. the upper right view) it will zoom in, cove... | <p>You have to design transition in style.xml </p>
<pre><code><style name="BaseAppTheme" parent="android:Theme.Material">
<!-- enable window content transitions -->
<item name="android:windowActivityTransitions">true</item>
<!-- specify enter and exit transitions -->
<item nam... |
How to set up and array with a for loop? <p>I need to write up an array which lists some animals and asks the user how many of each are left in the while. But I need this within a for loop so it keeps asking about each till there is a value for every variable. I have no real idea how to start this. Any help?</p>
| <p>How many are left in the wild?</p>
<p>You should start by initializing the array. Next use a <a href="http://docs.oracle.com/javase/1.5.0/docs/guide/language/foreach.html" rel="nofollow">For:Each loop</a> to go through each item in the array which should be linked to a type of animal. Then ask the user how many are... |
NSMutableArray that was able to unwrapped in Swiift2.2 becomes nil in Swift2.3 <p>As the title says the Array that could unwrapped in Swift2.2 turns to nil in Swift2.3(xcode8).</p>
<p>it happens in iOS10. Does somone knows the reason?</p>
<p>the self.dataObject is a json dictionary</p>
<pre><code>var array : NSMutab... | <p>I think the array is immutable in this case. Therefore, it would be necessary to init a new mutable array from an immutable one.</p>
<p>Ex.
<code>array = NSMutableArray(array: ((self.dataObject as NSDictionary)["array"] as? NSArray)!)</code></p>
|
Error Checking in R Data Set <p>I am checking a large set of data for errors and need to see if a variable includes the correct IDNumber. The correct numbers should be "A" "B" or "C", and if they are not I would like to change them to an "X"</p>
<p>I know how to do this in SAS, using:</p>
<pre><code>If Variable_Name ... | <p>Another thing to think about would be creating a new variable in the dataframe denoting the change. For example, instead of printing the change notification, creating a new boolean variable ID_Edited.</p>
<p>That way, future users (including future you) of the data can see where changes were made. If you're not pr... |
Awk Regex: match any first character <p>I'm trying to create a more effective "check if URL exist" function and I'm almost done the only roadblock is the regex.</p>
<p>So I'm looking for a regex that will match any first character of an output then print it and exit
for example the bellow code gets the source code of... | <p>I found the solution thanks to @karakfa for the suggestion</p>
<p>match the first character of an output, print it and exit</p>
<pre><code>echo "Yes, a down vote, just what I needed" | awk '{print $1;exit}' FS=""
# It will print
Y
</code></pre>
<p>Full source code of my script
<code>check_URL.sh</code> (working p... |
SQL table LEFT OUTER join query <p><a href="http://i.stack.imgur.com/Xr8FJ.png" rel="nofollow"><img src="http://i.stack.imgur.com/Xr8FJ.png" alt="enter image description here"></a></p>
<p>What's the solution for attached image? How to remove null?</p>
<p><code>ClosingQty</code> column should reflect the value purchas... | <p>The reason is that <code>NULL</code> is not the same as 0. Try this:</p>
<pre><code>P.Quantity-COALESCE(S.Quantity,0) AS ClosingQty
</code></pre>
<p>See here: <a href="http://www.w3schools.com/sql/sql_isnull.asp" rel="nofollow">http://www.w3schools.com/sql/sql_isnull.asp</a></p>
|
How to differentiate when node is called with xargs <p>Is there a way in Node.js to differentiate between a script called with xargs and a script called with a pipe?</p>
<pre class="lang-bash prettyprint-override"><code>$ echo test | xargs node test.js
$ echo test | node test.js
</code></pre>
<p>I was hoping for some... | <p>You should be able the solution described <a href="http://stackoverflow.com/a/15467539/476712">here</a> to detect if some data is being piped to node process. </p>
<p>In case of xargs, the stream is being passed to xargs rather than node, so attempting to read from stdin should give you null.</p>
|
Vi character encoding issue <p>I am trying to see the contents of a Finnish text on vi. However, it replaces some letters with numbers. For example, <code><8a></code> stands for <code>ä</code>, etc. </p>
<p>I changed the character encoding to ISO8859-1, however still when viewing the file, it cannot show the um... | <p>Try from command line:</p>
<pre><code>vim -c "set encoding=utf8" -c "set fileencoding=utf8" -c "wq" filename
</code></pre>
<p>being filename the original file you need to open with right encoding.</p>
|
Notepad++: Find Using Regular Expression and Replacing with Extra Comma <p>I have a comma delimited file that I want to add another comma after the ID: number, but before the street address, such as:</p>
<pre><code>Adam,ID:1,200,N,Sway,Rd.,Hometown,IN,46111,Website:,
Allison,ID:2,201,N,Sway,Rd.,Hometown,IN,46111,Websi... | <p>There is no need adding anything to your regex.</p>
<p>To access the whole match in the replacement string, you may use one of the following value:</p>
<pre><code>$&
$MATCH
${^MATCH}
$0
${0}
</code></pre>
<p>Add a <code>,</code> after one of these, and use in the <code>Replace With</code> field.</p>
<p>See <... |
How can you make a label fade in and out using timers in C#? <p>I am trying to use two timers to emulate the fading of a label on my form. Once the color values reach 255 in the first timer, the second timer is activated to reverse what the first timer did and bring the color values back to 0. When debugging, it works ... | <p>This is because you add multiple timer1.Tick event handlers when you change direction in the timer2_Tick. When you reach r == 255 in the second pass through - although you stop timer1 & start timer2 you still have another tick event waiting to be processed which will increment the count to 256.</p>
<p>Remove th... |
`puma:restart' invoke twice but i only call it once on my deploy app via Capistrano? <p>I tried to deploy Rails app to the server via Capistrano.
This is my code on deploy.rb</p>
<pre><code>set :repo_url, 'git@bitbucket.org:varisdaOfficial/insurance_site.git'
set :application, 'insurance_code'
set :user, ... | <p>I assume you are using the capistrano3-puma gem. That gem automatically restarts puma for you at the conclusion of a successful deployment. So that is the first time the restart task is being called.</p>
<p>Additionally, in your deploy.rb, you've defined your own custom restart task, and you are invoking it <code>a... |
Calculate new gps coordinates from 1 set of coordinates and distance? <p>so I was wondering if there was existing code/library that allowed me to calculate a new pair of gps coordinates given: distance, a pair of latitude and longituide and bearing. </p>
<p>I hope you guys can give me insight.</p>
<p>cheers!</p>
| <p>The answer that was given to me was from this link: stackoverflow.com/questions/37348207/find-location-1-km-away-in-180-degree-south-from-my-location/37349396#37349396</p>
<p>Using the following library: <a href="https://github.com/JavadocMD/simplelatlng" rel="nofollow">https://github.com/JavadocMD/simplelatlng</a>... |
C - FILE IO Read and Write Error <p>I am trying to swap the existing characters from the file with new characters one by one. The new characters are obtained by manipulating the existing characters by subtracting one from the ASCII code. The file already exists with text, but I ended up getting an infinite loop for som... | <p>try this</p>
<pre><code>#include <stdio.h>
int main(void){
FILE *fp = fopen("myfile.txt", "r+");
if (fp == NULL) {
printf("File cannot be opened.");
return -1;
}
int c;
long pos = ftell(fp);
while ((c = fgetc(fp)) != EOF){
fseek(fp, pos, SEEK_SET);//In the ca... |
What is the meaning of the IDs shown when a Docker image is pulled? <p>When pulling a Docker image from DockerHub, the CLI shows a few progress bars, each with a different ID:</p>
<pre><code>â docker pull training/sinatra
Using default tag: latest
latest: Pulling from training/sinatra
a3ed95caeb02: Pull complete
6e... | <p>Those things being pulled are the layers. Each image is made up of multiple layers, each layer has an ID. The image also has an ID. If you do <code>docker images -a</code> (for all) then you should see the other pulled IDs in the list.</p>
|
issues importing a script <p>Hello i have been working on this simple script and i have run into some rather annoying problems that i can not fix myself with the def. and import function it just won't work. here is the main script </p>
<pre><code>import time # This part import the time module
import script2 ... | <p>This is an error:</p>
<pre><code>def main():
#...
q1 = input("Would you like to some maths today? ")
if q1 == "yes":
# ...
</code></pre>
<p>Firstly, the <code>q1</code> in <code>main()</code> and the <code>q1</code> outside are not the same variable.</p>
<p>Secondly, <code>if q1 == "yes":</code> is e... |
dc charts change legend order <p>I have a stacked chart with legend. I want to change the order of legends without changing chart itself. i.e. Currently Legend is displayed in following order<br><br>
Least<br>
N/A<br>
Most<br><br>
I want to display it as follows<br><br>
Most<br>
N/A<br>
Least<br><br></p>
<pre><... | <p>Wow, that is a most annoying default! No wonder you want to change this. </p>
<p>It's completely backwards, since the order of stacks is from bottom to top:</p>
<p><a href="http://i.stack.imgur.com/RNYWV.png" rel="nofollow"><img src="http://i.stack.imgur.com/RNYWV.png" alt="wrong legend order"></a></p>
<p>Luckily... |
Why doesn't my newly-created docker have a digest? <p>I have been following the <a href="https://docs.docker.com/engine/tutorials/dockerimages/#/image-digests" rel="nofollow">Docker tutorial here</a>, and built a test image on my local OSX machine by committing changes to an existing image and tagging it with three dif... | <p>Firstly, Please keep in mind that a digest could represent a <code>manifest</code>, a layer or a combination of them (we normally called that combination an image).</p>
<p><code>Manifest</code> is a new term that introduced with Docker registry V2. Here is a short description fetched from <a href="http://www.slides... |
PHP if statement will allow me to add items to database but will not let echo or alert in Javascript <p>I would really appreciate some help with this:</p>
<p>I have a search bar. You type your interest into the search bar and it adds that interest to the database. If your interest exists in the database (as in someone... | <p>Maybe this works</p>
<pre><code>if (count($result) > 1) {
if($pdo->query($insertion) === TRUE){ //inserts 'works' into the database as a test.
echo "<script> alert('Test'); </script>";
}
}
</code></pre>
|
KNeighborsClassifier .predict() function doesn't work <p>i am working with KNeighborsClassifier algorithm from scikit-learn library in Python. I followed basic instructions e.g. split my data and labels into training and test data, then trained my model on a training data. Now I am trying to predict accuracy of testin... | <p>Did you tried to solve your issue via the following question ?</p>
<blockquote>
<p><a href="http://stackoverflow.com/questions/30813044/sklearn-found-arrays-with-inconsistent-numbers-of-samples-when-calling-linearre">sklearn: Found arrays with inconsistent numbers of samples when calling LinearRegression.fit()</a... |
Differences in erasing an entity from a list in C++ <p>I am trying to erase an entity from a list in two cases. In the first case the following worked just fine, where I have a list of pairs from which I want to erase a certain one:</p>
<pre><code>bool remove(std::list<std::pair<std::string, size_t>>& ... | <p>You're working on an invalidated iterator. That's undefined behavior. That's why <code>erase</code> returns a valid iterator.</p>
<p>If you want to only erase the first matching element, use <code>find_if</code> and then erase if the returned iterator isn't equal to <code>end()</code>.</p>
<pre><code>auto it = fin... |
Multiple Pins Google Maps <p>I am trying to add pins to a map I am creating for my website, please bare with me as I am new to this .</p>
<p>The html code only give me a maximum of 4 pins, so far I have tried to add 6 but there is more to come, can someone please tell me how to fix it? </p>
<pre class="lang-html pret... | <p>Please have a close look at where you initialize <code>var locations</code>.
You forgot the <code>,</code> behind those nested arrays after the fourth element.</p>
<p>Further remove <code>&callback=initMap</code> from the URL in line six as it causes an error.</p>
<p>Hope it helps!</p>
|
What is the best way to cache data in an ASP.Net application to prevent multiple queries? <p>I have a logic in my ASP.NET application which needs to check before some key operations if the user is eligible to execute this operation.</p>
<p>I dont want to check on each page_load on each page. What is the best way to do... | <p>If the permission is specific to the user you should store eligibility in <a href="https://msdn.microsoft.com/en-us/library/ms178581.aspx" rel="nofollow">Session State</a> and check that each time.</p>
|
User map scrolling <p>Let's say that I have a 2d plane. A 2d plane that is 10000 * 10000 units. </p>
<p>Now this plane has many objects scattered around it. Let's say these objects are rectangles. I want to be able to show the user only 500 * 500 area of any part of the map with the rectangles included.</p>
<p>My que... | <p>You could use the built-in <code>camera()</code> function:</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-js lang-js prettyprint-override"><code>function setup(){
createCanvas(100, 100);
}
function draw(... |
Android - activity2 back to activity1 fragment <p>I have a <code>List</code> view (I have used <code>Recycler</code> view ) which is in <code>activity1</code> > <code>fragment2</code> </p>
<p>from here user click on a row and go to <code>activity2</code> to show the content</p>
<p>Now when user click on back button i... | <p>Calling <a href="https://developer.android.com/reference/android/app/Activity.html#finish()" rel="nofollow">finish()</a> will finish the current activity and return the user to whatever is on top of the activity back stack. In your case it will be <code>activity1</code>.</p>
<p>The default implementation (below) of... |
How to multiply user input by a decimal number in python? <p>Hello I am having trouble with using strings and integers during multiplication. If there is something I do not think I have done anything fundamentally wrong but then again, it's not working so I probably have done! </p>
<p>This is my code as of now.</p>
<... | <p>There are quite a few issues with your code</p>
<p>First of all, you have not closed your parenthesis on lines 4 and 5</p>
<p>Secondly, you're trying to call variables by strings. That isn't how it works</p>
<pre><code>QV = (float("FRT"*"UI"))
</code></pre>
<p>should be</p>
<pre><code>QV = (float(FRI * UI))
</c... |
Moo: Add attribute to another (non-current) package <p>The following is a simplified example of my real code:</p>
<pre><code>#!/usr/bin/perl
package X;
use Moo;
sub add_attr_for_another_package {
my ($package) = @_;
eval "package $package";
has 'q' => (is=>'rw', default=>123);
}
package Y;
use Moo;
... | <p><code>package</code> affects the package into which code is compiled. It obviously won't affect code that's already been compiled (e.g. the call to <code>has</code>)! In other words, the call to <code>has</code> has to be compiled when the <code>package</code> directive is in effect to be affected by it.</p>
<pre><... |
Quartz Composer Custom Image Kernel XCode 8 <p>I'm interested in testing a custom image filter kernel using Quartz Composer. This seems like it should be possible given the docs (see Figure 9-2):
<a href="https://developer.apple.com/library/content/documentation/GraphicsImaging/Conceptual/CoreImaging/ci_custom_filters/... | <p>In quartz composer go to the patch library (Command-Return default shortcut key) search for core image filter. You can load that into composition by double clicking or if its the top of your search hit Return. Click on the patch that you loaded in and go to the patch settings panel (Command-2 default shortcut). Plac... |
Increase Disk Space on Docker Toolbox <p>I'm trying to start some very large Containers on Docker Toolbox (about 18 GB in total). Unfortunately, I always get the error that there is not enough disk space. I have a 1TB HDD and there are more than 200 GB free.</p>
<p>How can I increase the disk space for docker toolbox?... | <p>OK, I finally found the solution:</p>
<p>Remove the virtual docker-machine and add a new one:</p>
<pre><code> $ docker-machine rm default
$ docker-machine create -d virtualbox --virtualbox-disk-size "100000" default
</code></pre>
|
Scala behavior differs from Java only because Java try finally does not result in value <p>I am learning Scala and while going through Programming in Scala by Martin Odersky i confronted this statement - Scala behavior differs from Java only because Java try finally does not result in value.
Can someone explain this wi... | <p>In scala, everything is an expression, which implies that it returns a value. <code>1+1</code> expresses the value <code>2</code>. In java, try..catches essentially return void. You can't set a variable with void since that doesn't mean anything. Its an error for the java compiler.</p>
<p>This is one of those synta... |
Python list to string spacing <p>I have a list such as this</p>
<pre><code>list = ['Hi', ',', 'my', 'name', 'is', 'Bob', '!']
</code></pre>
<p>I wanted to convert this to a string, and originally, I found on stackoverflow that .join() could be used. So i did:</p>
<pre><code>x = ' '.join(list)
print(x)
</code></pre>
... | <p>To solve it in a general case, use the <code>nltk</code>'s <a href="https://github.com/nltk/nltk/pull/1282" rel="nofollow">"moses" detokenizer</a>:</p>
<pre><code>In [1]: l = ["Hi", ",", "my", "name", "is", "Bob", "!"]
In [2]: from nltk.tokenize.moses import MosesDetokenizer
In [3]: detokenizer = MosesDetokenizer... |
Pagination from servlet results using jquery (no php or jsp) <p>I have an html page (results.html) which shows all the contents of a table retrieved with a servlet using an ajax call. I need the result to be paginated.</p>
<p>Result of the servlet is printed in the div below. I want this to be paginated using jquery, ... | <p>I can't give you working code, so please stop reading if that is what you want.</p>
<p>If you're using MySQL you can pass the limit and offset variables to your query <a href="http://www.w3schools.com/php/php_mysql_select_limit.asp" rel="nofollow">Limit and offset examples</a></p>
<p>You would modify your jquery b... |
How to remove an element(s) from several arrays and append again? <p>I have a function with several arrays of <code>CGPoint</code>s and array of arrays. I have been 'manually' removing points from each of the arrays and appending them back one by one. This is certainly a tedious and inefficient approach. I am looking f... | <p>The answer is better types. First, if you want points to have shared state, then you want a reference type, not a value type. You should lift your points into a reference Location:</p>
<pre><code>final class Location {
let point: CGPoint
var isActive: Bool = true
init(_ point: CGPoint) { self.point = po... |
How can jupyter access a new tensorflow module installed in the right path? <p>Where should I stick the model folder? I'm confused because python imports modules from somewhere in anaconda (e.g. import numpy), but I can also import data (e.g. file.csv) from the folder in which my jupyter notebook is saved in.</p>
<p>T... | <p>From the error "ImportError: No module named datasets" <br>
It seems that no package named datasets is present.
You need to install datasets package and then run your script. <br>
Once you install it, then you can find the package present in location <br>"/Users/me/anaconda/lib/python2.7/site-packages/" or at the <... |
How to generate annotation image dynamically in Swift <p>I am displaying custom roads on the map and to display details about road, I need to display annotation with custom images (a shield).</p>
<p>But now I want to display shields with road numbers. As there are so many different roads, I cannot add all these shield... | <p>If you know that your image is always going to be certain dimensions (say, a square) then you know where the white space for the number will be. You can create a DynamicShield class which has the common image and a UILabel which positions the text in accordance with the dimensions of the common shield image.</p>
|
Indentifier not found in non-program loop script <p>I have tried to look up the "identifier not found" error only to find posts where the function must be moved outside the main loop or should use a forward declaration. However, my script is used as a module for a game engine thus has no real main loop and the functio... | <p>if getFriendPersonaName() is a member function then you have forgotten to define it the correct way so it will look like:</p>
<pre><code>string Steam::getFriendPersonaName(int steamID)...
</code></pre>
<p>if it is not a member then you can't access it. however you can Only access it if getFriendPersonaName() is a ... |
How to use Express with Socket.io? <p>I have the Express code in server JS file:</p>
<pre><code>app.post('/confirm', function (req, res) {
// Here I need to send socket with emit()
});
</code></pre>
<p>Below mentioned code I have Socket.io:</p>
<pre><code>io.on('connection', function (client) {
// All methods
... | <p>You can emit data to specific connected sockets using the following:</p>
<pre><code>io.to(socket_id).emit('something', {"bar":"foo"});
</code></pre>
<p>The "socket_id" variable is, as probably guessed, the socket.id from the connected socket. </p>
<p>You will probably have to store them along with some other iden... |
Add a value 0 to a variable if EditText is empty <p>Here's the code I'm using:</p>
<p><code>EditText ii1 = (EditText)findViewById(R.id.i1);
String iii1= (String)ii1.getText().toString();
ind1=Double.parseDouble(iii1);</code></p>
<p>I need that ind1 acquire value 0 if the EditText is empty.
I already tried using <... | <p>This should work <code>if(ind1 == null || ind1.isEmpty()){ind1=0;}</code></p>
|
Web App for clearing files <p>In my environment at work, which is primarily RHEL 6/7, we have a file system that keeps filling up with log files, that are not incredibly important, so we <code>cat /dev/null > $file</code> in that specific directory.</p>
<p>My limitations are not bound by root as our account has tha... | <p>Your server admin(s) should correctly configure logrotated. Why on earth cron jobs are a "security" concern when others are given root access to the box I have no idea... </p>
|
How to free a dynamically allocated array of structs in c? <p>I am learning C and I can't free a dynamically allocated array of structs.
Here is my sample code:</p>
<pre><code>typedef char Str50[50];
typedef struct exam {
Str50 firstname;
Str50 lastname;
Str50 className;
int score;
Str50 date;
} E... | <p>You allocated an array of objects. You can't free them by elements. What you can do is just free <code>examDB</code> itself:</p>
<pre><code> free(examDB);
</code></pre>
<p>The reason to do this is, as I said before, you are allocating a whole array of null values, as this code you posted states:</p>
<pre><code>... |
soap client error bad request <p>I need to use a webservice with php and I got the bad request error,</p>
<p>this is my code:</p>
<pre><code>try{
$client = new \SoapClient("http://54.88.59.192/Cashier/SwCashier.asmx?wsdl");
$params = new \SoapVar('<?xml version="1.0" encoding="UTF-8"?><XMLTransaccio... | <p>Try to check validity of your request:</p>
<p>$client = new \SoapClient("<a href="http://54.88.59.192/Cashier/SwCashier.asmx?wsdl" rel="nofollow">http://54.88.59.192/Cashier/SwCashier.asmx?wsdl</a>", <strong>array('trace' => 1)</strong>);</p>
<p>$params = new \SoapVar('GetServiceTransaction($params);</p>
<p><stro... |
Is there a way to add different textures to an object with TextureLoader.load <p>I would like to add different textures to each face of a box but I am not sure if <code>loader.load</code> is the way to do it, right now I have:</p>
<pre><code>loader.load('img/brick.jpg', function ( texture ){
var boxGeometry = new ... | <p>You can just load an image with <code>loader.load</code>, and store it in a variable:</p>
<pre><code>var loader = new THREE.TextureLoader();
var brick = loader.load('img/brick.jpg');
var occlusion = loader.load('img/ao.jpg'); //Example texture
//More textures here
</code></pre>
<p>You can then apply it like so:</... |
How to add 5px border around Videoview? <p>I have the following videoview: </p>
<pre><code> <VideoView
android:layout_width="200dp"
android:layout_height="316dp"
android:layout_below="@+id/instructions"
android:layout_centerHorizontal="true"
android:id="@+id/instructionsvideo... | <p>You could put VieoView inside some other (RelativeLayout, LinearLayout or even FrameLayout) and set margin & black background to this parent (and of course center your VideoView in both directions).</p>
|
How can I search across multiple codemirror instances? <p>Let's say I have the following simple page with two CodeMirror instances:</p>
<pre><code>const body = document.querySelector('body')
const title = document.createElement('h1')
title.textContent = 'This is a document with multiple CodeMirrors'
body.appendChild(... | <p>The <strong>find</strong> and <strong>replace</strong> commands are linked to the <strong>dialog</strong> addons and there doesn't seem to be a way to access them through the instances, at least not with a query that is not passed through a dialog.</p>
<p>But you can recuperate most of what's in search.js and add i... |
Convert cURL (--data-binary) Post Command to RestSharp Code <p>How to convert this cURL to <a href="http://restsharp.org/" rel="nofollow">RestSharp</a>?</p>
<p>curl -i -XPOST '<a href="http://localhost:8086/write?db=mydb" rel="nofollow">http://localhost:8086/write?db=mydb</a>' --data-binary 'cpu_load_short,host=server... | <p>Figured that out so answering my question:</p>
<pre><code>var client = new RestClient("http://localhost:8086");
client.Authenticator = new HttpBasicAuthenticator("username", "password");
var request = new RestRequest ("write?db=mydb", Method.POST);
request.AddParameter("text/plain", "cpu_load_short,host=server01,re... |
Display the title and year of all non SH and non CH films that were produced in the same year as any of the SH or CH videos were produced <p>Ok so I am having some issues with a SQL question. I have some code for the previous question and I feel that it has to be implemented with this question in some way.</p>
<pre><c... | <pre><code>SELECT
m1.production_year, m1.title
FROM
movie m1
WHERE
m1.genre_code NOT IN ('SH', 'CH')
AND m1.production_year IN (
SELECT m2.production_year FROM movie m2 WHERE m2.genre_code IN ('SH', 'CH')
)
</code></pre>
|
How to use jsdoc for a meteor application <p>What is the correct way to use JSDoc within a meteor application?
Below there is my way to document the code, but there is no 'connection' between all parts.
Everything belongs to the example template, so the output of jsdoc should be structured correctly.</p>
<p>How can I ... | <p>Where I work, we encountered the same situation a few months ago, what we concluded was that <code>jsdoc</code> was just not adapted to auto-doc with <code>Meteor</code>'s implementation. We ended up using <a href="https://github.com/fabienb4/meteor-jsdoc" rel="nofollow">https://github.com/fabienb4/meteor-jsdoc</a> ... |
Golang XML Parsing issue <p>I have just started experimenting with Google's GO (Golang) language, and have run into a problem that I would like to solve efficiently.
So I would like to extract some data from an XML file, that is available online (I get it as the response of a polling session), but I don't know how to ... | <p>Since its available online you can use <code>net/http</code> client to retrieve the xml. Then you can use <code>encoding/xml</code> package and convert the response body to struct object, it has <code>xml.Unmarshal</code> method to convert xml string to struct - hence you should write the struct first.</p>
<p><code... |
Calculate 15 minutes ago in shell <p>I have a time-stamp like 7:00:00, which means 7am.</p>
<p>I would like to write a short command that returns 06:45:00, or simply 06:45, preferably using date command so that I can avoid long shell script. Do you have any elegant solution?</p>
<p>I'm also looking for a 24h format. ... | <p>With GNU <code>date</code>, use <code>7:00:00 AM - 15 minutes</code> as <code>d</code> (<code>--date</code>) string :</p>
<pre><code>% date -d '7:00:00 AM - 15 minutes' '+%H:%M'
06:45
</code></pre>
<p><code>+%H:%M</code> sets the output format as <code>HH:MM</code>.</p>
|
How to load image from camera or photo library in Swift <p>How do you take a photo with the camera or pick an image from the photo library to be able to display it in an imageView for example?</p>
<p>Any help on this would be appreciated.</p>
| <p>I'm using the following: </p>
<p><strong>Camera Class</strong> as helper class: </p>
<pre><code>import Foundation
import MobileCoreServices
class Camera {
var delegate: protocol<UINavigationControllerDelegate, UIImagePickerControllerDelegate>?
init(delegate_: protocol<UINavigationControllerDel... |
AFrame No mesh.geometry.vertices attribute in version 0.3.0 <p>I am trying to recreate the game tutorial from the version 0.2.0 docs using 0.3.0:
<a href="https://aframe.io/docs/0.2.0/guide/building-an-advanced-scene.html" rel="nofollow">https://aframe.io/docs/0.2.0/guide/building-an-advanced-scene.html</a></p>
<p>The... | <p>They now default to BufferGeometry.</p>
<p>You can opt-out: <code><a-entity geometry="buffer: false"></code></p>
<p>Or old data before conversion is also stored in <code>this.geometry.metadata</code>.</p>
|
Unable to kill the recursion with return functions <p>I am in situation where I'm trying to use recursion within a function with double return type. I actually want to display 49 using recursion but it displays 10. I'm not able to understand the mechanism behind this. From what I understood after debugging, the counter... | <p>You need to assign the returned values to i. You pass the value of i, not a reference to it, so updating it in the method doesn't update i in the scope of the caller.</p>
<pre><code>public static void main( String[] args)
{
int i = 10;
i = counter(i);
System.out.print(i);
}
public static int counter(in... |
Open several popups at the same time <p>Inside a jquery $.getJSON call, I create several markers and popups, then bind the popups to the markers:</p>
<pre><code>$.each(points, function(index, p) {
var marker = L.marker(L.latLng(p.lat, p.lon), { title: p.text });
var popup = L.popup().setContent(p.text);
marke... | <p>You can use a layerGroup containing all your popups. That way you have all the functionalities of group control for your popups.</p>
<p>I reproduced a basic example on JSfidle (<a href="https://jsfiddle.net/vaillant/f4zpr6us/" rel="nofollow">https://jsfiddle.net/vaillant/f4zpr6us/</a>) but you can imagine removing ... |
How to run a function attached to an angular controller just once in a binding <p>I attached a function to the scope, and i wanted to run it in a binding, like this:</p>
<pre><code>var myApp = angular.module('myApp',[]);
function MyCtrl($scope) {
var count = 0;
$scope.f = function () {
count++;
r... | <p>Angular works by binding a model to view through a scope. Every so often, it will run a digest cycle on a scope to update the associated view. During the digest cycle, (almost) all bindings within that scope are reevaluated at least once - and possibly multiple times, since the digest cycle repeats multiple times if... |
Make green nullsrc to black <p>I have a video which hasn't 1920x1080 so I need to make it.</p>
<p>I try to use next command:</p>
<pre><code>ffmpeg -i "video.avi" -filter_complex "nullsrc=size=1920x1080 [0:v]; [0:v] overlay=shortest=1:x=200:y=100" -r 30 -c:v libx264 -preset fast -crf 18 -profile:v high -bf 2 -flags +c... | <p>It is simpler to just use the <a href="https://ffmpeg.org/ffmpeg-filters.html#pad" rel="nofollow">pad filter</a> to add the frame:</p>
<pre><code>ffmpeg -i input -filter_complex "pad=1920:1080:(ow-iw)/2:(oh-ih)/2" output
</code></pre>
<p>Alternatively, if you still want to use the overlay filter for whatever reaso... |
Wordpress: How to display blog posts with multiple equal columns under image? <p>I am trying to display all blog posts like a magazine article. Please see link below for the exact format. </p>
<p><a href="http://imgur.com/a/jKAlM" rel="nofollow">http://imgur.com/a/jKAlM</a></p>
<p>Single.php</p>
<pre><code><div c... | <p>Not sure exactly what your problem is since there's no call to show the featured image here, but it's worth pointing out that your:</p>
<pre><code><div class="article-single">
</code></pre>
<p>Has no closing <code></div></code> tag anywhere. That might be borking up your layout. Seems like it should co... |
rubocop "undefined method" for everything <p>I'm using rubocop with syntastic to write Chef code.</p>
<p>Something weird happens where after I satisfy all of rubocop's suggestions it flags every function call "undefined".</p>
<p>For example here it is flagging an extra space (this is a Chef resource I am writing):
<a... | <p>You'll have to disable that Rubocop rule. Chef uses a DSL, meaning there are methods that are magically injected into the context which Rubocop can't know about.</p>
|
Angular 2: change DOM elements outside the root AppComponent <p>I have an observable -- <code>loading$</code> -- that outputs <em>true</em> when I want to show a loading overlay in the UI, and <em>false</em> when it's time to remove that overlay. The visibility is controlled with a CSS class.</p>
<p>When the Observabl... | <p>Try to do like this:</p>
<pre><code><my-app>
<div class="your-class-for-loading"></div>
</my-app>
</code></pre>
<p>When <code>my-app</code> is ready, div will be automatically removed.</p>
|
How to change color of TreeViewItem from DataContext <p>This may sound like a stupid question, but I honestly can't figure out how I'm supposed to change the color of the items in my TreeView, and surprisingly there doesn't seem to be anyone on the internet who has given a straight answer to this.
<a href="http://i.st... | <p>you have to override the template of treeviewitem . put a controltemplate and a grid inside that.then you can change the background and other properties of grid.
after thet put a textblock in thad and change the color of that.
hope it work</p>
|
How to Let Spark Handle Bigger Data Sets? <p>I have a very complex query that needs to join 9 or more tables with some 'group by' expressions . Most of these tables have almost the same of numbers of the rows. These tables also have some columns that can be used as the 'key' to partition the tables. </p>
<p>Previously... | <blockquote>
<p>My tests turned out if the row count of each table is less than 4,000,000, the application can still run pretty nicely. However, if the count is more than that, the application writes hundreds of terabytes of shuffling </p>
</blockquote>
<p>When joining datasets if the size of one side is less than a... |
React router Uncaught Type error after updating react router <p>I just updated my react-router and react to the latest versions. Now my project keeps giving me an error on the browser saying that "Uncaught TypeError: Cannot read property 'Route' of undefined".</p>
<p>What should I do to solve this error. Here are my p... | <p>You need to use <code>ReactDOM.render()</code>. From v0.14 onwards react has split the library into <code>ReactDOM</code> and React. Thats the reason for you error in the current verison.</p>
<pre><code>Router.run(routes, function (Handler) {
ReactDOM.render(<Handler />, document.getElementById('react-con... |
Int will not work properly <p>I am very new to coding, have only completed a few hours of YouTube videos to learn thus far. I am trying to complete a practice code and am facing some trouble. </p>
<p>I have attached a part of the code below. When I am entering value in (10,12,14, and 16) the code is still responding w... | <p>So, keep in mind that the constants <code>16</code>, <code>"16"</code>, <code>" 16 "</code> are all different things and non-equal to each other.</p>
<p>The other thing is that you need to show us what your types are. As Java is statically typed, that type information can actually help determine the behavior that y... |
Google driver API called with PHP returns a response but does not upload image <p>Thanks for your time,</p>
<p>I have this code:</p>
<pre><code>$googleClient = Google::getClient();
$googleClient->setApplicationName("aiesec");
$googleClient->setScopes(\Google_Service_Drive::DRIVE);
//$googleClient->setSubject... | <p>Its possible that the PHP client (beta) is still using v2 APIs (when I checked the <a href="https://developers.google.com/api-client-library/php/guide/media_upload" rel="nofollow">PHP docs</a> about it). Try out to use <code>insert</code> instead of <code>create</code>.</p>
<p>Additionally, a <a href="http://stacko... |
std::cout seems to be printing out an extra "|" when called initially <p>I am working on a portion of my code that is suppose to output the error message correctly. </p>
<p>Please see below screenshot, I am using on bash</p>
<p>./myProgram < input3a.in | diff -a -y output3a.out - </p>
<p>Left hand side is what I ... | <p>Learning to be a software engineer is about breaking problems down into manageable chunks, and here we have a couple of doosies. Lets rephrase your question slightly:</p>
<blockquote>
<p>I am getting unexpected characters displayed when <code>diff</code> the output of my program against a file containing output o... |
Firebase verifyIdToken hangs <p>When I try to validate a token generated on the front end on my Node.js server, the function just hangs forever. Here is my code:</p>
<pre><code>const firebase = require('firebase').initializeApp({
serviceAccount: '******************.json',
databaseURL: "https://********************... | <p>I was sending the wrong data in the cookie. Use the <code>firebase.auth().currentUser.getToken(true)</code> function to get the correct token.</p>
|
Getting bundled extras from a notification reliever intent to a started activity <p>I have a notification receiver that is being called from my alarm.</p>
<p>The notification receiver bundles the data for a new intent (activity) and starts it like this:</p>
<pre><code>// Create an in intent to go to the new alarm vid... | <p>Replace all with the following:</p>
<pre><code>Intent repeatingAlarmIntent = new Intent(context,RepeatingAlarmActivity.class);
repeatingAlarmIntent.putExtra("AlarmVidId", VideoId);
repeatingAlarmIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
repeatingAlarmIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.st... |
What compiler to use for angular2 typescript <p>I see there are many options to compile typescript and generate JavaScript out of it like babel, typing, commonjs, systemjs, etc.</p>
<p>What is the best and easy one for angular2 application?</p>
| <p>Babel and typescript are super set of JavaScript they compile to JavaScript using typescript\babel compiler.</p>
<p>Best way to start with Angular is the <a href="https://angular.io/docs/ts/latest/quickstart.html" rel="nofollow">Quick Start using Typescript</a>. you may write Angular in Vanilla JavaScript. </p>
<p... |
Can't set root MySQL password to null <p>When installing mysql, I didn't put anything in the root password fields, but when I ran <code>mysql -u root</code> I still got <code>Access denied for user 'root'@'localhost'</code>.</p>
<p>I started mysql up in safe mode without the grant tables, <code>sudo mysql_safe --skip-... | <p>You forgot </p>
<pre><code>FLUSH PRIVILEGES;
</code></pre>
<p>Step by step it will be like this</p>
<p>Stop the MySQL Server.</p>
<pre><code>sudo /etc/init.d/mysql stop
</code></pre>
<p>Start the mysqld configuration.</p>
<pre><code>sudo mysqld --skip-grant-tables &
</code></pre>
<p>Login to MySQL as root... |
Clojure atomic derive and reset of an atom <p>I wrote a function to get the old value of an atom while putting a new value, all in one atomic operation:</p>
<pre><code>(defn get-and-reset! [at newval]
"Resets atom to newval and returns the old value. Atomic."
(let [tmp (atom [])]
(swap! at #(do (reset! tmp %) ... | <p>Yes, that will work with the current implementation of atoms in Clojure, and is (almost) guaranteed to work by contract.</p>
<p>The key here is that atoms are <em>sychronous</em>. Therefore, the inner <code>swap!</code> is guaranteed to complete before the outer <code>swap!</code>. Since <code>tmp</code> is only ... |
javascript regex for alphabetical range, for instance AF-BC <p>I'm trying to use javascript to check if a two-character string is in a certain alphabetical range. If the range would be AF to AZ i could use:</p>
<pre><code>var regAfAz = /^[a][f-z]/i;
</code></pre>
<p>But what if the range would be for example AF to BH... | <p>You're looking for something like this:</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-js lang-js prettyprint-override"><code>var reg = /(a[f-z]|b[a-h])/i;
console.log(reg.test('ab'));
console.log(reg.tes... |
Infinite Scroll - To identify the pagination url pattern <p>I am trying to find the pagination url pattern for this site: <a href="http://www.thetradefinder.co.uk/searchresult.aspx?loc=london&name=plumbers" rel="nofollow">http://www.thetradefinder.co.uk/searchresult.aspx?loc=london&name=plumbers</a>
, which has... | <p>Request Payload as "{'counter':'x'}" it's send to <a href="http://www.thetradefinder.co.uk/searchresult.aspx/BindSearchResult" rel="nofollow">http://www.thetradefinder.co.uk/searchresult.aspx/BindSearchResult</a> where x goes from 10 plus 10.</p>
|
What the value should I input on property with Class as its Datatype in c#? <p>So, guys, Let's say there are 3 classes (Program.cs , Animal.cs and Dog.cs)</p>
<p>On Animal.cs ,
I will a simple attribute/methods something like this :</p>
<pre><code>public class Animal
{
public string Name { get; set; }
public... | <p>Here are some things you should know:</p>
<ol>
<li><p>When a class is instantiated, the instance of that class is referred to as an object. Classes are typically referred to as reference types. In OO jargon - If you were making cookies, then a cookie cutter would be the class, and the object would be the cookie tha... |
Translations Don't Apply to All Points <p>Consider the following vertex shader:</p>
<pre><code>attribute vec4 a_Position;
uniform mat4 u_ModelMatrix;
void main() {
gl_Position = u_ModelMatrix * a_Position;
gl_PointSize = 3.0;
}
</code></pre>
<p>In my Javascript program I manipulate the <code>u_ModelMatrix</co... | <p>Buffers get bound to vertex attributes when you call <code>gl.vertexAttribPointer</code>. Whatever buffer was bound to <code>gl.ARRAY_BUFFER</code> at the time you call <code>gl.vertexAttribPointer</code> is now bound to that attribute. Above you're creating a new buffer but since there is no call to <code>gl.vertex... |
Confusion when it comes to Two's Complement <p>I'm currently trying to figure out how to do math when it comes to signed numbers. I kind of understand the concept of Two's complement, but knowing how to use it fully is what confuses me.</p>
<p>This is the problem I am currently dealing with:</p>
<pre><code>1100.1111.... | <p>Take 2's complement of only negative numbers and then add them with positive numbers.
<br><br>
One more thing, how u r getting 0011.0000.1111 as 2's complement of 1100.1111.1110, <br>
It should be 0011.0000.0010 &nbsp or else I didn't get your binary representation.</p>
|
In C++, how is cin and cout objects in relation to its class iostream? <p>I am taking Udacity beginner course for android app, and it says that class is something that has fields(variables) & methods, which can be used to instantiate an object. Basically, class is a blueprint for an object and an object is an insta... | <blockquote>
<p>In C++, 'cin' and 'cout' are known as objects of class <code>iostream</code>.</p>
</blockquote>
<p>That is not correct. </p>
<p>Here's what the standard says about their types:</p>
<pre><code>namespace std {
extern istream cin;
extern ostream cout;
extern ostream cerr;
extern ostream cl... |
How can i remap my surface pro 4 pen button? <p>Hey i've spent the past 6 hours trying all possible solutions with no luck. I have a third party dock for my surface pro for desktop. I want to toggle it using a key board shortcut (CTRL+SHIFT+W) so i'm trying to make my stylus work so that i simply click the eraser butto... | <p>i do not have Surface pro 4 so i can not test it out if it works.</p>
<p>but i now this product is a Touchscreen Tablet with WINDOWS 10 pro</p>
<p><strong>% = not SHIFT</strong> in <strong>autohotkey</strong> it must be</p>
<p><strong>+ = SHIFT</strong></p>
<p>and the styles pen does use a driver
if the [styles ... |
Ruby: Food Menu that calculates and displays balance of your choice <p>Below is a method that displays a menu using a hash. I can't figure out how to use the input to then calculate and display the balance of the users choice/s. I'm also struggling with the concept of class initialization and how that could help here. ... | <p>If users enter quantities of items as integers</p>
<pre><code>tot = 0
product_menu_hash = {
"Coffee" => 4.00,
"Soft Drink" => 4.00,
"Sandwich (Meat)" => 9.50,
"Sandwich (Veg)" => 8.00,
"Coffee Maker" => 50.00,
"Bag of Coffee (250g)" => 13.25,
}
puts "COFFEE SHOP"
product_menu_hash.each_wit... |
F test with python, finding the critical value <p>Using python, Is it possible to calculate the critical value on F distribution with x and y degrees of freedom? In other words, I need to calculate the critical value given a x degrees of freedom and a confidence level 5%, but i do not see the table from statistical boo... | <p>IIUC, you can use <a href="http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.f.html" rel="nofollow"><code>scipy.stats.f.ppf</code></a>, which gives the inverse of the cdf:</p>
<pre><code>>>> import scipy.stats
>>> scipy.stats.f.ppf(q=1-0.05, dfn=3, dfd=39)
2.8450678052793514
>>... |
what's the difference of sqoop import to hdfs and to hive? <p>I was able to use sqoop to import a mysql table "titles" to hdfs using command like this:</p>
<pre><code>sqoop import --connect jdbc:mysql://localhost/employees --username=root -P --table=titles --target-dir=titles --m=1
</code></pre>
<p>Now I want to impo... | <p>As Amit has pointed out, since you already created the HDFS directory in your first command, Sqoop refuses to overwrite the folder <code>titles</code> since it already contains data.</p>
<p>In your second command, you are telling Sqoop to import (once again) the whole table (which was already imported in the first ... |
Cause of Error Message "Error:(27) Tag <manifest> attribute package has invalid type 4." <p>When trying to build my app, I get the following error message: "Error:(27) Tag <manifest> attribute package has invalid type 4." Any ideas on what is causing this? Here is a copy of my manifest:</p>
<pre><code><manife... | <p>I think it is because, in your manifest, you've set your package name (line 2) to be</p>
<pre><code>package="com.dummy.tanc"
</code></pre>
<p>and in when defining the activity (line 18), you've used</p>
<pre><code>android:name="com.google.example.games.tanc.MainActivity"
</code></pre>
<p>Because of this mismatch... |
How the Regex C# Regex groups are identified <p>I have a Regex expression:</p>
<pre><code>@"(?<one>M\/S\s(\w+?\s)+(?<two>(U22334)))"
</code></pre>
<p>...which is tested against the string:</p>
<pre><code>"M/S ALPHA DAILY LIVING PRODUCTS INDIA PRIVATE LIMITED U22334"
</code></pre>
<p>My desktop Hero Re... | <ul>
<li>Group 1 is defined by <code>(\w+?\s)</code> and it captures only last iteration</li>
<li>Group 2 is defined by <code>(U22334)</code></li>
<li>Named group <code>one</code> is defined with whole regex definition</li>
<li>Named group <code>two</code> is defined by <code>(?<two>(U22334))</code></li>
</ul>
<... |
Collecting application trace on a rasberry pi <p>I am working on a project that involves collecting kernel level and application level traces on a Raspberry pi. I was wondering if anyone has any application that might be suitable for this purpose? If not a rasberry pi. What way can i collect log trace on a linux system... | <p>A very simple way to get a variety of traces is to use the Perf tool. <a href="https://perf.wiki.kernel.org/index.php/Main_Page" rel="nofollow">https://perf.wiki.kernel.org/index.php/Main_Page</a></p>
<p>A simple use would look like: </p>
<p><code>perf record ./myapp</code></p>
<p>and then run the following to se... |
In iPhone App How to Add an .edu Email verfication? <p>I am trying to create a function that restricts sign up to strictly .edu sign up. How could I implement a function that would allow any University student to sign up as long as they have a .edu sign up. I have a Facebook registration function but after this, I want... | <p>You could use a regular expression to check that it is a valid email ending in .edu, you could use a helper function like this:</p>
<pre><code> func validate(email: String) -> Bool {
do {
//instantiate a regex checking for valid email ending in .edu
let regex = try NSRegularEx... |
Troubles with my vertical alignment <p>I've followed several tutorials or "tips" on how to accomplish this, yet it seems when I do one thing, it breaks something else which is just pushing me further away from my goal.</p>
<p>Currently its center aligned as I want, now to center align it vertically.</p>
<p>'line-heig... | <p>You can use <code>flexbox</code> with <code>align-items:center;</code> and <code>justify-content:center</code> on <code>.parent</code>.</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-... |
Calling Firebase Analytic's getInstance() every time vs. storing instance as a static variable in Application class <p>I'm trying decide which of the following is the proper way to do this:</p>
<ol>
<li>Calling <code>FirebaseAnalytics.getInstance(Context)</code> from every activity, fragment, and service that I'm logg... | <p>The <a href="https://firebase.google.com/docs/reference/android/com/google/firebase/analytics/FirebaseAnalytics" rel="nofollow">documentation</a> states:</p>
<blockquote>
<p>public static FirebaseAnalytics getInstance (Context context)</p>
<p>Returns the singleton FirebaseAnalytics interface.</p>
</blockquot... |
Failed to implement Go interface because of pointer receiver <p>My <code>go test</code> can not be passed. What's wrong? What's the meaning of <code>(Handle method has pointer receiver)</code></p>
<pre><code>package ipc
import (
"testing"
)
// import (
// "encoding/json"
// "fmt"
// )
type Request struct {
... | <p>1- You may use </p>
<pre><code>server := &EchoServer{}
</code></pre>
<p>instead of </p>
<pre><code>server := EchoServer{}
</code></pre>
<p><a href="https://golang.org/ref/spec#Method_sets" rel="nofollow">Method sets</a>:</p>
<blockquote>
<p>A type may have a method set associated with it. The method set o... |
How to join duplicate column name in joins in SQL Server? <p>I have two tables, one is <code>Employee</code> and other one is <code>Dept</code>. </p>
<p>The <code>Employee</code> table has columns which are <code>ID</code>, <code>Name</code>, and <code>DeptId</code>, and <code>Dept</code> table has columns <code>ID</c... | <p>Use an Alias </p>
<pre><code>Select E.ID as EmpID
, E.Name
, D.ID as DepID
, D.DeptName
From Employee E
Inner Join Dept D
On E.Employee.DeptID = D.Dept.ID
</code></pre>
|
Ceylon plugin failed in Android Studio <p>I recently saw it article in infoq:</p>
<p><a href="https://www.infoq.com/news/2016/09/ceylon-13-android-support" rel="nofollow">https://www.infoq.com/news/2016/09/ceylon-13-android-support</a></p>
<p>I installed the plugin in Android studio 2.2 without problems. But when In ... | <p>This is actually a <a href="https://github.com/ceylon/ceylon-gradle-android/issues/6" rel="nofollow">bug in the ceylon-gradle-android plugin</a>, that has been fixed in 1.0.1. </p>
<p>Upgrade the version in <code>app/build.gradle</code>, resync the project and do <code>Tools > Ceylon > Reset Ceylon model</cod... |
Is that possible to put web code locally when building hybrid apps using native language? <p>My friends and I are building an app using native language on ios and android page. We want to use one or two pages using angular/ionic. I have wrote some ionic pages which are invoked by native languages through url. However, ... | <p>You can take a look at the open <a href="https://github.com/uberspot/2048-android" rel="nofollow">source code of 2048</a> which has web code stored locally in the assets.</p>
|
Swinject - Ambiguous reference to member <p>I am using <a href="https://github.com/Swinject/Swinject" rel="nofollow">Swinject</a> in my <code>Swift 3</code> app. When I tried</p>
<pre><code>let container = Container()
container.register(NetworkModeling.self) { _ in Network() }
</code></pre>
<p>I get an error saying</... | <p>I faced the same issue and i think compiler could be a bit more verbose in this case.</p>
<p>Anyway, my problem was on my side, not in <a href="https://github.com/Swinject/Swinject" rel="nofollow">Swinject</a></p>
<p>Check the following:</p>
<ol>
<li><p><code>NetworkModeling</code> and <code>Network</code> are vi... |
Saving TableView Array at indexPath in Swift <p>I have two tableView running in my project.I have successfully passed data from my first tableView to second tableView controller using segue.I am trying to save the data which i passed to secondViewController using NSUserDefaults.My partial code below....</p>
<p>First V... | <p>In <code>AppDelegate</code> <code>applicationDidFinishLaunching</code> register an empty array as default value for the key "NewArray". </p>
<pre><code>let defaultValues = ["NewArray": [String]()]
UserDefaults.standard.register(defaults: defaultValues)
</code></pre>
<p>In <strong>Second VC</strong> define <code>ne... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.