text:
Q: product collection toolbar with request params in magento custom module

I have a filter named CARTRIDGE FINDER. When I click button,FIND MY CARTRIDGE by selecting printer series dropdown, then it shows product collection with product list toolbar correctly and nicely. But when I sort by name or price or view as list, it shows There are no products matching the selection. Here my custom (manufacturer) module's layout file's code is given below:
<manufacturer_index_filter>
  <reference name="root">
        <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
  </reference>
<reference name="content">
       <block type="manufacturer/custom" name="printer_filter" template="manufacturer/brand_filter_result.phtml"/>
</reference>

And the code of module's (manufacturer) block file, Custom.php is given below:`class Bubmania_Manufacturer_Block_Custom extends Mage_Core_Block_Template
{public function __construct()
    {
        parent::__construct();$printer = $this->getRequest()->getParams();$make_a_printer_op_val = $printer['make_a_printer'];$printer_series = $printer['printer_series'];
        $printer_model_no = $printer['printer_model_no'];
    $collection = Mage::getModel('catalog/product')->getCollection();
    $collection->addAttributeToSelect('*');
    $collection->addAttributeToSort('created_at', 'desc');
    $collection->addAttributeToFilter(array(
        array('attribute'=>'manufacturer','eq'=>$make_a_printer_op_val),
        array('attribute'=>'printerseries','eq'=>$printer_series),
        array('attribute'=>'printermodelnumber','eq'=>$printer_model_no),
    ));
    $collection->addAttributeToFilter('status', 1);$this->setCollection($collection); /* parent::__construct();

    $collection = Mage::getModel('catalog/product')->getCollection();
    $collection->addAttributeToSelect('*')
               ->addFieldToFilter('visibility', array(
                           Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
                           Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG
               )); //showing just products visible in catalog or both search and catalog
        $this->setCollection($collection); */}

protected function _prepareLayout(){
        parent::_prepareLayout();
    //$toolbar = $this->getToolbarBlock();
    $toolbar = Mage::getBlockSingleton('catalog/product_list')->getToolbarBlock();

    // called prepare sortable parameters
    $collection = $this->getCollection();

    // use sortable parameters
    if ($orders = $this->getAvailableOrders()) {
        $toolbar->setAvailableOrders($orders);
    }
    if ($sort = $this->getSortBy()) {
        $toolbar->setDefaultOrder($sort);
    }
    if ($dir = $this->getDefaultDirection()) {
        $toolbar->setDefaultDirection($dir);
    }
    $toolbar->setCollection($collection);

    $this->setChild('toolbar', $toolbar);
    $this->getCollection()->load();
    return $this;
}public function getDefaultDirection(){
    return 'asc';
}

public function getAvailableOrders(){
        //return array('created_time'=> 'Created Time','update_time'=>'Updated Time','collection_id'=>'ID', 'name'=>'Name');
        return array('name'=> 'Name','position'=>'Position','price'=>'Price');
    }
    public function getSortBy(){
        return 'name';
    }
    public function getToolbarBlock()
    {
        $block = $this->getLayout()->createBlock('manufacturer/toolbar', microtime());
        return $block;
    }
    public function getMode()
    {
        return $this->getChild('toolbar')->getCurrentMode();
    }
public function getToolbarHtml()
{
    return $this->getChildHtml('toolbar');
}}`

But when It runs only with Mage::getModel('catalog/product')->getCollection(), not params, then it runs successfully with product collection toolbar. I need to set params in this toolbar. How to do this. If any one knows this point, please reply me as soon as possible. I have googled a lot. But there is no a specific result.
Thank you

A: Try extending:
class CollectionFilter extends \Magento\Catalog\Model\Layer\Category\CollectionFilter
{

public function filter(
    $collection,
    \Magento\Catalog\Model\Category $category
) {
if(isset($_GET['your filter']))

/* your magic here*/


text:
Q: check if an window closed in angularjs I need to check if an window is closed or not.
Here is my example,
I have opened a new window by calling this function,
$scope.openwind= function(){
    $scope.popupWindow = $window.open("index.html#/channelintegration", "SOme Title", 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no');
}

Then I have been checking if the opened window (popupWindow)  is closed or not, by calling below function through a button click,
$scope.checkmywindow=function(){
    console.log($scope.popupWindow);
    console.log($scope.popupWindow.closed);
}

Now, I need to check if the window (popupWindow) is closed or not, without the button trigger.
Pls Help on this.. Thanks..

A: You can check if the window is opened or not, by taking window.open function in a scope variable and check using the scope.
$scope.openwind= function(){
    $scope.popupWindow = $window.open("index.html#/channelintegration", "SOme Title", 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no');
}

$scope.closewind= function(){
    if ($scope.popupWindow) {
          $scope.popupWindow.close();
      }
    // code for closing goes here

}

$scope.checkmywindow=function(){
    if (!$scope.popupWindow) {
        document.getElementById("msg").innerHTML = "'$scope.popupWindow' has never been opened!";
    } else {
        if ($scope.popupWindow.closed) {
            document.getElementById("msg").innerHTML = "'$scope.popupWindow' has been closed!";
        } else {
            document.getElementById("msg").innerHTML = "'$scope.popupWindow' has Opened!";
        }
    }
}

Check this link and implement

A: @Sravan , Thank you for your answer.. It really helped a lot for doing further stuffs.. Now i used below code to check automatically whether the window is closed or not, using $interval service in angular..
This will update a scope variable (windowstatus) every second automatically, with respect to the current status of the window (popupWindow)..
    $scope.checkwind = function(){
                if (!$scope.popupWindow) {
                     $scope.windowstatus = "Window hasn't opened yet";

} else {
if ($scope.popupWindow.closed) {

         $scope.windowstatus = "Window is Currently Closed"
        }
        else {

         $scope.windowstatus = "Window is Currently Open";
    }
}
console.log($scope.windowstatus);
}
$interval( function(){ $scope.checkwind(); }, 100);

redpajama_set_name: RedPajamaStackExchange


text:
Q: 'gluErrorString' is deprecated in OS X 10.9. Why? I am referring to errors of the following form when compiling on OSX:
'gluErrorString' is deprecated: first deprecated in OS X 10.9

A cursory google+DDG indicates that a bunch of GLU and GLUT functions were deprecated as well, but Apple's reference has no information regarding the reasoning behind the change or the suggested successor(s). I'm not using GLUT and simply want to get a human-readable error description from GL.
Existing answers to this question and others suggest using a different framework, targeting earlier OSX versions, or suppressing the warnings, but I cannot find evidence of a proper solution.
So, what happened? And what's the recommended way to get an error string?

A: The GLU specification has not been updated since 1998. Large parts of its functionality depend on OpenGL features that have long been deprecated. If you look at the man pages on opengl.org, the latest GLU documentation is grouped with the OpenGL 2.1 man pages.
Based on this, it certainly makes sense to consider GLU deprecated for OpenGL versions past 2.1.
As for gluErrorString(), there are only 6 possible error codes returned by glGetError(). Generating a string for each of them only takes a few lines of code.


text:
Q: Where is the implementation of `Index::index` I was tracking the Rust's standard library's implementation for Vec<T>'s Indexing, that is, myvec[n]. If I was correct, here should be the source.
But it in turn calls Index::index(...), of which I currently cannot find the definition, could anyone give some clues? Thanks in advance!

A: The &** operators cause delegation to [T]'s Index implementation by way of Vec's Deref implementation.  This implementation requires the argument to be something implementing the SliceIndex trait, which defines both how the index operation is performed as well as the produced result type (e.g. ranges produce slices, while usize produces an Option<&T>).
To clarify, note that Index::index() is the very same trait method you're looking at.  It appears to be a recursive call at first glance, but since &**self is not the same type, it causes a different Index implementation to be used ([T]'s instead of Vec<T>'s) and so it's not actually recursive.


text:
Q: Android Studio detects import, but gives "Symbol cannot be resolved" I have added a library to my project in Android Studio with various classes, one of which is PublicKey.java.
If I start to type PublicKey in a class in my project, java detects the file and shows me the full file name in the popup that I can click to auto-complete. Ie, I start typing PublicKey, and I can click org.abstractj.kalium.keys.PublicKey.
However, as soon as I do this, android studio then tells me it cannot resolve the symbol abstractj, despite the fact it must recognize it given that it just prompted me to use it. Any ideas on how to fix this?
(Note: this happens with any file in the library. I just use PublicKey as an example)

A: Turns out this was an issue with the library itself. I had made a mistake in assembling the jar.


text:
Q: Can you create a strongly typed ASP.NET MVC ViewUserControl of type int or enum? i wish to create a reusable ASP.NET MVC ViewUserControl which is strongly typed to an enumeration.
Can this be done? When i try it, it says that the strong type the ViewUserControl can accept, can only be of a reference type :(
This also means i can't pass an int as TModel.
Why do i want to do this? I'n various places of my site, i'm displaying a simple image which is dependant upon an enumeration. So instead of copying that logic in multiple places, I wish to have this resuable ViewUserControl and pass in the enumeration.
eg.
public enum AnimalType
{
   Cat,
   Dog
}

// .. now code inside the view user control ...
switch (animalType)
{
    case AnimalType.Cat: source = "cat.png"; text="cute pussy"; break;
    ... etc ...
}

<img src="<%=Url.Content("~/Images/" + source)%>" alt="<%=text%>" />

I'm guessin the solution would be to NOT create a strongly typed ViewUserControl (because TModel Type can only be of type class) and then do the following..
<% Html.RenderPartial("AnimalFileImageControl", animalType); %>

and in the ViewUserControl ...
AnimalType animalType = (AnimalType) ViewData.Model;
    switch (animalType)
    { ... etc ... }

cheers :)

A: well, you could have:
public sealed class Box<T> where T : struct {
    public Box(T value) { Value = value; }
    public T Value { get; private set; }
    public static explicit operator T(Box<T> item) {
        return item.Value; } // also check for null and throw an error...
    public static implicit operator Box<T>(T value) {
        return new Box<T>(value); }
}

and use Box<int>, Box<MyEnum>, etc - but personally, I expect it would be easier to use an untyped view and simply cast.


text:
Q: I got a stomach flu or I got the stomach flu or I got stomach flu? When I googled stomach flu, there were many questions and statements like

How do you get the stomach flu?

Or

Difference between a stomach flu and food poisoning

Or

Six facts about stomach flu

When do you use the, a or nothing? And which should I use for a sentence like "I got a stomach flu from someone" ?

A: Short answer:  "The flu" is probably the one you want.
Long answer:
When your affliction is a specific named one, you often omit the article altogether.  All of these would be acceptable:

I have rickets.  I have measles.  I have AIDS.  I have cystic fibrosis. I have Zika.  I have canine distemper.*

Rough day for me.
When you are referring to symptoms of a disease, you sometimes use the indefinite article, "a."

I have a cough.  I have a rash.  I have a cyst.  I have a headache.  I have a fever.

....and sometimes use no article:

I have nauseau.  I have diarrhea.  I have dizziness.

A cold is a collection of symptoms, and usually takes the indefinite article.

I have a cold.

But if you know exactly which type of cold you have, you might switch to the definite article:

I have the common cold.

Flu is somewhat like cold in this respect.  In the past, all flus were thought to be the same malady.  Now we differentiate between avian flu, swine flu, Spanish flu and others.  (See ngrams )  If you just want to say that you have some type of flu-like illness, you might say _"a flu." If you are referring to the same flu that everyone else seems to be getting this year, you probably want to say "the flu."   If you aren't sure, use "the."

A: Since stomach flu is an informal term anyway (not medically specific or used in a setting where you might say gastroenteritis or something like that), you can use either the definite or the indefinite article and people will understand just what you mean.
The subtlety is that when you use "the" you are implying that there is one particular virus*  circulating, and your audience probably knows others who have gotten sick with the same symptoms, so your use of "the" intends to tap into the listener's knowledge of what (they or) others have experienced recently.
By contrast, "a" implies that you have acquired some virus* which affects your stomach but there are multiple such illnesses out there and you are not being specific about exactly which one you have.
In "Six facts about stomach flu" there is no article because "stomach flu" is being discussed as a general concept.  When you have a/the stomach flu, you have one specific illness, and the difference between definite and indefinite article is the implication about how many such illnesses are out there within the relevant range of consideration.  The article title ("six facts about...") does not imply that the author is sick at all or that the advice contained in that article is limited to any specific strain of virus*.
The bold words in the last paragraph can be read as more general guidance for when trying to decide between definite articles ("the") and indefinite articles ("a/an").

*: (or bacteria or other cause of disease).

A: The simple answer to your last question is,

"I got the stomach flu from someone."

But the larger question of when to use an article ("a" or "the") or not before "stomach flu" is more difficult and depends on the context, as you've found in your research.
Strictly speaking, "stomach flu" does not require an article in most cases. It would be just as valid to say,

"I got stomach flu from someone."
"How do you get stomach flu?"
"What is the difference between stomach flu and food poisoning?"

"A stomach flu" would only be used if there is more than one strain of the virus under consideration. This use is relatively rare.
The major pandemics of influenza that definitely affected the stomach (all of which I experienced) were in 1957, 1968 and 1978. I fortunately did not contract the so-called "swine flu" of 2009, so I don't know whether it was a "stomach flu" or not.
(See https://en.wikipedia.org/wiki/Influenza_pandemic)
Most "stomach flu" is actually a norovirus infection, caused by contact with tainted produce or other food. (See https://en.wikipedia.org/wiki/Norovirus)
So in most cases, it is correct to say "the stomach flu" or simply "stomach flu," unless you are speaking of multiple strains of the virus.
I hope this helps!

A: Firstly, 'Stomach flu' is not an official medical term - 'Stomach flu' is probably referring to something like gastroenteritis.
The poster asking 'How do you get the stomach flu' is probably saying it that way because that is how you refer to the flu, which is a contraction of 'Influenza'. It's common to refer to other illnesses this way, but colloquially (not officially), such as 'The Bends' (pressure sickness) or 'The Clap' (venereal disease).
Technically, there are many different strains of flu, such as H1N1, H1N2 etc. So if you don't know the type, you can refer to it non-specifically as 'a type of flu' or 'a flu'. Whereas if you specify that it is stomach flu, you don't need to prefix it with 'the' or 'a', because you have said what type it is. Examples of how it might be phrased:

*

*I've got the flu.

*I've got stomach flu.

*I feel unwell. It might be stomach flu.

*I've caught the flu from someone.

*I've caught stomach flu from someone.

*I've got gastroenteritis - it's like a stomach flu.
Hope this helps!


text:
Q: R workspace wiped I have spent the last few months on an important research project. I checked in on it again today after not touching it for about 2 weeks. The workspace is how it was around 3 months ago, and it does not have any of my most important data frames, tables, etc. The history, if I search for a command I used to assign the data (e.g. df="blah"), it is still there. How can I recover my workspace? It didn't have any error messages. My computer died a few times, but I don't know if that would impact it as I had it saved more recently than 3 months ago.
If I can't recover the workspace, how can I view the full history? I have tried saving the history as a .txt file, but it only shows the history from 3 months ago. The window also only shows this shortened history. However, again, if I actually search the window, it shows commands more recent than that. I don't know how to fix this.
Any help is greatly appreciated.


text:
Q: With HanekeSwift, will network requests be cancelled automatically for off-screen cells? When using HanekeSwift with a table view, I can simply show an image inside a cell with:
cell.image.hnk_setImageFromURL(url!)

without any further control.
If I scroll the table view quickly, some cells will go off the screen without showing their images since these images are not downloaded yet.
Are the network requests for these off-screen cells cancelled by HanekwSwift automatically?

A: One of the HanekeSwift contributors told me that the answer is NO and I should call hnk_cancelSetImage in prepareForReuse. Therefore, I added following lines in my class inherited from UITableViewCell:
override func prepareForReuse() {
    super.prepareForReuse()

    compImage.hnk_cancelSetImage()
    compImage.image = nil
}


text:
Q: How to encapsulate external scripts used in webcomponent I am creating a webcomponent which uses a codemirror library scripts to create codemirror instance.
This webcomponent works fine, until it is used in another project which is also using codemirror. In that case, page keeps on loading forever. I think its might be because of conflicts of global variables because if I comment out codemirror code, it loads fine.
My question, irrespective of above situation, is how can I scope/encapsulate external scripts in webcomponents.
Similar question has been asked but it doesnt say anything about external javascript scoping.
I am aware that shadow dom specs only talk about encapsulating css and not external JS but this is the problem that every webcomponent will have since they are meant to be used in someone elses project.

A: And what errors does DevTools "console" show?
Regarding name conflicts. There are several ways.
The easiest way is not to use global variables in the code. For example, the code can be closed in the structure:
(function() {
    // your code here
})();

and all variables in your code you declare using var, let or const.
Each declaration of a global variable should be treated as a design error.
The attached component can also be saved as a module and import variables to local variables.
If you must use a global variable for some real reason, you can call an exception when a variable with this name is already defined.
EDIT:
var editor1 = CodeMirror.fromTextArea(myTextarea1, {
    lineNumbers: true
});
var editor2 = CodeMirror.fromTextArea(myTextarea2, {
    lineNumbers: true
});

Where do you see the name conflict?


text:
Q: In my implementation I want to have different return type of the method I have the following problem. I have the interface:
public interface Parser {
    public Map<String, List<String>> parse() throws IOException;
}

I have two implementations:
public class RacerInfoParser implements Parser{

    private final Path path;

public RacerInfoParser(Path path) {
    this.path = path;
}

@Override
public Map <String, List<String>> parse() throws IOException {
    try (Stream<String>lines = Files.lines(path)){

        Map <Object, Object> map = lines.collect(Collectors.toMap(
                string -> string.substring(0,3),
                string -> Arrays.asList(string.substring(4).split("_"))));

        Map<String, List<String>> result = new HashMap<>((Map) map);
        return result;
        }
    }
}

and
public class TimeParser implements Parser {

    private final Path path;

public TimeParser(Path path) {
    this.path = path;
}

@Override
public Map <String, List<String>> parse() throws IOException {
    try (Stream<String>lines = Files.lines(path)){

        Map <Object, Object> map = lines.collect(Collectors.toMap(
                string -> string.substring(0,3),
                string -> Arrays.asList(string.substring(3).split("_"))));
        Map<String, List<String>> result = new HashMap<>((Map) map);
    return result;
        }
    }
}

What I want to do is to change the code and the return type of TimeParser so that it returns the result of type Map<String, List <LocalTime>. I have read that in order to have a different type I need to have a sub-class of the parent type, but I don't understand how to do it in my case.
P.S. I know that Map<String, List<String>> result = new HashMap<>((Map) map); is a bad code, but I don't know yet how to properly convert Map<Object, Object to Map<String, List<String>>. If you have any suggestions I will be glad to listen to them:).
P.S.S. I use these two implementations because I beleive they do the same thing: parse text from log and txt files:
    public class RacerBuilder {
        public List<Racer> buildRacers () throws URISyntaxException, IOException {

            Parser racerInfoParser = new RacerInfoParser(Paths.get(getClass().getClassLoader()
                      .getResource("abbreviations.txt").toURI()));
            Parser startTimeParser = new TimeParser(Paths.get(getClass().getClassLoader()
                      .getResource("start.log").toURI()));
            Parser endTimeParser = new TimeParser(Paths.get(getClass().getClassLoader()
                      .getResource("end.log").toURI()));

            Map<String, List<String>> racerInfoMap = racerInfoParser.parse();
            Map<String, List<String>> startTimeMap = startTimeParser.parse();
            Map<String, List<String>> endTimeMap = endTimeParser.parse();

            return racerInfoMap.keySet().stream()
                    .map(i -> new Racer (i,
                            racerInfoMap.get(i).get(0),
                            racerInfoMap.get(i).get(1),
                            startTimeMap.get(i).get(1),
                            endTimeMap.get(i).get(1),
                            endTimeMap.get(i).get(0)))
                    .collect(Collectors.toList());
           }
}

Racer class now has several fields, all of them are Strings. I want it to have 2 fields of type LocalTime.

A: To accept either :
Map<String, List<String>>

or
Map<String, List<LocalTime>>

You can use generic in this case, all you need is to use :
<T> Map<String, List<T>> parse() throws IOException;
                     ^

Also your code can be :
return lines.collect(Collectors.toMap(
        string -> string.substring(0, 3),
        string -> Arrays.asList(string.substring(4).split("_"))));

Or if you want a List of LocalTime, you can parse your String and collect as this:
return lines.collect(Collectors.toMap(
        string -> string.substring(0, 3),
        string -> Arrays.stream(string.substring(4).split("_"))
        .map(LocalTime::parse) // or you can use a Date time formatter
        .collect(Collectors.toList())

You don't need to cast with this solution.

A: I'd wrap the Map<String, List<String>> in a new class with a getter, let's call it MapAsString. Make it part of a class hierarchy so you have class MapAsString extends DataMap. Next have a new class that is a subclass of DataMap called perhaps MapAsLocalTime where MapAsLocalTime extends DataMap.
Bonus points: make your parent class DataMap abstract and provide a single abstract method you must implement. that uses Generics to return a List<String, T>. You can have a constructor that takes a T (generic type) which defines what type T will be at construction time. If this seems too hard, perhaps just have it return anything using the wildcard ?... so getter returns List<String, ?> - here ? can an object of any type

A: You can use generics T. Like this way
interface Parser<T> {
    public Map<String, List<T>> parse() throws IOException;
}

class RacerInfoParser implements Parser<String>{

    private final Path path;

    public RacerInfoParser(Path path) {
        this.path = path;
    }

    @Override
    public Map <String, List<String>> parse() throws IOException {
        try (Stream<String>lines = Files.lines(path)){

            Map <String,  List<String>> map = lines.collect(Collectors.toMap(
                    string -> string.substring(0,3),
                    string -> Arrays.asList(string.substring(4).split("_"))));
            return map;
            }
        }
    }

class TimeParser implements Parser<LocalTime> {

    private final Path path;

public TimeParser(Path path) {
    this.path = path;
}

@Override
public Map <String, List<LocalTime>> parse() throws IOException {
    try (Stream<String>lines = Files.lines(path)){

        Map<String, List<LocalTime>> result = lines.collect(Collectors.toMap(
                string -> string.substring(0,3),
                string -> Arrays.stream(string.substring(4).split("_"))
                .map(LocalTime::parse)
                .collect(Collectors.toList())
                ));
            return result;
        }
    }
}


text:
Q: How to map the "Eject" key on Non-Mac keyboard? I've gotten a new USB keyboard for my Mac. It is a Windows keyboard, but after remapping the Alt and Windows keys, it works just like a Mac keyboard. It is missing one particular feature and that is the "Eject" key. I'm not sure how to remap that command to another key. Where can I find that command?
Also if I can assign volume up and volume down to control the sound from the keyboard.
If anybody knows of a way to resolve this issue, I would greatly appreciate it.

A: One way you can eject a disk without remapping keys is to use the Eject Menu Extra item.
Just navigate to the /System/Library/CoreServices/Menu Extras/ folder and double-click on the Eject.menu file. It will put the 'eject' icon in the menu bar:

For me, this has worked for both internal and external drives. One click and the drive opens like magic!
Update: this Menu item still works in Ventura. It has survived all the updates and upgrades since I first put up this answer in 2017.

A: The shortcut ⌘ CommandE will perform the eject action anytime you have a disk selected in Finder, be it optical, removable, or mounted.


text:
Q: Trouble deploying Qt Applications I am new to Qt and I finally figured out how to use windeploy and when I did it said "libgcc_s_seh-1.dll is missing" and thus I added it from my minGW, but now It gives me the error "The application was unable to start correctly (0x000007b). I used windeployqt.exe with msvc2017_64 and here is an image of my release

Furthermore, I tried downloading dependencywalker and the only errors were false negatives in the form of MS-WIN-EXT or API-MS-WIN. I truly am lost. I think the issue may be that in my lack of knowledge with Qt and MinGW, in general, I downloaded something wrong when installing Qt or MinGW ie. 32 bit and 64 bit of MinGW, but I am truly not sure whatsoever. Any help would be much appreciated in figuring this out! Thanks!


text:
Q: Java Firestore - Error: Use FieldPath.of() for field names containing '˜*/[]' I am writing Java code to interact with a Firestore database. I need to access a field containing a forward-slash in the field name:
f.col1 = document.getString("username");
f.col2 = document.getString("subject");
f.col3 = document.getString("details/comments");

When I run the code, I get the following error for the line getting Col3:
java.lang.IllegalArgumentException: Use FieldPath.of() for field names containing '˜*/[]'.

I am unable to work out how to correctly use this method and I cannot find any documentation on how I should correctly use it (Googling brings up an equivalent JS method). When I attempt to use the FieldPath.of() method, as follows:
f.col3 = document.getString(FieldPath.of("details/comments"));

I get the following compiler error:
java: incompatible types: com.google.cloud.firestore.FieldPath cannot be converted to java.lang.String

I have no control over the structure of the Firebase data, so I need to work with this field name.
I am using the following documentation to interact with the database:
https://firebase.google.com/docs/firestore/quickstart#java_9

A: I think you're looking for FieldPath.of for that last field:
f.col3 = document.getString(FieldPath.of("details/comments"));

If the / was meant to indicate the comments is a subfield inside the details map, the correct separator would be a . btw:
f.col3 = document.getString(FieldPath.of("details.comments"));

For your second error, it looks like DocumentSnapshot.getString() only exists with a String parameter, so you'll want to use get() which accepts a FieldPath:
f.col3 = document.get(FieldPath.of("details/comments"));

or
f.col3 = document.get(FieldPath.of("details.comments"));

If you're getting a string conversion error here, add toString() to the call.


text:
Q: Can I use 'rather adjective to' instead of 'too adjective to'? My question is contained in the title: can I use 'rather (an adjective) to' instead of 'too (an adjective) to'?
To convey a weaker tone than a sentence such as 'Its implications are too various to outline in this short preamble', can I write like this: 'Its implications are rather various to outline in this short preamble'?
Thank you all in advance.

A: In general, the answer is yes.
e.g.
"He is rather old to be doing that".
He is doing it, and it is unexpected and unusual that he is.  It's a descriptive statement.
"He is too old to be doing that".
He is doing it, and he should not be doing it.  It is a proscriptive statement.
However, in the specific example you ask about, the answer is no.   "...rather various..." is not a phrase in use.


text:
Q: Why do these identical weapon coils give different results? I've noticed something weird when modifying my weapons.
If a weapon has equipped, for example, a +6% damage +6% tear coil and I want to replace it with an identical one, the weapon's stats don't give me the same result.
I'm wondering if weapon modifiers bugged or if coils' percentages aren't exact numbers, but approximated values? Because I really don't understand how this actually works.
I'm not the only one how have noticed something weird, there should be some math messed up somewhere.
Here's an example.
The Blast Sling have a +6% damage +6% handling coil equipped, but if I try to replace it with a theoretically identical +6% handling +6% damage coil this is the result:

A: This has been observed a handful of times by users and the general consensus is that there are hidden decimals that you can't see but will affect the outcome of applying the mods. From this thread:

Two mods with the same x% stat don't necessarily increase by the same amount. I think there's some kind of decimal system in place.

And this thread:

I'm fairly certain that there is decimals that you don't see.
Like you said I've had multiple say 10% ones. Normally they'd add like 5 but sometimes the bar will move up and it be 6 or 4.
The damage/modifiers increase is based on how full those little slashes are.

And from this thread:

The 20% mod changing to 19% could be a rounding difference. I've always known that mods have decimal numbers that you can't see. 2 identical looking mods can occasionally give different stat bonuses, and it's because of the decimal.

In the last thread, users were discussing an update that was released after the time this question was posted that changed a lot of their mod values. It may be that the invisible decimal was a bug and these values have been changed to more accurately represent the boosts they grant, but unless you still have the mods from the question, it will be hard to prove, though I suspect that this was just another one of these cases.


text:
Q: C# EPPlus how to generate line chart with dash line For last 2 days I stuck with a line chart issue with EPPlus. My objective is to create a line chart with EPPlus and line style will be dash line like below image. picture attached.

I search a lot Google for 2 days still got no relevant hint to have dash line in chart. I am not sure that at all EPPlus support dash line. I am using EPPlus version 6.0 and .NET Framework version 4.8. This is a sample code which generate chart in excel sheet with one line but I need that line will be dash line. please someone see my code and tell me what is missing in my code for which I could not have dash line style of line chart.
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
var newFile = new FileInfo(filepath);
using (ExcelPackage xlPackage = new ExcelPackage(newFile))
{
    ExcelWorksheet worksheet = xlPackage.Workbook.Worksheets.Add("test");
    worksheet.Cells["A1"].Value = 1;
    worksheet.Cells["A2"].Value = 2;
    worksheet.Cells["A3"].Value = 3;
    worksheet.Cells["A4"].Value = 4;
    worksheet.Cells["A5"].Value = 5;
    worksheet.Cells["A6"].Value = 6;

    worksheet.Cells["B1"].Value = 10000;
    worksheet.Cells["B2"].Value = 10100;
    worksheet.Cells["B3"].Value = 10200;
    worksheet.Cells["B4"].Value = 10150;
    worksheet.Cells["B5"].Value = 10250;
    worksheet.Cells["B6"].Value = 10200;

    //ExcelChart chart = worksheet.Drawings.AddChart("LineChart", eChartType.XYScatterSmooth);
    ExcelChart chart = worksheet.Drawings.AddChart("LineChart", eChartType.XYScatterSmoothNoMarkers);
    chart.Series.Add(ExcelRange.GetAddress(1, 2, worksheet.Dimension.End.Row, 2),
                ExcelRange.GetAddress(1, 1, worksheet.Dimension.End.Row, 1));

    var Series = chart.Series[0];
    //chart.Axis[0].MinorGridlines.Fill.Color = Color.Red;
    //chart.Axis[0].MinorGridlines.LineStyle = eLineStyle.LongDashDot;
    chart.Axis[0].RemoveGridlines();
    chart.Axis[1].RemoveGridlines();
    chart.Axis[0].Border.LineStyle = eLineStyle.SystemDash;
    //chart.XAxis.Border.LineStyle = eLineStyle.Dash;
    chart.Series[0].Header = "Blah";
    //chart.Series[0].Border.LineStyle = eLineStyle.DashDot;
    //chart.Axis[0].Border.LineStyle = eLineStyle.Dash;

    xlPackage.Save();
    MessageBox.Show("Done");
}

I also check this post but could not implement it in my code Office Open XML: Drawing Dashed Line in Chart
Please push me to right direction to achieve my goal. Thanks in advance.

A: This works for me with same versions as you.
You need to add a reference to System.Drawing for the color:
// ...(code above this line did not change)

ExcelChart chart = worksheet.Drawings.AddChart("LineChart", eChartType.XYScatterSmoothNoMarkers);
chart.Series.Add(
    ExcelRange.GetAddress(1, 2, worksheet.Dimension.End.Row, 2),
    ExcelRange.GetAddress(1, 1, worksheet.Dimension.End.Row, 1));

chart.Series[0].Header = "Blah";

// Add this:
chart.Series[0].Border.LineStyle = OfficeOpenXml.Drawing.eLineStyle.Dash;
chart.Series[0].Border.Width = 2;
chart.Series[0].Border.Fill.Color = System.Drawing.Color.Blue;

chart.Axis[0].RemoveGridlines();
chart.Axis[1].RemoveGridlines();

xlPackage.Save();

Result:

A: #region chart summary 4
ExcelWorksheet Worksheet4 = p.Workbook.Worksheets.Add("Graph(4)");
var summary_Chart_four = Worksheet4.Drawings.AddChart("chart", eChartType.LineMarkers);
// var summary_Chart_four = Worksheet4.Drawings.AddChart("chart", eChartType.XYScatterLines) as ExcelScatterChart;
            //var summary_Chart_four = Worksheet4.Drawings.AddChart("chart", (eChartType)System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Dash);
            //var summary_Chart_four = myWorksheet.Drawings.AddChart("chart", (eChartType)System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Dash);
            summary_Chart_four.ShowDataLabelsOverMaximum = true;
            Worksheet4.Cells.Style.Font.Name = "Arial";
            Worksheet4.Cells.Style.Font.Size = 10;
            Worksheet4.Cells.Style.Font.Bold = false;
            loopCnt = 0;
            for (int i = 0; i < (cVM.PeerGroups.Count + cVM.IndexGroups.Count) * 4; i += 4)
            {
                int rowIndex = 10 + i;
                int endRowIndex = 14 + i;
                string startingColumn_series = "C" + rowIndex;
                string endColumn_series = column + rowIndex;
                string lastColumn_xaxis = column + 6;
                int headerRowIndex = 9 + i;
                string seriesHeader = "A" + headerRowIndex;
                var series_i = summary_Chart_four.Series.Add(myWorksheet_summary_data.Cells[startingColumn_series + ":" + endColumn_series], myWorksheet_summary_data.Cells["C6:" + lastColumn_xaxis]);//working
                series_i.Header = myWorksheet_summary_data.Cells[seriesHeader].Value.ToString();
                summary_Chart_four.YAxis.Font.Size = 10;
                summary_Chart_four.XAxis.Font.Size = 10;
                //summary_Chart_four.XAxis.Format =DateTime.Now.Year.ToString();
                summary_Chart_four.YAxis.Format = "$0";

                if (loopCnt == 0)
                {
                    string LineColor = "#000080";
                    series_i.Border.LineStyle = eLineStyle.Solid;
                    //series_i.LineColor = LineColor.ConvertToColor();
                    //series_i.LineWidth = 2.0;
                    //series_i.Marker.Style = eMarkerStyle.Diamond;
                    //series_i.Marker.Size = 8;
                    //string BGColor = "#99ccff";
                    //series_i.Marker.Fill.Color = BGColor.ConvertToColor();
                    //string strBorderColor = "#000080";
                    //series_i.Marker.Border.Fill.Color = strBorderColor.ConvertToColor();
                    ((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).LineColor = LineColor.ConvertToColor();
                    ((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).LineWidth = 2.0;
                    ((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).Marker.Style = eMarkerStyle.Diamond;
                    ((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).Marker.Size = 8;
                    string BGColor = "#99ccff";
                    //((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).Marker.Border.LineCap
                    ((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).Marker.Fill.Color = BGColor.ConvertToColor();
                    string strBorderColor = "#000080";
                    ((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).Marker.Border.Fill.Color = strBorderColor.ConvertToColor();
                    ((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).Marker.Border.Width = 0.75;
                }
                else if (loopCnt == 1)
                {
                    string LineColor = "#003300";
                    series_i.Border.LineStyle = eLineStyle.LongDash;
                    //series_i.LineColor = LineColor.ConvertToColor();
                    //series_i.LineWidth = 2.0;
                    //series_i.Marker.Style = eMarkerStyle.Square;
                    ////((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).Marker.Style = eMarkerStyle.Dash;
                    //series_i.Marker.Size = 7;
                    string BGColor = "#c0c0c0";
                    //series_i.Marker.Fill.Color = BGColor.ConvertToColor();
                    //string strBorderColor = "#003300";
                    //series_i.Marker.Border.Fill.Color = strBorderColor.ConvertToColor();

                    ((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).LineColor = LineColor.ConvertToColor();
                    ((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).LineWidth = 2.0;
                    ((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).Marker.Style = eMarkerStyle.Square;
                    ((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).Marker.Size = 7;
                    //((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).Marker.Border.LineCap
                    ((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).Marker.Fill.Color = BGColor.ConvertToColor();
                    string strBorderColor = "#003300";
                    ((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).Marker.Border.Fill.Color = strBorderColor.ConvertToColor();
                    ((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).Marker.Border.Width = 0.75;

                }

                else if (loopCnt == 2)
                {
                    string LineColor = "#F79646";
                    series_i.Border.LineStyle = eLineStyle.Dot;
                    ////series_i.LineColor = LineColor.ConvertToColor();
                    ////series_i.LineWidth = 2.0;
                    ////series_i.Marker.Style = eMarkerStyle.Circle;
                    //////((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).Marker.Style = eMarkerStyle.Dot;
                    ////series_i.Marker.Size = 8;
                    string BGColor = "#ccffcc";
                    ////series_i.Marker.Fill.Color = BGColor.ConvertToColor();
                    string strBorderColor = "#F79646";
                    ////series_i.Marker.Border.Fill.Color = strBorderColor.ConvertToColor();
                    ((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).LineColor = LineColor.ConvertToColor();
                    ((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).LineWidth = 2.0;
                    ((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).Marker.Style = eMarkerStyle.Circle;
                    ((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).Marker.Size = 8;
                    //((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).Marker.Border.LineCap
                    ((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).Marker.Fill.Color = BGColor.ConvertToColor();
                    ((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).Marker.Border.Fill.Color = strBorderColor.ConvertToColor();

                    ((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).Marker.Border.Width = 0.75;

                }
                else if (loopCnt == 3)
                {
                    string LineColor = "#c0504d";
                    series_i.Border.LineStyle = eLineStyle.LongDashDotDot;
                    ////series_i.LineColor = LineColor.ConvertToColor();
                    ////series_i.LineWidth = 2.0;
                    ////series_i.Marker.Style = eMarkerStyle.Triangle;
                    //////((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).Marker.Style = eMarkerStyle.Dot;
                    ////series_i.Marker.Size = 8;
                    string BGColor = "#c0504d";
                    ////series_i.Marker.Fill.Color = BGColor.ConvertToColor();
                    ((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).LineColor = LineColor.ConvertToColor();
                    ((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).LineWidth = 2.0;
                    ((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).Marker.Style = eMarkerStyle.Triangle;
                    ((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).Marker.Size = 8;
                    //((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).Marker.Border.LineCap
                    ((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).Marker.Fill.Color = BGColor.ConvertToColor();
                    string strBorderColor = "#003300";
                    ((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).Marker.Border.Fill.Color = strBorderColor.ConvertToColor();
                    ((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).Marker.Border.Width = 0.75;

                }

                //else if (loopCnt == 4)
                //{
                //    string LineColor = "#c0504d";
                //    series_i.Border.LineStyle = eLineStyle.LongDashDotDot;
                //    series_i.LineColor = LineColor.ConvertToColor();
                //    series_i.LineWidth = 1.5;
                //    series_i.Marker.Style = eMarkerStyle.Square;
                //    //((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).Marker.Style = eMarkerStyle.Dot;
                //    series_i.Marker.Size = 8;
                //    string BGColor = "#c0504d";
                //    series_i.Marker.Fill.Color = BGColor.ConvertToColor();

                //}
                else
                {
                    ////series_i.LineColor = System.Drawing.Color.Aqua;
                    ////series_i.LineWidth = 1.5;
                    ////series_i.Marker.Style = eMarkerStyle.Circle;
                    ////series_i.Marker.Size = 8;
                    ////series_i.Marker.Fill.Color = System.Drawing.Color.Aqua;
                }
                //series_i.Smooth = eLineStyle.Dash;
                //((OfficeOpenXml.Drawing.Chart.ExcelLineChartSerie)series_i).Series=eChartType.d

                loopCnt++;
            }

            //var series_four = summary_Chart_four.Series.Add(myWorksheet_summary_data.Cells["C10:" + lastColumn_series1], myWorksheet_summary_data.Cells["C6:" + lastColumn_xaxis]);//working
            //series_four.Header = myWorksheet_summary_data.Cells["A9"].Value.ToString();

            //var series_four1 = summary_Chart_four.Series.Add(myWorksheet_summary_data.Cells["C14:" + lastColumn_series2], myWorksheet_summary_data.Cells["C6:" + lastColumn_xaxis]);

            //series_four1.Header = myWorksheet_summary_data.Cells["A13"].Value.ToString();

            summary_Chart_four.Border.Fill.Color = System.Drawing.Color.Black;
            //summary_Chart_four.Title.Text = "Comparison of " + cVM.YearsBack + " Year Cumulative Total Return" + Environment.NewLine + " Assumes Initial Investment of $100" + Environment.NewLine + strMonth + " " + strSelectedDt.Year;
            summary_Chart_four.Title.Text = "COMPARISON OF CUMULATIVE TOTAL RETURN";
            summary_Chart_four.SetSize(960, 600);
            // Add to 6th row and to the 6th column
            summary_Chart_four.Legend.Font.Size = 10;
            ((OfficeOpenXml.Drawing.Chart.ExcelChartStandard)summary_Chart_four).Legend.Font.SetFromFont("Calibri", 11, false, false, false, false);
            ((OfficeOpenXml.Drawing.Chart.ExcelChartStandard)summary_Chart_four).YAxis.Font.SetFromFont("Arial", 10, false, false, false, false);
            ((OfficeOpenXml.Drawing.Chart.ExcelChartStandard)summary_Chart_four).XAxis.Font.SetFromFont("Arial", 10, false, false, false, false);
            ((OfficeOpenXml.Drawing.Chart.ExcelChartStandard)summary_Chart_four).Title.Font.Bold = true;
            ((OfficeOpenXml.Drawing.Chart.ExcelChartStandard)summary_Chart_four).Title.Font.SetFromFont("Calibri", 16, false, false, false, false);
            //summary_Chart_four.Legend.Border.Fill.Color = System.Drawing.Color.Black;
            summary_Chart_four.SetPosition(0, 0, 0, 0);
            summary_Chart_four.XAxis.MajorTickMark = eAxisTickMark.In;
            //summary_Chart.XAxis.MajorTickMark = eAxisTickMark.In;
            summary_Chart_four.XAxis.MinorTickMark = eAxisTickMark.None;
            summary_Chart_four.YAxis.MinorTickMark = eAxisTickMark.None;
            summary_Chart_four.Legend.Position = eLegendPosition.Top;
            summary_Chart_four.YAxis.CrossBetween = eCrossBetween.MidCat;
            summary_Chart_four.XAxis.MajorGridlines.CompoundLineStyle = eCompundLineStyle.Double;


text:
Q: Trying to Use an array for Images that are targets for a game. Making targets appear randomly XCODE I'm trying to get the targets to add and remove from the subview randomly and without adding two to the same spot. I am trying to use an array by appending the imageviews to the array but I don't know how to call the array to make the appear.
    func spawnEnemys(){
    let enemy1 = UIImageView (image: nil)
    let enemy2 = UIImageView (image: nil)
    let enemy3 = UIImageView (image: nil)
    let enemy4 = UIImageView (image: nil)

    enemy1.image = UIImage(named: "enemy2.png")
    enemy1.frame = CGRect(x: self.w*0.85, y: self.h*0.035, width: self.w*0.12, height: self.h*0.22)

    enemy2.image = UIImage(named: "enemy3.png")
    enemy2.frame = CGRect(x: self.w*0.85, y:self.h*0.3, width: self.w*0.1, height: self.h*0.18)

    enemy3.image = UIImage(named: "enemy4.png")
    enemy3.frame = CGRect(x: self.w*0.85, y:self.h*0.525, width: self.w*0.1, height: self.h*0.18)

    enemy4.image = UIImage(named: "enemy2.png")
    enemy4.frame = CGRect(x: self.w*0.85, y:self.h*0.75, width: self.w*0.12, height: self.h*0.22)

    enemyArray.append(enemy1)
    enemyArray.append(enemy2)
    enemyArray.append(enemy3)
    enemyArray.append(enemy4)

    Timer.scheduledTimer(withTimeInterval: 3, repeats: true, block: { timer in
        self.view.addSubview(self.enemyArray[Int.random(in: 0...2)])
        }


text:
Q: FCM and AdMob with two different accounts? Is it possible to integrate FCM and AdMob in a single App from two different accounts?

A: When you add FCM and Admob to your project, the first step is to configure the project and then to add google-services.json file in app folder, which have all the configurations that is needed to link your project. There can be only one google-services.json file in your project. So it's not possible to use two accounts for the same.


text:
Q: View in Android ListView not redrawing I have a Android ListView, which contains one button thats needs to be checked when clicked. The click event seems to be working:
public View getView(final int position, View convertView, ViewGroup parent) {
    final ViewHolder holder;

    LayoutInflater inflater = this._context.getLayoutInflater();

    if (convertView == null) {
        convertView = inflater.inflate(R.layout.checkbox_cell, null);
        holder = new ViewHolder();
        holder.checkbox = (CheckBox) convertView.findViewById(R.id.button);
        holder.textView = (TextView) convertView.findViewById(R.id.textView);
        convertView.setTag(holder);

    } else {
        holder = (ViewHolder) convertView.getTag();
    }

    if(holder.checkbox.isChecked()) {
        convertView.setBackgroundColor(Color.RED);
        holder.textView.setBackgroundColor(Color.RED);
        convertView.invalidate();
    } else {
        convertView.setBackgroundColor(Color.GREEN);
    }

    holder.checkbox.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {

            Arrays.sort(_context.checkBoxIds);
            int index = Arrays.binarySearch(_context.checkBoxIds, position);

            if (((CheckBox) v).isChecked()) {
                holder.textView.setPaintFlags(holder.textView.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);

            } else {
                holder.textView.setPaintFlags(holder.textView.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG));
            }
            holder.textView.setBackgroundColor(Color.RED);
            notifyDataSetChanged();

        }
    });

    return convertView;
}

As you probably can see i'm changing the background to green initial, when i click the "checkbox" the background needs to be red (this is just a test to see if the UI updates). I tried to update the views in the onClick, but thats not working either. After the onClick i call notifyDataSetChanged() to see if the UI changes when i refresh. The holder.checkbox.isChecked()seems to be true but when i set the background to RED the UI won't update. Does anyone know what goes wrong here? I'm clueless at the moment.

A: You should update the view based on your data representation. However you are updating view based on checkbox view state that is never set before.
So you should first update checkbox based on portion of data that related to the position and after use it further

A: You can define interface inside adapter to listen checkbox click and use setTag() on Checkbox and implements that interface on Fragment or Activity and define your definition inside activity or fragment .

A: If you debug your code, I think if(holder.checkbox.isChecked()) { this line will always return false. That is because you have overriden the default on-click event of the CheckBox, which should be toggle the check status when clicking it, however after your overriden, you ignored to toggle the check status, that's why the background cannot be changed to RED even after you issued notifyDatasetChanged.
So please try to add holder.checkbox.setChecked(!checkbox.isChecked()); to the first line of your OnClickListener to see if it helps.

A: android:clickable="true" please add this tour check box in the xml then you try with your code , when ever you do some operation on adapter you need update with this .

A: First and foremost, you need to remember which items on the list are checked, and which are not. For this you can use a SparseBooleanArray.
Then in getView you need to set the view appropriately based on whether it's checked or not.
Finally you need to update the array whenever someone clicks on the checkbox.
public class MyAdapter extends BaseAdapter {

 private SparseBooleanArray checkedItems = new SparseBooleanArray();

    public View getView(final int position, View convertView, ViewGroup parent) {
        final ViewHolder holder;

        LayoutInflater inflater = this._context.getLayoutInflater();

        if (convertView == null) {
            // ...
        } else {
            // ...
        }

        holder.checkbox.setOnClickListener(null); // You may be reusing views, so avoid firing previous listener set

        holder.checkbox.setChecked(checkedItems.get(position, false));  // Set checked value for the checkbox based on your checked items array

        if(holder.checkbox.isChecked()) {
           // Do your stuff
        } else {
           // Do your stuff
        }

        holder.checkbox.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {

                checkedItems.put(position, ((CheckBox) v).isChecked()); // (!)
                // do stuff
            }
        });

        return convertView;
    }
}

I marked one line with (!) because I never remember whether onClick event on checkbox gives you old or new checked state - you may need to add negation appropriately.

A: Its Simple!..
You don't find same control after notifyDataSetChanged(); because this function refresh view calling with.
 public View getView(final int position, View convertView, ViewGroup parent) {
return convertView;
}

so you can't get same state of check box it refresh all view.
you need to find check state as data part using any binder class.
when you click, you make a state of data.
    List<CheckState> checkState=new ArrayList<CheckState>();// as an instance

holder.checkbox.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {

             if (((CheckBox) v).isChecked()) {

 checkState.add(new CheckState(true);

       } else{

            checkState.add(position,false);

        }
    });

 if(checkState.get(position).isChecked())
   {
        convertView.setBackgroundColor(Color.RED);
        holder.textView.setBackgroundColor(Color.RED);
        convertView.invalidate();
    } else {
        convertView.setBackgroundColor(Color.GREEN);
    }

example:- create a inner class
    public class CheckState {

    boolean isChecked;

    public CheckState(boolean isChecked) {

        this.isChecked = isChecked;
    }

    public boolean isChecked() {
        return isChecked;
    }

}

I think it is helpful to you!


text:
Q: Creating a URL from parsed arguments Say you have an array built using wp_parse_args().  Is there a built in method in Wordpress to create a url using said array, or would I have to resort to a custom function?

A: PHP has a function bulit-in to convert arrays to query strings: http_build_query
Here's an example:
$arr = array('name' => 'Eric', 'age' => 23, 'sex' => 'M');
$query = http_build_query($arr); // 'name=Eric&age=23&sex=M'
$url = 'http://example.com/?'.$query;

A: As far as I know, you don't have a specific function like that in WP.
However, I think you can solve your problem and get the current URL (including args) using this code:
global $wp;
$current_url = add_query_arg( $wp->query_string, '', home_url( $wp->request ) );

Note that you can replace the '' parameter, to even add your own parameters if needed.
If for some reason that code doesn't meet your requirements, the answer to your question might be something like:
$args = wp_parse_args();
$str_params = '';
foreach($args as $key => $val) {
  $str_params .= ($str == '') ? "?" : "&";
  $str_params .= $key . "=" . $val;
}
$current_url = home_url( $wp->request ) . $str_params;


text:
Q: Structs of Arrays: Type Error I do not get the difference between the following two struct definitions. The first works without any problems, while the second gives a Type Error:
julia> struct point1
           xy::Vector{Float64}
       end

julia> struct point2
           xy::Array{Float64,1}(2)
       end
ERROR: TypeError: point2: in type definition, expected Type, got Array{Float64,1}
Stacktrace:
 [1] eval(::Module, ::Any) at ./boot.jl:235
 [2] eval(::Any) at ./boot.jl:234
 [3] macro expansion at /Users/.julia/v0.6/Atom/src/repl.jl:186 [inlined]
 [4] anonymous at ./<missing>:?

Any ideas?

A: The issue here is that Array{Float64,1}(2) isn't a type (i.e. typeof(Array{Float64,1}(2)) != DataType) but a newly initialized instance of a Array{Float64,1}.
If you would like to fix the dimension of the array field xy you can
1) make constructors throw errors/warnings if someone tries to initialize with an array of wrong size (this doesn't effect performance of course)
2) use StaticArrays.jl to maybe speed up your code
Pkg.add("StaticArrays")
using StaticArrays

struct point3
    xy::SVector{2,Float64}
end

Test:
julia> p = point3(@SVector rand(2))
point3([0.621778, 0.083348])

julia> p = point3(rand(2))
point3([0.737558, 0.405582])

julia> p = point3(rand(3))
ERROR: Dimension mismatch. Expected input array of length 2, got length 3

A: Solved it:
struct point2
    xy::Array{Float64,1}
end

The problem was the definition of the dimension ...


text:
Q: Dudley's exercise on finitely additive probabilities Yesterday I found the following exercise in Dudley's "Real Analysis and Probability".

In a game, two players, Sam and Joe, each pick a nonnegative integer at random. For each, the probability that the number is in any set $A$ is $\mu(A)$, where $\mu$ is a finitely additive function defined on $2^X$ with $\mu(A) = 0$ for every finite set $A$ and $\mu(X) = 1$, and $X = \mathbb{N}$. The one who gets the larger number wins. A coin is tossed to determine whose number you find out first. It's heads, so you find out Sam's and still don't know Joe's. Now, who do you think will win?

I was wondering if the following line of reasoning is correct.

The one that will win with probability $1$ is Joe. To prove this, let $m \in \mathbb{N}$ be the number picked by Sam. Then, according to the way in which $\mu$ is defined, $\mu (x > m) = 1$ and $\mu (x \leq m) = 0$. This is so, because the set $\{ x \ | \ x > m \}$ is an infinite subset of $\mathbb{N}$, while $\{ x \ | \ x \leq m \}$ is clearly finite. QED

Is this correct?
Any feedback is more than welcome as always (even if this exercise looks completely trivial to you), in particular because I feel really uncomfortable with measure theory.
Thank you for your time and assistance.

A:
The one that will win with probability $1$ is Joe. To prove this, let $m \in \mathbb{N}$ be the number picked by Sam. Then, according to the way in which $\mu$ is defined, $\mu (x > m) = 1$ and $\mu (x \leq m) = 0$. This is so, because the set $\{ x \ | \ x > m \}$ is an infinite subset of $\mathbb{N}$, while $\{ x \ | \ x \leq m \}$ is clearly finite. QED
Is this correct?

The problem is that the same reasoning can be applied to show that Sam wins with probability $1$. In particular, let $m \in \mathbb{N}$ be the number picked by Joe. Then according to the way in which $\mu$ is defined, $\mu(x > n) = 1$ and $\mu(x \le m) = 0$. Therefore the probability that Sam picks a higher number is $1$.
You get the idea. Now, this is the whole point of the problem: to show that in an absurd situation, absurd conclusions can be drawn. Here, we can prove that Joe -- or Sam -- wins with probability $1$. But that makes little sense. An alternative interpretation is to consider the fact we find out Sam's answer first to be significant. Then maybe the probability is $1$, but if we found out Joe's number first, then the probability would be $1$ for Sam to win.
You see, the problem is completely symmetric -- Sam and Joe should have the same chance of winning! Yet it seems depending on whose answer we find out first, that person just loses.
So here, simply finding out some information -- even though the actual information, i.e. the actual value of Sam's number, doesn't matter -- seems to change the probability.
This is why we do not allow finitely additive measures to be called "probabilities". They are counterintuitive, and certain desirable properties that we want to be true of probability distributions become false.

A: This is a weird probability distribution, but your reasoning is correct. For any actual value $m$, the set $\{\leq m\}$ is finite and hence has probability zero of being selected. By complement, one of the integers greater than $m$ is almost surely going to be chosen.

A: It is not correct to claim the probability is 1. There are several problems here.  Let $J$ and $S$ be the numbers picked by Joe and Sam.  We are not told the relationship between $J$ and $S$, perhaps $J=S$ always!  Then it is impossible to have $J>S$.
Another difficulty is that we cannot use the following law of total probability for several reasons:
$$ P[J>S] = \sum_{i=1}^{\infty} \underbrace{P[J>S|S=i]}_{\mbox{undefined}}\underbrace{P[S=i]}_{0}$$
Problems:

*

*The "finitely additive" nature of the system does not allow us to sum over a countably infinite number of terms in this way. We indeed have:
$$ \{J>S\} = \cup_{i=1}^{\infty}\{J>i, S=i\}$$
However, this does not allow us to conclude $P[J>S] = \sum_{i=1}^{\infty} P[J>i, S=i]$.

*The "conditional probability" $P[J>S|S=i]$ is undefined for all $i \in \{1, 2, 3, ...\}$ (because we cannot condition on a probability-0 event). There is no clear mathematical way to work with the information "we are given $S=i$" or to draw conclusions from this information.

*Standard concepts of "independence" are not helpful: Even if $J=S$ always, $J$ and $S$ are still "independent" according to the standard definition because:
$$ P[J \leq x, S \leq y] = P[J \leq x]P[S\leq y] =0 \quad \forall x, y \in \mathbb{R}$$

So, in order to "solve" the problem given in your question, you would need to
develop a theory that includes nonstandard definitions of "independence" and
"conditional probability." The theory should be consistent and convincing enough
for people to feel comfortable interpreting the statement of your question within
the context of your theory.


text:
Q: log4j produces no output on specific Weblogic servers We are distributing an application that is deployed as a bunch of WAR files in various WebLogic servers (9, 10 and 11) at various customers' sites. Those apps are using commons-logging and log4j. It works perfectly everywhere except at a specific site where no logs are generated from our app. That site is on 11g and has a bunch of other Oracle software installed (BPEL, OSB etc)
In our code, we use:
public class Foo {

private final static Log log = LogFactory.getLog(Foo.class);

    public void bar () {
        log.trace("bar called");
        ...

Since we want to let the customers adapt their logs configuration, we have a configuration folder in the server CLASSPATH:
CLASSPATH=/opt/app/domain_foo/foo_config/:....

In that folder, two files for logs, commons-logging.properties:
org.apache.commons.logging.Log org.apache.commons.logging.impl.Log4JLogger

And log4j.properties: (this is a simplified one that has the same issue, actual file contains 5 loggers with various parameters)
log4j.rootLogger=INFO, fileApp

# File appender
log4j.appender.fileApp=org.apache.log4j.RollingFileAppender
log4j.appender.fileApp.file=fooapp.log
log4j.appender.fileApp.maxFileSize=10240KB
log4j.appender.fileApp.maxBackupIndex=5
log4j.appender.fileApp.append=true
log4j.appender.fileApp.layout=org.apache.log4j.PatternLayout
log4j.appender.fileApp.layout.ConversionPattern=%d{dd/MM/yyyy HH:mm:ss,SSS} %-5p %-70.70C %m%n

log4j.logger.be.foo=DEBUG

The file fooapp.log is created (so it was able to find the properties file) but empty.
I tried to check the log settings in Weblogic but they seem to be the same on working and not working servers.
I copied the CLASSPATH to my server and it is still working fine.
I don't really know where to look anymore. Any ideas ?

A: It is a bit tricky but the answer is in the environment named: APPLICATIONS_DIRECTORY that should point to the path where APPLICATIONS_DIRECTORY/fooapp.log should be.  You can get the directory location from System.getenv("APPLICATIONS_DIRECTORY");


text:
Q: How to put gist as user (and not anonymous)? In ipython terminal :
%pastebin -d "my description" 1-150
returns the url to the gist. However, I want to paste it as a logged in user, into my github account. Additionally, is there a way to create private gist (rather than public) from within ipython.

A: It is not possible with the current code, it is not even planned on the Roadmap.
Still this could be done as an extension.
You can also propose patches to current magic, Pull Request are always welcomed.


text:
Q: UWP Unhandled Exception when writing to serial I'm having an issue with writing to a serial device in UWP. My task for writing to the port looks like this:
    public async Task WriteAsync(byte[] stream)
    {
        if (stream.Length > 0 && serialDevice != null)
        {
            await writeSemaphore.WaitAsync();
            try
            {
                DataWriter dataWriter = new DataWriter(serialDevice.OutputStream);

                dataWriter.WriteBytes(stream);

                await dataWriter.StoreAsync();
                dataWriter.DetachStream();
                dataWriter = null;
            }
            finally
            {
                writeSemaphore.Release();
            }

        }
    }

The code works fine the first two times I call this function. The third time I get Unhandled Exception in ntdll.dll in the await dataWriter.StoreAsync() line.
The full exception I can see is:

Unhandled exception at 0x00007FFCB3FCB2C0 (ntdll.dll) in xx.exe:
  0xC000000D: An invalid parameter was passed to a service or function.

This answer mentions a garbage collector closing an input stream, however I don't see why would it happen in my code. Any help on getting to the bottom of this issue would be highly appreciated!

A: Turns out the solution to my problem was in another piece of code. I had a function reading the bytes like this:
        private async Task ReadAsync(CancellationToken cancellationToken)
    {
        Task<UInt32> loadAsyncTask;

        uint ReadBufferLength = 1024;

        // If task cancellation was requested, comply
        cancellationToken.ThrowIfCancellationRequested();

        // Set InputStreamOptions to complete the asynchronous read operation when one or more bytes is available
        dataReader.InputStreamOptions = InputStreamOptions.Partial;

        using (var childCancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken))
        {
            // Create a task object to wait for data on the serialPort.InputStream
            loadAsyncTask = dataReader.LoadAsync(ReadBufferLength).AsTask(childCancellationTokenSource.Token);

            // Launch the task and wait
            UInt32 bytesRead = await loadAsyncTask;
            if (bytesRead > 0)
            {
                byte[] vals = new byte[3]; //TODO:adjust size
                dataReader.ReadBytes(vals);
                //status.Text = "bytes read successfully!";
            }
        }
    }

Specifically the problem was in the following two lines:
byte[] vals = new byte[3]; //TODO:adjust size
dataReader.ReadBytes(vals);

As soon as I set the size of the vals array to bytesRead value the problem went away.

A: Normally, you would not have to set dataWriter to null, because the GC will know that an object will not be used anymore.
You'd better call dataWriter.Dispose() method like many UWP samples.
For example: SocketActivityStreamSocket
Please read IDisposable.Dispose Method () document for more details.


text:
Q: django request.user.is_superuser doesn't work I want to show a button if the user is a superuser. I've found  differents examples but my code doesn't work. The button doesn't appear. Anybody knows why?
views.py
def inici(request):
zones = Zona.objects.all()
return render_to_response('principal/inici.html', dict(zones=zones),
    context_instance = RequestContext(request))

inici.html
{% if not user.is_authenticated %}
     ....
{% else %}

    Logout

     Configuració

    {% if request.user.is_superuser %}

        Crear zona

    {% endif %}

{% endif %}

I only have a user in the database and he is a super user. I can see the "logout" button and the other one, but not the "crear zona" button.

A: You want this Generic view:
class IniciView(ListView):
    template_name = 'principal/inici.html'
    model = Zona

are the context processors in settings?
This is more redeable:
{% if user.is_authenticated %}

        Logout

         Configuració

    {% if user.is_superuser %}

        Crear zona

    {% endif %}

{% else %}
    ...
{% endif %}

I've changed {% if request.user.is_superuser %} to {% if user.is_superuser %}


text:
Q: Cannot include  or it crashes I am using eclipse with C++ and opengl. However in my program I cannot use #include or I get the following error The program file specified in the launch configuration does not exist C:\Users\workspace\mapCreator\Debug\mapCreator.exe not found
The console looks like this

08:10:17 ** Incremental Build of configuration Debug for project
  mapCreator ** Info: Internal Builder is used for build g++
  "-IC:\MinGW\lib\gcc\mingw32\4.6.2\include"
  "-IC:\MinGW\lib\gcc\mingw32\4.6.2\include-fixed"
  "-IC:\MinGW\lib\gcc\mingw32\4.6.2\include\c++"
  "-IC:\MinGW\lib\gcc\mingw32\4.6.2\include\c++\backward"
  "-IC:\MinGW\lib\gcc\mingw32\4.6.2\include\c++\mingw32"
  "-IC:\MinGW\include" -O0 -g3 -Wall -c -fmessage-length=0 -o

"src\main.o" "..\src\main.cpp" In file included from
C:\MinGW\lib\gcc\mingw32\4.6.2\include\c++/bits/char_traits.h:41, from
C:\MinGW\lib\gcc\mingw32\4.6.2\include\c++/ios:41, from
C:\MinGW\lib\gcc\mingw32\4.6.2\include\c++/ostream:40, from
C:\MinGW\lib\gcc\mingw32\4.6.2\include\c++/iostream:40, from
..\src\main.cpp:4:
C:\MinGW\lib\gcc\mingw32\4.6.2\include\c++/bits/stl_algobase.h: In
function 'OI std::_copy_move_a(_II, _II, _OI)':
C:\MinGW\lib\gcc\mingw32\4.6.2\include\c++/bits/stl_algobase.h:378:
error: expected primary-expression before ')' token

C:\MinGW\lib\gcc\mingw32\4.6.2\include\c++/bits/stl_algobase.h:378:
  error: there are no arguments to '__is_trivial' that depend on a
  template parameter, so a declaration of '__is_trivial' must be
  available
C:\MinGW\lib\gcc\mingw32\4.6.2\include\c++/bits/stl_algobase.h:378:
  note: (if you use '-fpermissive', G++ will accept your code, but
  allowing the use of an undeclared name is deprecated)
C:\MinGW\lib\gcc\mingw32\4.6.2\include\c++/bits/stl_algobase.h:383:
  error: '__simple' cannot appear in a constant-expression
C:\MinGW\lib\gcc\mingw32\4.6.2\include\c++/bits/stl_algobase.h:384:
  error: template argument 2 is invalid
C:\MinGW\lib\gcc\mingw32\4.6.2\include\c++/bits/stl_algobase.h: In
  function 'BI2 std::_copy_move_backward_a(_BI1, _BI1, _BI2)':
  C:\MinGW\lib\gcc\mingw32\4.6.2\include\c++/bits/stl_algobase.h:573:
  error: expected primary-expression before ')' token
C:\MinGW\lib\gcc\mingw32\4.6.2\include\c++/bits/stl_algobase.h:573:
  error: there are no arguments to '__is_trivial' that depend on a
  template parameter, so a declaration of '__is_trivial' must be
  available
C:\MinGW\lib\gcc\mingw32\4.6.2\include\c++/bits/stl_algobase.h:578:
  error: '__simple' cannot appear in a constant-expression
C:\MinGW\lib\gcc\mingw32\4.6.2\include\c++/bits/stl_algobase.h:579:
  error: template argument 2 is invalid g++ -o mapCreator.exe
"src\main.o" -lopengl32 -lglut32 -lglu32 g++: src\main.o: No such file
  or directory
08:10:18 Build Finished (took 1s.31ms)

My code is just some sample code that i have been modifying and is the following:
#include <windows.h>
#include <GL/glut.h>
#include <iostream>
using namespace std;
const int WIDTH = 600;
const int HEIGHT = 480;
void init();
void display();
void loop();
void init() {
    glClearColor( 0.0, 0.0, 0.0, 1.0 ); /* Set the clear color */
}
/* Displays a black clear screen */
void display() {
    glClear( GL_COLOR_BUFFER_BIT ); /* Clear the screen with the clear color */
    glutSwapBuffers(); /* Double buffering */
}

/* The main function */
int main( int argc, char *argv[] ) {
    /* Glut setup function calls */
    glutInit( &argc, argv );
    glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB ); /* Use double buffering and RGB colors */
    glutInitWindowPosition( 100, 100 );
    glutInitWindowSize( WIDTH, HEIGHT );
    glutCreateWindow( argv[0] );
    init();
    glutDisplayFunc( display );  /* Call back display function */
    glutMainLoop(); /* Continue drawing the scene */
    return 0;
}

It currently crashes, however the second that I remove #include it works fine.
Some more information:
it would appear that the .exe is not being created for some reason- i've cleaned the project and i've built it and even restarted eclipse. But it has had no effect.

I have tried running an incredibly basic program but still using iostream,GL/glut.h, and windows.h and even then it still crashes. i would assume this means that it is something wrong with the way it is set up. Code if you really need it:
#include <iostream>
#include <GL/glut.h>
#include <windows.h>
using namespace std;
int main(){

cout<<"hello";
return 0;
}

A: Try including windows.h after GL/glut.h in the first program.

A: *

*Not compiling != "it crashes"

*"it would appear that the .exe is not being created for some reason" - how about a missing .o file? It's literally in the error messages.

*The errors from <iostream> can't be caused by a later inclusion of anything. You stated that you tried every combination, and even showed including <iostream> first. Did that cause the same errors? If so, your compiler installation is broken.


text:
Q: Can't display id in the url and data inserted into database appear blank I want to get get id at the url. It displays the name of id variable instead of displaying the id. I also want eventid, event, venue and username to be inserted into the database, but event and username shows blank but the id increases. Whats the problem ?
<?php
require 'database.php';

$qry = "SELECT b.event_id, b.event, b.venue, u.username, s.name, s.gender, s.email, s.phone FROM bulletin b JOIN unite u JOIN student s WHERE b.event_id = u.event_id AND u.username = s.username ORDER BY event_id";
$result = mysql_query($qry) OR die (mysql_error());
     while ($row = mysql_fetch_row($result)){

             $eventid = $row[0];
                 $event = $row[1];
                 $venue = $row[2];
                 $username = $row[3];
                 $name = $row[4];
                 $gender = $row[5];
                 $email = $row[6];
                 $phone = $row[7];

?>

    <?php echo $row[0]; ?>
    <?php echo $row[1]; ?>
    <?php echo $row[2]; ?>
    <?php echo $row[3]; ?>
    <?php echo $row[4]; ?>
    <?php echo $row[5]; ?>
    <?php echo $row[6]; ?>
    <?php echo $row[7]; ?>

<form method="post" action="attend.php?eventid=<?php echo $row['event_id']; ?>" name="event_form1" target="_top">
              <input type="submit" name="submit" value=" Attend "></form>

<form method="post" action="not_attend.php" name="event_form1" target="_top">
              <input type="submit" name="submit" value=" Not Attend "></form>

             <?php
             } ?>

attend.php
<?php
session_start();
require 'database.php';
$events= $_GET['eventid'];

$qry = "INSERT INTO attend (event_id, name_event, username) VALUES ('$events', '$event', '$username')";

$result = mysql_query($qry) or die (mysql_error());
if ($result){
//echo $result;
    header("location:activity_a.php?success=&eventid=$events");
    exit();
}else {
    die ("Query failed");
}

?>

A: you're not passing any of the variables through the form, right now, you're just setting the submit button. if you plan on using an attend/not attend system then you'll need to re-do the sql to pull the information again for the variables. OR, you'll need to set hidden inputs for each form
change your attend.php to this:
<?php
session_start();
require 'database.php';
$events= $_GET['eventid'];

$qry = "SELECT b.event, u.username FROM bulletin b JOIN unite u JOIN student s WHERE b.event_id = u.event_id AND u.username = s.username ORDER BY event_id";
$result = mysql_query($qry) OR die (mysql_error());
$row = mysql_fetch_array($result)
$event = $row[0];
$username = $row[1];

$nqry = "INSERT INTO attend (event_id, name_event, username) VALUES ('$events', '$event', '$username')";

$nresult = mysql_query($nqry) or die (mysql_error());
if ($nresult){
//echo $nresult;
    header("location:activity_a.php?success=&eventid=$events");
    exit();
} else {
    die ("Query failed");
}

?>

change this accordingly to match with your db.
EDIT:
I accidentally set the same variable and it got overwritten.


text:
Q: How to seek a WPF Storyboard to a specific frame/time offset when not running I wish to seek to a specific time or frame using the ClockController.SeekAlignedToLastTick - however this does not appear to do anything, unless the Storyboard is running.
I dont want to have to 'start' the storyboard, because I only intend the Storyboard to set all dependencyproperty values, and have everything lay-out for that time position, so that I can take a snapshot and advance to the next frame (I could respond to clock events and capture the frame, but then I couldnt guarantee I would get my snapshots at the correct times that I want).
How can I simply advance a WPF storyboard to a specific position without 'running' it?
Thanks!

A: You'll have to at least begin the animation before you can seek into it.  You can however begin then pause right away, and seek.
// sb is a Storyboard
sb.Begin();
sb.Pause();
sb.SeekAlignedToLastTick(sometimespan);


text:
Q: Ceiling and integer +1 option in R software Is there an elegant way to take either the ceiling (if the input is not an integer) or one integer larger (if the input is an integer) for each index of a vector?
Such that, for example, vector x
x = c(0, 4, 5.3333, 6.25)

becomes vector y
1, 5, 6, 7

A: this thinks about the issue in a little different way
y <- floor(x+1)
> y
[1] 1 5 6 7


text:
Q: Array inside of an Array - Java Ok, so I have a 2D array that returns an array.
Object[][] sample = new Object[1][1];
//ok just imagine sample already has an array inside of it

How do I retrive the array within the 2d array?
I have tried to create a new array with the value,
object[] = sample[0][0];

but it just creates an error.
When I print the value of
sample[0][0]

it returns the value:
[[Ljava.lang.Object;@4e25154f
I do not know how to solve this.

A: sample[0][0] returns the object not int. First you need to downcast it and then retrieve integer value
For example :-
CustomObject co = (CustomObject)sample[0][0]; // downcast here

then retrieve the required field from your custom object

A: sample[0][0] is Object not int[], sample[0] can be one dimensional array or any Object, note that arrays are also Object in java.
To print multidimensional array you can use Arrays.deepToString(twoDarray) but this does not work if you have stored specifically Object.
Moreover, [[Ljava.lang.Object;@4e25154f is the result of default toString representation of the Object stored at sample[0][0] which is I think an array. To print array you can use Arrays.toString(int[]).
I guess this is what you are trying to do,
Object[][] obj = new Object[1][1];
obj[0][0] = new int[]{0,1,0,2};
System.out.println(obj);
//To get int[]
int[] arr= (int[]) obj[0][0];//Need to cast to the int[] specifically
//because it's currently stored as an Object
System.out.println(Arrays.toString(arr));

OUTPUT
[[Ljava.lang.Object;@1db9742
[0, 1, 0, 2]


text:
Q: fetching results from database I was trying to echo the row from mysql table inside a DIV but doesn't work, if I put:
     echo $row['test'];

inside while( $row = $result->fetch_assoc() ){
            } it works perfect but I wanted it to show inside a DIV tag. I know I am missing something but don't what it is. Thanks for your help.
                            <?php
            $mydb = new mysqli('localhost', 'root', '', 'test');
            $sql = "SELECT * FROM test  order by id limit 1 ";
            $result = $mydb->query($sql);
            if (!$result) {
                echo $mydb->error;
            }
            while( $row = $result->fetch_assoc() ){
            }
            $mydb->close ();

            ?>

<? echo $row['test'];?>

A: You just need to move your html and php code around. $row exists inside of the while loop and you have it outside the while loop.
<?php
        $mydb = new mysqli('localhost', 'root', '', 'test');
        $sql = "SELECT * FROM test  order by id limit 1 ";
        $result = $mydb->query($sql);
        if (!$result) {
            echo $mydb->error;
        }
        ?>

            <?php while( $row = $result->fetch_assoc() ){ ?>

<?php echo $row['test'];?>

            <?php
            }
            $mydb->close ();
            ?>

This will create a new div for each row retrieved from the database.

A: you are closing connection before fetching
       $mydb->close ();

remove that line and put it in the end of your code.
and put your html code inside the while loop.
 <?php
     $mydb = new mysqli('localhost', 'root', '', 'test');
     $sql = "SELECT * FROM test  order by id limit 1 ";
     $result = $mydb->query($sql);
  if (!$result) {
  echo $mydb->error;
 }
 ?>

 <?php
 while( $row = $result->fetch_assoc() ){
 echo $row['test'];
 }
 $mydb->close ();
 ?>

A: You simply need to put the $row['test'] inside of your while block again, and move your HTML around.
<?php
$mydb = new mysqli('localhost', 'root', '', 'test');
$sql = "SELECT * FROM test  order by id limit 1 ";
$result = $mydb->query($sql);
if (!$result) {
    echo $mydb->error;
}
?>

<?php
while( $row = $result->fetch_assoc() ){
    echo $row['test'];
}
$mydb->close ();
?>


text:
Q: S.M.A.R.T. lifetime hours resetting to zero I use S.M.A.R.T. selftest to test all of my hard drives and SSDs.  I run a short test daily and a long test monthly.
One of my SSD is showing odd behavior in that the lifetime hours seem to reset back to zero.  Is this normal?  Why would it do this?  I have never seen this behavior before.  Is it a cause for concern?
The command I use to initiate the tests (via a script launched by crontab) is:
smartctl --test=short $DISK

Here is a copy of the error log that shows the strange behavior:
   smart self-test log structure revision number 1
   num  test_description    status                  remaining  lifetime(hours)  lba_of_first_error
   # 1  short offline       completed without error       00%       110         -
   # 2  short offline       completed without error       00%        86         -
   # 3  short offline       completed without error       00%        62         -
   # 4  short offline       completed without error       00%        38         -
   # 5  short offline       completed without error       00%        14         -
   # 6  short offline       completed without error       00%      1166         -
   # 7  short offline       completed without error       00%      1142         -
   # 8  short offline       completed without error       00%      1117         -
   # 9  short offline       completed without error       00%      1093         -
   #10  short offline       completed without error       00%      1069         -
   #11  short offline       completed without error       00%      1045         -
   #12  short offline       completed without error       00%      1021         -
   #13  short offline       completed without error       00%       997         -
   #14  short offline       completed without error       00%       973         -
   #15  short offline       completed without error       00%       949         -
   #16  short offline       completed without error       00%       925         -
   #17  short offline       completed without error       00%       901         -
   #18  extended offline    completed without error       00%       897         -
   #19  short offline       completed without error       00%       877         -
   #20  short offline       completed without error       00%       853         -
   #21  short offline       completed without error       00%       829         -

The device is much older than 1166 hours.
Here is some specific info on the device:
smartctl -a $DISK
/dev/disk0
smartctl 7.1 2019-12-30 r5022 [Darwin 18.7.0 x86_64] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Apple SD/SM/TS...E/F/G SSDs
Device Model:     APPLE SSD SM1024F
Firmware Version: UXM8JA1Q
User Capacity:    1,000,555,581,440 bytes [1.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    Solid State Device
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ATA8-ACS T13/1699-D revision 4c
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Sat Nov  7 15:18:13 2020 EST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x00) Offline data collection activity
                    was never started.
                    Auto Offline Data Collection: Disabled.
Self-test execution status:      (   0) The previous self-test routine completed
                    without error or no self-test has ever
                    been run.
Total time to complete Offline
data collection:        (    0) seconds.
Offline data collection
capabilities:            (0x5f) SMART execute Offline immediate.
                    Auto Offline data collection on/off support.
                    Abort Offline collection upon new
                    command.
                    Offline surface scan supported.
                    Self-test supported.
                    No Conveyance Self-test supported.
                    Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                    power-saving mode.
                    Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                    General Purpose Logging supported.
Short self-test routine
recommended polling time:    (   2) minutes.
Extended self-test routine
recommended polling time:    (  10) minutes.

SMART Attributes Data Structure revision number: 40
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x001a   200   200   000    Old_age   Always       -       0
  5 Reallocated_Sector_Ct   0x0033   100   100   000    Pre-fail  Always       -       0
  9 Power_On_Hours          0x0032   093   093   000    Old_age   Always       -       33168
 12 Power_Cycle_Count       0x0032   099   099   000    Old_age   Always       -       876
169 Unknown_Apple_Attrib    0x0013   253   253   010    Pre-fail  Always       -       7105251654656
173 Wear_Leveling_Count     0x0032   190   190   100    Old_age   Always       -       30084956220
174 Host_Reads_MiB          0x0022   099   099   000    Old_age   Always       -       77353745
175 Host_Writes_MiB         0x0022   099   099   000    Old_age   Always       -       58090980
192 Power-Off_Retract_Count 0x0012   099   099   000    Old_age   Always       -       202
194 Temperature_Celsius     0x0022   053   053   000    Old_age   Always       -       47 (Min/Max 23/72)
197 Current_Pending_Sector  0x0022   100   100   000    Old_age   Always       -       0
199 UDMA_CRC_Error_Count    0x001a   200   200   000    Old_age   Always       -       0
240 Unknown_SSD_Attribute   0x0022   100   100   000    Old_age   Always       -       0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Completed without error       00%       110         -
# 2  Short offline       Completed without error       00%        86         -
# 3  Short offline       Completed without error       00%        62         -
# 4  Short offline       Completed without error       00%        38         -
# 5  Short offline       Completed without error       00%        14         -
# 6  Short offline       Completed without error       00%      1166         -
# 7  Short offline       Completed without error       00%      1142         -
# 8  Short offline       Completed without error       00%      1117         -
# 9  Short offline       Completed without error       00%      1093         -
#10  Short offline       Completed without error       00%      1069         -
#11  Short offline       Completed without error       00%      1045         -
#12  Short offline       Completed without error       00%      1021         -
#13  Short offline       Completed without error       00%       997         -
#14  Short offline       Completed without error       00%       973         -
#15  Short offline       Completed without error       00%       949         -
#16  Short offline       Completed without error       00%       925         -
#17  Short offline       Completed without error       00%       901         -
#18  Extended offline    Completed without error       00%       897         -
#19  Short offline       Completed without error       00%       877         -
#20  Short offline       Completed without error       00%       853         -
#21  Short offline       Completed without error       00%       829         -

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

A: How you can see from SMART attribute 9, your SSD lifetime is correcly reported in the full report:
  9 Power_On_Hours      0x0032   093   093   000    Old_age   Always       -       33168

On the other hand, the LifeTime(hours) value reported for self/short/long tests seems to wrap at ~49 days, similar to how SMART error reporting works. From smartctl man page:

This is displayed in the form Dd+HH:MM:SS.msec where D is the number
of days, HH is hours, MM is minutes, SS is seconds and msec is
milliseconds. [Note: this time stamp wraps after 2^32 milliseconds, or
49 days 17 hours 2 minutes and 47.296 seconds.]

This is one of the field where the once consumer related SMART heritage shows, as it is (was?) uncommon for a desktop to have >49 days uptime.

A: Most disks with SMART would use 16 bits to store this value, giving 65,535 hours before reset.
Yours appears to wrap after 1152 hours which is not a convenient power of 2 and is quite odd.
Here's a disk that has just completed its second time around that clock, with 139,895 hours of power-on time, but the SMART self tests wrap at 65,535 hours.
SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of
# 1  Short offline       Completed without error       00%      8823         -
# 2  Short offline       Completed without error       00%     65041         -
# 3  Short offline       Completed without error       00%     63134         -
# 4  Short offline       Completed without error       00%     43108         -
# 5  Short offline       Completed without error       00%     42235         -
# 6  Short offline       Completed without error       00%     30613         -
# 7  Short offline       Completed without error       00%     11535         -
# 8  Short offline       Completed without error       00%      5934         -
# 9  Short offline       Completed without error       00%      2667         -
#10  Short offline       Completed without error       00%      2666         -
#11  Short offline       Completed without error       00%     54241         -
#12  Short offline       Completed without error       00%     47079         -
#13  Short offline       Completed without error       00%     43109         -
#14  Short offline       Completed without error       00%     43071 ... etc

Yes this disk has about 16 years of active power-on time.
9 Power_On_Hours          0x0032   001   001   000    Old_age   Always 139895

I'd suspect your Apple SSD has some extra firmware fudges going on allowing it to report odd times.  It would be interesting to check the SMART values on a non-apple disk, attached by USB perhaps?  Or to check an apple firmware disk in a non-apple system.


text:
Q: Cannot duplicate my form with v-for vuejs help needed I am having a form  where user can put in the input the message he wants to deliver and the sec which stands for how many sec do you want to show it(timeout),
I made an add button which should put in the screen another one form where he can add something different text and sec ...
I put v-for to my form .My code looks like this:
<v-form ref="form" class="container" v-for="(input,i) in inputs" :key="i" lazy-validation>
  <v-container class="container">
    <v-layout>
      <v-flex lg12 class="container">
        <v-text-field v-model="inputs.text" label="Text" placeholder="" required></v-text-field>
      </v-flex>

      <v-flex lg3 class="container">
        <v-text-field v-model="inputs.sec" label="Millisec" required type="number"></v-text-field>
      </v-flex>

      <v-flex lg12 class="container">
        <v-btn color="black" @click="addLines(i)" v-show="i == inputs.length-1">ADD</v-btn>
      </v-flex>
      <v-flex lg6 class="container">
        <v-btn color="dark" @click="onSubmit">Submit</v-btn>
      </v-flex>
    </v-layout>
  </v-container>
</v-form>

data what i am having:
data() {
    return {
      inputs: [
        {
          text: "",
          sec: 0
        }
      ]

i decleared that addLines(i) method but  but im not sure how should i duplicate the form thats when i  need your help, i need the form to not be the same form so if i write to one form do not show it in the duplicate one.
addLines(i) {
      this.inputs.push({ text: "", sec: 0 });
    },

when i run this the program says
75:14  error  'i' is defined but never used  no-unused-vars

button is not showing as well:(

A: This is es-lint error. To solve change this line like this (remove the unused i)
addLines() {
  this.inputs.push({ text: "", sec: 0 });
}

and change your template to:
<v-form
  ref="form"
  class="container"
  v-for="(input,i) in inputs"
  :key="i"
  lazy-validation
>
  <v-container class="container">
    <v-layout>
      <v-flex lg12 class="container">
        <v-text-field
          v-model="input.text"
          label="Text"
          placeholder=""
          required
        ></v-text-field>
      </v-flex>

      <v-flex lg3 class="container">
        <v-text-field
          v-model="input.sec"
          label="Millisec"
          required
          type="number"
        ></v-text-field>
      </v-flex>

      <v-flex lg12 class="container">
        <v-btn color="black" @click="addLines(i)" v-show="i == inputs.length-1"
          >ADD</v-btn
        >
      </v-flex>
      <v-flex lg6 class="container">
        <v-btn color="dark" @click="onSubmit">Submit</v-btn>
      </v-flex>
    </v-layout>
  </v-container>
</v-form>


text:
Q: Pin with regex from codewars Regex validate PIN code "Hello world" i am trying to solve a problem from codewars and i am really struggling with regex. First of all i want to say sorry if my question is not properly written or maybe (dumm question).So to the point

the pin codes cannot contain anything but exactly 4 digits or exactly 6 digit and not symbols like (-)

  if ((pin.match(/^[0-9]+$/) != null && pin.length === 4) || pin.length === 6)
    return true;
  else return false;
}
console.log(validatePIN("-12345"));// this should be false.It is true because it contains the "-" and length===6