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
34,615,898
React Server side rendering of CSS modules
<p>The current practice for CSS with React components seems to be using webpack's style-loader to load it into the page in.</p> <pre class="lang-js prettyprint-override"><code>import React, { Component } from 'react'; import style from './style.css'; class MyComponent extends Component { render(){ return ( &lt;div className={style.demo}&gt;Hello world!&lt;/div&gt; ); } } </code></pre> <p>By doing this the style-loader will inject a <code>&lt;style&gt;</code> element into the DOM. However, the <code>&lt;style&gt;</code> will not be in the virtual DOM and so if doing server side rendering, the <code>&lt;style&gt;</code> will be omitted. This cause the page to have <a href="https://en.wikipedia.org/wiki/Flash_of_unstyled_content" rel="noreferrer">FOUC</a>.</p> <p>Is there any other methods to load <a href="https://github.com/css-modules/css-modules" rel="noreferrer">CSS modules</a> that work on both server and client side?</p>
<reactjs><webpack><webpack-style-loader>
2016-01-05 15:57:15
HQ
34,616,050
How to check if a char is in the alphabet in C#
<p>I think the title says enough.</p> <pre><code>void onClickSubmit(char submit) { if(submit.//check if it is alphabetical) { //some code } } </code></pre> <p>how can i check if the char submit is in the alphabet?</p>
<c#><char><alphabet>
2016-01-05 16:04:27
LQ_CLOSE
34,616,725
C: non-NULL terminated unsigned char *
I saw [here][1] that it isn't possible to find out an unsigned char * length using strlen if it isn't NULL terminated, since the strlen function will go over the string but won't find any '\0', hence a run-time error. I figure that it is exactly the same for signed char *. I saw a code snippet that was doing something like `int len = sizeof(unsigned char *);` but, as I understand, it only gives the size of a pointer - word size. Is it possible to use sizeof in another way to get the result or do I have to get the length somewhere else? [1]: http://stackoverflow.com/questions/261431/how-to-find-the-length-of-unsigned-char-in-c
<c><string><sizeof><strlen>
2016-01-05 16:38:56
LQ_EDIT
34,616,857
GKMinmaxStrategist doesn't return any moves
<p>I have the following code in my <code>main.swift</code>:</p> <pre><code>let strategist = GKMinmaxStrategist() strategist.gameModel = position strategist.maxLookAheadDepth = 1 strategist.randomSource = nil let move = strategist.bestMoveForActivePlayer() </code></pre> <p>...where <code>position</code> is an instance of my <code>GKGameModel</code> subclass <code>Position</code>. After this code is run, <code>move</code> is <code>nil</code>. <code>bestMoveForPlayer(position.activePlayer!)</code> also results in <code>nil</code> (but <code>position.activePlayer!</code> results in a <code>Player</code> object).</p> <p>However,</p> <pre><code>let moves = position.gameModelUpdatesForPlayer(position.activePlayer!)! </code></pre> <p>results in a non-empty array of possible moves. From Apple's documentation (about <code>bestMoveForPlayer(_:)</code>):</p> <blockquote> <p>Returns nil if the player is invalid, the player is not a part of the game model, or the player has no valid moves available.</p> </blockquote> <p>As far as I know, none of this is the case, but the function still returns <code>nil</code>. What could be going on here?</p> <p>If it can be of any help, here's my implementation of the <code>GKGameModel</code> protocol:</p> <pre><code>var players: [GKGameModelPlayer]? = [Player.whitePlayer, Player.blackPlayer] var activePlayer: GKGameModelPlayer? { return playerToMove } func setGameModel(gameModel: GKGameModel) { let position = gameModel as! Position pieces = position.pieces ply = position.ply reloadLegalMoves() } func gameModelUpdatesForPlayer(thePlayer: GKGameModelPlayer) -&gt; [GKGameModelUpdate]? { let player = thePlayer as! Player let moves = legalMoves(ofPlayer: player) return moves.count &gt; 0 ? moves : nil } func applyGameModelUpdate(gameModelUpdate: GKGameModelUpdate) { let move = gameModelUpdate as! Move playMove(move) } func unapplyGameModelUpdate(gameModelUpdate: GKGameModelUpdate) { let move = gameModelUpdate as! Move undoMove(move) } func scoreForPlayer(thePlayer: GKGameModelPlayer) -&gt; Int { let player = thePlayer as! Player var score = 0 for (_, piece) in pieces { score += piece.player == player ? 1 : -1 } return score } func isLossForPlayer(thePlayer: GKGameModelPlayer) -&gt; Bool { let player = thePlayer as! Player return legalMoves(ofPlayer: player).count == 0 } func isWinForPlayer(thePlayer: GKGameModelPlayer) -&gt; Bool { let player = thePlayer as! Player return isLossForPlayer(player.opponent) } func copyWithZone(zone: NSZone) -&gt; AnyObject { let copy = Position(withPieces: pieces.map({ $0.1 }), playerToMove: playerToMove) copy.setGameModel(self) return copy } </code></pre> <p>If there's any other code I should show, let me know.</p>
<swift><gameplay-kit><gkminmaxstrategist>
2016-01-05 16:44:42
HQ
34,617,066
Passing array (c++)
Code: #include <stdio.h> #include <string.h> #include <malloc.h> #include <stdlib.h> #include <math.h> #include <assert.h> #include <iostream> using namespace std; void case1(); void case2(); void case3(); void case4(); void case5(); //Global variables const int MAXROW = 5; const int MAXCOL = 5; int main() { char selection; do //menu { cout << "\n\nMENU\n"; cout << "1. Enter array 5,5 \n"; cout << "2. Find max and min: \n"; cout << "3. Average of negatives: \n"; cout << "4. Product of numbers different from 0 \n"; cout << "5. Output: \n"; cout << "6. Exit.\n\n"; cin >> selection; switch (selection) { case '1': { system("cls"); case1(); } break; case '2': { //system("cls"); case2(); } break; case '3': { //system("cls"); case3(); } break; case '4': { //system("cls"); case4(); } break; case '5': { //system("cls"); case5(); } break; } } while (selection != '6'); return 0; } void case1() { int A[MAXROW][MAXCOL] = { 0 }; for (int r = 0; r < MAXROW; ++r) for (int c = 0; c < MAXCOL; ++c) { cout << "\n A[" << r << "][" << c << "]= "; cin >> A[r][c]; } } void case2() { int newarr[MAXROW + 1][MAXCOL + 1] = { 0 }; int max[MAXCOL] = { 0 }; for (int r = 0; r < MAXROW; ++r) { int minr = A[r][0]; for (int c = 0; c < MAXCOL; ++c) { newarr[r][c] = A[r][c]; if (minr > A[r][c]) minr = A[r][c]; if (max[c] < A[r][c]) max[c] = A[r][c]; } newarr[r][MAXCOL] = minr; } for (int c = 0; c < MAXCOL; ++c) newarr[MAXROW][c] = max[c]; for (int r = 0; r < MAXROW + 1; ++r) { for (int c = 0; c < MAXCOL + 1; ++c) newarr[r][c] ? cout << newarr[r][c] << "\t" : cout << " \t"; cout << "\n"; } { //Function to find average of negatives void case3(); { int negNumber = 0; double average = 0; for (int r = 0; r < 6; ++r) { for (int c = 0; c < 6; ++c) { if (newarr[r][c] < 0) { ++negNumber; average += newarr[r][c]; } } } if (negNumber > 0) { average /= negNumber; cout << "Average of negatives: \n" << average; } else cout << "No negatives.\n"; } void case4(); {//Function to find product of numbers different from 0 int count = 0; int product = 1; bool f = false; for (int r = 0; r < 6; ++r) for (int c = 0; c < 6; ++c) if (newarr[r][c] != 0) { ++count; product *= newarr[r][c]; f = true; } if (count != 0) cout << "\n Product of numbers different from 0 is: \n" << product << endl; else cout << "All elements are = 0"; } void case5(); { for (int r = 0; r < MAXROW + 1; ++r) { for (int c = 0; c < MAXCOL + 1; ++c) newarr[r][c] ? cout << newarr[r][c] << "\t" : cout << " \t"; cout << "\n"; } } } As you can see in case1() is the input array. What I wonder how to use this array in all other functions(case2,case3,case4,case5). I also define several global variables but i want to put them in the function case1(). (const int MAXROW = 5; const int MAXCOL = 5;) How will this happen? How to call them in the menu? For now my error list is full with "'A': undeclared identifier".
<c++><arrays><parameter-passing><pass-by-reference>
2016-01-05 16:54:38
LQ_EDIT
34,617,157
Is it possible to host telegram on my own server?
<p><a href="https://telegram.org/" rel="noreferrer">Telegram</a> is a cloud based chat service. All of their clients are open source. I was wondering if there's a way to host a 'private' telegram service on my own server. </p> <p>If not, is there anything out there that can provide all or almost all features that telegram provides?</p>
<telegram>
2016-01-05 16:59:38
HQ
34,618,039
How to implement bit error based on percentage in C?
<p>I'm stuck at trying to simulate an Binary Symmetric Channel in C.</p> <p>It should work like this: the user enters a number (for example 0.01 = 1%) which represents error rate. So, for instance, if i read 1001 from file every bit has a chance to change its value to 0/1 respectively depending on the entered percent.</p> <p>Reading from file and writing into another is already working, but I just don't know how to make these percentage-based errors happen.</p> <p>Any help is much appreciated, thanks in advance.</p>
<c>
2016-01-05 17:44:36
LQ_CLOSE
34,618,504
How can I pull down a commit from Github (Enterprise) that I don't have locally?
<p>I accidentally did a <code>push --force</code> on the wrong repo (too many termminals open), effectively resetting the master branch back to an earlier commit.</p> <p>Looking at my build system I can see that the commit used to point to XYZ, however I don't have that commit locally as I hadn't done a pull or fetch recently. The repo is in Github, and I can navigate in Github to view the commit, so I know it is there.</p> <p>How can I pull down the commit so I can reset <code>master</code> back to the right commit without having to bother the dev who pushed that change?</p>
<git><github>
2016-01-05 18:13:39
HQ
34,618,978
how to give different file name every time i capture video and write it to file?
<p>I am newbee in opencv. I am working on part of the project.</p> <p>In the below code, I have used <strong>VideoWriter</strong> class to store video with name <strong>MyVideo.avi</strong> as I specified in below code. But every time i capture video it stores with same name i.e it get overridden. <strong>So I want to name it with computer date and time. please help me to modify this</strong> </p> <pre><code>#include "opencv2/highgui/highgui.hpp" #include &lt;iostream&gt; using namespace cv; using namespace std; int main(int argc, char* argv[]) { VideoCapture cap(0); // open the video camera no. 0 if (!cap.isOpened()) // if not success, exit program { cout &lt;&lt; "ERROR: Cannot open the video file" &lt;&lt; endl; return -1; } namedWindow("MyVideo",CV_WINDOW_AUTOSIZE); //create a window called "MyVideo" double dWidth = cap.get(CV_CAP_PROP_FRAME_WIDTH); //get the width of frames of the video double dHeight = cap.get(CV_CAP_PROP_FRAME_HEIGHT); //get the height of frames of the video cout &lt;&lt; "Frame Size = " &lt;&lt; dWidth &lt;&lt; "x" &lt;&lt; dHeight &lt;&lt; endl; Size frameSize(static_cast&lt;int&gt;(dWidth), static_cast&lt;int&gt;(dHeight)); VideoWriter oVideoWriter ("D:/MyVideo.avi", CV_FOURCC('P','I','M','1'), 20, frameSize, true); //initialize the VideoWriter object if ( !oVideoWriter.isOpened() ) //if not initialize the VideoWriter successfully, exit the program { cout &lt;&lt; "ERROR: Failed to write the video" &lt;&lt; endl; return -1; } while (1) { Mat frame; bool bSuccess = cap.read(frame); // read a new frame from video if (!bSuccess) //if not success, break loop { cout &lt;&lt; "ERROR: Cannot read a frame from video file" &lt;&lt; endl; break; } oVideoWriter.write(frame); //writer the frame into the file imshow("MyVideo", frame); //show the frame in "MyVideo" window if (waitKey(10) == 27) //wait for 'esc' key press for 30ms. If 'esc' key is pressed, break loop { cout &lt;&lt; "esc key is pressed by user" &lt;&lt; endl; break; } } return 0; } </code></pre>
<c++><qt><opencv><image-processing><computer-vision>
2016-01-05 18:40:33
LQ_CLOSE
34,619,145
Laravel: find out if variable is collection
<p>I want to find out if a variable is a collection.</p> <p>I can't use is_object() because it will be true even if it is not an collection. For now I use this, and it works:</p> <pre><code>if(is_object($images) &amp;&amp; get_class($images) != 'Illuminate\Database\Eloquent\Collection') { </code></pre> <p>But I think it's so ugly that I spend time asking you about another solution.</p> <p>Do you have any idea?</p>
<php><laravel><collections>
2016-01-05 18:50:02
HQ
34,619,256
Access OBDC Connection to SQL SERVER
I setup a new user with a new computer and installed MS Office. When I open the link to the access DB I get the error "OBDC - connection to SQL Server Native Client 11.0Path/of/Accessdb" Unfortunately I did not develop the Access DB and have no documentation on how to configure it from the developer
<sql-server><ms-access-2010>
2016-01-05 18:56:25
LQ_EDIT
34,619,305
functions calling functions python
def one_good_turn(n): return n + 1 def deserves_another(n): return n + 2 I don´t quite understand when it is asked me change the body of deserves_another, so that it always adds 2 to the output of one_good_turn?
<python>
2016-01-05 18:59:40
LQ_EDIT
34,619,539
Web service integration in Java
<p>I have created a web application, now i was asked by my professor to integrate it with another application using a provided web service.Given this is my first time working with web services, i read a lot about it(wsdl,SOAP..). But i still seem to be confused about the concept. I have 2 application mine and another one. The data saved in my application, needs to be saved in the second application, and i am given a wsdl file. I imported the file to eclipse and created the java classes of the wsdl file using Eclipse kepler. What i need is a bit clarification on how the concept in my case works? The same database should be on both sides? What do i need to do? Any help on clarifying this would be much appreciated.</p>
<java><web-services><soap><wsdl>
2016-01-05 19:15:12
LQ_CLOSE
34,620,317
Asynchronous classes and its features
<p>Newbie in programming, I am trying to understand <strong>Asynchronous</strong> classes and the benefits. What features can be included in a class that supports such operations? With example too</p>
<java>
2016-01-05 20:05:50
LQ_CLOSE
34,620,469
Safely assign value to nested hash using Hash#dig or Lonely operator(&.)
<pre><code>h = { data: { user: { value: "John Doe" } } } </code></pre> <p>To assign value to the nested hash, we can use</p> <pre><code>h[:data][:user][:value] = "Bob" </code></pre> <p>However if any part in the middle is missing, it will cause error.</p> <p>Something like </p> <pre><code>h.dig(:data, :user, :value) = "Bob" </code></pre> <p>won't work, since there's no <code>Hash#dig=</code> available yet.</p> <p>To safely assign value, we can do</p> <pre><code>h.dig(:data, :user)&amp;.[]=(:value, "Bob") # or equivalently h.dig(:data, :user)&amp;.store(:value, "Bob") </code></pre> <p>But is there better way to do that? </p>
<ruby><hash><dig><ruby-2.3><safe-navigation-operator>
2016-01-05 20:16:30
HQ
34,620,482
C# Reading Paths From Text File Says Path Doesn't Exist
<p>I'm developing a small command line utility to remove files from a directory. The user has the option to specify a path at the command line or have the paths being read from a text file.</p> <p>Here is a sample text input:</p> <pre><code>C:\Users\MrRobot\Desktop\Delete C:\Users\MrRobot\Desktop\Erase C:\Users\MrRobot\Desktop\Test </code></pre> <p>My Code:</p> <pre><code>class Program { public static void Main(string[] args) { Console.WriteLine("Number of command line parameters = {0}", args.Length); if(args[0] == "-tpath:"){ clearPath(args[1]); } else if(args[0] == "-treadtxt:"){ readFromText(args[1]); } } public static void clearPath(string path) { if(Directory.Exists(path)){ int directoryCount = Directory.GetDirectories(path).Length; if(directoryCount &gt; 0){ DirectoryInfo di = new DirectoryInfo(path); foreach (DirectoryInfo dir in di.GetDirectories()) { dir.Delete(true); } } else{ Console.WriteLine("No Subdirectories to Remove"); } int fileCount = Directory.GetFiles(path).Length; if(fileCount &gt; 0){ System.IO.DirectoryInfo di = new DirectoryInfo(path); foreach (FileInfo file in di.GetFiles()) { file.Delete(); } } else{ Console.WriteLine("No Files to Remove"); } } else{ Console.WriteLine("Path Doesn't Exist {0}", path); } } public static void readFromText(string pathtotext) { try { // Open the text file using a stream reader. using (StreamReader sr = new StreamReader(pathtotext)) { // Read the stream to a string, and write the string to the console. string line = sr.ReadToEnd(); clearPath(line); } } catch (Exception e) { Console.WriteLine("The file could not be read:"); Console.WriteLine(e.Message); } } } } </code></pre> <p><strong>My Problem:</strong></p> <p>When reading from the text file, it says that the first path doesn't exist, and prints all the paths to the prompt, despite that I have no <code>Console.WriteLine()</code>. However, if I plug these same paths and call -tPath: it will work. My issue seems to be in the <code>readFromText()</code> I just can't seem to figure it out. </p>
<c#><command-line><text-files><streamreader>
2016-01-05 20:17:17
LQ_CLOSE
34,621,006
How can a file contain null bytes?
<p>How is it possible that files can contain null bytes in operating systems written in a language with null-terminating strings (namely, C)?</p> <p>For example, if I run this shell code:</p> <pre><code>$ printf "Hello\00, World!" &gt; test.txt $ xxd test.txt 0000000: 4865 6c6c 6f00 2c20 576f 726c 6421 Hello., World! </code></pre> <p>I see a null byte in <code>test.txt</code> (at least in OS X). If C uses null-terminating strings, and OS X is written in C, then how come the file isn't terminated at the null byte, resulting in the file containing <code>Hello</code> instead of <code>Hello\00, World!</code>? Is there a fundamental difference between files and strings?</p>
<c><macos><null-terminated>
2016-01-05 20:50:31
HQ
34,621,080
Finding and removing consonants in a word: my program does not deliver the consonants
here is my program import time print('hello, i am the consonants finder and i am going to find he consonants in your word') consonants = 'b' 'c' 'd' 'f' 'g' 'h' 'j' 'k' 'l' 'm' 'n' 'p' 'q' 'r' 's' 't' 'v' 'w' 'x' 'y' 'z' word = input('what is your word: ').lower() time.sleep(1) print('here is your word/s only in consonants') time.sleep(1) print('Calculating') time.sleep(1) for i in word: if i == consonants: print((i), ' is a consonant') here Is the output: hello, i am the consonants finder and i am going to find he consonants in your word what is your word: hello here is your word/s only in consonants Calculating >>> how come the output does not give the consonants this is what the output should be: hello, i am the consonants finder and i am going to find he consonants in your word what is your word: hello here is your word/s only in consonants Calculating hll
<python><python-3.5>
2016-01-05 20:55:13
LQ_EDIT
34,621,093
Persist Elastic Search Data in Docker Container
<p>I have a working ES docker container running that I run like so</p> <pre><code>docker run -p 80:9200 -p 9300:9300 --name es-loaded-with-data --privileged=true --restart=always es-loaded-with-data </code></pre> <p>I loaded up ES with a bunch of test data and wanted to save it in that state so I followed up with </p> <pre><code>docker commit containerid es-tester docker save es-tester &gt; es-tester.tar </code></pre> <p>then when I load it back in the data is all gone... what gives?</p> <pre><code>docker load &lt; es-tester.tar </code></pre>
<elasticsearch><docker>
2016-01-05 20:56:00
HQ
34,621,576
The background music keep restarting. How to stop it.
<p>I create a sharedInstance of a background music and initialize it in the viewDidLoad of the first view controller. But when i change the screen (via segue) and come back to the first screen, the music restart. I believe that's happen because the viewDidLoad it's called again, but i don't want the music to keep restarting every time i comeback to this screen. </p> <p>How can i manage to the music keep playing without interfering? </p>
<ios><swift><avfoundation><segue>
2016-01-05 21:31:33
LQ_CLOSE
34,621,905
need help to solve stock market puzzle in java for max profit
need max profit. what i can modify to get the max profit if i can only buy once and sell once. means if i buy at 5 and sell at 150 then its max profit. Currently what is have done is buy when price is less than next day ,and sell if price is more than next day. as obvious We have to keep in mind we can sell only after we buy, means sell index can not be before buy index. what i have done so far is : package com; public class Stock { public static void main(String[] args) { int[] prices = {20,10,70,80,5,150,67}; int length = prices.length-2; int buy=0; int sell=0; int buyIndex=-1; int sellIndex=-1; int i=0; for (i =0 ; i<=length ;i++ ){ // buy logic start if(prices[i]<prices[i+1]){ if(i>buyIndex){ buy= prices[i]; buyIndex=i; System.out.println("buy"+buy); System.out.println("buyIndex"+buyIndex); } } // buy logic finish // sell logic start if(buy!=0 && i>buyIndex ){ System.out.println("inside sell logic"); if(prices[i]>prices[i+1]){ sell = prices[i]; sellIndex = i; System.out.println("sell"+sell); System.out.println("sellIndex"+sellIndex); } } // sell logic end } // for loop end } // main end } out put is buy10 buyIndex1 buy70 buyIndex2 inside sell logic sell80 sellIndex3 buy5 buyIndex4 inside sell logic sell150 sellIndex5 Please help.
<java><algorithm>
2016-01-05 21:54:26
LQ_EDIT
34,622,082
Why is a closing brace showing no code coverage?
<p>I've got a Swift function for which Xcode is showing 0 passes in code coverage. The line is a closing brace (highlighted in red below).</p> <p>Is this a bug in Xcode? If not, what condition do I need to hit to run that line? I thought I was covering all paths through this method.</p> <p><a href="https://i.stack.imgur.com/mD5TY.png" rel="noreferrer"><img src="https://i.stack.imgur.com/mD5TY.png" alt="Code with un-covered line"></a></p>
<xcode><unit-testing><xcode7><code-coverage>
2016-01-05 22:07:06
HQ
34,622,482
How does ap fromMaybe compose?
<p>There I was, writing a function that takes a value as input, calls a function on that input, and if the result of that is <code>Just x</code>, it should return <code>x</code>; otherwise, it should return the original input.</p> <p>In other words, this function (that I didn't know what to call):</p> <pre><code>foo :: (a -&gt; Maybe a) -&gt; a -&gt; a foo f x = fromMaybe x (f x) </code></pre> <p>Since it seems like a general-purpose function, I wondered if it wasn't already defined, so <a href="https://twitter.com/ploeh/status/684418608454352896">I asked on Twitter</a>, and <a href="https://twitter.com/bitemyapp/status/684467784793886720">Chris Allen replied</a> that it's <code>ap fromMaybe</code>.</p> <p>That sounded promising, so I fired up GHCI and started experimenting:</p> <pre><code>Prelude Control.Monad Data.Maybe&gt; :type ap ap :: Monad m =&gt; m (a -&gt; b) -&gt; m a -&gt; m b Prelude Control.Monad Data.Maybe&gt; :type fromMaybe fromMaybe :: a -&gt; Maybe a -&gt; a Prelude Control.Monad Data.Maybe&gt; :type ap fromMaybe ap fromMaybe :: (b -&gt; Maybe b) -&gt; b -&gt; b </code></pre> <p>The type of <code>ap fromMaybe</code> certainly looks correct, and a couple of experiments seem to indicate that it has the desired behaviour as well.</p> <p>But <strong>how does it work?</strong></p> <p>The <code>fromMaybe</code> function seems clear to me, and in isolation, I think I understand what <code>ap</code> does - at least in the context of <code>Maybe</code>. When <code>m</code> is <code>Maybe</code>, it has the type <code>Maybe (a -&gt; b) -&gt; Maybe a -&gt; Maybe b</code>.</p> <p>What I don't understand is how <code>ap fromMaybe</code> even compiles. To me, this expression looks like partial application, but I may be getting that wrong. If this is the case, however, I don't understand how the types match up.</p> <p>The first argument to <code>ap</code> is <code>m (a -&gt; b)</code>, but <code>fromMaybe</code> has the type <code>a -&gt; Maybe a -&gt; a</code>. How does that match? Which <code>Monad</code> instance does the compiler infer that <code>m</code> is? How does <code>fromMaybe</code>, which takes two (curried) arguments, turn into a function that takes a single argument?</p> <p>Can someone help me connect the dots?</p>
<haskell><monads>
2016-01-05 22:34:27
HQ
34,622,755
Select all text between quotes, parentheses etc in Atom.io
<p>Sublime Text has this same functionality via:</p> <p><code>ctrl+shift+m</code> or <code>cmd+shift+space</code></p> <p>How do I accomplish the same thing in Atom?</p>
<editor><sublimetext3><atom-editor>
2016-01-05 22:55:51
HQ
34,623,229
webpack loaders and include
<p>I'm new to webpack and I'm trying to understand loaders as well as its properties such as test, loader, include etc.</p> <p>Here is a sample snippet of webpack.config.js that I found in google.</p> <pre><code>module: { loaders: [ { test: /\.js$/, loader: 'babel-loader', include: [ path.resolve(__dirname, 'index.js'), path.resolve(__dirname, 'config.js'), path.resolve(__dirname, 'lib'), path.resolve(__dirname, 'app'), path.resolve(__dirname, 'src') ], exclude: [ path.resolve(__dirname, 'test', 'test.build.js') ], cacheDirectory: true, query: { presets: ['es2015'] } }, ] } </code></pre> <ol> <li><p>Am I right that test: /.js$/ will be used only for files with extension .js?</p></li> <li><p>The loader: 'babel-loader', is the loader we install using npm</p></li> <li><p>The include: I have many questions on this. Am I right that anything we put inside the array will be transpiled? That means, index.js, config.js, and all *.js files in lib, app and src will be transpiled.</p></li> <li><p>More questions on the include: When files get transpiled, do the *.js files get concatenated into one big file?</p></li> <li><p>I think exclude is self explanatory. It will not get transpiled.</p></li> <li><p>What does query: { presets: ['es2015'] } do?</p></li> </ol>
<javascript><ecmascript-6><webpack><webpack-style-loader>
2016-01-05 23:39:11
HQ
34,623,694
Run code on application startup Phoenix Framework (Elixir)
<p>Were would you put code which you want to run only when your application/api starts in vanilla Phoenix application? Let's say I want to make sure some mnesia tables are created or configure my logger backend. The other thing is runtime configuration. They mention it in documentation but it's not clear to me where one would define/change runtime configuration. </p> <p><code>Endpoint.ex</code> seems like a place where initial configuration is done but by looking at docs I can't find any callback that would allow me to run code only once at startup.</p>
<elixir><phoenix-framework>
2016-01-06 00:26:25
HQ
34,624,085
Can I export a Sqlite db using RedBean PHP ORM and Import to MySQL?
<p>I have a simple web app that I've been building using <code>redbean</code> PHP which has a really simple structure with three bean types:</p> <p>areas buildings persons</p> <p>All relationships are exclusive 1:Many. So, a <code>Person</code> belongs to only 1 <code>Building</code>, and a <code>Building</code> belongs to 1 <code>Area</code>. </p> <pre><code>Area BuildingList PersonList </code></pre> <p>Currently, I have been developing it using <code>Sqlite3</code> for ease of development, but I want to move the data to <code>mySQL</code>. I have a lot of data that I've already added.</p> <p>Is there an easy way to use RedBean to Export ALL beans to the new MySql Database?</p> <p>I know I can search for a <code>sqlite</code> -> <code>MySQL</code>/<code>MariaDB</code> converter, but I also potentially want to be able to use this in reverse to make migrating the site super easy to move/backup/change DBs.</p> <p>What I've tried below:</p> <pre><code>R::setup('sqlite:/' . __DIR__ . '/data/database.db'); R::addDatabase('mysql', $MySqlConn ); $old_datas = R::findAll( 'area' ); R::selectDatabase( 'mysql' ); foreach ($old_datas as $bean) { $new_area = R::dispense('area'); $new_area-&gt;importFrom( $bean ); $id = R::store( $new_area ); var_dump( $new_area ); // shows new data } var_dump( R::findAll( 'area' ) ); // returns empty array </code></pre>
<php><mysql><sqlite><redbean>
2016-01-06 01:12:21
HQ
34,624,100
Simulate display: inline in React Native
<p>React Native doesn't support the CSS <code>display</code> property, and by default all elements use the behavior of <code>display: flex</code> (no <code>inline-flex</code> either). Most non-flex layouts can be simulated with flex properties, but I'm flustered with inline text.</p> <p>My app has a container that contains several words in text, some of which need formatting. This means I need to use spans to accomplish the formatting. In order to achieve wrapping of the spans, I can set the container to use <code>flex-wrap: wrap</code>, but this will only allow wrapping at the end of a span rather than the traditional inline behavior of wrapping at word breaks.</p> <p>The problem visualized (spans in yellow):</p> <p><a href="https://i.stack.imgur.com/CgR94.png" rel="noreferrer"><img src="https://i.stack.imgur.com/CgR94.png" alt="enter image description here"></a></p> <p>(via <a href="http://codepen.io/anon/pen/GoWmdm?editors=110" rel="noreferrer">http://codepen.io/anon/pen/GoWmdm?editors=110</a>)</p> <p>Is there a way to get proper wrapping and true inline simulation using flex properties?</p>
<css><reactjs><flexbox><react-native>
2016-01-06 01:13:51
HQ
34,624,174
Will I be able to test this PHP?
<p>So I have 2 websites. One is currently hosted on a domain and one is just local on my computer (viewing it using brackets live preview).</p> <p>I used the hosted website (#1) to create a mysql database. </p> <p>Then for my local website (#2) I created a login page and created a index.php document to handle the submission. In the index.php of the local website I told it to connect to the mysql database of the hosted website.</p> <p>Then when I try to preview the local page and submit it, I get this error</p> <p><strong>"Cannot GET /POST?name=JohnDoe&amp;password=123"</strong></p> <p>So I am wondering, since my sql database is hosted online, can I actually test my website locally or not?</p>
<php><html><mysql>
2016-01-06 01:23:08
LQ_CLOSE
34,624,363
Django Bootstrap App differences with the normal Bootstrap
<p>I read in books and see in tutorials that is better to use a Django Bootstrap example:</p> <p><a href="https://github.com/dyve/django-bootstrap-toolkit" rel="nofollow">https://github.com/dyve/django-bootstrap-toolkit</a></p> <p><a href="https://github.com/dyve/django-bootstrap3" rel="nofollow">https://github.com/dyve/django-bootstrap3</a></p> <p>Over using a base template with the Original boostrap?</p> <p>But what is the difference? Which one is better?</p>
<python><django><twitter-bootstrap>
2016-01-06 01:47:23
LQ_CLOSE
34,624,978
Is there easy way to grid search without cross validation in python?
<p>There is absolutely helpful class GridSearchCV in scikit-learn to do grid search and cross validation, but I don't want to do cross validataion. I want to do grid search without cross validation and use whole data to train. To be more specific, I need to evaluate my model made by RandomForestClassifier with "oob score" during grid search. Is there easy way to do it? or should I make a class by myself?</p> <p>The points are</p> <ul> <li>I'd like to do grid search with easy way.</li> <li>I don't want to do cross validation.</li> <li>I need to use whole data to train.(don't want to separate to train data and test data)</li> <li>I need to use oob score to evaluate during grid search.</li> </ul>
<python><scikit-learn><random-forest><grid-search>
2016-01-06 03:09:35
HQ
34,625,089
Python equivalent of golang's defer statement
<p>How would one implement something that works like the <code>defer</code> statement from go in python? </p> <p>Defer pushes a function call to a stack. When the function containing the defer statement returns, the defered function calls are popped and executed one by one, in the scope that the defer statement was inside in the first place. Defer statements look like function calls, but are not executed until they are popped.</p> <p>Go example of how it works:</p> <pre><code>func main() { fmt.Println("counting") var a *int for i := 0; i &lt; 10; i++ { a = &amp;i defer fmt.Println(*a, i) } x := 42 a = &amp;x fmt.Println("done") } </code></pre> <p>Outputs: </p> <pre><code>counting done 9 9 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1 1 0 0 </code></pre> <p>Go example of a usecase:</p> <pre><code>var m sync.Mutex func someFunction() { m.Lock() defer m.Unlock() // Whatever you want, with as many return statements as you want, wherever. // Simply forget that you ever locked a mutex, or that you have to remember to release it again. } </code></pre>
<python><go><deferred>
2016-01-06 03:21:52
HQ
34,625,720
object twitterBootstrap is not a member of package views.html.helper
<p>Read from stdout: D:\PROJECTS\test\SimpleRequest5\app\views\products\editProduct.scala.html:11: object twitterBootstrap is not a member of package views.html.helper D:\PROJECTS\test\SimpleRequest5\app\views\products\editProduct.scala.html:11: object twitterBootstrap is not a member of package views.html.helper Read from stdout: <h2>@Messages("products.form")</h2> <h2>@Messages("products.form")</h2> Read from stdout: ^ ^</p>
<scala><playframework>
2016-01-06 04:36:53
LQ_CLOSE
34,625,829
Change button style on press in React Native
<p>I'd like the style of a button in my app to change when it is being pressed. What is the best way to do this?</p>
<javascript><reactjs><react-native>
2016-01-06 04:50:08
HQ
34,625,888
How to display date in Month and year format in R
I have a date variable which has date in "Fri Nov 27 20:17:01 IST 2015" format. I need to display it as NOv 2015. How can i do that in R? Please help
<r>
2016-01-06 04:56:11
LQ_EDIT
34,626,975
hi, i want to format sql result in to givin format using sql server
sql result ----> id student_name class 1 abc 1A 2 xyz 1A 3 dsk 1A 4 uij 1A ................. ................. ................. ................. ................. up 1000 results and i want to format data in my specific format id1 student_name1 class1 id2 student_name2 class2 id3 student_name3 class3 1 abc 1A 2 abc 1A 3 abc 1A 4 abc 1A 5 abc 1A 6 abc 1A 7 abc 1A please help ........ as soon as posible thanks & regards ravi kumar
<sql-server>
2016-01-06 06:29:56
LQ_EDIT
34,626,978
Laravel framework tutorial
<p>I'm a PHP developer and want to learn <strong>php laravel framework</strong> . What is the most helpful website to learn Laravel framework ?!</p> <p>Thanks for helping 😊</p>
<php><laravel>
2016-01-06 06:30:00
LQ_CLOSE
34,627,900
IE-9 giving fakepath when using input type file
<p>I wasn't able to read the file in IE-9. I am generating base64 from the url. In all the other browsers it works, except for IE-9. Can anyone please help me with this? I am getting c://fakepath/images.jpg in IE-9</p> <pre><code>if((navigator.userAgent.indexOf("MSIE") != -1 ) || !!document.documentMode == true )) //IF IE &gt; 10 { tmppath = $("#hi").val(); console.log("only in ie"+tmppath); } else{ var selectedFile = this.files[0]; tmppath = URL.createObjectURL(event.target.files[0]); console.log("temp path other"+tmppath); } console.log("temp path"+tmppath); &lt;input name="hello1" type="file" id="hi" accept="image/*"/&gt; </code></pre>
<javascript><internet-explorer-9>
2016-01-06 07:37:49
LQ_CLOSE
34,627,959
Draft refuses handshake when using java-websocket library to connect to the coinbase exchange websocket stream
<p>I am attempting to use the <a href="https://github.com/TooTallNate/Java-WebSocket" rel="noreferrer">Java-Websocket library by TooTallNate</a> to create a websocket client that receives messages from the <a href="https://docs.exchange.coinbase.com/" rel="noreferrer">coinbase exchange websocket stream</a>. I am porting a program I made in Python to Java because of parallelisation bottlenecks in Python and to my knowledge I am doing things the same in Java as I did in Python. Here is my code to open the connection in Python using <a href="https://github.com/liris/websocket-client" rel="noreferrer">this websocket lib</a> (This works as expected):</p> <pre><code>ws = websocket.create_connection("wss://ws-feed.exchange.coinbase.com", 20) ws.send(json.dumps({ "type": "subscribe", "product_id": "BTC-USD" })) </code></pre> <p>Here is my entire Java class:</p> <pre><code>public class CoinbaseWebsocketClient extends WebSocketClient { private final Gson gson = new Gson(); private CoinbaseWebsocketClient(URI serverURI) { super(serverURI, new Draft_17()); connect(); } private static URI uri; private static CoinbaseWebsocketClient coinbaseWebsocketClient; static { try { uri = new URI("wss://ws-feed.exchange.coinbase.com"); } catch (URISyntaxException e) { e.printStackTrace(); } } protected static CoinbaseWebsocketClient get() { if (coinbaseWebsocketClient == null) { coinbaseWebsocketClient = new CoinbaseWebsocketClient(uri); } return coinbaseWebsocketClient; } @Override public void onOpen(ServerHandshake serverHandshake) { System.out.println("Websocket open"); final JsonObject btcUSD_Request = new JsonObject(); btcUSD_Request.addProperty("type", "subscribe"); btcUSD_Request.addProperty("product_id", "BTC_USD"); final String requestString = gson.toJson(btcUSD_Request); send(requestString); } @Override public void onMessage(String s) { System.out.println("Message received: " + s); } @Override public void onClose(int code, String reason, boolean remote) { System.out.println("Websocket closed: " + reason); } @Override public void onError(Exception e) { System.err.println("an error occurred:" + e); } </code></pre> <p>}</p> <p>I know there isn't a totally fundamental issue with my Java code because it works as expected when I use ws://echo.websocket.org as the URI instead of wss://ws-feed.exchange.coinbase.com. However when I try to connect to wss://ws-feed.exchange.coinbase.com I get this error:</p> <pre><code>Websocket closed: draft org.java_websocket.drafts.Draft_17@7ca2fefb refuses handshake </code></pre> <p>There is no authentication or anything like for this connection as far as I know (I didn't provide any in my Python program) so I'm at a loss as to what the source of this error is.</p>
<java><websocket><java-websocket>
2016-01-06 07:42:35
HQ
34,627,992
Android - Refresh An Activity , but it should not clear previous selection areas
This is code of MainActivity languages = (Spinner) findViewById(R.id.spin_lang); languages.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View v, int pos, long id) { // TODO Auto-generated method stub if (pos==1){ Toast.makeText(getApplicationContext(), "You Selected :" +languages.getSelectedItem().toString(),Toast.LENGTH_SHORT).show(); setLocale("en"); } else if(pos ==2){ Toast.makeText(getApplicationContext(), "You Selected :" +languages.getSelectedItem().toString(),Toast.LENGTH_SHORT).show(); setLocale("de"); } } @Override public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } }); the method created for change language. public void setLocale(String lang){ mylocal = new Locale(lang); Locale.setDefault(mylocal); Resources res = getResources(); Configuration conf = res.getConfiguration(); conf.locale = mylocal; DisplayMetrics dm = res.getDisplayMetrics(); res.updateConfiguration(conf, dm); }
<android>
2016-01-06 07:45:03
LQ_EDIT
34,628,088
I want to assign strings to the student constructor's parameters based on what is typed into the JOptionPane
I want to assign strings to the student constructor's parameters based on what is typed into the JOptionPane input boxes . I have the user inputted information set to go to a variable but when I try and use those variables as my Parameters for the constructor I get an error. This is the Main import javax.swing.JOptionPane; public class main { public static void main (String [] args) { String nameinput ; String gradeinput ; String resourceinput ; String whatMissinginput; int infoComformation = 1; if ( infoComformation == 1) { nameinput =JOptionPane.showInputDialog("What is the students name"); gradeinput =JOptionPane.showInputDialog("What is the students grade"); resourceinput =JOptionPane.showInputDialog("What resource are you pulling the child out for "); whatMissinginput =JOptionPane.showInputDialog("What subject are you pulling the child out of "); infoComformation = JOptionPane.showConfirmDialog (null, "Is this the correct informtion \n " +"Name = " + nameinput + "\n" + "Grade = " + gradeinput + "\n" +"Resouce = " + resourceinput + "\n" +"Subject Missing = " + whatMissinginput ); } else if (infoComformation == 0) //THIS IS WHERE THE PROBLEM IS {student pupil = new student( nameinput, gradeinput ,resourceinput,whatMissinginput); } } } Here is the Constructor Class import javax.swing.JOptionPane; public class student { public String studentinfo (String nameinput, String gradeinput , String resourceinput,String whatMissinginput ) { String name ="" ; String grade= ""; String resource =""; String whatMissing=""; name=nameinput; grade=gradeinput; resource=resourceinput; whatMissing=whatMissinginput ; return name+grade+resource+whatMissing; } } What do I Do?
<java>
2016-01-06 07:51:49
LQ_EDIT
34,628,957
apache cordova game development, is it valid?
<p>I've been developing a game using libgdx (Java), it's basically a super mario game, a few moving objects, some sound effects, could something like that be done with html5 and javascript?</p> <p>I tried searching the world wide web for some info, but didn't find a lot, I guess it's not common, or even possible?</p> <p>I'm asking because I want to create non-game apps as well, and will be using apache cordova for those, would be nice to use the same language. </p>
<javascript><html><cordova>
2016-01-06 08:52:17
LQ_CLOSE
34,628,958
How do i implement the algorithm below
Get a list of numbers L1, L2, L3....LN as argument Assume L1 is the largest, Largest = L1 Take next number Li from the list and do the following If Largest is less than Li Largest = Li If Li is last number from the list then return Largest and come out Else repeat same process starting from step 3 Create a function prime_number that does the following Takes as parameter an integer and Returns boolean value true if the value is prime or Returns boolean value false if the value is not prime So far my code is : def get_algorithm_result(num_list): largest =num_list[0] for item in range(0,len(num_list)): if largest < num_list[item]: largest = num_list[item] return largest def prime_number(integer): if integer%2==0: return False else: return True After executing the code i get "Test Spec Failed Your solution failed to pass all the tests" where I'm i going wrong because i believe my code is correct
<python><algorithm>
2016-01-06 08:52:17
LQ_EDIT
34,628,979
Format date with "/" to "-" with javascript
<p>I have this Javascript function that takes X number of days and returns a date in the past</p> <pre><code> var GetDateInThePastFromDays = function (days) { var today = new Date(); _date = new Date(today.getFullYear(), today.getMonth(), today.getDate() - days); return _date.toLocaleDateString(); } </code></pre> <p>That works absolutely fine, but it returns the date as <code>06/01/2016</code> but I want it returned as <code>06-01-2016</code> but I can't seem to find out how to do it correctly.</p>
<javascript><jquery><html><date>
2016-01-06 08:53:30
LQ_CLOSE
34,628,999
swift force-unwrapping exception not propagated
<p>I've run into this silly behaviour in swift where force-unwrapping an optional does not propagate.</p> <p>From the documentation:</p> <blockquote> <p>Trying to use ! to access a non-existent optional value triggers a runtime error. Always make sure that an optional contains a non-nil value before using ! to force-unwrap its value.</p> </blockquote> <p>To reproduce:</p> <pre><code>func foo(bar:String?) throws{ print(bar!); } </code></pre> <p>And</p> <pre><code>try foo(nil); </code></pre> <p>This does not seem logical or consistent to me and I can't find any documentation on this subject.</p> <p>Is this by design?</p>
<ios><swift><swift2>
2016-01-06 08:54:21
HQ
34,629,085
How to output the name in their id
I have a problem, I want that each id in the foreign key can output the name instead of their id. [Here's the image][1] Here's my code : <table class="altrowstable" data-responsive="table" > <thead > <tr> <th> IDno</th> <th> Lastname </th> <th> Firstname </th> <th> Department </th> <th> Program </th> <th> Action</th> </tr> </thead> <tbody> <div style="text-align:center; line-height:50px;"> <?php include('../connection/connect.php'); $YearNow=Date('Y'); $result = $db->prepare("SELECT * FROM student,school_year where user_type =3 AND student.syearid = school_year.syearid AND school_year.from_year like $YearNow "); $result->execute(); for($i=0; $row = $result->fetch(); $i++){ ?> <tr class="record"> <td><?php echo $row['idno']; ?></td> <td><?php echo $row['lastname']; ?></td> <td><?php echo $row['firstname']; ?></td> //name belong's to their id's <td><?php echo $row['dept_id']; ?></td> <td><?php echo $row['progid']; ?></td> <td><a style="border:1px solid grey; background:grey; border-radius:10%; padding:7px 12px; color:white; text-decoration:none; " href="addcandidates.php?idno=<?php echo $row['idno']; ?>" > Running</a></div></td> </tr> <?php } ?> </tbody> </table> Thanks guys need a help [1]: http://i.stack.imgur.com/aOWkd.png
<php>
2016-01-06 08:58:35
LQ_EDIT
34,629,249
Inject namespace experimental to std
<p>Is it bad or good parctice to inject namespace <code>std::experimental</code> into <code>std</code> like following?</p> <pre><code>namespace std { namespace experimental { } using namespace experimental; } #include &lt;experimental/optional&gt; int main() { std::optional&lt; int &gt; o; return 0; } </code></pre> <p>Or even in more modern form:</p> <pre><code>#if __has_include(&lt;optional&gt;) # include &lt;optional&gt; #elif __has_include(&lt;experimental/optional&gt;) # include &lt;experimental/optional&gt; namespace std { using namespace experimental; } #else #error ! #endif int main() { std::optional&lt; int &gt; o; return 0; } </code></pre> <p>The intention to introduce <code>std::experimental</code> "sub-namespace" is clear because <code>std::experimental</code> currently contains <a href="http://en.cppreference.com/w/cpp/experimental">a plenty of <strong>new</strong> libraries</a>. I think it is very likely all them will migrate into <code>namespace std</code> without any substantial changes and user code written currently can rely upon this (am I totally wrong?). Otherwise all this code should be refactored to change from <code>std::experimental::</code> to <code>std::</code> in the future. It is not big deal, but there may be reasons not to do so.</p> <p>The question is about both production code and not-too-serious code.</p>
<c++><c++11><stl><c++14>
2016-01-06 09:08:24
HQ
34,629,261
Django render_to_string() ignores {% csrf_token %}
<p>I am trying to perform unit tests in Django. I have the following form in <code>index.html</code>:</p> <pre><code>&lt;form method=POST&gt; {% csrf_token %} &lt;input name=itemT&gt; &lt;/form&gt; </code></pre> <p>And I am testing if the view render the template correctly:</p> <p>views.py</p> <pre><code>def homePage(request): return render(request, 'index.html') </code></pre> <p>tests.py:</p> <pre><code>request = HttpRequest() response = homePage(request) if response: response = response.content.decode('UTF-8') expectedHTML = render_to_string('index.html') self.assertEqual(response, expectedHTML) </code></pre> <p>The <code>response</code> has a hidden input field with a csrf token; however, the <code>expectedHTML</code> does not (there is just a blank line at the place of <code>{% csrf_token %}</code>). So the assertion always fails.</p> <p>Is it possible to have <code>render_to_string()</code> generate a csrf input field? If so, would the token of <code>response</code> the same as that of <code>expectedHTML</code>?</p> <p>Or, is there any way to ignore the input field such that the test can be successful?</p>
<django>
2016-01-06 09:09:07
HQ
34,629,362
C++ - create new constructor for std::vector<double>?
<p>I have written a custom container class which contains a <code>std::vector&lt;double&gt;</code> instance - works nicely. For compatibility with other API's I would like to export the content of the container as a <code>std::vector&lt;double&gt;</code> copy . Currently this works:</p> <pre><code>MyContainer container; .... std::vector&lt;double&gt; vc(container.begin(), container.end()); </code></pre> <p>But if possible would like to be able to write:</p> <pre><code>MyContainer container; .... std::vector&lt;double&gt; vc(container); </code></pre> <p>Can I (easily) create such a <code>std::vector&lt;double&gt;</code> constructor?</p>
<c++>
2016-01-06 09:15:08
HQ
34,629,387
Checking the value of a key in an hasmap
I would like to know how to check the value of a specific key in an hashmap, for example, if the hashmap "map" contains the key "Key" then what is the value of the key "Key"?
<java><dictionary><hashmap><key-value>
2016-01-06 09:17:00
LQ_EDIT
34,629,424
how to load bitmap directly with picasso library like following
<pre><code>Picasso.with(context).load("url").into(imageView); </code></pre> <p>Here instead of url i want bitmap how can i achieve this. like below-</p> <pre><code>Picasso.with(context).load(bitmap).into(imageView); </code></pre>
<picasso>
2016-01-06 09:18:44
HQ
34,629,540
TaskStackBuilder.addParentStack not working when I was building a notification
<p>I did everything as the official docs writes.But when i navigate backwards,the MainActivity(parent) doesn't open.Instead, the application closes.</p> <p><strong>here is my code:</strong></p> <pre><code>Intent resultIntent = new Intent(context, TestActivity.class); TaskStackBuilder stackBuilder = TaskStackBuilder.create(context); stackBuilder.addParentStack(TestActivity.class); stackBuilder.addNextIntent(resultIntent); </code></pre> <p><strong>the manifest is as below:</strong></p> <pre><code> &lt;activity android:name=".MainActivity" android:label="@string/app_name" android:theme="@style/AppTheme.NoActionBar"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name=".TestActivity" android:parentActivityName=".MainActivity"&gt; &lt;meta-data android:name="android.support.PARENT_ACTIVITY" android:value=".Main2Activity" /&gt; &lt;/activity&gt; </code></pre> <p>Thank you.</p>
<android><notifications><taskstackbuilder>
2016-01-06 09:25:28
HQ
34,629,574
Can bash script be written inside a AWS Lambda function
<p>Can I write a bash script inside a Lambda function? I read in the aws docs that it can execute code written in Python, NodeJS and Java 8.</p> <p>It is mentioned in some documents that it might be possible to use Bash but there is no concrete evidence supporting it or any example</p>
<bash><amazon-web-services><aws-lambda>
2016-01-06 09:27:23
HQ
34,630,253
c# adding a string to an array
<p>i want to simply add a string to an array, like this:</p> <pre><code>string[] arrayName = new string[0]; arrayName.Add("raptor"); </code></pre> <p>But this doesn't work, can someone help me?</p>
<c#><arrays>
2016-01-06 09:59:26
LQ_CLOSE
34,630,552
Why This Query Not Work Properly
why this query not show more than one data.even I have 10/12 data but this line only show 1.check I have limit it 3 but it show only 1 $getAds=mysql_query("SELECT * FROM advertises WHERE status='RUNNING' AND adult='0' AND (country LIKE '%$test%' OR country='ALL') AND (device LIKE '%$pabu%' OR device='ALL') ORDER BY rand() LIMIT 0,3");
<php><mysql>
2016-01-06 10:14:44
LQ_EDIT
34,630,669
Python: ImportError: No module named 'HTMLParser'
<p>I am new to Python. I have tried to ran this code but I am getting an error message for ImportError: No module named 'HTMLParser'. I am using Python 3.x. Any reason why this is not working ?</p> <pre><code>#Import the HTMLParser model from HTMLParser import HTMLParser #Create a subclass and override the handler methods class MyHTMLParser(HTMLParser): #Function to handle the processing of HTML comments def handle_comment(self,data): print ("Encountered comment: ", data) pos = self.getpos() print ("At line: ", pos[0], "position ", pos[1]) def main(): #Instantiate the parser and feed it some html parser= MyHTMLParser() #Open the sample file and read it f = open("myhtml.html") if f.mode== "r": contents= f.read() #read the entire FileExistsError parser.feed() if __name__== "__main__": main() </code></pre> <p>I am getting the following error:</p> <pre><code>Traceback (most recent call last): File "C:\Users\bm250199\workspace\test\htmlparsing.py", line 3, in &lt;module&gt; from HTMLParser import HTMLParser ImportError: No module named 'HTMLParser' </code></pre>
<python-3.x>
2016-01-06 10:20:20
HQ
34,631,634
Oracle data types variations
<p>I'm a new beginner to Oracle ,I'm so confused about the data types .</p> <hr> <p>I don't know the difference between :</p> <ul> <li><code>INT</code>,<code>INTEGER</code>,<code>NUMBER</code></li> <li><code>CHAR</code>,<code>CHAR VARYING</code> ,<code>CHARACTER</code>,<code>CHARACTER VARYING</code></li> </ul>
<sql><database><oracle><oracle11g>
2016-01-06 11:08:05
LQ_CLOSE
34,631,806
Fail during installation of Pillow (Python module) in Linux
<p>I'm trying to install Pillow (Python module) using pip, but it throws this error:</p> <pre><code>ValueError: jpeg is required unless explicitly disabled using --disable-jpeg, aborting </code></pre> <p>So as the error says, I tried:</p> <pre><code>pip install pillow --global-option="--disable-jpeg" </code></pre> <p>But it fails with:</p> <pre><code>error: option --disable-jpeg not recognized </code></pre> <p>Any hints how to deal with it?</p>
<python><linux><pillow>
2016-01-06 11:16:29
HQ
34,631,956
Encryption in URL
<p>I have an URL. My URL type: "<a href="http://myweb.com/id=W5OAGejZ1HpuHri7BB1c%2BXHSYs2c47eyJFhpmroalPXZ5SUIgeUbqu7hJUVFVwPOA0xRI3ILJVHQ5QgBwtWpE1x0%2Fq10VVrmduMU5PiYguW1cXog4azzDvjcbb3%2BVpMDKe5QmvjLgJ9M4TXosTYR%2FOVzIPvXD%2BjeTEFtIM2g6siUcPBOeK5ubQh1QYB%2FCSbgnFsh2mpx3r%2FXBXI09I4q%2Be7hDSITcyIeYzFf1LoovBKotYcYSxhrZkbtIz2utl8PbpGa5G49EAwcKyossEo21dumTfkfJFoXUfmhH7amGcqbKUBOvtmhRwaMqrqoR6Vjd%2FKBCLrszpCRXX%2FdY6Kg0A7AUUNWdedizKCiDYdYL1IMUZ12od7HZNuHCruWPe43uhoxhjyhzx9oFl4rf6f8aM58b6KDtgiBbDwZNiICltUHq6htdzq2KwPRz8tl0WvZaaV3UC7vkfzfH%2FsRrv%2BB8MlsPrW6YfDOwupf0ax%2BJjc8oy%2BD%2BXv53swU5%2BS0dKQv94sgPNoQKG05oi4%2BO7M4gcw5Otp7O6qDFv5yhYnywJD8F6CXWUmHU9WoFRGoQnwdDwoMySYsiM4jCT9aq4s08%2Bx2m8EngPHr36aN7xJbc1yVgJUJjmCea5xCl4Hp6X3h%2BJMvUm25jbzi9ZXOFHHsp2lboLgXY1cM0b%2F1azWMaEgWLEXXbhIL36fC%2FQCQTk%2FvNnFZJLeye2LVbxBWVpyKxvC9ire1lxm0OrugnhhJle0lDFpl5O1cJwwORx2eUqwdmAJvWqh6SxBPyoxISKoIO6t4gRN%2BWMCHrwylBTsLvVKqwHdv2ulv88a3HHpOvTWuDlUb%2B0ADjnhAZ2jnVadSgX3r%2FQTaWVswD4rfRTPqdzmmHmIdC%2B%2BmOiUuMRL9qDXei4kxfeyODgkVJ4P9yEplsB2HfVM9cHU1ks4oq8bXIRb9j%2FqE%2FRsEFuQs%2FfQvBZXjEQK%2FnUiIHJ%2BZQcVTEPgsBPcewNjH85vc61WKd%2B3R6mbFuY4%2BJUdIt%2BaUjRohUP8P7R4Bh5WWA%2F%2B2odAn1fT5Xkn07XCWmoE5MBBTyFRXQBU6HImYDJ2Gk95xVn65jGrs5XbsKUjYEis1MQe4N59RjA%3D%3D" rel="nofollow">http://myweb.com/id=W5OAGejZ1HpuHri7BB1c%2BXHSYs2c47eyJFhpmroalPXZ5SUIgeUbqu7hJUVFVwPOA0xRI3ILJVHQ5QgBwtWpE1x0%2Fq10VVrmduMU5PiYguW1cXog4azzDvjcbb3%2BVpMDKe5QmvjLgJ9M4TXosTYR%2FOVzIPvXD%2BjeTEFtIM2g6siUcPBOeK5ubQh1QYB%2FCSbgnFsh2mpx3r%2FXBXI09I4q%2Be7hDSITcyIeYzFf1LoovBKotYcYSxhrZkbtIz2utl8PbpGa5G49EAwcKyossEo21dumTfkfJFoXUfmhH7amGcqbKUBOvtmhRwaMqrqoR6Vjd%2FKBCLrszpCRXX%2FdY6Kg0A7AUUNWdedizKCiDYdYL1IMUZ12od7HZNuHCruWPe43uhoxhjyhzx9oFl4rf6f8aM58b6KDtgiBbDwZNiICltUHq6htdzq2KwPRz8tl0WvZaaV3UC7vkfzfH%2FsRrv%2BB8MlsPrW6YfDOwupf0ax%2BJjc8oy%2BD%2BXv53swU5%2BS0dKQv94sgPNoQKG05oi4%2BO7M4gcw5Otp7O6qDFv5yhYnywJD8F6CXWUmHU9WoFRGoQnwdDwoMySYsiM4jCT9aq4s08%2Bx2m8EngPHr36aN7xJbc1yVgJUJjmCea5xCl4Hp6X3h%2BJMvUm25jbzi9ZXOFHHsp2lboLgXY1cM0b%2F1azWMaEgWLEXXbhIL36fC%2FQCQTk%2FvNnFZJLeye2LVbxBWVpyKxvC9ire1lxm0OrugnhhJle0lDFpl5O1cJwwORx2eUqwdmAJvWqh6SxBPyoxISKoIO6t4gRN%2BWMCHrwylBTsLvVKqwHdv2ulv88a3HHpOvTWuDlUb%2B0ADjnhAZ2jnVadSgX3r%2FQTaWVswD4rfRTPqdzmmHmIdC%2B%2BmOiUuMRL9qDXei4kxfeyODgkVJ4P9yEplsB2HfVM9cHU1ks4oq8bXIRb9j%2FqE%2FRsEFuQs%2FfQvBZXjEQK%2FnUiIHJ%2BZQcVTEPgsBPcewNjH85vc61WKd%2B3R6mbFuY4%2BJUdIt%2BaUjRohUP8P7R4Bh5WWA%2F%2B2odAn1fT5Xkn07XCWmoE5MBBTyFRXQBU6HImYDJ2Gk95xVn65jGrs5XbsKUjYEis1MQe4N59RjA%3D%3D</a>"</p> <p>I want to need decode the line behind the id "W5OAGejZ1HpuHri7BB.....9RjA%3D%3D". I think it encryption base 64. But when I decode it, it not true. If you know about it, please tell me more info it. Thank you..</p>
<php><encryption>
2016-01-06 11:23:53
LQ_CLOSE
34,632,845
Relative import error with py2exe
<p>I was trying to generate an executable for a simple Python script. My setup.py code looks like this:</p> <pre><code>from distutils.core import setup import py2exe setup(console=["script.py"]) </code></pre> <p>However, I am getting the error shown in the screenshot. Is there something I could try to fix this? I am using Windows 10.</p> <p><a href="https://i.stack.imgur.com/LDbbL.png"><img src="https://i.stack.imgur.com/LDbbL.png" alt="enter image description here"></a></p>
<python><py2exe><relative-import>
2016-01-06 12:11:00
HQ
34,632,959
Redirecting command output in docker
<p>I want to do some simple logging for my server which is a small Flask app running in a Docker container.</p> <p>Here is the Dockerfile</p> <pre><code># Dockerfile FROM dreen/flask MAINTAINER dreen WORKDIR /srv # Get source RUN mkdir -p /srv COPY perfektimprezy.tar.gz /srv/perfektimprezy.tar.gz RUN tar x -f perfektimprezy.tar.gz RUN rm perfektimprezy.tar.gz # Run server EXPOSE 80 CMD ["python", "index.py", "1&gt;server.log", "2&gt;server.log"] </code></pre> <p>As you can see on the last line I redirect stderr and stdout to a file. Now I run this container and shell into it</p> <pre><code>docker run -d -p 80:80 perfektimprezy docker exec -it "... id of container ..." bash </code></pre> <p>And observe the following things:</p> <p>The server is running and the website working</p> <p>There is no <code>/srv/server.log</code></p> <p><code>ps aux | grep python</code> yields:</p> <pre><code>root 1 1.6 3.2 54172 16240 ? Ss 13:43 0:00 python index.py 1&gt;server.log 2&gt;server.log root 12 1.9 3.3 130388 16740 ? Sl 13:43 0:00 /usr/bin/python index.py 1&gt;server.log 2&gt;server.log root 32 0.0 0.0 8860 388 ? R+ 13:43 0:00 grep --color=auto python </code></pre> <p>But there are no logs... HOWEVER, if I <code>docker attach</code> to the container I can see the app generating output in the console.</p> <p>How do I properly redirect stdout/err to a file when using Docker?</p>
<linux><bash><logging><docker><output>
2016-01-06 12:16:21
HQ
34,633,308
How to pass parameters to AWS Lambda function
<p>I know that it is possible to pass parameters to a Java program running on AWS Lambda in order to test it. But I do not know how to pass those parameters if this program gets called by a schedule event.</p> <p>Does anyone know if this is possible? If yes, how? I was not able to find anything about it.</p> <p>Thanks in advance</p>
<java><amazon-web-services><aws-lambda>
2016-01-06 12:35:37
HQ
34,633,805
Add Remote option not shown in PyCharm
<p>I am trying to set up a remote debugger with PyCharm on a Vagrant Machine. I am following <a href="https://www.jetbrains.com/pycharm/help/configuring-remote-interpreters-via-ssh.html">this</a> PyCharm tutorial. However, the Add Remote option is not available for me. Just Add local and Create VirtualEnv.</p> <p>Any idea why is this happening?</p>
<python><debugging><pycharm><remote-debugging>
2016-01-06 12:59:36
HQ
34,634,040
jQuery image scrolling, selecting and lightbox-like-fx
<p>I have a webpage in which I need to realize something that looks like the following sketch: <a href="https://i.stack.imgur.com/iZN5A.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iZN5A.jpg" alt="sketch"></a></p> <p>As you can see, there are basically two sections:</p> <ul> <li>a side-block (preferably) on the right that serves as image-thumbnails scroller;</li> <li>a contents-block on the left (in my draw) in which there are text parts and an image that is selected from the right side-scroller.</li> </ul> <p>Side scrolling may be achieved by a browser sidebar or (<em>very much</em> preferably better) by apposite up/down buttons. When clicking on a different image on the side-scroller that image get shown in place of the previous one. Last thing, clicking the image selected shall make it show in full-size (not larger than browser window anyway) with a lightbox-like-effect.</p> <p>Anyone know of a jQuery plugin that already provide all this?</p> <p>Thank you very much.</p>
<javascript><jquery><html><css><jquery-plugins>
2016-01-06 13:12:14
LQ_CLOSE
34,634,366
Android ActionBar Backbutton Default Padding
<p>I am creating a custom <code>ActionBar</code> using a <code>RelativeLayout</code> with an <code>ImageButton</code> to the left to <strong>replace</strong> it. I have downloaded the Back icon from google's website to use on the <code>ImageButton</code></p> <p>The problem is that I need to create a Back button to replace the original <code>ActionBar</code>'s Back Button, and I need it to be exactly identical to the original <code>ActionBar</code>'s back button.</p> <p><strong>I am wondering what is the system's default padding for the Back button image?</strong> </p>
<android><android-layout><android-actionbar><android-toolbar>
2016-01-06 13:30:18
HQ
34,634,637
How can I extract price of mobile phone from different ecommerce websites in php
<p>How can I extract price of <strong>mobile</strong> phone from different ecommerce websites in php tell me code</p>
<php><html><css>
2016-01-06 13:44:54
LQ_CLOSE
34,634,659
How to properly autostart an asp.net application in IIS10
<p>I'm trying to get my ASP.NET application to automatically start whenever the application pool is running.</p> <p>As per the lots and lots of references online I have already done the following:</p> <ul> <li>Set the Application Pool to <code>StartMode=AlwaysRunning</code></li> <li>Set the site in question (that belongs to beforementioned Pool) to <code>preloadEnabled=true</code></li> <li>Install the <code>Application Initialization</code> feature to the Windows installation</li> <li>Add the <code>&lt;applicationInitialization&gt;</code> node to the web.config's <code>&lt;system.webServer&gt;</code> node</li> </ul> <p>The web application is based on Owin and has a simple log4net logging statement in it's <code>Startup.Configuration()</code> method. Now when restarting IIS I see that the w3svc.exe process is running, so I know the <code>StartMode=AlwaysRunning</code> is working. There are however no logging messages in the log file.</p> <p>Navigating to any url (even a nonexisting one) in the application will start the app and add the log line.</p> <p>Because of the actual work that's done in the startup of the application I really want the application to truly preload, but I seem to be unable to get it done.</p> <p>Searching this site I have unfortunately not been able to find a solution. </p> <p>Thanks in advance.</p>
<asp.net><iis><autostart>
2016-01-06 13:45:43
HQ
34,635,269
How to pass @Input() params to an angular 2 component created with DynamicComponentLoader
<p>The DynamicContentLoader docs don't explain how I can properly load a child component's inputs. Let's say I have a child like:</p> <pre><code>@Component({ selector: 'child-component', template: '&lt;input type="text" [(ngModel)]="thing.Name" /&gt;' }) class ChildComponent { @Input() thing : any; } </code></pre> <p>and a parent like:</p> <pre><code>@Component({ selector: 'my-app', template: 'Parent (&lt;div #child&gt;&lt;/div&gt;)' }) class MyApp { thing : any; constructor(dcl: DynamicComponentLoader, elementRef: ElementRef) { dcl.loadIntoLocation(ChildComponent, elementRef, 'child'); } } </code></pre> <p>How should I go about passing <code>thing</code> into the child component such that the two components can be data bound against the same thing. </p> <p>I tried to do this:</p> <pre><code>@Component({ selector: 'my-app', template: 'Parent (&lt;div #child&gt;&lt;/div&gt;)' }) class MyApp { thing : any; constructor(dcl: DynamicComponentLoader, elementRef: ElementRef) { dcl.loadIntoLocation(ChildComponent, elementRef, 'child').then(ref =&gt; { ref.instance.thing = this.thing; }); } } </code></pre> <p>It sort of works, but they are not synchronised as you would expect. </p> <p>Basically I am trying to achieve the same thing that would have been achieved by using ng-include in angular 1 where the child is a dynamically determined component and shares the model with its parent. </p> <p>Thanks in advance ...</p>
<angular>
2016-01-06 14:15:15
HQ
34,635,588
How do I remove outline on link click?
<p>When I click a link on my website it is creating an outline around the link like so</p> <p><a href="https://i.stack.imgur.com/d7IrT.png" rel="noreferrer"><img src="https://i.stack.imgur.com/d7IrT.png" alt="enter image description here"></a></p> <p>I've tried adding:</p> <pre><code>a.image-link:focus { outline: 0; } </code></pre> <p>and</p> <pre><code>a {outline : none;} </code></pre> <p>But nothing seems to get rid of it. Is there a way to remove it?</p>
<html><css><hyperlink><outline>
2016-01-06 14:31:38
HQ
34,636,001
iOS - How to ignore the duplicates in NSMutableArray.
<p>For example I have an array = [12,13,13,13,14,15,16,16,17];</p> <p>and my output will be 12,13,14,15,16,17.</p> <p>Please help me on this.</p>
<ios>
2016-01-06 14:50:48
LQ_CLOSE
34,636,191
unable to pass the context to the another class in android
[enter image description here][1]ServiceCalls serviceCalls = new ServiceCalls(this, "ks"); serviceCalls.execute(requestParams); [1]: http://i.stack.imgur.com/DTjw1.png Note:pls check the image.I am not good at english.thanks in advance
<android>
2016-01-06 14:59:39
LQ_EDIT
34,636,423
syntax error, unexpected end of file in ... on line 31
<p>I didn't have any code here on line 31 in this code so what do you think what's the problem here? :)</p> <pre><code>&lt;?php require('config.php'); if(isset($_POST['submit'])) { $uname = mysqli_real_escape_string($con, $_POST['uname']); $pass = mysqli_real_escape_string($con, $_POST['pass']); $sql = mysqli_query($con, "SELECT * FROM users WHERE uname = '$uname' AND pass = '$pass'"); if (mysqli_num_rows($sql) &gt; 0) { echo "You are now logged in."; exit(); } } else { $form = &lt;&lt;&lt;EOT &lt;form action="login.php" method="POST"&gt; Username: &lt;input type="text" name="uname" /&gt;&lt;/br&gt; Password: &lt;input type="password" name="pass" /&gt;&lt;/br&gt; &lt;input type="submit" name="submit" value="Log in" /&gt; &lt;/form&gt; EOT; echo $form; } ?&gt; </code></pre> <p>I think that all my brackets are fine :D</p>
<php><mysqli>
2016-01-06 15:11:18
LQ_CLOSE
34,636,644
Creating a Program to pick out random strings from an array
<p>So, i wanted to create a program that picks out simple strings from an array, it sounded pretty simple to me but then i ran into problems. Here's what i wrote:</p> <pre><code>int pickjob; string jobs[] = {Police Officer, Fireman, Vet, Doctor, Nurse, Chemist, Waiter}; job1 = jobs[rand()%7]; job2 = jobs[rand()%7]; job3 = jobs[rand()%7]; cout &lt;&lt; "Here i found some jobs for you, check them out\n1." &lt;&lt; job1 &lt;&lt; "\n2." &lt;&lt; job2 &lt;&lt; "\n3." &lt;&lt; job3 &lt;&lt; "\nGo Head and pick one out" &lt;&lt; endl; cin &gt;&gt; pickjob; //Rest of code is below, i'll put it in if you need it ;) </code></pre> <p>But my problem was that everytime i ran the program the same jobs appeared everytime (Im a amaetur at C++, so if i sound stupid forgive me), so how do i make a program where it prints out diffrent jobs every time from the array.</p>
<c++><arrays>
2016-01-06 15:21:10
LQ_CLOSE
34,637,034
Curl -u equivalent in HTTP request
<p>I've been trying to plug into the Toggl API for a project, and their examples are all using CURL. I'm trying to use the C# wrapper which causes a bad request when trying to create a report, so I thought I'd use Postman to try a simple HTTP request.</p> <p>I can't seem to get the HTTP request to accept my API Token though. Here's the example that they give (CURL):</p> <pre><code>curl -u my-secret-toggl-api-token:api_token -X GET "https://www.toggl.com/reports/api/v2/project/?page=1&amp;user_agent=devteam@example.com&amp;workspace_id=1&amp;project_id=2" </code></pre> <p>I've tried the following HTTP request with Postman with a header called api_token with my token as the value:</p> <pre><code>https://www.toggl.com/reports/api/v2/project/?user_agent=MYEMAIL@EMAIL.COM&amp;project_id=9001&amp;workspace_id=9001 </code></pre> <p>(changed ids and email of course).</p> <p>Any help on how to use the CURL -u in HTTP would be appreciated, thanks.</p>
<http><curl>
2016-01-06 15:41:27
HQ
34,637,035
Are global static variables within a file comparable to a local static variable within a function?
<p>I know declaring a global variable as STATIC will make it visible to the current file. Does the variable retain its data every time functions are called within the file?</p> <p>For example,</p> <p>Let's say some file calls func1() below, which modifies the static global variable data and then calls func2() which modifies it again.</p> <p>The next time a file calls func1(), will it be modifying a new data variable struct? or will it preserve the previous data that was modified in the first call?</p> <pre><code>STATIC MY_DATA Data1; void func1( ){ //modify Data1 func2(Data1); } void func2 (MY_DATA data){ // modify data } </code></pre>
<c><variables><static><global>
2016-01-06 15:41:29
LQ_CLOSE
34,637,162
I wants to add images in repeatbox
i m new in smartface.io software.I wants to add images in repeatbox, can someone help me to add images in repeatbox. Thanks
<image><smartface.io>
2016-01-06 15:48:48
LQ_EDIT
34,637,657
It's possible ignore child dependency in Composer config?
<p>When I run composer install, it will install all my "require" and the "require" of the other package.</p> <p>My composer.json</p> <pre><code>{ "name": "my_app", "require": { "some/package": "0.0.0" } } </code></pre> <p>The "child" dependency</p> <pre><code>{ "name": "some/package", "require": { "zendframework/zend-mail": "2.4.*@dev", "soundasleep/html2text": "~0.2", "mpdf/mpdf": "6.0.0", "endroid/qrcode": "1.*@dev" } } </code></pre> <p>I know that it's possible ignore the php extensions, but what about these second require package?</p>
<composer-php>
2016-01-06 16:13:26
HQ
34,637,896
gitk will not start on Mac: unknown color name "lime"
<p>I've installed git on a mac via <code>brew install git</code>. When I try to start gitk I get the following error:</p> <pre><code>Error in startup script: unknown color name "lime" (processing "-fore" option) invoked from within "$ctext tag conf m2 -fore [lindex $mergecolors 2]" (procedure "makewindow" line 347) invoked from within "makewindow" (file "/usr/local/bin/gitk" line 12434) </code></pre> <p>It appears that my Mac doesn't have a color named <code>lime</code>. </p> <p>Can I add a lime color to the environment, or is there a better fix? </p> <p>The git version is 2.7.0, and the Mac is running Yosemite 10.10.5</p>
<gitk>
2016-01-06 16:27:12
HQ
34,638,462
Using git with ssh-agent on Windows
<p>I'm on Windows. I installed git and posh-git (some helpers for Windows PowerShell). I can add keys with <code>ssh-add</code> and can authenticate with github and my webserver. I can also use git from the PowerShell to interact with my repositories.</p> <p>But there is one thing I can't do: I use git-plus for the Atom editor. And I don't get it to push to my repo. What is my problem?</p>
<git><powershell><ssh><atom-editor><ssh-agent>
2016-01-06 16:55:24
HQ
34,638,895
iOS app rejected due to copyright issues
<p>an app I have been working on got rejected by Apple, here is the message I got from Apple when it got rejected:</p> <p>From Apple 22.2 - Apps that contain false, fraudulent or misleading representations or use names or icons similar to other Apps will be rejected </p> <p>22.2 Details Your app or its metadata contains misleading content.</p> <p>Specifically, the app screenshots and splash screen are from a well known TV show belonging to Keshet without the rights to use it.</p> <p>We’ve attached screenshot for your reference.</p> <p>Next Steps</p> <p>Please remove or revise any misleading content in your app and its metadata.</p> <p>Since your iTunes Connect Application State is Rejected, a new binary will be required. Make the desired metadata changes when you upload the new binary.</p> <p>NOTE: Please be sure to make any metadata changes to all App Localizations by selecting each specific localization and making appropriate changes.*</p> <p>some background, I did develop this app for Keshet with permission, but I did not include any kind of permission from Keshet when submitting. Yes, my bad, I just didn't know it was required.</p> <p>Anyway, my question is, would replying to Apple through the resolution center and including a document from Keshet's legel dept. be enough to resolve this issue? or do I need to go through the whole process again, submitting a new binary etc.? or perhaps something else?</p> <p>Also, does this kind of rejection means that every other aspect of the game I submitted is okay? because they only reacted to the rights to use Keshet's properties.</p>
<ios>
2016-01-06 17:18:38
LQ_CLOSE
34,640,598
grab all observations from a data set that are present in a second data set based on a linker ID using %in% function R
<p>So, say I have two data sets: </p> <pre><code>d1&lt;- data.frame(seq(1:10),rnorm(10)) colnames(d1) &lt;- c('id','x1') d2&lt;- data.frame(seq(3:7),rnorm(5)) colnames(d2) &lt;- c('id','x2') </code></pre> <p>Now, say I want a new dataset, <code>d3</code>, that is the data from <code>d1</code> with values of <code>id</code> that are also present in <code>d2</code>. I'd like to use a really simple function, something like:</p> <pre><code>d3 &lt;- d1[id %in% d2$id] </code></pre> <p>Except this is printing an error for me. What is a simple one liner to accomplish this?</p>
<r>
2016-01-06 18:53:54
LQ_CLOSE
34,641,003
Error checking TLS connection: Error checking and/or regenerating the certs
<p>After I restarted my windows i cannot connect to docker machine running in Oracle Virtual Box. When i start Docker QuickStart Terminal every thing looks fine, it's coming up OK and it gives me this message:</p> <pre><code>docker is configured to use the default machine with IP 192.168.99.100 For help getting started, check out the docs at https://docs.docker.com </code></pre> <p>but when i do:</p> <pre><code>$ docker-machine ls NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS default - virtualbox Timeout </code></pre> <p>and:</p> <pre><code>λ docker images An error occurred trying to connect: Get http://localhost:2375/v1.21/images/json: dial tcp 127.0.0.1:2375: ConnectEx tcp: No connection could be made because the target machine actively refused it. </code></pre> <p>also when i try to reinitialize my env., i get:</p> <pre><code>λ docker-machine env default Error checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates for host "192.168.99.100:2376": dial tcp 192.168.99.100:2376: i/o timeout You can attempt to regenerate them using 'docker-machine regenerate-certs [name]'. Be advised that this will trigger a Docker daemon restart which will stop running containers. </code></pre> <p>BTW, Regenerating certs also not helping. Any idea?</p> <p>Thanks.</p>
<docker><docker-machine>
2016-01-06 19:17:00
HQ
34,641,032
syntax error, unexpected (T_IF)
<p>Parse error: syntax error, unexpected 'if' (T_IF) on line 4</p> <p>I really don't know what is wrong with my code or why this is happening because I am new to PHP.</p> <p>Line 4 is: if($passcheck == $mypass){</p> <pre><code> &lt;?php $mypass="DaPigeon123"; $passcheck=$_POST["password"] if($passcheck == $mypass){ echo "Welcome," .$_POST["username"]. "! You are now logged in.&lt;br/&gt;"; { else echo "Sorry, wrong password. &lt;br/&gt;"; ?&gt; </code></pre>
<php><if-statement><syntax>
2016-01-06 19:19:17
LQ_CLOSE
34,641,659
Generic composable Ecto query w/ dynamic field name in query expression
<p>I'm trying to allow for passing in a field name and running it in an Ecto query expression dynamically, like so:</p> <pre><code>def count_distinct(query, field_name) when is_binary(field_name) do query |&gt; select([x], count(Map.fetch!(x, field_name), :distinct)) end </code></pre> <p>However, I get this compilation error:</p> <pre><code>(Ecto.Query.CompileError) `Map.fetch!(x, field_name)` is not a valid query expression </code></pre> <p>Is there any way to accomplish this?</p>
<elixir><ecto>
2016-01-06 19:56:23
HQ
34,642,165
This application's bundle identifier does not match its code signing identifier
<p>When I try to build and run the app on the device I get following error <code>App installation failed: This application's bundle identifier does not match its code signing identifier.</code></p> <p>I checked the signing certificates, bundle ids, provision profile, entitlements and everything is correct. </p> <p><a href="https://i.stack.imgur.com/ZnQ6P.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ZnQ6P.png" alt="Error message"></a></p> <p>Any Ideas ?</p>
<xcode><swift><ios9><code-signing>
2016-01-06 20:29:08
HQ
34,642,506
What is the '1995-12-17T03:24:00' for of a datetime called?
<p>I'm trying to to create a method that returns a random date in that format in the from today to a year ago. So right now I have</p> <pre><code>var curDate = new Date(), oneYearAgo = curDate-365*24*60*60*1000, randDate = new Date(Math.random() * (CurDate - OneYearAgo) + OneYearAgo); </code></pre> <p>But now how do I convert that to a string like in the title? I'm looking through <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date" rel="nofollow">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date</a> and can't figure it out because I don't know what the name of that format is. </p>
<javascript><algorithm><datetime>
2016-01-06 20:50:13
LQ_CLOSE
34,642,947
How to use Domain Transform Edge-Preserving technique for Image Enhancement in Matlab
I am interested in using this Domain Transform Edge-Preserving Video filtering technique (http://inf.ufrgs.br/~eslgastal/DomainTransform/ - source code available there) for image enhancement in Matlab (2015a). At around 3:12 on a 5-minute video (on the site linked above), they perform detail enhancement. I'm not sure how to use the filtered image to sharpen/deblur my original image. I usually use: H = padarray(2,[2 2]) - fspecial('gaussian' ,[5 5],2); sharpened = imfilter(I,H); to sharpen images, but I can't use imfilter with the filtered image from the edge-preserving technique (I've been testing with the normalized convolution filter from the source code) that I'm interested in. Can anyone advise me on what I can do to make use of this filtered image for sharpening/deblurring? Providing a snippet of code would be appreciated as well if possible.
<matlab><filter><dns><transform><edge-detection>
2016-01-06 21:17:56
LQ_EDIT
34,643,800
How to build a release version of an iOS framework in Xcode?
<p>Let's say I do the following:</p> <ol> <li>Open Xcode 7</li> <li>File | New | Project | Cocoa Touch Framework</li> <li>Create "TestFramework" with the Swift language</li> <li>Create a file Hello.swift with public func hello() { print("Hello") }.</li> </ol> <p>From here, I can build a debug build of the framework (inside the Debug-iphoneos folder), but I cannot figure out how to build the release version of the framework (inside Release-iphoneos). I thought Archive might do it, but it doesn't. Pointers please?</p>
<ios><xcode><frameworks><release>
2016-01-06 22:11:17
HQ
34,644,113
Msg 201, Procedure stp_DespatchedJob, Line 0 Procedure or Function 'stp_DespatchedJob' expects parameter '@jobId', which was not supplied
USE [taxi] GO DECLARE @return_value int EXEC @return_value = [dbo].[stp_DespatchedJob] @JobStatusId = NULL SELECT 'Return Value' = @return_value GO
<sql><sql-server>
2016-01-06 22:31:13
LQ_EDIT
34,644,117
Golang struct inheritance not working as intended?
<p>Check out <a href="https://play.golang.org/p/elIHgHAZjT" rel="noreferrer" title="this sandbox">this sandbox</a></p> <p>When declaring a struct that inherits from a different struct:</p> <pre><code>type Base struct { a string b string } type Something struct { Base c string } </code></pre> <p>Then calling functions specifying values for the inherited values gives a compilation error:</p> <pre><code>f(Something{ a: "letter a", c: "letter c", }) </code></pre> <p>The error message is: <code>unknown Something field 'a' in struct literal</code>.</p> <p>This seems highly weird to me. Is this really the intended functionality?</p> <p>Thanks for the help!</p>
<go>
2016-01-06 22:31:35
HQ
34,644,264
Where are the additional command line options in Android Studio version 1.5.1 for the emulator
<p>After the latest update to AS, the emulator's additional command line options are missing. I use this primarily for -http-proxy and -scale commands. Any help in locating these options, or it's replacement, would be appreciated.</p>
<android><android-studio><command-line><android-emulator><http-proxy>
2016-01-06 22:43:38
HQ
34,645,131
How do I run PhantomJS on AWS Lambda with NodeJS
<p><em>After not finding a working answer anywhere else on the internet, I am submitting this ask-and-answer-myself tutorial</em></p> <p>How can I get a simple <code>PhantomJS</code> process running from a <code>NodeJS</code> script on <code>AWS Lambda</code>? My code works fine on my local machine, but I run into different problems trying to run it on Lambda.</p>
<node.js><amazon-web-services><phantomjs><aws-lambda>
2016-01-06 23:59:08
HQ
34,645,274
EF query to Oracle throwing "ORA-12704: character set mismatch"
<p>I'm trying to combine a few columns in EF from Oracle then do a <code>.Contains()</code> over the columns like this:</p> <pre><code>public IEnumerable&lt;User&gt; SearchUsers(string search) { search = search.ToLower(); return _securityUow.Users .Where(u =&gt; (u.FirstName.ToLower() + " " + u.LastName.ToLower() + " (" + u.NetId.ToLower() + ")").Contains(search)) .OrderBy(u =&gt; u.LastName) .ThenBy(u =&gt; u.FirstName) .AsEnumerable(); } </code></pre> <p>However, I'm getting this exception:</p> <pre><code>{ "Message": "An error has occurred.", "ExceptionMessage": "An error occurred while executing the command definition. See the inner exception for details.", "ExceptionType": "System.Data.Entity.Core.EntityCommandExecutionException", "StackTrace": " at SoftwareRegistration.WebUI.Controllers.Api.V1.UserContactController.Lookup(String search) in C:\LocalRepository\OnlineSupport\SoftwareRegistration\trunk\release\SoftwareRegistration\SoftwareRegistration.WebUI\Controllers\Api\V1\UserContactController.cs:line 40\r\n at lambda_method(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.&lt;&gt;c__DisplayClass10.&lt;GetExecutor&gt;b__9(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.&lt;InvokeActionAsyncCore&gt;d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at System.Web.Http.Controllers.ActionFilterResult.&lt;ExecuteAsync&gt;d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.&lt;SendAsync&gt;d__1.MoveNext()", "InnerException": { "Message": "An error has occurred.", "ExceptionMessage": "ORA-12704: character set mismatch", "ExceptionType": "Oracle.ManagedDataAccess.Client.OracleException", "StackTrace": " at OracleInternal.ServiceObjects.OracleCommandImpl.VerifyExecution(OracleConnectionImpl connectionImpl, Int32&amp; cursorId, Boolean bThrowArrayBindRelatedErrors, OracleException&amp; exceptionForArrayBindDML, Boolean&amp; hasMoreRowsInDB, Boolean bFirstIterationDone)\r\n at OracleInternal.ServiceObjects.OracleCommandImpl.ExecuteReader(String commandText, OracleParameterCollection paramColl, CommandType commandType, OracleConnectionImpl connectionImpl, OracleDataReaderImpl&amp; rdrImpl, Int32 longFetchSize, Int64 clientInitialLOBFS, OracleDependencyImpl orclDependencyImpl, Int64[] scnForExecution, Int64[]&amp; scnFromExecution, OracleParameterCollection&amp; bindByPositionParamColl, Boolean&amp; bBindParamPresent, Int64&amp; internalInitialLOBFS, OracleException&amp; exceptionForArrayBindDML, Boolean isDescribeOnly, Boolean isFromEF)\r\n at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteReader(Boolean requery, Boolean fillRequest, CommandBehavior behavior)\r\n at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteDbDataReader(CommandBehavior behavior)\r\n at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)\r\n at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.&lt;Reader&gt;b__c(DbCommand t, DbCommandInterceptionContext`1 c)\r\n at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)\r\n at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)\r\n at System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavior behavior)\r\n at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)\r\n at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)" } } </code></pre> <p>The columns I'm querying are all of type VARCHAR2(128) in Oracle.</p> <p>I'm also using this exact same code in another project and it works. The only difference is that for the project that works I'm using <code>Oracle.DataAccess</code> and for the one that doesn't work, I'm using <code>Oracle.ManagedDataAccess</code> (I am unable to use <code>Oracle.DataAccess</code> for this project). So I believe there is a bug/problem in the managed driver.</p> <p>I'm open to solutions or workarounds.</p>
<c#><.net><oracle><entity-framework>
2016-01-07 00:15:12
HQ
34,645,315
How to apply css class to a component element when it's created by router-outlet?
<p>I have DOM that looks something like this:</p> <pre><code>&lt;app&gt; &lt;router-outlet&gt;&lt;/router-outlet&gt; &lt;project&gt;...&lt;/project&gt; &lt;/app&gt; </code></pre> <p>where <code>project</code> element is inserted by the router.</p> <p>How do I add a class to this element?</p>
<angular><angular2-routing>
2016-01-07 00:19:16
HQ
34,645,537
Android Espresso not working with Multidex gives "No tests found"
<p>My Espresso tests were running until I had to support multidex.</p> <p>My build.gradle, I have</p> <pre><code>minSdkVersion 14 targetSdkVersion 23 multiDexEnabled = true testInstrumentationRunner "com.android.test.runner.MultiDexTestRunner" androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1' androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2.1' androidTestCompile 'com.android.support.test:runner:0.4.1' androidTestCompile 'com.android.support.test:rules:0.4.1' dexOptions { jumboMode true javaMaxHeapSize "4g" incremental true } </code></pre> <h2>Test1AuthenticationEspressoTest</h2> <pre><code>@RunWith(AndroidJUnit4.class) @SmallTest public class Test1AuthenticationEspressoTest { @Rule public ActivityTestRule&lt;WelcomeActivity&gt; mActivityRule = new ActivityTestRule(WelcomeActivity.class); } </code></pre> <p>Here is the Error I get</p> <blockquote> <p>junit.framework.AssertionFailedError: No tests found in com.livestrong.tracker.test.Test1AuthenticationEspressoTest</p> </blockquote> <p>Any help will be appreciated. Any one has espresso working with multidex ?</p>
<android><android-espresso><android-multidex>
2016-01-07 00:45:22
HQ
34,645,731
Export more than one variable in ES6?
<p>I'm trying to export more than one variable in ES6:</p> <p>exports.js</p> <pre><code>var TestObject = Parse.Object.extend('TestObject') var Post = Parse.Object.extend('Post') export default TestObject export Post </code></pre> <p>main.js:</p> <pre><code>import TestObject from '../store' import Post from '../store' var testObject = new TestObject() // use Post in the same way testObject.save(json).then(object =&gt; { console.log('yay! it worked', object) }) </code></pre> <p>I understand that there's only one default value so I only used <code>default</code> in the first item.</p> <p>However, I get this error message:</p> <pre><code>Module build failed: SyntaxError: /home/alex/node/my-project/src/store/index.js: Unexpected token (9:7) 7 | 8 | export default TestObject &gt; 9 | export Post </code></pre> <p>Maybe I'm doing it the wrong way?</p>
<javascript><ecmascript-6><vue.js>
2016-01-07 01:08:18
HQ
34,646,007
Only allow form submit of pdf/images not ever blank
<p>Hi I have a website which the page logic should only accept submit under two conditions:</p> <p>1) if the captcha is actively checked</p> <p>and </p> <p>2) if at least one file is attached (only pdf and image file types are allowed up to three total) are attached. </p> <p>the issue is that we are receiving blank applications however, I am seeing a scenario where you can attach non pdfs/images with a pdf/image and still submit which strips all attachments.</p> <p>proper behavior should be: prevent submit if non pdf/image type attached show error message "Only image or pdf can be uploaded" and then a message stating this and preventing form submit at the bottom of the page in red just like the other errors.</p> <p>Be polite. Thanks. :-)</p> <p>Page URL: <a href="http://www.barona.com/about-barona/community-relations/community-giving-guidelines/" rel="nofollow">http://www.barona.com/about-barona/community-relations/community-giving-guidelines/</a></p> <p>PHP (to test replace youremail with your email address, thanks!):</p> <pre><code>&lt;?php ini_set('display_errors', 'off'); $to = 'youremail@gmail.com'; $from = 'youremail@gmail.com'; $subject = 'New Application'; $allowed_extensions = array( '.pdf', '.jpeg', '.jpg', '.png', '.gif', '.bmp' ); $file1 = ''; $file2 = ''; $file3 = ''; $filename1 = ''; $filename2 = ''; $filename3 = ''; //echo "1"; if (!empty($_FILES['file1']['name'])) { //echo "File 1 exists"; $filename1 = $_FILES['file1']['name']; $extension = '.' . strtolower(array_pop(explode('.', $filename1))); $size1 = $_FILES['file1']['size']; $mime1 = $_FILES['file1']['type']; $tmp1 = $_FILES['file1']['tmp_name']; if (in_array($extension, $allowed_extensions)) { $file1 = fopen($tmp1, 'rb'); $data1 = fread($file1, filesize($tmp1)); // Now read the file content into a variable fclose($file1); // close the file $data1 = chunk_split(base64_encode($data1)); // Now we need to encode it and split it into acceptable length lines $file1 = $filename1; } else { $filename1 = ''; } } //file 2: if (!empty($_FILES['file2']['name'])) { //echo "File 2 exists"; $filename2 = $_FILES['file2']['name']; $extension = '.' . strtolower(array_pop(explode('.', $filename2))); $tmp2 = $_FILES['file2']['tmp_name']; $size2 = $_FILES['file2']['size']; $mime2 = $_FILES['file2']['type']; if (in_array($extension, $allowed_extensions)) { $file2 = fopen($tmp2, 'rb'); $data2 = fread($file2, filesize($tmp2)); // Now read the file content into a variable fclose($file2); // close the file $data2 = chunk_split(base64_encode($data2)); // Now we need to encode it and split it into acceptable length lines $file2 = $filename2; } else { $filename2 = ''; } } //File 3: if (!empty($_FILES['file3']['name'])) { //echo "File 3 exists"; $filename3 = $_FILES['file3']['name']; $extension = '.' . strtolower(array_pop(explode('.', $filename3))); $tmp3 = $_FILES['file3']['tmp_name']; $size3 = $_FILES['file3']['size']; $mime3 = $_FILES['file3']['type']; if (in_array($extension, $allowed_extensions)) { $file3 = fopen($tmp3, 'rb'); $data3 = fread($file3, filesize($tmp3)); // Now read the file content into a variable fclose($file3); // close the file $data3 = chunk_split(base64_encode($data3)); // Now we need to encode it and split it into acceptable length lines $file3 = $filename3; } else { $filename3 = ''; } } //echo "2"; //Only allow image or pdf. $message = "&lt;table border='1' style='width:80%'&gt;&lt;tr&gt;&lt;td&gt;File 1: &lt;/td&gt;&lt;td&gt;$filename1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;File 2: &lt;/td&gt;&lt;td&gt;$filename2&lt;td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;File 3: &lt;/td&gt;&lt;td&gt;$filename3&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;"; // email fields: to, from, subject, and so on $headers = "From: $from\n"; $headers .= "Reply-To: $to\n"; $headers .= "BCC: cpeterson@barona.com"; // boundary $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; // headers for attachment $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed, html;\n" . " boundary=\"{$mime_boundary}\""; // multipart boundary $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/html; charset=ISO-8859-1\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n"; $message .= "--{$mime_boundary}\n"; if (!empty($file1)) { $message .= "Content-Type: {\"application/octet-stream\"};\n" . " name='$filename1'\n" . "Content-Disposition: attachment;\n" . " filename=$filename1\n" . "Content-Transfer-Encoding: base64\n\n" . $data1 . "\n\n"; $message .= "--{$mime_boundary}\n"; } if (!empty($file2)) { $message .= "Content-Type: {\"application/octet-stream\"};\n" . " name='$filename2'\n" . "Content-Disposition: attachment;\n" . " filename=$filename2\n" . "Content-Transfer-Encoding: base64\n\n" . $data2 . "\n\n"; $message .= "--{$mime_boundary}\n"; } if (!empty($file3)) { $message .= "Content-Type: {\"application/octet-stream\"};\n" . " name='$filename3'\n" . "Content-Disposition: attachment;\n" . " filename=$filename3\n" . "Content-Transfer-Encoding: base64\n\n" . $data3 . "\n\n"; $message .= "--{$mime_boundary}\n"; } // send $ok = @mail($to, $subject, $message, $headers, '-fnoreply@yourmailer.com'); if ($ok) { //echo "&lt;p&gt;Thank you for submitting your application to: $to!&lt;/p&gt;"; header("Location: ../../../about-barona/community-relations/community-giving-guidelines/thanks/"); /* Redirect browser */ exit(); } else { //echo "&lt;p&gt;mail could not be sent!&lt;/p&gt;"; header("Location: ../../../club-barona/email-signup/error/"); /* Redirect browser */ exit(); } ?&gt; </code></pre> <p>Wordpress HTML:</p> <pre><code>&lt;h2&gt;COMMUNITY GIVING GUIDELINES &amp; DONATION APPLICATION&lt;/h2&gt;&lt;p&gt;In an effort to better serve you, Barona will only review requests via an online donation application. To be considered for a donation or sponsorship, you must complete the online application. Requests submitted via email, mail, phone, or fax will not be accepted. All requests will be screened and reviewed for consideration by the Community Relations Committee. In making determinations on contribution requests, the Committee places emphasis on well-managed non-profit organizations and programs. Funding decisions are also based on the quality of the organizations programs and their support of Barona Resort &amp; Casino’s key areas of focus. Additional consideration includes the scope of each program and the overall impact on the community. Barona maintains the flexibility to accommodate new and innovative approaches to meeting the needs of the community.&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Due to the volume of requests received, donation requests for auction and raffle items must be submitted at least 60 – 90 days prior to the date the donation is needed.&lt;/li&gt;&lt;li&gt;Sponsorship requests should be submitted by October for consideration in the following year, as planning is based on a calendar year.&lt;/li&gt;&lt;li&gt;Sponsorships exceeding $10,000 must include performance measurement criteria and the requestor must be prepared to submit a report of achievement.&lt;/li&gt;&lt;li&gt;We will respond to all requests with the decision of the committee, regardless of the outcome within 6 - 8 weeks of review.&lt;/li&gt;&lt;/ul&gt; &lt;h3&gt;We generally &lt;b&gt; exclude &lt;/b&gt; requests that benefit:&lt;/h3&gt; &lt;ul&gt; &lt;li&gt;Local sports organizations &lt;/li&gt; &lt;li&gt;An individual person or family &lt;/li&gt; &lt;li&gt;General operating expenses &lt;/li&gt; &lt;li&gt;Political candidates or organizations &lt;/li&gt; &lt;li&gt;Film or documentary productions &lt;/li&gt; &lt;li&gt;Memorials, endowments, or grants &lt;/li&gt; &lt;li&gt;Organizations outside of California &lt;/li&gt; &lt;li&gt;Travel expenses &lt;/li&gt; &lt;li&gt;Groups seeking educational or travel grants for contests, pageants, trips or conventions &lt;/li&gt; &lt;li&gt;Loan or loan guarantees &lt;/li&gt; &lt;li&gt;Capital improvement or building funds &lt;/li&gt; &lt;/ul&gt; &lt;p&gt;&lt;input id="chkTerms" name="chkTerms" onclick="validate();" required="required" type="checkbox" value="0"&gt; I have read and understand the Community Giving Guidelines. Thank you for contacting Barona Resort &amp;amp; Casino regarding a contribution towards your organization. Please note that this online application must be completed in its entirety and, if necessary, submitted with all appropriate supporting documents.&lt;/p&gt;&lt;form action="../../../wp-content/themes/barona/form-to-email.php" enctype="multipart/form-data" method="post"&gt; &lt;div id="DonationApplicationFormContent" style="width: 700px; margin: 10px -150px !important; display: none;"&gt; &lt;hr /&gt; &lt;h2&gt;Instructions &lt;/h2&gt; &lt;p&gt;Follow the directions below to submit your &lt;strong&gt;&lt;a href="/wp-content/uploads/2015/10/DonationApplicationForm.pdf" target="_blank"&gt;Donation Application Form&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt; &lt;iframe width="560" height="315" src="https://www.youtube.com/embed/G-SDuvlur8o" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt; &lt;h3 style="margin: 0;"&gt;Step 1&lt;/h3&gt; &lt;p&gt;Download the Donation Application Form PDF.&lt;br /&gt;&lt;small&gt;Note: Safari users, right click the "Download Now" button and select "Download Linked File As".&lt;/small&gt;&lt;br /&gt;&lt;br /&gt;[easy_media_download url="/wp-content/uploads/2015/10/DonationApplicationForm.pdf" force_dl="1"]&lt;/p&gt; &lt;h3 style="margin: 0;"&gt;Step 2&lt;/h3&gt; &lt;strong&gt;Print&lt;/strong&gt; or &lt;strong&gt;complete&lt;/strong&gt; the form using &lt;strong&gt;&lt;a href="https://get.adobe.com/reader" target="_blank"&gt;Adobe Acrobat Reader&lt;/a&gt;&lt;/strong&gt;. You can download Adobe Acrobat for free at &lt;a href="https://get.adobe.com/reader" target="_blank"&gt;https://get.adobe.com/reader&lt;/a&gt; &lt;/p&gt; &lt;h3 style="margin: 0;"&gt;Step 3&lt;/h3&gt; Click &lt;strong&gt;Browse&lt;/strong&gt; to upload the completed &lt;strong&gt;Donation Application Form&lt;/strong&gt; along with any supporting documents (images or PDF). &lt;/p&gt; &lt;h3 style="margin: 0;"&gt;Step 4&lt;/h3&gt; &lt;p&gt;Click the &lt;strong&gt;Submit&lt;/strong&gt; button below to complete your submission. &lt;br /&gt; &lt;br /&gt; OR &lt;br /&gt;&lt;br /&gt; Email your completed PDF document with any supporting documents to &lt;a href="mailto: donationapplicationsbarona@gmail.com"&gt;donationapplicationsbarona@gmail.com&lt;/a&gt;. &lt;/p&gt; Upload event brochures, marketing materials or other documents. Upload images or PDF files only. (Limit: 5MB max per file): &lt;table&gt; &lt;tr style="height: 30px;"&gt; &lt;td&gt;File 1:&lt;input type="file" id="file1" name="file1"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr style="height: 30px;"&gt; &lt;td&gt;File 2:&lt;input type="file" id="file2" name="file2"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr style="height: 30px;"&gt; &lt;td&gt;File 3: &lt;input type="file" id="file3" name="file3"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;table&gt; &lt;tr &gt; &lt;td&gt; &lt;div class="g-recaptcha" id="rcaptcha" data-sitekey="6Let2wwTAAAAAJaUZQGTCRy6Pv4YYLoQjsLUH6hs"&gt;&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;div id="captcha" aria-live="assertive"&gt;&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr style="height: 80px;"&gt; &lt;td&gt;&lt;input tabindex="11" title="Submit" type="submit" value="Submit" onclick="return get_action(this);"&gt;&lt;input tabindex="12" title="Reset" type="reset" value="Reset"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;label id="lblStatus"&gt;*Required.&lt;/label&gt;&lt;/div&gt; &lt;/form&gt; </code></pre> <p>Page source:</p> <p>see page. :-)</p> <p>Please help fix it so no blank applications can be received. as well as only pdf/images allowed before submit. willing to install a js file. please be as thorough and I will select you as top vote/winner. be good my coder friends! Long live privacy!</p>
<javascript><php><html><wordpress>
2016-01-07 01:40:09
LQ_CLOSE
34,646,021
RestFuse vs Rest Assured vs MockMVC Rest Service Unit Test Framework
<p>I've been trying to find a simple all purpose unit test framework for Spring MVC based Rest Services I've written.</p> <p>I've been searching online and narrowed it down to:</p> <ul> <li>RestFuse (<a href="http://developer.eclipsesource.com/restfuse/" rel="noreferrer">http://developer.eclipsesource.com/restfuse/</a>)</li> <li>Rest Assured (<a href="https://github.com/jayway/rest-assured" rel="noreferrer">https://github.com/jayway/rest-assured</a>)</li> <li>MockMVC (<a href="http://www.petrikainulainen.net/programming/spring-framework/unit-testing-of-spring-mvc-controllers-rest-api/" rel="noreferrer">http://www.petrikainulainen.net/programming/spring-framework/unit-testing-of-spring-mvc-controllers-rest-api/</a>)</li> </ul> <p>I like RestFuse because it's mostly annotation based, but rest assured seems to have a easier way of passing parameters and checking responses. And finally being a Spring MVC Rest Service project, I'm wondering if I should just stick with the already established way of testing Rest Services in Spring with MockMVC.</p> <p>Interested to get any feedback, as well as performance, past experiences and if there's anything else I should take into consideration.</p>
<rest><spring-mvc><rest-assured><mockmvc><restfuse>
2016-01-07 01:41:40
HQ
34,646,221
How to get alpha names for my program?
<p>When you see games in BETA and ALPHA, lets use Minecraft as example, Minecraft when it was in ALPHA the title for the ALPHA versions for Minecraft where like "Minecraft APLHA C1.2.2_C1.2" for example. Not that it's really important but how do they get the numbers and letters (C1.2.2_C1.2 &lt;- these numbers and letters) and what do they represent for is it numbers that are just kinda random? and how does a person go about to getting those numbers for there program? I normally just go ALPHA 1 - how many updates there is but I find it more professional to have titles like this "Minecraft APLHA C1.2.2_C1.2"? Thanks</p>
<minecraft>
2016-01-07 02:03:54
LQ_CLOSE
34,646,709
how to change query to entity frame
i want to change this sql query to entity frame query SELECT dbo.ClassTiming.StartTime, dbo.ClassTiming.EndTime, dbo.Employee.StaffName, dbo.Department.DepartmentName, dbo.Class.ClassName, dbo.Section.SectionName, dbo.WeekDay.DayName FROM dbo.Timetable INNER JOIN dbo.ClassTiming ON dbo.Timetable.ClassTimingId = dbo.ClassTiming.Id INNER JOIN dbo.Employee ON dbo.Timetable.StaffId = dbo.Employee.StaffID INNER JOIN dbo.Department ON dbo.Timetable.DepartmentId = dbo.Department.id INNER JOIN dbo.Section ON dbo.Timetable.SectionID = dbo.Section.ID INNER JOIN dbo.Class ON dbo.Timetable.ClassID = dbo.Class.ID INNER JOIN dbo.WeekDay ON dbo.Timetable.WeekDayId = dbo.WeekDay.Id
<c#><sql-server><entity-framework>
2016-01-07 03:02:53
LQ_EDIT