text:
Q: Cannot hide a UIButton I have the following code:
visitSite.hidden = YES;

For some reason, when I click a UIButton and call this piece of code, the visitSite button does not hide.
The code is within this block:
-(IBAction)welcomeButtonPressed:(id)sender {
  [UIButton beginAnimations:@"welcomeAnimation" context:NULL];
  [UIButton setAnimationDuration:1.5];
  [UIButton SetAnimationDidStopSelector:@selector(nowHideThisSiteButton:finished:context:)];
  [UIButton setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
  ((UIView *)sender).hidden = YES;
  [UIButton commitAnimations];
}

and the stop selector below:
-(void)nowHideThisSiteButton:(NSString *)animationID finished:(BOOL *)finished context:(void *)context {
  visitSite.hidden = YES;
}

I've also tried [visitSite setHidden:YES]; and that fails as well. ALSO I've noticed that the setAnimationDidStopSelector does not get called at all.
Also, visitSite (when NSLogged) equals:
<UIButton: 0x1290f0; frame = (0 0; 320 460); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x1290f0>>

visitSite.hidden (when NSLogged) equals: NULL
Any more ideas? :(

A: There are a few mistakes in your code.

*

*The hidden property of UIView is NOT animatable.  When this animation block runs, your button will vanish, but it will not fade/animate.  The appropriate way to fade out a UIView is to animate its alpha property from 1.0 to 0.0 like this:
myView.alpha = 1.0;
[UIView beginAnimations:@"Fade" context:NULL];
myView.alpha = 0.0;
[UIView commitAnimations];
Here is a list of animatable UIView properties

*setAnimationDidStopSelector does not get called because you have not set the animation delegate.  You have properly specified a didStopSelector, which tells the UIView class what message to send when animation is complete.  However, you haven't specified what to send this message to.  The animation block has no idea about your object.  Just add this line inside the animation block:
[UIView setAnimationDelegate:self];
(Replace self with whatever object you want to receive the didStopSelector)

*As others has stated, your button is nil because it hasn't been hooked up properly in Interface Builder.  In your .h file, you should have @property (nonatomic, retain) IBOutlet UIButton * visitSite;.  Then in Interface Builder, click your controller, switch to the Connections display, and drag the open circle thing over to your button.  That should do it. See the Interface Builder help guide for more info on that.

A: you could try [visitSite removeFromSuperview];

A: Could it be that you wrote:
visitWebsite.hidden = YES;

instead of:
visitSite.hidden = YES;

?
What about setting your buttons alpha to 0, does that work?

A: Have you double-checked the bindings in Interface Builder? Did you remember to connect the button to the controller?
Try putting a breakpoint on visitSite.hidden = YES; and make sure that visitSite isn't null or set to something unexpected.

A: Your animationDidStopSelector definition is incorrectly defining the finished: argument type as a pointer to a boolean (BOOL *) rather than just a boolean (BOOL). I believe this is your problem.


text:
Q: Battery Backup with Monitoring, Low Voltage Cut Off with Hysteresis and Auto Power Recovery As an overview of what I am trying to achieve. I want to create a circuit that will trickle charge 8 x NiCd batteries (2200mAH) so that in the event of an "occasional" power loss my 5v circuit is provided power for around 12 hours (duration tested @ 16 hours on fully charged batteries). If the voltage of the NiCd batteries becomes too low to support the circuit then the power to the ESP32 is cut via the MOSFET. When the AC power is restored the batteries start to recharge and at a suitable voltage the power to the ESP32 is also restored. The ESP32 also monitors the NiCd batteries for Temperature and Voltage only for reporting purposes at the moment.
I testing everything on the breadboard with the exception of the Battery Monitoring (LM35's and Voltage Divider), everything seemed to work perfectly. Power to the ESP32 was cut when the battery fell to 8.81 volts, then after applying the AC powerpack back to the circuit the battery would recover to 8.95 volts and switch the ESP32 back on which would boot correctly and control my device again. Everything seemed good :) - Refer to Picture 1.

However, adding monitoring to the NiCd batteries (LM35 and Voltage Divider) gave me some strange results when the battery hit the low voltage condition and the Q1 MOSFET turned off. While I did not hang around before removing power I believe D1, R8, and D3 started to get very hot. At this stage I'm not sure if the ESP32 was damaged also.
I think the issue is regarding the grounding of the battery monitoring components?  What I think I need to do is take the grounding from the Drain side of the MOSFET so that when the battery is in a low voltage condition the battery monitoring is also disconnected. – Refer to Picture 2

Does anyone see any issues or could offer me any advice?
Note: I do intend to review the type of charging that I am doing, maybe using one of the dedicated IC's (i.e. MAX713) but for now I would like to get the basics working. I assume currently this circuit would take several weeks to recharge the batteries…

As an update this has worked perfectly (referencing the MOSFET to drive the GND feed) for a number of weeks now in bench testing with figure 2. When the battery voltage drops the ESP32 (a 32bit micro-controller similar to arduino) switches off and on battery recovery it switches back on. I have played around with the hysteresis values though in figure 2 and the Anode side of D3 now connects to the Anode side of D1 (diagram error).
The next step is to have the ESP32 monitor the level of the batteries and switch on and off the charging current as necessary just to save trickle charging all the time - why not since I have spare GPIO ports and the code is simple.
I need to ask another question though because I really am stuck now trying to use 3.3v logic to break the charge feed into the battery while allowing it still to power the circuit.
I have simplified the circuit below in the hope someone can tell me what I should really be doing with Q1 and Q2 before I subject anymore transistors to the magic smoke.
Thanks in advance
[3

redpajama_set_name: RedPajamaStackExchange


text:
Q: Spinner custom layout keep default layout Hi i try to set a custom layout on a spinner. My layout is added but the default spinner layout is still around my custom layout like this :
http://i.imgur.com/YjGZo7x.png?1
I initialaze my spinner in the onCreate method of my acitvity like that :
    Spinner s = (Spinner)findViewById(R.id.s_civilty);
    ArrayAdapter <String> adapter =
            new ArrayAdapter<String> (this, R.layout.spinner, new String[] {"Mademoiselle","Madame","Monsieur"});
    adapter.setDropDownViewResource(R.layout.spinner_dropdown);
    s.setAdapter(adapter);

And the spinner.xml
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/tv_parent"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/blue1"
    android:drawableRight="@drawable/ic_arrow_down_simple"
    android:gravity="center"
    android:paddingLeft="5dp"
    android:textColor="@drawable/btn_default"
    android:textSize="25sp" />

By the way, the dropdown works perfectly fine.
I already did that earlier in the same app, exactly in the same way, and it works as exceped, but not here.
Thanks in advance for your help.

A: Here is the sample code, you can refer to this and see how the custom layout is inflated and where you are doing wrong. Hope it helps:
public class Style extends Activity{
    String[] items = { "bangladesh", "bangla", "bd", "australia", "japan",
            "china", "indiaA", "indiaC" };
    String[] images = { "R.drawable.ic_launcher", "R.drawable.ic_launcher",
            "R.drawable.ic_launcher", "R.drawable.ic_launcher",
            "R.drawable.ic_launcher", "R.drawable.ic_launcher",
            "R.drawable.ic_launcher","R.drawable.ic_launcher" };
    Spinner spin;
    TextView txt1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.npicker);
        initcomponents();
        actionlistener();
        CustomAdapter spinneradapter = new CustomAdapter(this,
                android.R.layout.simple_spinner_item, items,images);
        spinneradapter
                .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        spin.setAdapter(spinneradapter);

    }

    private void actionlistener() {

    }

    private void initcomponents() {
        spin = (Spinner) findViewById(R.id.npicker_spnr);

    }

    public class CustomAdapter extends ArrayAdapter<String> {
        String[] items,images;
        Context context;
        int rid;
        TextView textview;
        ImageView imageview;
        LayoutInflater inflater;

        public CustomAdapter(Context context, int rid, String[] items,String[] images) {
            super(context, rid, items);
            this.items = items;
            this.context = context;
            this.rid = rid;
            this.images=images;

            inflater = (LayoutInflater) context
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        }

        public int getCount() {

            return items.length;
        }

        @Override
        public View getDropDownView(int position, View convertView, ViewGroup parent) {
            return getCustomView(position, convertView, parent);
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            return getCustomView(position, convertView, parent);
        }

        public View getCustomView(int position, View convertview, ViewGroup parent) {

            if (convertview == null) {
                convertview = inflater.inflate(R.layout.spinneritems, parent, false);
                textview = (TextView) convertview
                        .findViewById(R.id.spinneritem_txt);
                imageview = (ImageView) convertview
                        .findViewById(R.id.spinneritem_iv);
                imageview.setBackgroundResource(R.drawable.ic_launcher);
                textview.setText(items[position]);

            }

            return convertview;
        }

    }

}

Here is the spinner item xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" >

    <ImageView
        android:id="@+id/spinneritem_iv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/ic_launcher" />

    <TextView
        android:id="@+id/spinneritem_txt"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:text="Hello i am android logo" />

</LinearLayout>

A: Please check the below code which i used to change the background of spinner may be help for you
selector.xml this xml can be used as spinner background
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:drawable="@drawable/text_filed_login"/>
</selector>

below is the snippet for spinner
<Spinner
                android:id="@+id/spinner1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/addSpinner"
                android:layout_marginLeft="5dip"
                android:background="@drawable/groupselector"
                android:paddingBottom="2dp"
                android:paddingLeft="10dp"
                android:paddingTop="2dp"
                android:text="Select a group"
                android:textColor="#a5a5a5"
                android:textSize="13dp"
                android:typeface="sans" />


text:
Q: Scala: What does zipped produce and why can it be mapped as a pair? In an earlier question about zipWith, @Martin Odersky suggested that instead of something like
 foo zipWith(_ + _) bar

(where foo and bar are Seq's) that the following is better (and actually works in Scala).
(foo, bar).zipped map (_ + _)

My question is how does map know that its argument (which superficially would seem to be a pair) should be split into its two elements?
The following actually runs in a worksheet.
val list1 = List(1, 2, 3, 4)                    //> list1  : List[Int] = List(1, 2, 3, 4)
val list2 = List(5, 6, 7, 8)                    //> list2  : List[Int] = List(5, 6, 7, 8)
val zippedResult = (list1, list2).zipped        //> list3  : scala.runtime.Tuple2Zipped[Int,List[Int],Int,List[Int]] = scala.run
                                              //| time.Tuple2Zipped@f4bf78da
zippedResult.mkString(", ")                     //> res4: String = (1,5), (2,6), (3,7), (4,8)
zippedResult map (_ + _)                        //> res5: List[Int] = List(6, 8, 10, 12)

I see that zippedResult in fact has 4 type parameters and is not just a list of pairs.
val list3 = List((1, 5), (2, 6), (3, 7), (4, 8))
                                              //> list3a  : List[(Int, Int)] = List((1,5), (2,6), (3,7), (4,8))
list3 == zippedResult                           //> res6: Boolean = false

And I can't write
list3 map(_ +_ )

So what is the Tuple2Zipped type that it can supply two parameters to the map function? And is zipped the only way to create instances of it?

A: It's runtime.Tuple2Zipped. You can create an instance manually like this:
val zipped = new Tuple2Zipped(Seq(1, 2), Seq(3, 4))

Here is the source of map method.
Method map is declared like this (simplified):
def map[B](f: (El1, El2) => B): Seq[B]

Tuple2Zipped is not an descendant of any scala collection type, so its map method has nothing with map method of regular scala collections.


text:
Q: Change html code on server side asp.net I want to change some string located in html file when it loads. For example, i have a html file:

<title>MyTitle</title>

Some Text

I use Page_Load method in code-behind file:
protected void Page_Load(object sender, EventArgs e)
{
/*Insert necessary snippet of code*/
}

What code should i use to change string "TargerInfo" to "OtherString" ?
[EDIT]
Sorry, that I have forgot to mention
I can add any info to html page only in code-behind class, because this page isn't  generated by me.
I think i should use something like this:
1) load html file
2) find my string
3) replace it
4) send html file
There is an aspx page, but i add only some part of code and other code is added by VS

A: Unless I'm missing something (because this seems like a bit of an ASP.NET 101), you have several options...
Create a variable in the code-behind and then use that...
protected string _newText = "";
protected void Page_Load(object sender, EventArgs e)
{
   _newText = "OtherString";
}

And then in the ASPX...
var myString = "<%=_newText%>";

Otherwise you can use the <asp:Literal> control
UPDATE
After an extensive chat with @andDaviD it turns out that the javascript is in a Master page held in SharePoint Foundation.
The Master page is being referenced in his Content page via the DynamicMasterPageFile attribute in the <%@ Page directive, and that is why he said he is able to update some part of the code, but not others.
I am still unsure as to whether it is possible for the Master page to be modified (either by himself or an administrator), that is something he needs to find out from the people in charge at his company.  But I believe the adding of a property or method to the Master Page to provide what he needs is the only sensible option.

A: You could use inline aspx code tags:

in codebehind:
protected String getTargetInfo()
{
    return "OtherString";
}

A: You could use a literal:
protected void Page_Load(object sender, EventArgs e)
{
     literal.Text = string.Format("var myString = \"{0}\"", targetInfoValue);
}

Markup:

<title>MyTitle</title>

Some Text

A: You can have it in a hiddenfield in asp.net and change the hidden field in code behind.

A: in your code behind:
public string otherString;

otherString = "some text"  //update the string with the value oyu want.

in aspx page put this line in any place you want to see the otherString.
<%=otherString%>


text:
Q: Python docstrings to GitHub README.md How do I transcode Python documentation strings to a GitHub readme.md file?
Even though it seems like something everyone does, I cannot seem to get a decent solution and I am assuming it should be easy, so it seems unlikely folks are going throw two converters…
What I have tried
pydoc  Actually simple. The output of pydoc is manpages (groff format for Unix systems). Which is a dead end as man to md is not a thing. Via HTML, pydoc3 -w + pandoc, utterly munges the docstrings to bits.
Custom code There seems to be lots of short custom code, but for the few I tried the output does not seem to be as good as that pydoc, which has a summary, adds inherited methods and lists some attributes.
mkdocs. It was suggested somewhere. It just pollutes my folder as it is a misleading name as is a not docstrings > md converter, but a md > html.
Sphinx + Pandoc. After fixing an UTF-8 issue, I gave up on Sphinx as I have a single .py script to convert and the autodoc setting of the quickstart did not parse my script. I tried in Python to import sphinx.ext.autodoc, but TBH the documentation was too long and I gave up.
NB
There is a year-old unanswered Stack Overflow question on the topic, but I hope that by giving a lot more detail I will get an answer.

A: I have found some other options for doing this:
https://github.com/coldfix/doc2md

Little convenience tool to extract docstrings from a module or class and convert them to GitHub Flavoured Markdown. Its purpose is to quickly generate README.md files for small projects.

https://github.com/freeman-lab/myopts

This module provides a command line tool for parsing a Python file and generating nice looking markdown with your function definitions. It's extremely opinionated and rigid! But also extremely easy to use.

A: The other answers are great. But I thought I (the OP) ought to share what I do these days (a year or two after the question).
I use Sphinx and its Markdown extension. Do the following:
TL;DR: See Gist snippet.
Sphinx-markdown-builder
You need sphinx-markdown-builder python module.
 pip install sphinx sphinx-markdown-builder;

Run Sphinx
Not the autodoc, the apidoc!
sphinx-apidoc -o Sphinx-docs . sphinx-apidoc --full -A 'Matteo Ferla'; cd Sphinx-docs;

Configuration
Fix the conf.py file, by following the following or just lazily copy paste the echo command below.
Manual
First uncomment the lines. These are otherwise commented out.
import os
import sys
sys.path.insert(0, os.path.abspath('../'))

Note the change to ../
One weirdness is that the magic methods get ignored. To override this, add this anywhere:
def skip(app, what, name, obj, would_skip, options):
    if name in ( '__init__',):
        return False
    return would_skip
def setup(app):
    app.connect('autodoc-skip-member', skip)

A thing to note: The docstrings ought to be written in restructuredtext (RST). If they are in Markdown, you need to add a mod - see this. The two are similar, but different. For example, a single backquote is required for <code> in Markdown, while two are for RST. If in doubt, several blog posts discuss the merits of RST documentation over Markdown.
Typehinting
RST typehints (:type variable: List) are obsolete as proper typehinting def foo(variable: Optional[List[int]]=None) -> Dict[str,int]: has been introduced since 3.6. To make these work:
 pip install sphinx-autodoc-typehints

And add 'sphinx_autodoc_typehints' at the end of the extensions list. Note the package has hyphens while the module has underscores.
TL;DR
Copy paste this:
echo " import os
import sys
sys.path.insert(0,os.path.abspath('../'))
def skip(app, what, name, obj,would_skip, options):
    if name in ( '__init__',):
        return False
    return would_skip
def setup(app):
    app.connect('autodoc-skip-member', skip)
extensions.append('sphinx_autodoc_typehints')
 " >> conf.py;

Showtime
Then it is showtime.
make markdown;

Copy the files and clean however you fancy.
mv _build/markdown/* ../; rm -r Sphinx-docs;

Repeat Apidoc for new files
It should be noted that when new files are added, the apidoc command needs to be repeated. Nevertheless, I highly recommend generating documentation midway as I often realise I am doing something wrong when I see the docs.
But briefly, apidoc will add for each file a automodule command, so this could be added manually or even expanded:
.. automodule:: my_module
   :members:
   :inherited-members:
   :undoc-members:
   :show-inheritance:

There's also the commands autoclass, autofunction, autoexception, for specific cases. In the case of autoclass if the class inherits many base classes in separate files to rightfully keep filesizes under 250 lines, the property :inherited-members: is a nice addition to this —thus avoiding having to describe the private base classes.
Read the docs: the common way
It should be said that there's a trend to not have documentation in GitHub but in Read the docs. My guess is because:

*

*avoids this docstrings-to-markdown business

*some users get confused by GitHub

*looks nicer

*other do it

Despite this, it requires some set up due to the module requirements. In another SO post is a long list of pitfalls and tricks —briefly IMO users, such as myself, make three mistakes:

*

*missing modules or the target module

*forget to hard refresh the browser

*enabling the sphinx.ext.autodoc extension

However, if one has written markdown documentation in GitHub these can be imported too. Formerly, the m2r2 (a fix of the deprecated m2r) was a good solution, but the divergence of its dependency mistune, which would require it to be frozen at version 0.8.4 as opposed to being at 2.0.0, which breaks other sphinx modules, therefore a new split works best and better: sphinx-mdinclude.
This is pip installed as sphinx-mdinclude but included as sphinx_mdinclude and allows md files to be read alongside rst files.
So a simple workaround in the docs/source/config.py file is to copy the files from the project root to the folder of config.py One issue is that links may need to be checked, especially if files moved around or are relative to the base URL (slash prefixed), eg. [Foo](/md_docs/foo).

A: I have a little bit of code that I use to generate an index file from a project. It's not exactly what you're looking for, but with a little wiggle you could add an if statement for py files (where I only have html and png) and grab the doc = "your DocStrings."...
https://gist.github.com/Krewn/6e9acdadddb4bf2a56c0
# WARNING RUNNING THIS FILE WILL OVERIDE EXISTING readme.md FILE IN CWD

import os

class indexer:
    path = "~"
    username = "" # !!! Enter your github username in the provided quotes.
    site = "http://"+username+".github.io"
    proj = ""     # !!! Enter your repository name in provided quotes.
    prod = []
    loc=[]

    def __init__(self,p):
        self.path=p
    def fprep(self,name):
        name.replace(".","")
        name.replace("\\","/")
        return(name)
    def refPrep(self):
        ref = self.site+"/"+self.proj
        for qw in self.loc:
            ref+="/"+qw
        return(ref)
    def HtmlFrek(self,adir):
        self.loc.append(adir)
        os.chdir(adir)
        pys = [f for f in os.listdir('.') if os.path.isfile(f) and f.split(".")[len(f.split("."))-1]=="py"]
        for i in pys:
            Open the file i get the __doc__ string and append it to ret
        for k in folders:
            if(k.__contains__(".")):
                continue
            ret+=self.HtmlFrek(k)
        os.chdir("..")
        del self.loc[len(self.loc)-1]
        return(ret)

    def HtmlProd(self):
        ret = ""
        pys = [f for f in os.listdir('.') if os.path.isfile(f) and f.split(".")[len(f.split("."))-1]=="py"]
        for i in pys:
            Open the file i get the __doc__ string and append it to ret
        folders = [f for f in os.listdir(".") if not os.path.isfile(f)]
        for k in folders:
            if(k.__contains__(".")):
                continue
            ret+=self.HtmlFrek(k)
        self.prod = ret
        return(ret)

i = indexer(".")
q=i.HtmlProd()
#print i.prod

w = open("readme.md","w")
w.write(q)
w.close()

A: I've found pydoc-markdown quite easy to use. The first command will install the library and the second one will create a README from your module named MY_MODULE:
pip install pydoc-markdown
pydoc-markdown -m MY_MODULE -I $(pwd) > README.md


text:
Q: Windows Server AppFabric Custom Configuration Provider Issues UPDATE
Here is the link to the custom provider code - http://www.gurpreetsohal.com/configurationprovider.zip
I have managed to use reflector to step further into the Microsoft AppFabric dlls and I have found the place where the exception occurs.

The exception is caused on the WaitForStatus method - The service is definitely in the starting state, it just never reaches the started state within the timeout value.
The default timeout value is 60 seconds. I have increased this to 10 minutes, same problem.

The scenario is:
1)Working in a workgroup environment
This means that AppFabric will not allow a SQL Server source to store the configuration file, so you are left to a fileshare or creating a custom configuration provider.
I chose to do the latter and wrote up an implementation using the ICustomProvider interface provided, using blobstorage.
This all seems to work fine, the configuration can be created/modified deleted correctly - the configuration wizard works fine.
The problem is when I run the Start-CacheCluster in powershell, the AppFabric Caching Service hangs at the state of Starting.
Powershell then throws an error:

However, if I manually start the service from services.msc - it works fine no problem, pretty much instantly.
To make sure that this isn't an environment issue, I have configured AppFabric to use the fileshare for the configuration and it has worked fine without any problem.
I then started looking to see what this powershell command actually does and decompiled the dll.
It got me as far as this:

currentAdmin.StartCluster(new ProgressDelegate(this, (IntPtr) this.StartClusterDelegate), new WriteErrorDelegate(this, (IntPtr) this.WriteErrorRecord), this.QuorumTimeout, this.HostTimeout);
I cant step in any further and am stuck.
I have tried both Azure Tables and Blob Storage to try and get this to work
Help!!!!!

A: Since it uses a non standard port, I would make sure this port is open on all the nodes in the cluster. A timeout exception could be a firewall blocking the non standard port.
I looked at the screenshot of your decompiled code, and it looks like it is just throwing the timeout, like in the error.
Thanks,


text:
Q: saving the login name as current user identity in asp.net So I'm making a asp.net login. I want the login name that people use to match an id in my SQL database. So that I can retrieve their information. But currently when I use the code below, from which I get the name of the computer I am currently on. However I would like the user Identity to be what they write in the username textbox at the login screen.
If HttpContext.Current.User.Identity.IsAuthenticated Then
    Dim userName As String = HttpContext.Current.User.Identity.Name
    Response.Write(userName)
End If

So I looked for it on net and I think it might have something to do with my web.config file. As I'm totally new to asp.net I wouldn't know. However here's a part of my Web.config file.
<authentication mode="Forms">
    <forms name=".ASPXFORMSAUTH"
        loginUrl="Login.aspx"
        protection="All"
        timeout="30"
        path="/" />
</authentication>
<authorization>
    <deny users="?" />
</authorization>

so any ideas? :)

A: set login name using
FormsAuthentication.RedirectFromLoginPage(UserName.Text, RememberMe.Checked);

and retrive using
User.Identity.Name

reference links, bytes.com and asp.net tutorial

A: Use the ViewStates to maintain the Login state of the user.


text:
Q: How can a PMML reader interpret the predict value's type? Hi I have a PMML generated for a logistic regression model using R as follows. Only the first part of the pmml is shown here.
<?xml version="1.0"?>
<PMML version="4.2" xmlns="http://www.dmg.org/PMML-4_2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.dmg.org/PMML-4_2 http://www.dmg.org/v4-2/pmml-4-2.xsd">
 <Header copyright="Copyright (c) 2015 Upeksha" description="Generalized Linear Regression Model">
  <Extension name="user" value="Upeksha" extender="Rattle/PMML"/>
  <Application name="Rattle/PMML" version="1.4"/>
  <Timestamp>2015-12-02 08:41:27</Timestamp>
 </Header>
 <DataDictionary numberOfFields="11">
  <DataField name="ResponseAccountName" optype="continuous" dataType="double"/>
  <DataField name="RegionCat" optype="categorical" dataType="string">
   <Value value="ROW"/>
   <Value value="EUROPE"/>
   <Value value="NAM"/>
  </DataField>
  <DataField name="TitleCat" optype="categorical" dataType="string">
   <Value value="1"/>
   <Value value="2"/>
   <Value value="3"/>
   <Value value="4"/>
  </DataField>
  <DataField name="RLMaxTitle" optype="categorical" dataType="string">
   <Value value="1"/>
   <Value value="2"/>
   <Value value="3"/>
   <Value value="4"/>
  </DataField>
  <DataField name="Act1_rate" optype="continuous" dataType="double"/>
  <DataField name="Act2_rate" optype="continuous" dataType="double"/>
  <DataField name="Act3_rate" optype="continuous" dataType="double"/>
  <DataField name="Act4_rate" optype="continuous" dataType="double"/>
  <DataField name="Act5_rate" optype="continuous" dataType="double"/>
  <DataField name="Act6_rate" optype="continuous" dataType="double"/>
  <DataField name="AccntAct_rate" optype="continuous" dataType="double"/>
 </DataDictionary>
 <GeneralRegressionModel modelName="Logistic_Regression" modelType="generalizedLinear" functionName="regression" algorithmName="glm" distribution="binomial" linkFunction="logit">
  <MiningSchema>
   <MiningField name="ResponseAccountName" usageType="predicted"/>
   <MiningField name="RegionCat" usageType="active"/>
   <MiningField name="TitleCat" usageType="active"/>
   <MiningField name="RLMaxTitle" usageType="active"/>
   <MiningField name="Act1_rate" usageType="active"/>
   <MiningField name="Act2_rate" usageType="active"/>
   <MiningField name="Act3_rate" usageType="active"/>
   <MiningField name="Act4_rate" usageType="active"/>
   <MiningField name="Act5_rate" usageType="active"/>
   <MiningField name="Act6_rate" usageType="active"/>
   <MiningField name="AccntAct_rate" usageType="active"/>
  </MiningSchema>
  <Output>
   <OutputField name="Predicted_ResponseAccountName" feature="predictedValue"/>
  </Output>

The OutputField dataType is not present here. How could a PMMl reader interpret it's type if so?
I checked the PMML spec and it says that dataType for OutputField is not always required. I am writing a pmml reader and I need to know how the interpretation is done for a pmml like this.

A: The dataType and optype attributes are optional for the OutputField element, but any sane PMML producer should specify them anyway, as that would make the life much easier for PMML consumers.
If the dataType attribute is missing, then you can infer it based on the feature attribute of the OutputField element. In the current case, the value of the feature attribute is set to predictedValue, which means that the data type and the operational type will be "copied" from the DataField element that represents the target field of this model. Here, the target field (aka the predicted field) is called "ResponseAccountName", which means that the value of this OutputField element will be continuous double.


text:
Q: Issue in deleting data from core data through table view iPhone In cellForRowAtIndexPath: method I have implemented gesture recognizer for long press,
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

if (tableView == favouritesTable) {
    cellValue = [licensePlateArray objectAtIndex:indexPath.row];
} else { // handle search results table view
    cellValue = [filteredListItems objectAtIndex:indexPath.row];
}

static NSString *CellIdentifier = @"vlCell";

VehicleListCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if (cell == nil) {

    NSLog(@"Cell Created");

    NSArray *nibObjects = [[NSBundle mainBundle] loadNibNamed:@"VehicleListCell" owner:nil options:nil];

    for (id currentObject in nibObjects) {
        if ([currentObject isKindOfClass:[VehicleListCell class]]) {
            cell = (VehicleListCell *)currentObject;
        }
    }

}

UILongPressGestureRecognizer *pressRecongnizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(tableCellPressed:)];

toDeleteObject = [results objectAtIndex:indexPath.row];
pressRecongnizer.view.tag = indexPath.row;

pressRecongnizer.minimumPressDuration = 0.5f;
[cell addGestureRecognizer:pressRecongnizer];
[pressRecongnizer release];

cell.textLabel.font = [UIFont systemFontOfSize:10];

Favouritesdata *favdata = [results objectAtIndex:indexPath.row];

[[cell ignition] setImage:[UIImage imageNamed:@"ignition.png"]];
[[cell direction] setImage:[UIImage imageNamed:@"south.png"]];

cell.licPlate.text = [favdata licenseplate];

NSLog(@"cellvalue for cellforRow: %@", cell.licPlate.text);

return cell;}

And in tableCellPressed
- (void)tableCellPressed:(UILongPressGestureRecognizer *)recognizer{
if (recognizer.state != UIGestureRecognizerStateBegan) {
    return;
}

VehicleListCell* cell = (VehicleListCell *)[recognizer view];

cellValueForLongPress = cell.licPlate.text;

NSLog(@"cell value: %@", cellValueForLongPress);

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:nil delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles: nil] ;

alert.tag = recognizer.view.tag;

[alert addButtonWithTitle:@"Remove from Favourites"];
[alert addButtonWithTitle:@"Show on Map"];

[alert show];}

And in alertView:
-(void)alertView:(UIAlertView *)alert clickedButtonAtIndex:(NSInteger)buttonIndex {
NSString *title = [alert buttonTitleAtIndex:buttonIndex];

if([title isEqualToString:@"Remove from Favourites"])
{
    NSLog(@"cellValueForLongPress: %@", cellValueForLongPress);

    [results removeObjectAtIndex:alert.tag];

    [context deleteObject:toDeleteObject];

    NSLog(@"alert.tag:::: %d", alert.tag);

}
else if([title isEqualToString:@"Show on Map"])
{
    NSLog(@"Go to MapView");

    Maps *detailViewFromLabel = [Maps alloc];

    [self.view addSubview:detailViewFromLabel.view];

}

NSError *error;

if (![context save:&error]) {
    NSLog(@"Error Occured");
}

[favouritesTable reloadData];}

Through this code entry from the core data gets deleted but the issue is that it only deletes the entry at index:0 and not the entry which is selected from the table.
How can I resolve this issue ?

A: How about having your uitableviewcell subclass implement the gesture recognizer and this can also hold a reference to your data object. This would be a lot neater.
Assuming your view controller is holding your data model (bad idea really), you could then communicate back using either a delegate or notification pattern.
Here is something off the top of my head
@interface VehicleListCell
@property (nonatomic, retain) VehicleClass *vehicle;
@end

@implementation VehicleListCell

@synthesize vehicle;

- (id) initWithStyle:(UITableViewCellStyle) style reuseIdentifier:(NSString*)identifier {
    self = [super initWithStyle:style reuseIdentifier:identifier];
    if (self) {
       //add your gesture recogniser to self using the same code you have
    }
    return self;
}

- (void)tableCellPressed:(UILongPressGestureRecognizer *)recognizer{
if (recognizer.state != UIGestureRecognizerStateBegan) {
    return;
}
[NSNotificationCenter postNotificationName: @"VehicleDeleted" withObject: self userInfo: [NSDictionary dictionaryWithObject: vehicle andKey: @"vehicle"]]
}
@end

A: You're doing it backwards anyway, but here is your problem:
pressRecongnizer.view.tag = indexPath.row; // view is nil at this point
pressRecongnizer.minimumPressDuration = 0.5f;
[cell addGestureRecognizer:pressRecongnizer]; // now we have a view!
[pressRecongnizer release];

You set the tag on the view of pressRecogniser before you set the view itself. So you are setting a tag to nothing, ending up with zero as the tag and this is the row you keep deleting.
Add a gesture recogniser to your cell when it is first created (if cell==nil) then in your action method get hold of the index path of the cell (UITableView has a method for this, indexPathForCell:), and use that to determine which element you have selected and which element should be deleted.


text:
Q: Cannot import anymore PouchDB in my project I am working on a project and recently PouchDB decided to stop working. I can't compile it anymore in my ts project. I tried:
import * as PouchDB from 'pouchdb';

export default PouchDB.defaults({
  prefix: `http://admin:password@localhost:5984/`
})

but I get
server/src/database.ts(3,24): error TS2339: Property 'defaults' does not exist on type 'typeof 'pouchdb''.

If I try :
import {PouchDB} from 'pouchdb';

export default PouchDB.defaults({
  prefix: `http://admin:password@localhost:5984/`
} as any)

I get
server/src/database.ts(1,9): error TS2305: Module ''pouchdb'' has no exported member 'PouchDB'.

If I try :
import PouchDB from 'pouchdb';

export default PouchDB.defaults({
  prefix: `http://admin:password@localhost:5984/`
} as any)

Then it will compile but I get this when I run it:
export default PouchDB.defaults({
                      ^
TypeError: Cannot read property 'defaults' of undefined
    at Object.<anonymous> ...

If I try :
 const PouchDB = require('pouchdb');

I lose every typing, so it becomes a any type which i obv do not want
❯ npm ls pouchdb @types/pouchdb
compactd@0.0.0 /mnt/c/Users/Vincent/Documents/GitHub/compactd
├── @types/pouchdb@6.3.0
└── pouchdb@6.3.4

The only thing I did before it stopped working was cleaning node_modules and reinstalling using npm instead of yarn (yarn wants to recompile all my native modules every time I install something but I feel like npm is doing the same)
I tried downgrading PouchDB to 6.2.0, I have tried everything this is driving me crazy any help would be really appreciated.
Using ts-node, I tried to require/import PouchDB every way possible:
> require('pouchdb')
{ [Function: PouchDB$5]
  super_:
   { [Function: AbstractPouchDB]
     super_:
      { [Function: EventEmitter]
        EventEmitter: [Object],
        usingDomains: true,
        defaultMaxListeners: [Getter/Setter],
        init: [Function],
        listenerCount: [Function] } },
  adapters:...

> import PouchDB from 'pouchdb'
undefined
> PouchDB
undefined

> import * as PouchDB from 'pouchdb'
[eval].ts:2
Object.defineProperty(exports, "__esModule", { value: true });
                      ^

ReferenceError: exports is not defined
    at [eval].ts:2:23
    at ContextifyScript.Script.runInContext (vm.js:53:29)
    at ContextifyScript.Script.runInNewContext (vm.js:59:15)
    at _eval (/home/vincent/.nvm/versions/node/v8.5.0/lib/node_modules/ts-node/dist/_bin.js:181:29)
    at REPLServer.replEval (/home/vincent/.nvm/versions/node/v8.5.0/lib/node_modules/ts-node/dist/_bin.js:220:18)
    at bound (domain.js:301:14)
    at REPLServer.runBound [as eval] (domain.js:314:12)
    at REPLServer.onLine (repl.js:440:10)
    at emitOne (events.js:115:13)
    at REPLServer.emit (events.js:210:7)

> import {PouchDB} from 'pouchdb'
Thrown: ⨯ Unable to compile TypeScript
[eval].ts (1,9): Module ''pouchdb'' has no exported member 'PouchDB'. (2305)

A: As of now, the best fix is:
import Pouch from 'pouchdb';
const PouchDB: typeof Pouch = require('pouchdb');

This is quick and dirty, but the real fix needs to be done by pouchDB maintainer


text:
Q: Laravel routes not found on nginx when I try to access my test app, just the index route works:
malte.italoborg.es
If I try to access another route, like:
malte.italoborg.es/admin
I got 404 error.
My nginx app file:
server {
    listen 80;
    server_name malte.italoborg.es;
    root /home/italo/www/malte.italoborg.es/public;

    charset utf-8;

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log  /home/log/nginx/malte.italoborg.es-error.log error;
    error_page 404 /index.php;
    sendfile off;

    # Point index to the Laravel front controller.
    index index.php;

    location / {
            try_files $uri $uri/ /index.php;
    }

    location ~ \.php$ {
        try_files $uri /index.php =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ /\.ht {
        #deny all;
    }
}

I tried this solution in an another link in StackOverflow, but doesn't worked for me.
All Laravel routes "not found" on nginx
I'm using nginx in Digital Ocean.
::UPDATE::
My routes.php
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/',
    ['as' => 'site.welcome.index', 'uses' => 'Site\WelcomeController@index']
);

Route::group(['prefix' => 'admin'], function () {

    // Login
    Route::get('login',
        ['as' => 'admin.auth.login', 'uses' => 'Admin\Auth\AuthController@getLogin']
    );
    Route::post('login',
        ['as' => 'admin.auth.login', 'uses' => 'Admin\Auth\AuthController@postLogin']
    );
    Route::get('logout',
        ['as' => 'admin.auth.logout', 'uses' => 'Admin\Auth\AuthController@getLogout']
    );

    // Password
    Route::get('password/email',
        ['as' => 'admin.password.email', 'uses' => 'Admin\Auth\PasswordController@getEmail']
    );
    Route::post('password/email',
        ['as' => 'admin.password.email', 'uses' => 'Admin\Auth\PasswordController@postEmail']
    );

    // Password reset
    Route::get('password/reset/{token}',
        ['as' => 'admin.password.reset', 'uses' => 'Admin\Auth\PasswordController@getReset']
    );
    Route::post('password/reset',
        ['as' => 'admin.password.reset', 'uses' => 'Admin\Auth\PasswordController@postReset']
    );

    Route::group(['middleware' => 'auth'], function () {

        // Home
        Route::get('/', ['as' => 'admin.home.index', 'uses' => 'Admin\HomeController@index']);

        // My Account
        Route::get('profile',
            ['as' => 'admin.profile.edit', 'uses' => 'Admin\ProfileController@edit']
        );

        Route::put('profile',
            ['as' => 'admin.profile.update', 'uses' => 'Admin\ProfileController@update']
        );

        // Nail polish
        Route::resource('polishes', 'Admin\NailPolishController');

        // Brands
        Route::resource('brands', 'Admin\BrandController');

        // Types
        Route::resource('types', 'Admin\TypeController');
    });
});

A: Please try changing this
location / {
    try_files $uri $uri/ /index.php;
}

to this
location / {
    try_files $uri $uri/ /index.php?$query_string;
}

And also remove this line:
try_files $uri /index.php =404;

A: Fix for Laravel 5.1:
$ vi /etc/nginx/sites-available/default
Comment out:
# try_files $uri $uri/ =404;
Add:
try_files $uri $uri/ /index.php;

A: For the lumen and laravel this solved my problem:
I've change the document root on nginx to root of my project:
root /usr/you/laravelinstall/public;


text:
Q: Gradle: Run multiple webapps with Jetty I want to run two webapps created by the same Gradle project into a Jetty server. Let's call these two webapps "ninja" and "warrior".
Both webapps are very similar, they only differ in the application-context file (referenced in the web.xml file) and resources.
In order to deploy them, these two options are accepted:

*

*Use different ports:

http://www.example.com:8080/app (ninja webapp)
http://www.example.com:8081/app (warrior webapp)

*

*Use different paths:

http://www.example.com:8080/ninja_app
http://www.example.com:8080/warrior_app

Having one or two instances of Jetty should be ok for this project.
This is my project layout:

/src/main/java
/src/main/resources
/src/main/webapp (ninja webapp)
/src/main/webapp-warrior

First question: How to create two war files with Gradle?
Second question: How to deploy the two war files in the Jetty Server with Gradle?

A: Please have a look at Gretty gradle plugin: https://github.com/akhikhl/gretty
It supports multiple web-apps out of the box. It helps you to:

*

*run web-app projects "inplace", i.e. from compiled classes

*run web-app projects as WAR files

*run non-project WAR-files from the file system

*run non-project WAR-files from maven repositories (of course, WAR is downloaded first)

Additionally you can:

*

*Debug multiple web-apps on the same Jetty server under any Java IDE debugger.

*Perform integration tests with multiple web-apps on the same Jetty server.

*Perform code coverage with Jacoco - both client-side and server-side.

There is a lot of documentation helping with everything: http://akhikhl.github.io/gretty-doc/
Disclosure: I am author of Gretty plugin.
Happy coding :)

A: If you don't want to create two different projects, you may want to create two different gradle profiles, using the apply from:  feature from Gradle.
For each webapp instance, ninja and warrior, you must create a script file with all the information specific for the profile.
In these new gradle build files, ninja-profile.gradle and warrior-profile.gradle, you can set the specific configurations that differ from ninja to warrior, which in this case could be:

*

*Resources folder: you can create a separated resources folder for
each of the instances

*Jetty configuration: if you want to run two
different instances of the 2 webapps, each of them in a separated
jetty instance.

In your "main" build file you define everything that is common for all profile and build needs, plus you add the following line:
apply from: "${profile}-profile.gradle"

When you run Gradle you can pass the name of the profile using the -P option:
$ gradle -Pprofile=ninja tasks

or
$ gradle -Pprofile=warrior tasks

A: We finally implemented a solution where sourceSets were created for both projects, so the directory layout is:

*

*/src/main/java: Contains common classes for both projects

*/src/main/webapp: Contains common webapp for both projects.

*/src/ninjaMain/resources: Contains the specific resources for the ninja project

*/src/warriorMain/resources: Contains the specific resources for the warrior project

Then, the build.gradle file was configured to create two war files. After that, both war files were deployed in the same webapp container using cargo and jetty:
apply 'java'
apply 'war'
apply 'cargo'

task createNinjaWar(type: War, dependsOn: classes) {
    baseName = 'ninja'
    from file('src/main/webapp')
    destinationDir = file("$buildDir/dist")
    webInf {
        from ('src/ninjaMain/resources') { into 'classes' }
    }
}

task createWarriorWar(type: War, dependsOn: classes) {
    baseName = 'warrior'
    from file('src/main/webapp')
    destinationDir = file("$buildDir/dist")
    webInf {
        from ('src/warriorMain/resources') { into 'classes' }
    }
}

// Deploy
cargo {
    containerId = 'jetty9x'
    port = 8080
    deployable {
        context = 'ninja'
        file = createNinjaWar.archivePath
    }
    deployable {
        context = 'warrior'
        file = createWarriorWar.archivePath
    }
}

The access URL for the two web applications are now:

*

*http://www.example.com:8080/ninja

*http://www.example.com:8080/warrior

A: For better readbility, code organisation and simpler maintenance these two projects should be separated. Then jetty plugin can be applied and configured separately for each project and all env can be start in parent build.gradle file.


text:
Q: Asymptotic of reciprocal sums of $k-$almost primes As in this previous question, let a $k-$almost prime be a positive integer having exactly $k$ prime factors, not necessarily distinct. Let $\mathbb{P}_k$ be the set of the $k$-almost primes and let
$$
\rho_k(n):=\sum\limits_{\substack{q\in \mathbb{P_k}\\q\le n}}\frac1q.
$$
The answer to that question states that (I presume for fixed $k$) the asymptotic estimate for $\rho_k(n)$ has leading term
$$
\rho_k(n) \asymp \frac{1}{k!}(\log \log n)^k,
$$
and error term of $O((\log \log n)^{k-1}).$
How would a rigorous proof showing the error term proceed?
Is there a reference to such a result in the literature?

A: I'm just focusing on the error term since the main term was already discussed in your previous question.
You know that
$$
\sum_{p\leq n}\frac1{p} = \log\log n + O(1)\;;
$$
then
$$
\rho_k(n) \ll \left(\sum_{p\leq n}\frac1{p}\right)^k =
O((\log\log n)^k) + O((\log\log n)^{k-1}) \;.
$$


text:
Q: Unwanted white space in IEEE latex template I am writing a paper, in which I don't know the reason for this white spacing shown below:

This appears between sections, equations, and figures. However, this is the given template from IEEE. Could anyone help me?
PS: I am using pdflatex in windows. The only customization I did in the template is using the psfrag package, for substitution in .eps figures. Also, I could not provide a MWE because, I am not sure how to insert a whole class into MWE.


text:
Q: Huge drop in Google Analytics after site update I released a new version of my website today and with the old version, I was around 90 visitors an hour, and after the update, it dropped to around 20 visitors.
I don't know what went wrong. Here's the stats:

As you can see, a drop occurred between 3pm and 4pm and drop to finally get to 0 since then.
I added an httpS connection, but the non www and http all redirects to https://www automatically. The tracker is the same, I only added
ga('set', 'forceSSL', true);
ga('set', 'appVersion', '2');
ga('send', 'pageview');

There is only one page (it's a basic app), so there is no other page that could have the tracker removed.
Now, I'm wondering something, when I start the tracker, I send this info :
ga('create', 'UA-XXXXX-X', 'voilanorbert.com');

shouldn't it be ga('create', 'UA-XXXXX-X', 'www.voilanorbert.com');? (with "www.") Is this the issue?
Big Update: I decided to create a new tracker in Google to see if this was a reason, and yes it is! A few minutes after I changed it to the new tracker, the data went to 1 visitors per hour, to 18 in real time! There is clearly a problem in Google Analytics!

A: Your tracking code was flawed. This does not imply Google Analytics does not work.

*

*The appVersion parameter is reserved for mobile apps and not for the web collection API.

*forceSSL is kind of obsolete now

When in doubt, stick to the regular tracking code or use Google Tag Manager.


text:
Q: How to pass multiple params to the root route in Angular For other path 'test', I can use http://localhost/#/test;param1=a;param2=b
But for root path '', I can't use http://localhost/#/;param1=a;param2=b
Anyone helps?

A: You could pass it like this:
In html pass an json object or array, and retrieve it if you need in onInit hook.
So it will require only one param, which can hold many values.

   ngOnInit() {
      this._route.params.subscribe(params => {
          this.data = JSON.parse(params.yourParam);
      });
   }
<a [routerLink]="['/']"
       [queryParams]="{yourParam:yourDataInJsonFormat | json }">
       CLick here
    </a>


text:
Q: how to event handeler using google translater API I am using google translator api that it's allow me and give just small piece of code to add on your website and it will show dropdown that u can change any language so is it any pattern or some that on this drop down i can attach my event whenever has changed any language i can perform my logic thanks.
I want simply then when ever i changed language from drop down i want to perform some action.
here is code

here is an image of drop down that after adding this code it's showing me.
Drop down Translater Image want to bind my event when any language select any event that allow me to do this please tell me

A: You could detect whenever somebody clicks on #google_translate_element but methods to trigger a function when user click a language button, would be considered 'hacky' and may fail whenever Google updates it scripts.
To handle clicks with jquery, you could use something like:
$( "#google_translate_element" ).click(function() {
alert( "Clicked on Translate!" );
});


text:
Q: How to find and compress multiple directories with files to one archive? I have over 200 different domains with wordpress installed on my server and want all of their uploaded files for year 2013 to be compressed into one file keeping the directory structure.
I need all files and folders from
domain1.com/wp-content/uploads/2013/
domain2.com/wp-content/uploads/2013/
domain3.com/wp-content/uploads/2013/
domain4.com/wp-content/uploads/2013/

to be compressed into one archive. The problem is there many folders with the same name (month number) and possibly files with similar name. How to compress them all and overwrite compressed files if some already exist in the archive?

A: tar cfz archive.tar.gz */wp-content/uploads/2013

This will retain the directory structure.
It's not possible to replace files in a tar file. You can append new versions of a file to an uncompressed archive, but when it's compressed you can't do that, either. You could make an incremental archive of all the files that have changed since the last archive.

A: Just create a local directory for each domain and copy that domain's files to it. So create a directory called domain1-wp-content, copy the contents of domain1.com/wp-content/uploads/2013 into it, and repeat for the other directories. Then compress all of your newly created local directories together.


text: Q: EF code-first migrations not in batches I have a long migration script to execute, beginning from the initial migration, that was generated by VS/package-manager using update-database -script. It doesn't seem to automatically separate the script into batches so that I can easily execute it in sql management studio. Is there a way to do this, or are we expected to insert dozens of go manaully?


text:
Q: How to specify a style block in react component? I'm generating email text using React component. I have a problem with specifying styles for this email. For example in HTML I would specify it as following:

    Dear players ...

But, since React does not allow styles and uses object notation, I am not sure how to specify styles that I attach to the email.
Thanks.

A: JSX does support a style block. This is what it would look like:
const Margins = () => {
  return (

  )
}

Remember, it should be in side a the return and

style tag should not be a sibling

A: You would need to create the style block and set the contents from a variable.
render: function () {
    var styles = '#mailContent { margin: 10px; font-family: "Lato", "Helvetica Neue", Arial, Helvetica, sans-serif; font-size: 14px; line-height: 1.33; }';
    return (

          Dear players ...

  );
}

A: You can use the dangerouslySetInnerHTML attribute to add your CSS to a


text:
Q: MongoDB C# driver sorting by property in related collection? I am trying to sort data in a query of one collection based on a property in another collection referenced by an id. In SQL terms basically a sort by a value in a foreign key. The main collection contains an entity called CaseData that looks similar to this (some unrelated properties removed:
{
    caseId: "some unique Id value",
    type: {
        typeId: "someUniqueTypeId"
    }
    users: [
        {
            userId: "unique user id",
            userType: "some unique user type id"
            …other properties
        }
    ],
    …other properties
}

And the second collection is a collection of user objects that looks like the json below that is referenced in the users collection above by it's userId:
{
    userId: "some unique id",
    data: {
        property: {
            someSortableProperty: true
        }
    }
}

NOTE: the users array in caseData is not a "user" as it contains other properties that are specific to the assignment to the case that arent in user. The actual value I need to sort on is in the full user document. e.g. someSortableProperty.
I've got a mongo query that appears to be working if run in a mongo ide that looks like this:
db.cases.aggregate([
    { $match: { 'type.typeId': 'someUniqueTypeId', 'users':{$exists:true, $size:1} } },
    ^ this is not the final query qas just used to get data for the sample
    { $lookup: { 'from': 'users', 'localField': 'users.userId', 'foreignField': 'userId', 'as': 'caseUser' } },
    { $sort: {'caseUser.data.property.someSortableProperty':-1}}
])

The idea is that I need to sort case data by the caseUser.data.property.somevalueproperty on the related values in "caseUser" assuming only one case user in case data is used for the sort. Perhaps I am way off base with this query, but but it seems to work, I am just struggling with how to express this in the mongodb C# driver. I am trying to use a combination of aggregate and lookup, but nothing I have tried this far seems to make any sense. I ran across this post (mongodb - Aggregate $lookup with C# - Stack Overflow) on stack overflow which seems to be doing what I need to do, partially at least, but not of those examples compile and I am not understanding the relationships that person is trying to convey.
Is this even possible to do in the C# driver?

A: C# drivers allows specifying a raw MQL query in string form (as BsonDocument), so your above code will look similar to:
        var client = new MongoClient();
        var db = client.GetDatabase("d");

        var cases = db.GetCollection<CaseData>("cases");

        db.DropCollection("cases");
        db.DropCollection("users");

        var users = db.GetCollection<UserOutput>("users");
        var someUniqueTypeId = Guid.NewGuid();
        var someUniqueUserId = Guid.NewGuid();

        cases.InsertOne(new CaseData() { Type = new Type { TypeId = someUniqueTypeId }, Users = new[] { new User() { UserId = someUniqueUserId } } });
        users.InsertOne(new UserOutput() { UserId = someUniqueUserId, Data = new Data { Property = new Property { SomeSortableProperty = true } } });

        var res = cases
            .Aggregate()
            .Match(Builders<CaseData>.Filter.And(
                Builders<CaseData>.Filter.Eq(t => t.Type.TypeId, someUniqueTypeId),
                BsonDocument.Parse("{ users : { $exists : true, $size : 1} }")))
            // typed $lookup method doesn't support providing array as `localField`
            .AppendStage<UserOutput>(BsonDocument.Parse("{ $lookup : { 'from' : 'users', 'localField': 'users.userId', 'foreignField': 'userId', 'as': 'caseUser' } }"))
            .Sort(Builders<UserOutput>.Sort.Descending(c => c.Data.Property.SomeSortableProperty))
            .Single();

    // types
    public class Type
    {
        [BsonElement("typeId")]
        public Guid TypeId { get; set; }
    }

    public class User
    {
        [BsonElement("userId")]
        public Guid UserId { get; set; }
        public Guid UserType { get; set; }
    }

    public class CaseData
    {
        public ObjectId Id { get; set; }
        public Guid CaseId { get; set; }
        [BsonElement("type")]
        public Type Type { get; set; }
        [BsonElement("users")]
        public User[] Users { get; set; }
    }

    // foreign coll
    // this attribute is used since actual $lookup response document will be fields combination between `CaseData` and `UserOutput`. So to get rid of `CaseData` fields during deserialization use `BsonIgnoreExtraElementsAttribute`
    [BsonIgnoreExtraElements]
    public class UserOutput
    {
        public ObjectId Id { get; set; }
        public Guid UserId { get; set; }
        public Data Data { get; set; }
    }

    public class Data
    {
        public Property Property { get; set; }
    }
    public class Property
    {
        public bool SomeSortableProperty { get; set; }
    }

Generated MQL will be:
aggregate([
{ "$match" : { "type.typeId" : CSUUID("85e99185-5c1b-4beb-a108-1929d89c1b42"), "users" : { "$exists" : true, "$size" : 1 } } },
{ "$lookup" : { "from" : "users", "localField" : "users.userId", "foreignField" : "userId", "as" : "caseUser" } },
{ "$sort" : { "Data.Property.SomeSortableProperty" : -1 } }
])


text:
Q: Deleting duplicate values in std map I have a
map<char,my_class*> mymap;

the contents of which are as below.
mymap[0]=('a', 0x1);
mymap[1]=('b',0x2);
mymap[3]=('c',0x3);
mymap[4]=('d',0x1);

As you see we have same value for keys 'a' and 'd'. i have a for loop to delete the pointers in the map.
for ( it=mymap.begin() ; it != mymap.end(); it++ ){
  delete it->second;
}

It crashes because it is trying to delete 0x1 twice.
I tried doing this
for ( it=mymap.begin() ; it != mymap.end(); it++ ){
  if(!it->second){
      delete it->second;
      it->second = NULL;
  }
}

Even this tries to set a pointer to NULL twice which result sin an exception.
What is the best way to delete duplicate values as above in a map?

A: NPE's answer involving shared_ptr is good. But if you're forced to use real pointers, I'd probably do it like this:
set<my_class*> values;
for (it=mymap.begin(); it != mymap.end(); it++)
{
  // insert.second will be false if the value is already in the set
  if (values.insert(it->second).second)
    delete it->second;
}

// Make sure you do something with mymap to ensure you don't double-delete later!

A: My advice would be to keep shared_ptr<my_class> in your map, and sidestep the problem altogether.
If you can't do that, you'll need to keep an auxiliary container (e.g. a set) of pointers that you've already deallocated. You'll then consult and update that container as you're iterating over the map.

A: If you don't want duplicate second entries, then perhaps the
best solution would be to not insert them to begin with.  The
cleanest solution I can think of to do this would be to use
Boost bimap.  I rather think this behavior would surprise the
user who inserted the second entry, however.
Alternatively (supposing you can't use shared_ptr), the
simplest solution when deconstructing the map would be to create
a temporary std::set<MyClass*> with all of the elements, and
then delete from that.  (std::set ensures no duplicates).
And while I'm at it: the reason your second solution fails isn't
because you are setting a pointer to null twice; there's nothing
wrong with that.  It is because you have two distinct pointers
to the same object; setting the first to null doesn't modify the
second, so you still end up trying to delete the same object
twice.

A: It would be simpler if you stored the instances or used a smartpointer. Std::Map has its own internal pointers to your object, and you can save headache by relying on someone elses handle to your object. The Boost library contains several smartpointers. If you use an intrusive reference counting smartpointer, then your object can be automatically destroyed when it is removed from the map.
You will then be able to use the erase function to remove the value from the map, which will then delete your object (if it is the last reference) after calling the destructor chain.


text:
Q: Zbar Code128 decode wrong I have a image below

I'm using zbar to read the barcode
zbarimg --version

0.10
zbarimg -d ./image.jpg

CODE-128:10000400040021
scanned 1 barcode symbols from 1 images in 0.11 seconds
Result is 10000400040021, but the correct barcode is 10000439140021
I'm using barcode reader online (https://online-barcode-reader.inliteresearch.com/) and the result is 10000439140021

is it a zbar bugs ?


text:
Q: radio different names - only check one I'm using many radio-buttons in a xtcommerce-based-workaround. Those radiobuttons are dynamically created and given a different name for each group like this:
<input type="radio" name="id[1]" value="40">
<input type="radio" name="id[1]" value="30">
<input type="radio" name="id[1]" value="20">
<input type="radio" name="id[1]" value="10">
<input type="radio" name="id[2]" value="40">
<input type="radio" name="id[2]" value="30">
<input type="radio" name="id[2]" value="20">
<input type="radio" name="id[2]" value="10">
<input type="radio" name="id[3]" value="10">
....

Now I want to "group" those radio-buttons back together, so that I can only choose one radio-button at a time. Now by default every first radio-button of each "group" (name="id[1]", name="id[2]", etc.) is preselected and every value of each radio-button gets submitted.
I found this script here on stackoverflow to only select one radio-button:
$(document).ready(function () {
  $('input[type=radio]').prop('checked', false);
  $('input[type=radio]:first').prop('checked', true)

  $('input[type=radio]').click(function (event) {
    $('input[type=radio]').prop('checked', false);
    $(this).prop('checked', true);

    event.preventDefault();
  });
});

Here is a fiddle of that:
http://jsfiddle.net/3xD7V/1/
This works so far, I can only select one radio-button on my page. But there is one problem as you can see in my js-fiddle too:
http://jsfiddle.net/ksZxV/
The first radio-button of the first group is preselected - that's ok. But if you choose another radio-button of the same group, the selection-"mark" does not change. Only if you click a radio-button of another group the chosen radio-button gets selected (found another bug in FF (EDIT: and Opera as well as IE9), the selection-mark is not shown if I choose any other radio-button; in Chrome it changes by selecting another group). If you stay in this same group, the selection doesn't change either.
On my local based installation I have got a dynamically-changing updater, which states the new price of the selected item (sorry I couldn't implement this to the fiddle). This works so far, the price gets updated even if I choose another radio-button of the same group, but as described before the selection-"mark" does not change...
Any idea for this problem?

A: You don't need to uncheck all radio buttons, then re-check the current one. Un-checking the previously checked button suffices.
As a side effect of this simplification, your bug is also fixed.
$(document).ready(function () {
    $('input[type=radio]').change(function() {
        // When any radio button on the page is selected,
        // then deselect all other radio buttons.
        $('input[type=radio]:checked').not(this).prop('checked', false);
    });
});

A: why do you have event.preventDefault(); there....since your code inside click function is doing that.
remove the event.preventDefault(); and try
here is the fiddle..
http://jsfiddle.net/ksZxV/1/

A: Just remove event.preventDefault(); and it will work.
Check this JSFIDDLE

A: Radio button with a different name but a single selection
Working Example : https://codepen.io/Vivekparashar/pen/wvwLwxY
JS :
$(document).ready(function() {
  $("input[type=radio]").prop("checked", false);
  $("input[type=radio]:first").prop("checked", true);

  $("input[type=radio]").click(function(event) {
    $("input[type=radio]").prop("checked", false);
    $(this).prop("checked", true);

    //event.preventDefault();
  });
});

HTML :

Radio Button With Different Name/Group but Single Selection

    <form>

            Radio Button 1
            <input type="radio" name="radiobutton1">

            Radio Button 2
            <input type="radio" name="radiobutton2">

            Radio Button 3
            <input type="radio" name="radiobutton3">

            Radio Button 4
            <input type="radio" name="radiobutton4">

            Radio Button 5
            <input type="radio" name="radiobutton5">

    </form>


text:
Q: How to specify complicated patterns in function arguments? Unfortunately, I have not found in documentation how to create complicated patterns in arguments of a function
Consider a toy example. Say, I would like to have a simple function
foo[c_, x_] := c*x^2

but c is to be a real number, and x is a list. This can be achieved in a trivial way:
foo[c_Real, x_List] := c*x^2

But how to specify conditions:

*

*c is real number belonging to $[2.3, \sqrt{10})$

*x is an integer-valued list, Length[x]>=5, Min[x]>=0, and Max[x]<=3
I tried to use Condition, but had no success


text:
Q: Is there a way to copy all the data in a mysql database to another? (phpmyadmin) I want to copy all the tables, fields, and data from my local server mysql to my hosting sites mysql. Is there a way to copy all the data? (It's only 26kb, very small)

A: In phpMyAdmin, just export a dump (using the export) tab and re-import it on the other server using the sql tab.
Make sure you compare the results, I have had phpMyAdmin screw up the import more than once.
If you have shell access to both servers, a combination of
mysqldump -u username -p databasename > dump.sql

and a
mysql -u username -p databasename < dump.sql

on the target server is the much more fast and reliable alternative in my experience.

A: Have a look at
Copying MySQL Databases to Another Machine
Copy MySQL database from one server to another remote server

A: Please follow the following steps:

*

*Create the target database using MySQLAdmin or your preferred method. In this example, db2 is the target database, where the source database db1 will be copied.

*Execute the following statement on a command line:

mysqldump -h [server] -u [user] -p[password] db1 | mysql -h [server]
  -u [user] -p[password] db2

Note: There is NO space between -p and [password]
I copied this from Copy/duplicate database without using mysqldump.
It works fine. Please ensure that you are not inside mysql while running this command.

A: If you have the same version of mysql on both systems (or versions with compatible db file sytsem), you may just copy the data files directly. Usually files are kept in /var/lib/mysql/ on unix systems.


text:
Q: 400 Bad Request when calling WCF service? I am debugging an html page with three javascript charts that each call two WCF services: one paints the map and the other plots points. There are six calls (two/map). This WCF service and the HTML are both published in the same local Windows 2003 server.
The top three calls in Dev Tools are the points plotted. The other three calls paint the map. The issue is that I'm getting a 400 Bad Request in the last three calls. If I call them directly from a browser, they will return the correct JSON immediately.

This are the errors from one call:
Request URL: http://XX.XXX.XX.XX:89/Map.svc/GetWinner/9-19-2019/9-26-2019/0/0/ST
Request Method: GET
Status Code: 400 Bad Request
Remote Address: XX.XXX.XX.XX:89
Referrer Policy: no-referrer-when-downgrade
Access-Control-Allow-Origin: *
Cache-Control: private
Content-Length: 1647
Content-Type: text/html
Date: Fri, 27 Sep 2019 21:29:03 GMT
Server: Microsoft-IIS/7.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Provisional headers are shown
Origin: http://XX.XXX.XX.XX:93
Referer: http://XX.XXX.XX.XX:93/map.html
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36

What can the issue be?


text:
Q: Download bootstrapper exe path in msi I would like to assign a property path to the bootstrapper exe.
I've seen a few posts that show you can do it this way:
<MsiPackage Id="MainPackage" SourceFile"...\Installer.msi" ...>
    <MsiProperty Name='CONFIGFILELOCATION' Value='[WixBundleOriginalSource]'/>
</MsiPackage>

But all the ways I found to download it in the product don't work.
I'm not sure if I create veriable with value [WixBundleOriginalSource] returns the path, because writing it to the txt file in the custom interface returns me [WixBundleOrginalSource] instead of the path.
I was trying use in custom action:
AppDomain.CurrentDomain.BaseDirectory
Assembly.GetEntryAssembly().Location

A: Ok I found solution:
<Property Id="CONFIGFILELOCATION"\>
<SetProperty Id="CONFIGFILELOCATION" Value="[CONFIGFILELOCATION]" Before="AppSearch">
     CONFIGFILELOCATION=""
</SetProperty>

I don't understand how value works in the end, because if you can do something else, it also works.


text:
Q: Can a concept be checked against incomplete type I stumbled upon this:
#include <type_traits>
#include <concepts>

template<class T>
concept IsFoo = requires(T a)
{
    {a.a} -> std::same_as<int>;
};

#if 1
// Will not compile, because Foo currently has incomplete type
template<IsFoo AFoo>
struct AcceptsFoo
{};
#else
template<class AFoo>
struct AcceptsFoo
{};
#endif

struct Foo
{
    int a;
    int b;

    AcceptsFoo<Foo> obj;
};

https://gcc.godbolt.org/z/j43s4z
Other variant (crtp) https://gcc.godbolt.org/z/GoWfhq
Foo is incomplete because it has to instantiate AcceptsFoo, but to do so, Foo has to be complete, otherwise it cannot check IsFoo. Is this a bug in GCC, or does the standard say so? The latter would be sad, because this prevents concepts for being used together with some well-known patterns such as CRTP.
I noticed that clang does gives a similar error: https://gcc.godbolt.org/z/d5bEez

A: You can check a concept against an incomplete type - but if that concept check requires actually doing anything with the type that requires it to complete, that's going to fail the concept check.
And even there, you have to be careful since implementations are allowed to (and will) cache concept checks to compile faster - so if you try C<T> while T is incomplete and try again when T becomes complete, and those should give different answers, you're asking for trouble.
Foo isn't complete at the point you're checking it, so naturally it doesn't have a member named a. This really cannot possibly work.

because this prevents concepts for being used together with some well-known patterns such as CRTP.

Being used together in this way, yes. In the same way that with CRTP you also can't access anything directly off of the template parameter passed into the base class, you always have to be careful to delay any instantiation of that type until it is complete.
This is ultimately the same reason:
template <typename Derived>
struct B {
    typename Derived::type x;
};

struct D : B<D> {
    using type = int;
};

does not work.

A: [EDIT] This works as expected on g++ 10.3, 11.2 and current clang. Some comments indicate that this is undefined behavior, so beware of possibly unexpected changes for future compilers.
Original solution:
I also just stumbled on this, and succeeded in making my CRTP with concepts work by allowing type to be either incomplete, or complete with the desired constraints.
Besides the defined IsFoo, I also define IsComplete helper (using sizeof trick) and, finally, IsFooIncomplete in the following way:
template<class T>
concept IsFooIncomplete = !IsComplete<T> || IsFoo<T>;

This way I can ensure that, during the processing of Foo, it is incomplete, and just after class is finished, it is complete and matches desired IsFoo constraints.
#include <concepts>
#include <type_traits>

template<class T>
concept IsFoo = requires(T self)
{
   {
      self.a
      } -> std::same_as<int&>;
};

template<class T>
concept IsComplete = requires(T self)
{
   {
      // You can't apply sizeof to an incomplete type
      sizeof(self)
   };
};

template<class T>
concept IsFooIncomplete = !IsComplete<T> || IsFoo<T>;

#if 0
// Will not compile, because Foo currently has incomplete type
template<IsFoo AFoo>
struct AcceptsFoo
{};
#else
// will compile with IsFooIncomplete
template<IsFooIncomplete AFoo> // no need to use 'class AFoo' here...
struct AcceptsFoo
{};
#endif

struct Foo
{
   int a;
   int b;

   // Foo is incomplete here, but that's fine!
   static_assert(!IsComplete<Foo>);
   AcceptsFoo<Foo> obj;
};

// Foo is now complete, and that's also fine!
static_assert(IsFoo<Foo>);

Works fine on g++ version 10.3.0 (with flag --std=c++20), and I hope it works on other compilers as well.
[EDIT] as pointed out in comments, this accepts any incomplete type, but thats intended. Only the external static assert will filter complete type cases. Thanks @David Herring for the example on Bar, I wrote it here for testing: https://godbolt.org/z/sqc75qqMv

[EDIT2] now this deals with the CRTP variant, without any undefined behavior and without the IsComplete workaround, just by storing the type for checking once class is complete.
// Will not compile, because Foo currently has incomplete type
template<IsFoo AFoo>
struct AcceptsFoo
{};
#else
template<class AFoo> // will not check IsFoo directly here...
struct AcceptsFoo
{
    using IsFooType = AFoo; // will store type on IsFootType for later checks
};
#endif

struct Foo : public AcceptsFoo<Foo> // will check only when complete
{
    int a;
    int b;
};

// Foo is now complete, and that's also fine!
static_assert(IsFoo<Foo::IsFooType>);

struct FooBar : public AcceptsFoo<FooBar> // will fail once it is complete
{
    //int a;
    int b;
};
// will fail here
static_assert(IsFoo<FooBar::IsFooType>);

This also works on major compilers: https://godbolt.org/z/e1Gc4Kj5n


text:
Q: Create array from values in an array This is highly similar to a previous question (Create an array from multidimensional array), yet in this case I do not have a multidimensional array. Here is what I have:
Array
(
    [0] => ratings Object
        (
            [id] => 1
            [rating] => 4.4
        )

    [1] => ratings Object
        (
            [id] => 1
            [rating] => 5.0
        )

    [2] => ratings Object
        (
            [id] => 1
            [rating] => 5.0
        )
)

What I'm attempting to do is create a new array that consists of only the "rating" values...
$result_array = array(0 => "4.4",
                      1 => "5.0",
                      2 => "5.0");

The following solution was unsuccessful since $value is an object rather than an array...
$result_array = array();

foreach ($array as $value) {
    $result_array[] = $value[1];
}

What's the correct way to go about it?

A: $result_array[] = $value[1];

With the above line, you're trying to use $value as an array when it's not. It's an object, so treat it as such.
The properties of an object can be accessed using arrow notation (->). The updated code would read:
foreach ($array as $value) {
    $result_array[] = $value->rating;
}


text:
Q: Maximum stack size usage I have a function written in C which looks like this
void function1(){
    if(!some_condition){
        function1();
    }
}

This is compiled in gcc on a RedHat linux based machine.
Is there a profiling tool that can tell me the maximum amount of
stack space used by the code?

A: Massif from the valgrind suite should tell you this. However, you already know that your program is using the stack too extensively, so I'm not sure using it will help you much.
It seems to me you should refactor your code. Unfortunately, C is not Scheme, and the compilers are not required and don't do any tail recursion optimizations. So it may be a good idea to reorganize your function so it is looping instead of calling itself recursively. Here is a good read on Stacks and Recursion Elimination.


text:
Q: FB.api('/me/home') only returns a few results I'm getting the results of the /me/home Facebook Graph edge.  But it's only returning a few results, as compared with the way my News feed looks when I go to Facebook.  Code here:
FB.api('/me/home',function(response){
            var idDiv=document.getElementById('result');
            idDiv.textContent=JSON.stringify(response.data);
            });

For me, this only returns 16 results.  I'm wondering if the results are based on the permissions that my friends have set regarding who can read their posts.  However, some of the results that are returned have the "shared with friends" permission, and some have the "public" permission.  What determines which stories are returned with this query?

A: Similar to.
Some posts not visible on the feed through Graph API /me/home
and
Facebook SDK for .NET and Graph API Explorer news feed mismatch
The reason is Facebook "scores" nodes to derive the most "Top Story". Low scoring nodes are by default not visible. You can force all nodes with
/me/home.filter(owner)<some_filters>

There is no documentation on WHY this actually works, but it does. You can also force all nodes that are Likes or Comments by doing the following
me/posts?fields=likes.filter(stream),comments.filter(stream)

A: You can get the number of post to display using limit parameter. Eg,
me?fields=id,name,posts.limit(25)
Gives only 25 post per API hit. If you need to get more post, You need to set count limit in limit parameter. Also note that, you can retrieve only 200 post per API hit. i.e. You can set maximum of 200 in your limit parameter and you get your recent number of post.
You can use, Next url in API to get next set of feeds. Like,
"next": "https://graph.facebook.com/v2.2/778783212329364/posts?limit=25&until=1414386975"
To get next set of post and you can merge this with your first list. You can't get all the post in single API hit and this is how you can achieve.


text:
Q: Get Pycharm to see dynamically generated python modules Using Apache Airflow they install plugins by modifying sys.modules like this:
 sys.modules[operators_module.__name__] = operators_module

Which is how they get python classes from their plugins folder to be imported via
from airflow.operators.plugin_name import Operator
even though the class Operator exists inside
airflow/plugins/Operators.py
This makes it impossible for PyCharm to understand the above import statement because it is a non-traditional way of generating module/module name.
Is there any way to get PyCharm to have something like a module/package alias for situations like these?

A: If your plugin is in the same repository as the dag you can wrap you import in try-except block:
try:
   # local development
   from plugin_name import Operator
except ImportError:
   from airflow.operators.plugin_name import Operator

my_operator = Operator(...)

And mark plugins directory as sources in your PyCharm Project Structure.
Afterwards PyCharm picks up your plugin source code and works nicely with autocompletion and so on.

A: Airflow loads plugins by searching the plugins directory for AirflowPlugin subclasses, then binding the operators etc. stored in attributes of those subclasses to new modules under the airflow namespace.
Resolving code transforming classes into modules is beyond PyCharm's capabilities, so unless you want to override this behavior by adding the plugins directory to sys.path and importing the contents directly, the best solution is to whitelist the modules airflow creates through Settings -> Editor -> Inspections -> Python -> Unresolved references and adding airflow.operators.plugin_name to the Ignore references list. Then, using the module like so:
from airflow.operators import plugin_name
task = plugin_name.Operator()

will no longer raise any errors, although you still won't get the benefits of code completion.

A: So far the best solution I've found (which is not a very good solution) is to simply ignore all unresolved attributes in each DAG file. You can do this if you hover over the error, select "More actions..." and then "Mark all unresolved attributes of [DAG FILE NAME] as ignored." Screenshots below.
This is not a very good solution because it sort of defeats the purpose of an IDE, so I'm hoping eventually somebody who understands the issue better will think of a better solution and post it here :)

A: Maybe other solutions exist but referencing @stephen answer you that can
simply ignore all unresolved attributes in each DAG file.

but I found that marking the dags directory as sources_root resolves the issue of unresolved attributes in an IDE (I am using specifically IntelliJ and Pycharm but could work for other IDEs as well)


text:
Q: App crashes when uploading image to firebase storage - Kotlin As soon as I upload an image from a path on the phone my app craches. The user is also successfully authenticated into the app and i've imported all the sdk's needed. It could be that the sdk's verision is not the right one, because it's not the newest verision. I followed this video: https://youtu.be/86dkYGeXMaU
this is my code:
private fun UploadToFirebaseStorage(){

    if(PhotoUri == null) return

    Log.d("AuthMsgs", PhotoUri.toString())
    val filename = UUID.randomUUID().toString()

    val ref =
    FirebaseStorage.getInstance().getReference("/images/$filename")

    ref.putFile(PhotoUri!!)
            .addOnSuccessListener {
                Log.d("AuthMsgs", "Photo Succes: " + it.metadata?.path)
            }

}

heres the log cat message:
2018-11-04 11:29:39.040 20493-20493/com.David.DiveBuddy E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.David.DiveBuddy, PID: 20493
java.lang.SecurityException: Permission Denial: opening provider com.google.android.apps.photos.contentprovider.impl.MediaContentProvider from ProcessRecord{6385df5 20493:com.David.DiveBuddy/u0a340} (pid=20493, uid=10340) that is not exported from uid 10106
    at android.os.Parcel.readException(Parcel.java:1683)
    at android.os.Parcel.readException(Parcel.java:1636)
    at android.app.ActivityManagerProxy.getContentProvider(ActivityManagerNative.java:4263)
    at android.app.ActivityThread.acquireProvider(ActivityThread.java:5475)
    at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:2267)
    at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:1515)
    at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1129)
    at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:982)
    at android.content.ContentResolver.openFileDescriptor(ContentResolver.java:835)
    at android.content.ContentResolver.openFileDescriptor(ContentResolver.java:789)
    at com.google.firebase.storage.UploadTask.<init>(Unknown Source)
    at com.google.firebase.storage.StorageReference.putFile(Unknown Source)
    at com.David.DiveBuddy.LoginReg.UploadToFirebaseStorage(Login_reg.kt:212)
    at com.David.DiveBuddy.LoginReg.access$UploadToFirebaseStorage(Login_reg.kt:31)
    at com.David.DiveBuddy.LoginReg$registerUser$1.onComplete(Login_reg.kt:153)
    at com.google.android.gms.tasks.zzj.run(Unknown Source)
    at android.os.Handler.handleCallback(Handler.java:751)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6123)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)

A: You just forgot to add the GOOGLE_PHOTOS permission to your Manifest.
<uses-permission android:name="com.google.android.apps.photos.permission.GOOGLE_PHOTOS"/>


text:
Q: Change cell group in sap.ui.table.Table I'm using the sap.ui.table.Table to build my table in a Fiori app. At this time I have loaded all the data from an OData service.
I have the following result:

Pressing the Competence Team I Group by this field.

As an example: I have searched and saw that it is possible, in the yellow part to put the sum of the cells that are below.
Example: In the column 4/1 for the AS group I have (0.00 + 0.00 + 0.00) = 0 and so on for the next live examples.
I know it's possible to put a footbar, but I think this is not adaptable for this example.
Sorry if I do not explain the best way.
I am using version 1.28.

A: Olá :) Check the guidelines for Analytical Table (ALV), at the "Agregation" section you can see details/info for to show/put totals to a selected column.
https://experience.sap.com/fiori-design/ui-components/analytical-table-alv/


text:
Q: Why does KMeans have no attribute _inertia? I read this and it didn't help: AttributeError: 'KMeans' object has no attribute 'inertia_' . It says I need to call fit() and I'm doing that, but I still get the error.
This code was adapted from a JupyterLab Notebook so the line numbers in the error message, below, are incorrect.
aDF = pd.DataFrame([[1,2,3,4,5],[100,200,300,400,500]])
print (aDF)
wcss = []
for i in range(1, 11):
    kmeans = KMeans(n_clusters=i, random_state=0)
    kmeans.fit(aDF)
    wcss.append(kmeans.intertia_)

I get this error:
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Input In [102], in <cell line: 2>()
      3 kmeans = KMeans(n_clusters=i, random_state=0)
      4 kmeans.fit(aDF)
----> 5 wcss.append(kmeans.intertia_)

AttributeError: 'KMeans' object has no attribute 'intertia_'


text:
Q: Fetch only PHAssetCollections containing at least one photo In iOS PhotoKit, I can fetch all non-empty albums like this:
let fetchOptions = PHFetchOptions()
fetchOptions.predicate = NSPredicate(format: "estimatedAssetCount > 0")
let albumFetchResult = PHAssetCollection.fetchAssetCollections(with: .album, subtype: .any, options: albumFetchOptions)

albumFetchResult.enumerateObjects({ (collection, _, _) in
    // Do something with the album...
})

Then I can get only photos from the album like this:
let fetchOptions = PHFetchOptions()
fetchOptions.predicate = NSPredicate(format: "mediaType = %d", PHAssetResourceType.photo.rawValue)
let fetchResults = PHAsset.fetchAssets(in: collection, options: fetchOptions)

But the first part can give me albums with only videos, which means that after I apply the predicate to the second part, the album will be empty. Is there a way to filter out those albums in the first part, before I start using them?

A: It seems that collections cannot be filtered like this without also fetching the items in the collections. See the docs for available fetch options; none allow filtering by number of a specific type of media.
The way I would achieve this is by fetching all albums created by the user, and then fetching the assets from the albums with a predicate that returns only images.
So to put it in code:
var userCollections: PHFetchResult<PHAssetCollection>!
// Fetching all PHAssetCollections with at least some media in it
let options = PHFetchOptions()
    options.predicate = NSPredicate(format: "estimatedAssetCount > 0")
// Performing the fetch
userCollections = PHAssetCollection.fetchAssetCollections(with: .album, subtype: .albumRegular, options: options)

Next, fetch the assets from a collection that are images by specifying a predicate:
// Getting the specific collection (I assumed to use a tableView)
let collection = userCollections[indexPath.row]
let optionsToFilterImage = PHFetchOptions()
    optionsToFilterImage.predicate = NSPredicate(format: "mediaType = %d", PHAssetMediaType.Image.rawValue)
// Fetching the asset with the predicate to filter just images
let justImages = PHAsset.fetchAssets(in: collection, options: optionsToFilterImage)

Lastly, count the number of images:
if justImages.count > 0 {
    // Display it
} else {
    // The album has no images
}


text:
Q: How to get view height considering its parent has infinite height? I have ScrollView that contains two ViewPagers. Top pager's height is always 48dp. I want bottom pager's height to be equal to current page height. So I thought I will programatically change ViewPager's height to current page height on every page change event. However, when I call getHeight() on my current page view it returns height of visible area of the view. Instead I want to get height of a view considering its parent has infinite height, i.e., like the view was put to ScrollView and not in ViewPager. Is it possible to measure this?
XML:
<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <android.support.v4.view.ViewPager
            android:id="@+id/top_pager"
            android:layout_width="match_parent"
            android:layout_height="48dp" >
        </android.support.v4.view.ViewPager>

        <android.support.v4.view.ViewPager
            android:id="@+id/bottom_pager"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >
        </android.support.v4.view.ViewPager>
    </LinearLayout>
</ScrollView>

JAVA:
bottomPager.setOnPageChangeListener(new OnPageChangeListener() {

        @Override
        public void onPageSelected(int position) {
            Object pageTag = bottomPager.getTag();
            View currentPageView = bottomPager.findViewWithTag(pageTag);

            int height = currentPageView.getHeight();
            // height above is always smaller than the screen height
            // no matter how much content currentPage has.
        }

        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
        }

        @Override
        public void onPageScrollStateChanged(int state) {
        }
    });

A: Thanks Hugo Gresse. I ended up writing this class and I'm happy with the result.
/**
 * This ViewPager continuously adjusts its height to the height of the current
 * page. This class works assuming that each page view has tag that is equal to
 * page position in the adapter. Hence, make sure to set page tags when using
 * this class.
 */
public class HeightAdjustingViewPager extends ViewPager {

    public HeightAdjustingViewPager(Context context) {
        super(context);
    }

    public HeightAdjustingViewPager(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        for (int i = 0; i < getChildCount(); i++) {
            View pageView = getChildAt(i);
            pageView.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
            int pageHeight = pageView.getMeasuredHeight();

            Object pageTag = pageView.getTag();
            if (pageTag.equals(getCurrentItem())) {
                heightMeasureSpec = MeasureSpec.makeMeasureSpec(pageHeight, MeasureSpec.EXACTLY);
            }
        }

        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    }

}


text:
Q: NotesAndAttachments I just learned the NotesAndAttachments relatedList was renamed to CombinedAttachments.  I seem to also have lost the ability to only show "Notes" from the <apex:relatedList /> tag.  Does anyone know how to access ONLY notes using the new verbiage?
http://docs.releasenotes.salesforce.com/en-us/winter14/release-notes/rn_186_forcecom_attachments_related_list.htm

A: I filed a case to ask about this question. Salesforce Support noted that there is no way to only show Notes through that Visualforce tag.
You could alternatively rebuild the related list using a PageBlockTable and only query for Notes related to that object, but that does require custom development.