Id
int64
34.6M
60.5M
Title
stringlengths
15
150
Body
stringlengths
33
36.7k
Tags
stringlengths
3
112
CreationDate
stringdate
2016-01-01 00:21:59
2020-02-29 17:55:56
Y
stringclasses
3 values
39,758,094
Clearing Tensorflow GPU memory after model execution
<p>I've trained 3 models and am now running code that loads each of the 3 checkpoints in sequence and runs predictions using them. I'm using the GPU.</p> <p>When the first model is loaded it pre-allocates the entire GPU memory (which I want for working through the first batch of data). But it doesn't unload memory when it's finished. When the second model is loaded, using both <code>tf.reset_default_graph()</code> and <code>with tf.Graph().as_default()</code> the GPU memory still is fully consumed from the first model, and the second model is then starved of memory.</p> <p>Is there a way to resolve this, other than using Python subprocesses or multiprocessing to work around the problem (the only solution I've found on via google searches)?</p>
<python><tensorflow><gpu>
2016-09-28 21:38:34
HQ
39,758,193
Should I use a macro or a variable?
<p>I am rewriting a function and I noticed one particular variable is never reassigned after initialization. Is there any reason NOT to simply convert this variable to a macro? Is a macro ALWAYS preferable in this case?</p> <p>Thanks!</p>
<c><variables><macros>
2016-09-28 21:46:02
LQ_CLOSE
39,758,517
fetchmail: benefits of having ssl certificate and fingerprint checking
<p>I am trying to decide on a new e-mail service. I use fetchmail to fetch my e-mail and process it using procmail. Some of the email services (etc. gmx.com, outlook.com, etc) do not seem to require the certificate and the fingerprint checked. Some others, such as inbox.com or gmail.com do. I am wondering if there is a security hole in going from the latter kind to the former. What is the value of the certificate checking? Sorry that i am not a cryptography guy but I would not like to have a security hole than needed.</p> <p>Thanks!</p>
<linux><ssl><fetchmail>
2016-09-28 22:14:55
LQ_CLOSE
39,758,721
React-Native: Show loading screen till the webview is loaded
<p>I have at the moment a component SplashScreen which I'm rendering first till my state is set. I would like somehow to find a way how to still show this component while my webview is loaded. I added the onLoadEnd to my webview and looks like I get my message back when its finished loading, the problem is that if I load first the splashscreen and wait for the state to be changed onLoadEnd actually will never be changed because the webview is not yet rendered. Is there a good method how to do this?</p>
<android><reactjs><webview><react-native>
2016-09-28 22:38:16
HQ
39,759,071
error while starting kafka broker
<p>I was able to successfully set up zookeeper and one kafka broker yesterday. Everything worked as expected. I shut down kafka (ctrl + c) and then zookeeper.</p> <p>Today I started zookeeper and when I started kafka (<code>bin/kafka-server-start.sh config/server0.properties</code>), I get the following error. I tried various remedies suggested (removing completely my kafka installation and doing it again from scratch). Still I get same error.</p> <pre><code>[2016-09-28 16:15:55,895] FATAL Fatal error during KafkaServerStartable startup. Prepare to shutdown (kafka.server.KafkaServerStartable) java.lang.RuntimeException: A broker is already registered on the path /brokers/ids/0. This probably indicates that you either have configured a brokerid that is already in use, or else you have shutdown this broker and restarted it faster than the zookeeper timeout so it appears to be re-registering. at kafka.utils.ZkUtils.registerBrokerInZk(ZkUtils.scala:305) at kafka.utils.ZkUtils.registerBrokerInZk(ZkUtils.scala:291) at kafka.server.KafkaHealthcheck.register(KafkaHealthcheck.scala:70) at kafka.server.KafkaHealthcheck.startup(KafkaHealthcheck.scala:51) at kafka.server.KafkaServer.startup(KafkaServer.scala:244) at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:37) at kafka.Kafka$.main(Kafka.scala:67) at kafka.Kafka.main(Kafka.scala) [2016-09-28 16:15:55,896] INFO [Kafka Server 0], shutting down (kafka.server.KafkaServer) </code></pre> <p>All set up in mac</p>
<apache-kafka><apache-zookeeper>
2016-09-28 23:19:34
HQ
39,759,108
Sorting tuple of tuple in a list
<pre><code>[(('A', 'B'), 1.0), (('A', 'C'), 1.0), (('B', 'C'), 1.0), (('B', 'D'), 1.0), (('D', 'E'), 1.0), (('D', 'F'), 1.0), (('E', 'F'), 5.0), (('F', 'G'), 5.0), (('D', 'G'), 1.0)] </code></pre> <p>I need to sort this list in descending order on the numbers if in case of a tie I have to sort in the ascending order of alphabets</p> <p>The final list should look something like this:</p> <pre><code>[(('E', 'F'), 5.0),(('F', 'G'), 5.0), (('A', 'B'), 1.0),(('A', 'C'), 1.0),(('B', 'C'), 1.0),(('B', 'D'), 1.0),(('D', 'E'), 1.0),(('D', 'F'), 1.0) (('D', 'G'), 1.0)] </code></pre>
<python><python-3.x>
2016-09-28 23:24:20
LQ_CLOSE
39,759,734
How to remove an old commit in Git
All: I am pretty new in Git, I wonder say I have submitted several commits like: 1 -> 2 -> 3 -> 4 Could anyone show me the steps how to remove commit 3? Say each commit I just append that order number to same file. So for 1: the file content is 1. 2: the file content is 12. 3: the file content is 123. 4: the file content is 1234. Thanks
<git>
2016-09-29 00:54:17
LQ_EDIT
39,760,413
How can I allocate a pointer in c++?
<p>Hello so I have a question about pointers. How would I allocate memory for a pointer in c++? Can I use the <code>new</code> keyword like I would with allocating a type? Also what is the advantage of using pointers in c++ instead of just passing through a variable? Does it increase the efficiency of a program?</p>
<c++><pointers>
2016-09-29 02:29:27
LQ_CLOSE
39,760,956
Angular 2 binding to maxlength of input or texarea
<p>I can render the following Angular 2 component containing an input with a maxlength set:</p> <pre><code>@Component({ selector: 'app', template: '&lt;input maxlength="10"&gt;', }) export class App { } </code></pre> <p>This works fine. However, if I try to set the maxlength via a binding, like this:</p> <pre><code>@Component({ selector: 'app', template: '&lt;input [maxlength]="maxLength"&gt;', }) export class App { maxLength = 10; } </code></pre> <p>Or like this:</p> <pre><code> template: '&lt;input maxlength="{{maxLength}}"&gt;', </code></pre> <p>I get the following error:</p> <pre><code>"Template parse errors: Can't bind to 'maxlength' since it isn't a known property of 'input'." </code></pre> <p>Why? <code>maxlength</code> is a perfectly valid property of an input control.</p> <p>Here's a <a href="http://plnkr.co/edit/cxb10urctYezQUuPGyTj?p=preview" rel="noreferrer">live example</a> (open console to see error).</p>
<angular><angular2-template>
2016-09-29 03:31:30
HQ
39,761,453
No shortcut for DDMS in Android Studio 2.2
<p>After updating Android studio to version 2.2, I am not able to find option of DDMS in the toolbar. Though I can find it in <em>Tools -> Android -> Android Device Monitor</em>. <br><br> Any help is highly appreciated.</p>
<android><ddms><android-studio-2.2>
2016-09-29 04:31:58
HQ
39,761,573
BATCH - Verification System (READ DESC)
So basically I have this batch program. I want a verification system were you type the code, and it lets you continue. If you type the wrong code it won't let you continue. Anyone got a code I can use for this?
<batch-file>
2016-09-29 04:44:27
LQ_EDIT
39,761,964
how to pass the href variable to the switch case
i have four links which are redirected on the same page only there variables are different for eg: <a href="tab1.php?type=square">Square</a> <a href="tab1.php?type=circle">Circle</a> <a href="tab2.php?type=triangle">Triangle</a> <a href="tab3.php?type=rectangle">Rectangle</a> i want to write a switch case to pass the href variables so that if the type is square it should alert me that it is a square and similarly for the others.
<php><jquery><html>
2016-09-29 05:19:08
LQ_EDIT
39,763,343
How to randomly select certain percentage of rows and create new columns in r
I have a species column containing 100 species names. I have to distribute the species into four columns randomly such that each column will take a specific percentage of species. lets say the first column takes 20%, the second 30%, the third 40% and the last 10%. The four columns will be four different environments ie. Restricted, Tidal flat, beach, estuary. Hence the column intake will be predefined but the selection will be random.
<r>
2016-09-29 06:51:51
LQ_EDIT
39,764,365
What's the meaning of "READY=2/2" output by command "kubectl get pod $yourpod"
<pre><code>kubectl get pod run-sh-1816639685-xejyk NAME READY STATUS RESTARTS AGE run-sh-1816639685-xejyk 2/2 Running 0 26m </code></pre> <p>What's the meaning of "READY=2/2"? The same with "1/1"?</p>
<kubernetes><kubectl><kubelet>
2016-09-29 07:48:20
HQ
39,764,824
Does not evaluate the condition
Good day, that does not happen in my code, but when running, does not fall to assess the condition, otherwise I run the line of the "else" could help me have I got wrong. Thank you. public class LoginActivity extends AppCompatActivity { private EditText usern; private EditText passw; private Button logButton; @Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); usern = (EditText) findViewById(R.id.userNameText); passw = (EditText) findViewById(R.id.passwordText); logButton = (Button) findViewById(R.id.loginButton); logButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(usern.getText().toString().equals("demo") && passw.getText().equals("demo")){ Intent intent = new Intent(LoginActivity.this, MainActivity.class); startActivity(intent); Toast.makeText(getApplicationContext(), "Login...", Toast.LENGTH_SHORT).show(); } else{ Toast.makeText(getApplicationContext(), "Username or password incorrect", Toast.LENGTH_SHORT).show(); } } }); } } *Android Studio
<java><android><xml><android-studio><if-statement>
2016-09-29 08:11:18
LQ_EDIT
39,765,112
ERROR C2039: 'vector': is not a member of 'std'
<p>I am new to C++ and I am trying to make a little dungeon crawler game. Currently I have multiple vectors declared in my header files but they seem to give multiple errors. I have tried searching for this problem on StackOverflow but the answers don't really seem to work.</p> <p>Here is one of my header files: (Hero.h)</p> <pre><code>#pragma once class Hero { public: Hero(); std::string name; int experience; int neededExperience; int health; int strength; int level; int speed; std::vector&lt;Item&gt; items = std::vector&lt;Item&gt;(); void levelUp(); private: }; </code></pre> <p>Here is my .cpp file: (Hero.cpp)</p> <pre><code>#include "stdafx.h" #include &lt;vector&gt; #include "Hero.h" #include "Item.h" Hero::Hero() { } void Hero::levelUp() { }; </code></pre> <p>Like I said I am new to C++ so there might be a lot more wrong with my code than I know. This is just a test.</p> <p>Below are the errors that are shown in the Error list of Visual Studio 2015:</p> <pre><code>Error C2039 'vector': is not a member of 'std' CPPAssessment hero.h 13 Error C2143 syntax error: missing ';' before '&lt;' CPPAssessment hero.h 13 Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int CPPAssessment hero.h 13 Error C2238 unexpected token(s) preceding ';' hero.h 13 </code></pre>
<c++><visual-studio><c++11><stdvector>
2016-09-29 08:25:06
HQ
39,765,663
git submodule init does absolutely nothing
<p>I have a strange problem with "git submodule init"</p> <p>When I added the submodules using "git submodule add url location" it cloned the repository just fine and everything was ok.</p> <p>When I pushed all my changes back to the parent repository, added the .gitmodules files, etc and cloned the repository back, I tried to initialise all the submodules using "git submodule init" </p> <p>And nothing happens :( Literally nothing, no output, no extra files, it does not even attempt to do anything actually.</p> <p>So I am wondering, what did I do wrong?</p> <p>.gitmodules:</p> <pre><code>bash$ cat .gitmodules [submodule "projects/subprojectA"] path = projects/subprojectA url = ssh://user@bitbucket.company.com/test/projectA.git [submodule "projects/subprojectB"] path = projects/subprojectB url = ssh://user@bitbucket.company.com/test/projectB.git </code></pre>
<git><git-submodules>
2016-09-29 08:51:28
HQ
39,766,350
Bring View on top of Modal using zIndex style with React-Native
<p><code>zIndex</code> has been introduced recently to React-Native to change the position of a <code>View</code> in the stack of layers.</p> <p>Although, I'm not able to bring a <code>View</code> on top of a <code>Modal</code> component.</p> <p>My code looks like this:</p> <pre><code>render() { return ( &lt;View&gt; &lt;Modal visible&gt; {props.children} &lt;/Modal&gt; &lt;View style={{ zIndex: 1000 }}&gt; &lt;Text&gt;Loading...&lt;/Text&gt; &lt;/View&gt; &lt;/View&gt; ); } </code></pre> <p>I guess I could stop using <code>&lt;Modal&gt;</code> and create a regular animated <code>&lt;View&gt;</code> that would behave like the <code>Modal</code>, but I'd rather find another solution.</p> <p>Any idea?</p>
<javascript><android><ios><react-native>
2016-09-29 09:21:23
HQ
39,767,499
How to set the zIndex layer order for geoJson layers?
<p>I would like to have certain layers to be always on top of others, no matter in which order they are added to the map. I am aware of <code>bringToFront()</code>, but it does not meet my requirements. I would like to set the zIndex dynamically based on properties.</p> <p>Leaflet has the method <code>setZIndex()</code>, but this apparently does not work for geoJson layers: <a href="https://jsfiddle.net/jw2srhwn/" rel="noreferrer">https://jsfiddle.net/jw2srhwn/</a></p> <p>Any ideas?</p>
<leaflet><z-index><mapbox><geojson>
2016-09-29 10:14:42
HQ
39,767,718
pandas assign with new column name as string
<p>I recently discovered pandas <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.assign.html" rel="noreferrer">"assign" method</a> which I find very elegant. My issue is that the name of the new column is assigned as keyword, so it cannot have spaces or dashes in it. </p> <pre><code>df = DataFrame({'A': range(1, 11), 'B': np.random.randn(10)}) df.assign(ln_A = lambda x: np.log(x.A)) A B ln_A 0 1 0.426905 0.000000 1 2 -0.780949 0.693147 2 3 -0.418711 1.098612 3 4 -0.269708 1.386294 4 5 -0.274002 1.609438 5 6 -0.500792 1.791759 6 7 1.649697 1.945910 7 8 -1.495604 2.079442 8 9 0.549296 2.197225 9 10 -0.758542 2.302585 </code></pre> <p>but what if I want to name the new column "ln(A)" for example? E.g. </p> <pre><code>df.assign(ln(A) = lambda x: np.log(x.A)) df.assign("ln(A)" = lambda x: np.log(x.A)) File "&lt;ipython-input-7-de0da86dce68&gt;", line 1 df.assign(ln(A) = lambda x: np.log(x.A)) SyntaxError: keyword can't be an expression </code></pre> <p>I know I could rename the column right after the .assign call, but I want to understand more about this method and its syntax.</p>
<python><pandas><assign><columnname>
2016-09-29 10:25:08
HQ
39,767,955
Hi, I can't read the txt file in to my array of objects and then print out the result
I am trying to read a file in to my array of objects from my Movie class and then print the results. public class Movie_Class { private int MovieID; private String MovieTitle; private String Director; private String Writer; private String Duration; private String Genre; private String Classification; private String ReleaseDate; private Double Rating; public Movie_18512117(int ID, String Title, String Mdirector, String Mwriter, String Mduration, String Mgenre, String Mclassification, String MreleaseDate, Double Mrating) { MovieID = ID; MovieTitle= Title; Director= Mdirector; Writer= Mwriter; Duration= Mduration; Genre= Mgenre; Classification= Mclassification; ReleaseDate= MreleaseDate; Rating= Mrating; } public int getMovieID(){ return MovieID; } public String getMovieTitle(){ return MovieTitle; } public String getDirector(){ return Director; } public String getWriter(){ return Writer; } public String getDuration(){ return Duration; } public String getGenre(){ return Genre; } public String getClassification(){ return Classification; } public String getReleaseDate(){ return ReleaseDate; } public Double getRating(){ return Rating; } public void setMovieID(int MovieID) { this.MovieID = MovieID; } public void setMovieTitle(String MovieTitle){ this.MovieTitle = MovieTitle; } public void setDirector(String Director) { this.Director = Director; } public void setWriter(String Writer) { this. Writer = Writer; } public void setDuration(String Duration) { this. Duration = Duration; } public void setGenre(String Genre) { this.Genre = Genre; } public void setClassification(String Classification){ this.Classification = Classification; } public void setReleaseDate(String ReleaseDate){ this.ReleaseDate = ReleaseDate; } public void setRating(Double Rating){ this.Rating = Rating; } } import java.io.File; import java.util.Scanner; import java.io.FileNotFoundException; public class movie { public static void main(String[] args) throws FileNotFoundException { File myFile = new File ("movieLibrary.txt"); Scanner inputFile = new Scanner(myFile); String str; Movie_Class[] movie = new Movie_Class[100]; String[] tokens; while (inputFile.hasNext()){ str=inputFile.next(); tokens = str.split(","); for(int i = 0; i < movies.length; i++){ movie[i] = new Movie_18512117(1); > //I don't know how to read the lines in to //my array and split the spaces, then print the result. System.out.println(movie); } } inputFile.close(); } } > thanks i am still new to java
<java><java.util.scanner><text-parsing>
2016-09-29 10:35:59
LQ_EDIT
39,768,438
A short C++ program about the pointer......PLZ
#include <iostream> using namespace std; int main() { int x[][3]={1,2,3,4,5}; cout<<&x <<" "<<*x <<" "<<x <<endl; cout<<&x[0]<<" "<<*x[0]<<" "<<x[0]<<endl; cout<<&x[0][0]<<endl; return 0; } The result is: 0x28fef8 0x28fef8 0x28fef8 0x28fef8 1 0x28fef8 0x28fef8 why x[0][0] and x are in the this pointer?? what is in the 0x28fef8? 1 or 0x28fef8
<c++><pointers>
2016-09-29 10:59:56
LQ_EDIT
39,768,723
pass test case parameters using nunit console
<p>I am developing tests using <strong>Nunit</strong> and <strong>data driven testing</strong> approach. I have test method with 2 parameters: path to xlsx file and worksheet name. It works perfect in Visual Studio when I pass parameters in <code>TestCase</code> attribute, for example when I want to run 3 test cases have to write something like this:</p> <pre><code>[TestCase(@"pathToFile.xlsx", "TestCase1")] [TestCase(@"pathToFile.xlsx", "TestCase2")] [TestCase(@"pathToFile.xlsx", "TestCase3")] public void performActionsByWorksheet(string excelFilePath, string worksheetName) { //test code } </code></pre> <p>I would like to run my test cases and pass parameters using <strong>Nunit Console</strong> (not to write parameters in code). </p> <p>Is it possible to achieve it?</p>
<c#><nunit><data-driven-tests><nunit-console>
2016-09-29 11:13:41
HQ
39,769,469
The way to use background-image in css files with Django
<p>I'd like to use an image file as a background-image on <code>Django</code>. But I do not know how. First, I read <a href="https://docs.djangoproject.com/en/1.10/intro/tutorial06/" rel="noreferrer">this</a> and tried to write like following this in a css file.</p> <pre><code>#third{ background: url("img/sample.jpeg") 50% 0 no-repeat fixed; color: white; height: 650px; padding: 100px 0 0 0; } </code></pre> <p>But this does not work.</p> <pre><code>{% load staticfiles %} #third{ background: url({% static "img/sample.jpeg" %}) 50% 0 no-repeat fixed; } </code></pre> <p>and</p> <pre><code>#third{ background: url("../img/sample.jpeg") 50% 0 no-repeat fixed; } </code></pre> <p>don't work, too. </p> <p>How do you usually write css file when you use background-image on css files? Would you please give me some advices?</p> <pre><code>C:\~~~~~~&gt; dir hello\static\img 2016/09/28 19:56 2,123 logo.png 2016/09/24 14:53 104,825 sample.jpeg C:\~~~~~~&gt; dir hello\static\css 2016/09/29 20:27 1,577 site.css C:\~~~~~~&gt; more lemon\settings.py BASE_DIR = os.path.dirname(os.path.dirname(__file__)) PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__)) STATIC_ROOT = os.path.join(PROJECT_ROOT, 'staticfiles') STATIC_URL = '/static/' STATICFILES_DIRS = ( os.path.join(PROJECT_ROOT, 'static'), ) C:\~~~~~~&gt; more hello\templates\base.html {% load staticfiles %} &lt;link rel="stylesheet" type="text/css" href="{% static "css/site.css" %}" /&gt; </code></pre> <p>Django version: 1.9.2</p>
<css><django><background-image>
2016-09-29 11:47:43
HQ
39,769,796
findChessboardCorners IS GIVING GARBAGE VALUE IN CORNERS
Here is my code #include <opencv/cv.h> #include <opencv/highgui.h> #include<opencv2/opencv.hpp> #include<iostream> //#include<vector> using namespace cv; using namespace std; int main() { VideoCapture cap = VideoCapture(0); int successes = 0; int numBoards = 0; int numCornersHor = 6; int numCornersVer = 4; int numSquares = (numCornersHor - 1) * (numCornersVer - 1); Size board_sz = Size(numCornersHor, numCornersVer); vector<Point2f> corners; for (;;) { Mat img; cap >> img; Mat gray; cvtColor(img, gray, CV_RGB2GRAY); if (img.empty()) break; // end of video stream imshow("this is you, smile! :)", gray); if (waitKey(1) == 27) break; // stop capturing by pressing ESC bool found = findChessboardCorners(gray, board_sz, corners, CALIB_CB_ADAPTIVE_THRESH); if (found == 1) { cout << corners.size()<<"\n"; cornerSubPix(gray, corners, Size(11, 11), Size(-1, -1), TermCriteria(CV_TERMCRIT_EPS | CV_TERMCRIT_ITER, 30, 0.1)); drawChessboardCorners(gray, board_sz, corners, found); } } cap.release(); waitKey(); return 0; } What code is doing is, if "chessBoard" is found during capturing frames from webcam, it will print the corner size (I did it because I was not getting the output of the tutorial code and I wanted to find where the bug is!) Here is the image of my output:[1] [1]: http://i.stack.imgur.com/S1ewO.png
<c++><opencv><camera-calibration>
2016-09-29 12:01:55
LQ_EDIT
39,769,963
NGINX - Reverse proxy multiple API on different ports
<p>I have the following API(s):</p> <ol> <li>localhost:300/api/customers/ </li> <li>localhost:400/api/customers/:id/billing</li> <li>localhost:500/api/orders</li> </ol> <p>I'd like to use NGINX to have them all run under the following location:</p> <p>localhost:443/api/</p> <p>This seems very difficult because of customers spanning two servers.</p> <p>Here's my failed attempt starting with orders</p> <pre><code>server { listen 443; server_name localhost; location /api/orders { proxy_pass https://localhost:500/api/orders; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; } } server { listen 443; server_name localhost; location /api/customers/$id/billing { proxy_pass https://localhost:400/api/customers/$id/billing; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; } } server { listen 443; server_name localhost; location /api/customers { proxy_pass https://localhost:300/api/customers; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; } } </code></pre> <p>Anything jump out as far as a fix? Thanks!</p>
<api><nginx><port><reverse-proxy>
2016-09-29 12:10:29
HQ
39,770,376
Scikit-learn, get accuracy scores for each class
<p>Is there a built-in way for getting accuracy scores for each class separatetly? I know in sklearn we can get overall accuracy by using <code>metric.accuracy_score</code>. Is there a way to get the breakdown of accuracy scores for individual classes? Something similar to <code>metrics.classification_report</code>.</p> <pre><code>from sklearn.metrics import classification_report from sklearn.metrics import accuracy_score y_true = [0, 1, 2, 2, 2] y_pred = [0, 0, 2, 2, 1] target_names = ['class 0', 'class 1', 'class 2'] </code></pre> <p><code>classification_report</code> does not give accuracy scores:</p> <pre><code>print(classification_report(y_true, y_pred, target_names=target_names, digits=4)) Out[9]: precision recall f1-score support class 0 0.5000 1.0000 0.6667 1 class 1 0.0000 0.0000 0.0000 1 class 2 1.0000 0.6667 0.8000 3 avg / total 0.7000 0.6000 0.6133 5 </code></pre> <p>Accuracy score gives only the overall accuracy:</p> <pre><code>accuracy_score(y_true, y_pred) Out[10]: 0.59999999999999998 </code></pre>
<python><machine-learning><scikit-learn>
2016-09-29 12:29:03
HQ
39,770,768
table tr Undefined value is storing in datase
[![enter image description here][1]][1] [1]: http://i.stack.imgur.com/5VdcJ.png here is my form table: <table id="jobSkills" "> <tbody> <tr><td class="col-xs-4"> Skill </td> </tbody> </table> jquery Add+++ More script: var skillcount=0; $(".addSkills").click(function(){ $('#jobSkills tr:last').after('<tr><td><input name="skill['+skillcount+'][title]" type="text" "></td></tr>'); skillcount++; }); Controller code to strore in db: foreach($_POST["skill"] as $k=>$key) { $conn->query("INSERT INTO r_job_skill (id_job,title) values ('".$jobId."','".$key["title"]."')"); }
<php><jquery><mysql><append><undefined>
2016-09-29 12:48:05
LQ_EDIT
39,770,905
DB: "table" has no column named "name column"
<p>I've this problem when I was launching the app, it made me this error:</p> <pre><code>E/SQLiteLog: (1) table geophysics_table has no column named municipality E/SQLiteDatabase: Error inserting id_grid=1 culture_type= resolution_survey= soil_type= coordinates= finish_date= start_date= municipality= site= software= range= ctr= assistans= frequency_feeler= igm= max_depth= instrument_type= area_investigated= description_site= n_tab= author= acquisition_method= survey_method= ref_geo_map= android.database.sqlite.SQLiteException: table geophysics_table has no column named municipality (code 1): , while compiling: INSERT INTO geophysics_table(id_grid,culture_type,resolution_survey,soil_type,coordinates,finish_date,start_date,municipality,site,software,range,ctr,assistans,frequency_feeler,igm,max_depth,instrument_type,area_investigated,description_site,n_tab,author,acquisition_method,survey_method,ref_geo_map) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method) at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889) at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500) at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588) at android.database.sqlite.SQLiteProgram.&lt;init&gt;(SQLiteProgram.java:58) at android.database.sqlite.SQLiteStatement.&lt;init&gt;(SQLiteStatement.java:31) at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1469) at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1341) at com.example.giuse.secondly.DBTools.insertGrid(DBTools.java:85) at com.example.giuse.secondly.NewSheet.saveData(NewSheet.java:104) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at android.view.View$1.onClick(View.java:4015) at android.view.View.performClick(View.java:4780) at android.view.View$PerformClick.run(View.java:19866) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) W/EGL_emulation: eglSurfaceAttrib not implemented W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0x7fa4f2464180, error=EGL_SUCCESS </code></pre> <p>But I think I've entered the "municipality" in every part. This is the code of the db:</p> <pre><code> @Override public void onCreate(SQLiteDatabase database) { String query = "CREATE TABLE geophysics_table ( id_grid INTEGER PRIMARY KEY, site TEXT, " + "n_tab TEXT, municipality TEXT, ctr TEXT, igm TEXT, coordinates TEXT, ref_geo_map TEXT, description_site TEXT, soil_type TEXT, culture_type TEXT, survey_method TEXT, instrument_type TEXT, resolution_survey TEXT, area_investigated TEXT, acquisition_method TEXT, frequency_feeler TEXT, range TEXT, max_depth TEXT, software TEXT, author TEXT, assistants TEXT, start_date TEXT, finish_date TEXT)"; </code></pre>
<java><android><sqlite>
2016-09-29 12:53:09
LQ_CLOSE
39,771,131
How to convert array into comma separated string in javascript
<p>I have an array </p> <p><code>a.value = [a,b,c,d,e,f]</code></p> <p>How can I convert to comma seperated string like </p> <p><code>a.value = "a,b,c,d,e,f"</code></p> <p>Thanks for all help. </p>
<javascript><arrays>
2016-09-29 13:03:42
HQ
39,772,259
How do I cloudform an API gateway resource with a lambda proxy integration
<p>I've been trying to work out how to express (in cloudformation) an API Gateway Resource that has a Lambda function integration type using the Lambda Proxy integration.</p> <p>This is easy to do in the AWS console as there is a check box that you can select: <a href="https://i.stack.imgur.com/AkELO.png" rel="noreferrer"><img src="https://i.stack.imgur.com/AkELO.png" alt="API gateway console showing the Use Lambda Proxy Integration checkbox"></a></p> <p>However there is no corresponding field in the AWS::ApiGateway::Method CloudFormation resource (it should be in the <a href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration.html" rel="noreferrer">Integration property</a>).</p> <p>How can I configure this in cloudformation?</p>
<aws-lambda><aws-api-gateway><amazon-cloudformation>
2016-09-29 13:52:54
HQ
39,772,528
How to render QuillJS rich-text output to HTML
<p>I am a little stuck, I am working with Quill JS editor and have now got to the point where I need to render the output from the editor in a html document and possibly a PDF document (HTML is a priority)</p> <p>How would I render output like this:</p> <pre><code>{ "ops": [ {"attributes":{"bold":true},"insert":"Test Post"}, {"insert":"\n\nThis is a test post.\n"} ] } </code></pre> <p>I have had a look around but cant seem to find out how to do this. I hope someone can help.</p> <p>Thanks!</p>
<javascript><quill>
2016-09-29 14:03:18
HQ
39,773,272
SQLite: How do i search multiple values
I have two autocomplettextview and 3 columns in my table col1,col2,col3. col1 is primary key table look like this: | col1 | col2 | col3 | ----------------------------------------- | 1 | store1 |apple,pineapple,mango | | 2 | store2 | apple,orange | | 3 | store3 | apple,pineapple,orange| | 4 | store4 | orange,mango | | 5 | store5 | mango,jackfruit | **I have two question:** **Q1**: can i store multiple values in single column.If No then how can I store? **Q2**: previously said i have two autocompletetextview to search **For Eg**: If user types apple and pineapple in *two autocompletetextview* then i need to *display row that matches these two texts.* **Expected o/p**: | col1 | col2 | col3 | ----------------------------------------- | 1 | store1 |apple,pineapple,mango | | 2 | store3 | apple,pineapple,orange| how can I achieve this? I gone through several reseaches, with the help of `foreign key` I can store multiple values in single column but How can i use *foreign key* in `Where clause` to achieve `expected o/p`. Thanks in Advanced..
<android><sql><sqlite><android-sqlite>
2016-09-29 14:36:52
LQ_EDIT
39,773,560
SQLAlchemy: How do you delete multiple rows without querying
<p>I have a table that has millions of rows. I want to delete multiple rows via an in clause. However, using the code:</p> <pre><code>session.query(Users).filter(Users.id.in_(subquery....)).delete() </code></pre> <p>The above code will query the results, and then execute the delete. I don't want to do that. I want speed.</p> <p>I want to be able to execute (yes I know about the session.execute):<code>Delete from users where id in ()</code></p> <p><strong>So the Question:</strong> How can I get the best of two worlds, using the ORM? Can I do the delete without hard coding the query?</p>
<python><orm><sqlalchemy>
2016-09-29 14:50:42
HQ
39,773,563
Calling Method from Separate Class to MainWindow.cs
<p>I guess doing this in VB is much easier, but how do I call a method that is another class? This is what I have inside of my Sql.cs:</p> <pre><code>public static MainWindow MainWindow; public void FlLoadMembers() { SetConnection(); SqlCon.Open(); SqlCmd = SqlCon.CreateCommand(); const string commandText = "select firstname, lastname from members"; SqlAdapter = new SQLiteDataAdapter(commandText, SqlCon); DsMembers.Reset(); SqlAdapter.Fill(DsMembers); DtMembers = DsMembers.Tables[0]; MainWindow.lstPanelMembers.Items.Add(DtMembers); SqlCon.Close(); } </code></pre> <p>Trying to call this in MainWindow.cs</p> <pre><code>private MainWindow() { InitializeComponent(); GetVersion(); FlLoadMembers(); //This doesn't work apparently in C# } </code></pre>
<c#><wpf>
2016-09-29 14:50:46
LQ_CLOSE
39,773,889
Animated overlay for videos on iOS
<p>What's the common modern standard for animated video overlays? (e.g. if you want to add an animated logo to video recorded from the camera)</p> <p>During research, I've found the following options:</p> <ul> <li><p>GIF - seems to be pretty outdated technology</p></li> <li><p>FLV - supports alpha-channel, but no longer supported by Adobe. Requires FFMPEG.</p></li> <li><p>PNG sequence - the downside of this is having multiple files for each frame.</p></li> </ul> <p>What's the right format/technology to use?</p> <p>Ideally, what is natively supported on iOS (doesn't require FFMPEG)?</p>
<ios><video><ffmpeg><overlay>
2016-09-29 15:05:36
HQ
39,774,788
How to ask in Javascript?
<p>I want to write a line of code which asks a question and the user has to enter a number. The number is then stored as a variable and used throughout the rest of the script. Such as:</p> <p>fit1 = "What is your fitness level?" level = <em>the number the user had entered</em></p> <p>something like that. Can't really explain it properly</p> <p>P.S. I'm writing my code out in gedit because thats what my uni uses.</p>
<javascript>
2016-09-29 15:48:44
LQ_CLOSE
39,774,946
Database [] not configured Laravel 5
<p>I create new db in phpmyadmin and new tables.</p> <p>Then i do</p> <pre><code> public function next(Request $request){ $langs = DB::connection('mydb')-&gt;select('select * from lang'); } </code></pre> <p>and get</p> <pre><code>Database [compgen] not configured. </code></pre> <p>in my .env</p> <pre><code>DB_HOST=localhost DB_DATABASE=test DB_USERNAME=root DB_PASSWORD=123 </code></pre> <p>in my config/database.php</p> <pre><code> 'mysql' =&gt; [ 'driver' =&gt; 'mysql', 'host' =&gt; env('DB_HOST', 'localhost'), 'database' =&gt; env('DB_DATABASE', 'test'), 'username' =&gt; env('DB_USERNAME', 'root'), 'password' =&gt; env('DB_PASSWORD', '123'), 'charset' =&gt; 'utf8', 'collation' =&gt; 'utf8_unicode_ci', 'prefix' =&gt; 'test_', 'strict' =&gt; false, ], </code></pre>
<laravel><laravel-5><laravel-5.1>
2016-09-29 15:56:16
HQ
39,775,860
How to fix Sublime text highlighting for react-tutorial?
<p>I recently started the <a href="https://facebook.github.io/react/docs/tutorial.html" rel="noreferrer">official reactjs tutorial</a> and noticed that the sublime text highlighting is completely screwed.</p> <p><a href="https://i.stack.imgur.com/XlpVV.png" rel="noreferrer"><img src="https://i.stack.imgur.com/XlpVV.png" alt="enter image description here"></a></p> <p>How can i fix this?</p>
<javascript><reactjs><sublimetext3>
2016-09-29 16:47:02
HQ
39,776,414
Authorization method for REST API utilising Active Directory
<p>What is the best method of securing a REST Web API with the following requirements. The system has an Angular JS frontend with the REST APIs implemented in ASP.net.</p> <ul> <li>There are two "roles" in the system, users will have one of the roles. One role should allows access to some APIs (call it "VIEW"), the other role allows access to other APIs</li> <li>All users are in Active Directory, so if I have a username, I can check what role they are in- Some clients are on Windows boxes, the others are on Linux</li> <li>I would like to persist the session so I don't have to look up AD for every API call</li> <li>I would like single sign on. On the Windows machines, I don't require them to enter user and pass as I already can retrieve their username using Windows Authentication.</li> </ul> <p>I believe that Oauth would be my best option.</p>
<asp.net><angularjs><security><oauth><authorization>
2016-09-29 17:20:40
HQ
39,776,819
Function to normalize any number from 0 - 1
<p>I'm trying to make a function that takes a number and normalizes it from 0 - 1 between its min and max bounds. For example: </p> <p>If I want to normalize a value of 10 between 5 to 15, I call this:</p> <p><code>val = 10; normalize(val, 5, 15);</code> Returns 0.5</p> <p>normalizing a value 0 between -10 and 5</p> <p><code>val = 0; normalize(val, -10, 5);</code> Returns 0.666</p> <p>This is the function I came up with:</p> <pre><code>function normalize(val, min, max){ // Shift to positive to avoid issues when crossing the 0 line if(min &lt; 0){ max += 0 - min; val += 0 - min; min = 0; } // Shift values from 0 - max val = val - min; max = max - min; return Math.max(0, Math.min(1, val / max)); } </code></pre> <p>My question is: Is this the most efficient method to normalize a 1-dimensional value? I'm going to be calling this function a few thousand times per frame at 60fps, so I'd like to have it as optimized as possible to reduce the burden of calculation. I've looked for normalization formulas, but all I find are 2- or 3-dimensional solutions.</p>
<javascript><performance><math><normalization>
2016-09-29 17:45:03
HQ
39,777,076
format value type float in (Programming Language C/C++)
<p>How show 00156,00</p> <pre><code>float number = 156; printf("%5.2f",number); </code></pre> <p>The output of the example above:</p> <p>Output: 156.00</p>
<c++><c>
2016-09-29 18:00:51
LQ_CLOSE
39,777,166
Display pdf image in markdown
<p>Is this possible? Everything I'm google leads me to converting markdown to PDF. But I want to display a PDF image in a markdown file. This is my example:</p> <pre><code>![hustlin_erd](erd.pdf) </code></pre> <p>If i use a regular image, it works just fine. Also I'm aware of converting PDF to image.</p>
<html><markdown>
2016-09-29 18:07:11
HQ
39,778,525
How to get Windows Version - as in "Windows 10, version 1607"?
<p>It seems that the word "version" in reference to Windows is used for different things. For example, the Windows 10 "Anniversary Update" is labeled "Version 1607" by Microsoft (<a href="https://support.microsoft.com/en-us/kb/3176938" rel="noreferrer">here</a> for example). But if I try to get the "Version" (on a PC with the Anniversary Update installed) using the following code, nothing is returned that looks like "1607".</p> <pre><code>// Get Version details Version ver = os.Version; Console.WriteLine("Major version: " + ver.Major); Console.WriteLine("Major Revision: " + ver.MajorRevision); Console.WriteLine("Minor version: " + ver.Minor); Console.WriteLine("Minor Revision: " + ver.MinorRevision); Console.WriteLine("Build: " + ver.Build); </code></pre> <p>I get this:</p> <pre><code>Major version: 6 Major Revision: 0 Minor version: 2 Minor Revision: 0 Build: 9200 </code></pre> <p>How do I get the Windows 10 "version" as in "Version 1607"?</p> <p>Thanks!</p>
<c#><windows>
2016-09-29 19:29:38
HQ
39,778,610
How to send a notification on android extracting data from the database firebase?
I know firebase contains a section to send notifications writing your message in console, but i want get values from a table to display the values in a notification. is this possible?
<android><firebase><firebase-realtime-database><firebase-notifications>
2016-09-29 19:35:16
LQ_EDIT
39,778,625
Program won't run properly
<p>So I wrote this program but for some reason my else statement won't work. If i input "e" for example my program will simply crash... when its actually supposed to return "Invalid Input" Can someone please help me?</p> <p>=========================================================================</p> <pre><code>import java.util.Scanner; public class AbsValue2 { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Enter a number:"); String num = input.nextLine(); Double num2 = new Double(Double.parseDouble(num)); Double abs_val = new Double(Math.sqrt(num2 * num2)); if (num.matches("[+-]?[\\d]+[.]*")) System.out.println("The absolute value of " + num + " is |" + abs_val + "|"); else if (num.matches("[+-]?[\\d]*.[\\d]+")) System.out.println("The absolute value of " + num + " is |" + abs_val + "|"); else System.out.println("Invalid input"); } } </code></pre>
<java><if-statement><crash>
2016-09-29 19:36:15
LQ_CLOSE
39,778,899
Build laravel from framework kernel
<p>I have started a project to convert some parts of laravel framework to compiled php extensions to improve the performance. I have created a git repository for the migrated parts and another for the laravel modification that will use that extension.</p> <p>My question is how to build completly all laravel from framework kernel modified?</p> <p>Do you think that I'm doing well?</p>
<php><laravel><frameworks><software-design>
2016-09-29 19:54:38
LQ_CLOSE
39,778,959
single object of socket io
I am trying to create an application based on socket. Looking at the console it can be said that the client to trying to socket server twice. which should not be allowed. 1. Is there any way to stop that ? 2. If have modular javascript file where multiple script want to access same socket connection how is that possible ? <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> <!DOCTYPE html> <html> <head> <title>socket</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script src="https://cdn.socket.io/socket.io-1.4.5.js"></script> </head> <body> <script type="text/javascript"> $(function(){ var socket = io(); console.log(typeof socket); // object var socket1 = io(); console.log(socket === socket1); // false }) </script> </body> </html> <!-- end snippet -->
<javascript><jquery><html><socket.io>
2016-09-29 19:58:00
LQ_EDIT
39,778,971
an error that i don't understand on c++
So this is my code #include "stdafx.h" #include <iostream> #include <cmath> using namespace std; int main() { int kol=0, x; cout << "Insert a number: "; cin >> x; while (x > 0); { div_t output; output = x; x = div(output, 10); kol += kol; } cout << "Amount: " << kol << endl; system ("pause"); return 0; } and i got this error Error 1 error C2679: binary '=' : no operator found which takes a right-hand operand of type 'int' (or there is no acceptable conversation) can someone tell me what i did wrong and how to fix?
<c++>
2016-09-29 19:59:07
LQ_EDIT
39,779,538
How to get lineno of "end-of-statement" in Python ast
<p>I am trying to work on a script that manipulates another script in Python, the script to be modified has structure like:</p> <pre><code>class SomethingRecord(Record): description = 'This records something' author = 'john smith' </code></pre> <p>I use <code>ast</code> to locate the <code>description</code> line number, and I use some code to change the original file with new description string base on the line number. So far so good.</p> <p>Now the only issue is <code>description</code> occasionally is a multi-line string, e.g.</p> <pre><code> description = ('line 1' 'line 2' 'line 3') </code></pre> <p>or</p> <pre><code> description = 'line 1' \ 'line 2' \ 'line 3' </code></pre> <p>and I only have the line number of the first line, not the following lines. So my one-line replacer would do</p> <pre><code> description = 'new value' 'line 2' \ 'line 3' </code></pre> <p>and the code is broken. I figured that if I know both the lineno of start and end/number of lines of <code>description</code> assignment I could repair my code to handle such situation. How do I get such information with Python standard library?</p>
<python><abstract-syntax-tree>
2016-09-29 20:35:58
HQ
39,780,792
How to build a sparkSession in Spark 2.0 using pyspark?
<p>I just got access to spark 2.0; I have been using spark 1.6.1 up until this point. Can someone please help me set up a sparkSession using pyspark (python)? I know that the scala examples available online are similar (<a href="https://databricks-prod-cloudfront.cloud.databricks.com/public/4027ec902e239c93eaaa8714f173bcfc/6122906529858466/431554386690884/4814681571895601/latest.html" rel="noreferrer">here</a>), but I was hoping for a direct walkthrough in python language. </p> <p>My specific case: I am loading in avro files from S3 in a zeppelin spark notebook. Then building df's and running various pyspark &amp; sql queries off of them. All of my old queries use sqlContext. I know this is poor practice, but I started my notebook with </p> <p><code>sqlContext = SparkSession.builder.enableHiveSupport().getOrCreate()</code>. </p> <p>I can read in the avros with </p> <p><code>mydata = sqlContext.read.format("com.databricks.spark.avro").load("s3:...</code> </p> <p>and build dataframes with no issues. But once I start querying the dataframes/temp tables, I keep getting the "java.lang.NullPointerException" error. I think that is indicative of a translational error (e.g. old queries worked in 1.6.1 but need to be tweaked for 2.0). The error occurs regardless of query type. So I am assuming </p> <p>1.) the sqlContext alias is a bad idea </p> <p>and </p> <p>2.) I need to properly set up a sparkSession. </p> <p>So if someone could show me how this is done, or perhaps explain the discrepancies they know of between the different versions of spark, I would greatly appreciate it. Please let me know if I need to elaborate on this question. I apologize if it is convoluted. </p>
<python><sql><apache-spark><pyspark>
2016-09-29 22:09:33
HQ
39,781,115
Visual Studio 2015: "tsc.exe" exited with code 1
<p>I was formerly using Visual Studio 2013 for a web TypeScript project. Upgraded to Visual Studio 2015 Update 3, and when building the project, I get </p> <pre><code>"tsc.exe" exited with code 1 </code></pre> <p>There are a million of these errors on the web. One suggested I install Microsoft.TypeScript.MSBuild and Microsoft.TypeScript.Compiler via NPM, which I did.</p> <p>When I dig into the Output (making it verbose), I see this:</p> <pre><code>1&gt; C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.6\tsc.exe --project "F:\depot\depot\code\main\web\CedarsReport\tsconfig.json" --listEmittedFiles 1&gt; F:\depot\depot\code\main\web\CedarsReport\error TS5023:Build:Unknown compiler option 'listemittedfiles'. </code></pre> <p>Questions: 1) Why is it using TypeScript 1.6? I installed "TypeScript 1.8.4 for Visual Studio 2015."</p> <p>2) Where is the --listEmittedFiles option coming from, and how can I disable it?</p> <p>3) If I go to Project > Properties > TypeScript Build, it says: ":One or more tsconfig.json files detected. Project properties are disabled." So I tried moving my tsconfig.json file to the desktop, deleting the one in the project folder. Quit Visual Studio 2015 and restarted, did clean and rebuild, and same error message. Why does it think there is still a tsconfig.json file when there isn't one?!</p> <p>Even if you can't answer all questions, answering any would be welcome, esp. #2.</p>
<typescript><visual-studio-2015>
2016-09-29 22:41:35
HQ
39,781,618
error TS2314: Generic type 'Promise<T>' requires 1 type argument(s)
<p>I have used Promise and observables logic to fetch data from server using "get". It was working till yesterday. SUddenly it starts throwing the above error. Please help me finding the error. I am getting "Generic type 'Promise' requires 1 type argument(s)" error.</p> <pre><code>@Injectable() export class myBlogService{ // Property to hold root server URL i.e host private serverUrl:string = "app/data.json" constructor(private http:Http) {} // check function in service to check control is coming to service check(){ alert("getting clicked from service"); } // get function to get data from server // basically blog datas get(): Promise { return this.http.get(this.serverUrl) .map(response =&gt; response.json()) } } /** * * My Components * */ @Component({ selector: 'my-app', providers: [myBlogService], styleUrls: ['app/css/app.css'], template: ` &lt;h1 (click)= check()&gt;My First Angular 2 App&lt;/h1&gt; &lt;button (click)=get()&gt;Get My Name&lt;/button&gt; &lt;h1&gt;{{getResponse.name}}&lt;/h1&gt; ` }) export class myBlogApp { // Property to hold blog data public getResponse = {"name": "", "age": ""}; constructor(protected myblogservice:myBlogService){} // check function to check control is going to service check() { this.myblogservice.check(); } // get function calls service get function which return data from server get(){ this.myblogservice.get().subscribe(data =&gt; { this.getResponse = data; }); } } /** * * NgModule Declaration * */ @NgModule({ imports: [ BrowserModule, HttpModule ], declarations: [ myBlogApp ], providers: [ ], bootstrap: [ myBlogApp ] }) export class app{} /** * * App engine entry point * */ const platform = platformBrowserDynamic(); platform.bootstrapModule(app); </code></pre> <p>When "promise: " is given, still it gives issue like "error TS2339: Property 'subscribe' does not exist on type 'Promise'".</p> <p>I tried different solution but no luck yet.</p>
<javascript><angular>
2016-09-29 23:40:10
HQ
39,782,176
Filter input text only accept number and dot vue.js
<p>i have a text box only want accept "Number" and ".[dot]" using Vue.js, anyone can help the code? i'm new on vue.</p>
<vue.js>
2016-09-30 01:06:20
HQ
39,782,484
Looping through a variable in a class to find the key in a dict
I want the user to type in a name "Jim" then a def function is called in a class to look through all the names in the dict matching "Jim". If it finds the word "Jim" in the dict it will print out the value. When I run the code it just says None. class Test(object): def __init__(self, x=0): # So I don't get an error in (def find) self.x = x c = None # So I don't get an error while looping in the for loop users = { 'John': 1, 'Jim': 2, 'Bob': 3 } def find(self, x): # The user is suppose to type in the name "x" for self.c in self.users: # it goes through the dictionary if x == self.users[self.c]: # If x is equal to key it prints worked print('worked') else: pass beta = Test() print(beta.find('Jim'))
<python>
2016-09-30 01:49:01
LQ_EDIT
39,782,506
Deploying basic Angular 2 app to Google App Engine
<p>I can use Angular 2 to create basic front-end applications and can use python to create back-ends with endpoints on Google App engine. I can't however seem to figure out how to put the two together and deploy them with the cloud SDK.</p> <p>Here is a basic example where I can't even host a simple angular2 app with no back-end calls on GAE. I have taken the dist folder after building with angular2 CLI and tried to connect to it with the app.yaml file. It seems to work in the browser developer (dev_appserver.py app.yaml) although I get some 404 errors in SDK with the GET requests to do with my index.html file I think. I then create a blank index.yaml file and try to deploy it but get a 404 Error at the appspot.com location. This is the app.yaml file:</p> <pre><code>application: version: runtime: python27 threadsafe: true api_version: 1 handlers: - url: /favicon\.ico static_files: favicon.ico upload: favicon\.ico - url: (.*)/ static_files: dist\1/index.html upload: dist - url: (.*) static_files: dist\1 upload: dist </code></pre> <p>I really have no idea what I am doing wrong. Do I need some kind of a main.application python back-end to connect to the dist files or? Do I need to include node modules or some other kind or files from Angular2? Any help would be massively appreciated! Thanks</p>
<google-app-engine><angular><app.yaml><google-cloud-sdk>
2016-09-30 01:53:12
HQ
39,782,510
Open Wifi Settings by "prefs:root=WIFI" failed in iOS 10
<p>I was using prefs:root=WIFI url scheme in my app with prefs entered in info.plist to open directly the iOS settings application in Wi-Fi settings and it was working great on iOS 9 but it does not work anymore on iOS 10.</p> <p>Does anyone know if this is just a regression in the first developer preview or the way to open Wi-Fi settings has changed in iOS 10 or it is not allowed anymore?</p>
<ios><wifi><ios10>
2016-09-30 01:54:04
HQ
39,783,130
how to filter betwenn date in codeigniter
i have a problem , how to filter between date if i only have one column date in my table ? anyone can help me ?
<php><sql><date><codeigniter-3>
2016-09-30 03:19:17
LQ_EDIT
39,783,383
How would I go about make function for object JavaScript?
<p>How would I making my own function like <code>.innerHTML</code> for <code>document.getElementById("idName");</code>? For example it would look something like <code>document.getElementById("idName").myFunction;</code>.</p>
<javascript>
2016-09-30 03:49:29
LQ_CLOSE
39,783,651
golang Read(p []byte) doesnot read full byte?
Recently I use golang Read(p []byte),intending to read full len(p) bytes. However I find that Read does not guarantee read len(p) bytes.That's,I need read 4 bytes but actually it gives me only 1.At last I use io.ReadFull instead.Now I am confused, what's the meaning of the function? What's the proper scene using Read?It may just read less bytes than you need.
<go><io>
2016-09-30 04:23:36
LQ_EDIT
39,783,797
calculate percentage with java
I have a form where I want the user to input a few fields and the form will calculate the total and percentage of goal. I'm new to java, and I don't know how to calculate a percentage. When I try parseint(total)/parseint(goal)*100 I get a NaN error. <html> <head> <style media="screen"> .testform INPUT{display: block;margin-bottom:10px;border:1px solid #212121;height:35px;font-size: 16px;} </style> <script type="text/javascript"> calculate = function() { var cash = document.getElementById('a1').value; var checks = document.getElementById('a2').value; var coin = document.getElementById('a3').value; var goal = document.getElementById('goalamount').value; var total = document.getElementById('a4').value; document.getElementById('a4').value = parseInt(cash)+parseInt(checks)+parseInt(coin); document.getElementById('a5').value = parseInt(total)+parseInt(goal); } </script> </head> <body> <form class="testform"> Goal amount <input id="goalamount" type="text" value="3000"/> Cash Collected <input id="a1" type="text" /> Checks Collected <input id="a2" type="text" /> Coins Collected <input id="a3" type="text" /> Total Collected <input id="a4" type="text" name="total_amt" onblur="calculate()" /> Percent of Goal<input id="a5" type="text" name="goal_amt" /> </form> </body> </html>
<javascript><nan>
2016-09-30 04:39:06
LQ_EDIT
39,784,464
how to use and what is the use lambda expression in java8?
can anyone tell the use of lambda expression in java8?.. I have tried this below program and could not get the meaning of the program.. public static void main(String[] args) { state s=new state(); MathOperation addition=( a, b) -> a+b; System.out.println(s.operate(10.1,5.2,addition)); } interface MathOperation{ double operation(double a, double b); } private static double operate(double a,double b,MathOperation mo){ return mo.operation(a, b); }
<java><java-8>
2016-09-30 05:43:02
LQ_EDIT
39,784,513
swift: nscoding decodeObject with nil all the time
<p>I got the following codes on writing an object named Packet and send to the other side through Multipeer connectivity. However, I got the following error whenever it try to decode the encoded object.</p> <pre><code> class Packet : NSObject, NSCoding { var tmp1: Double = 0 var tmp2: Double = 0 struct PropertyKey { static let tmp1Key = "tmp1Key" static let tmp2Key = "tmp2Key" } init(tmp1: Double, tmp2: Double) { self.tmp1 = tmp1 self.tmp2 = tmp2 super.init() } deinit { } required convenience init(coder aDecoder: NSCoder) { debugPrint("initcoder") let tmp1 = aDecoder.decodeObject(forKey: PropertyKey.tmp1Key) as! Double // crash here let tmp2 = aDecoder.decodeObject(forKey: PropertyKey.tmp2Key) as! Double self.init(tmp1: tmp1, tmp2: tmp2) } public func encode(with aCoder: NSCoder) { debugPrint("encodeCoder") aCoder.encode(tmp1, forKey: PropertyKey.tmp1Key) aCoder.encode(tmp2, forKey: PropertyKey.tmp2Key) } } </code></pre> <p>The error I got is ---- Print out from me ---- "initcoder" fatal error: unexpectedly found nil while unwrapping an Optional value 2016-09-30 13:32:55.901189 Connection[323:33022] fatal error: unexpectedly found nil while unwrapping an Optional value</p> <p>But when I construct the object, all the values are set. I contracted a Packet object with no problem.</p> <p>---- Additional information ------ I used the following codes for encode and decode the data when send to the other side through multiplier connectivity.</p> <pre><code> func dataForPacket(packet: Packet) -&gt; Data { let data = NSMutableData() let archiver = NSKeyedArchiver(forWritingWith: data) archiver.encode(packet, forKey: "Packet") archiver.finishEncoding() debugPrint("dataForPacket \(data) \(packet)") return data as Data } func packetForData(_ data: Data) -&gt; Packet { debugPrint("packetForData") let unarchiver = NSKeyedUnarchiver(forReadingWith: data) let packet: Packet = unarchiver.decodeObject(forKey: "Packet") as! Packet // crash here (as this will call the init of the Packet class) debugPrint("packetForData \(packet)") return packet } </code></pre> <p>I wonder what can cause the error. Thanks.</p>
<ios><swift><nscoding><multipeer-connectivity><nskeyedunarchiver>
2016-09-30 05:47:30
HQ
39,785,051
how to convert nsstring to nsarray?
<p>I have a string Afar,Abkhazian,Afrikaans,Amharic and i wish to convert it into the NSArray. Currently i am using the code:</p> <pre><code> NSArray *languagesuserArray = [self.languagesOfUser componentsSeparatedByString:@""]; </code></pre> <p>But next when i checked like this:</p> <pre><code>NSLog(@"Languages array %@",[languagesuserArray objectAtIndex:0]); </code></pre> <p>the output comes:</p> <pre><code>Afar,Abkhazian,Afrikaans,Amharic </code></pre> <p>But i want only afar.. How to do this?</p>
<ios><objective-c><nsarray>
2016-09-30 06:30:18
LQ_CLOSE
39,785,803
Controller can't receive model data
<p>Hi I want to grab all user modify data. </p> <p>My question is why controller can't receive the model data from View in my project.</p> <p>Please explain why this error was caused and how to solve it.</p> <p>Models:</p> <pre><code> public class ShoppingCart { public List&lt;ShoppingCartItemModel&gt; items = new List&lt;ShoppingCartItemModel&gt;(); public IEnumerable&lt;ShoppingCartItemModel&gt; Items { get { return items; } } } public class ShoppingCartItemModel { public Product Product { get; set; } public int Quantity { get; set; } } </code></pre> <p>Controller </p> <pre><code> [HttpPost] public RedirectToRouteResult EditFromCart(ShoppingCart MyModel) { ShoppingCart cart = GetCart(); foreach (var CartItem in cart.items) { foreach (var ReceiveModelItem in MyModel.items) { if (CartItem.Product.ProductID == ReceiveModelItem.Product.ProductID) { CartItem.Quantity = ReceiveModelItem.Quantity; } } } return RedirectToAction("Index", "ShoppingCart"); } </code></pre> <p>View</p> <pre><code>@model ShoppingCart @{ ViewBag.Title = "購物車內容"; } &lt;h2&gt;Index&lt;/h2&gt; &lt;table class="table"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt; Quantity &lt;/th&gt; &lt;th&gt; Item &lt;/th&gt; &lt;th class="text-right"&gt; Price &lt;/th&gt; &lt;th class="text-right"&gt; Subtotal &lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; @using (Html.BeginForm("EditFromCart", "ShoppingCart", FormMethod.Post)) { foreach (var item in Model.items) { &lt;tr&gt; &lt;td class="text-center"&gt; @item.Product.ProductName &lt;/td&gt; &lt;td class="text-center"&gt; @item.Product.Price.ToString("c") &lt;/td&gt; &lt;td class="text-center"&gt; @( (item.Quantity * item.Product.Price).ToString("c")) &lt;/td&gt; &lt;td class="text-left"&gt; @Html.EditorFor(model =&gt; item.Quantity, null, "UserInputQuantity") @Html.Hidden("ProductId", item.Product.ProductID) &lt;/td&gt; &lt;/tr&gt; } &lt;tr&gt; &lt;td colspan="3"&gt; &lt;input class="btn btn-warning" type="submit" value="Edit"&gt; &lt;/td&gt; &lt;/tr&gt; } &lt;/tbody&gt; &lt;/table&gt; </code></pre>
<asp.net-mvc>
2016-09-30 07:16:46
LQ_CLOSE
39,786,012
How to verify call on setter in kotlin using mockito?
<pre><code>interface LoginDisplay { var username: String var password: String } class LoginActivityLoginDisplay : LoginDisplay { override var username: String get() = usernameEditView.text.toString() set(value) { usernameEditView.setText(value) } override var password: String get() = passwordEditView.text.toString() set(value) { passwordEditView.setText(value) } } </code></pre> <p>This is the example of code I'd like to test with Mockito as follows:</p> <pre><code>verify(contract.loginDisplay).username </code></pre> <p>Tricky thing is - that in this call i can only verify getter of field username, meanwhile I'd like to test call on setter of this field.</p> <p>Any help?</p>
<mockito><kotlin><setter><verify>
2016-09-30 07:29:41
HQ
39,786,134
Does PHP7's PDO ext read the entire result set into memory?
<p>I have noticed since I upgraded to PHP7 that some SQL statements no longer work and instead run out of memory.</p> <p>I have this code:</p> <pre><code>$query = Yii::$app-&gt;db-&gt;createCommand('select * from tbl_title')-&gt;query(); while ($row = $reader-&gt;read()) { var_dump($row); exit(); } </code></pre> <p>And Yii2's database abstraction is just an extremely thin layer over PDO's and does not do anything extra. <code>query()</code> does nothing extra except add a line to a log file (Yii2's) for profiling and <code>reader-&gt;read()</code> just calls the PDO stream's <code>fetch()</code> function.</p> <p>But it runs out of memory quoting the size (space used) of my table, i.e. trying to allocate 385 MB of process memory:</p> <blockquote> <p>Allowed memory size of 134217728 bytes exhausted (tried to allocate 385883840 bytes)</p> </blockquote> <p>As a spanner, if I use a query whose result set fits entirely in the 128 MB limit of the PHP process works.</p> <p>So, has PHP7 changed and can I change it back?</p>
<php><mysql><pdo><yii2><php-7>
2016-09-30 07:37:55
HQ
39,786,174
jQuery: Blur function is not calling on each dynamically added row
<p>I am newbie to jQuery.I am trying to call the Blur function on each dynamically Added row and send the values of each row of both text box to PHP.<br>For first row, it works but dynamically added rows, its not working.<br> My Code is as follows:<br> HTML and Jquery:</p> <pre><code> &lt;!doctype HTML&gt; &lt;html&gt; &lt;head&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;script type="text/javascript"&gt; var rowCount = 1; function addMoreRows(frm) { rowCount ++; var recRow = '&lt;p id="rowCount'+rowCount+'"&gt;&lt;tr&gt;&lt;td&gt;&lt;input name="" type="text" id="co_name" size="17%" maxlength="120" /&gt;&lt;/td&gt;&lt;td&gt;&lt;input name="" type="text" id="co_qty" maxlength="120" style="margin: 4px 5px 0 5px;"/&gt;&lt;/td&gt;&lt;/tr&gt; &lt;a href="javascript:void(0);" onclick="removeRow('+rowCount+');"&gt;Delete&lt;/a&gt;&lt;/p&gt;'; jQuery('#addedRows').append(recRow); } function removeRow(removeNum) { jQuery('#rowCount'+removeNum).remove(); } &lt;/script&gt; &lt;body&gt; &lt;table rules="all" style="background:#fff;"&gt; &lt;tr&gt; &lt;td style="font-size:14px;" &gt;Name&lt;/td&gt; &lt;td style="font-size:14px;" &gt;Email&lt;/td&gt; &lt;td&gt;&lt;span style="font:normal 12px agency, arial; color:blue; text-decoration:underline; cursor:pointer;" onclick="addMoreRows(this.form);"&gt; Add More &lt;/span&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr id="rowId"&gt; &lt;td&gt;&lt;input name="" type="text" id="co_name" value="" size="17%"/&gt;&lt;/td&gt; &lt;td&gt;&lt;input name="" type="text" id="co_qty" value="" /&gt;&lt;/td&gt; &lt;/table&gt; &lt;div id="addedRows"&gt;&lt;/div&gt; &lt;/td&gt; &lt;/tr&gt; &lt;script&gt; $(document).ready(function(){ $('#co_qty').on('blur',function () { var username = $('#co_name').val(); var password = $('#co_qty').val(); $.ajax({ type: "POST", url: "blur.php", data: {'title':username ,'title1':password}, success: function(msg) { alert(msg) } }); }); }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt;&lt;br&gt; </code></pre> <p>blur.php</p> <pre><code>$var=$_POST['title']; $var1=$_POST['title1']; echo $var."Success!".$var1; </code></pre> <p><br> I am not getting it. Please do suggest me.Thanks in advance.</p>
<php><jquery><ajax>
2016-09-30 07:40:09
LQ_CLOSE
39,786,714
How to insert scale bar in a map in matplotlib
<p>Any ideas on how can I insert a scale bar in a map in matplotlib that shows the length scale? something like the one I have attached.</p> <p>Or maybe any ideas on measuring and showing distances automatically (not drawing an arrow and writing the distance manually!)?</p> <p>Thanks :)<a href="https://i.stack.imgur.com/tODjr.png"><img src="https://i.stack.imgur.com/tODjr.png" alt="enter image description here"></a></p>
<python><matplotlib><scale><matplotlib-basemap>
2016-09-30 08:12:34
HQ
39,786,719
Friends birthday is not showing in facebook 2.7 graph API
<p>I am using mentioned below code to get birthday of my friend in Graph Explorer. But Birthday is not showing.</p> <p>/v2.7/me?fields=friends{birthday}</p>
<android><facebook>
2016-09-30 08:13:03
LQ_CLOSE
39,787,404
C# WebClient NTLM authentication starting for each request
<p>Consider a simple C# NET Framework 4.0 application, that:</p> <ul> <li>uses WebClient</li> <li>authenticates using NTLM (tested on IIS 6.0 and IIS 7.5 server)</li> <li>retrieves a string from an URL multiple times using DownloadString()</li> </ul> <p>Here's a sample that works fine:</p> <pre><code>using System; using System.Net; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string URL_status = "http://localhost/status"; CredentialCache myCache = new CredentialCache(); myCache.Add(new Uri(URL_status), "NTLM", new NetworkCredential("username", "password", "domain")); WebClient WebClient = new WebClient(); WebClient.Credentials = myCache; for (int i = 1; i &lt;= 5; i++) { string Result = WebClient.DownloadString(new Uri(URL_status)); Console.WriteLine("Try " + i.ToString() + ": " + Result); } Console.Write("Done"); Console.ReadKey(); } } } </code></pre> <p><strong>The problem:</strong></p> <p>When enabling tracing I see that the NTLM authentication does not persist.</p> <p>Each time Webclient.DownloadString is called, NTLM authentication starts (server returns "WWW-Authenticate: NTLM" header and the whole authenticate/authorize process repeats; there is no "Connection: close" header).</p> <p>Wasn't NTLM supposed to authenticate a connection, not a request?</p> <p>Is there a way to make WebClient reuse an existing connection to avoid having to re-authenticate each request?</p>
<c#><.net><authentication><webclient><ntlm>
2016-09-30 08:51:14
HQ
39,788,247
How do i change my code to not include build in functions
I've got a assignment for school with the test to make a code that checks password strength. as you cn see below i've made this code and turned it in but received it back afterwards beccause it's to convenient to use the build in function any. how can i adjust or change my program to not include the any function. import time print ("Check of uw wachtwoord veilig genoeg is in dit programma.") time.sleep(1) print ("Uw wachtwoord moet tussen minimaal 6 en maximaal 12 karakters bestaan") print ("U kunt gebruik maken van hoofdletters,getallen en symbolen (@,#,$,%)") klein = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] groot = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] nummers = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'] symbolen= [' ', '!', '#', '$', '%', '&', '"', '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_', '`', '{', '|', '}', '~',"'"] def ok(passwd,l): return any(k in passwd for k in l) # checkt of een letter in de lijst in het wachtwoord zit. while True: inp = input("Wilt u dit programma gebruiken? ja/nee: ") if inp == "nee" and "Nee" and "NEE": break elif inp == "ja" and "Ja" and "JA": ww = input("Voer uw wachtwoord in: ") if len(ww) < 6: print ("uw wachtwoord is te kort, uw wachtwoord moet uit minimaal 6 en maximaal 12 karakters bestaan!") elif len(ww) > 12: print ("uw wachtwoord is te lang, uw wachtwoord moet uit minimaal 6 en maximaal 12 karakters bestaan!") elif len(ww) >= 6 and len(ww)<= 12: sww = set(ww) # set is een onorganiseerde verzameling dat betekent dat het niet op order is bijv. SaUj%2F3 = Oonorganiseerd if all(ok(sww,l) for l in [klein,groot,nummers,symbolen]): print ("uw wachtwoord is Zeer sterk") elif all(ok(sww,l) for l in [klein,groot,nummers]): print ("uw wachtwoord is Sterk") elif all(ok(sww,l) for l in [klein,groot,symbolen]): print ("uw wachtwoord is Sterk") elif all(ok(sww,l) for l in [groot,nummers,symbolen]): print ("uw wachtwoord is Sterk") elif all(ok(sww,l) for l in [nummers,symbolen,klein]): print ("uw wachtwoord is Sterk") elif all(ok(sww,l) for l in [nummers,symbolen]): print ("uw wachtwoord is Medium") elif all(ok(sww,l) for l in [groot,nummers]): print ("uw wachtwoord is Medium") elif all(ok(sww,l) for l in [groot,symbolen]): print ("uw wachtwoord is Medium") elif all(ok(sww,l) for l in [klein,groot]): print ("uw wachtwoord is Medium") elif all(ok(sww,l) for l in [klein,nummers]): print ("uw wachtwoord is Medium") elif all(ok(sww,l) for l in [klein,symbolen]): print ("uw wachtwoord is Medium") elif all(ok(sww,l) for l in [klein]): print ("uw wachtwoord is Zwak") elif all(ok(sww,l) for l in [symbolen]): print ("uw wachtwoord is Zwak") elif all(ok(sww,l) for l in [nummers]): print ("uw wachtwoord is Zwak") elif all(ok(sww,l) for l in [groot]): print ("uw wachtwoord is Zwak")
<python><python-3.x>
2016-09-30 09:32:45
LQ_EDIT
39,788,839
JQuery returns false after return true?
<p>I'm little confused by behaviour of my functions in <code>JQuery</code>. The thing is that <code>is_airport</code> function decides, whether the location is an airport using JSON of airports. </p> <p>Everything seems to work correctly, JSON is correctly parsed etc. As you can see there is a loop which is used for detecting, whether the <code>destination_id</code> is in airports JSON keys. It is. <strong>It alerts 'OK'</strong> but returns <code>false</code> instead of <code>true</code>. </p> <p>If there was an <code>AJAX</code> instead of <code>each</code> function, I would expect this behaviour because of async. But why it happens here?</p> <pre><code>function is_airport(destination_id){ var json_storage = $("#locations-json"); var airports = JSON.parse(json_storage.attr("data-airports")); $.each(airports,function(id,name){ console.log(id,destination_id,name); if (id==destination_id){ alert('ok'); return true } }); return false } $(document).ready(function () { console.log(is_airport(5));)} </code></pre> <p>Do you know where is the problem?</p>
<javascript><jquery><json>
2016-09-30 10:00:58
LQ_CLOSE
39,789,054
Can you omit the return type in main function?
<p>Are there some special rules with respect to the declaration of the <code>main</code> function?</p> <p>According to <a href="http://ideone.com/eEoa8n">ideone</a> this is legal C++:</p> <pre><code>main() // As opposed to int main() { return 0; } </code></pre> <p>On the other hand, normal functions do not seem to have the privilege to avoid the return type:</p> <pre><code>f(){} int main() { return 0; } </code></pre> <p>Gives the error:</p> <blockquote> <p>prog.cpp:1:3: error: ISO C++ forbids declaration of 'f' with no type [-fpermissive] f(){} ^</p> </blockquote> <p>Is the <code>main</code> function special in this case?</p>
<c++>
2016-09-30 10:11:52
HQ
39,789,125
What does [&] mean before function?
<p>What do the follow row of code mean?</p> <pre><code>auto allowed = [&amp;](int x, const std::vector&lt;int&gt;&amp;vect){ .... } </code></pre> <p>I mean, what does <code>[&amp;]</code> do? and is it function with the same name of the variable??</p> <p>Because it used in this way: <code>unsigned short ok = get_allowed(0, vect);</code></p>
<c++>
2016-09-30 10:15:22
HQ
39,789,818
Best practice for passing enum params in Web API
<p>I have a RESTful Web API project, and I have 2 different Enum scenarios that I'm unsure of re best practice.</p> <p><strong>Scenario 1 : Straightforward Enum Param</strong></p> <p>My API method requires a parameter called <code>ruleType</code>, with valid values being <code>EmailAddress</code> and <code>IPAddress</code>. My enum within the Web API project looks like this:</p> <pre><code>public enum RuleType { None = 0, EmailAddress = 1, IPAddress = 2 } </code></pre> <p>My question for this scenario is, should I use <code>?ruleType=EmailAddress</code> in my request to the API (which automatically binds that value to my <code>RuleType</code> property within the API method)? If so, how best to validate that the <code>RuleType</code> param sent, is a valid RuleType Enum value?</p> <p><strong>Scenario 2 : Multiple Enum Values for a Single Param</strong></p> <p>My API method has an optional <code>fields</code> param, which is allows you to specify any additional data that should be returned. E.g. <code>&amp;fields=ruleOwner,rule</code>. This would return those 2 extra bits of data in the response.</p> <p>I have an enum in the Web API project which relates to each possible <code>field</code> that may be requested, and at present, I am splitting the comma separated fields param, then looping through each string representation of that enum, parsing it to the equivalent enum, resulting in a list of Enum values which I can then use within my API to retrieve the relevant data.</p> <p>This is the Enum:</p> <pre><code>public enum OptionalField { None = 0, RuleOwner = 1, Rule = 2, etc. } </code></pre> <p>What would be best practice here? I was looking into bitwise enums, so a single value is sent in the API request which resulted in any combination of <code>fields</code> but didn't know if this would work well with a Web API, or if there's generally a better way to go about this?</p>
<c#><rest><asp.net-web-api><enums>
2016-09-30 10:51:41
HQ
39,790,147
Error parsing proxy URL. Bad port number
<p>When I use wget command in RHEL 6.5, getting the error </p> <p><code>Error parsing proxy URL. Bad port number</code>. </p> <p>The command used to set the proxy was </p> <p><code>export http_proxy="http_proxy://username:password@address:port/"</code>.</p> <p>Yes I know this issue can be resolved by using </p> <p><code>http_proxy=address wget --proxy-user=username --proxy-password=&lt;password&gt; url</code>.</p> <p>But I want to install a package and during installation, it will need to download few other packages. so the proxy should be already set and ready before the installation. How can we resolve this?</p>
<linux><http><networking><proxy><wget>
2016-09-30 11:09:56
HQ
39,790,342
how to generate unique name for each json value in python 3.x
I have following json, returned from a REST service, where I want to generate a unique names for each value by combining parent keys. For example. `name+phone+address+city+name` , `name+phone+address+city+population+skilled+male` and so on. { "name": "name", "phone": "343444444", "address": { "lat": 23.444, "lng": 34.3322, "city":{ "name": "city name", "population": { "skilled": { "male": 2, "female": 4 }, "uneducated": { "male": 20, "femail": 4 } } } }, "email": "email", "education": "phd" } I want to combine all key names starting from the parent of the json tree. Any help will be appreciated.
<python><json><python-3.x>
2016-09-30 11:20:44
LQ_EDIT
39,790,493
Javascript input.value not working
<p>I'm using the Domready.js library as an alternative to the jQuery <code>document.ready()</code> function and inside the ready function I have this code:</p> <pre><code>DomReady.ready( function() { /* DOM elements */ var tel_input = document.getElementsByClassName( 'tel-input' ); /* When .tel-input is focused, `06` should be added automatically */ tel_input.onfocus = function() { tel_input.value = '06'; }; }); </code></pre> <p>This code doesn't do anything and the console doesn't throw an error. When putting an alert in the <code>tel_input.onfocus = function() {</code> it works, but inserting a value when the input is focused doesn't do anything.</p>
<javascript><jquery>
2016-09-30 11:28:28
LQ_CLOSE
39,791,318
How to get the earliest date of a List in Java?
<p>I have an ArrayList which stores 0...4 Dates.</p> <p>The amount of Dates in the list depends on a Business logic.</p> <p>How can I get the earliest date of this list? Of course I can build iterative loops to finally retrieve the earliest date. But is there a 'cleaner'/ quicker way of doing this, especially when considering that this list can grow on a later perspective?</p>
<java><date><compare>
2016-09-30 12:15:32
HQ
39,791,845
Get the output value of bash script executed with java
<p>I use this code to execute a script within my java program</p> <pre><code>pb.environment().put("time", time); pb.environment().put("value", value); Process p = pb.start(); p.waitFor(); // get the return value </code></pre> <p>After waiting for the process is it possible to get the output value ? With output value I mean the echo values used in the script </p>
<java><bash>
2016-09-30 12:45:24
LQ_CLOSE
39,792,257
Change ul background color whose li has a specific class
<p>I have a <code>ul</code> list whose <code>li</code> has a specific class. I want to change the back ground color of that <code>ul</code>.</p> <p>Eg:</p> <pre><code>&lt;ul class="dropdown-menu"&gt; &lt;li class=""&gt;About us&lt;/li&gt; &lt;li class=""&gt;Why Join?&lt;/li&gt; &lt;li class=""&gt;Constitution&lt;/li&gt; &lt;/ul&gt; &lt;ul class="dropdown-menu"&gt; &lt;li class="active"&gt;2016 Conference&lt;/li&gt; &lt;li class=""&gt;Member Home Page&lt;/li&gt; &lt;li class=""&gt;Bulletin Board&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>I want to change second <code>ul</code> background color.</p> <p>I have tried following code</p> <pre><code>ul.dropdown-menu li.active { background-color: #e9124a !important; } </code></pre>
<css>
2016-09-30 13:04:37
LQ_CLOSE
39,793,459
Xcode 8, iOS 10 - "Starting WebFilter logging for process"
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code> WF: === Starting WebFilter logging for process Test 2016-09-30 08:56:45.458007 Test[616:142557] WF: _userSettingsForUser mobile: { filterBlacklist = ( ); filterWhitelist = ( ); restrictWeb = 1; useContentFilter = 0; useContentFilterOverrides = 0; whitelistEnabled = 0; } 2016-09-30 08:56:45.458437 Test[616:142557] WF: _WebFilterIsActive returning: NO</code></pre> </div> </div> </p> <p>I am receiving this warning in my debugger in xcode 8, iOS-10, when I using UIWebView Delegate methods to load something. I didn't find any documentation in Apple website about this web filter Active/De-active mode. Though it's not causing any problem in my existing webView functionality even I am running some javascript function in my webView did finished method. But still curious to know more about this new feature. </p> <p>Any suggestion about this feature will be appreciate.</p>
<ios><uiwebview><ios10>
2016-09-30 14:07:47
HQ
39,793,924
Bolding a specific part of cell
<p>I have a cell that is referenced as <code>="Dealer: " &amp; CustomerName</code>. CustomerName is a dictionary referenced name. How could I go along of bolding only "Dealer:" and not the Customer name.</p> <p>Example:</p> <p><strong>Dealer:</strong> Josh</p> <p>I have tried</p> <pre><code>Cells(5, 1).Characters(1, 7).Font.Bold = True </code></pre> <p>But it only seems to work on non referenced cells only. How could I get this to work on a referenced cell?</p>
<vba><excel>
2016-09-30 14:30:19
HQ
39,794,101
My C Compiler blew up , when i tried changing some address values , please tell me why?
Have a look at my code : #include <stdio.h> #include <limits.h> int main (int argc, const char *argv[]) { typedef unsigned char byte; byte *pointer; byte b1=1; byte b2=2; int i1 =4; int i2 =0x12345678; byte b3=5; byte b4=6; byte b5=7; byte b6=9; //pointer = &b6; pointer = (byte*)&i2; printf("pointer has value %p\n", pointer); printf("the byte it points to contains %x\n", *pointer); pointer = pointer + 1; printf("the byte it points to contains %x\n", *pointer); pointer = pointer + 1; printf("the byte it points to contains %x\n", *pointer); pointer = pointer + 1; printf("the byte it points to contains %x\n", *pointer); pointer = pointer + 1; printf("the byte it points to contains %x\n", *pointer); pointer = pointer + 1; printf("the byte it points to contains %x\n", *pointer); pointer = pointer + 1; printf("the byte it points to contains %x\n", *pointer); pointer = pointer + 1; printf("the byte it points to contains %x\n", *pointer); pointer = pointer + 1; printf("the byte it points to contains %x\n", *pointer); pointer = pointer + 1; printf("the byte it points to contains %x\n", *pointer); pointer = pointer + 1; printf("the byte it points to contains %x\n", *pointer); pointer = pointer + 1; printf("the byte it points to contains %x\n", *pointer); pointer = pointer + 1; *pointer = 255; printf("the byte it points to contains %x\n", *pointer); pointer = pointer + 1; *pointer = 45; printf("the byte it points to contains %x\n", *pointer); pointer = pointer + 1; *pointer = 34; printf("the byte it points to contains %x\n", *pointer); //printf("How big is int in this machine? %d\n", INT_MAX); //insert code here ... printf (" b1 (%p) = %x\n", &b1, b1); printf (" b2 (%p) = %x\n", &b2, b2); printf (" i1 (%p) = %d\n", &i1, i1); printf (" i2 (%p) = %x\n", &i2, i2); printf (" b3 (%p) = %x\n", &b3, b3); printf (" b4 (%p) = %x\n", &b4, b4); printf (" b5 (%p) = %x\n", &b5, b5); printf (" b6 (%p) = %x\n", &b6, b6); return 0; } The line saying ***pointer = 255;** , maybe 40th line , the compiler blows , or the code stops working , saying this [if I make , *pointer = 255 or *pointer = 254][1] [and if I set any other values except this , my program works well i.e. *pointer = 4556 or *pointer = 45 ][2] [1]: http://i.stack.imgur.com/DMRtm.jpg [2]: http://i.stack.imgur.com/h2DAh.jpg Or in case of any other arbitrary values as well , it runs without any blow . Please tell me about this behaviour of addresses. *Source : Prof. Richard Buckland , I'm exploring all these due to his guidance.*
<c><memory><low-level>
2016-09-30 14:39:51
LQ_EDIT
39,794,509
How to open multiple terminals in docker?
<p>I need to launch two distinct processes on a docker container which requires two terminals.What is the best way to achieve this?</p>
<docker>
2016-09-30 14:59:53
HQ
39,794,588
Angular2 innerHtml removes styling
<p>I am using innerHtml and set the html in my cms the response seems okay and if I print it like this<code>: {{ poi.content }}</code></p> <p>it gives me the right content back : `</p> <pre><code>&lt;table border="0" cellpadding="5" cellspacing="0"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td style="vertical-align: top;"&gt;Tes11t&lt;/td&gt; &lt;td style="width: 2px;"&gt;&amp;nbsp;&lt;/td&gt; &lt;td style="width: 1px;"&gt;&lt;img alt="midgetgolf-sport-faciliteiten-vakantiepark-2.jpg" src="http://beeksebergen.dev/app_dev.php/media/cache/resolve/full_size/midgetgolf-sport-faciliteiten-vakantiepark-2.jpg" style="height: 67px; width: 100px;" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>`</p> <p>But when I use <code>[innerHtml]="poi.content"</code> it gives me this html back:</p> <pre><code>&lt;table border="0" cellpadding="5" cellspacing="0"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;Tes11t&lt;/td&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt;&lt;img alt="midgetgolf-sport-faciliteiten-vakantiepark-2.jpg" src="http://beeksebergen.dev/app_dev.php/media/cache/resolve/full_size/midgetgolf-sport-faciliteiten-vakantiepark-2.jpg"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>Does anybody know why it is stripping my styling when I use <code>[innerHtml]</code></p>
<angular><typescript><angular2-template>
2016-09-30 15:03:30
HQ
39,794,981
CSS3 :nth-child(odd) Selector not selecting columns not rows
I have a simple table using tr:nth-child(odd) to alternate background for rows in a table. HTML <tr class="sao-zebra"> <th class="sao-feature">Some Text</th> <td class="sao-even-basic">Copy</td> <td class="sao-even-gold">Copy</td> </tr> <tr class="sao-zebra"> <th class="sao-feature">More Text</th> <td class="sao-odd-basic"><span class="sao-checkmark">&check;</span></td> <td class="sao-odd-gold"><span class="sao-checkmark">&check;</span></td> </tr> CSS tr.sao-zebra :nth-child(odd) { background: #23282D; } as is stands, the table has 3 columns. The nth-child pseudo selector is causing every other column to be black, not every other row. What have I done wrong?
<html><css>
2016-09-30 15:24:49
LQ_EDIT
39,796,282
Please explain output of given program.
<p>the code is given below: it gives output true2. </p> <pre><code> #include&lt;stdio.h&gt; int main() { int a=10; if(a==a--) printf("true 1\t"); a=10; if(a==--a) printf("true2 \t"); return 0; } </code></pre>
<c>
2016-09-30 16:41:40
LQ_CLOSE
39,796,511
How do i show the current CodePush Version label in my React Native Android app?
<p>Looking for something like: <code> &lt;Text&gt;VERSION={CodePush.VersionLabel}&lt;/Text&gt; </code></p> <p>Where CodePush.VersionLabel is something like "v6" that is displayed in <code>code-push deployment ls &lt;MyApp&gt;</code></p> <p>I'd like to show this at the bottom my login screen.</p>
<react-native><code-push>
2016-09-30 17:00:14
HQ
39,796,893
How to run a migration in production
<p>I am new to migrations and I can't find out what to do to get my changes onto the LiveDB.</p> <p>So on dev when I add to my model I do</p> <pre><code>PM&gt; add-migration &lt;name&gt; PM&gt; update-database </code></pre> <p>But what do I do on live? I was HOPING that I could just publish\deploy to live and the migration would run and update the schema, but I guess not :)</p> <p>The Live SQL server is off in its own world I have no access to it from my dev box to just change the connectionstring and doing an update-database again.</p> <p>What do you guys do, where's the docs?</p> <p>Thanks, Steve</p>
<asp.net-core><entity-framework-core>
2016-09-30 17:24:53
HQ
39,798,083
How to do multiple word and value replacement in a multiple line at one time
Lets say I have multiples like this my input lines: "stack overflow version {5} my new version" "stack exchnage version {10} my new version" "perl scripting version 5.14 my new version" "segmentaion falult happen {5} if the memory is not freed" " my college 30 new xxxx" I want to replace value inside parenthesis and the value is not constant it will be vary by file by file. `My Approaches`: use strict; use warnings; my $old_parameter='stack overfolw version'; my $new_parameter; my $old_value={5}; my $new_value=' '; my $filename ='input.txt' open my $fh, "<", $filename or die "Couldn't open input file: $!";my file while<FH> { if ($old_parameter) and ($old_value) { s/($old_value)/(new_value); } the above code will replace the value if the value is constant but if the value is vary lets say (1--100) and also I want to do replacement at one time all the line. then what would be the best approach ?
<perl>
2016-09-30 18:41:09
LQ_EDIT
39,798,317
IdentityUserLogin<string>' requires a primary key to be defined error while adding migration
<p>I am using 2 different Dbcontexts. i want to use 2 different databases users and mycontext. While doing that i am getting a error The entity type 'Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin' requires a primary key to be defined. I think there is something wrong with IdentityUser please suggest me where can i change my code so that i can add migration.</p> <p>My Dbcontext class:</p> <pre><code> class MyContext : DbContext { public DbSet&lt;Post&gt; Posts { get; set; } public DbSet&lt;Tag&gt; Tags { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); modelBuilder.Entity&lt;PostTag&gt;() .HasKey(t =&gt; new { t.PostId, t.TagId }); modelBuilder.Entity&lt;PostTag&gt;() .HasOne(pt =&gt; pt.Post) .WithMany(p =&gt; p.PostTags) .HasForeignKey(pt =&gt; pt.PostId); modelBuilder.Entity&lt;PostTag&gt;() .HasOne(pt =&gt; pt.Tag) .WithMany(t =&gt; t.PostTags) .HasForeignKey(pt =&gt; pt.TagId); } } public class Post { public int PostId { get; set; } public string Title { get; set; } public AppUser User {get; set;} public string Content { get; set; } public List&lt;PostTag&gt; PostTags { get; set; } } public class Tag { public string TagId { get; set; } public List&lt;PostTag&gt; PostTags { get; set; } } public class PostTag { public int PostId { get; set; } public Post Post { get; set; } public string TagId { get; set; } public Tag Tag { get; set; } } </code></pre> <p>and AppUser class:</p> <pre><code>public class AppUser : IdentityUser { //some other propeties } </code></pre> <p>when I try to Add migration the following error occurs.</p> <pre><code>The entity type 'Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin&lt;string&gt;' requires a primary key to be defined. </code></pre> <p>give me solution to resolve the issue..</p>
<entity-framework>
2016-09-30 18:55:32
HQ
39,798,321
Generate clang compilation database for a Visual Studio project
<p>Visual Studio was added a lot of support for Clang.</p> <p>I want to use clang-tidy.exe for a Visual-Studio project. In order to do that I need the JSON "compilation database".</p> <p>Is there some way to export this database from a visual studio (2015) project?</p>
<visual-studio><visual-studio-2015><clang>
2016-09-30 18:55:46
HQ
39,798,542
Using jq to fetch key value from json output
<p>I have a file that looks as below:</p> <pre><code>{ "repositories": [ { "id": "156c48fc-f208-43e8-a631-4d12deb89fa4", "namespace": "rhel12", "namespaceType": "organization", "name": "rhel6.6", "shortDescription": "", "visibility": "public" }, { "id": "f359b5d2-cb3a-4bb3-8aff-d879d51f1a04", "namespace": "rhel12", "namespaceType": "organization", "name": "rhel7", "shortDescription": "", "visibility": "public" } ] } </code></pre> <p>I want to get only name values with each of them in a new line so that I can use <code>while read -r line</code>. I need only </p> <pre><code>rhel6.6 rhel7 </code></pre> <p>I am using jq as follows which doesn't seem to work:</p> <pre><code>jq -r '.[].name' </code></pre> <p>Please suggest correct use of jq here</p>
<linux><bash><shell><curl><jq>
2016-09-30 19:10:58
HQ
39,798,589
How to Visual c++ like javascript date?
<p>Visual c++ like Javascrit (new Date()).getTime() function? Function return (1475262776012) milliseconds.</p>
<javascript><c++><date>
2016-09-30 19:14:27
LQ_CLOSE
39,798,694
How to forEach in Elixir
<p>How do you forEach in Elixir? In JavaScript (and most languages have an equivalent), I can iterate through the various items in a list and do something with side effects like outputting to the console.</p> <pre><code>[1,2,3].forEach(function(num) { console.log(num); }); //=&gt; 1 //=&gt; 2 //=&gt; 3 </code></pre> <p>Is there an equivalent in elixir?</p>
<javascript><foreach><elixir>
2016-09-30 19:22:41
HQ
39,799,435
Crypto++ on Omnet++
Can you help me with the steps to link/import crypto++ library to OMNeT++ framework properly, please. I use omnet++ 5.0/inetmanet 3.0 version (Windows 10). Best regards, Hajji
<omnet++><crypto++>
2016-09-30 20:16:14
LQ_EDIT
39,799,640
When writing a PowerShell module in C#, how do I store module state?
<p>I'm writing a PowerShell module in C# that connects to a database. The module has a <code>Get-MyDatabaseRecord</code> cmdlet which can be used to query the database. If you have a <code>PSCredential</code> object in the variable <code>$MyCredentials</code>, you can call the cmdlet like so:</p> <pre><code>PS C:\&gt; Get-MyDatabaseRecord -Credential $MyCredentials -Id 3 MyRecordId : 3 MyRecordValue : test_value </code></pre> <p>The problem is, having to specify the <code>Credential</code> parameter every time that you call <code>Get-MyDatabaseRecord</code> is tedious and inefficient. It would be better if you could just call one cmdlet to connect to the database, and then another to get the record:</p> <pre><code>PS C:\&gt; Connect-MyDatabase -Credential $MyCredentials PS C:\&gt; Get-MyDatabaseRecord -Id 3 MyRecordId : 3 MyRecordValue : test_value </code></pre> <p>In order for that to be possible, the <code>Connect-MyDatabase</code> cmdlet has to store the database connection object somewhere so that the <code>Get-MyDatabaseRecord</code> cmdlet can obtain that object. How should I do this?</p> <h2>Ideas I've thought of</h2> <h3>Use a static variable</h3> <p>I could just define a static variable somewhere to contain the database connection:</p> <pre><code>static class ModuleState { internal static IDbConnection CurrentConnection { get; set; } } </code></pre> <p>However, global mutable state is usually a bad idea. Could this cause problems somehow, or is this a good solution?</p> <p>(One example of a problem would be if multiple PowerShell sessions somehow shared the same instance of my assembly. Then all of the sessions would inadvertently share a single <code>CurrentConnection</code> property. But I don't know if this is actually possible.)</p> <h3>Use PowerShell module session state</h3> <p>The MSDN page "<a href="https://msdn.microsoft.com/en-us/library/ms714451%28v=vs.85%29.aspx">Windows PowerShell Session State</a>" talks about something called session state. The page says that "session-state data" contains "session-state variable information", but it doesn't go into detail about what this information is or how to access it.</p> <p>The page also says that <a href="https://msdn.microsoft.com/en-us/library/system.management.automation.sessionstate%28v=vs.85%29.aspx">the <code>SessionState</code> class</a> can be used to access session-state data. This class contains a property called <a href="https://msdn.microsoft.com/en-us/library/system.management.automation.sessionstate.psvariable%28v=vs.85%29.aspx"><code>PSVariable</code></a>, of type <a href="https://msdn.microsoft.com/en-us/library/system.management.automation.psvariableintrinsics%28v=vs.85%29.aspx"><code>PSVariableIntrinsics</code></a>.</p> <p>However, I have two problems with this. The first problem is that accessing the <code>SessionState</code> property requires me to inherit from <code>PSCmdlet</code> instead of <code>Cmdlet</code>, and I'm not sure if I want to do that.</p> <p>The second problem is that I can't figure out how to make the variable private. Here's the code that I'm trying:</p> <pre><code>const int TestVariableDefault = 10; const string TestVariableName = "TestVariable"; int TestVariable { get { return (int)SessionState.PSVariable.GetValue(TestVariableName, TestVariableDefault); } set { PSVariable testVariable = new PSVariable(TestVariableName, value, ScopedItemOptions.Private); SessionState.PSVariable.Set(testVariable); } } </code></pre> <p>The <code>TestVariable</code> property works just as I would expect. But despite the fact that I'm using <code>ScopedItemOptions.Private</code>, I can still access this variable at the prompt by typing in <code>$TestVariable</code>, and the variable is listed in the output of <code>Get-Variable</code>. I want my variable to be hidden from the user.</p>
<c#><powershell>
2016-09-30 20:31:04
HQ
39,799,698
c# index was out of the bounds of the array
this is my program with error"index was out of the bounds of array" need help using System; using System.Collections.Generic; using System.Text; namespace command { class Program { static void Main(string[] args) Console.WriteLine("First Name is " + args[0]); Console.WriteLine("Last Name is " + args[1]); Console.ReadLine(); } }
<c#>
2016-09-30 20:34:55
LQ_EDIT