text:
Q: How to silent (vibrate only) alarms? When I use silent mode, I expect no sound and hence I expect alarms to be silent as well but they are not; ring/silent switch has no effect on alarms!
On iOS 5 this used to work and in silent mode alarms did just vibrate.
How can i put alarms in silent mode without reconfiguring each of them one by one when I need silent mode?
Thanks

A: Use a silent MP3
Here's the solution that worked for me:

*

*Get silent audio clip. Search online (e.g. using Google) or create (using GarageBand, Audacity, etc.) a 20-25 second clip of silence.

*Get clip into iTunes. Save it in your iTunes as a "song" (I just called it Silent Ringtone).

*Get clip onto iPhone. Then sync your phone so it's now on your phone. (Make sure you check the Sync Music checkbox in iTunes.)

*Use clip on iPhone. Now, when you create an alarm, use Pick a Song from your library, and select your "Ringtone" song.   If you have your settings elsewhere set to vibrate on silent or whatever, then you should now have a song that "plays" while your phone happily buzzes.

Hope that helps!
P.S. As someone who only recently switched to iPhone from a phone that could do the vibrate-only alarm thing easily, I would use these alarms to set myself private reminders for lots of things. Such as when I was in a lecture or meeting and needed to remember to leave 5 minutes early but didn't want to be watching the clock constantly. Or if I had to remember when to go back and put more money in the parking meter. Or basically a multitude of things to alert myself that I didn't need to whole world to know about! Just a simple buzz in the pocket was enough.
Further reading: HowToGeek has screenshots

A: When you make the alarm, go to the option where it says "sound" and go all the way to the bottom where it says "none" and click on it. I just tested it with my iPhone on silent and the alarm does not go off. Hope this helps.

A: Set "Sound" to "None"
Don't know if this will do but for me (iOS6), setting to silent and then turning the ringer down as far as it will go makes the alarm vibrate only. Just remember to turn your volume back up later.
Further reading: Apple Support: How to set and manage alarms on your iPhone

A: In your situation where you would like the vibration, but just not the sound the solution may require a bit of an investment.  If you go into iTunes and search for "Silent iPhone" they have ringtones that you can set as the default for your alarms. I think that would give you your desired result of vibration with no sound. The only downside being if you are expecting more than just a vibration if you are out of silent mode.

A: I did a lot of searching, and most solutions were to download a free ringtone recorder to record a silent ringtone. However, there was still static in the recording just due to ambient noise. The best solution is to do the following:

*

*Do a google search for blank MP3 (I used the following result: http://www.xamuel.com/blank-mp3s/)

*Download a blank MP3 to your desktop (I think any length will work, as I tried the 5 Sec and 30 second files and both had the same result, so I went with the 5 second file)

*Open iTunes → File → Add To Library

*Select the blank MP3 file from your Desktop that downloaded in step #2

*Either give the blank MP3 file it's own playlist and sync that playlist to your iPhone (I created a playlist called Silent) or add it to an existing playlist that is sync'd to your phone

*Go to the alarm that you only want to vibrate, select the sound option, select pick a song and select the Silent MP3 file you just sync'd

*The last thing you need to do is make sure your phone is set to vibrate when it rings; go to Settings → Sounds and make sure Vibrate On Ring and Vibrate On Silent are on

A: I tried the suggestion to search "silent iPhone" in iTunes ($1.29 & I chose the second option).  Then I sat that as the tone for my daily recurring alarm to take my Claritin (it goes off in the morning & when I'm sitting in lecture it's rude & annoying to have someone's phone go off & disrupt the entire class).  I made sure to flip the mute button on my iPhone 6 with "vibrate on ring" & "vibrate on silent" both turned on.  The alarm went off perfectly with only a vibration in my pocket so the world doesn't have to stop what they're doing- I can quietly take care of it & go about my day with everyone else none the wiser.

A: How to Set an iPhone Alarm to Vibrate Only

*

*Open the Clock app.

*Select Alarm at the bottom of the screen.

*Touch Edit at the top-left corner of the screen.

*Select the alarm that you wish to modify.

*Tap the Sound button.

*Scroll to the bottom of the screen and select None.

*Scroll to the top and select Vibration.

*Specify the type of vibration that you wish to use.

From here: https://www.live2tech.com/set-iphone-alarm-vibrate/

A: I think the best solution is, select any song as a ringtone, select a type of desired vibration(like Symphony or SOS), save the alarm , then reduce the phone ringtone volume(by pressing the external volume buttons), and bingo, job done.


text:
Q: Return string from C function accepting two strings Forgive my C newbness!  I'm trying to create a function that accepts two char arrays as arguments, and returns some JSON.  Here is my code, followed by compile warnings.  The program simply segfaults upon execution.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char get_json(char *sid, char *obuf)
{
        char *json;
        json = malloc(strlen(obuf)+37);
        strcpy(json, "{\"sessionline\":{\"sid\":\"");
        strcat(json, sid);
        strcat(json, "\",\"line\":\"");
        strcat(json, obuf);
        strcat(json, "\"}}");
        return json;
}

int main()
{
        char *sid = "xyzxyzxyz";
        char *obuf = "asdfasdfasdfasdf";
        char *json = get_json(sid, obuf);
        printf(json);
}

When compiling with gcc:
test.c: In function 'get_json':
test.c:14:9: warning: return makes integer from pointer without a cast [enabled by default]
         return json;
         ^
test.c: In function 'main':
test.c:21:22: warning: initialization makes pointer from integer without a cast [enabled by default]
         char *json = get_json(sid, obuf);
                      ^
test.c:22:9: warning: format not a string literal and no format arguments [-Wformat-security]
         printf(json);
         ^

A: *

*get_json should return a pointer char*, not char.

*You forgot to include sid to the length to allocate, so your program will cause out-of-range access and invoke undefined behavior.

*There are no harm in this program, but generally putting string from user into the format string of printf() is dangerous.

Try this:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char get_json(char *sid, char *obuf)
{
        char *json;
        json = malloc(strlen(sid)+strlen(obuf)+37);
        if(json == NULL) return json;
        strcpy(json, "{\"sessionline\":{\"sid\":\"");
        strcat(json, sid);
        strcat(json, "\",\"line\":\"");
        strcat(json, obuf);
        strcat(json, "\"}}");
        return json;
}

int main(void)
{
        char *sid = "xyzxyzxyz";
        char *obuf = "asdfasdfasdfasdf";
        char *json = get_json(sid, obuf);
        if (json != NULL) fputs(json, stdout);
}

or simpler this:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char get_json(char *sid, char *obuf)
{
        char *json;
        json = malloc(strlen(sid)+strlen(obuf)+37);
        if(json == NULL) return json;
        sprintf(json, "{\"sessionline\":{\"sid\":\""
                "%s"
                "\",\"line\":\""
                "%s"
                "\"}}", sid, obuf);
        return json;
}

int main(void)
{
        char *sid = "xyzxyzxyz";
        char *obuf = "asdfasdfasdfasdf";
        char *json = get_json(sid, obuf);
        if(json != NULL) fputs(json, stdout);
}

A: You are returning a char* as a char.
Your function declaration should look like this:
char* get_json(char *sid, char *obuf)

You also seem to put more stuff into json than it can fit given its size.
The segfault happens because in the conversion from char* to char the number is truncated to 1B, so printf(json) tries to read some byte of memory between 0 - 255, which it did not reserve previously.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Why does this code print the ASCII value instead of the character I thought typecasting to char we do the trick but it just prints ascii values
   String str = JOptionPane.showInputDialog("Enter a word");

   str = str.toUpperCase();
   String temp = "";

   for(int i = 0 ; i < str.length() ; i++)
   {
       temp += (char)str.charAt(i) + 1;
   }

   System.out.println(temp);

A: Your mistake is you are adding integer 1 to char .
This will return the ASCII code of the next char.
Change to
temp +=  (char)(str.charAt(i) +1)

A: You are adding + 1 and that is causing it to be converted to integer I am not sure if explained properly just remove it


text:
Q: Looping around a certain number of times I am trying to make this code only loop around 3 times as I do not need the 4th value. How can I do this?
{this.props.league.prizes && this.props.league.prizes.length > 0 ?
                            <View style={styles.section}>
                                {this.props.league.prizes.map((p, i) => (
                                    <View key={Math.random().toString(36).substr(2, 5)} style={[styles.sectionPart, { borderRightWidth: 1 }]}>
                                    <Text style={styles.label}>{this.getPositionString(i + 1)} Place</Text>
                                        <Text style={styles.prizeAmount}>{places[i]}</Text>
                                    </View>
                                ))}
                            </View> : null}

A: Use the slice function: list.slice(0, 3).map(..)

A: Why dont use make the this.props.league.prizes contains only 3 items?
this.props.league.prizes.slice(0,3)
or set this.props.league.prizes.length = 3
then you can continue render with 3 items showing only


text:
Q: How to connect whatsapp channel with omnichannel routing? I have seen salesforce documentation for creating whatsapp channel for digital engagement in this link
https://help.salesforce.com/s/articleView?id=sf.messaging_set_up_whatsapp.htm&type=5
But I am not sure for the next steps that is:

*

*how to link the whatsapp channel with omni channel

*How can service agent talk with customer

*how can I enable automated response in whatsapp.


text:
Q: How to choose the link function when performing a logistic regression? I am running a logistic model. In SAS Entreprise Miner, I noticed there's a link function that has three possible options: logit, probit and cll (complementary log-log).
Can you please shed light on the following questions:

*

*Can we use any of these link function to carry out a logistic regression?

*Are there situations where one would be better than others?

*Is it intuitively possible to get some insight about which kind of function could be useful in which situation? (By just looking at the formula, complementary log-log function might be good for normalization of data when data does not depart (too much) from a normal distribution.)

Any additional pointers would be greatly appreciated.

A: I don't know of SAS, so i'll just answer based on the statistics side of the question. About the software you mays ask at the sister site, stackoverflow.

*

*If the link function is different (logistic, probit or Clog-log), than you will get different results. For logistic, use logistic.

*About the real differences of these link functions.
Logistic and probit are pretty much the same. To see why they are pretty much the same, remember that in linear regression the link function is the identity. In logistic regression, the link function is the logistic and in the probit, the normal.
Formally, you can see this by noting that, in case your dependent variable is binary, you can think of it as following a Bernoulli distribution with a given probability of success.
$Y \sim Bernoulli(p_{i})$
$p_{i} = f(\mu)$
$\mu = XB$
Here, thew probabitliy $p_{i}$ is a function of predictor, just like in linear regression. The real difference is the link function. In linear regression, the link function is just the identity, i.e., $f(\mu) = \mu$, so you can just plug-in the linear predictors.In the logistic regression, the link function is the cumulative logistic distribution, given by $1/(1+exp(-x)). In the probit regression, the link function is the (inverse) cumulative Normal distribution function. And in the Clog-log regression, the link function is the complementary log log distribution.
I never used the Cloglog, so i'll abstein of coments about it here.
You can see that Normal and Logist are very similar in this blog post by John Cook, of Endeavour http://www.johndcook.com/blog/2010/05/18/normal-approximation-to-logistic/.
In general I use the logistic because the coefficients are easier to interpret than in a probit regression. In some specific context I use probit (ideal point estimation or when I have to code my own Gibbs Sampler), but I guess they are not relevant to you. So, my advice is, whenever in doubt about probit or logistic, use logistic!

A: I have a question/comment.  I thought that by definition, logistic regression uses the logit link.  If you are using the probit or complementary log-log link, then I do not think that is logistic regression.
What you are doing is fitting generalized linear models on a binary outcome, which is assumed to follow a Bernoulli.  The 3 usual choices of link functions are the logit, probit, and complementary log-log.  If you are using the logit link, that is logistic regression.

A: All 3 link functions are s-shaped and are not going to be that different.  Li and Duan showed that if the predictor variables are well behaved (elliptically symmetric predictors are a subset of the well behaved group) then changing the link function will change the coefficients by a multiplicitive constant.  Even if the predictors are not perfectly well behaved the differences between similar link functions are unlikely to change the overall inference (the exact coefficients will change, but what is important or significant will still be under a different link function).
The logit allows you to interpret individual coefficients as log-odds, so it tends to be the most popular these days.

A: This is an excellent question that sits at the nexus of mathematics and science. As someone who teaches a linear models course that touches on "logistic regression" and its several possible link functions, I feel compelled to answer.
First, I believe that SAS is fitting a generalized linear model (GLM) and estimating the parameters using MLE (or qMLE) in its "logistic" function. As such, any appropriate link function that transforms (0, 1) into (-\inf, \inf) is appropriate. Of that infinite class of functions, the logit, the probit, and the complementary log-log are members... so are all quantile functions.
Second, there is little appreciable difference between the logit and the probit link functions. While the coefficient estimates will tend to differ by a factor of about 3.8, the predictions will be very similar.
Third, the logit and probit functions are symmetric about (0, 0.5), while the complementary log-log function is not symmetric. This constitutes the primary difference between the logit/probit functions and the complementary log-log function.
Recall that the dependent variable is the probability of a success and the independent variable is the linear predictor. For the logit/probit links, the function value approaches 0 at the same rate as it does 1. For the complementary log-log function, however, that is not true. The cloglog function approaches 1 more sharply than it approaches 0. [Side note: the log-log function is the complement of the cloglog. It approaches 0 more sharply than 1.]
Fourth... I'm not sure what that actually means in terms of your last question. My experience is that the science has not advanced enough to suggest a "correct" link function. As a result, I instruct my students to fit their model using several link functions. If the coefficient results differ by "a lot," then there is something wrong with their model. Otherwise, the model is robust to the selection of the link function.
While this is an answer to ayush biyani, I think #4 could drive an interesting discussion about link functions.


text:
Q: Creating UUID and UDID in iOS 7 I want to create UUID, I have code below which can create UUID, how can I create UDID with multiple vendors same ID in iOS7?
+ (NSString*) stringWithNewUUID
{
    CFUUIDRef uuidObj = CFUUIDCreate(nil);
    NSString *newUUID = (NSString*)CFUUIDCreateString(nil, uuidObj);
    CFRelease(uuidObj);
    return newUUID;
}

A: The CFUUIDCreate function produces a version 4 UUID which is taken entirely from a pseudo-random number generator.  There are no timestamps or MAC addresses embedded in this type of UUID. (That refers to the little-used version 1 flavour.) These are safe to use for nearly all applications.

A: This method returns random UUID in iOS 6 and above
[[UIDevice currentDevice]identifierForVendor]

A: I have created a vendor ID and then saved it with keychain, which I am retaining for next time using KeychainWrapper keychainStringFromMatchingIdentifier:...

A: The UUID that the code produces above does not have a recoverable time stamp in it. It's just a string that looks something like this: E1D87006-7CD0-4E28-9768-624DA92F75D6

A: I followed Sandeep Khade's answer and made following code using PDKeychainBindings. It's same as using NSUserDefaults but it keeps identifier in keychain which saves data even when application is deleted.
+ (NSString *)uniqueVendor {

    PDKeychainBindings *keychain = [PDKeychainBindings sharedKeychainBindings];
    NSString *uniqueIdentifier = [keychain objectForKey:kKeyVendor];

    if (!uniqueIdentifier || !uniqueIdentifier.length) {

        NSUUID *udid = [[UIDevice currentDevice] identifierForVendor];
        uniqueIdentifier = [udid UUIDString];
        [keychain setObject:uniqueIdentifier forKey:kKeyVendor];
    }

    return uniqueIdentifier;
}


text:
Q: How can I manipulate List-Data on a certain SiteCollection using a TimerJob? I need to periodically execute code that reads and writes ListData within a certain SiteCollection. My first thought was a TimerJob.
Can I create a TimerJob using a SiteCollection-Feature? How can I tell this TimerJob which SiteCollection it should target and how can I access this SiteCollection's data in the TimerJob's code?
While there are many SiteCollections in the parent WebApplication, I only need this TimerJob to process the data of one single specific SiteCollection.
Thank you in advance for any help!

A: Timer Job is executed through SharePoint Timer Services. So there is no concept of Site Collection Scope etc.
You can say on which all servers (in case of multiple server farm) the job should be executed. This can be achieved using the constructor
public CustomTimerJob(string jobName, SPService service):
      base(jobName, service, null, SPJobLockType.Job) { ...
//Read more about SPJobLockType

You can use a Feature to install the Timer Job. Inside the Feature Receiver you can create new Timer Object and set the Schedule. Based on the schedule timer job will get executed every (day/x hours/y minutes)
Now each timer object has an Execute method. You need to write your code inside this method.
To target data in a specific Site Collection you can use SPSite object as
using(SPSite sitecollection = new SPSite("http://sitecollectionURL"))
{
    using(SPWeb web = sitecollection.OpenWeb())
    {
        SPList list = web.Lists["ListName"];
        ...

A: Timer-Jobs have to be deployed in farm scope and also run in that scope. You´d have to connect in your timer-job´s execute-method manually (or hardcoded or any configurable ways you´d like to provide) with the desired SPSite
using (var site = new SPSite(URL);
using (var web = site.openWeb());
{
enter code here
}


text:
Q: No getter method for property id of bean I don't know what's wrong with this. When I'm using "from Structure", it's working. But if I expand it to
"SELECT S.id, S.firstName, S.middleName, S.lastName, S.gender, S.birthdate, S.course, S.phone, S.address, S.classCode from StudentStructure S"

the error is:
javax.servlet.jsp.JspException: No getter method for property id of bean showStudent
    at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:716)
    at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:290)
    at org.apache.jsp.WEB_002dINF.crud.show_jsp._jspx_meth_bean_005fwrite_005f0(show_jsp.java:330)
    at org.apache.jsp.WEB_002dINF.crud.show_jsp._jspService(show_jsp.java:165)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:387)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:687)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:403)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
    at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:972)
    at org.apache.struts.action.RequestProcessor.processActionForward(RequestProcessor.java:408)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:269)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1109)
    at com.getcare.utility.web.GetcareActionServlet.process(GetcareActionServlet.java:139)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:452)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
    at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:437)
    at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:381)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:619)
10:52:50,230 INFO  [STDOUT] - Servlet.service() for servlet action threw exception
javax.servlet.jsp.JspException: No getter method for property id of bean showStudent
    at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:716)
    at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:290)
    at org.apache.jsp.WEB_002dINF.crud.show_jsp._jspx_meth_bean_005fwrite_005f0(show_jsp.java:330)
    at org.apache.jsp.WEB_002dINF.crud.show_jsp._jspService(show_jsp.java:165)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:387)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:687)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:403)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
    at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:972)
    at org.apache.struts.action.RequestProcessor.processActionForward(RequestProcessor.java:408)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:269)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1109)
    at com.getcare.utility.web.GetcareActionServlet.process(GetcareActionServlet.java:139)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:452)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
    at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:437)
    at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:381)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:619)

THIS IS THE STRUCTURE:
import java.io.Serializable;
import java.util.ArrayList;

import com.getcare.remote.Structure;

/**
 *
 * @author clemjon
 *
 * @hibernate.class table="student"
 */

public class StudentStructure extends Structure implements Serializable{

    private Integer id;
    private Integer phone,classCode;
    private String firstName, middleName, lastName, gender, birthdate, course,address;
    private ArrayList students;
    StudentContactInfoStructure contact = new StudentContactInfoStructure();

    public ArrayList getStudents() {
        return students;
    }
    public void setStudents(ArrayList arrayList) {
        this.students = arrayList;
    }
    /**
     * @hibernate.id generator-class="sequence"
     * @hibernate.generator-param name="sequence" value="student_id_seq"
     */

    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }

    /**
     * @hibernate.property
     *
     */

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    /**
     * @hibernate.property
     *
     */

    public String getMiddleName() {
        return middleName;
    }
    public void setMiddleName(String middleName) {
        this.middleName = middleName;
    }

    /**
     * @hibernate.property
     *
     */

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    /**
     * @hibernate.property
     *
     */

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    /**
     * @hibernate.property
     *
     */

    public String getBirthdate() {
        return birthdate;
    }

    public void setBirthdate(String birthdate) {
        this.birthdate = birthdate;
    }

    /**
     * @hibernate.property
     *
     */

    public String getCourse() {
        return course;
    }

    public void setCourse(String course) {
        this.course = course;
    }

    /**
     * @hibernate.property
     *
     */

    public Integer getPhone(){
        return phone;
    }

    public void setPhone(Integer phone){
        this.phone = phone;
        this.contact.setPhone(phone);
    }

    /**
     * @hibernate.property
     *
     */

    public String getAddress(){
        return address;
    }

    public void setAddress(String address){
        this.address = address;
        this.contact.setAddress(address);
    }

    /**
     * @hibernate.property
     *
     */

    public Integer getClassCode(){
        return classCode;
    }

    public void setClassCode(Integer classCode) {
        this.classCode = classCode;
    }
}

AND THIS IS THE JSP:

<%@ page contentType="text/html; charset=EUC-KR" pageEncoding="EUC-KR"%>
<%@ taglib uri="/WEB-INF/struts-form.tld" prefix="form" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>

 <jsp:useBean id="studentForm" class="com.getcare.crud.web.StudentForm" scope="session"/>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<form:html >

<title>Show Student</title>

                Student Number
                First Name
                Middle Name
                Last Name
                Gender
                Birth Date
                Course
                Phone
                Address
                Subject
                Action
                Add

       <% int count = 0; %>

       <logic:iterate id="showStudent" name="studentForm" property="students">

                    <bean:write name="showStudent" property="id"/>
                    <bean:write name="showStudent" property="firstName"/>
                    <bean:write name="showStudent" property="middleName"/>
                    <bean:write name="showStudent" property="lastName"/>
                    <bean:write name="showStudent" property="gender"/>
                    <bean:write name="showStudent" property="birthdate"/>
                    <bean:write name="showStudent" property="course"/>
                    <bean:write name="showStudent" property="phone"/>
                    <bean:write name="showStudent" property="address"/>
                    <bean:write name="showStudent" property="classCode"/>
                    <a href="/orprovider/crud/updateForm.do?id=<bean:write name="showStudent" property="id" format="##########"/>&firstName=<bean:write name="showStudent" property="firstName" format="##########"/>&middleName=<bean:write name="showStudent" property="middleName" format="##########"/>&lastName=<bean:write name="showStudent" property="lastName" format="##########"/>&gender=<bean:write name="showStudent" property="gender" format="##########"/>&birthdate=<bean:write name="showStudent" property="birthdate" format="##########"/>&course=<bean:write name="showStudent" property="course" format="##########"/>&classCode=<bean:write name="showStudent" property="classCode" format="##########"/>&phone=<bean:write name="showStudent" property="phone" format="##########"/>&address=<bean:write name="showStudent" property="address" format="##########"/>">Update
                    <a href="/orprovider/crud/crudAction.do?method=delete&classCode=<bean:write name="showStudent" property="id" format="##########"/>" onclick="return validate()">Delete
                    <a href="/orprovider/crud/forwardAdd.do?id=<bean:write name="showStudent" property="id" format="##########"/>&firstName=<bean:write name="showStudent" property="firstName" format="##########"/>&middleName=<bean:write name="showStudent" property="middleName" format="##########"/>&lastName=<bean:write name="showStudent" property="lastName" format="##########"/>&gender=<bean:write name="showStudent" property="gender" format="##########"/>&birthdate=<bean:write name="showStudent" property="birthdate" format="##########"/>&course=<bean:write name="showStudent" property="course" format="##########"/>&phone=<bean:write name="showStudent" property="phone" format="##########"/>">Class / Contact Info

        <% count++; %>
        </logic:iterate>

     Records found: <%=count %>

 <form:link href="http://orgetcare/orprovider/crud/options.do">Return to Options</form:link>

</form:html>

STUDENT FORM:
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import net.sf.hibernate.mapping.Collection;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

import com.getcare.crud.remote.StudentContactInfoStructure;
import com.getcare.crud.remote.StudentStructure;

public class StudentForm extends ActionForm{

    private StudentStructure student = new StudentStructure();
    private StudentContactInfoStructure studentContact = new StudentContactInfoStructure();
    private ArrayList students = new ArrayList();
    private ArrayList studentContacts = new ArrayList();
    private int studentid;
//  private ArrayList s= new ArrayList();

//  public ArrayList getS() {
//      return (ArrayList) Arrays.asList(students,studentContacts);
//  }

//  public void setS(ArrayList s) {
//      this.s = (ArrayList) Arrays.asList(students,studentContacts);
//  }

    public int getId() {
        return student.getId();
    }

    public void setId(int id){
        student.setId(id);
        studentContact.setId(student.getId());
//      studentContact.setStudentid(id);
    }

    public void setFirstName(String firstName) {
        student.setFirstName(firstName);
    }

    public void setMiddleName(String middleName) {
        student.setMiddleName(middleName);
    }

    public void setLastName(String lastName) {
        student.setLastName(lastName);
    }

    public void setGender(String gender) {
        student.setGender(gender);
    }

    public void setBirthdate(String birthdate) {
        student.setBirthdate(birthdate);
    }

    public void setCourse(String course) {
        student.setCourse(course);
    }

    public void setPhone(Integer phone){
        student.setPhone(phone);
        studentContact.setPhone(phone);
    }

    public void setAddress(String address){
        student.setAddress(address);
        studentContact.setAddress(address);
    }

    public void setClassCode(Integer classCode) {
        student.setClassCode(classCode);
    }

    public String getFirstName() {
        return student.getFirstName();
    }

    public String getMiddleName() {
        return student.getMiddleName();
    }

    public String getLastName() {
        return student.getLastName();
    }

    public String getGender() {
        return student.getGender();
    }

    public String getBirthdate() {
        return student.getBirthdate();
    }

    public String getCourse() {
        return student.getCourse();
    }

    public Integer getPhone(){
        return student.getPhone();
    }

    public String getAddress(){
        return student.getAddress();
    }

    public Integer getClassCode(){
        return student.getClassCode();
    }

    public Integer getStudentid() {
        return studentContact.getId();
    }

    public void setStudentid(int studentid) {
        studentContact.setId(student.getId());
        studentContact.setStudentid(studentid);
    }

    @Override
    public void reset(ActionMapping mapping, HttpServletRequest request) {
        super.reset(mapping, request);
//      setId(0);
        setFirstName(null);
        setLastName(null);
        setMiddleName(null);
        setGender(null);
        setBirthdate(null);
        setCourse(null);
        setPhone(null);
        setAddress(null);
        setClassCode(null);
    }

    public ArrayList getStudents() {
        return student.getStudents();
    }
    public void setStudents(ArrayList students) {
        this.student.setStudents(students);
    }

    public ArrayList getStudentContacts() {
        return studentContact.getStudentContacts();
    }
    public void setStudentContacts(ArrayList studentContacts) {
        this.studentContact.setStudentContacts(studentContacts);
    }

    public StudentContactInfoStructure getStudentContact() {
        return studentContact;
    }

    public void setStudentContact(StudentContactInfoStructure studentContact) {
        this.studentContact = studentContact;
    }

    public StudentStructure getStudent() {
        return student;
    }

    public void setStudent(StudentStructure student) {
        this.student = student;
    }

}


text:
Q: How to add a multi coloured border underneath text I have created a multi coloured border but at the moment it appears in the top right instead of underneath my text. I want it to be underneath the text as like the text underline.
If I remove the float:right then it does go to the text, but appears either side of the text instead of underneath.

h1.title-v2.title-center, h2.title-v2.title-center, h3.title-v2.title-center {
    text-align: center;
}

h2.title-v2 {
    color: #555;
    position: relative;
    margin-bottom: 30px;
}

h1, h2, h3, h4, h5, h6 {
    color: #555;
    margin-top: 5px;
    text-shadow: none;
    font-weight: normal;
    font-family: Roboto;
}

h2 {
    font-size: 24px;
    line-height: 33px;
  }

  h2.title-v2.title-center:before, [dir=rt1] h2.title-v2.title-center:after {
    border-right: #F4A613 15px solid;
    border-left: #B0c335 15px solid;
}
h2.title-v2:before {
    left: 0;
    width: 45px;
    height: 4px;
    content: " ";
    bottom: -10px;
    float: right;
    background: #007DC5;
}
h2.title-v2.title-center:after, [dir=rt1] h2.title-v2.title-center:before {
    left: 50%;
    border-right: #56144A 15px solid;
    border-left: #C62428 15px solid;
}
h2.title-v2:after {
    left: 0px;
    width: 29px;
    height: 4px;
    content: " ";
    float: right;
    }

News

A: I assume you've taken the ::before/::after idea from this question:
How to create multi-color border in css3
Their solution added a multi-colored border above the div, using this ::after pseudo element-
.yourDiv::after {
  background: linear-gradient(to right, #bcbcbc 25%,#ffcd02 25%, #ffcd02 50%, #e84f47 50%, #e84f47 75%, #65c1ac 75%);
  position: absolute;
  content: '';
  height: 4px;
  right: 0;
  left: 0;
  top: 0;
}

Changing the 'top:0' part to 'bottom:0' will place the border at the bottom of the div instead.
See working fiddle here:
https://jsfiddle.net/rrupuL99/
Hope it helps

A: You can use linear-gradient to solve your problem. It is much easier see following example:

h1.title-v2.title-center, h2.title-v2.title-center, h3.title-v2.title-center {
  text-align: center;
}
h2.title-v2 {
  color: #555;
  position: relative;
  margin-bottom: 30px;
}
h1, h2, h3, h4, h5, h6 {
  color: #555;
  margin-top: 5px;
  text-shadow: none;
  font-weight: normal;
  font-family: Roboto;
}
h2 {
  font-size: 24px;
  line-height: 33px;
}
h2:after {
  background:linear-gradient(
    to right,
    #56144A 0px, #56144A 15px,
    white 15px, white 45px,
    #C62428 45px, #C62428 60px,
    #F4A613 60px, #F4A613 75px,
    #007DC5 75px, #007DC5 120px,
    #B0c335 120px, #B0c335 135px
  );
  height:4px;
  display:block;
  content:"";
  width:135px;
  margin:0 auto;
}

News

You only need the :after on your
 to set the border. You can define the different colors on linear-gradient for the background of the :after.


text:
Q: Command delimited by return or blank line I have this document
\documentclass{scrartcl}

\long\def\quotenextparagraph#1

{\begin{quote}#1\end{quote}}

\begin{document}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

\quotenextparagraph
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

\end{document}

The command \quotenextparagraph puts its argument (which is delimited by a blank line) in a quote environment. One may suggest using
\long\def\quotenextparagraph#1\par{\begin{quote}#1\end{quote}}

but with that definition you loose the hability to include paragraph breaks (without little tricks) inside the argument. With the blank line in the definition you can use
\quotenextparagraph
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat.\par
Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

However… you need to leave no space before the \par token. If you leave a space, then LaTeX understands that the argument is delimited there.
 First question: why is that?
And now the second part of the question. I'm interested in doing the same thing with only one return (I don't know the exact word; I mean "blank line" = two returns).
\def\quotethisline#1
{\begin{quote}#1\end{quote}}

so that
\quotethisline Lorem ipsum dolor sit amet.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
anim id est laborum.

gives only Lorem ipsum dolor sit amet. in the quote. As I expected, it only gives Lorem (until the first space).
 Second question: why does this happen?
Third question: how can I achieve the argument delimited by only one return? (preferably without touching catcodes, if possible)
PS: I might know why, but I think it's worth to have an answer explaining it.

A: TeX processes its input using several processors:
input processor -> token processor -> expand processor -> main processor
A gastro-anatomical terminology is mentioned in the TeXbook for this but I never use this terminology.
The Input processor reads lines from file, appends \endlinechar and (maybe) re-encodes the line and outputs each line as a buffer to the token processor. The token processor reads the buffers and generates sequence of tokens. The main reason of the token processor is (roughly speaking):

*

*to pack up each \csname as one token.

*to merge double (or more) spaces to one space token.

*to replace end of buffer (i.e. end of line) to space token.

*to generate \par token instead of each (visual) empty line.

*to assign a category (catcode) to each generated token.
There are two types of catcodes: first type is designated to the token processor itself (0 \, 5 endline, 9 ignored char, 14 comment char, 15 forbidden char) and second: the others catcodes. The first type of catcodes never occurs at the output side of the token processor.
The expand processor expands macros. It means that macros treat only with sequences of tokens from the token processor, the original structure of lines is invisible from this point of view (by default settings of catcodes and \endlinechar). The task to scan endline by macros is comparable to the task to scan doublespaces between words: this is impossible because double spaces don't exist at this level of processing.
The main processor takes unexpandable primitive commands (as an output from expand processor) and does: assignments or typessetting.
The processing is controlled from main processor: when main processor needs the command (or command parameter), it asks to the expand procesor. When expand processor needs the new token from the input stream, it asks to the token processor. When token processor needs the new buffer, it asks to the input processor. The minimal data is stored at each level of processors. Example:
\catcode`x=14x aaa
\catcode`X=14 X bbb

The first line sets x to the comment character (like %) but the letter x immediatelly after 14 has catcode 11 (letter) because it is touched by token processor when the parameter of the \catcode primitive was scanned. This was a time where catcode of x was 11. The second line sets X to the comment character. The parameter scanning is terminated by space, the \catcode primitive does assigmnent after this and the next token X is touched by token processor when X has catcode 14. Thus the aaa is visible but bbb is invisible (commented out).
You can set \endlinechar=something but you have to take into account that this endlinechar is appended firstly to the next line after the line already read. This is the reason why the first solution by egreg places the \quotenextline before the scanned line. His second solution utilizes the fact that default \endlinechar is 13 (i.e. ^^M character). Its cactode is set by default to 5 (i.e. replace it to space token and stop the reading of the current linebuffer) and it is replaced to the active character which does some work and terminates the group.
You can use similar technique for \quotenextparagraph too:
\def\quotethisparagraph {\bgroup
    ... do some starting work ...
    \def\par{\endgraf ... do some ending work ... \egroup}%
}

This technique is better beause it doesn't scan text to the parameter. Thus catcode changing (like \verb|...|) will work inside this environment. You can tell to the user (in the documentation about \quotethisparagraph) that if more paragraphs are expected inside this environemt then the \endgraf instead \par or instead empty line have to be written.

A: Here's just a "semi-generalization" (with expl3) of the solution provided by egreg. I tried exactly that before asking this question (just touching catcodes of ^^M and using an auxiliar command, inspired by the definition of \obeylines) but, unfortunately for me, it didn't work (I need more training with catcodes and groups and where to change catcodes and where not to).
It's not quite important, but just automatises this process a little bit.
\documentclass{scrartcl}
\usepackage{xparse}

\ExplSyntaxOn
\group_begin:
  \char_set_catcode_other:N \^^M %
  \cs_new:Npn \cs_new_delimited_by_newline:Nn #1 #2 %
    { %
      \cs_new:Npn #1 %
        { %
          \group_begin: %
            \char_set_catcode_other:N \^^M %
            \use:c { __ \cs_to_str:N #1 } %
        } %
      \cs_new:cpn { __ \cs_to_str:N #1 } ##1 ^^M %
        { %
            #2 %
          \group_end: %
        } %
    } %
\group_end:
\cs_new_delimited_by_newline:Nn \quotethisline
  {
    \begin{quote} ``\emph{#1}'' \end{quote}
  }
\ExplSyntaxOff

\begin{document}
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
anim id est laborum.
\quotethisline Lorem ipsum dolore sit amet.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
anim id est laborum.
\end{document}

A: In the first definition, the argument is delimited by a space and a \par token:
\long\def\testA#1

{\begin{quote}#1\end{quote}}

\long\def\testB#1 \par{\begin{quote}#1\end{quote}}

\ifx\testA\testB\message{EQUAL}\else\message{DIFFERENT}\fi

prints
EQUAL

The first end-of-line in \testA is converted to a space token; the second one is converted to a \par token, because it is scanned when TeX is in its "skipping blanks" state.
The definition
\def\quotethisline#1
{\begin{quote}#1\end{quote}}

is fully equivalent to
\def\quotethisline#1 {\begin{quote}#1\end{quote}}

because the tokenization converts the end-of-line to a space token.
You can't delimit a string by just an end-of-line without category code juggling, because tokenization is performed before macro expansion.
Also, TeX reads a full line and replaces the operating system end-of-record separator with \endlinechar before tokenization, which gives even more problems.
One can do like this, which has minimal impact on category codes:
\documentclass{scrartcl}

\catcode`\^^L=\active
\def^^L{\end{quote}\endlinechar=13 }
\def\quotenextline{%
  \begin{quote}
  \endlinechar`\^^L
}

\begin{document}

Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
anim id est laborum.
\quotenextline
Lorem ipsum dolor sit amet.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
anim id est laborum.

\end{document}

However, this is just a plaything: never use the end of line as delimiter, unless you're in a very controlled environment (verbatim mode, for instance).
This is another solution, copied from section 11.9.4 of TeX by Topic:
\documentclass{scrartcl}

\def\quotethisline{\begingroup\catcode`\^^M=12 \xquotethisline}
{\catcode`\^^M=12 %
 \gdef\xquotethisline#1^^M{\begin{quote}#1\end{quote}\endgroup}%
}

\begin{document}

Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
anim id est laborum.
\quotethisline Lorem ipsum dolor sit amet.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
anim id est laborum.

\end{document}


text:
Q: Why do Java's Iterator and ListIterator point between elements? The Javadoc for ListIterator says:

A ListIterator has no current element; its cursor position always lies
  between the element that would be returned by a call to previous() and
  the element that would be returned by a call to next().

Why was Java's ListIterator implemented to point between elements rather than at a current element?  It seems that this makes client code less readable when it has to repeatedly call getNext(), getPrevious(), so I assume there must be a good reason for the choice.
As a side note, I just wrote a little library called peekable-arraylist that extends ArrayList, Iterator, and ListIterator that provides a peekAtNext() and peekAtPrevious() methods implemented like:
  @Override public synchronized T peekAtNext() {
     T t = next();
     previous();
     return t;
  }

A: As far as I can tell, the reason can be found in the part of javadoc you didn't quote (emphasis below mine):

An iterator for lists that allows the programmer to traverse the list in either direction, modify the list during iteration...

You see, the intended purpose is to allow usage while list is being modified. Possible modifications apparently include removal of the elements.
Now think of what would happen if we remove an element that would be current() for iterator - assuming that iterator would have a notion of current element? In this context, the way to implement it without a notion of current element makes pretty good sense to me - because that way, iterator does not have to worry about elements removal.

It is important to note that javadoc does not require interface implementations to be thread safe.

*

*Because of that, one should not expect correct handling of modifications done from different threads - for that, implementation would have to provide additional means to synchronize access, guarantee visibility etc as specified by Java Memory Model per JSR 133.

What ListIterator is capable of, is handling modifications done from the same thread when iterating. Not all the iterators are like that, ConcurrentModificationException javadocs specifically warn about this:

...Note that this exception does not always indicate that an object has been concurrently modified by a different thread. If a single thread issues a sequence of method invocations that violates the contract of an object, the object may throw this exception. For example, if a thread modifies a collection directly while it is iterating over the collection with a fail-fast iterator, the iterator will throw this exception...


text:
Q: I keep Getting Control reaches end of non-void function. What am I doing wrong? location pick(void){    // generates a random location
     location get;
     get.x = rand() % FIELD_SIZE + 1;
     int forY = rand() % FIELD_SIZE +1;
    switch(forY){
    case 1:
        get.y = 'a';
            break;
    case 2:
        get.y = 'b';
            break;
    case 3:
        get.y = 'c';
            break;
    case 4:
        get.y = 'd';
            break;
    case 5:
        get.y = 'e';
            break;
    }

}

A: You're missing return get; at the end of your function.

A: Make sure to return get; in your function!
Otherwise, you want to declare your function as void pick.

A: Are you returning a value from your function?

A: Your function, as written, does not return anything, but it is declared to return a location.  You probably want return get; at the end, as Mark said.

A: You may want to pass the location item by reference to the function.  This may reduce the stack size:
void pick(location& get)
{
     get.x = rand() % FIELD_SIZE + 1;
     int forY = rand() % FIELD_SIZE +1;
    switch(forY){
    case 1:
        get.y = 'a';
            break;
    case 2:
        get.y = 'b';
            break;
    case 3:
        get.y = 'c';
            break;
    case 4:
        get.y = 'd';
            break;
    case 5:
        get.y = 'e';
            break;
    }
    return;
}

Also, think about a default case in your switch statement.  Error handling now will help prevent wasting later debugging time.
Another suggestion:  convert switch statement into a table lookup.  This allows the table to change without having to change the code (and retest the function).  This can be further extended to placing the data into an external file.  The external file allows changes to the data without the need to rebuild the program.

A: Hmm...now that you've been told how to fix the problem, here's how I'd write the code:
location pick(void){    // generates a random location
     location get;
     get.x = rand() % FIELD_SIZE + 1;
     get.y = rand() % FIELD_SIZE +'a';
     return get;
}

Purely in theory, this isn't entirely portable -- letters aren't required to be contiguous. In reality, the only one known where they aren't contiguous is EBCDIC, and it is contiguous in the range you're using. If you were really concerned about it, however, you could do something like:
location pick(void){    // generates a random location
     static char letters[] = "abcdef";
     location get;
     get.x = rand() % FIELD_SIZE + 1;
     get.y = letters[rand() % FIELD_SIZE];
     return get;
}


text:
Q: Which PHP ORM with built in array type (for PostgreSQL)? I would like to use PostgreSQL as main RDB in my Symfony 3 based project. I plan to use PostgreSQL array type extensively (storing arrays, querying arrays), and possibly other PostgreSQL specific functionalities.
Which ORM has is best suited for it? I see that Doctrine 2 has 'array type', but it stores elements in text fields. I would like to use some existing ORM / extension for ORM, not create it by myself (like creating some mappings for Doctrine).
Query builder with support for array operators would be a big plus.

A: From Doctrine 2.6 you can use the json_array type ( see http://doctrine-orm.readthedocs.io/projects/doctrine-dbal/en/latest/reference/types.html#mapping-matrix ) and you can then query using the Native Query functionality.
There is also an open source Symfony Bundle which back ports this functionality https://github.com/boldtrn/JsonbBundle if need to be on an older version of Doctrine.
I know you specifically asked about the Postgres array type but storing as an array in the JSON type is very similar from my understanding. I would be interested to know if there are any downsides to this?


text:
Q: How this equation of the voltage is attained? I've may been asking the very easy question.

The each resistor has the same resistance(given by \$r\$).
The textbooks states the following.
\$V_{AB}=r\{i_1+i_2+i_3+(I-i_1)\}\$
How the above equation is attained?
Can anyone tell me some hint(s)? so that I can deduce it in my own.

A: To find voltage between \$A\$ and \$B\$ , traverse from node B to A through any of the paths, and add all the voltage drops along the way. For instance, you can follow this path:

P.S: Assuming that the circuit and current directions are correct, you will find that the textbook answer is wrong for \$V_{AB}\$.


text:
Q: How to quit click after some specific event I am trying to generate UDP packets for benchmarking purposes.
my click configuration file: fastudp.click
/*
 * Author: Anuraag
 */

// FastUDPSource(RATE, LIMIT, LENGTH, SRCETH, SRCIP, SPORT, DSTETH, DSTIP, DPORT [, CHECKSUM, INTERVAL, ACTIVE])

FastUDPSource(1000, 2000, 64, 78:32:1b:71:81:b8, 192.168.0.250, 5432, FF:FF:FF:FF:FF:FF , 192.168.0.1, 5433)->ToDevice(enp2s0);

The command that I run to use click:
sudo click fastudp.click -h fudp.rate -h fudp.count

After 2 seconds, when I press CTRL+C:
^Cfudp.rate:
1000

fudp.count:
2000

What do I want?

I want a method/workaround so that the program automatically quits after sending the 2000 packets and displays the handler details fudp.rate and fudp.count

Any suggestion/comments are appreciated, thanks in advance

A: You typically use the Script element or DriverManager element for these types of things. As an example, run the config and stop after 2 seconds:
fudp::FastUDPSource(1000, 2000, 64, 78:32:1b:71:81:b8, 192.168.0.250, 5432, FF:FF:FF:FF:FF:FF , 192.168.0.1, 5433)->ToDevice(enp2s0);

Script (
    wait 2,
    printn "fudp.rate: ",
    print fudp.rate,
    printn "fudp.count: ",
    print fudp.count,
    stop
)

Credits:

*

*Beyers Cronje

*Issue on GitHub


text:
Q: Changing a numerical value in a file with Vim from a script I need to change the numerical value of a variable stored in a text file from the command line.
I've tried to script it with Bash, but only got so far:
#!/bin/bash
clear
vim The_Generator.c

(This is hopefully where I modify the The_Generator.c file).

-c 'wq'

A: Vim isn't the best way to get this done, but it is possible:
$ vim -c '%s/^\(VARIABLE=\)\d\+/\13/' -c wq The_Generator.c

%s means "search and replace globally" in Vi. The search pattern looks for a line beginning with VARIABLE= followed by one or more digits (\d+), then it replaces the digit(s) with 3, the new value of the variable I've chosen for the sake of the example here. The VARIABLE= part is put back into the line with the \1 backreference.
There are several weaknesses here that make this suboptimal:

*

*Vim is a fairly heavy program for a simple task like this. Notice that you get a brief flash of the full-screen vi interface while doing this. That's wasteful; we can do better.

*Vim isn't as widely deployed as the alternatives below, and we're using at least three features of Vim that aren't likely to exist in more traditional flavors of Vi such as Berkeley nvi or Solaris vi: backreferences, \d in regexes, and multiple -c flags.

*Because Vim isn't geared to this sort of problem, we need the explicit "save and exit" option here (-c wq) which is more briefly expressed in the alternatives below.
A more efficient and more portable option is to use sed:
$ sed -i -e 's/^\(VARIABLE=\)[0-9][0-9]*/\13/' The_Generator.c

If you're on a system where you can use POSIX extended regular expressions in sed via -E, you can make the command shorter than the Vim equivalent:
$ sed -E -i -e 's/^(VARIABLE=)[0-9]+/\13/' The_Generator.c

That let us drop several backslashes and express the "one or more digits" bit more compactly.
If efficiency isn't paramount, you can get more expressive power with the Perl pie idiom:
$ perl -pi -e 's/^(VARIABLE=)\d+/${1}3/' The_Generator.c

It's shorter than the sed -E alternative because Perl regexes are even more powerful than POSIX extended REs.
The largest difference here is in the way Perl handles backreferences. You normally give them as $NUM syntax instead of \DIGIT, but we put the number in curly brackets here to separate it from the replacement text, since it is also a number. Without the brackets, Perl would go looking for backreference #13, find no matching text and thus fail to do what you want.
Some people like Awk for this sort of thing, but I was unable to come up with an expression that pulled its own weight by being shorter than the sed option while being faster than the Perl option.


text:
Q: Jquery functions is not working for header. When I include header using .load() Method I am using .load() method for common header. But I want add dropdown in header for user profile.
Always, Script not working when I use .load() method for includin header.
Please don't suggest me to use PHP to include header file. I just want to resolve why jquery is not work when we use .load() method.
HTML File :-

  <title>How to include HTML page with jQuery</title>

Content

Header Code :-

Script :-

A: You can try like this:
Set a name for the function


text:
Q: Is it possible to use SLIM with ReactJs both together There is a classic React component:
var CommentForm = React.createClass({
  render: function() {
    return (
      <form className="commentForm">
        <input type="text" placeholder="Your name" />
        <input type="text" placeholder="Say something..." />
        <input type="submit" value="Post" />
      </form>
    );
  }
});

Is it possible to use Slim instead of HTML? Something like this:
var CommentForm = React.createClass({
  render: function() {
    return (
      form.commentForm
        input type="text" placeholder="Your name"
        input type="text" placeholder="Say something..."
        input type="submit" value="Post"
    );
  }
});


text:
Q: SonarQube: "Invoke method(s) only conditionally" Let's consider there is a class Status from a third party library which has implemented toString() method of their own as per below: -
public class Status<T> extends AttemptStatus<T> {

    public String toString() {
        StringBuilder sb = new StringBuilder("Status{");
        sb.append("id=").append(this.id);
        sb.append(", startTime=").append(this.startTime);
        sb.append(", endTime=").append(this.endTime);
        .....
    }
}

I use this class in my code as per below: -
public class ABC {

private <T> T executeWithRetries(Callable<T> callable, RetryConfig conf) {
    Status<T> status = new CallExecutorBuilder()
            .config(conf)
            .afterFailedTryListener(s -> {
                    LOGGER.warn("Connection failed. Retrying.");
                    MetricsUtil.REDIS_RETRIES_METER.mark();
                    this.redis = createConnection();
            })
            .build()
            .execute(callable);
    LOGGER.info(status.toString());
    return status.getResult();
}

Now SonarQube complains about Invoke method(s) only conditionally on this sentence below:-
LOGGER.info(status.toString());

So if I remove toString() from above sentence then compiler complains as per below: -
 LOGGER.info(status);

Cannot resolve method 'info(com.evanlennick.retry4j.Status<T>)'
Should I wrap the status variable in String.valueOf()? but then it would not give me a desired toString() method output specified in the Status class. Any solution?

A: How about:
LOGGER.info("{}",status);

A:
status is a java record. Sonar warning is not related to what I did here.


text:
Q: ipad scrollbar in html5 I am very new to HTML5 development for ipad. I am creating my first application for ipad using HTML5. Everything is done except I am facing one problem. Problem description is.
There is one vertical overflowing div. This page is viewed properly in computer's browser but when the same page is viewed in ipad the overflowing section is cutoff and it appears that there is no overflowing content.
Please let me know the proper way of doing it.

A: On the iPad scrollable div's using overflow scrollbars will not appear on that div. The only way to scroll is using a two finger swipe.
Joe says that Scrollability is not yet ready to be used, so I wouldn't implement it in a production system.
To do this you have other options like:
http://cubiq.org/scrolling-div-on-iphone-ipod-touch

A: You want native-like scrolling on the iPad in your HTML5 application? You might want to check out a project called Scrollability by Joe Hewitt: http://joehewitt.github.com/scrollability/

A: Check out https://github.com/appmobi/aux_web (aUX_webScroll)  .  I'm the author, so if you have any questions, let me know.
iOS5 has the new property to allow scrolling on divs, but you'll find out that when you use it in a webview, the whole webview moves too and surprisingly, not everyone upgrades the OS.

A: I wrote an article about new features in iOS 5. Also this topic is covered on section -webkit-overflow-scrolling: http://samuli.hakoniemi.net/ios-5-and-new-features-for-web-developers/#webkit-overflow-scrolling


text:
Q: setting default encoding in a python.py I am calling some sort of API which returns an object with three properties:
obj.name
obj.id
obj.text

all of these could come in different encoding.
In order to output it correctly to my terminal, I am now doing
print obj.name.encode('UTF-8')
print obj.id.encode('UTF-8')
print obj.text.encode('UTF-8')

Is there a way I can simply do one time to set my default encoding to UTF-8?
I read some other post which suggested calling the sys.setdefaultencoding('UTF-8'), which is not available anymore in python 2.7.x
Please advise.

A: Normally Python detects the output encoding from the terminal settings; you can see what Python detected by running:
import sys
sys.stdout.encoding

You really want to configure your terminal to specify the correct encoding if that doesn't work for you; set the LC_CTYPE environment variable on POSIX systems for example.
You can also force Python to use an encoding by setting the PYTHONIOENCODING environment variable:
$ PYTHONIOENCODING=latin-1 python -c 'import sys; print sys.stdout.encoding'
latin-1
$  PYTHONIOENCODING=utf8 python -c 'import sys; print sys.stdout.encoding'
utf8


text:
Q: custom template asp.mvc problem i have strongly typed View, custom template for properties of string type, i should change value
// model
class Person
{
  public string Name { get; set; }
}

// view
@model Person
<div>
    @Html.EditorFor(m => m.Name)
</div

//custom template view
@model System.String
@Html.TextBox(string.Empty, Model.ToUpper())

but it doesn't work — i get old Name value, not changed
NEW
i forgot important detail — Name property get value from query string in URL —
http://localhost:53494/?Name=blah

A: Html helpers such as TextBox always first look into modelstate when binding their value and because there is already a value coming from the request string it ignores the second argument you are passing to it. So to achieve what you are looking for you might need to first remove the value from model state:
@model string
@{
    ViewData.ModelState.Remove(ViewData.TemplateInfo.GetFullHtmlFieldName(""));
}
@Html.TextBox(string.Empty, (Model ?? string.Empty).ToUpper())


text:
Q: Deleting columns from a data.frame where NA is more than 15% of the column length I have a data.frame of 10 different columns (length of each column is the same). I want to eliminate any column that has 'NA' greater than 15% of the column length.
Do I first need to make a function for calculating the percentage of NA for each column and then make another data.frame where I apply the function? What's the best way to do this?

A: First, it's always good to share some sample data. It doesn't need to be your actual data--something made up is fine.
set.seed(1)
x <- rnorm(1000)
x[sample(1000, 150)] <- NA
mydf <- data.frame(matrix(x, ncol = 10))

Second, you can just use inbuilt functions to get what you need. Here, is.na(mydf) does a logical check and returns a data.frame of TRUE and FALSE. Since TRUE and FALSE equate to 1 and 0, we can just use colMeans to get the mean of the number of TRUE (is NA) values. That, in turn, can be checked according to your stipulations, in this case which columns have more than 15% NA values?
colMeans(is.na(mydf)) > .15
#    X1    X2    X3    X4    X5    X6    X7    X8    X9   X10
#  TRUE  TRUE FALSE FALSE FALSE  TRUE FALSE  TRUE  TRUE FALSE

As we can see, we should drop X1, X2, X6, X8, and X9. Again, taking advantage of logical vectors, here's how:
> final <- mydf[, colMeans(is.na(mydf)) <= .15]
> dim(final)
[1] 100   5
> names(final)
[1] "X3"  "X4"  "X5"  "X7"  "X10"

A: You could do it with data.table like so
Load data into data.table. Call it DT. Say cols 2 through 4 are numeric.
Theta = 0.15
Drop <- DT[, lapply(.SD, function (x) {sum(is.na(x))/length(x) > Theta} ), .SDcols = 2:4]
Cols.2.Drop <- names(Drop)[which(Drop==TRUE)]
DT[, (Cols.2.Drop) := NULL]

Tested with data here:
Obs Var1    Var2    Var3
A0001   21  21  21
A0002   21  78  321
A0003   32  98  87
A0004   21  12  54
A0005   21  13  45
A0006   21  87  45
B0007   84  NA  45
B0008   21  NA  98
B0009   2   NA  45
B0010   12  NA  45


text:
Q: Need to debug segmentation fault (core dumped) in C Below is the function that takes a character array allowing max 10 characters and checks if its lesser than 9999999999.0. I am getting "segmentation fault(core dumped) error during run time. Please someone help me debug this function.
bool validate(char* token)
{
    int i=0, count=0;
    char* temp = 0;

    while(token[i] != '\0' && count < 10)
    {
        temp[i] = token[i];

        i++;
        count++;
    }

    temp[i] = '\0';

    float check = strtof(temp,NULL);

    if (check > 9999999999.0)
        return false;

    return true;
}

A: Allocate memory for temp. Because it can have at max 10 characters, you need to allocate memory for 11 bytes (one is for the '\0' character)
If you're sure that you'll always have at max 10 characters then allocate it statically:
char temp[11];
If that's not the case then you might want to allocate the memory dynamically.
int noOfCharacters = // value
char* temp = malloc(noOfCharacters + 1);

A: I can't figure out what you're actually trying to do here but...
You are overflowing your buffer.  Your assigned char* temp = 0; is completely incorrect and probably the cause of the overflow.  Remember that in C, strings are IMMUTABLE.  Instead, try initializing char temp[50]; where 50 is replaced by whatever number is large enough to hold your entire end result.  IE- make an array of characters large enough to contain whatever it is you're trying to contain.
warning:  Remember that in C, every character takes 1 byte of memory and so a very large data set will need to be approached differently.

A: The best way is to here is to pass the size of the token as an argument to the validate function. In that manner, you can allocate memory to your temp pointer at run time
example
...
bool validate(char* token, int size)
{
    int i=0, count=0;
    char* temp = 0;

    char* temp = (char*) malloc(size + 1);

    //continue here

...
}


text:
Q: Definition of a point $x$ in a Riemann sum. $$\int_{a}^{b} f(x) dx = \lim_{n \to \infty} \sum_{k=1}^{n} f(x_k) \Delta(x)$$
I am interested in what $x_k$ is. On stackexchange I have seen $x_k$ being defined as:
$$x_k = \Delta(x)(k) + a$$
Where $a$ is the initial beginning etc...
Is there are a proof of this, or is it a definition?

A: Very briefly, $x_k$ denotes a point in the $k$th part of the partition of $[a,b]$. It doesn't actually matter which point: the limit is supposed to exist regardless of what point is chosen within the $k$th part of the partition.
Equivalently, $x_k$ denotes the left endpoint of one of the $k$th part of the partition, where the limit is over partitions whose widths go to $0$.
Often in first calculus classes, one evaluates integrals by assuming that the left endpoints of the partitions of the interval $[a,b]$ into $k$ same-sized parts is sufficient (and it is sufficient for continuous functions, for instance). In this case, the left endpoint is $a$. The next endpoint would be $a + \frac{b-a}{k}$, and so on. Is this a necessary definition? No. But it's more concrete, and sometimes having something concrete is nice in a first calculus class.
You might also be interested in a post I wrote for my students about calculus and the intuition behind some of these ideas. There's also a gif of integration by rectangles, which I rather like.

A: More generally a Riemann sum can use any partition of the interval $[a,b]$; i.e., a division of $[a,b]$ into $n$ subintervals not necessarily of the same size.
If the Riemann integral exists, it is equal to your limit on the RHS using a partition of subintervals of the same size, where $$ \Delta x = \frac{b-a}{n} \ \ \hbox{ and } \ \ x_k = a + k\Delta x$$


text:
Q: How do I solve this exponential function I have the following exponential equation:
$3\sqrt 5\cdot 2^n=(1+\sqrt 5)^n-(1-\sqrt 5)^n$. How do I solve it?
P.S. I can already see $n=4$, but I am interested in how to solve this using logarithms.

A: This equation is just $\frac{1}{\sqrt{5}}\phi^n-\frac{1}{\sqrt{5}}\psi^n=F_n=3$, where $F_n$ denotes the $n$th Fibonacci number, so the answer is $n=4$.
See Binet's Formula

A: \begin{align}
3\sqrt5\,2^n&=(1+\sqrt 5)^n-(1-\sqrt 5)^n
\tag{1}\label{1}
\end{align}
Let's denote $1+\sqrt 5=a$, $\sqrt 5-1=b,\ b>0$.
Note that
\begin{align}
a\cdot b&=4=2^2
.
\end{align}
Consider $n=2m$, $m\in\mathbb{Z}$.
Then \eqref{1} transforms into
\begin{align}
3\sqrt5\,2^{2m}&=a^{2m}-(-b)^{2m}
\tag{2}\label{2}
,\\
3\sqrt5\,(2^2)^m&=a^{2m}-((-b)^2)^m
,\\
3\sqrt5\,(ab)^m&=a^{2m}-(b^{2m})
,\\
3\sqrt5\,\left(\frac{a}b\right)^m
&=\left(\frac{a}b\right)^{2m}
-1
.
\end{align}
Let $(\tfrac{a}b)^m=x$,
\begin{align}
x^2-3\sqrt5 x-1&=0
,\\
x&=\tfrac72+\tfrac32\sqrt5 \quad\text{(ignore negative root)}
,\\
(\tfrac{a}b)^m&=\tfrac72+\tfrac32\sqrt5
,\\
m&=
\frac{\ln(\tfrac72+\tfrac32\sqrt5
)}{\ln(\tfrac32+\tfrac12\sqrt5)}
\\
&=
\frac{\ln((\tfrac32+\tfrac12\sqrt5)^2)}{\ln(\tfrac32+\tfrac12\sqrt5)}
\\
&=
\frac{2\ln(\tfrac32+\tfrac12\sqrt5)}{\phantom{2}\ln(\tfrac32+\tfrac12\sqrt5)}
=2
,\\
n&=2m=4
.
\end{align}

A: hint
Observe that
$$\frac{1-\sqrt{5}}{2}=\frac{-2}{1+\sqrt{5}}$$


text:
Q: Change environment variables in debian/rules according to debian/control targets I have this package mypackage which is already bundled for Ubuntu. For setting the compiler, debian/rules contains
DEB_CONFIGURE_SCRIPT_ENV += CC=gcc

I would now like to extend the package in that I would like to add more targets in debian/control, namely libmypackage-openmpi, libmypackage-mpich2 and so forth. The only thing that would theoretically need changing in debian/rules is the compiler line above;
DEB_CONFIGURE_SCRIPT_ENV += CC=mpicc

Is there a way in debian/rules to if-else between the build targets and set DEB_CONFIGURE_SCRIPT_ENV  dynamically?
If not, what's the appropriate way to deal with this?

A: *

*The regular debian/rules file runs only 1 cycle.

*Your case seems to require additional cycles (seems 3), here the official tutorial with example for 2 build cycles.
Debian Wiki: PkgSplit, removed here its history. It is seems outdated.

*You could check more real examples (as mentioned by tumbleweed):

*

*search for ".*-mpi" or .*-openmpi
apt-cache search --names-only ".*-mpi"

*then download source
apt source <packagename>

Or you can check online:

*

*Search for mpi through descriptions on https://packages.ubuntu.com/ .

*Peak one from last suite, example mrbayes-mpi. Usually, packages are suffixed with used compiler or critical options.

*Follow download source package link.

*Either download debian archive or check its Debian Package Source Repository (Browsable) on upstream Debian/Ubuntu/External site.

*Check control, *.install files and most important rules file.

Here the multi-cycles build essential part:
override_dh_auto_configure:
  dh_auto_configure -- --with-beagle=/usr --enable-mpi=yes --enable-debug=yes

override_dh_auto_build:
  # build mb-mpi (from initial config)
  LIBS="-Wl,--as-needed" dh_auto_build
  mv src/mb ./mb-mpi
  # Now - build mb
  ( cd src ; make clean )
  dh_auto_configure -- --with-beagle=/usr --enable-mpi=no --enable-debug=yes
  LIBS="-Wl,--as-needed" dh_auto_build
  mv src/mb .

It overrides the default and used 2 cycles of (dh_auto_configure & dh_auto_build) then store them with different names.


text:
Q: Supervised learning v.s. offline (batch) reinforcement learning Most materials (e.g., David Silver's online course) I can find offer discussions about the relationship between supervised learning and reinforcement learning. However, it is actually a comparison between supervised learning and online reinforcement learning where the agent runs in the environment (or simulates interactions) to get feedback given limited knowledge about the underlying dynamics.
I am more curious about offline (batch) reinforcement learning where the dataset (collected learning experiences) is given a priori. What are the differences compared to supervised learning then? and what are the similarities they may share?

A:
I am more curious about the offline (batch) setting for reinforcement learning where the dataset (collected learning experiences) is given a priori. What are the differences compared to supervised learning then ? and what are the similarities they may share ?

In the online setting, the fundamental difference between supervised learning and reinforcement learning is the need for exploration and the trade-off between exploration/exploitation in RL. However also in the offline setting there are several differences which makes RL a more difficult/rich problem than supervised learning. A few differences I can think of on the top of my head:

*

*In reinforcement learning the agent receives what is termed "evaluative feedback" in terms of a scalar reward, which gives the agent some feedback of the quality of the action that was taken but it does not tell the agent if this action is the optimal action or not. Contrast this with supervised learning where the agent receives what is termed "instructive feedback": for each prediction that the learner makes, it receives a feedback (a label) that says what the optimal action/prediction was. The differences between instructive and evaluative feedback is detailed in Rich Sutton's book in the first chapters. Essentially reinforcement learning is optimization with sparse labels, for some actions you may not get any feedback at all, and in other cases the feedback may be delayed, which creates the credit-assignment problem.

*In reinforcement learning you have a temporal aspect where the goal is to find an optimal policy that maps states to actions over some horizon (number of time-steps). If the horizon T=1, then it is just a one-off prediction problem like in supervised learning, but if T>1 then it is a sequential optimization problem where you have to find the optimal action not just in a single state but in multiple states and this is further complicated by the fact that the actions taken in one state can influence which actions should be taken in future states (i.e. it is dynamic).

*In supervised learning there is a fixed i.i.d distribution from which the data points are drawn (this is the common assumption at least). In RL there is no fixed distribution, rather this distribution depends on the policy that is followed and often this distribution is not i.i.d but rather correlated.
Hence, RL is a much richer problem than supervised learning. In fact, it is possible to convert any supervised learning task into a reinforcement learning task: the loss function of the supervised task can be used as to define a reward function, with smaller losses mapping to larger rewards. Although it is not clear why one would want to do this because it converts the supervised problem into a more difficult reinforcement learning
problem. Reinforcement learning makes fewer assumptions than supervised learning and is therefore in general a harder problem to solve than supervised learning. However, the opposite is not possible, it is in general not possible to convert a reinforcement learning problem into a supervised learning problem.


text:
Q: iterating through plist file and storing data in array or Dictionary I am new in swift programing. I'm trying to learn plist file. I have a plist file which has data of Country, State and city. I want to iterate through the data of plist file. But I can't understand how to create an array or dictionary to store the data for country, state and City. Can you help me with how to manipulate the following data of plist file.
    {
Country =     (
            {
        CountryName = India;
        State =             (
                            {
                City =                     (
                    Ahmedabad,
                    Vadodara,
                    Surat,
                    Aanand,
                    Bharuch
                );
                StateName = Gujrat;
            },
                            {
                City =                     (
                    Mumbai,
                    Pune,
                    Nagpur,
                    Nasik,
                    Thane
                );
                StateName = Maharastra;
            },
                            {
                City =                     (
                    Kochi,
                    Kanpur,
                    Alleppey,
                    Thrissur,
                    Thiruvananthapuram
                );
                StateName = Kerala;
            }
        );
            },

A: // swift 3 using structure. Manually parsing of data.
struct ListData {
    var countries : [Country]?

    init(dict:[String:AnyObject]) {
        if let countryDict = dict["Country"] as? [[String:AnyObject]] {
            self.countries = parseArray(dictArray: countryDict)
        }
    }

    func parseArray(dictArray:[[String:AnyObject]]) -> [Country] {
        var array = [Country]()
        for dict in dictArray {
            let country = Country(dict: dict)
            array.append(country)
        }
        return array
    }
}
struct Country  {
    var countryName : String?
    var states : [State]?

    init(dict:[String:AnyObject]) {
        countryName = dict["CountryName"] as? String

        if let stateDict = dict["State"] as? [[String:AnyObject]] {
            states = parseArray(dictArray: stateDict)
        }
    }

    func parseArray(dictArray:[[String:AnyObject]]) -> [State] {
        var array = [State]()
        for dict in dictArray {
            let state = State(dict: dict)
            array.append(state)
        }
        return array
    }
}
struct State {
    var stateName : String?
    var cities : [String]?

    init(dict:[String:AnyObject]) {
        self.stateName = dict["StateName"] as? String

        if let cityDict = dict["City"] as? [AnyObject] {
            cities = parseArray(dictArray: cityDict)
        }
    }

    func parseArray(dictArray:[AnyObject]) -> [String] {
        var array = [String]()
        for dict in dictArray {
            array.append(dict as! String)
        }
        return array
    }
}

 var listData : ListData? = nil

 if let path = Bundle.main.path(forResource: "Property List" , ofType: "plist") {
            let rootDict = NSDictionary(contentsOfFile: path) as? [String:AnyObject]
            listData = ListData(dict: rootDict!)
    }

// Using swift 4 and codable protocol.
struct ListData : Codable {
    var countries : [Country]?

    enum CodingKeys : String, CodingKey {
        case countries =  "Country"
    }

}

struct Country : Codable {
    var countryName : String?
    var states : [State]?

    enum CodingKeys : String, CodingKey {
        case countryName =  "CountryName"
        case states = "State"
    }

}

struct State : Codable {
    var stateName : String?
    var cities : [String]?

    enum CodingKeys : String, CodingKey {
        case stateName =  "StateName"
        case cities = "City"
    }

}

var listData : ListData? = nil
if  let url = Bundle.main.url(forResource: "Property List", withExtension: "plist") {
            if let data = try? Data(contentsOf: url) {
                let decoder = PropertyListDecoder()
                do {
                    listData = try decoder.decode(ListData.self, from: data)
                } catch (let err) {
                    print(err.localizedDescription)
                }
            }
        }

A: You can use Object mapper
https://github.com/Hearst-DD/ObjectMapper
where, install the pod and then
create your class as
    class State : Mappable {

      var stateName: String?
      var city: [String]?

      required init?(map: Map) {}

     func mapping(map: Map) {
         stateName <- map["StateName"]
         city <- map["City"]

     }
 }

 class Country : Mappable {
     var countryName: String?
     var state: [State]?

    required init?(map: Map) {}

    func mapping(map: Map) {
        countryName <- map["CountryName"]
        state <- map["State"]

    }

}

class CountryData: Mappable {
    var countries: [Country]?

    required init?(map: Map) {}

    func mapping(map: Map) {
        countries <- map["Country"]

    }
}

get your plist content in a varibale like
 var dictRoot: NSDictionary?
 var countryItems: [String:AnyObject]?
    if let path = Bundle.main.path(forResource: "MyCountryList" , ofType: "plist") {
        dictRoot = NSDictionary(contentsOfFile: path)
    }

    if dictRoot != nil
    {
        // Your dictionary contains an array of dictionary
        // Now pull an Array out of it.
        countryItems  = dictRoot as? [String:AnyObject]
        tableView.reloadData()

    }

let countryData  = CountryData(JSON: countryItems)

now you can use it as you wish


text:
Q: What happens when an object tries to access deallocated unowned object? if A is declared as unowned var and is then deallocated, What happens when another object tries to access A?

A: Unowned references, like weak references, do not increase the retain count of the object being referred. However, in Swift, an unowned reference has the added benefit of not being an Optional. This makes them easier to manage rather than resorting to using optional binding. This is not unlike Implicitly Unwrapped Optionals. In addition, unowned references are non-zeroing. This means that when the object is deallocated, it does not zero out the pointer. This means that use of unowned references can, in some cases, lead to dangling pointers. In the Objective-C world, unowned references map to unsafe_unretained references.
So, it will raise a Fatal Error like:

Fatal error: Attempted to read an unowned reference but object X was already deallocated

As a signal SIGABRT


text:
Q: Why HMS Analytics kit in react native can not migrate to androidx? While implementing HMS Analytics kit in react native, can not migrate to androidx because it breaks the build with below error
node_modules\react-native-ha-interface\android\src\main\java\com\huawei\hianalytics\HaInterfaceModule.java:37: error:
cannot find symbol
import androidx.annotation.NonNull;

A: Test it on Native java project without androidx support by adding below in the gradle.build.
implementation 'com.huawei.hms:hianalytics:4.0.3.300'


text:
Q: How to Make Autodesk Viewer Orthographic by Default I am trying to make the autodesk viewer display files in orthographic mode by default. So far the best solution i've come up with is the following:
forgeViewer.addEventListener(
    Autodesk.Viewing.GEOMETRY_LOADED_EVENT,
    function setOrtho() {
      forgeViewer.autocam.homeVector.isPerspective = false;
      forgeViewer.autocam.homeVector.isOrtho = true;
      forgeViewer.autocam.originalHomeVector.isPerspective = false;
      forgeViewer.autocam.originalHomeVector.isOrtho = true;
      forgeViewer.autocam.toOrthographic();
    },
  );

This sets home to orthographic and sets the current view to orthographic which is exactly what i'm looking for. The only issue i have is that waiting on the GEOMETRY_LOADED_EVENT means that larger models will load in perspective and then snap to orthographic when all of the geometry is loaded, which can be jarring for users.
Is there a way to get the viewer to initialize in orthographic sooner so that it doesn't do this? I've tried waiting on a few other events as well as running setOrtho immediately with no event listener and usually it fails to get picked up.

A: You can set orthographic view as early (and might work even earlier) as Autodesk.Viewing.MODEL_ROOT_LOADED_EVENT:
NOP_VIEWER.addEventListener(Autodesk.Viewing.MODEL_ROOT_LOADED_EVENT, ()=>{
   //...
}

See live demo here - LGTM.
You can also try viewer.debugEvents(true) (and here's the doc to explain them) to print all the events to console and see which one gets called earlier to suit your needs.


text:
Q: QGIS Count lines in polygon ( to be part of a graphical model ) My problem is very easy to understand but I can't find a solution.
I'm actually working on the spreading of a local optic fibre network. These fibres will be contained in plastic tubes buried in trenches. I need to know how many tubes we should bury in each trench.
In GIS words : I make a buffer from the polyline shapefile "trenches", and I need to know how many polylines from the "tubes" shapefile cross (all the lines starts and ends out of the buffers) this buffer, then create a new shapefile with a column containing this count.
I though that there was a geoprocessing tool which could do it just like the "count points in polygon" geoprocessing tool. But it doesn't exist in QGIS Version 2.14.13.
So, I'm looking for a similar method that could be integrated in a graphical modeller, as a one-click operation (because I'll have to do it several times, and so will do my colleagues).

A: You could use the Join attributes by location tool (which hopefully should in available in your modeler). If you select the Attribute summary option and choose Take summary of intersecting features, it will insert a Count field into your layer. If you don't want to calculate the sum, mean etc then just remove them so that the textbox is blank, that way you will only get the Count field as the statistic:


text:
Q: chrome://inspect#devices not showing device on network I'm trying to debug a chromecast application and when I go to chrome://inspect#devices, I don't see anything other than localhost. I've tried adding the IP in manually via the configure button, but I don't get the inspect option.
I'm working in a place with several devices and my coworkers can see all of them. I'm also on the same subnet as the chromecast. Windows 10.

A: This is only targeted to debug android apps that contain WebViews.
Very important define in your app´s MainActivity inside onCreate() method to enable debugging:
WebView.setWebContentsDebuggingEnabled(true);

https://developers.google.com/web/tools/chrome-devtools/remote-debugging/webviews


text:
Q: Kendo Grid Object doesn't support property or method 'slice' I am trying to bind the kendo grid to a WCF remote odata service. But when I try to populate the grid I receive the exception Object doesn't support property or method 'slice'. Here is my javascript code to populate the grid.
$("#datagrid").kendoGrid({
                dataSource: {
                    type: "json",
                    transport: {
                        read: "http://localhost:65401/sdrservice.svc/IssueLists"
                    },
                    pageSize: 20
                },
                groupable: true,
                sortable: true,
                pageable: {
                    refresh: true,
                    pageSizes: true,
                    buttonCount: 3
                },
                columns: [{
                    field: "Issueid"
                }, {
                    field: "Subject"
                }, {
                    field: "Description"
                }, {
                    field: "Module"
                }, {
                    field: "Status"
                }, {
                    field: "StartDate"
                }, {
                    field: "ClosureDate",
                    nullable: true
                }, {
                    field: "RaisedBy"
                }, {
                    field: "Duration"
                }]
            });

And my json object is like
    {"odata.metadata":"http://localhost:65401/sdrservice.svc/$metadata#IssueLists",
"value":[{"Issueid":"512","Subject":"Crossing","Description":"a feugiat et eros vestibulum ac est lacinia nisi venenatis tristique fusce congue diam id ornare imperdiet","Module":"ADF","Status":"Fixed","StartDate":"2013-05-14T00:00:00","ClosureDate":null,"RaisedBy":"Azhar Husain","Duration":828},
    {"Issueid":"474","Subject":"Point","Description":"a feugiat et eros vestibulum ac est lacinia nisi venenatis tristique fusce congue diam id ornare imperdiet sapien urna","Module":"ADF","Status":"Open","StartDate":"2012-10-09T00:00:00","ClosureDate":null,"RaisedBy":"Azhar Husain","Duration":1045},
    {"Issueid":"937","Subject":"Point","Description":"a ipsum integer a nibh in quis justo maecenas rhoncus aliquam lacus morbi","Module":"TM1","Status":"Fixed","StartDate":"2013-05-31T00:00:00","ClosureDate":null,"RaisedBy":"Azhar Husain","Duration":811},
    {"Issueid":"226","Subject":"Point","Description":"a libero nam dui proin leo odio porttitor id consequat in consequat","Module":"DATA MINING","Status":"Open","StartDate":"2014-11-08T00:00:00","ClosureDate":null,"RaisedBy":"Azhar Husain","Duration":285},
    {"Issueid":"76","Subject":"Hill","Description":"a libero nam dui proin leo odio porttitor id consequat in consequat ut nulla sed","Module":"TM1","Status":"Fixed","StartDate":"2013-04-12T00:00:00","ClosureDate":null,"RaisedBy":"Azhar Husain","Duration":860}]}

I think the issue is with json object as slice method need array which is data.value here but how to use it is my problem as read line in method directly calls the service and perform the required task I have no control over it.

A: You need to set the dataSource's schema.data property.
schema: {
  data: 'value'
}

Documentation http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-schema.data

A: You need to set the schema in the configuration, since you aren't binding the datasource directly to the object that is returned, but actually to a property in that object (i.e. the value property).
Try setting your datasource like this:
dataSource: {
  type: "json",
  transport: {
    read: "http://localhost:65401/sdrservice.svc/IssueLists"
  },
  pageSize: 20,
  schema: {
    data: function(response) {
      return response.value;
    }
  }
}