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,957,825 | for-loop and getchar() in C++ | Why does the code get the empty data directly in even times? I have no idea what is going on.
Thank you very much.
#include <stdio.h>
#pragma warning(disable : 4996)
void main() {
int f, a = 10, b = 20;
for (int i = 0; i < 5; i++)
{
char ch;
ch = getchar();
printf("ch = %c\n", ch);
switch (ch)
{
case '+': f = a + b; printf("f = %d\n", f); break;
case '−': f = a - b; printf("f = %d\n", f); break;
case '*': f = a * b; printf("f = %d\n", f); break;
case '/': f = a / b; printf("f = %d\n", f); break;
default: printf("invalid operator\n");
}
}
} | <c><for-loop><getchar> | 2016-01-22 23:45:50 | LQ_EDIT |
34,957,890 | Javascript string size limit: 256 MB for me - is it the same for all browsers? | <p>Curious about what was the maximum string length I could get in Javascript, I tested it myself, today, on my Firefox 43.0.1, running in Windows 7. I was able to construct a string with length <code>2^28 - 1</code>, but when I tried to create a string with one more char, <a href="http://getfirebug.com/" rel="noreferrer">Firebug</a> showed me the <em>"allocation size overflow"</em> error, meaning the string must be less than 256 MB.</p>
<p><strong>Is this the same thing for all browsers, all computers, all operational systems, or it depends?</strong></p>
<p>I created the following snippet to find out the limit:</p>
<pre><code>(function() {
strings = ["z"];
try {
while(true) {
strings.push(strings[strings.length - 1] + strings[strings.length - 1]);
}
} catch(err) {
var k = strings.length - 2;
while(k >= 0) {
try {
strings.push(strings[strings.length - 1] + strings[k]);
k--;
} catch(err) {}
}
console.log("The maximum string length is " + strings[strings.length - 1].length);
}
})();
</code></pre>
<p>If you are running a different browser/OS, I would like to see your results. My result was <em>The maximum string length is 268435455</em>.</p>
<p><strong>P.S.:</strong> I searched around for an answer, but the most recent topic I found was from 2011, so I am looking for a more up-to-date information.</p>
| <javascript><string><memory><out-of-memory> | 2016-01-22 23:52:52 | HQ |
34,957,971 | Why Does code.runnable.com Allow Me to Change a Variable's Value in Java? | <p>I heard that Java integers are <strong>pass by value</strong>, so why does the following code work in code.runnable.com? </p>
<pre><code>public class HelloWorld {
public static void main(String[] args) {
int number = 0;
number = 2;
System.out.println(number);
}
}
</code></pre>
<p>The code will print out <strong>2</strong>.</p>
| <java><pass-by-value> | 2016-01-23 00:01:20 | LQ_CLOSE |
34,958,319 | PHPDocumentor 2 and PHP 7 with opcache issues in Doctrine | <p>Hopefully someone here knows a thing or 2 about this.</p>
<p><b>Short Question</b></p>
<p>I am running into an error using phpdoc on the command line, installed via pear on PHP 7.0.2. The error is:</p>
<pre><code>#> phpdoc
PHP Fatal error: Uncaught Doctrine\Common\Annotations\AnnotationException:
You have to enable opcache.load_comments=1 or zend_optimizerplus.load_comments=1.
in /usr/local/php5-7.0.2-20160108-102134/lib/php/phpDocumentor/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php:193
</code></pre>
<p>How do I fix this error?</p>
<p><b>Details</b></p>
<p>Opcache is enabled and <code>opcache.load_comments=1</code> is in my opcache.ini file, verified by using the commands: <code>php -i | grep "Opcode"</code> and <code>php -i | grep "opcache"</code> respectively. Within that .ini file I can verify that changes are loaded by checking enable and disable opcache via that file.</p>
<p>With that said, if I have <code>opcache.load_comments=1</code> in my .ini file, why am I still getting this error?</p>
<p>Thanks!</p>
| <php><phpdoc><php-7><opcache><phpdocumentor2> | 2016-01-23 00:46:32 | HQ |
34,958,389 | I'm having some problems when I try localhost:3000 for programming with Google Chrome Browser | <p>I'm having many problems when I try use my localhost:3000 for programming in Ruby On Rails 4.
When I put in the Chrome browser in my Mac OS X "El Capitan".
This redirect's of this link</p>
<pre><code>http://www.free-merchants.com/partner/promokod_aliexpress-by-alibabacom#e4da3b7fbbce2345d7772b0674a318d5-http%3A%2F%2Flocalhost%3A3000%2F
</code></pre>
<p>and then automaticallyfor the other called: <code>http://localhost/to.php?subid=31</code></p>
<p>I think i have a virus. Anyone has this? </p>
| <ruby-on-rails><ruby><google-chrome><localhost><google-chrome-devtools> | 2016-01-23 00:57:21 | LQ_CLOSE |
34,958,776 | is there a command such as "sed" in bash scripts in c++? | Currently ım trying to convert my bash script to c++ executable
but ı stuck in "sed" command
here is my bash script:
unset WIFIMAC
unset BTMAC
# Skip processing if MAC addresses are already written
if [ -f /data/.mac.info -a -f /data/.bt.info ]; then
echo "MAC addresses already found."
fi
# Wait until Samsung's RIL announces MAC addresses
until [ $(expr length "$WIFIMAC") == 17 ]; do
WIFIMAC=`getprop ril.wifi_macaddr`
sleep 1
done
until [ $(expr length "$BTMAC") == 12 ]; do
BTMAC=`getprop ril.bt_macaddr`
sleep 1
done
# Set WiFi MAC address
echo $WIFIMAC >/data/.mac.info
# Convert BT MAC address to proper format
echo $BTMAC | sed 's!^M$!!;s!\-!!g;s!\.!!g;s!\(..\)!\1:!g;s!:$!!' >/data/.bt.info
exit
here ım trying it to convert to c++
*** ı put comments into next of bash commands ***
# This script will read the MAC addresses from Samsung's RIL.
unset WIFIMAC ---> char wifimac....
unset BTMAC ---> char btmac...
# Skip processing if MAC addresses are already written
if [ -f /data/.mac.info -a -f /data/.bt.info ]; then ----> create file_exist(); function with fd = open... and put a smiply if return block
echo "MAC addresses already found."
fi
# Wait until Samsung's RIL announces MAC addresses
until [ $(expr length "$WIFIMAC") == 17 ]; do -----> while strlen(wifimac) == 17 blah blah blah....
WIFIMAC=`getprop ril.wifi_macaddr` -----> property_get function in cutils.h
sleep 1 -----> mdelay(1) if ım not wrong huh?.....
done
until [ $(expr length "$BTMAC") == 12 ]; do
BTMAC=`getprop ril.bt_macaddr` -----> SAME COMMANDS ABOVE
sleep 1
done
# Set WiFi MAC address
echo $WIFIMAC >/data/.mac.info -----> create write_string_to_path(); function with write(fd, ...)
# Convert BT MAC address to proper format
echo $BTMAC | sed 's!^M$!!;s!\-!!g;s!\.!!g;s!\(..\)!\1:!g;s!:$!!' >/data/.bt.info -----> ********HERE İS THE F*CKİNG COMMAND "sed" *********
I KNOW A LİTTLE BİT ABOUT SED
BUT I DONT KNOW WHAT İS İT DOİNG HERE
THUS I DONT KNOW WHİCH COMMAND İN C++ DO THE SAME THİNG
exit
can any one help me please?
thanx
regards | <c++><linux><bash><shell><sed> | 2016-01-23 02:01:56 | LQ_EDIT |
34,958,795 | How do I enable the Ruby 2.3 `--enable-frozen-string-literal` globally in Rails? | <p>I am building a greenfield Rails application on top of Ruby 2.3, and I would like all Rails commands (e.g. <code>rails s</code>, <code>rails c</code>) and all Ruby commands (e.g. <code>rake do:something</code>) to use the new immutable-String functionality introduced in Ruby 2.3. (See, e.g. <a href="https://wyeworks.com/blog/2015/12/1/immutable-strings-in-ruby-2-dot-3/" rel="noreferrer">https://wyeworks.com/blog/2015/12/1/immutable-strings-in-ruby-2-dot-3/</a>)</p>
<p>So, how do I pass that lovely <code>--enable-frozen-string-literal</code> Ruby option down to Ruby in all possible contexts where some command I issue bottoms out in Ruby?</p>
<p>Thanks in advance!</p>
| <ruby-on-rails-4><ruby-2.3> | 2016-01-23 02:04:02 | HQ |
34,958,855 | SublimeText3 Fold/Unfold all methods | <p>I am using SublimeText3 for C++ and Java. I am wondering if there is a way to fold all of the methods in a file / class, and then unfold them all, regardless of where the caret is. Or is there a way to list all the functions / methods. </p>
<p>Basically I would like to be able to enter a file and see all the methods at one quick glance.</p>
<p>Thanks</p>
| <sublimetext3> | 2016-01-23 02:12:00 | HQ |
34,958,908 | Where can I find documentation for the NuGet v3 API? | <p>I'm interested in writing a client library around the NuGet v3 API in a non-.NET language. Where can I find documentation/resources on it that would tell me e.g. what URLs to make requests to and what responses it would return?</p>
<p>I tried doing a quick Google search, but the only thing that turns up is <a href="https://github.com/NuGet/NuGetGallery/wiki/API-v3-Specification" rel="noreferrer">this</a>, which was last updated 3 years ago. Does a spec exist?</p>
| <c#><.net><nuget><nuget-package><nuget-server> | 2016-01-23 02:19:37 | HQ |
34,959,038 | NPM stuck giving the same error EISDIR: Illegal operation on a directory, read at error (native) | <p>I am stuck with this error no matter what directory I am in, and what I type after "npm" in cmd.exe. Here is the npm-debug.log: </p>
<pre><code>0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js' ]
2 info using npm@2.14.12
3 info using node@v4.2.6
4 verbose stack Error: EISDIR: illegal operation on a directory, read
4 verbose stack at Error (native)
5 verbose cwd C:\Users\me
6 error Windows_NT 6.1.7601
7 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js"
8 error node v4.2.6
9 error npm v2.14.12
10 error code EISDIR
11 error errno -4068
12 error syscall read
13 error eisdir EISDIR: illegal operation on a directory, read
13 error eisdir This is most likely not a problem with npm itself
13 error eisdir and is related to npm not being able to find a package.json in
13 error eisdir a package you are trying to install.
14 verbose exit [ -4068, true ]
</code></pre>
<p>I have tried and uninstalling/reinstalling nodejs multiple times, I even deleted npm and npm-cache folders in C:\Users\me\AppData\Roaming. I'm not sure what went wrong to cause this. One second it was working fine, and now I can't get rid of this error. The explanation in the log does not make sense, as it gives this error in any directory. I should note that running a command prompt as administrator does not give this error. I'm pulling my hair out this Friday evening trying to get this fixed, any help would be greatly appreciated!</p>
| <node.js><windows><cmd><npm><file-permissions> | 2016-01-23 02:43:37 | HQ |
34,959,257 | Why isn't my future value available now? | <p>My ajax call is not returning anything! Here is my code:</p>
<pre><code>var answer;
$.getJSON('/foo.json') . done(function(response) { answer = response.data; });
console.log(answer);
</code></pre>
<p>Even though the network call is succeeding, and I can see that the response contains data, the console logs "undefined"! What is happening?</p>
| <ajax><asynchronous><async-await><promise> | 2016-01-23 03:28:39 | LQ_CLOSE |
34,959,432 | bat script to trim characters after a particular length from 1st word of every line | I have text file like below
Input sample text file
-------------------------------
<Line1> 69273ww01/080-100 1021/00 11123
<Line2> 80381ew20/937-134 1372/92 12737298323
<Line3> 02ws88749/263-379 2836/39 121
<Line4> 4793de592/343-283 7384/49 233792740562263
Required output text file
-------------------------------
<Line1> 69273ww01/080-100 1021/00 111
<Line2> 80381ew20/937-134 1372/92 127
<Line3> 02ws88749/263-379 2836/39 121
<Line4> 4793de592/343-283 7384/49 233
I want to trim characters after a particular length (30) from 1st word of every line
Could any one help me who write a batch script. for the above requirement. | <batch-file><trim> | 2016-01-23 03:55:47 | LQ_EDIT |
34,959,558 | Select MySQL rows with timestamp older than 12 hours? | <p>In my table <code>monitoring</code>, I want to select the content from the content <code>domain</code>. But I only want to select it for rows where the timestamp on them is older than 12 hours and it should list the oldest entries first.</p>
<p>Here's what I've got so far and need help with:</p>
<pre><code>SELECT domain FROM monitoring WHERE status = 'active' AND WHERE submit_time = '?????' ORDER BY '?????'
</code></pre>
<p>I know there are similar questions posted here about this. However, the answers all seem dependent on the format of your time. Here's how the time is listed in the database:</p>
<pre><code>01-20-2016 23:12:13
</code></pre>
<p>Any help would be appreciated.</p>
| <mysql><sql> | 2016-01-23 04:21:02 | LQ_CLOSE |
34,959,643 | How can I specify where my local developer's service fabric cluster is created? | <p>My problem: I am learning Service Fabric, and doing simple tutorials, and the local cluster is filling up my C drive. I run the projects in Visual Studio. It first creates a cluster in a folder SfDevCluster. That takes up 842 MB of space. Then it deploys the services and web api sites. Remember, these are trivial tutorials with almost nothing in them. Now, I notice that I have a folder with a Size = 1.22 TB and Size on Disk of 9.4 GB. I'm not sure how to interpret that. But it consumes the remaining space on my C drive and sets off alarms.
I have other drives with lots of space. I would love to specify that those be used. Is there a way to do that with the service fabric cluster used by Visual Studio? Or is there a way to constrain the overly ambitious size allocations? And if you understand this, can you explain what these unusual folder sizes mean?
In the old days, I would have a hard drive with lots of space. But now, my developer machine has a much faster, but more expensive SSD drive, and space is at a premium. So I need more control of the cluster location. </p>
| <azure-service-fabric> | 2016-01-23 04:33:40 | HQ |
34,960,296 | Prime Number in clisp | Well I'm just completely new to CLISP programming language and I have started learning this language by my own from yesterday and that too out of interest.Now when i came across functions and loop,after learning about them I started developing the Prime Number problem in CLISP.
My code is as follows:
(defun prime (num)
(setq c 1)
(setq a 2)
(loop
(setq a (+ 1 a))
(if (= (mod num a) 0)
(setq c (+ c 1))
)
(when (> (+ a 1) 17) (return a))
)
)
(if (= c 1)
(return-from prime num)
)
)
(loop for x from 1 to 20
do (prime x)
)
Now the problem which I am facing with this code is that whenever I am trying to execute this code the error which I am getting is as follows:
***IF: variable C has no value
but I've declared a value to c already still it's appearing. So all i want to know is that why this error is appearing even though i have declared it. | <common-lisp> | 2016-01-23 06:15:02 | LQ_EDIT |
34,960,308 | How optimise code in the scenario ??? instated of writing multiple else if conditions | This My DAOImple class::::
here i have two drop down boxes like
1'st box options are ALL,in pool,out of pool.
2ed box option are ALL,active,inactive,Frozen,Baried,Delete.
-------------------
public class FleetDetailsDAOImpl22 extends CustomJdbcDaoSupport implements FleetDetailsDAO {
@Autowired
private DataManager dataManager;
/** This method is called for getting all the vessels. */
/**
* @param vesselStatus
* @param poolStatus
* @param poolid
*/
@Override
public List<FleetDetails> getFleetDetails(String vesselStatus,
String poolStatus, int poolid, String fromDate, String toDate)throws CustomException {
List<FleetDetails> fleetList =new ArrayList<FleetDetails>();
String poolStatusValue = null;
String vesselStatusValue = null;
String displayFlag = null;
/*---check for poolStatus---------*/
if(poolStatus.equals("yes")) {
poolStatusValue = "Y";
}
if(poolStatus.equals("no")) {
poolStatusValue = "N";
}
if(poolStatus.equals("all")) {
poolStatusValue = "ALL";
}
/*---check for vessel status---------*/
if(vesselStatus.equals("active")) {
vesselStatusValue = "Y";
displayFlag = "Y";
}
if(vesselStatus.equals("inactive")) {
vesselStatusValue = "N";
displayFlag = "Y";
}
if(vesselStatus.equals("frozen")) {
vesselStatusValue = "F";
displayFlag ="Y";
}
if(vesselStatus.equals("buried")) {
vesselStatusValue = "B";
displayFlag = "B";
}
if(vesselStatus.equals("pending")) {
vesselStatusValue = "P";
displayFlag = "P";
}
if(vesselStatus.equals("delete")) {
vesselStatusValue = "D";
displayFlag = "D";
}
if(vesselStatus.equals("all")){
vesselStatusValue = "ALL";
}
try {
if(poolStatusValue.equals("Y") && vesselStatusValue.equals("ALL") ){
String fleetDetailsQuery = dataManager.getQuery("FLEET_DETAILS", Queries.QUERY_GET_FLEET_DETAILS_ALL_NONPOOL);
Object[] params = new Object[] { poolid, poolStatusValue };
fleetList = getJdbcTemplate().query(fleetDetailsQuery,params, new FleetDetails.FleetDetailsRowMapper());
}
else if(poolStatusValue.equals("ALL") && vesselStatusValue.equals("ALL")) {
String allVesselsQuiry = dataManager.getQuery("FLEET_DETAILS",Queries.QUERY_GET_POOL_NONPOOL_VESSELS);
Object[] params = new Object[] { poolid };
fleetList = getJdbcTemplate().query(allVesselsQuiry,params, new FleetDetails.FleetDetailsRowMapper());
}
else if(poolStatusValue.equals("N")){
String nonpoolVesselsQuiry = dataManager.getQuery("FLEET_DETAILS", Queries.QUERY_GET_NONPOOL_VESSELS);
Object[] params = new Object[] { poolid, vesselStatusValue,poolStatusValue, displayFlag };
fleetList = getJdbcTemplate().query(nonpoolVesselsQuiry,params, new FleetDetails.FleetDetailsRowMapper());
}
else if(poolStatusValue.equals("Y")){
String fleetDetailsQuery = dataManager.getQuery("FLEET_DETAILS", Queries.QUERY_GET_FLEET_DETAILS);
Object[] params = new Object[] { poolid, vesselStatusValue,poolStatusValue, displayFlag };
fleetList = getJdbcTemplate().query(fleetDetailsQuery,params, new FleetDetails.FleetDetailsRowMapper());
}
else {
String fleetDetailsQuery = dataManager
.getQuery("FLEET_DETAILS",Queries.QUERY_GET_STATUS_VESSELS_FOR_BOTH_POOL_NONPOOL);
Object[] params = new Object[] { poolid, vesselStatusValue,displayFlag };
fleetList = getJdbcTemplate().query(fleetDetailsQuery,params, new FleetDetails.FleetDetailsRowMapper());
}
} catch(Exception e) {
e.getMessage();
}
return fleetList;
}
| <java> | 2016-01-23 06:16:47 | LQ_EDIT |
34,960,457 | Matlab convolution code in C | <p>I'm trying to make the MATLAB conv function in C. So far I have this:</p>
<pre><code>int n=Length(SignalArray);
int m=Length(FilterArray);
TempX=[SignalArray,Zeros(1,FilterArray)];
TempH=[FilterArray,Zeros(1,SignalArray)];
for(int i=0;i<n+m-1;i++){
ResultArray(i)=0;
for(int j=0;j<=m-1;j++){
if(i-j+1>0){
int TempVal=ResultArray(i)+TempX(j)*TempH(i-j);
ResultArray(i)=TempVal;
}
}
}
</code></pre>
<p>The first elements of the convolution result come out to be fine but the last element either comes out to be right or is shown to be a really high number ( something like 10 to the power 9).</p>
<p>Please help.</p>
| <c><matlab><convolution> | 2016-01-23 06:38:08 | LQ_CLOSE |
34,961,066 | Run remote php script from terminal | <p>how would I go about running a script @ <code>http://www.domain.com/php/script.php/</code> from my terminal window. Also, I would need to pass a variable, <code>$var1 = "string"</code>. How would I do this?</p>
| <php> | 2016-01-23 07:58:21 | LQ_CLOSE |
34,961,505 | Delete files in Windows>Temp>tmp0000* repertories : Windows 8.1 | <p>I do not have enough space on my disk, I would like to know if I can delete the Temp files of the <code>Windows directory>Temp>tmp0000*</code></p>
| <windows> | 2016-01-23 08:52:46 | LQ_CLOSE |
34,961,563 | show/hide a div with drop dwon value in asp.net | its my code i want to hide div which have id selnumber (when i select form 60/61 and show a text message "It is form 60/61" at the place of div) but when select pan then show the div.
<div id="selpan">
<asp:DropDownList ID="ddlpan" runat="server">
<asp:ListItem>---Select---</asp:ListItem>
<asp:ListItem>PAN</asp:ListItem>
<asp:ListItem>FORM 60/61</asp:ListItem>
</asp:DropDownList> </div>
</td><div id="selnumber">
<td colspan="3">
<asp:Label ID="add_no" runat="server" Font-Bold="True" Font-Names="Verdana"
Font-Size="10pt" Font-Strikeout="False" Text="File Number"></asp:Label>
</td><td>
<asp:TextBox ID="tbnumber" runat="server" ontextchanged="tbnumber_TextChanged"></asp:TextBox>
</td>
</div> | <html><css><asp.net> | 2016-01-23 08:58:47 | LQ_EDIT |
34,961,598 | Issues with Macros in C | I'm still trying to firgure out macros in C
#define A(x) #x
int main()
{
int i = -i;
char *s = A(i);
i = -(s[0] == 'i');
printf("%d", i);
return 0;
}
Anyone care to enlighten me and comment the code, especially what the macro does and this line: i = -(s[0] == 'i'); | <c><macros> | 2016-01-23 09:02:59 | LQ_EDIT |
34,961,682 | can javascript be inline with webpack? | <p>I need to import a library to my project, the library should is a javascript file, which need to be inlined to html.</p>
<p>for example: </p>
<p>library code:</p>
<pre><code>(function(){
var a = 0;
})();
</code></pre>
<p>I need to make this code inline in html.</p>
<p>html:</p>
<pre><code><html>
<head>
<script>
(function(){
var a = 0;
})();
</script>
</head>
<body>
</body>
</html>
</code></pre>
<p>can I implement this with webpack?
I find <a href="https://github.com/webpack/script-loader">script-loader</a>, but it run the script, not make it inline.</p>
| <webpack> | 2016-01-23 09:14:18 | HQ |
34,961,981 | Why converting from base 10 to base 2 is considered slow? | <p>As stated <a href="http://codeforces.com/blog/entry/22712" rel="nofollow">here</a> it is quadratic, but why?</p>
| <algorithm> | 2016-01-23 09:49:40 | LQ_CLOSE |
34,962,677 | Twitter Streaming API limits? | <p>I understand the Twitter REST API has strict request limits (few hundred times per 15 minutes), and that the streaming API is sometimes better for retrieving live data. </p>
<p>My question is, what exactly are the streaming API limits? Twitter references a percentage on their docs, but not a specific amount. Any insight is greatly appreciated. </p>
<p>What I'm trying to do: </p>
<ul>
<li>Simple page for me to view the latest tweet (& date / time it was posted) from ~1000 twitter users. It seems I would rapidly hit the limit using the REST API, so would the streaming API be required for this application? </li>
</ul>
| <api><twitter><twitter-streaming-api><tweetstream><twitter-rest-api> | 2016-01-23 11:09:24 | HQ |
34,963,051 | Webpack not loading css | <p>This is my first time trying to set up Webpack, so I'm sure I'm missing something here.</p>
<p>I am trying to load my PostCSS files with Webpack, using the ExtractTextPlugin to generate a css file into "dist". The problem is Webpack does not seem to pick up the css files. They are under "client/styles", but I've tried moving them to "shared", with the same result.</p>
<p>I ran Webpack with the --display-modules option, and verified that no css files display there.</p>
<p>I have tried running it without the extract text plugin, and the result is the same: no CSS is built into bundle.js.</p>
<p>Here is my prod config:</p>
<pre><code>var ExtractTextPlugin = require('extract-text-webpack-plugin');
var path = require('path');
module.exports = {
entry: [
'./client'
],
resolve: {
modulesDirectories: ['node_modules', 'shared'],
extensions: ['', '.js', '.jsx', '.css']
},
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js',
chunkFilename: '[id].js',
publicPath: '/'
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loaders: ['babel']
},
{
test: /\.css?$/,
loader: ExtractTextPlugin.extract(
'style-loader',
'css-loader!postcss-loader'
),
exclude: /node_modules/
}
]
},
plugins: [
new ExtractTextPlugin('[name].css')
],
postcss: (webpack) => [
require('postcss-import')({ addDependencyTo: webpack, path: ['node_modules', 'client'] }),
require('postcss-url')(),
require('precss')(),
require('postcss-fontpath')(),
require('autoprefixer')({ browsers: [ 'last 2 versions' ] })
]
};
</code></pre>
<p>And here's an example of my main css file:
@import 'normalize.css/normalize';</p>
<pre><code>/* Variables */
@import 'variables/colours';
/* Mixins */
/* App */
/* Components */
body {
background-color: $black;
}
</code></pre>
<p>Would anyone have an idea on why this is happening? Am I missing something?</p>
<p>Thank you</p>
| <javascript><css><webpack><postcss> | 2016-01-23 11:47:08 | HQ |
34,963,138 | Error: stat_count() in ggplot2 | <p>In many of my programs I have been using ggplot2 to render charts. I have loaded them on shinyapps.io and they are working absolutely fine. However, when I try to run the program on my machine, i am getting the following error:</p>
<pre><code>Error : stat_count() must not be used with a y aesthetic.
</code></pre>
<p>The following is the example code:</p>
<pre><code>ggplot(hashtg, aes(x=reorder(hashtag, Freq), y = Freq, fill = hashtag)) + geom_bar(stat="identity") +
geom_bar(width = 0.4) + xlab("Hashtags Used") + ylab("Number of responses") +
geom_text(aes(label=Freq), hjust = 1, colour = "white" )
</code></pre>
<p>The actual code has many arguments of bar graph such as title, theme & annotation, but I guess they would not hamper the output. I am using aggregated data where <code>Freq</code> in the code is the frequency of a particular term. When I searched for help, I repeated get instructions to use <code>stat = "identity"</code> for a bar plot. </p>
<p>Any help would be highly appreciated.</p>
<p>The session info is as follows:</p>
<pre><code>R version 3.2.0 (2015-04-16)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.3 (Yosemite)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] wordcloud_2.5 RColorBrewer_1.1-2 SnowballC_0.5.1 ggplot2_2.0.0 plyr_1.8.3
[6] chron_2.3-47 RCurl_1.95-4.7 bitops_1.0-6 ROAuth_0.9.6 RJSONIO_1.3-0
[11] twitteR_1.1.9 base64enc_0.1-3 tm_0.6-2 NLP_0.1-8 stringr_1.0.0
[16] shinydashboard_0.5.1 shinyIncubator_0.2.2 shiny_0.12.2
loaded via a namespace (and not attached):
[1] Rcpp_0.12.1 tools_3.2.0 digest_0.6.8 bit_1.1-12 jsonlite_0.9.17 gtable_0.1.2
[7] DBI_0.3.1 rstudioapi_0.3.1 curl_0.9.3 parallel_3.2.0 httr_1.0.0 bit64_0.9-5
[13] grid_3.2.0 R6_2.1.1 magrittr_1.5 scales_0.3.0 htmltools_0.2.6 colorspace_1.2-6
[19] mime_0.4 xtable_1.7-4 httpuv_1.3.3 labeling_0.3 stringi_0.5-5 munsell_0.4.2
[25] slam_0.1-32 rjson_0.2.15 rstudio_0.98.1103
</code></pre>
<p>To reiterate, the same code works without a trouble in shinyapps.io.</p>
| <r><ggplot2> | 2016-01-23 11:56:02 | HQ |
34,963,550 | When should I use * and when &? | <p>I am learning some C++, and I came across pointers and addresses. However, in none of the materials, I could find a good explanation on when to use pointer, and when to use address. As I understand it is that when I use pointer, I POINT to address in memory, where some variable is stored. So for example:</p>
<pre><code>int x = 5;
int k* = &x;
</code></pre>
<p>Which will mean that:</p>
<pre><code>k represents x
</code></pre>
<p>When I change <code>k</code>, I also change value of <code>x</code>.</p>
<p>My question is as follows: when should I use pointer, and when should I use address? When I declare a function, should I use pointer, or address as a variable?</p>
| <c++><pointers> | 2016-01-23 12:37:55 | LQ_CLOSE |
34,963,949 | Kotlin: Why are most variables underlined in Android Studio and how do I turn that off? | <p>I wanted to know why most variables in Kotlin are underlined. Some files contain a lot of underlining which is very annoying. If I hover my mouse over a variable it doesn't give any information most of the time. But on some it says "This property has a backing field" or "Value captured in a closure". Does anybody know how to disable those underlines? Here is a screenshot with what I mean:
<a href="https://i.stack.imgur.com/qUQMI.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qUQMI.png" alt="enter image description here"></a></p>
<p>And realm is then underlined throughout the entire file.</p>
| <android-studio><syntax-highlighting><kotlin> | 2016-01-23 13:20:22 | HQ |
34,964,454 | VBA excel programming | [![output sheet][1]][1]
[![The sheet from which data has to be dumped.][2]][2]
There is an excel sheet with ItemId and ItemName.For a single ItemID there are 4-5 ItemName.The data from this sheet needs to be dumped into another sheet using VBA Excel Programming.
The sheet in which the data is dumped shall list the ItemName in different columns for a single ItemId.
[1]: http://i.stack.imgur.com/Fx3da.png
[2]: http://i.stack.imgur.com/rJy9w.png | <vba><excel> | 2016-01-23 14:07:17 | LQ_EDIT |
34,964,462 | Yii2 | requires bower-asset/jquery | <p>I'm trying to install Yii2 via composer:</p>
<pre><code>composer global require "fxp/composer-asset-plugin:~1.1.1"
composer create-project --prefer-dist yiisoft/yii2-app-basic basic
</code></pre>
<p>~/.composer/composer.json</p>
<pre><code>{
"require": {
"fxp/composer-asset-plugin": "~1.1.1"
}
}
</code></pre>
<p>result: </p>
<pre><code>Problem 1
- yiisoft/yii2 2.0.x-dev requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
- yiisoft/yii2 dev-master requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
- yiisoft/yii2 2.0.6 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
- yiisoft/yii2 2.0.5 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
- Installation request for yiisoft/yii2 >=2.0.5 -> satisfiable by yiisoft/yii2[2.0.5, 2.0.6, dev-master, 2.0.x-dev].
</code></pre>
<p>What do I do wrong?</p>
| <yii2><composer-php> | 2016-01-23 14:08:01 | HQ |
34,964,901 | Finding number of methods used in a java program after selecting the file | <p>Are there any specific methods or functions to calculate the number of methods and not the constructors in java?</p>
<p>Very important, please share if you know something.</p>
| <java><methods><count> | 2016-01-23 14:52:55 | LQ_CLOSE |
34,965,277 | Regex vs, versus, vs., v. matching in lines for c# code | >Hi I need to write a regex that matches the word
>versus,verse, vs. , v. , v but v should not be jumbled in words
@"\b((.*?)" + Regex.Unescape(xz) + @"[.,:/s]?)\b", RegexOptions.IgnoreCase))
>here i ll pass the array and test it | <c#><regex> | 2016-01-23 15:29:06 | LQ_EDIT |
34,965,856 | What is the point of the constants in redux? | <p>For example from this example:</p>
<pre><code>export const ADD_TODO = 'ADD_TODO'
export const DELETE_TODO = 'DELETE_TODO'
export const EDIT_TODO = 'EDIT_TODO'
export const COMPLETE_TODO = 'COMPLETE_TODO'
export const COMPLETE_ALL = 'COMPLETE_ALL'
export const CLEAR_COMPLETED = 'CLEAR_COMPLETED'
</code></pre>
<p>It's not like you're saving characters. The variable name is exactly the same as the string, and will never change. I understand making constants if one day you were doing to do something like:</p>
<pre><code>ADD_TODO = 'CREATE_TODO'
</code></pre>
<p>but that never happens. So what purpose do these constants serve?</p>
| <javascript><redux> | 2016-01-23 16:24:50 | HQ |
34,965,885 | Data is not enter in database using php | <p>I want to insert data into the database.but when i click on save button than data did not go in database.i did not understand where i did mistake. This is my php code:</p>
<pre><code> <?php
$host = "localhost";
$user = "root";
$password ="";
$database = "crud";
$conn = new mysqli($host, $user, $password);
mysql_select_db($database);
if(isset($_POST['btn-save']))
{
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$city_name = $_POST['city_name'];
$sql_query ="INSERT INTO users(first_name,last_name,user_city) VALUES('$first_name','$last_name','$city_name')";
mysql_query($sql_query);
}
?>
</code></pre>
| <php><mysql><database> | 2016-01-23 16:27:33 | LQ_CLOSE |
34,966,066 | Xamarin.Forms: How can I load ResourceDictionary from another file? | <p>I wrote following code, but XamlParseException has bean thrown. ("StaticResource not found for key CustomColor")</p>
<p>MyPage.xaml</p>
<pre><code><?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="XFApp11.MyPage">
<ContentPage.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="CustomResource.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<BoxView Color="{StaticResource CustomColor}" />
</ContentPage.Content>
</ContentPage>
</code></pre>
<p>CustomResource.xaml (build action = EmbeddedResource)</p>
<pre><code><?xml version="1.0" encoding="UTF-8" ?>
<ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
<Color x:Key="CustomColor">#004B86</Color>
</ResourceDictionary>
</code></pre>
| <c#><xaml><xamarin><xamarin.forms> | 2016-01-23 16:44:35 | HQ |
34,966,124 | How to make RxJava interval to perform action instantly | <p>Hello I am making observable to ask my server about its online/offline status every 15 seconds:</p>
<pre><code>public Observable<Response> repeatCheckServerStatus(int intervalSec, final String path) {
return Observable.interval(intervalSec, TimeUnit.SECONDS)
.flatMap(new Func1<Long, Observable<Response>>() {
@Override
public Observable<Response> call(Long aLong) {
return Observable.create(new Observable.OnSubscribe<Response>() {
@Override
public void call(Subscriber<? super Response> subscriber) {
try {
Response response = client.newCall(new Request.Builder()
.url(path + API_ACTION_CHECK_ONLINE_STATUS)
.header("Content-Type", "application/x-www-form-urlencoded")
.get()
.build()).execute();
subscriber.onNext(response);
subscriber.onCompleted();
if (!response.isSuccessful())
subscriber.onError(new Exception());
} catch (Exception e) {
subscriber.onError(e);
}
}
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
}
});
}
</code></pre>
<p>After I call this method, first execution of code will be after intervalSec time (15sec in my case). Looking at rxJava docummentation of interval method:</p>
<p><a href="http://reactivex.io/documentation/operators/interval.html" rel="noreferrer">http://reactivex.io/documentation/operators/interval.html</a></p>
<p>This is how it should be. </p>
<p>Question: is there any way to execute code instantly and then repeat in intervals?</p>
| <java><android><rx-java> | 2016-01-23 16:50:00 | HQ |
34,966,560 | Algorithm for joining circles into a polygon | <p>What is the best way of combining overlapping circles into polygons?</p>
<p>I am given a list of centre points of circles with a fixed diameter.</p>
<p><a href="https://i.stack.imgur.com/LE7b3.png" rel="noreferrer"><img src="https://i.stack.imgur.com/LE7b3.png" alt="Rendering of 5 random circles"></a></p>
<p>I need to join any overlapping circles together and output a list of points in the resulting polygon.
<a href="https://i.stack.imgur.com/bUeY9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/bUeY9.png" alt="Rendering of desired output"></a></p>
<p>This seems like a fairly common problem (GIS systems, vectors, etc.). This is possible to do through the Google Maps API but I am looking for the actual algorithm.</p>
<p>I have tried to solve this problem by calculating points around each circle.
<a href="https://i.stack.imgur.com/xwvfU.png" rel="noreferrer"><img src="https://i.stack.imgur.com/xwvfU.png" alt="Rendering of 16 points on the circumference of each circle"></a></p>
<p>Then removing any points located inside any circle.
<a href="https://i.stack.imgur.com/Wor7I.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Wor7I.png" alt="enter image description here"></a></p>
<p>This gives me the correct list of points in the desired polygon.
<a href="https://i.stack.imgur.com/ww6yp.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ww6yp.png" alt="Rendering of points on the desired polygon"></a></p>
<p>However, the order of the points is a problem with this solution. Each circle has its points stored in an array. To merge them correctly with 2 overlapping circles is relatively straight forward. However, when dealing with multiple overlapping circles it gets complicated.
<a href="https://i.stack.imgur.com/BQcIP.png" rel="noreferrer"><img src="https://i.stack.imgur.com/BQcIP.png" alt="enter image description here"></a></p>
<p>Hopefully you have some ideas to either make this solution work or of another algorithm that will achieve the desired result.</p>
<p>Thanks in advance!</p>
| <algorithm><geometry><polygon> | 2016-01-23 17:30:30 | HQ |
34,966,960 | Different audio by language | <p>Different audio by language.</p>
<p>Hello, I wonder if it is possible to use different audio tracks according to the user's language, similar to strings.xml but for sound files.</p>
| <android><audio> | 2016-01-23 18:11:21 | LQ_CLOSE |
34,966,987 | Update columns through SQL Query | <p>I have made a PHP script that upgrades his/her Firewall app (a function of my website). I have written this code:</p>
<pre><code><?php
session_start();
include_once 'dbconnect.php';
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "dbtest";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
if(!isset($_SESSION['user']))
{
header("Location: index.php");
}
$query = "UPDATE users SET firewall = firewall + 1, money = money - 300 WHERE user_id=".$_SESSION['user']")";
?>
</code></pre>
<p>Please help me and see what I did wrong.</p>
| <php><mysql> | 2016-01-23 18:13:57 | LQ_CLOSE |
34,967,093 | How to redirect stderr to a file in a cron job | <p>I've got a cron job that is set up like this in my crontab:</p>
<pre><code>*/1 * * * * sudo /home/pi/coup/sensor.py >> /home/pi/sensorLog.txt
</code></pre>
<p>It puts stdout into sensorLog.txt, and any stderr it generates gets put into an email. </p>
<p>I want both stdout and stderr to go into sensorLog.txt, so I added <code>1>&2</code> to the crontab, which is supposed to make stderr go into the same place as stdout. It now looks like this:</p>
<pre><code>*/1 * * * * sudo /home/pi/coup/sensor.py >> /home/pi/sensorLog.txt 1>&2
</code></pre>
<p>Now, both stdout and stderr both get put into an email, and nothing gets added to the file. This is the opposite of what I am trying to accomplish.</p>
<p>How do I get both stdout and stderr to get redirected to the file?</p>
| <sh><crontab> | 2016-01-23 18:25:17 | HQ |
34,967,273 | Add metadata comment to Numpy ndarray | <p>I have a Numpy ndarray of three large arrays and I'd just like to store the path to the file that generated the data in there somewhere. Some toy data:</p>
<pre><code>A = array([[ 6.52479351e-01, 6.54686928e-01, 6.56884432e-01, ...,
2.55901861e+00, 2.56199503e+00, 2.56498647e+00],
[ nan, nan, 9.37914686e-17, ...,
1.01366425e-16, 3.20371075e-16, -6.33655223e-17],
[ nan, nan, 8.52057308e-17, ...,
4.26943463e-16, 1.51422386e-16, 1.55097437e-16]],
dtype=float32)
</code></pre>
<p>I can't just append it as an array to the ndarray because it needs to be the same length as the other three. </p>
<p>I could just append <code>np.zeros(len(A[0]))</code> and make the first value the string so that I can retrieve it with A[-1][0] but that seems ridiculous.</p>
<p>Is there some metadata key I can use to store a string like <code>/Documents/Data/foobar.txt'</code> so I can retrieve it with something like <code>A.metadata.comment</code>?</p>
<p>Thanks!</p>
| <python><arrays><numpy> | 2016-01-23 18:40:40 | HQ |
34,967,391 | RSpec: Is there a not for `and change`, e.g. `and_not to change`? | <p>I find the <code>.and</code> method very useful for chaining many expectations.</p>
<pre><code>expect {
click_button 'Update Boilerplate'
@boilerplate_original.reload
} .to change { @boilerplate_original.title }.to('A new boilerplate')
.and change { @boilerplate_original.intro }.to('Some nice introduction')
</code></pre>
<p>Is there something that let's me check for <strong>no change</strong>?</p>
<pre><code>.and_not change { @boilerplate_original.intro }
</code></pre>
<p>Something like that? I couldn't find anything, and it's hard to search on Google for something like "and not".</p>
| <rspec> | 2016-01-23 18:49:59 | HQ |
34,967,958 | Create an array from hash replacing all of the keys and values with integers in Ruby | I have a hash in Ruby, like that:
a = {"0" => ["2", "3"], "1" => "4", "3" => "5"}
and I need a function to make an array from it, like that:
a = [[2, 3], 4, nil, 5]
Is there any simple way to do this? | <arrays><ruby><hash> | 2016-01-23 19:41:51 | LQ_EDIT |
34,968,112 | How to give jupyter cell standard input in python? | <p>I am trying to run a program on a jupyter notebook that accepts user input, and I cannot figure out how to get it to read standard input. For example, if I run the code with shift-enter:</p>
<pre><code>a = input()
print(a)
</code></pre>
<p>the cell indicates it is running, but does not accept input from me. How do I get it to accept input?</p>
| <python><jupyter><jupyter-notebook> | 2016-01-23 19:54:09 | HQ |
34,968,174 | Set text-cursor position in a textarea | <p>I'm working on a BBCode editor and here is the code:</p>
<pre><code>var txtarea = document.getElementById("editor_area");
function boldText() {
var start = txtarea.selectionStart;
var end = txtarea.selectionEnd;
var sel = txtarea.value.substring(start, end);
var finText = txtarea.value.substring(0, start) + '[b]' + sel + '[/b]' + txtarea.value.substring(end);
txtarea.value = finText;
txtarea.focus();
}
</code></pre>
<p>Everything is OK except one thing which is the position of the text-cursor. When I click on the boldText button, it sets the cursor position at the end of the Textarea!!</p>
<p>Actually, I want to be able to set the cursor position at a certain index. I want something like this:</p>
<pre><code>txtarea.setFocusAt(20);
</code></pre>
| <javascript><textarea> | 2016-01-23 19:59:48 | HQ |
34,968,371 | Integrate Spring Boot with JBOSS EAP Server | <p>1) Can Spring-boot use JBOSS EAP 7.0 server as an embedded server?</p>
<p>2) please let us know, if any one can the sample code for the above. </p>
| <spring-boot> | 2016-01-23 20:19:15 | LQ_CLOSE |
34,968,391 | Can i fetch the data from SQL database table without using any Query...????? in vb or C# | <p>Can i fetch the data from SQL database table without using any Query...????? in vb or C#</p>
| <c#><sql><vb.net> | 2016-01-23 20:21:26 | LQ_CLOSE |
34,968,571 | Xamarin Studio not Recognizing Provisioning Profiles | <p>I'm at my wit's end with these apple certificates. I have a Xamarin.Forms app that I need to sign with a provisioning profile so I can enable push notifications. However, Xamarin Studio isn't recognizing any of the provisioning profiles that I'm making. Can someone please help?</p>
<p>Xamarin Studio trying to link provisioning profiles, profile 23devpp not found:
<a href="https://i.stack.imgur.com/pez1Z.png" rel="noreferrer"><img src="https://i.stack.imgur.com/pez1Z.png" alt="enter image description here"></a></p>
<p>Xcode finds prov. profile 23devpp:
<a href="https://i.stack.imgur.com/CI05C.png" rel="noreferrer"><img src="https://i.stack.imgur.com/CI05C.png" alt="enter image description here"></a></p>
<p>Developer window has provisioning profile marked as active:
<a href="https://i.stack.imgur.com/5iygS.png" rel="noreferrer"><img src="https://i.stack.imgur.com/5iygS.png" alt="enter image description here"></a></p>
| <ios><xcode><xamarin><provisioning-profile><xamarin-studio> | 2016-01-23 20:38:22 | HQ |
34,969,287 | What is the current status of C++ AMP | <p>I am working on high performance code in C++ and have been using both CUDA and OpenCL and more recently C++AMP, which I like very much. I am however a little worried that it is not being developed and extended and will die out.</p>
<p>What leads me to this thought is that even the MS C++AMP blogs have been silent for about a year. Looking at the C++ AMP algorithms library <a href="http://ampalgorithms.codeplex.com/wikipage/history" rel="noreferrer">http://ampalgorithms.codeplex.com/wikipage/history</a> it seems nothing at all has happened for over a year.</p>
<p>The only development I have seen is that now LLVM sort of supports C++AMP, so it is not windows only, but that is all, and not something which has been told far and wide.</p>
<p>What kind of work is going on, if any, that you know of?</p>
| <c++><c++11><gpgpu><c++-amp> | 2016-01-23 21:48:10 | HQ |
34,969,292 | How to set default HTTP header in Angular2? | <p>I know how to set headers for a single HTTP call using the <a href="https://angular.io/docs/ts/latest/api/http/Headers-class.html" rel="noreferrer">Headers class</a>.</p>
<p>Is there a way to do it for <strong>all</strong> HTTP calls? </p>
| <angular> | 2016-01-23 21:48:53 | HQ |
34,969,525 | CAN standard frame and extended frame related | <p>Is it possible to have both CAN standard frame and CAN extended frame coexist on a single CAN bus ?</p>
<p>can bus protocol allows this to happen?</p>
| <embedded> | 2016-01-23 22:11:59 | LQ_CLOSE |
34,969,552 | How to configure 3 way merge feature on compare in Visual Studio 2015 | <p><strong>Problem:</strong> The default diff/ merge tool in visual studio 2015 (and previous versions) does not allow merging when you compare a file. It only allows you to see differences. The only occasion I'm aware of the 3 way merge option being enabled is when there is a merge conflict.</p>
<p>I want to see the 3 way merge option on every instance of the diff tool in Visual Studio.</p>
<p><strong>Notes:</strong> I'm definitely not looking for an alternative tool or a 'work around' on this. I have been happily using <a href="http://blog.degree.no/2013/12/using-winmerge-as-the-default-diffmerge-tool-in-visual-studio-2012/" rel="noreferrer">WinMerge</a> as my merge tool which allows merging anytime you compare. I really like the vs diff tool's 3 way option and being able to use it any time I want would be a nice boost to my work flow.</p>
<p>Thanks!</p>
| <visual-studio><merge><visual-studio-2015><diff><merge-conflict-resolution> | 2016-01-23 22:14:58 | HQ |
34,969,848 | "textAlignVertical" is not a valid style property | <p>I am getting an error saying "textAlignVertical" is not a valid style property when attempting to use the 'textAlignVertical' style on a Text element. I've checked the documentation and it says I should be able to use this style property: <a href="https://facebook.github.io/react-native/docs/text.html" rel="noreferrer">https://facebook.github.io/react-native/docs/text.html</a></p>
<p>has anyone else had this issue?</p>
| <react-native> | 2016-01-23 22:42:40 | HQ |
34,970,081 | How much jquery in angular app? | <p>I'm learning javascript and I'm at the point where I can't figure it out on my own, how much do I need to know about jquery to develop app with angular, ember or whatever framework i chose to, <strong>is jquery optional, something good to know but i can do all i wanted just by going with some popular framework</strong>? </p>
| <javascript><jquery><angularjs><ember.js> | 2016-01-23 23:10:13 | LQ_CLOSE |
34,970,704 | What is a fast and proper way to refresh/update plots in Bokeh (0.11) server app? | <p>I have a bokeh (v0.11) serve app that produces a scatter plot using (x,y) coordinates from a data frame. I want to add interactions such that when a user either selects points on the plot or enters the name of comma-separated points in the text box (ie. "p55, p1234"), then those points will turn red on the scatter plot. </p>
<p>I have found one way to accomplish this (Strategy #3, below) but it is terribly slow for large dataframes. I would think there is a better method. Can anyone help me out? Am I missing some obvious function call?</p>
<ul>
<li><strong>Strategy 1</strong> (<1ms for 100 points) drills into the ColumnDataSource data for the exist plot and attempts to change the selected points. </li>
<li><strong>Strategy 2</strong> (~70ms per 100 points) overwrites the plot's existing ColumnDataSource with a newly created ColumnDataSource. </li>
<li><strong>Strategy 3</strong> (~400ms per 100 points) is Strategy 2 and then it re-creates
the figure.</li>
</ul>
<p>Code is deposited on pastebin: <a href="http://pastebin.com/JvQ1UpzY">http://pastebin.com/JvQ1UpzY</a> Most relevant portion is copied below.</p>
<pre><code>def refresh_graph(self, selected_points=None, old_idxs=None, new_idxs=None):
# Strategy 1: Cherry pick current plot's source.
# Compute time for 100 points: < 1ms.
if self.strategy == 1:
t1 = datetime.now()
for idx in old_idxs:
self.graph_plot.data_source.data['color'][idx] = 'steelblue'
for idx in new_idxs:
self.graph_plot.data_source.data['color'][idx] = 'red'
print('Strategy #1 completed in {}'.format(datetime.now() - t1))
else:
t3 = datetime.now()
self.coords['color'] = 'steelblue'
self.coords.loc[selected_points, 'color'] = 'red'
new_source = bkmodels.ColumnDataSource(self.coords)
self.graph_plot = self.graph_fig.scatter('x', 'y', source=new_source, color='color', alpha=0.6)
print('Strategy #3 completed in {}'.format(datetime.now() - t3))
return
</code></pre>
<p>Ideally, I would like to be able to use <strong>Strategy #1</strong>, but it does not seem to allow the points to refresh within the client browser.</p>
<p>Thanks for any help!</p>
<p>FYI: I am using RHEL 6.X</p>
| <python><bokeh> | 2016-01-24 00:19:24 | HQ |
34,970,881 | Inject a service into an Ember Object [not an Ember Controller] | <p>I'm trying to inject an Ember service into an Ember Object but keep getting the following error:</p>
<pre><code>"Assertion Failed: Attempting to lookup an injected property on an
object without a container, ensure that the object was instantiated
via a container."
</code></pre>
<p>My code looks essentially something like the following:</p>
<pre><code>const Model = Ember.Object.extend({
store: Ember.inject.service(),
destroyRecord() {...},
serialize() {...},
deserialize() {...},
});
let newModel = Model.create();
newModel.get('store');
</code></pre>
<p><strong>Note</strong>: it does work if I inject the service into a Controller, but not an object. Haven't had any luck trying to figure out how to register the Object with the Ember container.</p>
| <ember.js> | 2016-01-24 00:42:39 | HQ |
34,970,899 | batch if, for, do sentences | I discovered while I tried to add a function with if command that I probably don't understand the real function of theese commands.
what I tried to achieve: I tried to tell the script that "if" (variable) equals to (this) then it will "SET" (this variable) to 0
how I tried to acomplish this:
i tried to acomplish this by writing: `IF %Q%==/decrypt_Delhi-Inter-Cafe-Guest set decrypt_Delhi-Inter-Cafe-Guest=0`
and as you can see... I aparently don't understand quite what I'm doing here haha
why would i want to do something like this?
well I'm mostly playing around with some few things and in order for whatever I do to work. I need to write something that can do this (sort of same waY)
heres the script itself (i removed any unneccecary lines. between those codes theres an menu and a lot of other stuff I removed. this is the only part that needs fixing.)
(sorry for my incompetence. I'm here to learn) :P I tried to google a bit and read a lot but I had no luck sadly
set encryption_Delhi-Inter_Cafe-Guest=1
set /P Q=Console:
IF %Q%==/decrypt_Delhi-Inter-Cafe-Guest set decrypt_Delhi-Inter-Cafe-Guest=0
if encryption_Delhi-Inter_Cafe-Guest=0 goto decryptedsuccess
:decryptedsuccess
echo you successfully decrypted dheli guest network
echo encryption value: %encryption_Delhi-Inter_Cafe-Guest% | <batch-file><if-statement> | 2016-01-24 00:45:42 | LQ_EDIT |
34,971,082 | Create date - Carbon in Laravel | <p>I'm starting to read about <code>Carbon</code> and can't seem to figure out how to create a <code>carbon date</code>.</p>
<p>In the docs is says you can;</p>
<blockquote>
<p><code>Carbon::createFromDate($year, $month, $day, $tz);
Carbon::createFromTime($hour, $minute, $second, $tz);
Carbon::create($year, $month, $day, $hour, $minute, $second, $tz);</code></p>
</blockquote>
<p>But what if I just recieve a <code>date</code> like <code>2016-01-23</code>? Do I have to strip out each part and feed it to <code>carbon</code> before I can create a <code>carbon</code> date? or maybe I receive <code>time</code> like <code>11:53:20</code>??</p>
<p>I'm dealing with dynamic dates and time and writing code to separate parts of time or date doesn't feel right.</p>
<p>Any help appreciated. </p>
| <php><laravel><laravel-5><php-carbon> | 2016-01-24 01:12:21 | HQ |
34,972,023 | call event function in another event function As3 | i am calling function on another function like below.
function loadXML(e:Event = null):void{
xmlData = new XML(e.target.data);
//var production:String = xmlData.production.app_id.text();
trace(xmlData);
var states:String = xmlData.state.place.text();
var desc:String = xmlData.state.description.text();
var image:String = xmlData.state.image.text();
trace('this is working');
}
obj.addEventListener(MouseEvent.MOUSE_OVER,fl_MouseOverHandler);
function fl_MouseOverHandler(event:MouseEvent):void
{
loadXML();
}
in thi s case warning occured `Cannot access a property or method of a null object reference` how do i resolve this? | <actionscript-3><flash> | 2016-01-24 03:54:03 | LQ_EDIT |
34,972,895 | Lombok.hashCode issue with "java.lang.StackOverflowError: null" | <p>I have two tables has one to one relationship as below:</p>
<pre><code>@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Book {
@Id
@GeneratedValue(strategy = GenerationType.TABLE)
private int id;
private String name;
@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "book_dtail_id")
private BookDetail bookDetail;
}
@Entity
@Table(name = "book_detail")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class BookDetail {
@Id
@GeneratedValue(strategy = GenerationType.TABLE)
private Integer id;
@Column(name = "number_of_pages")
private Integer numberOfPages;
@OneToOne(mappedBy = "bookDetail")
private Book book;
}
</code></pre>
<p>I used a Form to input data as below</p>
<pre><code>@Data
@NoArgsConstructor
@AllArgsConstructor
public class BookForm {
Book book;
BookDetail bookDetail;
}
</code></pre>
<p>The controller looks like this:</p>
<pre><code>String handleNewBook(Model model){
Book book = new Book();
BookDetail bookDetail = new BookDetail();
BookForm bookForm = new BookForm(book, bookDetail);
model.addAttribute("bookForm", bookForm);
return "index";
}
String handleSaveBookCreate(BookForm bookForm, Model model){
bookForm.getBook().setBookDetail(bookForm.getBookDetail());
bookForm.getBookDetail().setBook(bookForm.getBook());
bookService.save(bookForm.getBook()));
return "index";
}
</code></pre>
<p>Last is my form as below:</p>
<pre><code><form role="form" action="#" th:object="${bookForm}" th:action="@{/book}" method="POST">
<input type="text" th:field="*{book.name}"/>
<input type="text" th:filed="*{bookDetail} == null ? '' : *{bookDetail.numberOfPages}" placeholder="Enter Book Page Numbers"/>
<button type="submit">Submit</button>
</form>
</code></pre>
<p>everything seems no problems, but when I "bookService.save(bookForm.getBook()));" is executed, I got error as below</p>
<pre><code>java.lang.StackOverflowError: null,
at com.zangland.study.jpa.entity.BookDetail.hashCode(BookDetail.java:17) ~[classes/:na]
at com.zangland.study.jpa.entity.Book.hashCode(Book.java:16) ~[classes/:na]
at com.zangland.study.jpa.entity.BookDetail.hashCode(BookDetail.java:17) ~[classes/:na]
at com.zangland.study.jpa.entity.Book.hashCode(Book.java:16) ~[classes/:na]
</code></pre>
<p>repeat the same as above about 100 lines.... do this mean that I can't use Lombok.hashCode? </p>
<p>Saved Book: '32768','Spring JPA','32768'
Saved BookDetail: '32768','1157'</p>
| <hashcode><lombok> | 2016-01-24 06:28:12 | HQ |
34,973,432 | OkHttpClient throws exception after upgrading to OkHttp3 | <p>I'm using following lines of code to add a default header to all of my requests sent using Retrofit2:</p>
<pre><code>private static OkHttpClient defaultHttpClient = new OkHttpClient();
static {
defaultHttpClient.networkInterceptors().add(new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request().newBuilder()
.addHeader("Accept", "Application/JSON").build();
return chain.proceed(request);
}
});
}
</code></pre>
<p>After upgrading retrofit to beta-3 version, I had to upgrade OkHttp to OkHttp3 also (actually I just changed package names from okhttp to okhttp3, the library is included inside retrofit). After that I get exceptions from this line:</p>
<pre><code>defaultHttpClient.networkInterceptors().add(new Interceptor());
</code></pre>
<blockquote>
<p>Caused by: java.lang.UnsupportedOperationException
at java.util.Collections$UnmodifiableCollection.add(Collections.java:932)</p>
</blockquote>
<hr>
<blockquote>
<p>Caused by: java.lang.ExceptionInInitializerError</p>
</blockquote>
<hr>
<p>What is the problem here?</p>
| <android><retrofit><okhttp><retrofit2><okhttp3> | 2016-01-24 07:57:15 | HQ |
34,974,095 | Is it possible to install Oracle 11g server version on windows 7 non server | I want to install oracle 11g server class on my windows 7 ( NON SERVER OS).
If it is possible then what step to follow client-server installation.
plz help. | <oracle><oracle11g><windows-7> | 2016-01-24 09:25:34 | LQ_EDIT |
34,974,220 | Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in line 2 | <pre><code>$query2 = mysql_query("SELECT *from order where reservation_id = '$reservation_id' "); //query for getting the order_id
$row = mysql_fetch_assoc($query2); //this is the line that warns
echo $row['order_id']; // the value of order id
</code></pre>
<p>// anyone knows how to solve this? i keep getting warning on mysql_fetch_assoc()</p>
| <php><mysql> | 2016-01-24 09:41:32 | LQ_CLOSE |
34,974,535 | Install latest nodejs version in ubuntu 14.04 | <p>This is the way I installed <a href="https://nodejs.org/en/">nodejs</a> in ubuntu 14.04 LTS:</p>
<pre><code>sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get install nodejs
</code></pre>
<p>When I checked the node version with this:</p>
<pre><code>node -v
</code></pre>
<p>I get this</p>
<pre><code>v0.10.37
</code></pre>
<p>But the latest version is 4.2.6 and 5.5.0. How can I get the latest or update version?</p>
| <node.js><ubuntu> | 2016-01-24 10:14:19 | HQ |
34,975,572 | Why sysout allways prints 1? | <p>In below code, why sysout allways prints 1?</p>
<pre><code>public class A implements ActionListener{
public static int X = 0;
private Timer timer;
public A(){
timer = new Timer(16 ,this);
timer.setInitialDelay(16);
timer.start();
}
public void actionPerformed(ActionEvent arg0) {
System.out.println(X);
}
public static void main(String args[]){
new A();
new B().start();
}
}
class B extends Thread{
public void run(){
try {
Thread.sleep(200);
} catch (InterruptedException e) {
e.printStackTrace();
}
A.X++;
}
}
</code></pre>
<p>I expect something like this output:</p>
<pre><code>1
2
3
...
</code></pre>
<p>Note that I dont want to use another approach.</p>
| <java> | 2016-01-24 12:08:10 | LQ_CLOSE |
34,975,972 | How can I make a video from array of images in matplotlib? | <p>I have a couple of images that show how something changes in time. I visualize them as many images on the same plot with the following code:</p>
<pre><code>import matplotlib.pyplot as plt
import matplotlib.cm as cm
img = [] # some array of images
fig = plt.figure()
for i in xrange(6):
fig.add_subplot(2, 3, i + 1)
plt.imshow(img[i], cmap=cm.Greys_r)
plt.show()
</code></pre>
<p>and get something like:<a href="https://i.stack.imgur.com/QX5Jm.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/QX5Jm.jpg" alt="enter image description here"></a></p>
<p>Which is ok, but I would rather animate them to get <a href="https://kaggle2.blob.core.windows.net/competitions/kaggle/4729/media/heartbeat_cropped.mp4" rel="noreferrer">something like this video</a>. How can I achieve this with python and preferably (not necessarily) with matplotlib</p>
| <python><animation><matplotlib> | 2016-01-24 12:48:14 | HQ |
34,976,058 | Pycharm 5.0.1: Scanning files to index taking forever | <p>I am using PyCharm Community Edition 5.0.1
It was working fine till yesterday. But it has been stuck at 'Scanning files to index' for a very long time now. Since yesterday. </p>
<p>I have tried re-installing it, and also tried invalidating cache.</p>
<p>I can make changes to programs and use it as a text editor but unable to run any file. Can anyone help? Thanks.</p>
| <python><pycharm> | 2016-01-24 12:56:07 | HQ |
34,976,140 | C P.L., using goto statement for temperature conversion. Need to learn :) | #include <stdio.h>
int main() {
char choice;
float x,y;
start:
printf("[c] Converts Celsius -> Fahrenheit\n[f] Converts Fahrenheit -> Celsius\n\n\n");
printf("Enter Choice: ");
scanf("%c",&choice);
if (choice!='c' || choice!='f' || choice!='x') {
printf("Wrong Choice: Try Again!");
goto start;
} if (choice!=x)
printf("Input Value: ");
scanf("%f",&x);
if (choice =='c')
y = 1.8 * x + 32
else
y = (x-32) * (5/9)
printf("Result: %.2f",y);
exit:
return 0;
}
My instructor posted this but when I tried it, it have errors, need help to fix it :) Any help will do :)
| <c><goto><temperature> | 2016-01-24 13:06:12 | LQ_EDIT |
34,976,283 | In Ionic 2, how do I create a custom directive that uses Ionic components? | <p>Creating a basic directive is simple:</p>
<pre><code>import {Component} from 'angular2/core';
@Component({
selector: 'my-component',
template: '<div>Hello!</div>'
})
export class MyComponent {
constructor() {
}
}
</code></pre>
<p>This works as expected. However, if I want to use Ionic components in my directive things blow up.</p>
<pre><code>import {Component} from 'angular2/core';
@Component({
selector: 'my-component',
template: '<ion-list><ion-item>I am an item</ion-item></ion-list>'
})
export class MyComponent {
constructor() {
}
}
</code></pre>
<p>The directive is rendered, but Ionic components are not transformed, and so wont look/work properly.</p>
<p>I can't find any examples on this. How should I do this?</p>
| <javascript><ionic2> | 2016-01-24 13:21:06 | HQ |
34,976,385 | Ruby On Rails & Interacting with the Database | <p>How can I write SQL queries for CRUD if I don't want to use the constructors & ghost methods' concept of the Rails.
Eg. What if i want to INSERT INTO Values()
instead of using Tablename.create()...and the saving it..</p>
| <ruby-on-rails><ruby><sqlite> | 2016-01-24 13:30:36 | LQ_CLOSE |
34,977,230 | Separate form validation with Meteor | <p>I'm using <a href="https://github.com/aldeed/meteor-collection2">collection2</a> and I'm trying to get it to handle validation is a specific way. I have a profile schema which looks kind of like this:</p>
<pre><code>Schema.UserProfile = new SimpleSchema({
name: {
type: String,
optional: false
}
location: {
type: String,
optional: true
}
gender: {
type: String,
optional: false
}
});
Schema.User = new SimpleSchema({
username: {
type: String,
optional: true
},
emails: {
type: Array,
optional: true
},
"emails.$": {
type: Object
},
"emails.$.address": {
type: String,
regEx: SimpleSchema.RegEx.Email
},
"emails.$.verified": {
type: Boolean
},
createdAt: {
type: Date
},
profile: {
type: Schema.UserProfile,
optional: true
},
services: {
type: Object,
optional: true,
blackbox: true
},
roles: {
type: [String],
optional: true
},
heartbeat: {
type: Date,
optional: true
}
});
Meteor.users.attachSchema(Schema.User);
</code></pre>
<p>Now, on my registration form I'm requiring the user to select their gender and then later once they log in, users are presented with a separate form asking for their name and location. Here's the problem:</p>
<p>The registration form works and everything goes through with saving. When they try to save the internal form with location and name though I get an error:</p>
<pre><code>Error invoking Method 'updateProfile': Gender is required [400]
</code></pre>
<p>I know it's happening because it's required in the schema but I've already obtained this information. How do I not require that? Or do I set up validation per form?</p>
| <meteor><meteor-collection2><simple-schema> | 2016-01-24 14:56:49 | HQ |
34,977,381 | Append each data frame iteratively into a larger data frame R | I did search for this and linking to entries here:
http://stackoverflow.com/questions/22053090/appending-multiple-files-into-a-data-frame-using-r
http://stackoverflow.com/questions/22053090/appending-multiple-files-into-a-data-frame-using-r
http://stackoverflow.com/questions/12162278/appending-column-to-a-data-frame-r
But they don't answer my question.
Code:
for (i in 1:nrow(files.df)) {
Final <- parser(as.character(files.df[i,]))
Final2 <- rbind(Final2,Final)
}
files.df contains over 30 filenames (read from a directory using list.files) which is then passed to a custom function parser which returns a dataframe holding over 100 lines (number varies from one file to the next). Both Final and Final2 are initialised with NA outside the for loop. The script runs fine with rbind but its a semantic issue - the resulting output is not what I expect. The resulting dataframe is a lot smaller than the files combined.
I am certain it has to do with the rbind bit.
Any thoughts would be great! Would be good if I can stick to the data frame structure. | <r><dataframe><pivot-table> | 2016-01-24 15:10:29 | LQ_EDIT |
34,977,789 | Cannot change visual studio code settings | <p>I try to change visual studio code settings but I cannot edit anything. What should I do ? I want to set encoding to </p>
<pre><code>"files.encoding": "ISO 8859-1",
</code></pre>
| <visual-studio-code> | 2016-01-24 15:47:44 | HQ |
34,978,182 | a code for checking leap year and counting no of days in a month in python | this is my code:
def cal(month):
if month in ['January', 'march','may','july','august','oct','dec']:
print ("this month has 31 days")
elif month in ['april','june','sept','nov']:
print ("this month has 30 days")
elif month == 'feb' and leap(year)== True:
print ("this month has 29 days")
elif month == 'feb' and leap(year) == False:
print ("this month has 28 days")
else:
print ("invalid input")
def leap(year):
if (year % 4== 0) or (year % 400 == 0):
print ("its a leap year!")
else:
print ("is not a leap year")
year = int(input('type a year: '))
print ('you typed in :' , year)
month = str(input('type a month: '))
print ('you typed in :', month)
cal(month)
leap(year)
o/p:
type a year: 2013
you typed in : 2013
type a month: feb
you typed in : feb
is not a leap year
is not a leap year
invalid input
is not a leap year
why am i not getting the output for count of days in feb if it is a 28 day month or 29?
why am i getting the invalid input part even though its an else?
Help is appreciated.
Thanks.
| <python><if-statement> | 2016-01-24 16:20:22 | LQ_EDIT |
34,978,828 | Uncaught ReflectionException: Class log does not exist Laravel 5.2 | <p>I am currently trying to clone an existing project of mine from github. After clone I run <code>composer install</code> during the process I receive the following error:</p>
<p><code>Uncaught ReflectionException: Class log does not exist</code></p>
<p>I am running Laravel 5.2 on Centos 7. </p>
<p>I have seen references to: </p>
<ul>
<li>Removing spaces within the <code>.env</code> file. </li>
<li>Removing the vendor directory & re-installing</li>
<li>Removing certain packages required in composer.json </li>
</ul>
<p>I have: </p>
<ul>
<li>Replaced my <code>.env</code> with the <code>example.env</code> to avoid any custom config errors. </li>
<li>I have removed & re-cloned the repo. </li>
<li>I have used the default <code>composer.json</code> shipped with Laravel to see if that makes a difference. </li>
</ul>
<p>None of the above have brought me any joy. I also have the same environment set up on another machine with the application working fine. The only difference here is the machine (working) wasn't cloned from git - it was the initial build environment. </p>
<p>The stack trace I am receiving: </p>
<pre><code>PHP Fatal error: Uncaught ReflectionException: Class log does not exist in /var/www/html/Acme/vendor/laravel/framework/src/Illuminate/Container/Container.php:736
Stack trace:
#0 /var/www/html/Acme/vendor/laravel/framework/src/Illuminate/Container/Container.php(736): ReflectionClass->__construct('log')
#1 /var/www/html/Acme/vendor/laravel/framework/src/Illuminate/Container/Container.php(631): Illuminate\Container\Container->build('log', Array)
#2 /var/www/html/Acme/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(674): Illuminate\Container\Container->make('log', Array)
#3 /var/www/html/Acme/vendor/laravel/framework/src/Illuminate/Container/Container.php(845): Illuminate\Foundation\Application->make('log')
#4 /var/www/html/Acme/vendor/laravel/framework/src/Illuminate/Container/Container.php(800): Illuminate\Container\Container->resolveClass(Object(ReflectionParameter))
#5 /var/www/html/Acme/vendor/laravel/framework/src/Illuminate/Container/Container.php(769): Illuminate\Container\Container->getDependenc in /var/www/html/Acme/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 736
</code></pre>
<p>Any help would be much appreciated. Thanks in advance. </p>
| <php><laravel><centos7><laravel-5.2> | 2016-01-24 17:12:30 | HQ |
34,978,960 | Making a simple page responsive through CSS | <p>I am using a simple half bootstrap / half designed by somebody login template. Now it opens just as it should through the web browser:</p>
<p><a href="https://i.stack.imgur.com/lKZNP.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lKZNP.jpg" alt="enter image description here"></a></p>
<p>But when I open it through my mobile device it loads this way:</p>
<p><a href="https://i.stack.imgur.com/Jhvsl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Jhvsl.png" alt="enter image description here"></a></p>
<p>And I want it to open in a close-up way like that:</p>
<p><a href="https://i.stack.imgur.com/D0YbC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/D0YbC.png" alt="enter image description here"></a></p>
<p>Now here are my html and css:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>body {
background: #eee !important;
}
.form-signin {
max-width: 380px;
padding: 15px 35px 30px;
margin: 20px auto;
background-color: #fff;
border: 1px round rgba(0, 0, 0, 0.1);
}
.form-signin .checkbox {
margin-bottom: 30px;
}
.form-signin .checkbox {
font-weight: normal;
}
.form-signin .form-control {
position: relative;
font-size: 16px;
height: auto;
padding: 10px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.form-signin .form-control:focus {
z-index: 2;
}
.form-signin input[type="text"] {
margin-bottom: -1px;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
.form-signin input[type="password"] {
margin-bottom: 20px;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.form-signin-heading {
color: #777;
}
.social-box{
margin: 0 auto;
padding: 20px 38px 0 38px;
}
.social-box a{
font-weight:bold;
font-size:18px;
padding:8px;
}
.social-box a i{
font-weight:bold;
font-size:20px;
}
.newborder {
border-bottom: 1px #ccc solid;
margin-top: 30px;
margin-bottom: 30px;
}
.omb_loginOr {
position: relative;
font-size: 1.5em;
color: #aaa;
margin-top: 1.5em;
margin-bottom: 2.2em;
padding-top: 0.5em;
padding-bottom: 0.5em;
}
.omb_loginOr .omb_hrOr {
background-color: #cdcdcd;
height: 1px;
margin-top: 0 !important;
margin-bottom: 0 !important;
}
.omb_loginOr .omb_spanOr {
display: block;
position: absolute;
left: 50%;
top: -0.3em;
margin-left: -1.5em;
background-color: white;
width: 3em;
text-align: center;
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html >
<head>
<meta charset="UTF-8">
<title>Bootstrap Snippet: Login Form</title>
<link rel="stylesheet" href="css/lstyle.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="container">
<div class="form-signin">
<form>
<h2 class="form-signin-heading text-center"><i class="fa fa-tint fa-fw"></i>Hello</h2>
<div class="social-box">
<div class="row mg-btm">
<div class="col-md-12">
<a href="#" class="btn btn-primary btn-block">
<i class="fa fa-facebook fa-fw"></i> Log in
</a>
</div>
</div>
</div>
<div class="newborder"></div>
<input type="text" class="form-control" name="username" placeholder="E-mail" required="" autofocus="" />
<input type="password" class="form-control" name="password" placeholder="Password" required=""/>
<label class="checkbox text-right">
<input type="checkbox" value="remember-me" id="rememberMe" name="rememberMe"> Remember me
</label>
<button class="btn btn-lg btn-info btn-block" type="submit">Log in</button>
</form>
<div class="row omb_loginOr ">
<hr class="omb_hrOr">
<span class="omb_spanOr">or</span>
</div>
<form>
<div class="alert alert-info"><p>No registration?</p></div>
<input type="text" class="form-control" name="username" placeholder="E-mail" required="" autofocus="" />
<input type="password" class="form-control" name="password" placeholder="Password required=""/>
<button class="btn btn-lg btn-info btn-block" type="submit">Register me & log in</button>
</form>
</div>
</div>
</body>
</html></code></pre>
</div>
</div>
</p>
<p>Huge thanks in advance!</p>
| <html><css> | 2016-01-24 17:22:35 | LQ_CLOSE |
34,979,139 | String Encoding Python 2.7 | I have a non-literal string that is programmatically obtained from the title of a printed document online:
"wxPython: Windows Styles and Events Hunter « The Mouse Vs. The Python" # retrieved string
I am trying to put it in to a database which does not accept non-ASCII characters and it always throws exceptions every attempt I make to `encode` and `decode` with `UTF-8` encoding. Any suggestions? | <python><string><python-2.7><unicode><utf-8> | 2016-01-24 17:42:00 | LQ_EDIT |
34,979,411 | I got error when i was installing django.Pls Help me? | >>> import django
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named django
>>>
[enter image description here][1]
[1]: http://i.stack.imgur.com/OveNv.png | <python><django><django-templates> | 2016-01-24 18:05:29 | LQ_EDIT |
34,979,522 | NotificationManager getActiveNotifications() for older devices | <p>I want to be able to get active notifications from my Android app on demand. (actually I just need to know if there are any)
I've been searching for this behavior and it seems, like I have only two options: <code>NotificationManager.getActiveNotifications()</code> which is exactly what I need, but is only available from SDK 23 or using a <code>NotificationService</code> but I really dislike this solution as I have to provide the permission to my app to read all notifications which is definitely an overkill. </p>
<p>Does anybody know about any solution which would behave like <code>NotificationManager.getActiveNotifications()</code> and not require SDK >= 23?</p>
<p>Thanks in advance!</p>
| <android><notifications><notificationmanager> | 2016-01-24 18:15:05 | HQ |
34,980,144 | Difference between lambda and LINQ? | <p>Can someone explain me the difference between lambda and linq?</p>
<p>Please don't point me out to other stackexchange answers or trivial explanations, I've checked most of them and they're orribly confusing.</p>
<p>I've used a bit of LINQ (I believe?) in these days with expressions like (merely an invented example)</p>
<pre><code>var result = object.Where(e => e.objectParameter > 5).Any()
</code></pre>
<p>Which, should return in result a boolean which says if there is any element >5.</p>
<p>Ok, then, what are LINQ and lambda?</p>
<p>Is LINQ just a library, a set of functions, developed by C# team to include with</p>
<pre><code>using System.Linq;
</code></pre>
<p>which gives you a powered "for loop" with many methods to avoid you getting your hands "dirty"? (First, FirstOrDefault, Any.... etc)</p>
<p>And what is Lambda? Is the same as above? It's a language on it's own? What is it and how it differs from LINQ? How do I recognize one or another?</p>
<p>Thanks</p>
| <c#><linq><lambda> | 2016-01-24 19:08:39 | HQ |
34,980,253 | I write this code but I need to use a function in order to get a return instead printing the output | """A catering company has hired you to help with organizing and preparing customer's orders. You are given a list of each customer's desired items, and must write a program that will count the number of each items needed for the chefs to prepare. The items that a customer can order are: salad, hamburger, and water.
Write a function called item_order that takes as input a string named order. The string contains only words for the items the customer can order separated by one space. The function returns a string that counts the number of each item and consolidates them in the following order: salad:[# salad] hamburger:[# hambruger] water:[# water]
If an order does not contain an item, then the count for that item is 0. Notice that each item is formatted as [name of the item][a colon symbol][count of the item] and all item groups are separated by a space.
For example:
•If order = "salad water hamburger salad hamburger" then the function returns "salad:2 hamburger:2 water:1"
•If order = "hamburger water hamburger" then the function returns "salad:0 hamburger:2 water:1" """
s = '"hamburger water hamburger water salad "'
#The value of s will be received by the user only with the options in s
subs = 'salad'
count =0
flag=True
start=0
while flag:
a = s.find(subs,start)
if a==-1:
flag=False
else:
count+=1
start=a+1
if count==0:
salad="salad:0"
else:
b=str(count)
c=subs+':'
salad=c+b
subs = 'water'
count =0
flag=True
start=0
while flag:
a = s.find(subs,start)
if a==-1:
flag=False
else:
count+=1
start=a+1
if count==0:
water="water:0"
else:
b=str(count)
c=subs+':'
water=c+b
subs = 'hamburger'
count =0
flag=True
start=0
while flag:
a = s.find(subs,start)
if a==-1:
flag=False
else:
count+=1
start=a+1
if count==0:
hamburger="hamburger:0"
else:
b=str(count)
c=subs+':'
hamburger=c+b
print salad,hamburger,water | <python> | 2016-01-24 19:18:01 | LQ_EDIT |
34,980,308 | How many is too many for create dispatch_queues in GCD (grand central dispatch)? | <p>There is a wonderful article about a lightweight notification system built in Swift, by Mike Ash: (<a href="https://www.mikeash.com/pyblog/friday-qa-2015-01-23-lets-build-swift-notifications.html" rel="noreferrer">https://www.mikeash.com/pyblog/friday-qa-2015-01-23-lets-build-swift-notifications.html</a>).</p>
<p>The basic idea is you create objects that you can "listen" to i.e. invoke a callback on when there is some state change. To make it thread-safe, each object created holds its own dispatch_queue. The dispatch_queue is simply used to gate critical sections:</p>
<pre><code>dispatch_sync(self.myQueue) {
// modify critical state in self
}
</code></pre>
<p>and moreover it likely won't be in high contention. I was kind of struck by the fact that <em>every</em> single object you create that can be listened to makes its own dispatch queue, just for the purposes of locking a few lines of code.</p>
<p>One poster suggested an OS_SPINLOCK would be faster and cheaper; maybe, but it would certainly use a lot less space.</p>
<p>If my program creates hundreds or thousands (or even tens of thousands of objects) should I worry about creating so many dispatch queues? Probably most won't ever even be listened to, but some might.</p>
<p>It certainly makes sense that two objects not block each other, i.e. have separate locks, and normally I wouldn't think twice about embedding, say, a pthread_mutex in each object, but an entire dispatch queue? is that really ok?</p>
| <multithreading><grand-central-dispatch> | 2016-01-24 19:22:11 | HQ |
34,980,465 | Way to break out of an inner For loop in Swift | <p>Is there a simple way to break out of an inner For loop, i.e. a Fro loop within another For loop? Without having to set additional flags for example</p>
| <swift><for-loop> | 2016-01-24 19:34:39 | HQ |
34,980,618 | can somebody help me understand this more. javascript selection |
var select = document.getElementById('select');
var opsArray= select.options;
select.onchange = userSelection;
function userSelection(){
var i = select.selectedIndex;
document.location.assign('projects/' + opsArray[i].value + '/');
}
so i know that when the user select the page they want it will go there. what i want is for somebody to enplane this to me, this is the part of JavaScript that i am confused with. so if i just had a block menu instead of a select menu, how will this code go with that. well basically how do that "userSlection/opsArray[i].value" work......i know how to do this in html ""folder/aboutpage/this.index"". but how do that code above work?? thanks in avances. | <javascript><jquery><javascript-objects> | 2016-01-24 19:47:32 | LQ_EDIT |
34,981,341 | two trees and a joint table between them | i have three tables, 2 hierarchical and 1 junction between these.
Teams
id idParent
1 null
2 1
3 null
4 null
5 4
Projects
id idParent
1 null
2 null
3 2
4 2
5 null
TeamProjects
idTeam idProject
2 2
3 1
5 5
A project always depend on at least one team, this is what teamprojects is for.
The result i'm trying to achieve : for each of the object (both teams and projects), i want to know what are the ascendant and descendant objects (id concatened)
idObject ascendantTeams descendantTeam ascendantProjects descendantProjects
1 2 7, 10
2 1 7
3 6
4
5 4 10
6 3
7 2 8, 9
8 2 7
9 2 7
10 5
I am trying to achieve this with a linq to entities query, but i need both CTE (for the recursive part) and (stuff-for-xml) for the concatenation part... and neither translate to linq to entities.
so i'm trying to make a view to help, but i dont manage to write the sql for it either.
how would you resolve this, either with linq to entities or sql ? | <sql-server><entity-framework><linq><tsql><entity-framework-6> | 2016-01-24 20:55:16 | LQ_EDIT |
34,981,745 | Taskkill /PID not working in GitBash | <p>I'm trying to kill a process on GitBash on Windows10 using the taskkill command. However, I get the following error:</p>
<pre><code>$ taskkill /pid 13588
ERROR: Invalid argument/option - 'C:/Program Files/Git/pid'.
Type "TASKKILL /?" for usage.
</code></pre>
<p>it works fine on cmd. Can anyone help?</p>
| <bash><git-bash> | 2016-01-24 21:30:49 | HQ |
34,984,212 | How can I set the UIColor of a UIBezierPath in Swift? | <p>Let's say I have something like this in Objective-C</p>
<pre><code> - (void)drawRect:(CGRect)rect {
if (1 < [_points count]) {
UIBezierPath *path = [UIBezierPath bezierPath];
[path setLineWidth:3.];
MyPoint *point = _points[0];
[path moveToPoint:point.where];
NSTimeInterval now = [NSDate timeIntervalSinceReferenceDate];
for (int i = 1; i < (int)_points.count; ++i) {
point = _points[i];
[path addLineToPoint:point.where];
float alpha = 1;
if (1 < now - point.when) {
alpha = 1 - MIN(1, now - (1+point.when));
}
[[UIColor colorWithWhite:0 alpha:alpha] set]; //THIS LINE
[path stroke];
path = [UIBezierPath bezierPath];
[path setLineWidth:3.];
[path moveToPoint:point.where];
}
}
}
</code></pre>
<p>How would I do the following line <code>[[UIColor colorWithWhite:0 alpha:alpha] set];</code> in Swift?</p>
| <objective-c><swift><uibezierpath> | 2016-01-25 02:25:08 | LQ_CLOSE |
34,984,647 | Sudoku Checker Program C | <p>I'm trying to complete a sudoku solution checker program in c. I'm still trying to understand the steps in building this program before I start coding it. I found this example online <a href="http://practicecprogram.blogspot.com/2014/10/c-program-to-find-out-if-solved-sudoku.html" rel="nofollow">http://practicecprogram.blogspot.com/2014/10/c-program-to-find-out-if-solved-sudoku.html</a></p>
<p>There are a few questions I still don't understand.</p>
<p>1 For my program I am given a text file with the first number being a number that says how many sets of sudoku solutions it contains. I am almost understanding how to check just one solution but having to do it for N solutions and making the program work for multiple sudoku solutions confuses me. Especially in making my 2d arrays for the values. My ouput is supposed to only be Yes or No on a new line for however many N sets.</p>
<p>2 Is checking that all rows and columns have sums of 45 and that the values are >0, <10 enough to prove that the solution is valid? I'm assuming since every puzzle only has one solution I don't have to check each 3x3 grid to make it doesn't contain duplicates if each row and column sum to 45.</p>
| <c><arrays><multidimensional-array><sudoku> | 2016-01-25 03:32:00 | LQ_CLOSE |
34,984,820 | How to generate offline Swagger API docs? | <p>I have a spring boot MVC java Web app. I've been able to integrate Springfox for API documentation. I can visually see all of the APIs when server is up and running. </p>
<p>How can I generate OFFLINE swagger API documentation? Note: I would not like to use asciidoc or markdown documentation, but I'd like the same swagger API user interface in html files. I'd like so that the links are relative to local directory instead of local host server links. Thanks</p>
| <java><spring-mvc><spring-boot><swagger><springfox> | 2016-01-25 03:55:16 | HQ |
34,985,282 | Incompatible types : String cannot be converted to int error in java | <p>I've checked my codes many times but not seeing any error in lines. But It shows <code>incompatible types: string cannot be converted to int</code> in the package name. I've tried copying all codes in new package also but still seeing the same error. What was the exact problem. Here is my error screenshot
<a href="http://i.stack.imgur.com/Rdxnu.png" rel="nofollow">Error</a></p>
| <java> | 2016-01-25 04:45:27 | LQ_CLOSE |
34,985,284 | How to get all Airlines from DBpedia in Asia | <p>I'm just learning querying DBpedia. How would look query to return all Airline companies located in Asia that have income greater than X and are used by Y passengers.</p>
| <sparql><dbpedia> | 2016-01-25 04:45:54 | LQ_CLOSE |
34,985,620 | Confusion on ruby local variables when calling methods and method invocation variables |
a = 5 # variable is initialized in the outer scope
3.times do |n|
a = 3 # is a accessible here, in an inner scope?
end
puts a
What is the value of a when it is printed to the screen?
mind you times is a method invocation, there is inner scope created here.
The value of a is 3. This is because a is available to the inner scope created by 3.times do ... end, which allowed the code to re-assign the value of a. In fact, it re-assigned it three times to 3.
why is this different than above? because we bring in a variable but it doesn't
change the local variable?! maybe because its a method? I don't know?
But you guys can compare above example with the one below.
a = 5
def adder(num)
num = 3
end
adder a # 3
puts a # 5
why is a 5 and not 3? | <ruby> | 2016-01-25 05:19:04 | LQ_EDIT |
34,985,713 | How to perform Undo(remove last entered string) and Redo(add it back) Operations on Strings ? ( using Core Java data structures ) | How to perform Undo(remove last entered string) and Redo(add it back) Operations on Strings ? ( using Core Java data structures ) .
This was an interview question,which expected , creating our own pool of strings (asking for number of strings and strings from user)
UNDO : removing last string from
Redo : Adding it back | <java><string> | 2016-01-25 05:30:07 | LQ_EDIT |
34,985,889 | How to get the zoom level from the leaflet map in R/shiny? | <p>I create a map using leaflet package in Shiny which have a <code>selectInput</code> to allow user to select from a site list. The site list also adds into leaflet as markers.</p>
<p>When user selects a new site, I want to recenter map into the selected site without change the zoom level. The <code>setView</code> function can be called to set center points, but has to specify the zoom level. </p>
<p>Is it possible to get the zoom level of leaflet map which can be used in the <code>setView</code> function?</p>
<p>This is a minimum example to play with my question with reset zoom level.</p>
<pre><code>library(shiny)
library(leaflet)
df <- data.frame(
site = c('S1', 'S2'),
lng = c(140, 120),
lat = c(-20, -30),
stringsAsFactors = FALSE)
# Define UI for application that draws a histogram
ui <- shinyUI(fluidPage(
selectInput('site', 'Site', df$site),
leafletOutput('map')
))
server <- shinyServer(function(input, output, session) {
output$map <- renderLeaflet({
leaflet() %>%
addTiles() %>%
setView(lng = 133, lat = -25, zoom = 4) %>%
addMarkers(lng = df$lng, lat = df$lat)
})
observe({
req(input$site)
sel_site <- df[df$site == input$site,]
isolate({
leafletProxy('map') %>%
setView(lng = sel_site$lng, lat = sel_site$lat, zoom = 4)
})
})
})
shinyApp(ui = ui, server = server)
</code></pre>
<p>PS: when you play with these codes, please adjust zoom level before selecting a new site.</p>
<p>Thanks of any suggestions.</p>
| <r><shiny><leaflet> | 2016-01-25 05:46:56 | HQ |
34,985,939 | How is multiple User Interface or Views achieved in Chrome App AND How do i connect to MySQL from the Chrome App | I have a web portal developed with Php and MySQL. I want to create a desktop app to work to connect to the Database through the internet. I have two huge challenges
1. Chrome App doesn't navigate from page to page like a website does so HOW DO I ACHIEVE MULTIPKE USER INTERFACES OR VIEWS
2. IndexedDB is not suitable for my app, HOW DO I CONNECT TO MYSQL DATABASE ONLINE
NB: I am only a bigginner ! | <php><mysql><interface><navigation><google-chrome-app> | 2016-01-25 05:51:10 | LQ_EDIT |
34,987,978 | Deloyment failed in aws beanstalk, getting 502 error | Everything worked in my local, I googled few questions, all have to do with port problem. But since I'm using express, I think I will not have hardcoded port problem, as you can see below is partially the code in
www
var port = normalizePort(process.env.PORT || '3000');
app.set('port', port);
I have a app.js and below is my package.json
{
"name": "my app",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
..
..
}
}
What I've tried :
1. rename app.js to main.js
2. created nodecommand.config file like someone suggested
| <node.js><amazon-web-services><express><amazon-elastic-beanstalk> | 2016-01-25 08:23:57 | LQ_EDIT |
34,988,163 | Linux - Check if a file has multiple lines | <p>Is there a command or bash function to check if a file has multiple lines?
Lets say i have these two files:</p>
<p><strong>foo.txt</strong></p>
<pre><code>Hello World
</code></pre>
<p><strong>bar.txt</strong></p>
<pre><code>Hello
World
</code></pre>
| <linux><bash> | 2016-01-25 08:36:28 | LQ_CLOSE |
34,988,593 | How to get the count of # data rows in .csv file in R using nrow() function | <p>I have a data file (data.csv file) in my working directory. The first row of my file has column names. I want to count all the rows in my .csv file (excluding the first row) using the nrow() function. Size of the file is 4kb on disk, otherwise 2.83 kb
Thanks
Jyoti</p>
| <r> | 2016-01-25 09:03:04 | LQ_CLOSE |
34,989,182 | need a sql query for this can any one suggest two join simultaneously | Table Product
Id name t1 t2
1 A 1 4
2 B 5 2
3 C 3 1
4 D 4 5
Tan Table
id tan
1 tanA
2 tanB
3 tanC
4 tanD
5 tanE
I have two above table and i want the result as below in expecting result how it is possible please assist
Expecting result
A tanA tanD
B tanE tanB
C tanC tanA
D tanD tanE | <sql> | 2016-01-25 09:35:18 | LQ_EDIT |
34,989,915 | Write only, read only fields in django rest framework | <p>I have models like this:</p>
<pre><code>class ModelA(models.Model):
name = models.CharField()
class ModelB(models.Model):
f1 = models.CharField()
model_a = models.ForeignKey(ModelA)
</code></pre>
<p>Serializers:</p>
<pre><code>class ASerializer(serializers.ModelSerializer):
model_b_ids = serializers.CharField()
class Meta:
model = ModelA
write_only_fields = ('model_b_ids',)
</code></pre>
<p>views:</p>
<pre><code>class AView(CreateModelMixin, GenericViewSet):
def perform_create(self, serializer):
model_b_ids = parse_somehow(serializer.validated_data["model_b_ids"])
#do something...
</code></pre>
<p>The problem I am getting is the with the "model_b_ids"</p>
<p>The user should submit it while sending post data.</p>
<p>I use it in perform_create to link to related models. </p>
<p>But thats not "real column" in ModelA so when I try to save it is raising exception.</p>
<p>I tried to it pop from validated_data but then again getting error somewhere that cannot read model_b_ids from model. Any idea on using this kind of field correctly ?</p>
| <django><django-rest-framework> | 2016-01-25 10:11:26 | HQ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.