Id int64 34.6M 60.5M | Title stringlengths 15 150 | Body stringlengths 33 36.7k | Tags stringlengths 3 112 | CreationDate stringdate 2016-01-01 00:21:59 2020-02-29 17:55:56 | Y stringclasses 3 values |
|---|---|---|---|---|---|
39,910,543 | Returning address of local variable and program still work | <p>Lets say this is the snapshot I want to talk about. In this code, main function calls 'foo' which returns address of locally declared variable 'a'. I was under the impression that locally declared variables de-allocates the memory when they go out of scope. Variable 'a' should be de-allocated after call to foo is done and there should not be anything left related to 'a'. But in this case, it seems to be breaking that basic assumption. What is going on underneath?</p>
<pre><code>int* foo() {
int a = 5;
return &a;
}
int main() {
int* p = foo();
// Prints 5
std::cout << "Coming from foo = " << *p << std::endl;
*p = 8;
// Prints 8
std::cout << "Setting explicitly = " << *p << std::endl;
}
</code></pre>
| <c++> | 2016-10-07 06:10:03 | LQ_CLOSE |
39,910,832 | Set text color using data binding on Android | <p>I'm trying to set <code>TextView</code> text color using data binding library</p>
<pre><code>android:textColor="@{holder.getTitleColor(context, item)}"
</code></pre>
<p>where the method in <code>Holder</code> class is defined like below</p>
<pre><code>public int getTitleColor(Context context, Item item) {
...
}
</code></pre>
<p>No matter if I return color int (<code>@ColorInt</code>) or color resource (<code>@ColorRes</code>) it paints the text solid white. What am I doing wrong?</p>
| <android><android-databinding> | 2016-10-07 06:32:30 | HQ |
39,911,319 | Xamarin: Error CS0118: `SessionsManager.Create()' is a `method group' but a `type' was expected (CS0118) | I have this error message. I'm creating a Xamarin.ios table view app. If anyone can help me thanks in advanced.
public partial class SessionsViewController : UITableViewController
{
public SessionsViewController (IntPtr handle) : base (handle)
{
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
var sessionManager = new SessionsManager.Create();// receive the error here.
TableView.Source = new SessionsTableViewSource(sessionManager.Sessions);
}
}
---------------------------------------------------------------------------
public class SessionsManager
{
private static SessionsManager _instance = null;
public SessionData[] Sessions;
public static SessionsManager Create()
{
if (_instance == null) _instance = new SessionsManager();
return _instance;
}
internal SessionsManager()
{
SessionData[] sessions = new SessionData[5] {
new Data("1", "Title1", "speaker1", "desc1", DateTime.Today, true),
new Data("2", "Title2", "speaker2", "desc2", DateTime.Today, false),
new Data("3", "Title3", "speaker3", "desc3", DateTime.Today, false),
new Data("4", "Title4", "speaker4", "desc4", DateTime.Today, true),
new Data("5", "Title5", "speaker5", "desc5", DateTime.Today, true)
};
| <c#><xamarin> | 2016-10-07 07:02:50 | LQ_EDIT |
39,911,474 | How to implement view always visible and fixed in MainActivity above fragments? | How to implement view always visible and fixed in MainActivity above fragments? I also need it when the fragment is replaced, not only when add fragment.
Thank u!
Dave | <java><android><android-activity><view><fragment> | 2016-10-07 07:12:10 | LQ_EDIT |
39,911,480 | How to create Wordpress theme like | <p>How to create WordPress theme like this websites
one for govt jobs and another for show images slide </p>
<p><a href="http://www.indiangovtjobs.in" rel="nofollow">www.indiangovtjobs.in</a></p>
<p><a href="http://www.imgcluster.com" rel="nofollow">www.imgcluster.com</a></p>
| <wordpress> | 2016-10-07 07:12:27 | LQ_CLOSE |
39,911,636 | SQLiteDatabase error:near "in1": syntax error | I have click First button this time show error in1
<br>I have put the = in the query some error near "=": syntax error like this how to solve it .
<br>In this query i have use String Builder for concat to multiple string
public List<People> getPeople(String category_id) {
List<People> peoples = new ArrayList<>();
try {
SQLiteDatabase db = SQLiteDatabase.openDatabase(DB_PATH + DB_NAME, null, SQLiteDatabase.OPEN_READWRITE);
StringBuilder sb = new StringBuilder();
sb.append(",");
Cursor cursor = db.rawQuery("select * from people where category_id in"+(category_id + sb + category_id), null);
while (cursor.moveToNext()) {
String peopleName = cursor.getString(cursor.getColumnIndex(PEOPLE_NAME));
String peopleImage = cursor.getString(cursor.getColumnIndex(PEOPLE_IMAGE));
People people = new People();
people.setPeopleName(peopleName);
people.setPeopleImage(peopleImage);
peoples.add(people);
}
} catch (Exception e) {
Log.d("DB", e.getMessage());
}
return peoples;
} | <java><android><sqlite><android-sqlite> | 2016-10-07 07:21:38 | LQ_EDIT |
39,911,899 | delete the item on search box if clicked. | I am trying to built a dropdown menu with a text box.When the text box is clicked the items appear and when the items are clicked they turn green(selected) and show up in the text box.
I was wondering if there was a way in which i could just click the item on the search box and the item gets unselected(ungreen). How can i capture the click on the element name in the text box.!.[enter image description here][1]
[1]: http://i.stack.imgur.com/YKEOQ.png | <javascript><angularjs><dom> | 2016-10-07 07:36:24 | LQ_EDIT |
39,912,501 | Ios objective c progress bar update in background | Ive ran various types of code to try and make a progress bar increment for x seconds and continue to do so even when in background. Currently the bar just resumes from where it left off via the timer when going from background to focus.
How can I continue the timer even when the user minimizes the app?
Many thanks! | <ios><objective-c><xcode><timer><progress> | 2016-10-07 08:10:09 | LQ_EDIT |
39,913,194 | VSTS 2015 Current user-issues in using features of VSTS 2015 | Issues using features of VSTS 2015 where if two users are connected to same VM(work station) concurrently and trying to access Visual studio 2015 (work station Name : DevBOX).
could you please explain that if 2 users are accessing same VM concurrently and trying to access Visual studio 2015 at same time with single license how it really works? | <visual-studio-2015> | 2016-10-07 08:49:22 | LQ_EDIT |
39,913,850 | I want to stroed data of client side slider in temporary using javascript | 1. I have using one slider from client side that slider containing 4
question n question having 4 option of the answer.
2. user have select any one from them n go to next question.
3. i want to that user selected answer in temporarily stored in some where using javascript.
4. Please help me how to create the javascript for that.end
sorry for my english language.
------------------------------------------------------------------------
[enter image description here][1][enter image description here][2]
[1]: http://i.stack.imgur.com/qYNE7.png
[2]: http://i.stack.imgur.com/4I1lJ.png
**code:**
<div class='home' style="background-color: #e4ceb4 !important">
<section class='start-invest'>
<div class='wrapper'>
<div class='unslider' data-unslider='true' id='unslider' style='display:none;'>
<ul class='nolist'>
<li>
<div class='slide-counter'>
<div class='inner-d'>
<span>1/4</span>
</div>
</div>
<!-- 1 -->
<div class='hide' data-slide-no='1'></div>
<div class='start-heading'>Start your Investment Plan</div>
<!-- For Mobile -->
<div class='slider-nav'>
<span>1</span>/4
</div>
<div class='age-income'>
I am
<input autocomplete='off' autofocus class='age' id='age' maxlength='2' placeholder='' tabindex='1' type='text'>
years old &
<br class='br'>
earn
<br class='break'>a
Gross annual income
<br class='br'>of
<i class='fa fa-inr'></i>
<input class='income' id='income' maxlength='13' placeholder='' tabindex='2' type='text'>
</div>
<div class='cta-next'>
<button class='btn' id='next-btn' tabindex='3'>
Next
</button>
</div>
</li>
<li>
<div class='slide-counter'>
<div class='inner-d'>
<span>2/4</span>
</div>
</div>
<!-- 2 -->
<div class='hide' data-slide-no='2'></div>
<div class='start-heading'>Start your Investment Plan</div>
<!-- For Mobile -->
<div class='slider-nav'>
<span>2</span>/4
</div>
<div class='age-income'>
How long do you intend
<br class='br'>to
remain invested?
</div>
<div class='btn-set' id="Opt1">
<button id="Opt5" name="button" type="submit" class="wh-btn optn-btn risk-by-time-btns" data-risk-factor="10.5" value="1 to 3 yrs">1 to 3 yrs</button>
<button id="Opt2" name="button" type="submit" class="wh-btn optn-btn risk-by-time-btns" data-risk-factor="24.5" value="3 to 5 yrs">3 to 5 yrs</button>
<button id="Opt3" name="button" type="submit" class="wh-btn optn-btn risk-by-time-btns" data-risk-factor="28" value="5 to 7 yrs">5 to 7 yrs</button>
<button id="Opt4" name="button" type="submit" class="wh-btn optn-btn risk-by-time-btns" data-risk-factor="31.5" value="Greater than 7 yrs">Greater than 7 yrs</button>
</div>
</li>
<li>
<div class='slide-counter'>
<div class='inner-d'>
<span>3/4</span>
</div>
</div>
<!-- 3 -->
<div class='hide' data-slide-no='3'></div>
<div class='start-heading'>Start your Investment Plan</div>
<!-- For Mobile -->
<div class='slider-nav'>
<span>3</span>/4
</div>
<div class='age-income'>
What are you looking at from your
<br class='br'>investment?
</div>
<div class='btn-set'>
<button name="button" type="submit" class="wh-btn optn-btn goal-btns" data-risk-factor="10.5">
Safety
<br class='br'>
<span class='tip'>I prioritise safety of my principal at the top and expect to achieve returns that equal inflation</span>
</button><button name="button" type="submit" class="wh-btn optn-btn lg goal-btns" data-risk-factor="17.5">
Safety +
<br class='br-lg'>
Moderate Growth
<br class='br'>
<span class='tip'>While I would like to protect my principal, I will be happy with returns that beat inflation</span>
</button><button name="button" type="submit" class="wh-btn optn-btn goal-btns" data-risk-factor="26.25">
Growth
<br class='br'>
<span class='tip'>I seek to grow my capital in line with the stock market performance over a longer period of time while being able to accept short term volatilities</span>
</button><button name="button" type="submit" class="wh-btn optn-btn goal-btns lg" data-risk-factor="31.5">
Aggressive
<br class='br-lg'>
Growth
<br class='br'>
<span class='tip'>I would like to take the stock market returns and beat them hands down with my portfolio performance! I will digest the volatility that accompanies my style</span>
</button>
</div>
</li>
<li id='risk-buttons'>
<div class='slide-counter'>
<div class='inner-d'>
<span>4/4</span>
</div>
</div>
<!-- 4 -->
<div class='hide' data-slide-no='4'></div>
<div class='start-heading'>Start your Investment Plan</div>
<!-- For Mobile -->
<div class='slider-nav'>
<span>4</span>/4
</div>
<div class='age-income'>
How do you rate yourself
<br class='br'>
on Risk Tolerance?
<sup>*</sup>
</div>
<!-- For Mobile -->
<div class='risk-sm'>
* Risk tolerance is an important component in investing. An individual should have a realistic understanding of
<br class='br-lg'>
his or her ability and willingness to stomach large swings in the value of his or her investments.
</div>
<div class='btn-set'>
<button name="button" type="submit" class="wh-btn sure risk-willingness-btns" data-risk-factor="3">
Very Low
<span class='tip'>I cannot tolerate any loss</span>
</button><button name="button" type="submit" class="wh-btn sure risk-willingness-btns" data-risk-factor="6">
Low
<span class='tip'>I can tolerate up to 5% loss in a short term dip</span>
</button><button name="button" type="submit" class="wh-btn sure risk-willingness-btns" data-risk-factor="9">
Medium
<span class='tip'>I can tolerate up to a 10% loss in a short term dip</span>
</button><button name="button" type="submit" class="wh-btn sure risk-willingness-btns" data-risk-factor="11.25">
High
<span class='tip'>I can tolerate up to a 25% loss in a short term dip</span>
</button><button name="button" type="submit" class="wh-btn sure risk-willingness-btns" id="very_high_tolerance" data-risk-factor="13.5">
Very High
<span class='tip'>I can tolerate greater than 25% loss in a short term dip</span>
</button><button name="button" type="submit" class="wh-btn unsure risk-willingness-btns" data-risk-factor="0">
Unsure
<span class='tip'></span>
</button>
</div>
<div class='cta hide' id='okay-cta'>
<small>Still unsure? Answer a few more questions for us!</small>
<br>
<button class='btn' id='okay-btn'>OKAY</button>
</div>
<div class='cta hide' id='compute-cta'>
<button class='btncompute btn compute' id="compute" onclick=" Progressbar()">COMPUTE</button><div>
</div>
</div>
<!-- For Desktop -->
<div class='risk-lg'>
* Risk tolerance is an important component in investing. An individual should have a realistic understanding of
<br class='br-lg'>
his or her ability and willingness to stomach large swings in the value of his or her investments.
</div>
</li>
<!-- 4.1 -->
<li>
<div class='slide-counter'>
<div class='inner-d'>
<span>
4.1 /
<br>4.4</br>
</span>
</div>
</div>
<div class='hide' data-slide-no='5'></div>
<div class='start-heading'>Start your Investment Plan</div>
<!-- For Mobile -->
<div class='slider-nav'>
<span>4</span>/4
</div>
<div class='age-income'>
By how much would your investments need
<br class='break'>
to go down to cause you discomfort?
</div>
<div class='btn-set'>
<button name="button" type="submit" class="wh-btn optn-btn investment-fall-threshold-btns" data-risk-factor="0.75">
Any fall
</button><button name="button" type="submit" class="wh-btn optn-btn investment-fall-threshold-btns" data-risk-factor="1.5">
By 10%
</button><button name="button" type="submit" class="wh-btn optn-btn investment-fall-threshold-btns" data-risk-factor="2.25">
By 25%
</button><button name="button" type="submit" class="wh-btn optn-btn investment-fall-threshold-btns" data-risk-factor="3.375">
By more than 25%
</button>
</div>
</li>
<!-- 4.2 -->
<li>
<div class='slide-counter'>
<div class='inner-d'>
<span>
4.2 /
<br>4.4</br>
</span>
</div>
</div>
<div class='hide' data-slide-no='6'></div>
<div class='start-heading'>Start your Investment Plan</div>
<!-- For Mobile -->
<div class='slider-nav'>
<span>4</span>/4
</div>
<div class='age-income'>
While making investments, what do you care for most?
</div>
<div class='btn-set'>
<button name="button" type="submit" class="wh-btn optn-btn lg investment-care-btns" data-risk-factor="0.75">
Minimizing Losses
</button><button name="button" type="submit" class="wh-btn optn-btn lg investment-care-btns" data-risk-factor="1.875">
Both Equally
</button><button name="button" type="submit" class="wh-btn optn-btn lg investment-care-btns" data-risk-factor="3.375">
Maximising Gains
</button>
</div>
</li>
<!-- 4.3 -->
<li>
<div class='slide-counter'>
<div class='inner-d'>
<span>
4.3 /
<br>4.4</br>
</span>
</div>
</div>
<div class='hide' data-slide-no='7'></div>
<div class='start-heading'>Start your Investment Plan</div>
<!-- For Mobile -->
<div class='slider-nav'>
<span>4</span>/4
</div>
<div class='age-income'>
While deciding between two jobs,
<br class='break'>
which will you go for?
</div>
<div class='btn-set'>
<button name="button" type="submit" class="wh-btn optn-btn lg job-choice-btns" data-risk-factor="0.75">
The one with high job security
<br class='break'>
and low pay increase
</br>
</button><button name="button" type="submit" class="wh-btn optn-btn lg job-choice-btns" data-risk-factor="1.875">
Can't say as it depends on
<br class='break'>
other factors as well
</br>
</button><button name="button" type="submit" class="wh-btn optn-btn lg job-choice-btns" data-risk-factor="3.375">
The one with less job security
<br class='break'>
but high pay increase
</br>
</button>
</div>
</li>
<!-- 4.4t -->
<li>
<div class='slide-counter'>
<div class='inner-d'>
<span>
4.4 /
<br>4.4</br>
</span>
</div>
</div>
<div class='hide' data-slide-no='8'></div>
<div class='start-heading'>Start your Investment Plan</div>
<!-- For Mobile -->
<div class='slider-nav'>
<span>4</span>/4
</div>
<div class='age-income'>
How do you rate your willingness to take investment
<br class='break'>
risks relative to the general population?
</div>
<div class='btn-set'>
<button name="button" type="submit" class="wh-btn relative-risk-willingness-btns" data-risk-factor="0.75">
Very Low
<br class='break risk-rel-pop'>
Risk-taker
</br>
</button><button name="button" type="submit" class="wh-btn relative-risk-willingness-btns" data-risk-factor="1.5">
Low
<br class='break risk-rel-pop'>
Risk-taker
</br>
</button><button name="button" type="submit" class="wh-btn relative-risk-willingness-btns" data-risk-factor="2.25">
Medium
<br class='break risk-rel-pop'>
Risk-taker
</br>
</button><button name="button" type="submit" class="wh-btn relative-risk-willingness-btns" data-risk-factor="2.8125">
High
<br class='break risk-rel-pop'>
Risk-taker
</br>
</button><button name="button" type="submit" class="wh-btn relative-risk-willingness-btns" data-risk-factor="3.375">
Very High
<br class='break risk-rel-pop'>
Risk-taker
</br>
</button>
</div>
<div class='cta'>
<button class='btn compute hide btncompute' onclick=" Progressbar()" id="compute">COMPUTE</button>
</div>
</li>
</ul>
<a class="unslider-arrow next tooltip" href="#">
<span class='error-message'>
ZAPP!
<br>
Please pick an
<br>
option before we
<br>
move ahead.
</span>
<span class='error-message-input'></span>
</a><a class="unslider-arrow prev" href="#"></a>
</div>
</div>
</section>
<div class='hide' id='progress'>
<div class='wrapper of-hidden'>
<div class='orange-text'></div>
<div class='white-text'></div>
<div class="safari chart" data-percent="100" style="align-content: center ;margin-left: auto; margin-right: auto; width: 6em">
<img class="tag" src="~/Image/spinner.gif" style="align-content: center ;margin-left: auto; margin-right: auto; width: 6em" />
</div>
</div>
</div>
</div> | <javascript><asp.net-mvc-4> | 2016-10-07 09:24:29 | LQ_EDIT |
39,914,057 | jQuery and replace does not work in IE | I want to replace all dimensions 375x270 and 250x180 with 750x1280 in this code-snippet:
<img class="j-webview-product-image" imgsrc="
https://image.jimcdn.com/app/cms/image/transf/dimension=375x270:format=jpg/path/sbcfc830c2d85c206/image/i547767095dfc0c2d/version/1475157973/image.jpg 375w,
https://image.jimcdn.com/app/cms/image/transf/dimension=250x180:format=jpg/path/sbcfc830c2d85c206/image/i547767095dfc0c2d/version/1475157973/image.jpg 250w"
sizes="(max-width: 480px) 100vw, 250px" src="
https://image.jimcdn.com/app/cms/image/transf/dimension=250x180:format=jpg/path/sbcfc830c2d85c206/image/i547767095dfc0c2d/version/1475157973/image.jpg"
alt="" title="" data-pin-nopin="true">
Here´s my fiddle: http://jsfiddle.net/andreaszeike/rtywrt9k/4/
- the code works well on all browsers except IE...
Thank´s for your suggestions! BR, az
| <javascript><jquery><replace> | 2016-10-07 09:35:31 | LQ_EDIT |
39,915,069 | Linux sh Script for files older than | I have a backup of mysql databases and backup file is with time and date in name, like this daily_amavisd_2016-10-01_05h28m_Saturday.sql.gz daily_amavisd_2016-10-02_05h28m_Sunday.sql.gz daily_amavisd_2016-10-03_05h28m_Monday.sql.gz
So I need a script to check if the oldest file in folder /backup/amavisd/daily is not older than one week. If it is older than one week it gives me status "backup failed" if it is not older than 1 week than gives me status "backup OK"
Can someone help me with sh script for that?
| <shell> | 2016-10-07 10:26:02 | LQ_EDIT |
39,915,818 | WARNING as java.io.EOFException when ActiveMQ starts | <p>am trying to start the ActiveMQ 5.11 and I see a <code>WARNING</code> as below:</p>
<pre><code> WARN | Transport Connection to: tcp://127.0.0.1:40890 failed: java.io.EOFException
</code></pre>
<p>My <code>activemq.xml</code> is as below:</p>
<pre><code><transportConnectors>
<transportConnector name="openwire" uri="tcp://0.0.0.0:${JMS_PORT}" />
<transportConnector name="stomp" uri="stomp://0.0.0.0:${JMS_STOMP_PORT}"/>
<transportConnector name="ssl" uri="ssl://0.0.0.0:${JMS_SSL_PORT}"/>
</transportConnectors>
<sslContext>
<sslContext
keyStore="file:${JMS_KEY_STORE}"
keyStorePassword="${JMS_KEY_STORE_PASSWORD}"
trustStore="file:${JMS_TRUST_STORE}"
trustStorePassword="${JMS_TRUST_STORE_PASSWORD}"
/>
</sslContext>
<networkConnectors>
<networkConnector
name="host1 and host2"
uri="static://(${JMS_X_SITE_CSV_URL})?wireFormat=ssl&amp;wireFormat.maxInactivityDuration=30000"
dynamicOnly="true"
suppressDuplicateQueueSubscriptions = "true"
networkTTL="1"
/>
</networkConnectors>
</code></pre>
<p>Here is the entire console log for this.</p>
<pre><code>Java Runtime: Oracle Corporation 1.7.0_05 /usr/java/jdk1.7.0_05/jre
Heap sizes: current=1004928k free=994439k max=1004928k
JVM args: -Xmx1G -Dorg.apache.activemq.UseDedicatedTaskRunner=true -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/home/dragon/activemq/conf/login.config -Dcom.sun.management.jmxremote -Djava.io.tmpdir=/home/dragon/activemq/tmp -Dactivemq.classpath=/home/dragon/activemq/conf; -Dactivemq.home=/home/dragon/activemq -Dactivemq.base=/home/dragon/activemq -Dactivemq.conf=/home/dragon/activemq/conf -Dactivemq.data=/home/dragon/activemq/data
Extensions classpath:
[/home/dragon/activemq/lib,/home/dragon/activemq/lib/camel,/home/dragon/activemq/lib/optional,/home/dragon/activemq/lib/web,/home/dragon/activemq/lib/extra]
ACTIVEMQ_HOME: /home/dragon/activemq
ACTIVEMQ_BASE: /home/dragon/activemq
ACTIVEMQ_CONF: /home/dragon/activemq/conf
ACTIVEMQ_DATA: /home/dragon/activemq/data
Loading message broker from: xbean:activemq.xml
INFO | Refreshing org.apache.activemq.xbean.XBeanBrokerFactory$1@a842913: startup date [Fri Oct 07 08:14:02 IST 2016]; root of context hierarchy
INFO | PListStore:[/home/dragon/activemq/data/divinedragonbox/tmp_storage] started
INFO | Using Persistence Adapter: KahaDBPersistenceAdapter[/home/dragon/jms_store]
INFO | JMX consoles can connect to service:jmx:rmi:///jndi/rmi://localhost:15526/jmxrmi
INFO | KahaDB is version 5
INFO | Recovering from the journal ...
INFO | Recovery replayed 76 operations from the journal in 0.032 seconds.
INFO | Apache ActiveMQ 5.11.1 (divinedragonbox, ID:divinedragonbox-60914-1475824445361-0:1) is starting
INFO | Listening for connections at: tcp://divinedragonbox:15511
INFO | Connector openwire started
INFO | Listening for connections at: stomp://divinedragonbox:15512
INFO | Connector stomp started
INFO | Listening for connections at: ssl://divinedragonbox:15571
INFO | Connector ssl started
INFO | Establishing network connection from vm://divinedragonbox?async=false&network=true to ssl://localhost:15571
INFO | Connector vm://divinedragonbox started
INFO | Network Connector DiscoveryNetworkConnector:host1 and host2:BrokerService[divinedragonbox] started
INFO | Apache ActiveMQ 5.11.1 (divinedragonbox, ID:divinedragonbox-60914-1475824445361-0:1) started
INFO | For help or more information please see: http://activemq.apache.org
INFO | divinedragonbox Shutting down
INFO | Connector vm://divinedragonbox stopped
INFO | divinedragonbox bridge to Unknown stopped
WARN | Transport Connection to: tcp://127.0.0.1:40890 failed: java.io.EOFException
INFO | ActiveMQ WebConsole available at http://localhost:15521/
INFO | Initializing Spring FrameworkServlet 'dispatcher'
INFO | jolokia-agent: No access restrictor found at classpath:/jolokia-access.xml, access to all MBeans is allowed
</code></pre>
<p>I enabled the TRACE for the messages and I got the following snippets of exceptions in the log file.</p>
<pre><code>2016-10-07 08:15:45,378 | TRACE | Execute[ActiveMQ ForwardingBridge StopTask] runnable: org.apache.activemq.network.DemandForwardingBridgeSupport$4@b3f451d | org.apache.activemq.thread.TaskRunnerFactory | ActiveMQ BrokerService[divinedragonbox] Task-4
2016-10-07 08:15:45,378 | TRACE | Created and running thread[ActiveMQ ForwardingBridge StopTask-5]: Thread[ActiveMQ ForwardingBridge StopTask-5,5,main] | org.apache.activemq.thread.TaskRunnerFactory | ActiveMQ BrokerService[divinedragonbox] Task-4
2016-10-07 08:15:45,379 | DEBUG | Caught exception sending shutdown | org.apache.activemq.network.DemandForwardingBridgeSupport | ActiveMQ ForwardingBridge StopTask-5
org.apache.activemq.transport.TransportDisposedIOException: Transport disposed.
at org.apache.activemq.transport.vm.VMTransport.oneway(VMTransport.java:82)[activemq-broker-5.11.1.jar:5.11.1]
at org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:68)[activemq-client-5.11.1.jar:5.11.1]
at org.apache.activemq.transport.ResponseCorrelator.oneway(ResponseCorrelator.java:60)[activemq-client-5.11.1.jar:5.11.1]
at org.apache.activemq.network.DemandForwardingBridgeSupport$4.run(DemandForwardingBridgeSupport.java:288)[activemq-broker-5.11.1.jar:5.11.1]
at java.lang.Thread.run(Thread.java:722)[:1.7.0_05]
2016-10-07 08:15:45,380 | DEBUG | Stopping transport ssl://localhost/127.0.0.1:15571 | org.apache.activemq.transport.tcp.TcpTransport | ActiveMQ BrokerService[divinedragonbox] Task-4
2016-10-07 08:15:45,381 | DEBUG | Initialized TaskRunnerFactory[ActiveMQ Task] using ExecutorService: null | org.apache.activemq.thread.TaskRunnerFactory | ActiveMQ BrokerService[divinedragonbox] Task-4
2016-10-07 08:15:45,381 | TRACE | Execute[ActiveMQ Task] runnable: org.apache.activemq.transport.tcp.TcpTransport$1@a1848dc | org.apache.activemq.thread.TaskRunnerFactory | ActiveMQ BrokerService[divinedragonbox] Task-4
2016-10-07 08:15:45,381 | TRACE | Created and running thread[ActiveMQ Task-1]: Thread[ActiveMQ Task-1,5,main] | org.apache.activemq.thread.TaskRunnerFactory | ActiveMQ BrokerService[divinedragonbox] Task-4
2016-10-07 08:15:45,382 | TRACE | Closing socket 2a9a5d77[TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA: Socket[addr=localhost/127.0.0.1,port=15571,localport=40999]] | org.apache.activemq.transport.tcp.TcpTransport | ActiveMQ Task-1
2016-10-07 08:15:45,383 | DEBUG | Closed socket 2a9a5d77[TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA: Socket[addr=localhost/127.0.0.1,port=15571,localport=40999]] | org.apache.activemq.transport.tcp.TcpTransport | ActiveMQ Task-1
2016-10-07 08:15:45,384 | INFO | divinedragonbox bridge to Unknown stopped | org.apache.activemq.network.DemandForwardingBridgeSupport | ActiveMQ BrokerService[divinedragonbox] Task-4
2016-10-07 08:15:45,384 | TRACE | serviceLocalException: disposed true ex | org.apache.activemq.network.DemandForwardingBridgeSupport | ActiveMQ BrokerService[divinedragonbox] Task-4
org.apache.activemq.transport.TransportDisposedIOException: peer (vm://divinedragonbox#1) stopped.
at org.apache.activemq.transport.vm.VMTransport.stop(VMTransport.java:207)[activemq-broker-5.11.1.jar:5.11.1]
at org.apache.activemq.transport.TransportFilter.stop(TransportFilter.java:65)[activemq-client-5.11.1.jar:5.11.1]
at org.apache.activemq.transport.TransportFilter.stop(TransportFilter.java:65)[activemq-client-5.11.1.jar:5.11.1]
at org.apache.activemq.transport.ResponseCorrelator.stop(ResponseCorrelator.java:132)[activemq-client-5.11.1.jar:5.11.1]
at org.apache.activemq.broker.TransportConnection.doStop(TransportConnection.java:1151)[activemq-broker-5.11.1.jar:5.11.1]
at org.apache.activemq.broker.TransportConnection$4.run(TransportConnection.java:1117)[activemq-broker-5.11.1.jar:5.11.1]
at java.lang.Thread.run(Thread.java:722)[:1.7.0_05]
2016-10-07 08:15:45,384 | DEBUG | Stopped transport: vm://divinedragonbox#0 | org.apache.activemq.broker.TransportConnection | ActiveMQ BrokerService[divinedragonbox] Task-4
2016-10-07 08:15:45,384 | TRACE | Shutdown timeout: 1 task: Transport Connection to: vm://divinedragonbox#0 | org.apache.activemq.thread.DedicatedTaskRunner | ActiveMQ BrokerService[divinedragonbox] Task-4
2016-10-07 08:15:45,385 | TRACE | Run task done: Transport Connection to: vm://divinedragonbox#0 | org.apache.activemq.thread.DedicatedTaskRunner | ActiveMQ Connection Dispatcher: vm://divinedragonbox#0
2016-10-07 08:15:45,385 | DEBUG | Connection Stopped: vm://divinedragonbox#0 | org.apache.activemq.broker.TransportConnection | ActiveMQ BrokerService[divinedragonbox] Task-4
2016-10-07 08:15:45,385 | TRACE | Shutdown of ExecutorService: java.util.concurrent.ThreadPoolExecutor@dfe196a[Running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0] with await termination: 0 millis | org.apache.activemq.util.ThreadPoolUtils | ActiveMQ Transport: ssl:///127.0.0.1:40999
2016-10-07 08:15:45,385 | DEBUG | Shutting down VM connectors for broker: divinedragonbox | org.apache.activemq.transport.vm.VMTransportFactory | triggerStartAsyncNetworkBridgeCreation: remoteBroker=ssl://localhost/127.0.0.1:15571, localBroker= vm://divinedragonbox#0
2016-10-07 08:15:45,385 | INFO | Connector vm://divinedragonbox stopped | org.apache.activemq.broker.TransportConnector | triggerStartAsyncNetworkBridgeCreation: remoteBroker=ssl://localhost/127.0.0.1:15571, localBroker= vm://divinedragonbox#0
2016-10-07 08:15:45,400 | DEBUG | Shutdown of ExecutorService: java.util.concurrent.ThreadPoolExecutor@dfe196a[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0] is shutdown: true and terminated: true took: 0.001 seconds. | org.apache.activemq.util.ThreadPoolUtils | ActiveMQ Transport: ssl:///127.0.0.1:40999
2016-10-07 08:15:45,400 | DEBUG | Transport Connection to: tcp://127.0.0.1:40999 failed: java.io.EOFException | org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ Transport: ssl:///127.0.0.1:40999
java.io.EOFException
at java.io.DataInputStream.readInt(DataInputStream.java:392)[:1.7.0_05]
at org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:258)[activemq-client-5.11.1.jar:5.11.1]
at org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:221)[activemq-client-5.11.1.jar:5.11.1]
at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:213)[activemq-client-5.11.1.jar:5.11.1]
at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:196)[activemq-client-5.11.1.jar:5.11.1]
at java.lang.Thread.run(Thread.java:722)[:1.7.0_05]
2016-10-07 08:15:45,401 | DEBUG | Unregistering MBean org.apache.activemq:type=Broker,brokerName=divinedragonbox,connector=clientConnectors,connectorName=ssl,connectionViewType=remoteAddress,connectionName=tcp_//127.0.0.1_40999 | org.apache.activemq.broker.jmx.ManagementContext | ActiveMQ Transport: ssl:///127.0.0.1:40999
2016-10-07 08:15:45,401 | TRACE | Execute[ActiveMQ BrokerService[divinedragonbox] Task] runnable: org.apache.activemq.broker.TransportConnection$4@5039f4d3 | org.apache.activemq.thread.TaskRunnerFactory | ActiveMQ Transport: ssl:///127.0.0.1:40999
2016-10-07 08:15:45,401 | TRACE | Created and running thread[ActiveMQ BrokerService[divinedragonbox] Task-6]: Thread[ActiveMQ BrokerService[divinedragonbox] Task-6,8,main] | org.apache.activemq.thread.TaskRunnerFactory | ActiveMQ Transport: ssl:///127.0.0.1:40999
</code></pre>
<blockquote>
<p>Can somebody tell me why are these exceptions thrown?</p>
</blockquote>
<p>I can provide the entire log file if anybody needs for a deeper look.</p>
| <java><activemq><messagebroker><broker> | 2016-10-07 11:10:55 | HQ |
39,916,021 | Does retrieving a parcelable object through bundle always create new copy? | <p>I'm passing a parcelable object to a fragment by adding into a bundle while creating the fragment. In onc instance modification to this parcelled object reflects modification in original object and in another case it is not. I'm a little baffled by this behaviour.
Till now I have assumed retrieving a parcelled objects through a bundle always create new object[no sure whether it's shallow copy or deep copy]. </p>
<p>Someone please clarify parcelable behaviour. </p>
| <android><android-fragments><parcelable><android-bundle> | 2016-10-07 11:23:15 | HQ |
39,917,132 | Maven compile fails on unneeded dependency of dependency | I am attempting to compile my maven project, and I am depending on another project (which is a jar file). For some reason, when I attempt to compile I get the following error which seems to be that my project can not access the required dependencies of the project I'm depending on, even though I don't use any of those dependencies.
Here is the error http://hastebin.com/pebolozuxi.sql
I know that I can easily depend on that required dependency to solve the issue, however I don't see why that would be necessary so I wish to solve this issue without taking that route, if possible.
Thanks! | <java><eclipse> | 2016-10-07 12:17:59 | LQ_EDIT |
39,917,867 | Uncaught Reference Error - $ is not defined + JQuery not defined | <p>I have been struggling to understand the errors on this page. Can someone help me and show me how to fix this page.</p>
<p><a href="https://www.caternow.com.au/richmond-3121-caterers/Fabulous-Catering" rel="nofollow">https://www.caternow.com.au/richmond-3121-caterers/Fabulous-Catering</a></p>
<p>It doesn't load properly and gives following error.</p>
<ul>
<li>Uncaught Reference Error - $ is not defined </li>
<li>Uncaught Reference Error - JQuery is not defined </li>
</ul>
<p>While the same code and same css/js works fine at below test site.</p>
<p><a href="http://cater2.tecexperts.com/richmond-3121-caterers/Fabulous-Catering" rel="nofollow">http://cater2.tecexperts.com/richmond-3121-caterers/Fabulous-Catering</a></p>
<p>Any help is appreciated.</p>
<p>Thanks,
DK</p>
| <javascript><jquery><html><css><ajax> | 2016-10-07 12:56:45 | LQ_CLOSE |
39,918,570 | I have written code for Broadcast Receiver that toasts when an SMS is received, and it's not working can anyone rectify the mistake? | This is the MainActivity.java
package tagit.aj.com.broadcastreceiverforsms;
import android.content.Intent;
import android.content.IntentFilter;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
This the MyReceiver class which includes the broadcast receiver's onReceive method. One of the methods used here is "deprecated" but I assume it does not creates any problem in testing.
package tagit.aj.com.broadcastreceiverforsms;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.SmsMessage;
import android.util.Log;
import android.widget.Toast;
public class MyReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
Toast.makeText(context,"IncomingSms",Toast.LENGTH_SHORT).show();
// Retrieves a map of extended data from the intent.
final Bundle bundle = intent.getExtras();
try {
if (bundle != null) {
Object[] pdus = (Object[]) bundle.get("pdus");
for (int i = 0; i < pdus.length; i++) {
SmsMessage messages = SmsMessage.createFromPdu((byte[]) pdus[i]);
String phoneNumber = messages.getDisplayOriginatingAddress();
String phone = phoneNumber;
String stringMessage = messages.getDisplayMessageBody();
int duration = Toast.LENGTH_LONG;
Log.i("Broadcasting", "Number" + phone + "Message" + stringMessage);
Toast toast = Toast.makeText(context, "senderNum: " + phone + ", message: " + stringMessage, duration);
toast.show();
} // end for loop
} // bundle is null
} catch (Exception e) {
Log.e("SmsReceiver", "Exception smsReceiver" + e);
}
}
}
The XML layout is
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="tagit.aj.com.broadcastreceiverforsms.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!" />
</RelativeLayout>
And the AndroidManifest file is:-
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="tagit.aj.com.broadcastreceiverforsms">
<uses-permission android:name="android.permission.RECEIVE_SMS"></uses-permission>
<uses-permission android:name="android.permission.READ_SMS"></uses-permission>
<uses-permission android:name="android.permission.SEND_SMS"></uses-permission>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name=".MyReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED"></action>
</intent-filter>
</receiver>
</application>
</manifest>
Please provide me with why this problem is occurring. and solution (if any). And i'm running this app in Android KitKat | <android><broadcastreceiver><sms> | 2016-10-07 13:34:17 | LQ_EDIT |
39,919,793 | tslint-loader with webpack 2.1.0-beta.25 | <p>I have an angular2 Project that I compress/compile with webpack.</p>
<p>I use tslink loader with webpack so I have tslint related configuration in <code>webpack.config.js</code>.</p>
<pre><code>module.exports = {
...
tslint: {
configuration: {
rules: {
quotemark: [true, "double"]
}
},
// tslint errors are displayed by default as warnings
// set emitErrors to true to display them as errors
emitErrors: false,
// tslint does not interrupt the compilation by default
// if you want any file with tslint errors to fail
// set failOnHint to true
failOnHint: true,
// name of your formatter (optional)
formatter: "",
// path to directory containing formatter (optional)
formattersDirectory: "node_modules/tslint-loader/formatters/",
// These options are useful if you want to save output to files
// for your continuous integration server
fileOutput: {
// The directory where each file"s report is saved
dir: "./webpack-log/",
// The extension to use for each report"s filename. Defaults to "txt"
ext: "xml",
// If true, all files are removed from the report directory at the beginning of run
clean: true,
// A string to include at the top of every report file.
// Useful for some report formats.
header: "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<checkstyle version=\"5.7\">",
// A string to include at the bottom of every report file.
// Useful for some report formats.
footer: "</checkstyle>"
}
},
...
preLoaders: [
{
test: /\.ts$/,
loader: "tslint"
}
],
}
}
</code></pre>
<p>I updated webpack 1.13.1 to 2.1.0-beta.25 and tslint configuration breaks the complication process of <code>npm run build</code>.</p>
<p>I changed the <code>preLoaders</code> directive to <code>loaders</code></p>
<pre><code>module: {
....
{
test: /\.ts$/,
loader: 'tslint',
exclude: /(node_modules)/,
enforce: 'pre'
},
],
}
</code></pre>
<p>that's not enough cause I still get the error </p>
<pre><code>For loader options: webpack 2 no longer allows custom properties in configuration.
Loaders should be updated to allow passing options via loader options in module.rules.
</code></pre>
<p>so I should move the tslint configuration and place it somewhere else. kinda lost here. so any information regarding the issue would be greatly appreciated.</p>
<p>thanks!</p>
| <typescript><webpack><tslint><webpack-2> | 2016-10-07 14:33:51 | HQ |
39,919,967 | If a user inputs a 4 digit int, how do I use an array to extract each digit? | <p>I'm creating a very basic encryption program, and I'm stuck. Essentially the user inputs a 4 digit int using a scanner and my goal is to, encrypt each digit, using a set formula. But i can't figure out how to, extract each digit and insert it into the formula. if anyone knows the simplest way of doing so, id really appreciate it. </p>
| <java><arrays><arraylist><java.util.scanner> | 2016-10-07 14:41:59 | LQ_CLOSE |
39,920,284 | Is it possible to run command of cmd using php? | <p>Is it possible to run cmd command using php? i.e: I can see ip configuration as follows:
step1: open cmd
step2: run ipconfig/all</p>
<p>If I want to do this using php as like below what should I do:
I will input ipconfig/all in a text field then click a button named 'RUN' then I will get ip configuration as like as cmd command results.</p>
| <php><cmd> | 2016-10-07 14:58:58 | LQ_CLOSE |
39,920,394 | Change coding in java script function | <p>I have never seen it, but is there a way to modify the existing java script function through the code? Something similar to "ALTER PROCEDURE..." statement in SQL Server? </p>
<p>Thank you!</p>
| <javascript> | 2016-10-07 15:04:03 | LQ_CLOSE |
39,920,452 | jquery ajax submit callback get this closet | <pre><code>$(document).on('click', '#file-submit', function () {
$.ajax({
url: url,
type: 'POST',
cache: false,
data: formData,
processData: false,
contentType: false
}).done(function (data, status, jqxhr) {
//here will be get a error
var nextId = $(this).parents('.tab-pane').next().attr("id");
alert(nextId);
}).fail(function (data, status, jqxhr) {
console.log("error");
});
})
</code></pre>
<p>threr is a button in page, when the page submited,
i will get the value in the form element,
but the i cant get,
please give some point ,thanks.</p>
| <jquery> | 2016-10-07 15:06:49 | LQ_CLOSE |
39,920,461 | How do I click a link with javascript? | <p>How do I click this using JavaScript?</p>
<p>The "a" only have href and only id on the "div"</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code><div id="id">
<a href="link">
</a>
</div></code></pre>
</div>
</div>
</p>
| <javascript> | 2016-10-07 15:07:25 | LQ_CLOSE |
39,920,992 | Rebase remote branch onto master while keeping the remote branch updated | <p>I am trying to rebase my remote branch onto master, but I want to keep the remote branch pointing to it's commits, just based at a different point in master.</p>
<p>Here is my structure:</p>
<pre><code>A - B - C - D (origin/master)
\
R - S - T (origin/develop)
</code></pre>
<p>I would like:</p>
<pre><code>A - B - C - D (origin/master) - R - S - T (origin/develop)
</code></pre>
<p>Is such a rebase possible without some sort of merge?</p>
| <git><rebase><git-remote> | 2016-10-07 15:34:52 | HQ |
39,921,087 | a = open("file", "r"); a.readline() output without \n | <p>I am about to write a python script, that is able to read a txt file, but with readline() there is always the \n output. How can i remove this from the variable ? </p>
<pre><code>a = open("file", "r")
b = a.readline()
a.close()
</code></pre>
| <python> | 2016-10-07 15:40:39 | HQ |
39,921,694 | How to add randomness to the blink effect? | <p>JS</p>
<pre><code> <script>
(function blink() {
$('.demo').fadeOut(500).fadeIn(400, blink);
})();
</script>
</code></pre>
<p>CSS</p>
<pre><code>.demo {
background: url('../res/logo.png') no-repeat;
width: 200px;
height: 200px;
margin-top: 355px;
margin-left: 855px;
}
</code></pre>
<p>How do i add randomness to this blinking effect?</p>
| <javascript><jquery><css> | 2016-10-07 16:13:03 | LQ_CLOSE |
39,921,722 | Ethereum Mist mongo db port | After Running the **Ethereum Mist,** I can't connect the *mongodb* use the Robomongo 0.9.0-RC10(https://robomongo.org).
Anyone tell me mongodb's port!
| <mongodb><port><ethereum> | 2016-10-07 16:14:36 | LQ_EDIT |
39,922,072 | How to return the correct info from a Javascript loop | Good day all, i was creating this javascript quiz app and i have some bugs where i can't figure out.
it displays correctly, but where the error is, is at the output which is supposed to return "You answered (no of questions answered) out of (total number of questions). Here it just displays 0 if when the value is true.
Below is my script.
thanks
<script>
var pos = 0, test, test_status, question, choice, choices, chA, chB, chC, correct = 0;
var questions = [
["What is 10 + 4?", "12", "14", "16", "B"],
["What is 10 + 5?", "15", "14", "16", "A"],
["What is 20 + 4?", "12", "24", "16", "B"],
["What is 30 + 4?", "32", "24", "34", "C"],
["What is 10 + 6?", "12", "14", "16", "C"]
];
function _(x) {
return document.getElementById(x);
}
function renderQuestion() {
test = _("test");
if(pos >= questions.length) {
test.innerHTML = "<h2>You got "+ correct +" of "+questions.length+" Questions correct</h2>";
_("test_status").innerHTML = "Test Completed";
pos = 0;
correct = 0;
return false;
}
_("test_status").innerHTML = "Question "+(pos+1)+" of "+questions.length;
question = questions[pos][0];
chA = questions[pos][1];
chB = questions[pos][2];
chC = questions[pos][3];
test.innerHTML = "<h3>"+question+"</h3>";
test.innerHTML +="<input type='radio' name='chioces' value='A'> "+chA+"<br>";
test.innerHTML +="<input type='radio' name='chioces' value='B'> "+chB+"<br>";
test.innerHTML +="<input type='radio' name='chioces' value='C'> "+chC+"<br>";
test.innerHTML += "<button onclick='checkAnswer()'>Submit Answer</button>";
}
function checkAnswer() {
choices = document.getElementsByName("choices");
for(var i=0; i<choices.length; i++) {
if(choices[i].checked) {
choice = choices[i].value;
}
}
if (choice == questions[pos][4]) {
correct++;
}
pos++;
renderQuestion();
}
window.addEventListener("load", renderQuestion, false);
</script> | <javascript><html> | 2016-10-07 16:35:07 | LQ_EDIT |
39,923,362 | Finding the 2nd Max value in R data table | <p>I have a data table that has a int column that is counting the iteration of a test that I've preformed. So the first time I preformed the test, <code>Table$Column == 1</code> and the second time <code>Table$Column == 2</code> and so on and so forth.</p>
<p>However, there are times when a test breaks or I don't want to use the results from a particular test run. I have code that compares the current run vs. the previous run that looks like this.</p>
<pre><code>vLatest<-max(Table$Column)
vPrevious<-max(Table$Column)-1
</code></pre>
<p>But since I sometimes omit results, it breaks vPrevious. How could I replace the "-1" with a function that finds the "2nd" max value?</p>
| <r><max> | 2016-10-07 18:02:44 | LQ_CLOSE |
39,923,833 | ckfinder 2.6.x does not remember last folder | <p>I downloaded trial version of the ckfinder and i noticed that it does not remember the last folder from previous use. I believe it should remember right since it has a config option. Also tried with different browsers like Chrome, Edge, Opera and set <code>config.rememberLastFolder = true</code> to be sure but still same, it always stars from <code>File</code> folder. Any idea?</p>
| <ckfinder> | 2016-10-07 18:36:25 | LQ_CLOSE |
39,923,884 | how to get selected row value on the next page using jquery?php | I want to get selected `row` id on the next page.I want when i clcik on `button` then selected row id show in next page.Remember next window tab will open.
Here is my jquery function.Its getting `ID` in `value` var when i click on row but i don't know ho to get this id on next page.But i want that ,first i select row then i click on button then `id` show on next tab window.Thanks
[![enter image description here][1]][1]
[1]: http://i.stack.imgur.com/LoEvb.jpg
and here is my `jQUERY` function :
$("#maintable tr").click(function(){
//alert($(this).hasClass("selected"));
if ($(this).hasClass("selected")){
$(this).removeClass("selected");
var value=$(this).find('td:first').html();
alert(value);
}else{
$(this).addClass("selected").siblings().removeClass("selected");
}
}); | <javascript><php><jquery><html> | 2016-10-07 18:39:25 | LQ_EDIT |
39,924,136 | Find dead code in Golang monorepo | <p>My team has all our Golang code in a monorepo.</p>
<ul>
<li>Various package subdirectories with library code.</li>
<li>Binaries/services/tools under <code>cmd</code></li>
</ul>
<p>We've had it for a while and are doing some cleanup. Are there any tools or techniques that can find functions not used by the binaries under <code>cmd</code>?</p>
<p>I know <code>go vet</code> can find private functions that are unused in a package. However I suspect we also have exported library functions that aren't used either.</p>
| <go><refactoring> | 2016-10-07 18:57:58 | HQ |
39,924,453 | Why I cant get previous url in controller? | I work on my single page application project I use angujarjs 1.5.
At some point in my controller I need to get previous url.
I tried to use this row to get previous url:
var prevUrl = $document[0].referrer;
and this:
var prevUrl2 = document.referrer;
But `prevUrl` and `prevUrl2` are always empty.
When I use this row to go back:
$window.history.back();
It works fine.
Any idea why 'prevUrl' and 'prevUrl2' is empty?
Please help me!
| <angularjs> | 2016-10-07 19:22:08 | LQ_EDIT |
39,924,719 | i tried a program to remove common alphabets from character array in c language | void main()
{
int i, j, k,flag=1;
char key[10], keyword[10];
gets(key);
i=0;
j=0;
while(key[i]!='\0') {
k=0;
while(keyword[k]!='\0') {
if(key[i]==keyword[k]) {
i++;
flag=0;
break;
}
k++;
}
if(flag==1) {
keyword[j]=key[i];
j++;
i++;
}
flag=1;
}
}
Here i tried to copy unique alphabets from array to another array ..means duplicate alphabet should not copied in another array..it shows right output but along with that it shows some garbage values like smiley or something till the length of original input array(i.e.key[]) | <c> | 2016-10-07 19:42:26 | LQ_EDIT |
39,925,069 | Python is the opposite of working | I am making a super simple program, you can tell what it is by looking at it. The problem is I can't get it to work. Here are my problems:
> python2.7 test.py 1 1234
> Usage: test.py [option] [number], etc..
Here it should had print out 134
>
> python2.7 test.py 1
doesn't do anything... When it should print out the usage.
What's happening? I can't figure out. Here's the code:
def oddtarray(num):
tlist = map(int, str(num))
tnum = [x for x in tlist if (x % 2) != 0]
return tnum
def eventarray(num):
tlist = map(int, str(num))
tnum = [x for x in tlist if (x % 2) == 0]
return tnum
def transform():
try:
odd = int(''.join(map(str, eventarray(sys.argv[2]))))
even = int(''.join(map(str, oddtarray(sys.argv[2]))))
if len(sys.argv) == 3:
if sys.argv[1] == 1:
print odd
elif sys.argv[1] == 2:
print even
else:
usage()
else:
usage()
print ' we are here'
except IndexError:
if len(sys.argv) < 2:
usage()
def usage():
print 'Usage: test.py [option] [number]'
print 'Options: \n[1] - Remove even numbers\n[2] - Remove odd numbers'
transform()
| <python> | 2016-10-07 20:11:13 | LQ_EDIT |
39,925,898 | Can't find the offical documentation for the next() method |
I see it is used in various ways: next(), next('route'), next(error)...
Where can I find the official documentation for the `next()` method ?
I don't find any documentation summing up it's use cases on the [express api docs][1]...
[1]: http://expressjs.com/en/4x/api.html | <node.js><express> | 2016-10-07 21:14:20 | LQ_EDIT |
39,926,493 | ClassName styles not working in react | <p>I'm having a little issue with styling react components. I have my scss stylesheets in a separate file and importing them into my react file. My scss stylsheet looks like this:</p>
<pre><code>.testStyle {
font-family: avenir;
color: blue;
}
</code></pre>
<p>My react file, looks like this:</p>
<pre><code>import React from 'react'
import styles from '../styles/main.scss'
class Temp extends React.Component {
render() {
return (
**<div className={styles.testStyle}>**
<h1>Hello</h1>
</div>
)
}
}
export default Temp
</code></pre>
<p>With this setup, my styles are not passed through, however, if it works if I replace the starred line with <code><div className='testStyle'></code>, so it seems like the styles are being imported correctly. Can anyone help with this? Thanks.</p>
| <javascript><reactjs><sass> | 2016-10-07 22:11:24 | HQ |
39,926,648 | Explanation on "Integer.Max_Value" and Integer.Min_Value | <p>I am going to write a program that takes in five integer values as the test grades for some class.Then I will determine what the minimum grade is and what the maximum grade will be. Following that I am going to calculate the average. My professor specified that she wants the minimum grade stored in <code>Integer.Max_Value</code> and the maximum grade in <code>Integer.Min_Value</code>. I'm having a rough time comprehending this. Can someone please explain to me what the meaning of those statements are? </p>
| <java><oop> | 2016-10-07 22:30:47 | LQ_CLOSE |
39,926,686 | 'System.Drawing.Color' does not contain a definition for 'FromARgb' | <p>I have added System.Drawing as a reference, yet this code seems to fail on the line where I declare the new color</p>
<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
using System.Windows.Forms;
using System.IO;
namespace BitmapParser
{
class Program
{
static void Main(string[] args)
{
Color a = Color.FromARgb(0, 255, 0);
}
}
}
</code></pre>
<p>So what is going on here? I looked up System.Drawing.Color and it does have a 3-int constructor
<a href="https://msdn.microsoft.com/en-us/library/system.drawing.color.aspx" rel="nofollow">https://msdn.microsoft.com/en-us/library/system.drawing.color.aspx</a></p>
| <c#><system.drawing><system.drawing.color> | 2016-10-07 22:37:59 | LQ_CLOSE |
39,927,303 | Automated refactoring tool for java - eclipse IDE | <p>Our team wants to adopt a coherent coding style, that has an automated refactor tool to spread the style across the team easily (not in terms of formatting - more like preventing "mistakes" and detecting general pitfalls in the code).</p>
<p>We have those needs:</p>
<p><strong>- Working well with Eclipse, cross platform (linux/windows)</strong></p>
<p><strong>- Manipulate the code without changing its semantics</strong></p>
<p><strong>- Configurable (option to enable/disable rules)</strong></p>
<p><strong>- Optional: "Short Style" preferred ('v' instead of 'variable', if there is such tool that can do it)</strong></p>
<p>A bit strict needs - but I'm sure SO community will do it :)</p>
| <java><eclipse><coding-style><refactoring><automated-refactoring> | 2016-10-07 23:59:56 | LQ_CLOSE |
39,927,357 | Many Modules using the same component causes error - Angular 2 | <p>I have a shared component called GoComponent that I want to use in 2 modules: FindPageModule and AddPageModule.</p>
<p>When I add it in the declarations of "FindPageModule" and in my "AddPageModule" I get an error:</p>
<blockquote>
<p>find:21 Error: (SystemJS) Type GoComponent is part of the declarations
of 2 modules: FindPageModule and AddPageModule! Please consider moving
GoComponent to a higher module that imports FindPageModule and
AddPageModule. You can also create a new NgModule that exports and
includes GoComponent then import that NgModule in FindPageModule and
AddPageModule.</p>
</blockquote>
<p>So I take it out of them both and add it in AppModule declarations, which does import FindPageModule and AddPageModule, and I get an error in a component called "FindFormComponent" which is in the declarations of FindPageModule and uses "GoComponent":</p>
<pre><code>zone.js:355 Unhandled Promise rejection: Template parse errors:
'go' is not a known element:
1. If 'go' is an Angular component, then verify that it is part of this module.
2. If 'go' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. (" style="height:64px;">
<div style="position: relative; display: inline-block; width: 100%;">
[ERROR ->]<go></go>
</div>
</div>
"): FindFormComponent@101:4 ; Zone: <root> ; Task: Promise.then ; Value: Error: Template parse errors:(…) Error: Template parse errors:
'go' is not a known element:
1. If 'go' is an Angular component, then verify that it is part of this module.
2. If 'go' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. (" style="height:64px;">
<div style="position: relative; display: inline-block; width: 100%;">
[ERROR ->]<go></go>
</div>
</div>
"): FindFormComponent@101:4
</code></pre>
<p>How do I let components such as FindFormComponent that are declared in FindPageModule use GoComponent and also let components declared by AddPageModule use GoComponent?</p>
| <angular><ng-modules> | 2016-10-08 00:09:06 | HQ |
39,927,452 | Recursively print all permutations of a string (Javascript) | <p>I've seen versions of this question for other languages, but not for JS.</p>
<p>Is it possible to do this recursively in one function?</p>
<p>I understand that I need to take the first element in the string, and then append it to each solution to the recursion on the remainder of the string.
So logically, I understand how the recursion needs to go. I just don't understand how to append the first char onto each of the recursive solutions</p>
<pre><code>var myString = "xyz";
function printPermut(inputString){
var outputString;
if(inputString.length === 0){
return inputString;
}
if(inputString.length === 1){
return inputString;
}
else{
for(int i = 0; i<inputString.length(); i++){
//something here like:
//outputString = outputString.concat(printPermut(inputString.slice(1))??
//maybe store each unique permutation to an array or something?
}
}
}
</code></pre>
| <javascript><string><algorithm><recursion><permutation> | 2016-10-08 00:28:03 | HQ |
39,928,132 | git rebase using sourcetree | <p>I think I am confused on how to use SourceTree GUI to do git rebase. I have two branches "master" and "dev". As seen, the two branch diverged. I want to do a rebase on "dev" branch, using command line, this would be:</p>
<pre><code>git checkout dev
git rebase master
</code></pre>
<p><a href="https://i.stack.imgur.com/POAIV.png" rel="noreferrer"><img src="https://i.stack.imgur.com/POAIV.png" alt="enter image description here"></a></p>
<p>I would have expected to right click "dev", and choose "Rebase current changes onto dev". I assume current changes means "new commits on master". But picking this option seems have no effect whatsoever. What would be the correct steps?</p>
| <git><atlassian-sourcetree> | 2016-10-08 02:35:53 | HQ |
39,928,934 | how to write standard deviation? | do i calculate my standard deviation in the loop. also i know the formula for standard deviation just not how to get it to accept the numbers from the users. im new to programming so explain everything. also dont mind my sorry attempt at trying to write out Standard deviation formula it wasnt meant to work just to understand SD more
import java.util.Scanner;
public class readFromKeyboard {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String inStr = input.next();
int n;
int i;
int count=0;
int min = Integer.MAX_VALUE;
int max = Integer.MIN_VALUE;
double average=0;
int sum;
double deviation = 0;
while (!inStr.equals("EOL")) {
count++;
n = Integer.parseInt(inStr);
min = Math.min(min, n);
max = Math.max(max, n);
System.out.printf("%d ", n);
inStr = input.next();
average += n;
// really bad attempt here
deviation = math.pow(n / average,2) ++ / mean sqrt();
}
average = average/count;
System.out.println("\n The average of these numbers is " + average);
System.out.printf("The list has %d numbers\n", count);
System.out.printf("The minimum of the list is %d\n", min);
System.out.printf("The maximum of the list is %d\n", max);
input.close();
}
}
| <java><loops><math><standard-deviation> | 2016-10-08 05:16:58 | LQ_EDIT |
39,929,758 | PS MarkSweep is which garbage collector | <p>My jdk version is :</p>
<pre><code>java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)
</code></pre>
<p>this is my test code :</p>
<pre><code>List<GarbageCollectorMXBean> beans = ManagementFactory.getGarbageCollectorMXBeans();
for (GarbageCollectorMXBean bean : beans) {
System.out.println(bean.getName());
}
</code></pre>
<p>result is :</p>
<pre><code>PS Scavenge
PS MarkSweep
</code></pre>
<p>I know PS Scavenge is "Parallel Scavenge" of young generation garbage collector, "PS MarkSweep" is which, is it "Parallel Old"? </p>
| <java><garbage-collection> | 2016-10-08 07:13:12 | HQ |
39,930,103 | Sending Email to SpecifiedPickupDirectory with MailKit | <p>I was using SmtpClient till now with ASP.NET MVC 5. For testing email send functionality on local system, I was using <code>client.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;</code></p>
<p>Now, I want to do the same things in ASP.NET Core which does not have SmtpClient class implemented till now. All search for this ended up on <a href="https://github.com/jstedfast/MailKit" rel="noreferrer">MailKit</a>. I have used their send mail code which is working fine with gmail.</p>
<p>I do not want to send testing emails each time and there may be a lot of scenarios in my project where I need to send email. How can I use the local email sending functionality with MailKit. Any links or little source code will help. Thanks</p>
| <c#><email><smtp><asp.net-core><mailkit> | 2016-10-08 07:58:06 | HQ |
39,930,104 | validation function error , 'length' of undefined | var ClassSignUpValidation = function (){};
ClassSignUpValidation.prototype.CheckName = function (_target)
{
return false;
}
ClassSignUpValidation.prototype.CheckPassword = function (_target)
{
return false;
}
//SUBMIT FORM VALIDATION
ClassSignUpValidation.prototype.SubmitForm = function (event)
{
var sumbit_errorspan = $("#submit-errorResult");
//array validation function
var validators = [this.CheckName, this.CheckPassword];
// bypass all function
var valid = validators.reduce(function(valid, validator){
return validator() && valid;
}, true);
if(valid){
sumbit_errorspan.html('');
}else{
sumbit_errorspan.css('color', 'red');
sumbit_errorspan.html('sumbit not requirements.');
}
return valid;
}
i am making a validation function , submitForm function is to check other function return value true or false , but i have this error , i dont know why.
error
Uncaught TypeError: Cannot read property 'length' of undefined | <javascript><jquery> | 2016-10-08 07:58:07 | LQ_EDIT |
39,930,171 | Cache Brew builds with travis ci | <p>I have a Travis CI <code>osx</code> build with a <code>brew</code> dependency that has to be built from source.</p>
<p>I know that Travis has the <code>cache</code> feature, but it doesn't have any documentation on how to cache <code>brew</code> builds or outputs.</p>
<p>Any idea on how to cache a <code>brew</code> package in travis?</p>
| <macos><homebrew><travis-ci> | 2016-10-08 08:06:55 | HQ |
39,930,380 | How i can make an array of the five most popular elements in an another array? |
`int[] a ={1, 2, 5, 2, 4, 6, 8, 9, 1, 19};
int[] fiveMostPopular = new int[5];
for(int i=0; i<5;i++){
System.out.println(fiveMostPopular[i]);
}` | <arrays> | 2016-10-08 08:34:49 | LQ_EDIT |
39,930,701 | How can I get the same effect on my webpage? | <p>So I've seen a mouse-hover effect on 2 websites so far and I really like it.
<a href="https://i.stack.imgur.com/Ly0gP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ly0gP.png" alt="image1"></a></p>
<p><a href="https://i.stack.imgur.com/oDe1i.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oDe1i.png" alt="image2"></a></p>
<p>This is the effect I'm talking about.
I'd be grateful if somebody can tell me how to get that effect on my webpage.
It only appears under your cursor when you hover over the page.</p>
| <javascript><php><jquery><html><css> | 2016-10-08 09:18:29 | LQ_CLOSE |
39,930,925 | toString method of a linear equation | <p>I am trying to represent an equation in this format: "a = bx + c"</p>
<ul>
<li>If b is 0, it should return “a = c”.</li>
<li>If c is 0, then it should return “a = bx”</li>
<li>Also, when c is negative it should not return something like "5 = 8x + -7" </li>
<li>And when b=1, it should not show the coefficient of x.</li>
</ul>
<p>Can you help me?</p>
| <java><tostring><equation> | 2016-10-08 09:43:50 | LQ_CLOSE |
39,930,952 | Cannot import keras after installation | <p>I'm trying to setup <code>keras</code> deep learning library for <code>Python3.5</code> on Ubuntu 16.04 LTS and use <code>Tensorflow</code> as a backend. I have <code>Python2.7</code> and <code>Python3.5</code> installed. I have installed <code>Anaconda</code> and with help of it <code>Tensorflow</code>, <code>numpy</code>, <code>scipy</code>, <code>pyyaml</code>. Afterwards I have installed <code>keras</code> with command</p>
<blockquote>
<p>sudo python setup.py install</p>
</blockquote>
<p>Although I can see <code>/usr/local/lib/python3.5/dist-packages/Keras-1.1.0-py3.5.egg</code> directory, I cannot use <code>keras</code> library. When I try to import it in python it says</p>
<blockquote>
<p>ImportError: No module named 'keras'</p>
</blockquote>
<p>I have tried to install <code>keras</code> using<code>pip3</code>, but got the same result. </p>
<p>What am I doing wrong? Any Ideas?</p>
| <python><ubuntu><tensorflow><anaconda><keras> | 2016-10-08 09:46:36 | HQ |
39,931,618 | How to decompile iOS apps? | <p>I want to see the code of an iOS app.</p>
<p>The app I downloaded is .deb.</p>
<p><strong>First question</strong>: Is it possible to install .deb file on iOS or I downloaded a wrong file?</p>
<p>After unpacking the .deb file, I got some files, including .nib, .storyboard and some other files.</p>
<p>My <strong>main question</strong> is, How to decompile these .nib files?</p>
<p>I tried to decompile these files using NibToXibConverter, but I didn't succeed.</p>
| <ios><decompiling><deb> | 2016-10-08 11:05:08 | HQ |
39,931,752 | Hide text after period of time and show another in place of it and keep in loop | <p>I want to make like a show ( continues text swapping)
so when the page is loaded the first text will disappear with animation after 3 seconds for example , and the second text will appear in place of it with animation and then disappear to show the first text and so on.</p>
| <javascript><jquery><css><html> | 2016-10-08 11:21:57 | LQ_CLOSE |
39,931,907 | reactnative : can't get ellipsizeMode to work | <p>I am trying to truncate a text in my reactnative app. I've decided to use the "ellipsizeMode" attribute, but I can't get it to work.</p>
<p>I wrote a demo of the problem :</p>
<pre><code>'use strict';
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View,
} from 'react-native';
export class EllipsizeModeTest extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.text}>{'first part | '}</Text>
<Text style={styles.text} numberOfLines={1} ellipsizeMode={'tail'}>
{'a text too long to be displayed on the screen'}
</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flexDirection: 'row',
},
text: {
fontSize: 20,
}
});
</code></pre>
<p>Now the text does not get truncated, any idea why ?</p>
| <javascript><reactjs><react-native> | 2016-10-08 11:40:15 | HQ |
39,932,140 | PHP array_search not working (returns empty string) | <p>I'm trying to check if a filename of an image contains "cover". Somehow this stopped working for me (Pretty sure it worked already). I copied the part of my function not working. </p>
<pre><code>$name=array("_IMG8555.jpg", "_IMG7769.jpg", "_IMG8458.jpg", "Cover.jpg", "_IMG7184.jpg");
$cov=array("Cover.png","Cover.jpg","Cover.jpeg", "cover.png","cover.jpg","cover.jpeg");
</code></pre>
<p>This does not work for me:</p>
<pre><code>print_r(array_search($cov, $name)); //Returns empty String
print_r($name[array_search($cov, $name)]); //Returns first element of the name Array
</code></pre>
<p>Also I added a test Strings to make sure this is not result the searched string is the same as the search value.</p>
<pre><code>print_r($name[3]===$cov[1]); //Returns true(1)
</code></pre>
<p>Can anyone help? Why does this simple script not work?</p>
<p>I also tried using <code>in_array()</code> but this is not working either.</p>
| <php><arrays><sorting> | 2016-10-08 12:06:33 | LQ_CLOSE |
39,932,176 | how to sumup alias columns in case statement in SQL | SELECT E.EMPNO,E.DEPTNO,E.SAL,E.COMM,
COALESCE(SAL,0)+COALESCE(COMM,0) AS T1,
CASE
WHEN E.DEPTNO=10 THEN COALESCE(E.SAL,0)+COALESCE(E.COMM,0)
WHEN D.DNAME='ACCOUNTING' THEN COALESCE(E.SAL,0)-COALESCE(E.COMM,0)
ELSE 0 END AS T,
sum(T+T1) as T2
FROM EMP E LEFT OUTER JOIN DEPT D ON E.DEPTNO=D.DEPTNO;
getting below error
ORA-00904: "T1": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action:
Error at Line: 7 Column: 7 | <sql><oracle><oracle11g> | 2016-10-08 12:10:01 | LQ_EDIT |
39,934,369 | Groovy script to change the svn url in jenkin jobs | hi we have around 200 jobs where svn url has to be updated
can someone help me with groovy script please provide me insight about different methods of jenkins | <jenkins><groovy> | 2016-10-08 15:54:44 | LQ_EDIT |
39,935,190 | ContentCachingResponseWrapper Produces Empty Response | <p>I'm trying to implement filter for logging requests and responses in <code>Spring MVC</code> application.
I use the following code:</p>
<pre><code>@Component
public class LoggingFilter extends OncePerRequestFilter {
private static final Logger LOGGER = LoggerFactory.getLogger(LoggingFilter.class);
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
ContentCachingRequestWrapper requestWrapper = new ContentCachingRequestWrapper(request);
ContentCachingResponseWrapper responseWrapper = new ContentCachingResponseWrapper(response);
LOGGER.debug(REQUEST_MESSAGE_FORMAT, requestWrapper.getRequestURI(), requestWrapper.getMethod(), requestWrapper.getContentType(),
new ServletServerHttpRequest(requestWrapper).getHeaders(), IOUtils.toString(requestWrapper.getInputStream(), UTF_8));
filterChain.doFilter(requestWrapper, responseWrapper);
LOGGER.debug(RESPONSE_MESSAGE_FORMAT, responseWrapper.getStatus(), responseWrapper.getContentType(),
new ServletServerHttpResponse(responseWrapper).getHeaders(), IOUtils.toString(responseWrapper.getContentInputStream(), UTF_8));
}
}
</code></pre>
<p>So, I get my request and respone logged as expected. Here are the logs:</p>
<pre><code>2016-10-08 19:10:11.212 DEBUG 11072 --- [qtp108982313-19] by.kolodyuk.logging.LoggingFilter
----------------------------
ID: 1
URI: /resources/1
Http-Method: GET
Content-Type: null
Headers: {User-Agent=[curl/7.41.0], Accept=[*/*], Host=[localhost:9015]}
Body:
--------------------------------------
2016-10-08 19:10:11.277 DEBUG 11072 --- [qtp108982313-19] by.kolodyuk.logging.LoggingFilter
----------------------------
ID: 1
Response-Code: 200
Content-Type: application/json;charset=UTF-8
Headers: {}
Body: {"id":"1"}
--------------------------------------
</code></pre>
<p>However, the empty response is returned. Here's the output from <code>curl</code>:</p>
<pre><code>$ curl http://localhost:9015/resources/1 --verbose
* Trying ::1...
* Connected to localhost (::1) port 9015 (#0)
> GET /resources/1 HTTP/1.1
> User-Agent: curl/7.41.0
> Host: localhost:9015
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Sat, 08 Oct 2016 17:10:11 GMT
< Content-Type: application/json;charset=UTF-8
< Content-Length: 0
<
* Connection #0 to host localhost left intact
</code></pre>
<p>Any ideas?</p>
<p>Thanks</p>
| <spring-mvc><servlets><spring-boot><servlet-filters> | 2016-10-08 17:20:03 | HQ |
39,935,563 | C - How to print roman numbers? | <p>Given a natural number less or equal to 99, print it as a roman number.</p>
<p>Is there a method for this? How do I solve this assignment? Noob question here.</p>
| <c> | 2016-10-08 17:58:35 | LQ_CLOSE |
39,935,607 | Python code : explain plz | 1. first_num = raw input ("Please input first number. ")
2. sec_num = raw input (" Please input second number:")
3
4. answer = into( first_num) +into( sec_num)
5.
6. print " Now I will add your two numbers : ", answer
7.
8. print " Pretty cool. huh ?
9
10. print " Now I'll count backwards from ",answer
11
12. counter = answer
13
14. while (counter >=0):
15. print counter
16. counter = counter-1
17
18. print. " All done !"
I think the first half in a command to add first and second numbers to get sum and the second half is a command to return to start or zero out. I don't know python language. Thanks for your help.
| <python> | 2016-10-08 18:02:42 | LQ_EDIT |
39,935,616 | Membership site with PHP and MySQL | <p>I have a html site, and I have a page that acts as a bio for users (which I currently have to update by hand with html).</p>
<p>I want to create a membership login page, and I want users to be able to input their own data, that in turn updates their bio page automatically. With an option to upload images.</p>
<p>I read up and looks like php and mysql is the way to go, which I know nothing about. Is that the right route? Or is there an easier way?</p>
<p>Kick me in the right direction to get that setup please? I'm lazy and don't want to spend months figuring out how everything works just to setup one page...</p>
| <php><mysql><membership> | 2016-10-08 18:03:18 | LQ_CLOSE |
39,935,720 | How to create new string in C++ by two other ones? | <p>I want to create <code>string</code> <code>"hello1world</code> by this two strings:</p>
<pre><code>string s1 = "hello"
string s2 = "world"
</code></pre>
<p>I do this:</p>
<pre><code>string my_str;
sprintf(my_str, "%s1%s", s1, s2);
</code></pre>
<p>But I have an error:</p>
<pre><code>error: cannot convert ‘std::__cxx11::string {aka std::__cxx11::basic_string<char>}’ to ‘char*’ for argument ‘1’ to ‘int sprintf(char*, const char*, ...)’
sprintf(my_str, "%s1%s", s1, s2);
</code></pre>
<p>How to do it properly?</p>
| <c++><string> | 2016-10-08 18:14:28 | LQ_CLOSE |
39,935,758 | Neo4j+apoc: Is there an apoc-function for importing word-doc? | Neo4j+apoc: Is there an apoc-function for importing word-doc ?
I try to import the text as a chain of nodes parsing some simple layout tags. | <import><neo4j><ms-word> | 2016-10-08 18:17:51 | LQ_EDIT |
39,936,454 | Range of card in database cell | How can I insert a range of cards like AA-QQ (AA, KK, QQ) in a cell of a database?
I will use java
I can't use 2 column like in [this thread][1] because cardsaren't numbers
[1]:http://stackoverflow.com/a/7463531/6942539
| <java><database><poker> | 2016-10-08 19:25:04 | LQ_EDIT |
39,936,634 | Why does creating contact forms require a password? | <p>So Im looking at having a contact form on my website where a person can type a message and send it, with the mesage going to my inbox.</p>
<p>But every time I see them online Ill see this:</p>
<pre><code> System.Net.NetworkCredential("yourEmail@gmail.com", "YourPassword");
</code></pre>
<p>Why do I need to provide my password? When you send someone a regular email, you dont need THEIR password. </p>
<p>I also have security concerns. Ok, it's in a .cs file, but still, I dont like seeing my password in plain text there.</p>
<p>Also, what about if its for a big company? Does ebay have their password in plain text? It's something I doubt. How do other people do it?</p>
| <c#><asp.net><contact-form> | 2016-10-08 19:42:32 | LQ_CLOSE |
39,936,837 | Cannot convert type 'Windows.UI.Xaml.Media.Imaging.WriteableBitmap' to 'ZXing.LuminanceSource' on UWP | I'm trying to use ZXing on UWP project and I have read a lots of tutorials, that I can't get to work. The last tutorial said that I should use WritableBitmap, 'cos Bitmap is not awailable in UWP.
However it says to me
> Cannot convert type 'Windows.UI.Xaml.Media.Imaging.WriteableBitmap' to
> 'ZXing.LuminanceSource'
public class QrCodeHelpers
{
public static void ReadQrCodeFromBitmap(WriteableBitmap image)
{
IBarcodeReader reader = new BarcodeReader();
var generic = new BarcodeReaderGeneric<WriteableBitmap>();
// detect and decode the barcode inside the bitmap
var result = reader.Decode((ZXing.LuminanceSource)image);
// do something with the result
}
}
How could I get this work? I have an image from MediaCapture and it would be fine to use that and get the QR code's data. Any solution?
| <c#><uwp><zxing> | 2016-10-08 20:04:24 | LQ_EDIT |
39,938,528 | iterating through multiple equations | <p>I have a problem simplified into the following:</p>
<p>Xn+1 = Xn + Yn</p>
<p>Yn+1= Yn + Zn</p>
<p>Zn+1= Zn+ Xn</p>
<p>I know the values of X0,Y0,Z0 to be equal to 1.
I want to tell python to find the values of X1,Y1,Z1 and then X2,Y2,Z2,...etc. Can anyone help me with that? I think I have to use a nested loop but I am not sure exactly how to go about it. Thanks!</p>
| <python><iteration> | 2016-10-08 23:43:48 | LQ_CLOSE |
39,938,633 | Detached HEAD Issue in Android Studio | <p>I am new to Android Studio and have began developing a Navigation Drawer app.</p>
<p>After having made a mistake in a commit, I played around with the Version control's "Checkout Revision" and now I can no longer push my project onto Github due to a "Detached HEAD".</p>
<p>How can I fix this problem? My app runs perfectly fine in the emulator.</p>
<p>Thanks</p>
| <android><git><github><head> | 2016-10-09 00:01:28 | HQ |
39,938,766 | Getting the next number in php | <p>I'm not sure what the easiest way to go about this is, I just want one button on a page called assign.</p>
<p>When you visit the page, it says 001, once you click assign, the page refreshes and it says 002 and so on. Do I need a DB to keep track of the current number? </p>
<p>Is there an easier way to do this with javascript that does not need a DB?</p>
| <javascript><php><jquery><mysql> | 2016-10-09 00:25:09 | LQ_CLOSE |
39,938,826 | Ruby shuffle two arrays non-randomly | I have two different arrays with arrays in them:
Vowels = [['a', 'a'], ['a', 'e'], ['a', 'i']...]
Consonants = [['b', 'b', 'b'], ['b', 'b', 'c'], ['b', 'b', 'd']...]
I want to be able to mix them together into every possible combination, without losing or adding content, with a function
> allmixes(Vowels, Consonants)
=> [['a', 'a', 'b', 'b', 'b'], ['a', 'b', 'b', 'b', 'a']...]
By mix, I mean that I need the two arrays two have a sort of combination without duplicates, or a shuffle that follows a pattern letting me call a certain result by index. | <arrays><ruby> | 2016-10-09 00:39:30 | LQ_EDIT |
39,938,900 | iOS constraint style: addConstraints vs .isActive = true | <p>I have some code which is creating auto-layout constraints programatically, and adding them to a view.</p>
<p>There are two ways to do this - call <code>addConstraints</code> on the superView, or set <code>.isActive = true</code> on each constraint (which internally calls addConstraint)</p>
<p>Option 1:</p>
<pre><code>parent.addConstraints([
child.topAnchor.constraint(equalTo: parent.topAnchor, constant: 20),
child.leftAnchor.constraint(equalTo: parent.leftAnchor, constant: 5) ])
</code></pre>
<p>Option 2:</p>
<pre><code>child.topAnchor.constraint(equalTo: parent.topAnchor, constant: 20).isActive = true
child.leftAnchor.constraint(equalTo: parent.leftAnchor, constant: 5).isActive = true
</code></pre>
<p>My question is, is there any benefit to doing one over the other? (performance/etc) or does it come purely down to style.</p>
<p><em>(I don't think constraints are evaluated until the next layout pass, so I don't think it should matter that we add them one-by-one instead of in a block??)</em></p>
<p>If it is just style, what's the "more preferred" style by the community??</p>
<p><em>(personally I prefer addConstraints, however it's very close and I could be easily swayed to .isActive)</em></p>
| <ios><swift><autolayout><nslayoutconstraint> | 2016-10-09 00:54:35 | HQ |
39,938,959 | vue.js - not defined on the instance but referenced during render | <p>I am loading a template that references a client side js file with my code like so:</p>
<pre><code><!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.0.1/vue.js"></script>
<link rel="stylesheet" type="text/css" href="../css/app.css">
</head>
<body>
<div id="container">
<div id="map">
<script src="../js/app.js" type="text/javascript"></script>
<div id="offer-details">
<form id="offer-form" v-on:submit="makeOffer(tags, description, code)">
<input id="description"/>
<input id="tags"/>
<input id="code"/>
<input type="submit"/>
</form>
</div>
</div>
</div>
</body>
</html>
</code></pre>
<p>My browser shows that the following (details.js) loads successfully. </p>
<pre><code>var vm = new Vue({
el: "#details",
data: {
offer: {
publickey: '',
privatekey: '',
name: '',
service: '',
value: '',
currency: '',
tags: '',
description: '',
code: ''
},
methods: {
makeOffer: function makeOffer(){console.log(vm.publickey)}
}
}
})
</code></pre>
<p>However, when I submit the form I get the following error message:</p>
<pre><code>[Vue warn]: Property or method "makeOffer" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option. (found in root instance)vue.js:2574:7
[Vue warn]: Handler for event "submit" is undefined.
</code></pre>
<p>It looks to me like I'm defining makeOffer in the method key as I should. Is this not the same as defining it on the instance? Why isn't it seeing makeOffer?</p>
| <javascript><vue.js> | 2016-10-09 01:07:04 | HQ |
39,939,375 | How do I randomly apply CSS style using plain Javascript? | <p>I have a few list entries that I would like to randomly highlight, 1 item only with different background and text color.</p>
<p>As shown below with "list 2" highlighted.</p>
<pre><code><div id="entries">
<ul style="list-style-type: none;">
<li><a href="#1">list 1</a></li>
<li><a href="#2" style="color:#fff; background-color:#000">list 2</a></li>
<li><a href="#3">list 3</a></li>
<li><a href="#4">list 4</a></li>
<li><a href="#5">list 5</a></li>
</ul>
</div>
</code></pre>
<p>How can I achieve this using vanilla javascript without the use of jQuery?</p>
| <javascript><css> | 2016-10-09 02:28:22 | LQ_CLOSE |
39,939,662 | es6 import from underscore | <p>I wanted to double check to make sure I understand imports enough to know if it is ok to do <code>import {_.identity} from 'underscore'</code> opposed to <code>import _ from 'underscore'</code>? That is the only use of underscore if the particular file.</p>
<p>Thank you for your help</p>
| <javascript><ecmascript-6> | 2016-10-09 03:18:31 | HQ |
39,939,831 | Reload app in iOS simulator using Command-R not working | <p>I am using TabBarIOS component in React native. If I press Command-R, the reload of the app is not happening. I use the "Shake Gesture" to show the menu and then click Reload on the context menu to reload the app.</p>
<p>Is there a way to get Command-R to work with TabBarIOS component in React native?</p>
| <react-native><ios-simulator> | 2016-10-09 03:48:55 | HQ |
39,940,665 | Passing vuex module state into vue-router during beforeEach | <p>I am using VueJS in conjunction with <code>vuex</code> and <code>vue-router</code>. I have a <code>vuex</code> module that is making a mutation to its store, and trying to use that to determine whether or not a user is authenticated.</p>
<p>Here is what my code looks like in relevant part.</p>
<p><strong>main.js</strong></p>
<pre><code>import Vue from 'vue'
import App from './App.vue'
import store from './store'
import router from './router'
router.beforeEach((to, from, next) => {
console.log(router.app) // prints a Vue$2 object
console.log(router.app.$store) // undefined
console.log(store.getters.isAuthenticated) // false
...
}
const app = new Vue({
store,
router,
...App
})
app.$mount('#app')
</code></pre>
<p><strong>/store/index.js</strong></p>
<pre><code>import Vue from 'vue'
import Vuex from 'vuex'
import core from './modules/core'
Vue.use(Vuex)
const store = new Vuex.Store({
modules: {
core: core
}
})
export default store
</code></pre>
<p><strong>/store/modules/core.js</strong></p>
<pre><code>import * as types from '../types'
import api from '../../api'
import router from '../../router'
const state = {
token: null,
user: null,
authenticated: false
}
const mutations = {
[types.LOGIN_SUCCESS] (state, payload) {
console.log('mutate')
state.token = payload.token
state.user = payload.user
state.authenticated = true
router.go('/')
}
}
const getters = {
isAuthenticated: state => {
return state.authenticated
}
}
const actions = {
[types.LOGIN] (context, payload) {
api.getToken(payload).then(response => {
context.commit(types.LOGIN_SUCCESS, response)
})
}
}
export default {
state,
mutations,
actions,
getters
}
</code></pre>
<p>When I go thru my logic to trigger the <code>LOGIN</code> action, I can see that the mutation executed properly, and when I use the Chrome extension to view the vuex state for my <code>core</code> module, the state for <code>user</code> and <code>authenticated</code> have been properly mutated.</p>
<p><strong>QUESTION</strong></p>
<p>It seems like this module just simply has not been loaded by the time the router is running in the <code>.beforeEach</code> loop. Is this true?</p>
<p>If yes, what are some other suggestions on how to handle this situation?
If no, what am I doing incorrect?</p>
| <javascript><vue.js><vue-router><vuex> | 2016-10-09 06:24:13 | HQ |
39,941,329 | How do I take multiple inputs in different lines in Python so that inputs can be accessed later? | <p><a href="http://i.stack.imgur.com/1xDpf.jpg" rel="nofollow">I want to take input in similar pattern</a>
I want user to give inputs in multiple lines and value of multiple lines is provided.(5 in given pic)</p>
| <python> | 2016-10-09 07:56:19 | LQ_CLOSE |
39,941,746 | Array - Loop - Generate random number in Java | <p>I have to write a program that generate random integers from 0 to 9 for 1000 times and count repeated numbers. So output should be like:</p>
<p>0 used 123 times,
1 used 89 times,
2 301 times,
.
.
9 used 23 times</p>
<p>I must use math.random for this. I can generate numbers but how can I use array and loop for this?</p>
<p>Thanks.</p>
| <java> | 2016-10-09 08:56:45 | LQ_CLOSE |
39,942,360 | The JSON sent by firebase is invalid | { name: 'anonymous', text: 'Hello' }
{ name: 'anonymous', text: 'How are you' }
{ name: 'anonymous', text: 'I am fine' }
This code is returned by firebase, and I'm getting the error "No JSON object could be decoded". I think this has to do something with the validity of json format.
<br>
I'm getting this json data using the firebase node.js SDK. Then I'm passig it to python using pyshell. When I use the `json.loads` in python. It says :<br><br>
C:\Python27>node firebase2.js
{ name: 'anonymous', text: 'Hello' }
{ name: 'anonymous', text: 'How are you' }
{ name: 'anonymous', text: 'I am fine' }
C:\Python27\firebase2.js:40
if (err) throw err;
^
Error: ValueError: No JSON object could be decoded
at PythonShell.parseError (C:\Python27\node_modules\python-shell\index.js:183:17)
at terminateIfNeeded (C:\Python27\node_modules\python-shell\index.js:98:28)
at ChildProcess.<anonymous> (C:\Python27\node_modules\python-shell\index.js:88:9)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
----- Python Traceback -----
File "my_script.py", line 3, in <module>
myjson = json.loads(myinput)
File "C:\Python27\lib\json\__init__.py", line 339, in loads
return _default_decoder.decode(s)
File "C:\Python27\lib\json\decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Python27\lib\json\decoder.py", line 382, in raw_decode
raise ValueError("No JSON object could be decoded") | <python><json><node.js><firebase><firebase-cloud-messaging> | 2016-10-09 10:09:48 | LQ_EDIT |
39,942,588 | How to make a random number between -1 and 1 in Java | <p>Trying to figure this out for a while, need a random number that is either -1, 0 or 1. Any help would be great.</p>
| <java><random><numbers> | 2016-10-09 10:32:44 | LQ_CLOSE |
39,942,618 | String equation seperation |
String Str = new String("(300+23)*(43-21)/(84+7)");
System.out.println("Return Value :" );
String[] a=Str.split(Str);
String a="("
String b="300"
String c="+"
I want to convert this single string to an array giving output as above till the end of the equation using split method any suggestions
The above code doesn't works for it
| <java><string> | 2016-10-09 10:35:53 | LQ_EDIT |
39,942,794 | java equals true with different hashcodes | I am going through the java.lang.Object API which states the below the point on objects equality:
https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html
**public boolean equals(Object obj):**
> It is generally necessary to override the hashCode method whenever
> this method is overridden, so as to maintain the general contract for
> the hashCode method, which states that equal objects must have equal
> hash codes.
**Now to test the above theory on "equal objects must have equal hash codes", I have come up with the below simple code:**
public class Product {
private String name;
public Product(String name) {
this.name = name;
}
@Override
public boolean equals(Object obj) {
//always returns true for all objects
return true;
}
@Override
public int hashCode() {
//Different hascodes for different objects
if(name.equals("PRODUCT1")) {
return 10;
} else {
return 20;
}
}
public static void main(String[] args) {
Product p1 = new Product("PRODUCT1");
Product p2 = new Product("PRODUCT2");
if(p1.equals(p2)) {
System.out.println(" p1 p2 are equal **** ");
} else {
System.out.println(" p1 p2 are NOT equal **** ");
}
}
}
***Output:***
p1 p2 are equal ****
**So, is n't the above code violating/contradicting the API statement "equal objects must have equal hash codes" i.e., equal objects need NOT have same hashcodes ?
Or else what am I missing in the above code ?**
Please help. | <java><equals> | 2016-10-09 10:55:26 | LQ_EDIT |
39,944,124 | I Want to Query a table with two parameters in where condition and both the parameters are returned from another query | I Want to Query a table with two parameters in where condition and both the parameters are returned from another query.
Let us say a table t1 with column1 and column2, if I use a query select column1,column2 from t1,suppose it return 10 records
I want to query something like below
for(int j=0;j<10;j++)
{
select * from t2 where t2.column1=t1.column1(jth position) and t2.column2=t1.column2(jth position)
} | <sql><sql-server> | 2016-10-09 13:24:28 | LQ_EDIT |
39,944,280 | Windows batch script to rename files that have random names? | <p>I need to make windows batch script to rename files that have random names. I have a folder with thousand .txt files, their names are completely random,
I want to rename first 5 files in that folder to <code>file1.txt, file2.txt,file3.txt, file4.txt,file5.txt</code>.</p>
<p>Help appreciated.</p>
| <windows><batch-file><random> | 2016-10-09 13:41:12 | LQ_CLOSE |
39,944,576 | What to do when Jupyter suddenly hangs? | <p>I'm using Jupyter notebook 4.0.6 on OSX El Capitan. </p>
<p>Once in a while I'll start running a notebook and the cell will simply hang, with a <code>[ * ]</code> next to it and no output.</p>
<p>When this happens, I find that only killing Jupyter at the command line and restarting it solves the problem. Relaunching the kernel doesn't help. </p>
<p>Has anyone else had this problem? If so, any tips?</p>
| <python><macos><jupyter-notebook> | 2016-10-09 14:16:02 | HQ |
39,944,975 | What would be the default constructor header | <p>I am new to java and trying to grasp concepts concerning headers for the default constructor.</p>
<p>The header for the first constructor in Circle is:</p>
<pre><code>public Circle(String label, int radius)
</code></pre>
<p>If one decides to add a default constructor to the class. What would be the header for this default constructor?</p>
<p>I have looked online but not really seen a succinct answer. </p>
| <java> | 2016-10-09 14:56:48 | LQ_CLOSE |
39,945,882 | Child element on top of parent element on a small screen | I have 2 divs, one nested inside of the other. According to the page design, the nested div needs to appear normally inside its parent on a large screen, [as in this image.][1]
But on a small screen, the nested div needs to appear to be"on top of" the parent div, [as in this image.][2]
I don't want to position the child element absolutely, because it's a very poor and inflexible choice, especially for a responsive page.
HTML for divs:
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-html -->
<div class="container-div">
<div class="child-div">
...
</div>
</div>
<!-- end snippet -->
[1]: http://i.stack.imgur.com/Z1Vs9.jpg
[2]: http://i.stack.imgur.com/mvhcL.jpg | <html><css> | 2016-10-09 16:30:19 | LQ_EDIT |
39,946,260 | my tkinter wont quit when i press quit button it just changes location | this is the code and when i run it the quit button doesn't work:
def quit2():
menu.destroy()
def menu1():
menu=Tk()
global menu
play=Button(menu, text='play', command =main)
play.pack()
quit1=Button(menu, text='quit', command=quit2)
quit1.pack()
menu.mainloop()
while True:
menu1()
| <python><tkinter> | 2016-10-09 17:10:14 | LQ_EDIT |
39,946,263 | Issue with Garbage Collection | <p>I have code some what like</p>
<pre><code>class HappyGarbage01
{
public static void main(String args[])
{
HappyGarbage01 h = new HappyGarbage01();
h.methodA(); /* Line 6 */
}
Object methodA()
{
Object obj1 = new Object();
Object [] obj2 = new Object[1];
obj2[0] = obj1;
obj1 = null;
return obj2[0];
}
}
</code></pre>
<p>Will the most chance of the garbage collector being invoked be after line 9 or 10?</p>
| <java> | 2016-10-09 17:10:27 | LQ_CLOSE |
39,946,381 | Binding in ViewHolder | <p>This will be theoretical question.</p>
<p>As everyone we use RecyclerView in many parts of the app. Sometimes RecyclerView contains different items, not only image for example, but ads, hints etc. And that's why we can use getViewType() method in Adapter. </p>
<p>But problem occurs when we have many viewTypes and binding this in Adapter is not elegant. So here is the question, <strong>is it nice and good pattern to bind data in ViewHolder?</strong></p>
<p>Let's say we have list of apps.</p>
<p>Every app has name for simplicity. Our ViewHolder looks like this:</p>
<pre><code>class AppViewHolder extends RecyclerView.ViewHolder {
public TextView nameText;
AppViewHolder(View itemView) {
super(itemView)
nameText = (TextView) itemView.findViewById(R.id.text_name);
}
}
</code></pre>
<p>Now we could add bind method:</p>
<pre><code>public void bind(App app) {
nameText.setText(app.getName());
}
</code></pre>
<p>Is it good pattern?</p>
<p>Another solution would be using ViewModel. Because we have different items in RecyclerView, our Adapter could contain list of class which is base class for every ViewModel.</p>
<p>So basic class is:</p>
<pre><code>class RecyclerViewItem {}
</code></pre>
<p>Now class which is ViewModel for App.</p>
<pre><code>class AppRecyclerViewItem extends RecyclerViewItem {
App app;
...
}
</code></pre>
<p>and our Adapter just has list of RecyclerViewItems:</p>
<pre><code>class Adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
List<RecyclerViewItem> items;
...
}
</code></pre>
<p>So with this approach (I mean using ViewModel) is it better to add bind method in ViewHolder, or in ViewModel?</p>
| <android><android-recyclerview><android-viewholder> | 2016-10-09 17:21:49 | HQ |
39,946,632 | ReactorNotRestartable error in while loop with scrapy | <p>I get <code>twisted.internet.error.ReactorNotRestartable</code> error when I execute following code:</p>
<pre><code>from time import sleep
from scrapy import signals
from scrapy.crawler import CrawlerProcess
from scrapy.utils.project import get_project_settings
from scrapy.xlib.pydispatch import dispatcher
result = None
def set_result(item):
result = item
while True:
process = CrawlerProcess(get_project_settings())
dispatcher.connect(set_result, signals.item_scraped)
process.crawl('my_spider')
process.start()
if result:
break
sleep(3)
</code></pre>
<p>For the first time it works, then I get error. I create <code>process</code> variable each time, so what's the problem?</p>
| <python><python-2.7><scrapy><twisted> | 2016-10-09 17:47:46 | HQ |
39,946,709 | Hey guys, new to C and am having trouble with this work assignment. I use a C89 compiler btw | Write a program that sort its command-line arguments of 10 numbers, which are assumed to be integers. The first command-line argument indicate whether the sorting is in descending order (-d) or ascending order (-a), if the user enters an invalid option, the program should display an error message. Example runs of the program:
./sort –a 5 2 92 424 53 42 8 12 23 41
output: 2 5 8 12 23 41 42 53 92 424
./sort –d 5 2 92 424 53 42 8 12 23 41
output: 424 92 53 42 41 23 12 8 5 2
1) Use the selection_sort function provided for project 5. Create another function that’s similar but sorts in descending order.
2) Use string library functions to process the first command line argument.
3) Use atoi function in <stdlib.h> to convert a string to integer form.
4) Compile the program to generate the executable as sort:
gcc –Wall –o sort command_sort.c
What I have so far is:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//function prototype
void swap(int *arr, int i, int j);
//main function
int main(int argc, char *argv[])
{
//declare the required variables
int array[10];
int maxIndex = 0, minIndex =0;
int i = 0, j = 0, n = 2;
//check whether the number of arguments are less than 2 or not
if (argc < 2)
{
//print the error message
printf("Data is insuffient! Please insert proper input at command line. \n");
}
else
{
// read the integers from the command line
for (i = 0; i < 10; i++)
array[i] = atoi(argv[2 + i]);
}
printf("Selection sort on integer arrays \n\n");
//print the elements that are read from the command line
printf("Elements before sorting are: \n");
//print the sorted elements
for(i =0;i<10;i++)
printf("%d ", array[i]);
printf("\n");
//check whether the first argument is -a, if
//-a sort the elements in the array in asscending order
if (strcmp(argv[1], "-a") == 0)
{
//logic to sort the elements in asscending order using selection sort
for (i = 0; i < 10; ++i)
{
minIndex = i;
for (int j = i + 1; j < 10; ++j)
{
if (array[j] < array[minIndex])
minIndex = j;
}
swap(array, minIndex, i);
}
}
//check whether the first argument is -d, if
//-d sort the elements in the array in descending order
if (strcmp(argv[1], "-d") == 0)
{
//logic to sort the elements in descending order using selection sort
for (i = 0; i < 10; ++i)
{
maxIndex = i;
for (j = i + 1; j < 10; ++j)
{
if (array[j] > array[maxIndex])
maxIndex = j;
}
swap(array, maxIndex, i);
}
}
//print the elements
printf("\nElements after sorting are: \n");
//print the sorted elements
for(i =0;i<10;i++)
printf("%d ", array[i]);
printf("\n\n");
return 0;
}
//definition of swap function
void swap(int *arr, int i, int j)
{
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
} | <c><arrays><sorting> | 2016-10-09 17:54:44 | LQ_EDIT |
39,947,055 | How to caculate UITableViewCell Height when have more UILabel? | We Use systemLayoutSizeFitting to caculate UITableViewCell`s Height when number of UILabel less than 2,like this [enter image description here][1]
How to caculate Cell Height when have more UILabel? like this [enter image description here][2]
[1]: http://i.stack.imgur.com/XpWo7.png
[2]: http://i.stack.imgur.com/JgSyK.png | <ios><swift><uitableview> | 2016-10-09 18:28:41 | LQ_EDIT |
39,947,545 | Java: non-distributed event-processing | <p>My application logic should be based on event processing. Its not that hard to implement corresponding producer-consumer patterns and event classes. But first I would like to ensure this was not implemented before.</p>
<p>I would like to specify that I am talking about non-distributed event-processing. I.e. I dont need to serialize my events and send them to some other JVMs.</p>
<p>Which options do I have?</p>
<ol>
<li>I use Spring. In Spring there is event-handling support already present. Is Spring event-processing robust enough? What are the limitations?</li>
<li>I can use Akka. Good, but Akka is mainly for distributed systems. Is it worth to use it for single JVM application?</li>
<li>I can implement this by myself. Not a big deal, but I always prefer to consult stackoverflow before reinventing the wheel.</li>
</ol>
<p>?</p>
| <java><spring><event-handling><akka> | 2016-10-09 19:17:44 | LQ_CLOSE |
39,947,580 | The class file for a new Thread and the class file for main are the same | <p>I have a program called Main.java, shown as below. After compilation of this program, there will be two .class file: Main.class and Main$1.class. My problem is the two .class files are exactly the same. </p>
<p>Anyone knows what is wrong? </p>
<p>I wan to instrument some codes in the run() method of the new thread, but I cannot find the instructions of codes in the run() method of a new thread. </p>
<pre><code>public class Main{
public static void main(String...args){
Thread t=new Thread(){
@Override
public void run(){
System.out.println("xxxx");
}
};
t.start();
}
}
</code></pre>
| <java><multithreading><instrumentation><.class-file> | 2016-10-09 19:20:45 | LQ_CLOSE |
39,948,027 | How do I make vendoring work with Google App Engine? | <p>I am trying to introduce Go vendoring (storing dependencies in a folder called <code>vendor</code>) to an existing App Engine project. I have stored all dependencies in the vendor folder (using Godep as a helper) and it looks right, but running the application locally I get the following error: </p>
<p><code>go-app-builder: Failed parsing input: package "golang.org/x/net/context" is imported from multiple locations: "/Users/erik/go/src/github.com/xyz/abc/vendor/golang.org/x/net/context" and "/Users/erik/go/src/golang.org/x/net/context"</code></p>
<p>I believe the two locations should resolve to the same location, as Go applications should look in the <code>vendor</code> folder first. Is there a way to make Appengine understand that both dependencies are the same?</p>
| <google-app-engine><go> | 2016-10-09 20:07:38 | HQ |
39,948,151 | In R plotly subplot graph, how to show only one legend? | <p>I have a basic subplot with two graphs, both have a legend by default, but I want to see only one of them.</p>
<p>I tried this :</p>
<pre><code>require(plotly)
p1 <- plot_ly(data=iris,x=~Sepal.Length,y=~Sepal.Width,split=~Species) %>% layout(showlegend = FALSE)
p2 <- plot_ly(data=iris,x=~Sepal.Length,y=~Sepal.Width,split=~Species) %>% layout(showlegend = TRUE)
subplot(p1,p2)
subplot(p2,p1)
</code></pre>
<p>But it doesn't work : it seems as if only one showlegend attribute was handled, so if I start with p1 I have two legend, if I start with p2 I have two. </p>
<p>Any ideas ?</p>
| <r><plotly> | 2016-10-09 20:20:38 | HQ |
39,948,739 | Why the array is undefined? | <p>In following code snippet why I see undefined logged?However if I separate call to range method and store in some local variable then perform <code>foreach</code> ,it works fine.</p>
<pre><code> var range = function (max) {
var result = [];
var index;
for (index = 0; index <= max; index = index + 1) {
result.push(index);
}
return result;
};
var arr= range(100).forEach(function (number, index,array) {
if (number % 3 == 0) {
array[index] = "c";
}
});
console.log(arr);
</code></pre>
| <javascript> | 2016-10-09 21:29:34 | LQ_CLOSE |
39,948,754 | Python 3.x Is there anyway to take the users input in one variable and use that input in another variable? | [Python 3.x] Is there anyway to take the users input in one variable and use that input in another variable?
For example:
def user_input():
numb = input("Please input the number ")
numb_process()
def numb_process():
if numb == '1':
print("Good")
else:
print("Bad")
user_input()
Sorry if this is a silly question, I am quite new to Python and am still learning. Any help would be very appreciated.
Thanks | <python><python-3.x> | 2016-10-09 21:31:28 | LQ_EDIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.