text:
Q: A characterization of normal schemes (clarification of a statement of proposition) The following is taken from 4.1 in Liu's book.

Definition: A scheme $X$ is normal at $x \in X$ if $O_{X,x}$ is normal. $X$ is normal if it is irreducible and normal at every point.
Proposition: Let $X$ be irreducible. Then $X$ is normal if and only if for every $U \subseteq X$ open, $O_X (U)$ is a normal integral domain.

I have a question on the phrasing of this statement. Reviewing the proof, he seems to assume that $O_X (U)$ is already an integral domain. Of course, we wouldn't be talking about a ring being normal if it weren't an integral domain. However, the phrasing of the theorem seems to assert that $O_X (U)$ is an integral domain for every open subset $U$ as opposed to asserting that for the open subsets $U$ where $O_X (U)$ is an integral domain. Which is the correct way to interpret this Proposition?


text:
Q: Parsing XML for iPhone (aMule downloads/ search results) I am currently working on a software to control aMule status of my server through the iPhone,
i created a socket that spits out xml which should be parsed out, but because NSXMLParser is event-drive, i'm having problems in understanding how this could work...
I thought of this type of XML structure, if you have ideas of a better way to structure it please tell me!! :D
<root type="donwloads">   <-- specifies downloads or search results
<file name="Ubuntu_9_10.iso" status="[11,6%]" />
<file name="Fedora 12.iso" status="[56,2%]" />
</root>

What i was thinking is, as i want to put this in a tableview, most probably i will need a NSMutableArray with lots of NSDictionaries based on the results, every dict should be a file.. what do you guys propose?? how should i handle this situation?
Thanks

A: Write a parser class that turns nodes into Core Data managed objects and saves them to the managed object context, when a parser callback event is fired.
Use an NSFetchedResultsController to access the Core Data store. As the managed objects come in and are saved, the results controller updates the table view with whatever results it fetches.

A: An NSMutableArray of NSDictionary seems like a reasonable approach for your in-memory data structure.
You'll basically have a series of callbacks that build up that array as NSXMLParser runs through your XML file:
- (void) parseXML:(NSString *) filename {
    NSURL *xmlURL = [NSURL fileURLWithPath:filename];

    NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:xmlURL];

    [xmlParser setDelegate:self];

    [xmlParser parse];

    // Check for errors.
    NSError *errorCode = [xmlParser parserError];
    if (errorCode) {
        // handle error here
        NSLog(@"%@", [errorCode localizedDescription]);
    }

    [xmlParser release];
}

And your main delegate:
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict
{
    // If certain elements are found initialize the object
    if ([elementName isEqualToString:"@file"]) {
       NSMutableDictionary *currentFile = [[NSMutableDictionary alloc] init];
       // Look through the attributes add stuff to your dictionary
       // Add it to your array.
    }
}

Since all of your data is returned in attributes you can do it this way.  Otherwise you'd need to store the file and build it up (the foundCharacters delegate) finally adding it to your array when the file's tag occurs in the didEndElement delegate.

A: Thanks a lot for your answers :D fortunately i resolved the problem 10 minutes after :D
ill post what i did:
XML:
<root>
  <downloads>
<file type="text" name="fdsdf" />
<file type="text" name="sdfsdfssds" />
  </downloads>
</root>

NSXMLParser delegates:
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName       namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict{
if([elementName isEqualToString:@"downloads"] || [elementName isEqualToString:@"results"]){
    NSLog(@"starting or downloads or results");
    if(xmlArray){
        xmlArray= nil;
    }
    self.xmlArray= [[NSMutableArray alloc] init];
}
else if([elementName isEqualToString:@"file"]){
    NSLog(@"found file...");
    [self.xmlArray addObject:attributeDict];
   }
}

- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{
if([elementName isEqualToString:@"downloads"] || [elementName isEqualToString:@"results"]){
    if([elementName isEqualToString:@"downloads"]){
        NSLog(@"downloads found: %@...  reloading table", xmlArray);
    }
  }
}

I hope this can possibly help someone which has my same problem :D

redpajama_set_name: RedPajamaStackExchange


text:
Q: overflow hidden not working in ios devices using particles I have a very simple landing page with some animated particles in the background which are small images.  Seems to work fine in typical browsers however when on any mobile ios platform (iphone/ipad etc) the particles seem to cause the view to constantly resize as they float to the boundaries of the page...  I thought overflow hidden would prevent this...
I'm at a loss on this one...
Here is the site: www.test.joshmu.com
Obviously you would have to view this on an ios device to see the screen 'jitter' I am talking about.  Any help would be super appreciated!
-Update: some JS code I used for the body which works fine on normal browsers
//set up the page
var W = window.innerWidth;
var H = window.innerHeight;
var bodyStyle = document.body.style;
bodyStyle.backgroundColor = 'rgba(2,34,63,1)';
bodyStyle.width = W;
bodyStyle.height = H;
bodyStyle.position = 'relative';
bodyStyle.top = '0px';
bodyStyle.left = '0px';
bodyStyle.margin = '0px';
bodyStyle.padding = '0px';
bodyStyle.overflow = "hidden";

I should also add that when I console.log the window.onresize event, it turns out that it is constantly firing when viewing from an ios platform.


text:
Q: Receiving an error while editing permissions of the objects in the bucket I am receiving below error while trying to edit the permissions of the objects in my bucket
Cannot get legacy ACL for an object when uniform bucket-level access is enabled.

A: It seems like you have selected access control as uniform, you can change it to fine-grained, if you want to add permissions in object level.
To do this you can click on the 3 buttons present on the right of your bucket - click on edit bucket permissions - select switch to fine-grained under access control - select fine grained - click save.


text:
Q: How to create a .txt file with password protection in android programatically? I am creating .txt file in android by using below Snippet
public void createTextFile(String fileName) {
try {
    File notesDirectory = new File(Environment.getExternalStorageDirectory(), "Text Files");
    if (!notesDirectory.exists()) {
        notesDirectory.mkdirs();
    }
    File textFile = new File(notesDirectory, fileName);
    FileWriter writer = new FileWriter(textFile);
    writer.append("Sample Content");
    writer.flush();
    writer.close();
    Toast.makeText(this, "File Created at "+textFile.getAbsolutePath(), Toast.LENGTH_SHORT).show();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

Added below permission
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Is it possible to provide password for that .txt file programatically in Android?

A: You can use Jasypt.
http://www.jasypt.org/
Below the example.
StrongPasswordEncryptor passwordEncryptor = new StrongPasswordEncryptor();
String encryptedPassword = passwordEncryptor.encryptPassword(userPassword);
...
if (passwordEncryptor.checkPassword(inputPassword, encryptedPassword)) {
  // correct!
} else {
  // bad login!
}

...encrypting and decrypting a text...

StrongTextEncryptor textEncryptor = new StrongTextEncryptor();
textEncryptor.setPassword(myEncryptionPassword);
String myEncryptedText = textEncryptor.encrypt(myText);
...
String plainText = textEncryptor.decrypt(myEncryptedText);


text:
Q: Will adding more recruitment beacons make settlers come more often? In a settlement, if I have one recruitment beacon, settlers don't come very often. If I add another one, will settlers come more often than if I have one?
.
NOTE:
I'm not sure if you actually can do more than one. I am asking this question to see if I should make another, or if it will be pointless.

A: No, the game only checks if there is a beacon in a settlement.
Only happiness increases the chance.
Build bars ( lvl 3 restaurant) to get +40 happiness.
No new settlers will come if you have five settlers that are not assigned to anything.


text:
Q: Triangles and Semicircles. Given any acute angled triangle $ABC$, let points $X, Y, Z$ be located as follows: $X$ is
the point, where the altitude from $A$ on $BC$ meets the outward facing semicircle
on $BC$ as diameter. Points $Y$ and $Z$ are defined similarly. Prove the result:
$[BCX]^2 + [CAY]^2 + [ABZ]^2 = [ABC]^2$, where the notation $[.]$ denotes the area of the figure.
A question from pathfinder for olympiad mathematics.
My Solution attempt:
using $\angle XGC = \theta=\angle XCG \implies \angle XGD=2\theta \ and \ \angle XGC=\pi - \theta
 $
Thus we get,by cosine rule,
$XD = XC^2(a^2-XC^2)$
Now i calculated the area of the triangle $BXC$ but couldnt go any furter, kindly proceed this.

A: Let the orthocentre of the original triangle be $H$. Observe that, $AE\cdot EC=HE\cdot BE$ since $\triangle AEB\sim \triangle HEC$.
Thus, $EY^2=AE\cdot EC=HE\cdot BE$
Hence, $[\triangle ACY]^2=\frac {1}{4} AC^2\cdot HE\cdot BE=\left(\frac{1}{2} AC\cdot HE\right)\left(\frac {1}{2}AC\cdot BE\right)=[\triangle AHC]\cdot [\triangle ABC]$
Similarly,
$[\triangle BXC]^2=[\triangle BHC]\cdot [\triangle ABC]$
$[\triangle ABZ]^2=[\triangle AHB]\cdot [\triangle ABC]$
Adding these up gives the desired result.


text:
Q: how to send dropdownlist value in the begin form to the controller i want to pass the selected dropdown list item value to the controller , im able to send the datepicker values but not dropdownlist item values.
view
   @using (Html.BeginForm())
            {

                        <button type="button" class="btn btn-info ">Device Id</button>
                        <button type="button" class="btn btn-info  dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                            Toggle Dropdown
                        </button>

                            @foreach (var item in Model.OrderBy(x=>x.DeviceId).Select(x => x.DeviceId).Distinct())
                            {
                                @item
                            }

                    <input type="submit" id="btnSubmit" name="Submit" class="btn btn-success" value="Submit" />

            }

controller
 public ActionResult Reports(DateTime? fromDate, DateTime? toDate, string deviceid_dropdown)
{

}

Model
@model List<SmartPond.Models.SmartPondViewModel>

viewmodel
 public class SmartPondViewModel
    {
        public string Imie { get; set; }
        public int DeviceId { get; set; }
        public string pH { get; set; }
        public string DissolvedOxygen { get; set; }
        public string Temperature { get; set; }
        public DateTime Timestamp { get; set; }
    }


text:
Q: make div scroll left when window is scrolled left I've tried something like below and it prints out "scroll" but the element #etable_body is not scrolled.
    $(window).scroll(function() {
        $("#Table_body").scrollLeft(window.scrollLeft);
        console.log("scroll");
    });

Note, I only want Table_body to scroll left if I scroll left in window. Also if possible: don't move the "window" either when scrolling.
Thanks in advance.

A: jsBin demo
Using https://github.com/brandonaaron/jquery-mousewheel/
var $tb = $('#Table_body');

$(window).on('mousewheel', function(e){
  var ns = $tb.scrollLeft() - (e.deltaFactor*e.deltaY)
  $tb.scrollLeft( ns );
});


text:
Q: PHP image upload grey lines I have a custom drupal module which saves uploaded files passed from the uploadify jquery plugin. All seemed well but some images are coming up with grey blocks in them. See:
http://5oup.net/sites/default/files/360/5ouppic.jpg
This is a user submitted image and I'm unable to reproduce the problem myself - as I understand it it's a server side problem, but I'm unsure about how to rectify the issue.
Here is the PHP from my module which handles the upload:
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';

$filename = $_FILES['Filedata']['name'];
$filename = preg_replace("/[^A-Za-z0-9. ]/", '', $filename);
$filename = str_replace(" ", '_', $filename);

$targetFile =  str_replace('//','/',$targetPath) . $filename;

$name = $filename;

mkdir(str_replace('//','/',$targetPath), 0755, true);
move_uploaded_file($tempFile,$targetFile);

Is the upload 'stalling' somehow? Any ideas about why it would only be on some images and not others? Any help is very gratefully received!
James

EDIT - Able to reproduce problem
I have contacted a user and am able to recreate the problem (i.e. it uploads with grey pixels every time) using this jpeg:
http://5oup.net/test/sucon.jpg
This jpeg uploads fine:
http://5oup.net/test/hd.jpg
I just can't figure out the difference?! What on earth could be going on?
Thanks

A: While it could of course have been a transmission error that damaged a small part of the JPG image, if this was a single incident, I would look on the user's side first. It's much, much more likely something went wrong when they resized the image before uploading. Ask them whether they resized the image immediately before uploading, and what the resized file looks like. Have them E-Mail you everything.
Maybe you want to upload the original, undamaged file as well, somebody here may be able to tell more by taking a look into it.
I would first check whether it can be reproduced on the user's side from a intact image (have them E-Mail it to you), and from a different image.

Edit (ran out of space in the comment)
Very, very strange. From what little I know about the JPG format, this could be the typical behaviour when the transmission gets mangled during only a few bytes: A number of blocks could be affected and lead to this. What it could be, I can't say - could be anything from hard disk problems (unlikely) to some firewall filtering out data.
The first step would definitely be obtaining the original images and seeing whether the problem can be reproduced. My bet is it can't. Then  a disk check is in order, and as much replacing and changing and testing as you can (move temporary directory / updating the server software maybe).
If nothing helps, as a last resort, you may want to set up a mirror copy of the site on another server, and do some automated uploading there to see whether it happens again. Selenium IDE could be a help for that.
By the way, you may want to post-process users' images to protect their privacy. The EXIF data reveal quite a lot, check out this for example or this.

A: I think that $_SERVER['DOCUMENT_ROOT'] will give the document path of the site without slash('/') at the end.
Please replace the second line of your above code with below line,
$targetPath = $_SERVER['DOCUMENT_ROOT'] .'/'. $_REQUEST['folder'] . '/';

Hope this will help for you....


text:
Q: Magento is not working after compilation Initially, observers are not worked & I found that compilation is enabled.So I have used these steps to disable compilation.But no use.After using the third step.The site itself not working.
How to solve this issue?
Thank you in advance!
Steps I have followed:
1. Via Magento admin
Navigate to System > Tools > Compilation page and click on Disable button
Navigate to System > Cache Management screen and use Flush Cache button.
2. Via SFTP, by editing the includes/config.php file
To disable compilation in Magento, edit includes/config.php. At around line 28, uncomment the first line and comment out the second:
#define('COMPILER_INCLUDE_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR.'src');
define('COMPILER_COLLECT_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR.'stat');
3. Via SSH
php -f shell/compiler.php -- disable
php -f shell/compiler.php -- clear
Reference links:
link


text:
Q: Pseudo element ::after has no height I've got a strange one. I use this same bit of code all over my site, and it works everywhere. For some reason, it simply wont work here.
Basically what I am doing is creating a translucent background image by using pseudo elements :before and :afterto fill the entire container with a background color (:before) and a semi-transparent image (:after). The :before element works just fine, it fills the height and width of the .dashboard-page as expected. The :after element has 100% width, but a height of 0, so the image is not showing up. Help would be much appreciated.
.dashboard-page {
    width: 100%;
    position: relative;
    z-index: 1;
    @include clearfix;

    &:before,
    &:after {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        @include transition($transition-main);
    }

    &:before {
        z-index: -2;
        background-color: $blue-light;
    }

    &:after {
        opacity: 0.02;
        z-index: -1;
        background-image: url('../life/assets/img/pattern.png');
    }
}

A: Try adding display: block; to :after.
By default pseudo elements are inline boxes


text:
Q: Pass serialized form with other data parameters I have a jQuery ajax function and would like to submit an entire form as post data and will transfer some data parameter as well.
var serial = $("#formProjectBilling").serialize();

$.ajax({
    url: base_url+"sales/Sales_invoice_form/saveSalesInvoice",
    type: 'post',
    data: serial + {
        'orderItems': orderItems,
        'orderTotal': totalamt,
        'freight': freight,
        'gen_disc':gen_disc,
        'otp': otp,
        'notes': $("#notes").val(),
        'idno': $("#idno").val(),
        'acctno': $("#hdnAcctNo").val(),
        'itemlocid': $("#location_id").val(),
        'shipping_id': $("#shipping_id").val(),
        'sales_date': $("#sales_date").val(),
        'discamt': $("#discount").text(),
        'gendisctype': $("#gen_disc_type").val()
    },

It only transfers the serialized form, but not the other data in parameters.

A: Try this

 var serial = $("#formProjectBilling").serializeArray();

                $.ajax({
                    url: base_url+"sales/Sales_invoice_form/saveSalesInvoice",
                    type: 'post',
                    data: {...serial,...{
                        'orderItems': orderItems,
                        'orderTotal': totalamt,
                        'freight': freight,
                        'gen_disc':gen_disc,
                        'otp': otp,
                        'notes': $("#notes").val(),
                        'idno': $("#idno").val(),
                        'acctno': $("#hdnAcctNo").val(),
                        'itemlocid': $("#location_id").val(),
                        'shipping_id': $("#shipping_id").val(),
                        'sales_date': $("#sales_date").val(),
                        'discamt': $("#discount").text(),
                        'gendisctype': $("#gen_disc_type").val()
                    },

A: First you need to convert your object to url param query:
var str = "";
for (var key in yourData) {
    if (str != "") {
        str += "&";
    }
    str += key + "=" + yourData[key];
}

then into your ajax in the line where you pass data, just use the converted url:
...
data: serial + '&' + str;
...

Full Code:
var serial = $("#formProjectBilling").serialize();
// your data
var data = {
  'orderItems': orderItems,
  'orderTotal': totalamt,
  'freight': freight,
  'gen_disc': gen_disc,
  'otp': otp,
  'notes': $("#notes").val(),
  'idno': $("#idno").val(),
  'acctno': $("#hdnAcctNo").val(),
  'itemlocid': $("#location_id").val(),
  'shipping_id': $("#shipping_id").val(),
  'sales_date': $("#sales_date").val(),
  'discamt': $("#discount").text(),
  'gendisctype': $("#gen_disc_type").val()
}
// conversion object to url params
var str = "";
for (var key in data) {
  if (str != "") {
    str += "&";
  }
  str += key + "=" + data[key];
}

$.ajax({
  url: base_url + "sales/Sales_invoice_form/saveSalesInvoice",
  type: 'post',
  data: serial + '&' + str
})

A: Jquery serialize() function effectively turns the form values into a valid query string. Use $.param(object) to send other params in some object variable
var values = [
  { 'orderItems': orderItems },
  { 'orderTotal': orderTotal },
  { 'freight': freight }
  { ... }
]

var data = form.serialize() + '&' + $.param(values);

Read more http://api.jquery.com/jQuery.param/


text:
Q: Compiling Linux kernel with all available drivers I'm compiling the kernel for usage in portable USB stick. Which means it must run on any hardware, not just hardware of the machine where it is being compiled. What should I choose in kernel config for that? Is make allyesconfig suitable for this?
Just in case, I'm doing this because stock kernels for my operating system (Debian Stretch) don't include the latest drivers I need (touchpad support for some 2019 Lenovo laptops appeared only in 5.1)

A: Instead of compiling a custom kernel, you can just add the relevant kernel modules to your initramfs. In my project I just created a file inside the initramfs-tools folder called "modules" where I listed each module to be loaded, then I ran:
mkinitramfs -o "initrd.img" initramfs-tools

to build it.
More info can be found here: http://manpages.ubuntu.com/manpages/trusty/man8/initramfs-tools.8.html

If you just want the desktop environment to have them, then adding modules can be done by editing the /etc/modules file to load the modules automagically at boot time.

A: make allyesconfig builds as many drivers into the main kernel as possible, which makes for a huge kernel file. The <kernel source>/Documentation/admin-guide/README.rst says:

Having unnecessary drivers will make the kernel bigger, and can under some circumstances lead to problems: probing for a nonexistent controller card may confuse your other controllers.

Also:

The "kernel hacking" configuration details usually result in a bigger or slower kernel (or both), and can even make the kernel less stable by configuring some routines to actively try to break bad code to find kernel problems (kmalloc()).  Thus you should probably answer 'n' to the questions for "development", "experimental", or "debugging" features.

make allmodconfig builds as many drivers as loadable modules as possible, so it might be a better starting point than make allyesconfig.
You might consider grabbing a linux-config package from Debian Testing or from Stretch-backports and picking the kernel configuration from it. That's only a few kernel releases away from 5.1, so it should not be too hard to run make oldconfig with that configuration, and reading the help text before deciding on any kernel features added in versions 4.20, 5.0 and 5.1.
Note that the kernel packages from Debian should be already configured to be as generic as possible, and using that as a basis for your new kernel configuration might allow you to avoid some pitfalls with debugging features or settings related to system console. Debugging a kernel configuration that fails with no viable system console drivers is a special kind of nuisance.


text:
Q: Error with JSF2 and RichFaces I'm trying to use RichFaces on a working JSF2 application. I incorporated the RichFaces jars, changed the web.xml but got the following error:
17:49:13,097 SEVERE [javax.enterprise.resource.webcontainer.jsf.application] Error Rendering View[/login.xhtml]: java.lang.NullPointerExcept
ion
        at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:936)
        at com.sun.faces.facelets.tag.jsf.CompositeComponentTagHandler.createComponent(CompositeComponentTagHandler.java:154)
        at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.createComponent(ComponentTagHandlerDelegateImpl.java:311)
        at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:145)
        at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:114)
        at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:91)
        at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:120)
        at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:204)
        at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:114)
        at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:91)
        at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:86)
        at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:91)
        at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:75)
        at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:301)
        at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:360)
        at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:339)
        at com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:191)
        at com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:149)
        at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:86)
        at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:75)
        at com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:145)
        at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:716)
        at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:351)
        at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:126)
        at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
        at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
        at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:127)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
        at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:336)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242)
        at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
        at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
        at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
        at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:734)
        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:541)
        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:479)
        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:407)
        at org.apache.catalina.authenticator.FormAuthenticator.forwardToLoginPage(FormAuthenticator.java:318)
        at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:243)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:559)
        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95)
        at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
        at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:872)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951)
        at java.lang.Thread.run(Thread.java:619)

It seems that some jars are missing, but I cannot seem to find this cause. The above error is the only thing that the log spits out.
Here's web.xml:
<context-param>
        <param-name>javax.faces.FACELETS_LIBRARIES</param-name>
        <param-value>/WEB-INF/faces-validator-tags/general.taglib.xml;
                        /WEB-INF/faces-converter-tags/general.converter.taglib.xml
           </param-value>
    </context-param>
    <!--
        Startup Servlet <servlet> <servlet-name>StartUpServlet</servlet-name>
        <servlet-class>pt.cgd.agile.util.StartupServlet</servlet-class>
        <load-on-startup>1</load-on-startup> </servlet>
    -->

    <context-param>
        <param-name>javax.faces.DISABLE_FACELET_JSF_VIEWHANDLER</param-name>
        <param-value>true</param-value>
    </context-param>

    <context-param>
        <param-name>org.richfaces.SKIN</param-name>
        <param-value>blueSky</param-value>
    </context-param>

    <!-- Making the RichFaces skin spread to standard HTML controls -->
    <context-param>
        <param-name>org.richfaces.CONTROL_SKINNING</param-name>
        <param-value>enable</param-value>
    </context-param>

    <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>server</param-value>
    </context-param>

    <context-param>
        <param-name>org.richfaces.SKIN</param-name>
        <param-value>blueSky</param-value>
    </context-param>

    <context-param>
        <param-name>org.richfaces.CONTROL_SKINNING</param-name>
        <param-value>enable</param-value>
    </context-param>

    <filter>
        <display-name>RichFaces Filter</display-name>
        <filter-name>richfaces</filter-name>
        <filter-class>org.ajax4jsf.Filter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>richfaces</filter-name>
        <servlet-name>Faces Servlet</servlet-name>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
    </filter-mapping>

    <listener>
        <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
    </listener>

    <!--
        Just here so the JSF implementation can initialize, *not* used at
        runtime
    -->
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <!-- Just here so the JSF implementation can initialize -->
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>

    <login-config>
        <auth-method>FORM</auth-method>
        <form-login-config>
            <form-login-page>/login.jsf</form-login-page>
            <form-error-page>/loginError.jsf</form-error-page>
        </form-login-config>
    </login-config>

    <error-page>
        <exception-type>java.lang.Throwable</exception-type>
        <location>/errors/error.jsf</location>
    </error-page>

A: We moved on to another component lib. We were deploying to WAS, so it was a headache anyway.

A: For the record, the issue you were having is because RichFaces 3.3.x isn't fully compatible with JSF2.  Specifically the composite component feature of facelets won't work.  It appears that is what your issue was


text:
Q: NPM audit vulnerabilities I was installing npm package for getting node module file but after I run npm install it is showing me 184 vulnerabilities(153 low, 1 moderate, 30 high), should i have to run npm audit fix in order to fix this, But my concern is that will it make any changes in the already installed dependencies, will it change my package.json file and package-lock.json file. I have attached the image below.
 Please help me out with this Thank you. I just need to know whether will it change all the preinstalled dependencies or is it good to run npm audit fix command.Thanks.

A: I never encountered any problems running npm audit fix on my projects and didn't hear it from anyone else either so I recommend you try it in the worst-case scenario you can just uninstall your packages and install them again using npm install just know that npm audit fix may not fix all of you're vulnerabilities you may need to replace the specific package.
cheers.


text:
Q: Get Previous and Next Sunday from another time zone I need a script that will return the next sunday and previous saturday from the date . I know how i can return that value from the current date
$saturday = date('Y-m-d H:i:s',strtotime( "next saturday" ));

$sunday = date('Y-m-d H:i:s',strtotime("previous sunday"));

But i have user and his timezone is different say 'Europe/Zurich'(different timezones will be used)
I need to get his previous sunday's date and next saturday.
I wrote a script like this . But i am not sure about the accuracy of the  script since it is timezone related task.Please help  me to fix this.
   $actual_server_time = new DateTime;
   $actual_server_time->setTimeZone(new DateTimeZone('Europe/Zurich'));
   $converted_server_date_time = $actual_server_time->format('Y-m-d H:i:s');
   $actual_server_time->modify('last Sunday');
   $actual_server_time->format('Y-m-d H:i:s');

A: You can add the timezone in  strtotime:
<?php strtotime("previous sunday GMT+1");

DEMO


text:
Q: How can I clean stuff up on program exit? I have a command line program that wants to pickle things when I send it a ctrl-C via the terminal. I have a some questions and concerns:

*

*How do I perform this handling? Do I check for a KeyboardInterrupt? Is there a way to implement an exit function?

*What if the program is halted in the middle of a write to a structure that I'm writing to? I presume these writes aren't treated atomically, so then how can I keep from writing trash into the pickle file?

A: You can use atexit for defining an exit handler.  Modifications of Python objects will be treated atomically, so you should be fine as long as your code is arranged in a way that your objects are always in a consistent state between (byte code) instructions.

A: (1) Use the atexit module:
def pickle_things():
    pass

import atexit
atexit.register(pickle_things)

(2) In general, you can't. Imagine someone trips on the power cord while your program is in the middle of a write. It's impossible to guarantee everything gets properly written in all cases.
However, in the KeyboardInterrupt case, the interpreter will make sure to finish whatever it's currently doing before raising that exception, so you should be fine.


text:
Q: how to access sonarqube on centos virtual instance I have installed centos 7 on oracle virtual box.
I installed sonarqube on it. I have created a user "sonar" and started the sonarqube server.
I verifed the status and it is running.
I want to access that sonarqube now. What should be the url to access sonarqube?


text:
Q: My PointerClick function gets fired twice I have an OnPointerClick() function that sometimes gets fired twice if I keep clicking on multiple buttons at a stretch, even though I have pressed this button only once. This is happening in the new Input UI System. How do I stop this from happening?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

public class ClickableButtons : MonoBehaviour, IPointerClickHandler {

public void OnPointerClick (PointerEventData eventData) {

       Debug.Log("Clicked"); //Called twice most of the time when button is pressed once
  }
}

A: First of all, let's try to solve the problem caused by 2 clicks, before the causes of 2 clicks. Because the information you provide is not enough.
public class ClickableButtons : MonoBehaviour, IPointerClickHandler
{
    private static readonly object ClickLock = new object();

    public void OnPointerClick(PointerEventData eventData)
    {
        lock (ClickLock)
        {
            Debug.Log("Clicked"); //Called twice most of the time when button is pressed once
        }
    }
}

If you put the actions to be performed after the click in the "lock" statement, it will prevent the actions from being done at the same time.
public class ClickableButtons : MonoBehaviour, IPointerClickHandler
{
    private static readonly object ClickLock = new object();
    private bool clicked = false;

    public void OnPointerClick(PointerEventData eventData)
    {
        if (clicked) return;

        lock (ClickLock)
        {
            clicked = true;

            Debug.Log("Clicked"); //Called twice most of the time when button is pressed once
            clicked = true;
        }

        clicked = false;
    }
}

You can try to control it with an "if" statement.
But what I'm wondering is why don't you use the button's onclick event?
https://docs.unity3d.com/530/Documentation/ScriptReference/UI.Button-onClick.html


text:
Q: Interpretation of odds ratios individually and in the interaction? I have run a logistic regression model
fit <- glm(y ~ x1 + x2 + x3 + x1:x2,
           family = binomial(link = "logit"), data = train)

The odds ratio for x1, x2 are significant (1.04, 1.18) and the odds ratio of the interaction is significant and 0.99. How is it possible that x1, x2 to increase the probability for y = 1 and their interaction to decrease it? I have made the plot how the slope of x1 on y changes with the values of x2 and I see:
 and when I plot how the slope of x2 on y changes with the values of x1 and I see:

Can you help me to explain this?

A: Remember that even odds means odds of 1. The odds ratio of 0.99 associated with your interaction term means that the overall odds decrease as either of x1 or x2 increase while the other is held constant. That's consistent with what you see in your first plot.
The original coefficients are in a log-odds scale, where this becomes a bit more obvious: the x1 coefficient in that scale is 0.039, the x2 coefficient is 0.166, and the interaction coefficient is negative, -0.01.
I'm not sure how you generated and labeled the second plot, as the range of x2 values is far from that in the first plot and the "partial slope" values on the vertical axis are enormous.


text:
Q: Serialization Versus Encoding What is the different between Serialization and Encoding.
As i understood
"Serialization defines how the .NET object maps to XML, while Encoding defines how the XML is written out to a stream of bytes. "
is this correct ?

A: Yes. Serialization used for transmission of messages in between client and server we need to convert CLR types to standards-based XML.
WCF defines serialization as the process of converting an object graph into an XML Information Set (XML Infoset)
1. The XML Infoset is the data model WCF uses internally to represent a message.
2. The XML Infoset is the data model for representing an XML document.

Encoding used to describe the process of converting a WCF message into an array of bytes. This is done so that the message can be sent across a transport protocol.
Here is the good explanation with example http://msdn.microsoft.com/en-us/magazine/cc163569.aspx#S1

A: Serialization is the conversion of the in-memory .NET object to another format such as XML, JSON, etc. so that they can be stored or transmitted. This format is usually text i.e. a string of characters.
Encoding is the conversion of these characters to a byte stream to transmit them over the wire or store them to disk. Some common encodings are ASCII, UTF-8, etc.
From Wikipedia,
Serialization: Serialization is the process of translating data structures or object state into a format that can be stored (for example, in a file or memory buffer, or transmitted across a network connection link) and reconstructed later in the same or another computer environment.
Character Encoding: A character encoding system consists of a code that pairs each character from a given repertoire with something else — such as a bit pattern ... to facilitate the transmission of data (generally numbers or text) through telecommunication networks or for data storage.


text:
Q: Difference between 1L and (long) 1 One of a colleague added a review comment in PR that we should use 1L instead of (long)1.
The only explanation is given by my colleague is that it's convenient to use and read 1L.
So my question is apart from readability, does 1L offer some other benefits?
My code
void getUserId() {
    assert((long) 1, userService.getUserId())
}

userService.getUserId() returns long value i.e 1
assert() accepts two long object

A: Explanation
Performance-wise there is no difference.
(long) 1 is a constant expression (because the 1 is directly known) and hence, by the rules of the Java Language Specification (JLS), will be a long after compilation already.
However, in my experience, it is far more common that people use the long literal and write 1L for readability.

Int literal out of bounds
You will see some differences though when you actually use int literals for values outside of the 32-bit integer range. So for example:
(long) 100_000_000_000

wont compile, you have to use a long literal and add the L to it.

Bytecode
Consider the following two example snippets:
System.out.println((long) 5);

// versus

System.out.println(5L);

Now look at their bytecode:
0: getstatic #2 // Field java/lang/System.out:Ljava/io/PrintStream;
3: ldc2_w #3 // long 5l
6: invokevirtual #5

Both compile to the exact same code which uses ldc2_w directly, loading a long onto the stack. So there is no explicit conversion from int to long required at runtime anymore.

JLS
The JLS explains this behavior in Chapter 15. Expressions:

Some expressions have a value that can be determined at compile time. These are constant expressions (§15.28).

Which states:

A constant expression is an expression denoting a value of primitive type or a String that does not complete abruptly and is composed using only the following: [...]

*

*Literals of primitive type and literals of type String (§3.10.1, §3.10.2, §3.10.3, §3.10.4, §3.10.5)

*Casts to primitive types and casts to type String (§15.16)

So the snippet, because it only consists of a primitive literal and a cast to a primitive type, is considered a constant expression and will thus be computed at compile-time.

A: One good reason is using the simplest way that the language provides.
Following convention is also important: I've been writing java since it was a baby and I've never before seen a long constant coded using a (long) cast.


text:
Q: isScreenOn() returning true when screen is off I am trying to detect if the screen is off. Tried with BroadcastReceiver but didn't work as expected.
So i tried with Power manager isScreenOn() in onPause() and it works great.
But i noticed that when i press the power button to lock the screen and then immediately press it again to unlock it, isScreenOn() returns true.
Can you help me?
I can't find solution around this.
Here is the code:
@Override
public void onPause() {
    super.onPause();
    //registBroadcastReceiver();

    PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE);
    boolean isScreenOn = powerManager.isScreenOn();

    if (!isScreenOn) {
        Log.d("Screen", "OFF");
        flag1 = true;
    }

}

A: Based on this link to the Android Developer's Guide:
http://developer.android.com/reference/android/os/PowerManager.html#isInteractive()
isScreenOn()

doesn't check if the screen is on or off, but rather whether or not it's interactive.
"The value returned by this method only indicates whether the device is in an interactive state which may have nothing to do with the screen being on or off. To determine the actual state of the screen, use getState()."

A: Refer to http://developer.android.com/reference/android/os/PowerManager.html:

isScreenOn()
  This method was deprecated in API level 20. Use isInteractive() instead.


text:
Q: AngularJS - How can I get data from GET method My Controller:
angular.module('apartmentCtrl', [])

.controller('ApartmentController', function ($scope, $http, Apartment) {
    $scope.loading = true;

    $scope.myLocation = '';

    Apartment.get($scope.myLocation).success(function (data) {
        $scope.apartments = data;
        $scope.loading = false;
    });
});

My Service
angular.module('apartmentService', [])
.factory('Apartment', function ($http) {
    return {
        get: function (myLocation) {
            //return $http.get('/api/apartments');
            return $http({
                method: 'GET',
                url: '/api/apartments',
                //headers: {'Content-Type': 'application/x-www-form-urlencoded'},
                params: {location: myLocation}
            });
        }
    };
});

My HTML:
<input type="text" name="myLocation" class="form-control" ng-model="myLocation">

How can I get data from GET method by AngularJS and pass it to params

A: If you want to pass some value from your form as "location", you should bind it to your model, and explicitly pass it to your factory get function.
I have a working example here, it just does a window alert showing you the typed in data, in place of the $http call, but the idea is the same.
http://plnkr.co/edit/fRra6RfQrSZb8rzrm4XF?p=preview
Html:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <title>AngularJS Plunker</title>

    <link rel="stylesheet" href="style.css" />

Hello {{name}}!

    <form ng-submit="getIt()">
      <input type="text" ng-model="myLocation"/>
      <input type="submit"/>
    </form>

Javascript:
var app = angular.module('plunker', []);

app.controller('MainCtrl', function($scope, Apartment) {
  $scope.name = 'World';
  $scope.myLocation = 'Hollywood';

  $scope.getIt = function() {
    Apartment.get($scope.myLocation);
  }
});

app.factory('Apartment', function ($window) {
        return {
            get: function (whatLocation) {
                $window.alert(whatLocation);
            }
        };
    });


text:
Q: leaflet snap polyline to rout I'm try to convert polyline to  rout but I have a problem
You see in the picture below that the road is different from the polyline:

Here is my code:
    var mymap = L.map('map').setView([32.661343, 51.680374], 6);
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(mymap);
var markers = new L.MarkerClusterGroup();
var markerList = [];
var a = [];
var myTrip = [];
var myTrip2 = [];
for (var i = 1; i < locations.length ; i++) {
    myTrip.push(new L.LatLng(parseFloat(locations[i]['Received']['lat']),parseFloat(locations[i]['Received']['lng'])));
    a[0] =  parseFloat(locations[i]['Received']['lat']);
    a[1] = parseFloat(locations[i]['Received']['lng']);
  var marker = new L.Marker(new L.LatLng(a[0], a[1]));
    marker.bindPopup((locations[i]['Received']['id']).toString());
    markerList.push(marker);

    var polyline =L.polyline(myTrip, {color: 'blue'}).addTo(mymap);

}
var markerPatterns = L.polylineDecorator(myTrip, {
    patterns: [
        {offset: 25, repeat: 50, symbol: L.Symbol.arrowHead({pixelSize: 15, pathOptions: {fillOpacity: 1, weight: 0}})}
    ]
}).addTo(mymap);
var control = L.Routing.control({
    waypoints: myTrip,
    show: false,
    waypointMode: 'snap',
    showAlternatives: true,
    useZoomParameter: true,
    createMarker: function() {}
}).addTo(mymap);

A: 1) So are the lines drawn using the raw coordinates? In other words, are the lines drawn like you do not use a routing service?
2) Leaflet Routing Machine is a plug-in that supports several routing engines, with OSRM as a default.
http://www.liedman.net/leaflet-routing-machine/
Have you tried inserting your DB coordinates to the OSRM-demo? Is it giving you the expected results?
http://map.project-osrm.org/

A: The high and low streets are routes because 1 of your waypoints are hitting that street and to get back on track again it have to turn around the block. It would have routed correcly if your waypoints where more accurate.


text:
Q: How to merge duplicated history of commands in interactive shell? When you try to find a previous used command in an interactive shell session
by ↑ (up arrow), you may get something like
$ls         # 1st time push `up arrow`
$ls         # 2nd time push `up arrow`
$ls         # 3rd time push `up arrow`
$ls         # 4th time push `up arrow`
$ls         # 5th time push `up arrow`
$ls         # 6th time push `up arrow`
$make       # 7th time push `up arrow`
$make       # 8th time push `up arrow`
$make       # 9th time push `up arrow`
$ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"   # Bingo!

I would like it better if it were like this:
$ls         # 1st time push `up arrow`
$make       # 2th time push `up arrow`
$ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"   # Bingo!

because the duplicated history is usually of no use.
How can I get Bash to do this?

A: You can accomplish this by setting ignoredups in the HISTCONTROL variable:
HISTCONTROL="ignoredups"

Optionally export it,
export HISTCONTROL="ignoredups"

to make it an environment variable.
From the bash(1) man page:

HISTCONTROL
*
A  colon-separated list of  values controlling how commands are
saved on the history list.
If the list of values includes ignorespace,
lines which begin with a space character are not saved in the  history
list.   A  value  of ignoredups  causes  lines  matching the previous
history entry to not be saved.  A value of ignoreboth is shorthand
for ignorespace and ignoredups.  A value of erasedups causes all
previous lines matching the  current  line  to  be removed  from the
history list before that line is saved.  Any value not in the above
list is ignored.  If HISTCONTROL is unset, or does not include a valid
value, all lines read by the shell parser are saved on the history
list, subject  to  the  value  of  HISTIGNORE.
The second and
subsequent lines of a multi-line compound command are not tested,
and are added to the history regardless of the value of
HISTCONTROL.

This does exactly what the question asks for.
If the user enters the commands ruby …,
make, make, make, ls, ls, ls, ls, ls and ls
(as separate, consecutive lines),
then the history list will be ruby …, make, ls.
Pressing ↑ (up arrow) three times
will return to the ruby command.

A: To add to @jordanm reply, I think you should use HISTCONTROL in fact but with the "erasedups" value.
"A value of erasedups causes all previous lines matching the  current  line  to  be removed  from the history list before that line is saved."
export HISTCONTROL="ignoreboth:erasedups"
Add it to your ~/.bashrc to have it execute every time you log in.
Actually, this has been answered before
I wanted to add a comment but I can't because of my reputation.

A: For macos, add the following lines to your ~/.zshrc file to avoid command duplicates in terminal history
setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_IGNORE_SPACE
setopt HIST_FIND_NO_DUPS
setopt HIST_SAVE_NO_DUPS

A: I really couldn't find anything that works!
I create a bash file which I run on boot, but you can schedule it with cron too. It erase the duplicated from .bash_history.
arrVar=()
while read -r line; do
  s=${line# } # remove leading spaces
  s=${line%% } # remove trailing spaces
  if [[ ! " ${arrVar[*]} " =~ " ${s} " ]] && [[ "$s" != history* ]] ;
  then
    arrVar+=("$s")
  fi
done < ~/.bash_history

printf "%s\n" "${arrVar[@]}" > ~/.bash_history


text:
Q: IOS Write plugin at phonegap 2.9.1 There is a guide how to create a plugin for phonegap 2.9.1 step by step, without the use nodejs?
thanks.

A: I will walk you through the first of a few steps in creating a custom PhoneGap plugin for iOS.
Skip: this optional for your to Create the PhoneGap project from the below. you create the project your style.
building-a-custom-phonegap-plugin-for-ios-step-by-step


text:
Q: Anyway to remove white screen after splash screen When on a slow connection, my Ionic app shows a white screen briefly on a slow connection. I am not importing any providers and the page does not have cordova plugins so it should not be an issue.
Is there any way to 100% remove this. What I was thinking, is to add an output to the pages the app can load on. When and event is emitted on ionViewDidEnter(), I hide the splash screen. This should hide the splash screen when the page is rendered.
Note that I have uncommented the service worker code in index.html and building as prod to create the necessary files.
What do you think?
EDIT: add config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.ionicframework.ionic" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>ionic</name>
    <description>Ionic</description>
    <author email="ionic@gmail.com" href="http://www.ionic.com/">Ionic</author>
    <content src="index.html" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <platform name="android">
        <allow-intent href="market:*" />
        <icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
        <icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
        <icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
        <icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
        <icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
        <icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
        <splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
        <splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
        <splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
        <splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
        <splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
        <splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
        <splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
        <splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
        <splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
        <splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
        <splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
        <splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
        <icon height="57" src="resources/ios/icon/icon.png" width="57" />
        <icon height="114" src="resources/ios/icon/icon@2x.png" width="114" />
        <icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
        <icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" />
        <icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120" />
        <icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
        <icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100" />
        <icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
        <icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120" />
        <icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180" />
        <icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
        <icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144" />
        <icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
        <icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" />
        <icon height="167" src="resources/ios/icon/icon-83.5@2x.png" width="167" />
        <icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
        <icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58" />
        <icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87" />
        <splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
        <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
        <splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
        <splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
        <splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" />
        <splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" />
        <splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
        <splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
        <splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" />
        <splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
        <splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
        <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
        <icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" />
        <splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" />
    </platform>
    <preference name="webviewbounce" value="false" />
    <preference name="UIWebViewBounce" value="false" />
    <preference name="DisallowOverscroll" value="true" />
    <preference name="android-minSdkVersion" value="16" />
    <preference name="BackupWebStorage" value="none" />
    <preference name="SplashScreenDelay" value="3000" />
    <preference name="FadeSplashScreen" value="true" />
    <preference name="FadeSplashScreenDuration" value="1000" />
    <preference name="SplashScreenBackgroundColor" value="0xFFFFFFFF" />
    <preference name="SplashScreen" value="screen" />
    <feature name="StatusBar">
        <param name="ios-package" onload="true" value="CDVStatusBar" />
    </feature>
    <icon src="resources/android/icon/drawable-xhdpi-icon.png" />
    <preference name="SplashShowOnlyFirstTime" value="false" />
    <plugin name="cordova-plugin-console" spec="^1.1.0" />
    <plugin name="cordova-plugin-device" spec="^1.1.7" />
    <plugin name="cordova-plugin-geolocation" spec="^2.4.3">
        <variable name="GEOLOCATION_USAGE_DESCRIPTION" value=" " />
    </plugin>
    <plugin name="cordova-plugin-network-information" spec="^1.3.4" />
    <plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
    <plugin name="cordova-sqlite-storage" spec="^2.1.2" />
    <plugin name="ionic-plugin-deeplinks" spec="^1.0.15">
        <variable name="URL_SCHEME" value="ionic" />
        <variable name="DEEPLINK_SCHEME" value="https" />
        <variable name="DEEPLINK_HOST" value="ionic.com" />
        <variable name="ANDROID_PATH_PREFIX" value="/" />
        <variable name="ANDROID_2_PATH_PREFIX" value="/" />
        <variable name="ANDROID_3_PATH_PREFIX" value="/" />
        <variable name="ANDROID_4_PATH_PREFIX" value="/" />
        <variable name="ANDROID_5_PATH_PREFIX" value="/" />
        <variable name="DEEPLINK_2_SCHEME" value=" " />
        <variable name="DEEPLINK_2_HOST" value=" " />
        <variable name="DEEPLINK_3_SCHEME" value=" " />
        <variable name="DEEPLINK_3_HOST" value=" " />
        <variable name="DEEPLINK_4_SCHEME" value=" " />
        <variable name="DEEPLINK_4_HOST" value=" " />
        <variable name="DEEPLINK_5_SCHEME" value=" " />
        <variable name="DEEPLINK_5_HOST" value=" " />
    </plugin>
    <plugin name="cordova-plugin-google-analytics" spec="^1.8.3" />
    <plugin name="uk.co.workingedge.phonegap.plugin.launchnavigator" spec="^4.1.0">
        <variable name="LOCATION_USAGE_DESCRIPTION" value="This app requires access to your location for navigation purposes" />
    </plugin>
    <plugin name="cordova-plugin-ionic-webview" spec="^1.1.16" />
    <plugin name="cordova-plugin-camera" spec="^3.0.0" />
    <plugin name="cordova-plugin-splashscreen" spec="^4.1.0" />
    <plugin name="cordova-plugin-badge" spec="^0.8.5" />
    <plugin name="cordova-plugin-statusbar" spec="^2.3.0" />
    <engine name="ios" spec="4.5.4" />
    <engine name="android" spec="6.3.0" />
</widget>

[Solution] - Seems removing the splashscreen.hide() fixes the issue.

A: You need to decrease value of Fade Screen duration
<preference name="FadeSplashScreenDuration" value="300" />

and do below steps.

*

*Remove platform : ionic cordova platform rm <android|ios>

*Add platform : ionic cordova platform add >android|ios>

*Run your app : ionic run <android|ios> --prod --device
Hope this will remove your white screen issue after splash.


text:
Q: Checking: Number of unique connections in an undirected graph with constant degree. This is possibly simple, but I'd like to check my reasoning because it seems "too simple".
Consider an undirected graph of $N$ nodes.
We set it up so that each node is connected to a fixed number of other nodes, i.e. every node has the same degree, $k$.
I'd like to know how many edges there are in the graph. It would be fewer than $kN$, because one of node A's edges say $\overline{AB}$ would also count as one of B's edges.
The way I approached the problem was to consider the adjacency matrix $A$. As the graph is unweighted, each row of the matrix would have $k$ ones in it. So the sum of all elements in $A$ would be $kN$.
As the graph is undirected, the matrix is symmetric and all of the relevant information about the edges is in the upper diagonal of $A$.
The graph contains no self-loops so $\text{tr}(A) = 0$.
Therefore, the total number of unique edges should be $1/2$ the sum of the whole matrix $A$, or:
$$\text{number of edges} = \frac{kN}{2}  $$
Does this seem right? Or am I missing something in my logic. I am new to graph theory. I've not seen this problem addressed anywhere only, which makes me think it's either too complicated or trivial.
Thanks

A: Yes, your are right. A standard double-counting argument (of the number of pairs $(v,e)$ where a vertex $v$ is incident to an edge $e$) shows that the sum of degrees of the veritces of $G$ is twice the number of its edges.


text:
Q: Importing useStyles into a function - TypeError: prevDeps is undefined I have been using class components and importing my useStyles files with const classes = useStyles();. What is the correct way to use this in a function?
The classes.formControl etc is being used on each of my MaterialUI dropdowns and they are throwing the errors. Does I need to write this as a hook? do I need to remove makeStyles from my styleSheet?
error message
TypeError: prevDeps is undefined
areHookInputsEqual

const classes = useStyles();

        return (

            <form>

<FormControl className={classes.formControl}>
   <InputLabel id="Enter-the-dive-type">Dive Type</InputLabel>
      <Select
       labelId="Enter-the-dive-type"
       id="Enter-the-dive-typer"
       value={dive.typeID}
       onChange={handleChange}>
       <MenuItem value="">
       None
       </MenuItem>
       <MenuItem value={10}>Ten</MenuItem>
       <MenuItem value={20}>Twenty</MenuItem>
       <MenuItem value={30}>Thirty</MenuItem>
    </Select>
</FormControl>

styles
export const useStyles = makeStyles((theme) => ({

    table: {
        maxWidth: 450,
    },
    form: {
        width: '100%', // Fix IE 11 issue.
        marginTop: theme.spacing(1),
    },
    submit: {
        margin: theme.spacing(3, 0, 2),
    },
    formControl: {
        margin: theme.spacing(1),
        minWidth: 120,
    },
    selectEmpty: {
        marginTop: theme.spacing(2),
    },
}));


text:
Q: Assigning an int to a char with two different outputs I was wondering Why these two codes give different outputs?
int main()
{
    char a;
    a = 50;
    printf("%d \n\n", a);
    return 0;
}

This one gives 50 as output.
int main()
{
    char a;
    a = 50;
    cout << "Test : " << a << "\n\n";
    return 0;
}

while this one outputs 2...

A: The reason the first example outputs 50 is because the printf is expecting a integer specifced with %d, change this to %c and it will output 2 which has an ASCII value of 50.
The second example outputs 2 as you have defined a as a char, meaning it will look up the ASCII value.
You can have a look at ASCII values of different symbols here.

A: Reason for the first code outputs 50 is that printf is expecting a integer (%d).
But in case of cout it outputs 2 because it is defined as char, That makes cout treat it as char and 50 is ASCII code of 2.
A code like this can give correct output:
std::cout <<(int)a;

OR more better way :
std::cout <<static_cast<int>(a);

A: While char can be used as a small integer, for the output operator << it's only a character, and will print the char value as a character in whatever encoding is used.
With your printf call you explicitly say that you want to print the value as an int value (using the "%d" format). If you want to do the same with std::cout and << then you also need to explicitly say so:
std::cout << "Test : " << static_cast<int>(a) << "\n\n";

If you want the printf call to print the character encoded by the value 50, then you need to use the "%c" format:
printf("Test : %c\n\n", a);

A: Characters (chars) are stored as numerical values according to the ASCII table.
'2' as a char has a numerical value of 50 on that table.
when you use printf to output something, you do so with the help of format specifiers (they specify which format to use: char, integer, ..etc).

*

*Using %d will output the numerical value of your char variable as an integer.

*Using %c will output your variable as a char.

*Finally, using cout instead of printf will default to outputting according to the type of the variable, which is a char here.


text:
Q: Opencv Web Application I'm trying to get access a local web server via web browser and give it an image, then the web server gives a processed image back.
I'm using ubuntu 14.04 using opencv 3.0.0, apache2 and php5.
This is the best example I could find thus far for what I am attempting to accomplish.
http://opencv-code.com/projects/web-based-interface-for-face-detection-with-opencv/
However, it simply hangs at a half loaded bar and never finishes the task. I re-read the instructions and found I had followed them to the letter and I still could not get it to work. Is this because I am using Ubuntu and not windows?
I'm open to using other methods for developing the front end to interface with the back end (opencv executables). However, I am very new to web development and I'm uncertain where to start (I've only made desktop applications up to this point).
If there is an easier way to do this please let me know.

A: Debugging complicated code while it is running under Apache can be tricky, because browsers don't always tell you what is getting transmitted.  Have you tried running your php page as a stand-alone app using the php command?  That can be easier, as if the program gets a segmentation fault, you get the message to your console.


text:
Q: Error: Permission denied to access property of subdomain I am loading pages from an iFrame, and of course I get this error:
Error: Permission denied to access property "INSERT JAVASCRIPT VARIABLE HERE".
The main frame of the website is www.domain.com
The iFrame I am using to access pages are loading from domain: www.localserver.centralserver.domain.com
Why can't I do this setup?
Thanks

A: You can't access JS objects bound to page from other domain. Check http://en.wikipedia.org/wiki/Same-origin_policy


text:
Q: How to make smart playlist that contain more than 1 artist I want to make smart playlist that contain more than 1 artist.
Example:
I want to make smart playlist which artist are: Matchbox Twenty, Savage Garden, and Train.
If I fill the box like this:

The playlist will be empty.

A: Switch the first part
Match "all" of the following rules

to
Match "any" of the following rules


text:
Q: В тело письма mailto вставить в body результат JS скрипта Добрый день, есть поле html , как в тело письма вставить результат JS скрипта?
<a href="mailto:imst@mail.ru?subject=130000027&body="в тело вставить результат скрипта JS (возвращает строку)"

A:

document.getElementById("abc").href="mailto:mail@mail.ru?subject=130000027&body=1";
Mail me

Или так:

var temp = document.getElementById("abc").href;
var result ="result"; //Это переменная которую вы хотите вставить в конец после выполнения вашего скрипта
    document.getElementById("abc").href=temp+result;
Mail me 2


text:
Q: Apply string substitutions line by line I need to apply a series of substitutions on a text file, using a filter file with the same number of lines: line n of the filter should apply to line n of the original file.
E.g. original file:
foo
bar
foobar

Filter file:
s/oo/uu/
s/a/i/
s/b/l/

Expected result:
fuu
bir
foolar

Since sed will apply each filter on each line, using sed -f filterfile is particularly inefficient (the number of lines is fairly large, so N² is quite large as well…).  Furthermore, although in my particular case I can modify the filters to avoid this issue, this command will lead to wrong results on the example.
I'm currently implementing the following approach (still trying to fix an issue with tabulations…):
paste -d'@' filterA filterB infile \
  |while IFS="@" read AA BB LINE;
do
  echo $LINE|"s/$AA/$BB/g"
done > outfile

But I'm wondering if there was a more elegant solution, e.g. some sed option?  (Preferably with standard GNU/Linux tools.)

A: You could modify your filter file by adding the proper line address in front of each line
$ nl filter
     1  s/oo/uu/
     2  s/a/i/
     3  s/b/l/

and then pipe this to sed:
$ nl filter | sed -f- infile
fuu
bir
foolar

If the substitutions need to be global, append g first:
$ sed 's/$/g/' filter
s/oo/uu/g
s/a/i/g
s/b/l/g

resulting in
sed 's/$/g/' filter | nl | sed -f- infile

A small optimization to start the next loop after the substitution is to add a b command after it:
sed 's/.*/{&g;b}/' filter | nl | sed -f- infile

This starts the next cycle immediately. The effect for a 30,000 line version of the input and filter files from the question is about a 20% time saving:
$ wc -l filter infile
 33033 filter
 33033 infile
 66066 total
$ time sed 's/$/g/' filter | nl | sed -f- infile >/dev/null

real    0m15.868s
user    0m15.522s
sys     0m0.296s
$ time sed 's/.*/{&g;b}/' filter | nl | sed -f- infile >/dev/null

real    0m12.238s
user    0m11.901s
sys     0m0.271s

If your file is large, awk is a lot faster (code courtesy of Ed Morton):
$ time awk 'NR==FNR{o[NR]=$2;n[NR]=$3;next} {gsub(o[FNR],n[FNR])} 1' filter infile >/dev/null

real    0m0.073s
user    0m0.061s
sys     0m0.007s

A: awk -F'/' '
NR==FNR {
    old[NR] = $2
    new[NR] = $3
    next
}
{ gsub(old[FNR],new[FNR]) }
1' filterfile originalfile
fuu
bir
foolar

The above will work using any awk in any shell on any UNIX box.


text:
Q: How to solve crashing app problem and FATAL EXCEPTION error? I am using the latest version of android studio and trying to pass image from one activity to another, but the following code is not performing as per expectation. when I am clicking on the image the app is going to close the second activity is not opening and I am getting run time error. How do I solve it?
you can see whole code through this link: https://drive.google.com/drive/folders/16R-8gvAfq1lNiaBrbxYk8OQuap_evoMg?usp=sharing
Error:
2021-03-21 21:14:52.639 23412-23412/com.example.recyclerviewexample5 E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.recyclerviewexample5, PID: 23412
    android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.recyclerviewexample5/com.example.recyclerviewexample5.SecondActivity}; have you declared this activity in your AndroidManifest.xml?
    at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2005)
    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1673)
    at android.app.Activity.startActivityForResult(Activity.java:4762)
    at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:676)
    at android.app.Activity.startActivityForResult(Activity.java:4691)
    at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:663)
    at android.app.Activity.startActivity(Activity.java:5081)
    at android.app.Activity.startActivity(Activity.java:5049)
    at com.example.recyclerviewexample5.CustomRecyclerViewAdopter$1.onClick(CustomRecyclerViewAdopter.java:44)
    at android.view.View.performClick(View.java:6724)
    at android.view.View.performClickInternal(View.java:6682)
    at android.view.View.access$3400(View.java:797)
    at android.view.View$PerformClick.run(View.java:26479)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:233)
    at android.app.ActivityThread.main(ActivityThread.java:7225)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:499)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:962)

CustomRecyclerViewAdopter.java: (you may go through onClick function)
    package com.example.recyclerviewexample5;

import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
public class CustomRecyclerViewAdopter extends RecyclerView.Adapter {
    ArrayList personNames;
    ArrayList personImages;
    Context context;
    public CustomRecyclerViewAdopter(Context context, ArrayList personNames, ArrayList personImages) {
        this.context = context;
        this.personNames = personNames;
        this.personImages = personImages;
    }
    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        // infalte the item Layout
        View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.row_layout_view, parent, false);
        // set the view's size, margins, paddings and layout parameters
        MyViewHolder vh = new MyViewHolder(v); // pass the view to View Holder
        return vh;
    }
    @Override
    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, final int position) {
        // set the data in items
        MyViewHolder viewHolder= (MyViewHolder)holder;
        ((MyViewHolder) holder).name.setText( personNames.get(position).toString());
        ((MyViewHolder) holder).image.setImageResource((Integer) personImages.get(position));
        // implement setOnClickListener event on item view.
        holder.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
//                Toast.makeText(context,"Person : "+(position+1),Toast.LENGTH_SHORT).show();
                Intent intent = new Intent(context, SecondActivity.class);
                intent.putExtra("image", (Integer) personImages.get(position)); // put image data in Intent
                context.startActivity(intent); // start Intent
            }
        });
    }
    @Override
    public int getItemCount() {
        return personNames.size();
    }
    public class MyViewHolder extends RecyclerView.ViewHolder {
        // init the item view's
        TextView name;
        ImageView image;
        public MyViewHolder(View itemView) {
            super(itemView);
            // get the reference of item view's
            name = (TextView) itemView.findViewById(R.id.name);
            image = (ImageView) itemView.findViewById(R.id.image);
        }
    }
}

SecondActivity.java code:
package com.example.recyclerviewexample5;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.widget.ImageView;
import android.widget.TextView;
public class SecondActivity extends AppCompatActivity {
    ImageView selectedImage;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second);
        selectedImage = (ImageView) findViewById(R.id.selectedImage); // init a ImageView
        Intent intent = getIntent(); // get Intent which was set from adapter of Previous Activity
        selectedImage.setImageResource(intent.getIntExtra("image", 0)); // get image from Intent and set it in ImageView
//        Bundle bundle = getIntent().getExtras(); // get Intent which was set from adapter of Previous Activity
//        int resId = bundle.getInt("image");
//        selectedImage.setImageResource(resId);
    }
}

activity_second.xml code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:background="#fff"
    tools:context=".SecondActivity">
    <ImageView
        android:id="@+id/selectedImage"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:scaleType="fitXY"
        android:contentDescription="TODO" />
</RelativeLayout>

AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.recyclerviewexample5">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.RecyclerViewExample5">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

A: add
<activity android:name=".SecondActivity"></activity>

to your AndroidManifest.xml, right after the MainActivity


text:
Q: Reframe the data input for Sankey diagrams using sankeyPlot() in networkD3 package I am trying to plot Sankey diagrams using sankeyPlot() in networkD3 package. The visualization works great on a sample data such as this
Nodes
node
1124107186
1124132760
1124119016
20150517
/matte-low-dome-49354
/accounts/account-order-list.html
/Stepp

and Links
 source target   value
0        3       5
1        3       9
2        3       1
3        4       6
3        5       12
3        6       8

But it is difficult to do prepare the link table from a csv file in the format
       URI                          DATE_KEY    TIME_KEY GUID_KEY
/matte-low-dome-49354               20150517    145755  1124107186
/matte-low-dome-49355               20150517    145755  1124107186
/accounts/account-order-list.html   20150517    143857  1124132760
/accounts/account-order-list.html   20150517    143857  1124132760
/Stepp                              20150517    143416  1124119016
/Stepp                              20150517    143415  1124119016
/platinum-47184                     20150517    145637  1124107186

Is there a reproducible way to prepare the source, target row numbers for such a dataset?

A: I figured out a way to do in Excel using vlookup and pivot. I assigned row numbers to each unique variable entry using the row()
variable          row
20150517           1
20150518           2
/platinum-47184    3

and did a vlookup with its name in another table hence getting the source and the target in the form of their sequence numbers. I then ran a pivot to get the count of each unique combination of variables, like this,
 source                              target   value
/matte-low-dome-49354               20150517    12
/matte-low-dome-49355               20150517    6

I was able to use this as the input for making a Sankey plot.
This is not a very programmable way of doing it but it serves the purpose.


text:
Q: Laravel Cashier Stripe Trial creates new subscriptions, allows exploit I am using Laravel Cashier to add stripe payments (subscriptions) for the premium version of my web app. Users are offered a 5-day free trial (card in advance).
Now what happens is, I create a subscription using:
$user->newSubscription('premium','monthly')->trialDays(5)->create($stripeToken,['email' => $user->email], "")

Works really well, but let's say the user cancels his subscription within the trial period.. He will be on the 'grace' period, let's say for 4 more days..
When these days are passed, user will lose account benefits, as the trial will expire and subscription is cancelled.
But, after that, if the user wants to subscribe again, since $subscription->resume() is only available during the grace period, I would have to create a subscription using $user->newSubscription, generating a new subscription on the table and a new trial period.. allowing them to cancel again, wait 5 days, create another one and repeat this getting free trial days forever..
Is there a way to "resume" an existing subscription when it is cancelled and grace period is over?


text:
Q: Create an unscaling pattern from laser DOE As I've few to no science background I may use the wrong terms/vocabulary.
As I try to create a tool for my job (wood worker), I try to create an unscalling with distance pattern from a laser DOE (1mW laser is enough, and I do have laser glasses for other tools).
An DOE (Diffractive Optical Element) pattern usually scale with distance as
Using a set of lenses (in the reverse order of a camera) I should be able to get
the lens is my image is definitely going to be more complicated.
My questions is:
As far as I could research using bad keywords, a "telecentric" lens should do, but why?  Is there another way to achieve that? (with other objects than lasers)

A: There does not exist any practical optical beam that does not eventually scale with distance. A Bessel-beam is a theoretical beam that would not scale, but in practice one can only make an approximate Bessel-beam (with, for instance, an axicon), but such an approximate Bessel-beam only remains in tack for a finite distance, then it also starts to diverge.
An example of a telecentric system is what is called a 4f system. It consists of two lenses placed one behind the other separated by a distance equal to the sum of their focal lengths. It is an imagining system: the pattern that exists in the transverse plane at one focal length before the first lens will be reproduced at one focal distance behind the second lens. That why it is calld a 4f system: the distance from the input plane to the output plane is 4 focal lengths. The size of the output pattern would be magnified compared to the input pattern by ratio of the focal lengths.
So if in your wood work application you need a particular sized pattern at a particular distance then you can use a 4f system. Otherwise, you may need to provide more information way you need a non-scaling beam in your application.


text:
Q: Petalinux 2014.4 build error with board_f file I am trying to build a petalinux kernel for a project.
The bitstream in vivado compiles just fine, there are a few warnings but they are intended (implied latches, things not in sensitivity lists, etc).
When I get the HDF everything is fine as well, the project is initialized just fine. When I configure the the project everything goes smoothly as well. Nothing out of the ordinary, I am instantiating the basic setup, no changes.
Now when i run petalinux-build -v , everything is fine until I get to the board_f files. These fail due to this error.
[ALL  ] /home//Desktop/NIX_SNES/build/linux/u-boot/src/u-boot-plnx/common/board_f.c: In function 'init_baud_rate':
[ALL  ] /home//Desktop/NIX_SNES/build/linux/u-boot/src/u-boot-plnx/common/board_f.c:143:46: error: 'CONFIG_BAUDRATE' undeclared (first use in this function)
[ALL  ]   gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE);
[ALL  ]                                               ^
[ALL  ] /home//Desktop/NIX_SNES/build/linux/u-boot/src/u-boot-plnx/common/board_f.c:143:46: note: each undeclared identifier is reported only once for each function it appears in
[ERROR] make[4]: *** [common/board_f.o] Error 1
[ALL  ] make[4]: *** Waiting for unfinished jobs...

I have tried in both Ubuntu 14.04 and 15.10 , the errors are both the same.
I cant post the entire build log, but here a link to the log on pastebin
[the error occours on line 2375]
http://pastebin.com/zFkXs8wb

A: It turns out the ZYNQ block I was using didn't instantiate the tcl file from the BSP that I got from the Diligent website. Thus none of the UARTS or any other peripherals were described at all. So I made this manually using a base system template and tested it out, it all works.
In case anyone else comes across this problem.
http://pastebin.com/pE6gRGJ2


text:
Q: Convert SQL query to csv using odbc I'm trying to get data from an off-site Miscrosoft SQL database using php's odbc connection, convert certain queries against it to arrays, and then turn those arrays into a csv that my cms can read and import. I'm able to succesfully conncect and return some results from the database, but my lack of php and SQL skills is killing me.
What I have right now, which is not much, but does what it's supposed to do:
    $result = odbc_tables($connect);

    $tables = array();

    while (odbc_fetch_row($result))
    {
        if(odbc_result($result,"TABLE_TYPE")=="TABLE")
        echo"<br>".odbc_result($result,"TABLE_NAME");

    }

Is there any clear resource on the web on how to do what I want to do? The official php documentation seems to be about the most unhelpful documentation ever. A basic example: I want to return the entries here into csv format. I can get them in array format:
$query = "SELECT TOP 10 * FROM Communities";

    $result = odbc_exec($connect, $query);

    if ( $result )
    {
        while ( ($row = odbc_fetch_array($result)) )
        {
            print_r($row);
        }
        odbc_free_result($result);
    }
    else
    {
        echo 'Exec error: ' . odbc_errormsg();
    }

    odbc_close($conn);

Wish I had more, but I'm a bit lost on where to go next.

A: Using the tips, here's the working solution:
$theArray = array();

while ( ($row = odbc_fetch_array($result)) )
{
    array_push($theArray, $row);
}

$header = array('Name', 'Hours', 'Fees', 'Notes', 'ShortDescription', 'URL');

$fp = fopen('array.csv', 'w');

fputcsv($fp, $header);

foreach ($theArray as $lines)
{

    fputcsv($fp, $lines);

}

A: I just got done doing the exact project that you are asking about. I am running php 5.2 so you may be able to deal with the csv file more easily in a newer version. Here is my code:
<?php
// Uncomment this line for troubleshooting / if nothing displays
ini_set('display_errors', 'On');

$myServer = "GSRBI";
$myUser = "webuser";
$myPass = "Webuser1";
$myDB = "GSRBI";

$dbhandle = odbc_connect($myServer, $myUser, $myPass)
    or die("Couldn't connect to SQL Server on $myServer");

$return = odbc_exec($dbhandle, 'select * from GSRBI.dbo.BounceBackEmail');

$subscribers_array = array();
$db_row = '';
$arrayrow = 0;

while ( $db_row = odbc_fetch_array($return) )
{
    $arrayrow++;
    $array[] = array(

                        'card_num' => $db_row['PlayerAccountNumber']
                        ,'last_name' => ucfirst(strtolower($db_row['LastName']))
                        ,'first_name' => ucfirst(strtolower($db_row['FirstName']))
                        ,'email' =>  $db_row['EMailAddress']
                        ,'earned_on_date' => date('m/d/Y', strtotime('-1 days'))
                        ,'free_play' => $db_row['Offer1']
                        ,'valid_through_date' => date('m/d/Y', strtotime('+15 days'))

                    );
    }
echo print_r($arrayrow, true); ## display number of rows for sql array
echo " rows in ODBC ";

// Creates an array with GSR webteams contact info
    $array1[] = array(

                        'card_num' => "123456789"
                        ,'last_name' => "GSRwebteam"
                        ,'first_name' => "GSRwebteam"
                        ,'email' => "webteam@something.com"
                        ,'earned_on_date' => date('m/d/Y', strtotime('-1 days'))
                        ,'free_play' => "9"
                        ,'valid_through_date' => date('m/d/Y', strtotime('+15 days'))
                    );

$result = array_merge((array)$array, (array)$array1); ## merge the two arrays together

// This will convert the array to csv format then save it
 ## Grab the first element to build the header
$arr = array_pop( $result );
$temp = array();
    foreach( $arr as $key => $data )
    {
        $temp[] = $key;
    }
$csv = implode( ',', $temp ) . "\n";
$csv .= to_csv_line( $arr ); ## Add the data from the first element
    foreach( $result as $arr ) ## Add the data for the rest
    {
        $csv .= to_csv_line( $arr );
    }
//echo print_r($csv, true); ## Uncomment to test output1

$f = fopen('reports/bounceback-'.date('m-d-Y').'.csv', "w");
fwrite($f, $csv);
fclose($f);
Echo "The report has ran";

return $csv;
function to_csv_line( $result )
    {
    $temp = array();
        foreach( $result as $elt )
        {
            $temp[] = '' . addslashes( $elt ) . '';
        }
        $string = implode( ',', $temp ) . "\n";
    return $string;
    }


text:
Q: Characterization of measurable functions mapping into banach space via simple functions? This is a statement I read in Lang's Real and Functional Analysis Chpt VI, Sec 1, M8.
M8. A map $f:X\to E$ with $E$ finite dimensional real vector space is measurable if and only if $f$ is a limit of simple functions where simple here means measurable with image a finite subset of $E$.
$\textbf{Q1:}$ If I drop $E$ finite dimenaional but banach space, does the statement still hold? If not what is the counter example?
$\textbf{Q2:}$ If $f$ is a sequence of simple functions, clearly $f$ is measurable irregardless of $E$ being finite or infinite dimensional. Under what kind of assumption on banach space, can I assure that I can approximate a measurable function by simple functions?


text:
Q: Can't reach database server at `database`:`5432` running on docker container I'm working on a NextJS application with Prisma and a postgres DB connected through docker.
This setup was working before and suddenly i get an error.
I was trying to seed my database using prisma and I get this error:
 94 try {
  → 95   const update1 = await prisma.user.update(
  Can't reach database server at `localhost`:`5432`

  Please make sure your database server is running at `localhost`:`5432`.

I have a docker container running on port 5555:5432
any access of Prisma to the database gives the same error, same with migrations:
Error: P1001: Can't reach database server at localhost:5432
connection string:
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/mid-jobs-db?schema=public"
docker-compose.yml
version: "3.8"
services:
  postgres:
    image: postgres:13
    restart: always
    container_name: mid-jobs-db
    ports:
      - "5555:5432"
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_DB=postgres
    volumes:
      - my-db:/var/lib/postgresql/data
volumes:
  my-db:

docker ps
Docker PS screenshot
I have a Docker Desktop and I can see the container running
my node version is: v16.13.0
I tried restarting the docker container, deleting it and running it again with docker compose up.
I tried using this different connection URLS, also tried adding ?connect_timeout=300 to it.
I tried changing the port in the docker container to:
    ports:
      - "5432:5432"

but then I get a different error
Database `mid-jobs-db` does not exist on the database server at `localhost:5432`

I didn't change anything on the docker container or the connection string and it was working fine a week ago. (Might have restarted my Mac anytime from that day).

A: Your docker compose implies that the file only has the Postgres database.
That database is accessible in 2 different ways:

*

*On the Host on port 5555

*From another container which is setup in the same (!!) docker-compose file through "postgresql://postgres:postgres@localhost:5432"

If you want to access the database from something outside this host, then you need to access the host (via domainname?) on port 5555.
If you want to access the database from another container, which is not set up in the same docker-compose file, then you need to do the following:

*

*Create an external network and give this postgres container an IP in that network

*Give your application (which wants to connect to this postgres) also an IP in that same network

*Access the postgres database via IP address


text:
Q: How to resume a suspended shell? $ help suspend
suspend: suspend [-f]
    Suspend shell execution.

    Suspend the execution of this shell until it receives a SIGCONT signal.

How should I send a SIGCONT signal to a shell suspended by suspend in a gnome terminal tab?

A: Send SIGCONT
The only way to resume the suspended shell is to send the SIGCONT signal, presumably from another shell. You'll need to know the PID (process ID) of the shell.
kill -cont $shellpid

If you don't know the PID already, try this:
ps x | grep bash

For example, when I suspended my shell, I saw this with ps x | grep bash:
 6147 pts/14   S+     0:00 grep --color bash
 6172 pts/14   Ss     0:01 /bin/bash
15085 pts/0    Ss+    0:00 /bin/bash
15121 pts/12   Ts+    0:01 /bin/bash

Look at that third column. The shell you want is the one with the T, and that one has a PID (first column) of 15121. Of course the PID in your case will differ; this was just an example. Once you find the PID (let's say it is 15121), then run:
kill -cont 15121

A: The same way as with any other suspended process: With fg, %, or any other similar job control builtin.
zsh% bash
bash$ suspend
zsh: suspended (signal)  bash
zsh% jobs
[1]  + suspended (signal)  bash
zsh% fg
[1]  + continued  bash
bash$


text: Q: Why should we remove trend and seasonality before forecasting? Why should we remove trend and seasonality (hence, making a series stationary) before forecasting? If time series has a particular trend/seasonality, shouldn't we incorporate that model instead because its indeed useful?


text:
Q: Windows 10 - Decrypt EFS encrypted I encrypted files using EFS tool on my PC and then transferred them to another PC without transfer the certificate used to encrypt data, but then I want to retrieve them. I moved it encrypted from the other device to my device but I could not decrypt it. It appears in the extension of .PFILE.

A:
I encrypted files using EFS tool on my PC and then transferred them to another PC without transfer the certificate used to encrypt data, but then I want to retrieve them.

If you do not have the certificate, used to encrypt the data, then you cannot decrypt the encrypted the data.  What you want is not possible without the certificate installed on the PC in question.

A: For any proper and modern encryption method, the ability to decrypt manually, without the required decryption key, is a function of mathematics using very large numbers that generally represent very long periods of time. This makes decryption without the correct decryption key effectively impossible.
If you still have access to the key, get the key and use it. If you lost the key and no longer have it in any storage or backup, the data is effectively lost.
When I say "effectively lost" I mean that it would take you on an averagely powerful computer dozens to hundreds of years or more to decrypt the data.