text:
Q: Survey of recent developments of the Gelfand-Kirillov dimension It is almost two decades since the now classical books by McConnell and Robinson's

*

*[ Noncommutative Noetherian rings. With the cooperation of L. W. Small. Revised edition. Graduate Studies in Mathematics, 30. American Mathematical Society, Providence, RI, 2001 ],

and Krause and Lenagan's

*

*[ Growth of algebras and Gelfand-Kirillov dimension. Revised edition. Graduate Studies in Mathematics, 22. American Mathematical Society, Providence, RI, 2000. ],

which are were (and still are in my opinion), the standard references on almost everything related to the Gelfand-Kirillov dimension, appeared.
Time has passed, and a lot of new work on this dimensional invariant has been done.
I am looking for references, surveys and pherhaps lecture notes on the Gelfand-Kirillov dimension which covers relevant developments regarding this invariant in the last 20 years.
Regarding its computational aspects, one has for instance

*

*J. Bueso, J. Gomés-Torrecillas, A. Verschoren, [ Algorithmic methods in non-commutative algebra.
Applications to quantum groups. Mathematical Modelling: Theory and Applications, 17. Kluwer Academic Publishers, Dordrecht, 2003 ],

but it does not cover all aspects of recent developments.

A: This list is certainly far from being complete, but it contains some important results obtained in the last 20 years.
The following thesis discusses some recent results obtained by Bell (see Section 5):
Michelle Roshan Marie Ashburner (2008). A Survey of the Classification of Division Algebras over Fields. Master Thesis, University of Waterloo
This is a survey on GK dimension of graded PI-algebras:
L. Centrone, On some recent results about the graded Gelfand-Kirillov dimension of graded
PI-algebras, Serdica Math. J. 38(1-3) (2012), 43-68.
Centrone also wrote other papers where he proved some interesting results on GK dimension. For instance, he wrote:
L. Centrone, The graded Gelfand-Kirillov dimension of verbally prime algebras, Linear Multilinear Algebra 59(12) (2011), 1433-1450.
and
L. Centrone, A note on graded Gelfand-Kirillov dimension of graded algebras, J. Algebra
Appl. 10(5) (2011), 865-889.
For some results on Hopf algebras with finite GK dimension, see:
Zhang, G. (2013). Hopf algebras of finite Gelfand-Kirillov dimension. PhD Thesis, University of Washington
To conclude, GK dimension has been recently extended to algebras over commutative domains by Zhang and Bell. Now, GK dimensions can be studied on many new structures. In the following paper, GK is studied for skew PBW extensions
Reyes, A.: Gelfand–Kirillov dimension of skew PBW extensions. Rev. Col. Mat. 47(1), 95–111 (2013)
while in this one it has been studied for rings:
Lezama, O., Venegas, H. Gelfand–Kirillov dimension for rings. São Paulo J. Math. Sci. 14, 207–222 (2020).
I'm not aware of any survey discussing all these new developments.


text:
Q: F#: Implementing interface with function name the same as the keyword begin I am trying to implement the IVector interface which is part of the Microsoft.VisualC.StlClr namespace.  It has a member function begin().  If I try to implement the interface then it complains about "unexpected keyword 'begin' in object expression".
Is this because begin is a keyword and I can't implement a member function with that name?
B.

A: you can try to wrap it into backticks. IVector inteface is too big to implement it as sample, so example will be smaller - the code below compiles without any errors.
// C#
public interface ITest
{
    void begin();
}

// F#
type Test() =
    interface UStatic.ITest with
        member this.``begin``() = ()

redpajama_set_name: RedPajamaStackExchange


text:
Q: Recover dangling blobs in Git I did a "git rm -rf ." (trying to purge the cache of files I had removed after doing "git add .") without thinking git would physically delete the files. I don't have an initial commit/branch yet.
$ git init
$ git add .

I remember to add my ".gitignore". Then, out of being lazy and also not bothering to look up the proper command I did:
$ git rm -rf .

Now every file that git was tracking is gone. Oops.
How do I recover the files using the dangling blobs
$ git fsck
notice: HEAD points to an unborn branch (master)
notice: No default references
dangling blob 45cb2316b079df7898a28bab1389c87d37de4da5
dangling blob 06b9d0f91bb0643a54ec027efc0efd6645d95326
dangling blob c6c828230bc129da40928d55297577421c6f2e79
dangling blob 087b296f5ae80151fb0d6150927ebe8049ed7706
dangling blob c957743cb7ea533ce772d178394ce9f656b17b7c
dangling blob 0ea745612b105394f5cd5c0119a829de98a0a954
dangling blob 8fb1fa03c12cd56d4e2284008e92a3666bc60b93
dangling blob cf49a6cf77ac792b108577c01ccf88cb2c28228c
dangling blob 93817d9eeefea6ea894544e78b0e0970aa5adc46
dangling blob 94a9ed024d3859793618152ea559a168bbcbb5e2
dangling blob 574b7130959f2278c88946cf385fc49adcdf28c2
dangling blob 582f5bceb8b35c01fd7442678a3cd7e1088b7957
dangling blob d9fb7ca5775745b4332f630400d52c979aab35cd
dangling blob 2087b182bf8b4b8d5ed8fe45a50c7661bda25feb
dangling blob 6109baf32d04410c84d860501057a7f55a13f9dd
dangling blob 22cc2ac7585b1d47bccf2ecb7bf57e16c2142bb6
dangling blob 63b329443cc27273fad14c1e41de5bb9bf1bdd03
dangling blob a2296d429715c9b6d730fdcc972eefdf8273d2e2
dangling blob e41aedd7b2dbdee8b965a30d40ed0c9275194984
dangling blob 6dc7b06e8f03cda72cf223b050d07ccd2b850fc8
dangling blob ee52d86d94a40e7092dc34d1b2760244ec7dccaf
dangling blob 2ffa08c086d3702563d498c9069a345940b3a348
dangling blob 6fafa07526ad288ff2f6e26810ed9818eb18aabb
dangling blob b1cdf17b5bb40b4839cfc80f7e91bbcf7b94f798
dangling blob 353db77b88c248c752cdbd914787b9ebdf2d700f
dangling blob f61d3492ce0d0e396fd322114a5e3475886de1cc
dangling blob 7756a8713095390f5b106b81ae7f7247f762970b
dangling blob bc995b7f9f6806dd5678227579a515bb5768d3a0
dangling blob fce4a77b63b25abbc010859b4037589983820329
dangling blob 3e3335f8cd27168d4fe81f61421d647f2905b7b0
dangling blob 7f56efed4f8706e5b79408afbde197964d824eab

Looking around I could only find tutorials on recovering dangling commits.

A: You can use git show fce4a77b63b25abbc010859b4037589983820329to see the content (or git show fce4a > somefile to dump it to a file).
File names are lost (unless there are also dangling trees or other sources of information like command history in .bash_history).
If you can see (with git ls-tree) your root tree, you can create a commit with it using git commit-tree command or some git checkout  e48751c3b37a9cab692133202bbb933241f73f69 -- . to retrieve files.

A: I've recovered them in the past using the fsck command with the lost and found option:

git fsck --lost-found

Running that then saves the dangling blobs to the following path

.git/lost-found/other

A: Here's a script to convert the blobs to readable, .txt files.
Use the other answers (e.g., user909746's answer) to create and navigate to the lost-found folder.
From within the lost-found folder, run:
for FILE in *; do git show $FILE > "$FILE.txt"; done

This will create a .txt copy of every blob and add it to the current directory, which is the lost-found folder. You can now filter using your file explorer of choice for .txt files and browse them all to find the files you need.

A: See here: http://schacon.github.com/git/user-manual.html#dangling-objects

For commits, you can just use:
    $ gitk <dangling-commit-sha-goes-here> --not --all

This asks for all the history reachable from the given commit but not from any branch, tag, or other reference. If you decide it's something you want, you can always create a new reference to it, e.g.,
    $ git branch recovered-branch <dangling-commit-sha-goes-here>

For blobs and trees, you can't do the same, but you can still examine them. You can just do
    $ git show <dangling-blob/tree-sha-goes-here>

Usually, dangling blobs and trees aren't very interesting. They're almost always the result of either being a half-way mergebase (the blob will often even have the conflict markers from a merge in it, if you have had conflicting merges that you fixed up by hand), or simply because you interrupted a "git fetch" with ^C or something like that, leaving some of the new objects in the object database, but just dangling and useless.


text:
Q: Attach item to campaign after deployment Let me reword this:
I'd like to attach an email to a campaign, in campaign manager, after it has already deployed and still have the stats (opens, clicks, etc...) show up in the campaign for reporting purposes. I ask this because the email was not attached to said campaign before it was deployed. I would like to access the statistics for this email in the campaign for reporting purposes.
Is there any way to do this or do I need to have ExactTarget do this on their own back-end databases?

A: Yes you can.  Click on the email, select properties and then edit.  From here you can add the campaign from the upper right side.


text:
Q: Disable the Navigation of the TabBar Is it possible to disable the Navigation of a TabBarController?
Background: I want to do the event handling by myself...
        ViewControllerSelected += (sender, e) =>
        {
            // Take action based on the tab being selected
            switch (TabBar.SelectedItem.Title)
            {
                case "Test":
                    // Do something... like your own navigation
                    break;
            }
        };

Thank you very much for your help.


text:
Q: How to map ggplot stat_sum to size aesthetics? In my understanding ggplot's stat methods take arrays of values and calculate new values which can be displayed by certain aesthetics. I would like the size of the points to be proportional with the sum of a numeric variable within each group (unique x, y combinations). I was surprised that whenever there were more than one values in one group multiple points have been plotted instead of one point representing the sum of all. Here is a minimal working example:
ex_data <- data.frame(
    a = sort(rep(letters[1:4], 5)),
    b = rep(letters[6:7], 10),
    c = rnorm(20, 1000, 500),
    d = rep(c('h', 'h', 'i', 'i'), 5)
)

p <- ggplot(ex_data,
    aes(x = b, y = a, size = log10(c), color = d, shape = d)) +
    geom_point(stat = 'sum', alpha = 0.33) +
    scale_radius(guide = guide_legend(title = 'c (log)')) +
    scale_color_manual(values = c('cyan', 'magenta'),
                    guide = guide_legend(title = 'd'),
                    labels = c('h', 'i')) +
    scale_shape_manual(values = c(15, 18), guide = FALSE) +
    theme_bw()

print(p)

Thanks to low alpha it is visible that for example at c-f and a-f multiple points of the same color are plotted over each other. How I could achieve to have one point for each color at each location and the size of these marks represent the sum of all values of log10(c) variable within that group?

A: I believe you need to reshape the data somehow. Here is my example (with data.table and dplyr)
ex_data_2 <- data.table(ex_data) %>%
    .[, list(c = sum(c),
             d = which.max(table(d))), by = list(a, b)] %>%
    .[, d := c('c', 'd')[d]]
p <- ggplot(ex_data_2,
            aes(x = b, y = a, size = log(c), color = d, shape = d)) +
    geom_point(stat = 'sum', alpha = 0.33) +
    scale_radius(guide = guide_legend(title = 'c (log)')) +
    scale_color_manual(values = c('cyan', 'magenta'),
                       guide = guide_legend(title = 'd'),
                       labels = c('h', 'i')) +
    scale_shape_manual(values = c(15, 18), guide = FALSE) +
    theme_bw()
p

A: It looks like stat='sum' is able to work together only with y aesthetics, hence we need to aggregate the data and apply statistics before going to ggplot. Here is a working example with dplyr. (Note: Stack Overflow reviewers did not allow me to edit MAK77's reply and accept it, that's the only reason I am writing a new answer.)
require(dplyr)
require(ggplot2)

ex_data <- data.frame(
    a = sort(rep(letters[1:4], 5)),
    b = rep(letters[6:7], 10),
    c = rnorm(20, 1000, 500),
    d = rep(c('h', 'h', 'i', 'i'), 5)
)

ex_data_2 <- ex_data %>%
        group_by(a, b, d) %>%
        mutate(csum = sum(c)) %>%
        summarise_all(first)

p <- ggplot(ex_data_2,
            aes(x = b, y = a, size = log(csum), color = d, shape = d)) +
    geom_point(alpha = 0.33) +
    scale_radius(guide = guide_legend(title = 'c (log)')) +
    scale_color_manual(values = c('cyan', 'magenta'),
                    guide = guide_legend(title = 'd'),
                    labels = c('h', 'i')) +
    scale_shape_manual(values = c(15, 18), guide = FALSE) +
    theme_bw()
p


text:
Q: Cannot shut down/restart without using the power button please help I have Lenevo C260 Desktop.. it had windows 8.1 I deleted it and installed the latest version of Ubuntu..,
everything works fine but when i have to shut down  my computer it will kill all the running process but the machine doesn't shut down   the fan and led indicators remain on i have to press and hold of the power button to shut down manually
i tried this
sudo -i (to get a root shell, sudo gedit is not recommended)
gedit /etc/default/grub
Find the line: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
Change this to: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi=force"
Save the file and close the file.
Finally, in terminal: update-grub
exit (to end the root shell)

and even  tried sudo shutdown -h now in terminal but that doesn't turn off the machine although it does turn off system but not machine..,  i know many have asked this questions but  i couldn't get any solution from most of it .., please Give solution..!!

A: man shutdown would have been of use to you.
sudo shutdown -P now will power down the system now.
the -h switch only halts the system and doesn't power it down.


text:
Q: Define variables about Player_HP and Damage The variables created below define the Damage Amount coming from the Player and Opponent. After that, comes the part of LIFE, where each one takes X percentage of life depending on the given DAMAGE. Then, the remaining LIFE of the variables $ player_hp and $ opponent_hp is inserted in DATABASE. (UPDATE says "player_health =?".
Error: Every time I make an attack, it removes LIFE ($ player) and adds MORE LIFE (it should remove until it is negative) in DATABASE to OPPONENT ($ opponent), but simply ADDs more life to the opponent.
 Exemp: $player_damage = 1200
        $opponent_damage = 500

        $player_hp = 100(hp) - $opponent_damage
        $opponent_hp = 100(hp) - $player_damage

The database show basically like this:
  Player_VIDA = -400
  Opponent_VIDA = 600

I've tried user on UPDATE player_health = player_health -?, But it's the same.
My used code:
$player_damage = rand(5, $player_status['attack']);
$player_damage = $player_damage - ($opponent_status['defense'] * 0.3);

$opponent_damage = rand(5, $opponent_status['attack']);
$opponent_damage = $opponent_damage - ($player_status['defense'] * 0.3);

//add def to the health and subtract with damaged
$player_hp = round($opponent_damage - $player_status['health']);
$opponent_hp = round($player_damage - $opponent_status['health']);

Solution: I need to know why the PLAYER and OPPONENT_HP are positive, they should SUBSTRACT to negative.


text:
Q: abrir links mo webview sem ter colocado http:// ou https:// Estou criando um browser para android, mas estou com dificuldade de conseguir rodar a url sem a necessidade do protocolo no link como por exemplo abrir www.google.com e o app automaticamente colocar o http:// para ficar http://www.google.com e o webeview reconhecer o link.
segue em baixo meu MainActivity
public class MainActivity extends AppCompatActivity {
    //definir na programação ---
    private android.widget.Button botaoNav;

    private android.widget.EditText urlNav;

    private android.webkit.WebView navegadorNav;
    //---

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // achar oque cada variavel é, nome do elemento  no FindViewById
        botaoNav = (android.widget.Button) findViewById(R.id.botaoPesquisar);
        urlNav = (android.widget.EditText)  findViewById(R.id.urlPesquisar);
        navegadorNav = (android.webkit.WebView) findViewById(R.id.navegador);

        //definir java script
        navegadorNav.getSettings().setJavaScriptEnabled(true);

        //definir app como navegador
        navegadorNav.setWebViewClient(new android.webkit.WebViewClient());

        //Ação pesquisar

        botaoNav.setOnClickListener(new android.view.View.OnClickListener(){
            @Override
            //carregar url
            public void onClick(android.view.View v){
                navegadorNav.loadUrl(urlNav.getText().toString());
            }
        });
    }
}

A: Uma extensão da lógica do Woton Sampaio
botaoNav.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        // Remover possíveis espaços em branco no início e no fim da string
        String url = urlNav.getText().toString().trim();

        if (!url.startsWith("http://"))
            url = "http://" + url;

        navegadorNav.loadUrl(url);
    }
});


text:
Q: App crash if I try to open a fragment in an activity every time I try to open my fragment in my MainActivity.class my app crashs.
MainActivity.class
/* Menu */
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.add_server:
            Intent intent = new Intent(getApplicationContext(), AddServerFragment.class);
            startActivity(intent);
            return true;
        case R.id.menu_refresh:
            myWebView.reload();
            return true;
        default:
            return true;
    }
...
 public class AddServerFragment extends Fragment {

    public AddServerFragment(){

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState){
        View rootView = inflater.inflate(R.layout.add_ip, container, false);

        Button btn_back, btn_add;
        final EditText server_ip, server_name;

        server_ip = (EditText) findViewById(R.id.edit_server_address);
        server_name = (EditText) findViewById(R.id.edit_server_name);

         /* Back Button */
        btn_back = (Button) findViewById(R.id.btn_back);
        btn_back.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                Intent intent = new Intent(getApplicationContext(), MainActivity.class);
                startActivity(intent);
            }
        });

        /* Add IP Button */
        btn_add = (Button) findViewById(R.id.btn_add);
        btn_add.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                String new_server_ip = null, new_server_name = null;

                ArrayList<String> server_name_list = new ArrayList<String>();
                ArrayList<String> server_ip_list = new ArrayList<String>();

                new_server_ip = server_ip.getText().toString();
                server_ip_list.add(new_server_ip);

                new_server_name = server_name.getText().toString();
                server_name_list.add(new_server_name);
            }
        });

        return rootView;
    }
}

My errorlog only say, I have to add the Fragment in my Manifest.xml as activity. But I know, I don't have to add it there.
Errorlog
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime: FATAL EXCEPTION: main
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime: Process: de.kwietzorek.fulcrumwebview, PID: 18345
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime: android.content.ActivityNotFoundException: Unable to find explicit activity class {de.kwietzorek.fulcrumwebview/de.kwietzorek.fulcrumwebview.MainActivity$AddServerFragment}; have you declared this activity in your AndroidManifest.xml?
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1794)
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1512)
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.app.Activity.startActivityForResult(Activity.java:3917)
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.app.Activity.startActivityForResult(Activity.java:3877)
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:784)
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.app.Activity.startActivity(Activity.java:4200)
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.app.Activity.startActivity(Activity.java:4168)
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at de.kwietzorek.fulcrumwebview.MainActivity.onOptionsItemSelected(MainActivity.java:90)
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.app.Activity.onMenuItemSelected(Activity.java:2908)
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.support.v4.app.FragmentActivity.onMenuItemSelected(FragmentActivity.java:361)
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.support.v7.app.AppCompatActivity.onMenuItemSelected(AppCompatActivity.java:147)
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.support.v7.internal.view.WindowCallbackWrapper.onMenuItemSelected(WindowCallbackWrapper.java:100)
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.support.v7.app.AppCompatDelegateImplV7.onMenuItemSelected(AppCompatDelegateImplV7.java:621)
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.support.v7.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:811)
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.support.v7.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:153)
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.support.v7.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:958)
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.support.v7.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:948)
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.support.v7.internal.view.menu.MenuPopupHelper.onItemClick(MenuPopupHelper.java:191)
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.widget.AdapterView.performItemClick(AdapterView.java:310)
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.widget.AbsListView.performItemClick(AbsListView.java:1145)
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.widget.AbsListView$PerformClick.run(AbsListView.java:3042)
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.widget.AbsListView$3.run(AbsListView.java:3879)
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.os.Handler.handleCallback(Handler.java:739)
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:95)
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.os.Looper.loop(Looper.java:148)
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at android.app.ActivityThread.main(ActivityThread.java:5417)
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Native Method)
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
11-14 15:22:05.935 18345-18345/de.kwietzorek.fulcrumwebview E/AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Edit
My Manifest.xml
<?xml version="1.0" encoding="utf-8"?>

<uses-permission android:name="android.permission.INTERNET" />

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

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

A: Wrong with the above code:

ERROR     Intent intent = new Intent(getApplicationContext(), AddServerFragment.class);
                startActivity(intent);
    Use the correct method for using fragment, you have used method for starting activity.

AddServerFragment is Fragment not activity.
For fragment to add in activity, you have to use the following approach:
In your activity,
XML code part in activity_main.xml:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/fragment_container"
     android:layout_width="match_parent"
     android:layout_height="match_parent" />

Java Code Part in MainActivity.class:
    if (findViewById(R.id.fragment_container) != null) {

        if (savedInstanceState != null) {
            return;
        }

        // Create an instance of AddServerFragment
        AddServerFragment firstFragment = new AddServerFragment();
        // if there are any extras
        firstFragment.setArguments(getIntent().getExtras());

        // Add the fragment to the 'fragment_container' FrameLayout
        getSupportFragmentManager().beginTransaction()
                .add(R.id.fragment_container, firstFragment).commit();
    }

A: You need to add the activity declaration to your manifest file:
<activity android:name=".MainActivity" >
</activity>

A: You cant use intent when you want open fragment.
You can try FragmentManager.
Example:
public void getFragment(Fragment fragment) {
    FragmentManager fm = getSupportFragmentManager();
    Fragment mFragment = fm.findFragmentById(R.id.fragment_container);

    if (mFragment == null) {
        mFragment = fragment;
        fm.beginTransaction()
                .add(R.id.fragment_container, mFragment)
                .commit();
    }
    if (mFragment != null) {
        mFragment = fragment;
        fm.beginTransaction().addToBackStack(null)
                .replace(R.id.fragment_container, mFragment)
                .commit();
    }
}


text:
Q: MongoDB create index of all text values of a key inside arrays I am trying to generate a mongodb index for the text values for the following keys: CVE_data_meta, vendor_name and product_name. The values are part of arrays.
My code is as follows:
col.createIndex({
    'cve.affects.vendor.vendor_data.vendor_name': 'text',
    'cve.affects.vendor.vendor_data.product.product_data.product_name': 'text',
    'cve.CVE_data_meta.ID': 'text'
  }).then(() => {
    db.close();

The issue i am running into is 'namespace name generated from index name "vulndbapi.nvd.$cve.affects.vendor.vendor_data.vendor_name_text_cve.affects.vendor.vendor_data.product.product_data.product_name_text_cve.CVE_data_meta.ID_text" is too long (127 byte max)'. Also, if i just try to index by CVE id, the search query is coming up empty.
The sample dataset. The actual dataset is much bigger.
    {
    "cve": {
        "data_type": "CVE",
        "data_format": "MITRE",
        "data_version": "4.0",
        "CVE_data_meta": {
            "ID": "CVE-2012-0001",
            "ASSIGNER": "cve@mitre.org"
        },
        "affects": {
            "vendor": {
                "vendor_data": [{
                    "vendor_name": "microsoft",
                    "product": {
                        "product_data": [{
                                "product_name": "windows_7",
                                "version": {
                                    "version_data": [{
                                        "version_value": "-",
                                        "version_affected": "="
                                    }]
                                }
                            },
                            {
                                "product_name": "windows_server_2003",
                                "version": {
                                    "version_data": [{
                                        "version_value": "*",
                                        "version_affected": "="
                                    }]
                                }
                            }
                        ]
                    }
                }]
            }
        }
    }
}

My query code is
col.find({
$text: {
    $search: 'CVE-2012-0001'
    // $search: 'firefox'
}
}).then((resolve) => {
console.log(resolve);
db.close();

How can i generate indexes when the value is part of an array, and index all the items of that array? The final collection will exceed 50K items

A: The default name for an index is the concatenated names of the included fields, which ends up being too long in your case. The solution is to provide your own name for the index:
col.createIndex({
    'cve.affects.vendor.vendor_data.vendor_name': 'text',
    'cve.affects.vendor.vendor_data.product.product_data.product_name': 'text',
    'cve.CVE_data_meta.ID': 'text'
  }, {name: 'vendor_product_text_index'})


text:
Q: Computer wakes up from Sleeping Mode Sorry for my English.
Computer wakes up after being put to 'sleep' mode. And i don't know what to do. powercfg -lastwake shows similar to this:
Wake History Count - 1
Wake History [0]
Wake Source Count - 1
Wake Source [0]
Type: Device
Instance Path: PCI\VEN_8086&DEV_A36D&SUBSYS_50071458&REV_10\3&11583659&0&A0
Friendly Name: Intel(R) USB 3.1 eXtensible Host Controller - 1.10 (Microsoft)
Description: USB xHCI Compliant Host Controller
Manufacturer: Generic USB xHCI Host Controller

Assuming that this port is a problem, i already uninstalled it and rebooted the system, but it dont seems to work. powercfg -requests are clear. All drivers are up-to-date. At this point i don't know what to do.

*

*Aorus Gigabyte B360

*i5-9400F

A: Windows 10 64-bit.
Why is my PC awake?
Your human interface devices and / or mouse and / or keyboard and / or network adapter and / or BIOS and / or Scheduled Task and / or Windows Update and / or Automatic Maintenance is set to wake your PC.
It is not uncommon to find your PC awake.
Powershell command: Which Scheduled Tasks wake the PC?
Get-ScheduledTask | where {$_.settings.waketorun}

Learn to live with it:
Require sign-in when PC wakes from sleep:
%windir%\explorer.exe ms-settings:signinoptions

Change your power management settings: Create a shortcut on your desktop to a batch file to change your power management settings. C:\Windows\_61.bat minpower
@rem Change power management settings. Windows 10 64-bit. Does not require admin privileges.
@echo off
setlocal enableextensions disabledelayedexpansion
GOTO :%1
:normalpower
POWERCFG /CHANGE /MONITOR-TIMEOUT-DC 10
POWERCFG /CHANGE /DISK-TIMEOUT-DC 29
POWERCFG /CHANGE /STANDBY-TIMEOUT-DC 30
POWERCFG /CHANGE /MONITOR-TIMEOUT-AC 10
POWERCFG /CHANGE /DISK-TIMEOUT-AC 29
POWERCFG /CHANGE /STANDBY-TIMEOUT-AC 30
exit /b
:minpower
POWERCFG /CHANGE /MONITOR-TIMEOUT-DC 1
POWERCFG /CHANGE /DISK-TIMEOUT-DC 2
POWERCFG /CHANGE /STANDBY-TIMEOUT-DC 3
POWERCFG /CHANGE /MONITOR-TIMEOUT-AC 1
POWERCFG /CHANGE /DISK-TIMEOUT-AC 2
POWERCFG /CHANGE /STANDBY-TIMEOUT-AC 3
exit /b

Put the PC to sleep when it has been idle for 10 minutes:

*

*Create a Scheduled Task to run psshutdown.exe -d -t 0 -accepteula
when the PC has been idle for ten minutes.

*Psshutdown must be run in a window with admin privileges.

*-rundll32.exe powrprof.dll,SetSuspendState 0,1,0 prevents wakeup by scheduled task.

Right click Start - click Device Manager - expand Human Interface Devices, Keyboards, Mice and other pointing devices, Network Adapters, and Universal Serial Bus Controller.

*

*Uncheck allow this device to wake the computer.

*Network Adapters: only allow a magic packet to wake the computer OR

*All wake on "Magic Packet" or "Pattern Match" or "Link Settings" of all network adapters are set to "Disabled" in the Advanced settings of the devices in Device Manager.

Go to BIOS - Power Management and disable Wake by mouse, Wake by keyboard, Resume by alarm, Power on by keyboard, Power on by mouse, Wake on LAN, Wake setup, ...
I put my PC to sleep, woke it up with the USB mouse, ran powercfg -lastwake:

Previous powercfg -lastwake was:

I put my PC to sleep, woke it up with the USB keyboard, ran powercfg -lastwake:
Wake History Count - 1
Wake History [0]
  Wake Source Count - 1
  Wake Source [0]
    Type: Device
    Instance Path: PCI\VEN_8086&DEV_8C31&SUBSYS_50071458&REV_05\3&11583659&0&A0
    Friendly Name: Intel(R) USB 3.0 eXtensible Host Controller - 1.0 (Microsoft)
    Description: USB xHCI Compliant Host Controller
    Manufacturer: Generic USB xHCI Host Controller
Automatic Maintenance: Left click Start. Type Control Panel. Click Control Panel App - Security and Maintenance - Maintenance - Change maintenance settings

See How to tell what wake source is when Wake Source: Unknown
Why is my computer awake? PC wakes up when everything is set to never wake. PC unexpectedly awake.

A: Computer wakes up from Sleeping Mode
I had the same problem the past few days, but I got mine fixed.  Whether this solves it for you - we will have to see:
Out of the clear blue, my machine would wake up immediately after putting it to sleep.
There have been no recent hardware or software changes.
After a wakeup, running "powercfg -lastwake" gave same result listed above:
Instance Path: PCI\VEN_8086&DEV_A36D&SUBSYS_50071458&REV_10\3&11583659&0&A0
Friendly Name: Intel(R) USB 3.0 eXtensible Host Controller - 1.10 (Microsoft)
Description: USB xHCI Compliant Host Controller
Manufacturer: Generic USB xHCI Host Controller
I did all of the usual software checks and tweaks, and I was unable to correct the problem.
When I first got my current Win10 machine, I had all kinds of wake up problems, but I have since squashed them all, so this was new, and seemed odd that the usual config tweaks, registry hacks, and so on did not solve it.
While I am just as apt as anyone to blame Microsoft for a buggy OS, the fact that this is a host controller / usb issue does imply something hardware.
Since I have set all of my mice and keyboards to "do not wake up", perhaps the problem was in the usb controllers or hubs.
First thing I did was go to device manager and uninstall that driver (the usb 3 host controller).
I was hoping it would just disable the USB 3 ports, but it basically shut down all usb, so my mouse and keyboard would not work.
I turned off the machine from the front panel, and restarted it.
The OS found "new" hardware, reinstalled the driver and devices.
Once booted, I tried to sleep - same problem, system woke right up.
So, resetting the driver did not help.
So, next tweak - turn off the usb peripheral devices.
I have several multi-port usb hubs plugged in.
One sits right on my desk, and it has a master on-off switch.  That was the easiest to reach hub, so I chose that one first.  I turned off the power to that hub (if it did not have a switch, I would have unplugged it).  My main mouse and keyboard are not on that, so I could continue working.
Then, I put the system, to sleep - no problems! - all normal!
I then turned the device back on, but unplugged each device attached.
One by one I reinserted the peripherals then put the machine to sleep - no problems.
After getting all eight devices back online, still no problems - the machine slept as it should.
It seems that the hub itself was the problem, and that turning it off then rebooting it cleared whatever it was doing.
That particular powered hub has been buggy before, and I have plugged devices into it causing power surges or transient shutdown of a plugged in device.  It was so infrequent that I never bothered to crawl under the desk to replace it.
I do recall that the day or day before that the sleep problem started, that I had plugged in some old flash drives, so one of them I suppose caused some kind of surge and latched up something in the hub.
Now, it is gone, a new hub in its place, and hopefully the problem will not resurface.
My suggestion - after doing all of the software and OS tweaks already suggested in this thread - because they are good things to do no matter what - try to troubleshoot the hardware, specifically usb hubs and devices.
Take your mouse and keyboard and plug them directly into your rig through a usb 2 or usb 1 port, then disconnect or power down all other hubs.
If that solves the sleep problem, then it is just a matter of being methodical as you bring each device back online and check to see if the sleep problem recurs.
What a relief.
I hope this works out as well for you as it did for me.


text:
Q: How to configure outgoing connections from an SQL stored procedure? I am working on a .NET project which uses Microsoft SQL server. In this project, I need a CLR stored procedure (written in C#) that uses a remote web service. So, when the stored procedure is executed on the SQL server, it makes web service calls and thus sends packets to a remote location. The problem is that when executing the SP I get:
"System.Net.WebException: The request failed with HTTP status 403: Forbidden."
The database user has full permission, the deployed CLR assembly and SP are even marked "unsafe", I tried signing it etc., so any of that is not causing the problem.
When I am executing the very same C# code, but from a simple console application instead of as a SP, it all works fine. So I started to suspect a network related problem and had a packet sniffer running when executing both the SP and the console app version.
What I realized was that the packets sent out had different destination IP addresses: the console app sent the packets directly to the web service IP while the SP sent the packets to a proxy server we use in our company. Due to network policies the latter is not allowed and that explains the "403 Forbidden" exception.
So my question boils down to this: How can I configure the SP/MS SQL server to NOT use that proxy? I want it to send the packets directly to the web service IP, just like the test console app. (again, the C# code is the same , so it's not a programming matter).
I've disabled all proxy settings in Internet Explorer in case the SQL server inherits these settings or something. However, no luck.
Any help would be greatly appreciated!
Best regards,
Peter

A: Don't make HTTP web calls from SQL CLR.
Make all Web service calls from an outside process. Unless you want to find your production server frozen in worker starvation with all threads blocked in CLR events. You have been warned.

A: The most likely explanation is some kind of network level transparent proxy. I would discuss the issue with whoever manages/administers your network.


text:
Q: convert system datatime to milliseconds My input is 12/26/2013 12:19:47 PM
My output format is 1388078387000.
I am using this link to convert datetime to milliseconds.
please give me answer.

A: Make use of
(DateTime.Now - DateTime.MinValue).TotalMilliseconds;

here inplace of DateTime.Now you can take your date. and you can easily find total miliseconds

A: try this
long milliseconds = DateTime.Now.Ticks

or
long milliseconds = TimeSpan.TicksPerMillisecond;


text:
Q: how to get data from array in json format in javascript I have faced a problem. When I use http://headers.jsontest.com/  then I get value. Here is my code

But when I use this link I don't get any value My Link. Why it's not working
getJSON('http://67.225.137.209/index.php/queue_manage_api/queue/doc_id/3536/loc_id/4696/username/9791a47fef07649b1c3e70749e898153/password/2d593e25d0560b19fd84704f0bd24049/format/json').then(function(data) {

    for(x in data){
       ip.innerText = data.id;
    }

    },  function(status) {
        alert('Something went wrong.');
});

If a default data format {data} then I get default value But when data format like [{data}] then I don't get any value also. And my data format like [{data}] this. So how to get my data

A: Browser security is firing. You need to enable CORS by adding this header to your reply:
Access-Control-Allow-Origin:*

If you look the Network tab (F12), you will see that http://headers.jsontest.com/ is already doing it.
Here you can read more info about CORS: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
If the server is not yours and you can't add CORS, then they will have a reason to not do that (Is called security because a reason xD). Maybe they don't noticed and you can ask them to enable it.
Protip: When checking front-end code, always do it with the Developer Tools (F12) open (console tab).

A: I have edited my code below and It works fine. It gives me desired output.


text:
Q: NSLocationAlwaysUsageDescription purpose issue We identified one or more issues with a recent delivery for your app, "my application name" Your delivery was successful, but you may wish to correct the following issues in your next delivery:
ITMS-90683: Missing Purpose String in Info.plist - Your app's code references one or more APIs that access sensitive user data. The app's Info.plist file should contain a NSLocationAlwaysUsageDescription key with a user-facing purpose string explaining clearly and completely why your app needs the data. Starting Spring 2019, all apps submitted to the App Store that access user data are required to include a purpose string. If you're using external libraries or SDKs, they may reference APIs that require a purpose string. While your app might not use these APIs, a purpose string is still required. You can contact the developer of the library or SDK and request they release a version of their code that doesn't contain the APIs. Learn more (https://developer.apple.com/documentation/uikit/core_app/protecting_the_user_s_privacy).
I got this message from App Store Team. It says that your delivery was successful but I forget to add purpose for the  NSLocationAlwaysUsageDescription for location purpose.
if now I submit the application for review.Is there a chance that the application is rejected or it will submit successfully.
is it okay to update this change in next delivary


text: Q: Does http to https log out a user concrete5 On my Concrete5 website a user sometimes gets logged out right after logging in when they view a checkout page with https in the url (SSL). None of the other pages have SSL (https in url), not even the login. Is it possible that logging in non-ssl then visiting a page with SSL would log out the user?


text:
Q: Taking and restoring an image of partition with dd I created a new partition on my server /dev/sda4 with a filesystem based on ext3.
I mounted the new partition /dev/sda4 on /mnt/sda4/ and created an image with dd of the partition /dev/sda3. sda3 is mounted on the root folder (cd /) so it contains the most important files.
Creation of the image:
dd if=/dev/sda3 of=/mnt/sda4/backup.img

Then I removed a file on /var/www/html/ which is on the partition sda3. I tried to restore the image and it worked, but the file which I removed earlier isn't in back in place.
restoring:
dd if=/mnt/sda4/backup.img of=/dev/sda3

Output:
[root@h9999 sda4]# dd if=backup.img of=/dev/sda3
982128+0 records in
982128+0 records out
502849536 bytes (503 MB) copied, 1.13645 s, 442 MB/s

So actually it should work, shouldn't it?

A: There are several reasons why this may have failed: /var/www/html could actually be a symlink to somewhere else in your filesystem (try ls -la /var/www/ to see if there is a line like html -> /foo/bar/html. If /dev/sda3 was mounted during either of your dd processes, the filesystem may have been corrupted so that you don't see that file any more.
Using dd is in most cases not the best way to make a backup image of a disk, because dd copies everything including empty sectors and can only restore to a disk/partition of exactly the same size. Try partimage instead, which will copy only used sectors.
In most cases, using tar is actually the best option to create a backup of linux filesystems because this gives you independence of the filesystem and partition size used in the original partition and thus make the restoring process much more flexible. If you are worried about loosing the boot loader, the link I gave above also explains how you can restore the boot loader during the restoration process using a live cd, which is just a few additional lines of code apart from creating the partitions.


text:
Q: Como recarregar data depois de uma ação VueJS Minha lista permanece a mesma depois de excluir um item, só atualiza quando aperto F5 na tela. Já tentei utilizar componentKey, mas só funciona quando dou 2 cliques.
Segue código atual do componente:
<template>

        ID
        Nome
        Raça
        #

        {{ d.id }}
        {{ d.titulo }}
        {{ d.conteudo }}
        <button @click="deleteDog(d.id)">Deletar</button>

</template>

A: Você pode remover o elemento da lista dog após fazer a chamada da API, usando simples métodos de array.
Dentro do método deleteDog:
deleteDog(id) {
  api.delete("dog/" + id).then(() => {
     // localiza o indice do elemento no array
     const index = this.dog.findIndex(dog => dog.id === id)

     if (index >= 0) {
        // remove apenas ele do array
        this.dog.splice(index, 1)
     }
  });
}

Ou, chamar a API novamente, que irá trazer os dados atualizados. Pode não ser muito elegante fazer uma chamada toda vez que excluir um elemento, mas pode ser feito:
deleteDog(id) {
  api.delete("dog/" + id).then(() => {
     // chama novamente a API com os dados atualizados
     api.get("dogs").then((response) => (this.dog = response.data));
  });
},

Como o Vue trabalha com o conceito de View em função do estado, alterar o valor de dog vai ocasionar o refresh somente do componente que tem esse estado, sem precisar apertar F5.

A: A sua array está sendo populada no momento em que a view é montada, então qualquer alteração na api que ocorra depois disso não vai ser refletida na sua array de resultados. Para que as alterações no view ocorram, você deve atualizar (excluir o item em específico) a sua array toda vez que o método deleteDog for acionado.
Vue é reativo, então se você modificar a array, ele vai recarregar o elemento automaticamente, o problema é que esse o método deleteDog atualiza apenas a fonte de dados.
Existem meios de essas atualizações serem feitas automaticamente, a depender do framework ou pacotes que você utiliza. O Meteor, por exemplo, mantém uma cópia do banco de dados no navegador, que fica sincronizada com o banco original, então todas as alterações são refletidas na view para todo mundo que está vendo, mas você pesquisar mais sobre isso depois.


text:
Q: How to properly check if a prefix of a word exists in a trie? Currently I have the "searchPrefix" function of my Trie class defined as such:
public Boolean searchPrefix(String word) {
    TrieNode temp = this.root;
    for(int i = 0; i < word.length(); i++){
        if(temp.children.get(word.charAt(i)) == null) return false;
        else temp = temp.children.get(word.charAt(i));
    }
    return (temp.children.isEmpty()) ? false : true;
}

This function is supposed to return "true" when the input string is a prefix of a word that exists inside of the trie object. Here is the TrieNode class for reference:
class TrieNode {
   Character c;
   Boolean isWord = false;
   HashMap<Character, TrieNode> children = new HashMap<>();

   public TrieNode() {}
   public TrieNode(Character c) {
    this.c = c;
   }
}

According to this online judge, I am incorrectly determining whether a given input string is a prefix.  Can anyone shed some light as to why this is an incorrect method?  My thinking is that when we get to the node that is the end of the input string, if the node has children it is a prefix of some other word so we return true.  However this is apparently incorrect.

A: I think you are not handling the case where prefix is a terminal word in the trie.
For example, assume there's only one word hello in a trie.
Your implementation will return false for searchPrefix("hello").
To fix it, you need to check the isWord flag too:
public Boolean searchPrefix(String word) {
    TrieNode temp = this.root;
    for (int i = 0; i < word.length(); i++){
        TrieNode next = temp.children.get(word.charAt(i));
        if (next == null) {
            return false;
        }
        temp = next;
    }
    return !temp.children.isEmpty() || temp.isWord;
}


text:
Q: Populate inputs by number angularjs I am trying to populate input by typing the number in input[number].
Why this doesn't work

// Code goes here

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

app.controller('MainCtrl', function($scope) {
    $scope.lengInput = {
        count: 0,
        values: [],
        fill: function(limit) {
            var sequence = [];
            for (var i = 0; i < limit; i++) {
                sequence.push(i);
            }
            return sequence;
        }
    };
});
<!DOCTYPE html>

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

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

Hello {{name}}!

    <input ng-model="lengInput.count" type="number" min="1" max="20">

            <input ng-model="lengInput.values[i]" />

since this is working
JSFiddle Demo
Please find my mistake.

A: Instead of attaching the function directly to the ng-repeat, you can use ng-init to intialize the $scope.lengInput.values and add an ng-change to the input field where $scope.lengInput.count is getting set, so that the function does not get run every time, instead it runs only when the value in the input box has changed!

// Code goes here

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

app.controller('MainCtrl', function($scope) {
  $scope.lengInput = {
    count: 0,
    values: [],
    fill: function(limit) {
      var sequence = [];
      for (var i = 0; i < limit; i++) {
        sequence.push(i);
      }
      $scope.lengInput.values = sequence;
    }
  };
});
<!DOCTYPE html>

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

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

Hello {{name}}!

  <input ng-model="lengInput.count" type="number" min="1" max="20" ng-change=" lengInput.fill(lengInput.count)">

      <input ng-model="lengInput.values[i]" />


text:
Q: Stacking monads Writer and OptionT I have the following code:
override def getStandsByUser(email: String): Try[Seq[Stand]] =
  (for {
    user <- OptionT(userService.findOneByEmail(email)): Try[Option[User]]
    stands <- OptionT.liftF(standService.list()):[Try[List[Stand]]]
    filtered = stands.filter(stand => user.stands.contains(stand.id))
  } yield filtered).getOrElse(Seq())
}

I want to add logging on each stage of the processing - so I need to introduce writer monad and stack it with monad transformer OptionT. Could you please suggest how to do that?

A: The best way to do this is to convert your service calls into using cats-mtl.
For representing Try or Option you can use MonadError and for logging you can use FunctorTell. Now I don't know what exactly you're doing inside your userService or standService, but I wrote some code to demonstrate what the result might look like:
type Log = List[String]

//inside UserService
def findOneByEmail[F[_]](email: String)
  (implicit F: MonadError[F, Error], W: FunctorTell[F, Log]): F[User] = ???

//inside StandService
def list[F[_]]()
  (implicit F: MonadError[F, Error], W: FunctorTell[F, Log]): F[List[Stand]] = ???

def getStandsByUser[F[_]](email: String)
(implicit F: MonadError[F, Error], W: FunctorTell[F, Log]): F[List[Stand]] =
  for {
    user <- userService.findOneByEmail(email)
    stands <- standService.list()
  } yield stands.filter(stand => user.stands.contains(stand.id))

//here we actually run the function
val result =
  getStandsByUser[WriterT[OptionT[Try, ?], Log, ?] // yields WriterT[OptionT[Try, ?], Log, List[Stand]]
    .run  // yields OptionT[Try, (Log, List[Stand])]
    .value // yields Try[Option[(Log, List[Stand])]]

This way we can avoid all of the calls to liftF and easily compose our different services even if they will use different monad transformers at runtime.

A: If you take a look at the definition of cats.data.Writer you will see that it is an alias to cats.data.WriterT with the effect fixed to Id.
What you want to do is use WriterT directly and instead of Id use OptionT[Try, YourType].
Here is a small code example of how that can be achieved:
object Example {

  import cats.data._
  import cats.implicits._

  type MyType[A] = OptionT[Try, A]

  def myFunction: MyType[Int] = OptionT(Try(Option(1)))

  def main(args: Array[String]): Unit = {
    val tmp: WriterT[MyType, List[String], Int] = for {
      _ <- WriterT.tell[MyType, List[String]](List("Before first invocation"))
      i <- WriterT.liftF[MyType, List[String], Int](myFunction)
      _ <- WriterT.tell[MyType, List[String]](List("After second invocation"))
      j <- WriterT.liftF[MyType, List[String], Int](myFunction)
      _ <- WriterT.tell[MyType, List[String]](List(s"Result is ${i + j}"))
    } yield i + j

    val result: Try[Option[(List[String], Int)]] = tmp.run.value
    println(result)
    // Success(Some((List(Before first invocation, After second invocation, Result is 2),2)))
  }

}

The type annotations make this a bit ugly, but depending on your use case you might be able to get rid of them. As you can see myFunction returns a result of type OptionT[Try, Int] and WriterT.lift will push that into a writer object that also has a List[String] for your logs.


text:
Q: Difference between Groovy def and Java Object? I'm trying to figure out the difference between
Groovy:
def name = "stephanie"

Java:
Object name = "stephanie"

as both seem to act as objects in that to interact with them i have to cast them to their original intended type.
I was originally on a search for a java equivalent of C#'s dynamic class ( Java equivalent to C# dynamic class type? ) and it was suggested to look at Groovy's def
for example my impression of groovy's def is that I could do the following:
def DOB = new Date(1998,5,23);
int x = DOB.getYear();

however this wont build
thanks,steph
Solution edit:
Turns out the mistake iw as making is I had a groovy class wtih public properties (in my example above DOB) defined with def but then was attemping to access them from a .java class(in my example above calling .getYear() on it). Its a rookie mistake but the problem is once the object leaves a Groovy file it is simply treated as a Object. Thanks for all your help!

A: You can experiment with groovy in the groovy web console http://groovyconsole.appspot.com/
Your initial groovy date example works.

A: Per se, there is not much difference between those two statements; but since Groovy is a dynamic language, you can write
def name = "Stephanie"
println name.toUpperCase() // no cast required

while you would need an explicit cast in the Java version
Object name = "Stephanie";
System.out.println(((String) name).toUpperCase());

For that reason, def makes much more sense in Groovy than unfounded use of Object in Java.


text:
Q: render Model's properties dynamically - Angular I have a model comes from backend with many properties, example:
item:{
Name,
Quantity,
Price,
...
}

and I'm rendering that model's properties in html like:

{{item.Name}}

{{item.Quantity}}

but if a new property added to the model I have to add it to the code.
I need a way to iterate the model's properties without write them in a hardcode way

A: Try something like this:

{{ item[key] }}

A: You can loop through object's properties using Object.entries() method
Object.entries(item)

Above method will return list of properties. Use that with ngFor in your html

A: You can use *ngfor directive in your HTML template
ngFor is a built-in directive in angular. it's easy to iterate over objects, arrays, etc using ngFor. You can think of ngFor is the same as for loop or foreach loop in JS.
Example:

{{ eachItem }}

Update
You can use angular builin KeyValuePipe that transform objects and maps into array of key value pairs. Check Docs
I implemented a small example check StackBlitz Example


text:
Q: What is ng-reflect-router-link? Why is not showing up for a button in inspect element section As far as I understand ng-reflect-router-link is used for debugging. And tells which link has the element being routed to. But ng-reflect-router-link is not showing up for me for a button.
I created two button in two different modules, keeping the whole process similar. Unfortunately, one button is working and other is not. And the html elements upon inspection is as follows:
Button that works:

<button _ngcontent-qun-c23="" class="btn btn-success" tabindex="0" ng-reflect-router-link="/tags/add">Add Tag</button>

Button that does not work:

<button _ngcontent-rvm-c25="" routerlink="['/languages/add']" class="btn btn-success">Add language</button>

What am I missing here? Any hints on how can I get rid of it?

A: I realized that it was a very small mistake: I had not imported the language module in app.module.ts. So even though, I have made all imports in the language.module.ts, only HTML data will be shown and the Angular elements will not work.


text:
Q: How to check for unique values in two columns with one query? I have a MySQL table where two of the fields are supposed to be unique.  As new data is offered up I need to check if it already exists, and so would like to do something like (PDO parameters included):
SELECT COUNT(foo),COUNT(bar)
FROM `mytable`
WHERE foo=:foo
OR bar=:bar;

The problem here is that if both values will come back with identical counts, so in the event of that count being 1 I don't know which column contains the matching value.  Obviously I could split this into 2 queries, but is there a neater way to check both at once?

A: Maybe something like this:
SELECT
    SUM(CASE WHEN foo='foo' THEN 1 ELSE 0 END) AS FooCount,
    SUM(CASE WHEN bar='bar' THEN 1 ELSE 0 END) AS BarCount
FROM
    `mytable`

A: Not really, but you could fake it like:
SELECT COUNT(foo) FROM `mytable` WHERE foo=:foo
UNION
SELECT COUNT(bar) FROM `mytable` WHERE bar=:bar;

or
SELECT (SELECT COUNT(foo) FROM `mytable` WHERE foo=:foo) AS `foo`, (SELECT COUNT(bar) FROM `mytable` WHERE bar=:bar) AS `bar`;

or
SELECT SUM(IF(foo=:foo, 1, 0)) as foo, SUM(IF(bar=:bar, 1, 0)) as bar FROM `mytable`

Between the three, you'll want to test to see which performs best.


text:
Q: get level of each node for a binary tree I am learning to implement a binary tree , I am trying to get the level of each node , I tried traversing from my root nodes to leaf node but wasn't able to get the right answer. Here is my code
public class BinaryTree
 {
 private Node root;

 /**
   Constructs an empty tree.
 */
 public BinaryTree() {
   root=new Node();
   root = null; }

 /**
   Constructs a tree with one node and no children.
  @param rootData the data for the root
 */
 public BinaryTree(Object rootData)
 { root=new Node();
 root.data=rootData;
  }

 /**
   Constructs a binary tree.
  @param rootData the data for the root
  @param left the left subtree
  @param right the right subtree
  */
 public BinaryTree(Object rootData, BinaryTree left, BinaryTree right)
  {
   root = new Node();
   root.data = rootData;
   root.left = left.root;
   root.right = right.root;
}

 class Node
  {
  public Object data;
  public Node left;
  public Node right;

  public String printTree(int level)
  {

     return null;

   }
  }

  int getLevelUtil(Node n, Object data, int level)
 {
   if (n == null)
       return 0;

   if (n.data == data)
       return level;

   int downlevel = getLevelUtil(n.left, data, level+1);
   if (downlevel != 0)
       return downlevel;

   downlevel = getLevelUtil(n.right, data, level+1);
   return downlevel;
  }

  /* Returns level of given data value */
 int getLevel(Node n, int data)
  {
   return getLevelUtil(n,data,1);
  }

 /**
  Returns the height of the subtree whose root is the given node.
  @param n a node or null
    @return the height of the subtree, or 0 if n is null
 */
 private static int height(Node n)
  {
   if (n == null) { return 0; }
   else { return 1 + Math.max(height(n.left), height(n.right)); }
  }

 /**
  Returns the height of this tree.
  @return the height
 */

 public Object data()
 {
 return root.data;
 }

 /**
  Gets the left subtree of this tree
  @return the left child of the root
 */
 public BinaryTree left()
 {
  return null;
 }

 /**
  Gets the right subtree of this tree
  @return the right child of the root
 */
 public BinaryTree right()
 {
  return null;
 }

   /**
   * Sets a new right child
   * @param child the new right child
   */
   public void setRight(BinaryTree child)
    {
   root.right=child.root;
  }

  /**
   * Sets a new left child
  * @param child the new left child
  */
  public void setLeft(BinaryTree child)
  {
   root.left=child.root;
  }

  public void setData(Object data)
 {
   root.data=data;
  }

  public boolean isLeaf()
  {
  if(root.left==null&& root.right==null)
      return true;
  else
      return false;
 }

  public String printTree()
  {
  String s=new String();

  s= s+printTree(root);
  return s;

  }

  public String printTree(Node parent)
 { String s=new String();

   if (parent == null) { return ""+" "; }
   s=s+parent.data+"(level:"+(height(parent))+")";

 s=s+printTree(parent.left);

 s=s+ printTree(parent.right);

   return(s);
     }

  }

Any way in which I can do this...???

A: I think you need to add PARENT property for each Node. If you have Parent property, the below code help you get level of a Node:
class Node
{
    public Object data;
    public Node left;
    public Node right;

    public Node parent;

    public int getLevel() {
        int level = 1;
        Node n = this;
        while (n != null && n.parent != null) {
            level++;
            n = n.parent;
        }
        return level;
   }
}

NOTE:

*

*I assume ROOT node has Level = 1

*You should not use PUBLIC for data member, you can use Private, Protected and use Getter/setter.

*Other note: Should not use RECURSIVE, it may cause StackOverflowException.


text:
Q: Parsing XML data with python - how to capture everything in a more pythonic way? The aim is to capture all data in an xml file. Once captured, im comparing it to a reference xml file to ensure nothing has changed and to then tell you what the differences are.
What i wrote works for what I need, but is very cumbersome and a bit messy! Is there a better way to iterate through all items at all depths of an xml file? The solution just has to be robust to capture everything.
Currently, iterating like I have below uses too may layers of iteration with try/except that is very ugly!
import xml.etree.ElementTree as ET

def xml_iter(file):

    tree = ET.parse(file)
    root = tree.getroot()

    namespaces = {}

    List = []
    Parent = []
    for elem in root:
        for i in elem:
            try:
                i = i.text.strip()
                List.append(i)
            except:
                pass

            for j in i:
                try:
                    j = j.text.strip()
                    List.append(j)
                except:
                    pass

                for k in j:
                    try:
                        k = k.text.strip()
                        List.append(k)
                    except:
                        pass
    return (List)

Any help would be greatly appreciated.

A: User Element.iter. It iterates recursively over all the sub-trees.
For your case, it would be something like:
dict_list = []
text_list = []
for node in root.iter():
    dict_list.append(node.attrib) # adds to list, the dictionary of attrib
    text_list.append(node.text)

# do the same for other file and compare dictionaries/strings in corresponding lists.

You can look at this official tutorial for examples.


text:
Q: How to access Vuex getters directly in data property? Please see this minimum example:
import { mapGetters } from "vuex";

export default {
  data() {
    return {
      text: this.myText // this throws error, because I can't access computed here.
    };
  },
  computed: {
    ...mapGetters(["myText"])
  }
};

As you can see, the above code throws error, I can't access computed in data property yet.
I know I can access Vuex state directly, but how about getters? The value I want is within Vuex getters.
Is it possible to directly access Vuex getters?


text:
Q: Merging XML files using Python's ElementTree and maintaining CDATA tags I pretty much reused the same bit of code from here merging xml files using python's ElementTree and I got it working. The XML files I am trying to merge look like this
A.xml
<root>
  <categories>
    <category name="Biology" />
  </categories>
  <app>
    <mainHeader><![CDATA[AP Biology]]></mainHeader>
    <questions>
      <question type="0" number="1" title="Biology #1">
        <images />
        <description><![CDATA[Which of the following is
        the site of protein synthesis?]]></description>
        <category><![CDATA[Biology]]></category>
        <choices>
          <choice name="A"><![CDATA[Cell wall]]></choice>
          <choice name="B" correct_answer="true"><![CDATA[Ribosomes]]></choice>
          <choice name="C"><![CDATA[Vacuoles]]></choice>
          <choice name="D"><![CDATA[DNA polymerase]]></choice>
          <choice name="E"><![CDATA[RNA polymerase]]></choice>
        </choices>
        <explanation><![CDATA[Answer: B, Ribosomes.  Translation, the
        process that converts mRNA code into protein, takes place in ribosomes.

Key Takeaway: Ribosomes are complexes of RNA and
        protein that are located in cell nuclei.  Ribosomes catalyze both the
        conversion of the mRNA code into amino acids as well as the assembly of
        the individual amino acids into a peptide change that becomes a protein.
        ]]></explanation>
      </question>
    </questions>
  </app>
</root>

B.xml
<root>
  <categories>
    <category name="Biology" />
  </categories>
  <app>
    <mainHeader><![CDATA[SAT Biology]]></mainHeader>
    <questions>
      <question type="0" number="1" title="Biology #1">
        <images>
        </images>
        <category><![CDATA[Biology]]></category>
        <description><![CDATA[The site of cellular respiration
        is:]]></description>
        <choices>
          <choice name="A"><![CDATA[DNA polymerase]]></choice>
          <choice name="B"><![CDATA[Ribosomes]]></choice>
          <choice name="C" correct_answer="true"><![CDATA[Mitochondria]]></choice>
          <choice name="D"><![CDATA[RNA polymerase]]></choice>
          <choice name="E"><![CDATA[Vacuoles]]></choice>
        </choices>
        <explanation><![CDATA[Answer: C, Mitochondria.
        The mitochondrion (plural mitochondria) is known as the "powerhouse"
        of the cell for its role in energy production.

        Key Takeaway: The mitochondrion is a membrane-bound organelle
        found in most eukaryotic cells.  The dominant role of the mitochondrion
        is the production of ATP through cellular respiration, which is
        dependent on the presence of oxygen.  All forms of cellular
        respiration, glycolysis, Krebs' cycle, and oxidative phosphorylation,
        take place within the mitochondria.]]></explanation>
      </question>
    </questions>
  </app>
</root>

This is the code I used to merge them
import os, os.path, sys
import glob
from xml.etree import ElementTree

def run(files):
    xml_files = glob.glob(files +"/*.xml")
    xml_element_tree = None
    for xml_file in xml_files:
        data = ElementTree.parse(xml_file).getroot()
        # print ElementTree.tostring(data)
        for question in data.iter('questions'):
            if xml_element_tree is None:
                xml_element_tree = data
                insertion_point = xml_element_tree.find('app').findall("./questions")[0]
            else:
                insertion_point.extend(question)
    if xml_element_tree is not None:
        print ElementTree.tostring(xml_element_tree)

And it works except that the output does not maintain the CDATA tags. To be specific, this is the output I get.
<root>
  <categories>
    <category name="Biology" />
  </categories>
  <app>
    <mainHeader>AP Biology</mainHeader>
    <questions>
      <question number="1" title="Biology #1" type="0">
        <images />
        <category>Biology</category>
        <description><b>Which of the following is the site
        of protein synthesis?</b></description>
        <choices>
          <choice name="A">Cell wall</choice>
          <choice correct_answer="true" name="B">Ribosomes</choice>
          <choice name="C">Vacuoles</choice>
          <choice name="D">DNA polymerase</choice>
          <choice name="E">RNA polymerase</choice>
        </choices>
        <explanation><b>Answer:</b> B, Ribosomes.
        Translation, the process that converts mRNA code into protein,
        takes place in ribosomes.<br /><br /><b>
        Key Takeaway: </b>Ribosomes are complexes of RNA and protein
        that are located in cell nuclei.  Ribosomes catalyze both the
        conversion of the mRNA code into amino acids as well as the assembly
        of the individual amino acids into a peptide change that becomes
        a protein.</explanation>
      </question>
      <question number="1" title="Biology #1" type="0">
        <images>
        </images>
        <category>Biology</category>
        <description><b>The site of cellular respiration is:</b>
        </description>
        <choices>
          <choice name="A">DNA polymerase</choice>
          <choice name="B">Ribosomes</choice>
          <choice correct_answer="true" name="C">Mitochondria</choice>
          <choice name="D">RNA polymerase</choice>
          <choice name="E">Vacuoles</choice>
        </choices>
        <explanation><b>Answer:</b> C, Mitochondria.  The
        mitochondrion (plural mitochondria) is known as the “
        powerhouse” of the cell for its role in energy production.
        <br /><br /><b>Key Takeaway: </b>The
        mitochondrion is a membrane-bound organelle found in most
        eukaryotic cells.  The dominant role of the mitochondrion is the
        production of ATP through cellular respiration, which is dependent
        on the presence of oxygen.  All forms of cellular respiration,
        glycolysis, Krebs’ cycle, and oxidative phosphorylation,
        take place within the mitochondria.</explanation>
      </question>
    </questions>
  </app>
</root>

While the output that I want is this
<root>
  <categories>
     <category name="Biology" />
   </categories>
  <app>
    <mainHeader><![CDATA[AP Biology]]></mainHeader>
    <questions>
       <question type="0" number="1" title="Biology #1">
        <images />
        <category><![CDATA[Biology]]></category>
        <description><![CDATA[Which of the following is the
        site of protein synthesis?]]></description>
        <choices>
          <choice name="A"><![CDATA[Cell wall]]></choice>
          <choice name="B" correct_answer="true"><![CDATA[Ribosomes]]></choice>
          <choice name="C"><![CDATA[Vacuoles]]></choice>
          <choice name="D"><![CDATA[DNA polymerase]]></choice>
          <choice name="E"><![CDATA[RNA polymerase]]></choice>
        </choices>
        <explanation><![CDATA[Answer: B, Ribosomes.  Translation,
        the process that converts mRNA code into protein, takes place in
        ribosomes.

Key Takeaway: Ribosomes are complexes
        of RNA and protein that are located in cell nuclei.  Ribosomes
        catalyze both the conversion of the mRNA code into amino acids as
        well as the assembly of the individual amino acids into a peptide
        change that becomes a protein.]]></explanation>
      </question>
      <question type="0" number="2" title="Biology #1">
        <images />
        <category><![CDATA[Biology]]></category>
        <description><![CDATA[The site of cellular respiration
        is:]]></description>
        <choices>
          <choice name="A"><![CDATA[DNA polymerase]]></choice>
          <choice name="B"><![CDATA[Ribosomes]]></choice>
          <choice name="C" correct_answer="true"><![CDATA[Mitochondria]]></choice>
          <choice name="D"><![CDATA[RNA polymerase]]></choice>
          <choice name="E"><![CDATA[Vacuoles]]></choice>
        </choices>
        <explanation><![CDATA[Answer: C, Mitochondria.  The
        mitochondrion (plural mitochondria) is known as the "powerhouse"
        of the cell for its role in energy production.

        Key Takeaway: The mitochondrion is a membrane-bound
        organelle found in most eukaryotic cells.  The dominant role
        of the mitochondrion is the production of ATP through cellular
        respiration, which is dependent on the presence of oxygen.
        All forms of cellular respiration, glycolysis, Krebs' cycle,
        and oxidative phosphorylation, take place within the
        mitochondria.]]></explanation>
      </question>
    </questions>
  </app>
</root>

How do I maintain the CDATA tags in my merged output? How do I keep the ,
, "" in my merged output instead of getting weird stuff like <b>? Sorry for my really noob questions, but I really appreciate the help.

A: CDATA is specifically for data that the xml parser should ignore. I think the best you'll be able to do in these circumstances, then, is to capture the text like so:
>>> element = et.fromstring('''<explanation><![CDATA[Answer: B, Ribosomes.  Translation,
        the process that converts mRNA code into protein, takes place in
        ribosomes.

Key Takeaway: Ribosomes are complexes
        of RNA and protein that are located in cell nuclei.  Ribosomes
        catalyze both the conversion of the mRNA code into amino acids as
        well as the assembly of the individual amino acids into a peptide
        change that becomes a protein.]]></explanation>''')
>>> element.text
'Answer: B, Ribosomes.  Translation, \n        the process that converts mRNA code into protein, takes place in \n        ribosomes.

Key Takeaway: Ribosomes are complexes \n        of RNA and protein that are located in cell nuclei.  Ribosomes \n        catalyze both the conversion of the mRNA code into amino acids as \n        well as the assembly of the individual amino acids into a peptide \n        change that becomes a protein.'

Then you can unescape your text as @praveen suggested.

A: Use the HTMLParse python library but this doesn't create those CDATA stuff.
text = """
<root>
  <categories>
    <category name="Biology" />
  </categories>
  <app>
    <mainHeader>AP Biology</mainHeader>
    <questions>
      <question number="1" title="Biology #1" type="0">
        <images />
        <category>Biology</category>
        <description><b>Which of the following is the site
        of protein synthesis?</b></description>
        <choices>
          <choice name="A">Cell wall</choice>
          <choice correct_answer="true" name="B">Ribosomes</choice>
          <choice name="C">Vacuoles</choice>
          <choice name="D">DNA polymerase</choice>
          <choice name="E">RNA polymerase</choice>
        </choices>
        <explanation><b>Answer:</b> B, Ribosomes.
        Translation, the process that converts mRNA code into protein,
        takes place in ribosomes.<br /><br /><b>
        Key Takeaway: </b>Ribosomes are complexes of RNA and protein
        that are located in cell nuclei.  Ribosomes catalyze both the
        conversion of the mRNA code into amino acids as well as the assembly
        of the individual amino acids into a peptide change that becomes
        a protein.</explanation>
      </question>
      <question number="1" title="Biology #1" type="0">
        <images>
        </images>
        <category>Biology</category>
        <description><b>The site of cellular respiration is:</b>
        </description>
        <choices>
          <choice name="A">DNA polymerase</choice>
          <choice name="B">Ribosomes</choice>
          <choice correct_answer="true" name="C">Mitochondria</choice>
          <choice name="D">RNA polymerase</choice>
          <choice name="E">Vacuoles</choice>
        </choices>
        <explanation><b>Answer:</b> C, Mitochondria.  The
        mitochondrion (plural mitochondria) is known as the “
        powerhouse” of the cell for its role in energy production.
        <br /><br /><b>Key Takeaway: </b>The
        mitochondrion is a membrane-bound organelle found in most
        eukaryotic cells.  The dominant role of the mitochondrion is the
        production of ATP through cellular respiration, which is dependent
        on the presence of oxygen.  All forms of cellular respiration,
        glycolysis, Krebs’ cycle, and oxidative phosphorylation,
        take place within the mitochondria.</explanation>
      </question>
    </questions>
  </app>
</root>
"""

import HTMLParser
html_parser = HTMLParser.HTMLParser()
unescaped = html_parser.unescape(text)

print unescaped

Output:
<root>
  <categories>
    <category name="Biology" />
  </categories>
  <app>
    <mainHeader>AP Biology</mainHeader>
    <questions>
      <question number="1" title="Biology #1" type="0">
        <images />
        <category>Biology</category>
        <description>Which of the following is the site
        of protein synthesis?</description>
        <choices>
          <choice name="A">Cell wall</choice>
          <choice correct_answer="true" name="B">Ribosomes</choice>
          <choice name="C">Vacuoles</choice>
          <choice name="D">DNA polymerase</choice>
          <choice name="E">RNA polymerase</choice>
        </choices>
        <explanation>Answer: B, Ribosomes.
        Translation, the process that converts mRNA code into protein,
        takes place in ribosomes.

        Key Takeaway: Ribosomes are complexes of RNA and protein
        that are located in cell nuclei.  Ribosomes catalyze both the
        conversion of the mRNA code into amino acids as well as the assembly
        of the individual amino acids into a peptide change that becomes
        a protein.</explanation>
      </question>
      <question number="1" title="Biology #1" type="0">
        <images>
        </images>
        <category>Biology</category>
        <description>The site of cellular respiration is:
        </description>
        <choices>
          <choice name="A">DNA polymerase</choice>
          <choice name="B">Ribosomes</choice>
          <choice correct_answer="true" name="C">Mitochondria</choice>
          <choice name="D">RNA polymerase</choice>
          <choice name="E">Vacuoles</choice>
        </choices>
        <explanation>Answer: C, Mitochondria.  The
        mitochondrion (plural mitochondria) is known as the "
        powerhouse" of the cell for its role in energy production.

Key Takeaway: The
        mitochondrion is a membrane-bound organelle found in most
        eukaryotic cells.  The dominant role of the mitochondrion is the
        production of ATP through cellular respiration, which is dependent
        on the presence of oxygen.  All forms of cellular respiration,
        glycolysis, Krebs' cycle, and oxidative phosphorylation,
        take place within the mitochondria.</explanation>
      </question>
    </questions>
  </app>
</root>


text:
Q: How can I amass lard quickly? As the cornerstone of Muchi Muchi Pork's scoring system, the Lard Meter is extremely important, as it allows you to use your Lard Attack, which creates Medals that are collected for points. However, management of the lard meter is tricky, and it's extremely easy to find yourself out of lard at a crucial moment.
What are the best ways to refill the Lard Meter as quickly as possible if I find myself in a situation where I need a lot of lard, and I need it right now?
In particular, I care most about the 1.01 version of the game.

A: There are a few different ways to obtain lard, but there are a lot of little nuances that aren't immediately apparent, and it's easy to accidentally mess things up if you're not careful.

*

*Shooting enemies with normal Shot (A button) will produce piggies, which increase the Lard Meter when collected. Airborne enemies will produce parachuting piggies that can be sucked in by flying near them, and ground enemies will produce ground-based piggies that must be picked up manually.

*Using the Lard Attack (B button) when the Lard Meter is empty will shoot out a narrow piercing shot, which generates lots of piggies (more than the A button) from every enemy that it destroys.
However, you must press the A button to switch back to "Shot mode" before you pick up the piggies in order for your Lard Meter to increase; otherwise, you'll just get points. You can tell you're in the right mode if your Options are hovering out to the sides of your ship, rather than sitting behind it.

*Using a bomb will spawn pigs from all enemies and bullets that it destroys. This can work in an emergency, but it obviously has other side effects, such as potentially destroying a bunch of valuable medal-giving enemies.
Additionally, it's important to realize that your Lard Meter decreases by a large amount (around 30%?) whenever you switch from Lard Attack mode (B button) to Shot mode (A button). While this is necessary to suck in on-screen medals, it's also important to plan around this so that you don't waste a lot of lard unnecessarily.


text:
Q: Javascript - Programmatically trigger the onChange event of a checkBox for any browser I have some checkboxes in an HTML for that are set like this :
<input type='checkbox' name='chk[]' checked onChange="updateWindow('Label 1', this.checked)"> Label 1

I also have check all / uncheck all links for those checkboxes :
Unckeck all

With this code :
function checkAll(checkValue) {
    checkboxes = document.getElementsByName('chk[]');
    for (var checkbox in checkboxes) {
        checkbox.checked = checkValue;
        activateEvent(checkbox, 'change');
     }
}

The starting problem is that ckecking / unchecking the checkboxes like this do not trigger the onChange event and the associated method. So I trigger it manually calling :
function activateEvent(item, actionShortName) {

    if (document.createEventObject){    // dispatch for IE
        item.fireEvent("on" + actionShortName);
    }
    else {  // dispatch for firefox + others
        var evt = document.createEvent("HTMLEvents");
        evt.initEvent(actionShortName, true, true); // event type,bubbling,cancelable
        item.dispatchEvent(evt);
    }
}

This works fine with IE8, and some older versions of Firefox.
But... on firefox 23, I have a javascript error telling me :
"TypeError: item.dispatchEvent is not a function"

How may I do to make this work for all browsers ?

A: Your for loop is wrong.
checkboxes will be a NodeList, and you cannot for(in) over that (unless you are interested in property names).
Use a regular for (var i = 0; i < checkboxes.length; ++i) checkboxes[i]... loop.


text:
Q: Compare value of property of all instances of class in python I'm trying to write an object oriented program (as a learning exercise, I know there may be simpler ways to do it) in which beads bounce around a 2D plane bounded by a ring. Each bead is an object defined by a class ball. In setting the initial positions of the balls I need to check that no other ball has already been placed at the same x and y coordinates.
#Class for the beads
class ball:
    NumbBalls = 0

    #Constructor
    def __init__(self,Beads):
        self.ball = sphere(pos = vector(0,0,0), radius = radiusBall,color=color.red)
        ball.NumbBalls += 1
        self.ball.pos = self.createInitialPosition(Beads)

    #Assign ball its initial position
    def createInitialPosition(self,other):
         #CODE to compare self.ball.pos and other.ball.pos which returns a unique position coordinate

#Main program
NumbBeads  = 100
Beads = []#Create empty list for all the beads

#create balls in random initial positions
Beads = [ball(Beads) for item in range(NumbBeads)]

I can get this to work if I create two objects bead1 and bead2 and then pass bead1 and bead2 as arguments ie bead2 = ball(bead1) but how do I do this if I am generating a list of beads and want all of them to be compared with self. Hopefully that makes sense.

A: Perhaps rather than the approach you are currently taking, you should consider something along these lines (of course, with the necessary changes to your class definition/methods):
N = 100
initialPositions = []
while len(initialPositions) <= N:
    newPosition = generateRandomPosition()
    if newPosition in initialPositions:
        pass
    else:
        initialPositions.append(newPosition)

ballList = [ ball(p) for p in initialPositions ]

In other words, generate a list of initial positions outside of the creation of your objects, and do whatever validation/restriction you need during that creation. Then just create your objects from that list. If N is really large, you might want to consider a dictionary (or a mutable set of some sort) instead of a list for initialPositions, to help speed up the membership testing, but it's still the same concept...


text:
Q: AngularJs bind controller after link append a new element I have a directive like below, basically append a new element with current one.
and in new element bind ng-controller "openCntl"
explorerModule.controller("openCntl",function($scope, $dialog){
    $scope.open = function(){
        alert('dialog closed with result: ' + result);
    };
});

explorerModule.directive('ngCustomerClick', function($parse){
    return {
        controller :  "openCntl",

        link: function(scope, element, attr){
            var alert = angular.element(
                '

' +
                '
' +
                '
Add
'+
                '

'
            );
        }
    }
});

but when I click the li, don't invoke the function in the controller "openCntl", how to achieve that?
thanks a lot

A: You have to use $compile to let Angular know about the new element.
the heart of the solution is:
link : function(scope, el, attrs) {
  var newElem = angular.element('<SomeNewElement/>');
  el.append(newElem);
  $compile(newElem)(scope);
}

See this plunker that uses a modified version of your code: http://plnkr.co/edit/tOUl8CM56GSd0L3xdNQW?p=preview
Note: in your question, you seem to think that open of openCntl will be called, but your new element has its own ng-controller referring to dialogCntl. In your question, openCntl is the directive's controller, not the new element's controller. I have also fixed that in my plunker by providing dialogCntl.


text: Q: Может ли SDK иметь собственную тему? Работаю над SDK, которая представляет собой один фрагмент, использующий сторонние зависимости. Activity и App классы отсутствуют. Соответственно я не могу в манифесте прописать тему. Вернее могу, но насколько я понимаю - это бессмысленно. Как сделать чтобы мой фрагмент из SDK использовал собственную тему?


text:
Q: Solve the recursion $a_{n} = n a_{n-1} + (n+1)!$ Define the sequence $\{a_{n}\}$ by $a_{n} = n a_{n-1} + (n+1)!$ for $n \geq 1$ and setting $a_{0} = 1$. Solve this recursion completely.
I can solve this rather easily by an induction argument, where I found $a_{n} = \frac{(n+1)!}{2}$. I was not, however, able to solve this using generating functions.
This is a problem from a past exam for one of my classes, and the professor is not fond of induction proofs - so I am thinking that another approach should be possible. If the method of generating functions is not practical, would there be a way to straightforward particular solution one can guess for the inhomogeneous relation?

A: Hint: Change $a_n=n!b_n$. You get $b_n=b_{n-1}+n+1$.

A: Hint Use exponential generating functions.

A: Let $b_n=\dfrac{a_n}{n!}$ and rewrite the recurrence as
$$n!b_n=n(n-1)!b_{n-1}+(n+1)!\;;$$
dividing through by $n!$ leaves you with $b_n=b_{n-1}+(n+1)$, which has the instant solution
$$b_n=b_0+\sum_{k=2}^{n+1}k=\sum_{k=1}^{n+1}k=\frac12(n+1)(n+2)\;.$$
Now just recover $a_n$.


text:
Q: How to separate the prefix in words that are 'di'? I want to separate some prefixes that are integrated into words after the word "di" is followed by letters.
sentence1 = "dipermudah diperlancar"
sentence2 = "di permudah di perlancar"

I expect the output like this:
output1 = "di permudah di perlancar"
output2 = "di permudah di perlancar"

Demo

A: This expression might work to some extent:
(di)(\S+)

if our data would just look like as simple as is in the question. Otherwise, we would be adding more boundaries to our expression.
Test
import re
regex = r"(di)(\S+)"
test_str = "dipermudah diperlancar"
subst = "\\1 \\2"

print(re.sub(regex, subst, test_str))

The expression is explained on the top right panel of regex101.com, if you wish to explore/simplify/modify it, and in this link, you can watch how it would match against some sample inputs, if you like.

A: Here is one way to do this using re.sub:
sentence1 = "adi dipermudah diperlancar"
output = re.sub(r'(?<=\bdi)(?=\w)', ' ', sentence1)
print(output)

Output:
adi di permudah di perlancar

The idea here is to insert a space whenever what immediately precedes is the prefix di, and what also follows is some other word character.


text:
Q: How do I determine reflection matrix over a line through the origin with direction vector $\vec{v}=\left(a,b\right) ^{T}$? I don't understand this really good and couldnt find anything helpful on internet. I only found in book the following: A is the matrix with reflection over line through the origin with direction vector $\left(\cos(\frac{\alpha }{2} ) , \sin(\frac{\alpha }{2} ) \right) ^{T}$
$A=\begin{pmatrix} \cos(\alpha ) & \sin(\alpha ) \\ \sin(\alpha )  & -\cos(\alpha )    \end{pmatrix}$
I'm not sure how to connect this from book to solve it, because there is another direction vector.

A: From prior experience, the reflection matrix can be written as a linear combination of the identity matrix and a suitable projection matrix. With this in mind, we let $R=AI+Bvv^T$ and seek to determine $A,B$. (Technically $vv^T$ is only proportional to a projection matrix, but this can be absorbed into the definition of $B$ without issue.)
First, note that the vector $v$ pointing along the line of reflection should be mapped to itself; on the other hand, the vector $u=(b,-a)^T$ is perpendicular to $v$ and therefore should be mapped to its reflection through the origin. Together, this yields
\begin{align}
v&=Rv=Av+Bv(v^T v)=(A+B v^T v)v \\ -u&=Ru=Au+Bv(v^T u)=Au
\end{align} which solves to $(A,B)=(-1,2/v^T v)$. Hence $R=2(vv^T/v^T v)-I$.
The above is valid for any vector $v$. But if this is a direction vector i.e. $v^Tv=1,$ then $R=2v v^T-I$. (Note that $vv^T$ is now a true projection matrix since $(v v^T)^2=v v^T$). This is the case mentioned in the problem statement, and one can use double-angle identities to confirm that the matrix $R$ quoted above indeed coincides with $2 v v^T-I$.


text:
Q: Difference between enforce Content security policy and CSP report only I am working on Content Security policy to add to my pages. I am confused between term enforce CSP and CSP report only. what is the difference between those two and how they are useful.

A: A CSP puts a number of restrictions on sources of content and specific actions. As this has the potential to break a lot of functionality there is also a report only mode, which can be thought of as a test mode. In report only you will get the same browser errors about violations, they are just not enforced and are marked as report-only. For a valid report-only CSP you must define a report-uri to send reports to. Gathering reports from real users for a while will identify problems with your policy before switching to enforce mode. But you will likely also get some false positives due to proxy rewrites, browser extensions, malware etc. Report-only doesn't give any protections and violations will only be visible for users who take a look at dev tools. A strict enforce CSP is essential in protecting your users from a number of web attacks such as XSS and clickjacking.


text:
Q: Exclude package in maven-war-plugin in classesClassifier we mavenize an old application which was build with ant. It's an multimodule project.
They did some funny things with one web-module, a jar-module has a dependency on. This I can solve with some configuration in the maven-war-plugin:
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <configuration>
        <attachClasses>true</attachClasses>
        <classesClassifier>classes</classesClassifier>
        ...

With this I can refer to an jar without the web stuff:
<dependency>
    <groupId>org.example</groupId>
    <artifactId>my-app</artifactId>
    <classifier>classes</classifier>
    <version>2.23.1-SNAPSHOT</version>
</dependency>

Now I found out that with the ant scripts they filtered most of the packages out, which I need to do so too with maven.
Is there a way to exclude packages just for the jar version which is built from the maven-war-plugin? The war need to be complete.
Thanks!


text:
Q: Suspected linking issue with self created inherited class I am having some issues with a program for class. I believe it to be an issue with the linker. The program gives me no syntax issues and compiles. The issues arises from a class in the program. I have tried rewriting this from scratch hoping it to be a simple syntax error, but that did not work. I have also made sure that the class files were in a directory that was included in the list of included directories.
The file calling the FillerImage class that causes issues.
#include <cstdlib>
#include <sstream>
#include <iostream>

#include "globals.h"  //some global variables are included here
#include "pixel.h"  //includes the pixel class for storing individual pixels
#include "image.h"  //includes the image class we will be using.
#include "FillerImage.h"

using namespace std;

//declare your global variables here!
image* IM;

//load the filler images from the given folder into a vector of fillerImage.
bool loadFillerImagesFromFolder(string folder)
{
    for (int i = FIRST_FILLER_NUMBER; i<= LAST_FILLER_NUMBER; i++){
        stringstream num;
        num << i;
        string filepath = folder + "/" + num.str() + FILLER_IMAGE_EXT;

        FillerImage* tmpFil = new FillerImage(filepath);
    }
    return false;
}

The header file
#ifndef FILLERIMAGE_H
#define FILLERIMAGE_H

#include "image.h"
#include "pixel.h"

using namespace std;

class FillerImage :image
{
    public:
        FillerImage(string filepath);
        bool setAverageColour();
    private:
        int timesUsed;
        pixel averageColour;
};

#endif

.
#include "FillerImage.h"
#include "pixel.h"
#include "image.h"

using namespace std;

FillerImage::FillerImage(string filepath):image(filepath){
    timesUsed = 0;
}

bool FillerImage::setAverageColour(){
    pixel** pix = getPixels();
    int height = getHeight();
    int width = getWidth();
    int averageRed, averageBlue, averageGreen = 0;
    for (int i = 0; i < height; i++){
        for (int j = 0; j< width; j++){
            averageRed += pix[i][j].red;
            averageBlue += pix[i][j].blue;
            averageGreen += pix[i][j].green;
        }
    }
    pixel tmppix;
    int pixels = width*height;
    tmppix.red = averageRed/pixels;
    tmppix.blue = averageBlue/pixels;
    tmppix.green = averageGreen/pixels;
    averageColour = tmppix;
}

The image class which FillerImage inherits from was created by my teacher and worked fine in the last program, so I assume this is not the issue.
The error given by Netbeans is

g++ -headerpad_max_install_names -o
  cs215pgm5.app/Contents/MacOS/cs215pgm5 mainForm.o image.o cs215pgm5.o
  main.o moc_mainForm.o   -F/Library/Frameworks -L/Library/Frameworks
  -framework QtGui -framework QtCore  Undefined symbols for architecture x86_64:   "FillerImage::FillerImage(std::basic_string, std::allocator >)", referenced from:
        loadFillerImagesFromFolder(std::basic_string, std::allocator >)in cs215pgm5.o ld:
  symbol(s) not found for architecture x86_64 collect2: ld returned 1
  exit status make: * [cs215pgm5.app/Contents/MacOS/cs215pgm5] Error 1
BUILD FAILED (exit value 2, total time: 131ms)

Thanks for any help you can provide.

A: It seems you haven't included fillerimage.cpp in your build. It probably isn't listed as a source in the .pro file of your Qt Application, if indeed you are using Qt.


text:
Q: PHP Security: Allow one PHP script to create file in a root-owned location I need to create a very simple file (one line long) in a directory owned by root, but my PHP server is running as www-data.
I have full control of the system, and while I want to grant www-data to execute this ONE file with full permission, I don't want to give it access to run anything ELSE as root.
Is there a place where I can grant PHP or the www-data user permission to run just that one file so that it can create files in the root-owned location?

A: will the filename change?
create the file via the command line and chown it to www-data, or www-data's group.
As long as the script doesn't delete the file..  it can't rewrite it and do with it as it pleases.

A: I get the feeling you are trying to obtain root permissions for some specific process through the execution of the one file. In any case here is a solution.
I recently published a project that allows PHP to obtain and interact with a real Bash shell. Get it here: https://github.com/merlinthemagic/MTS
After downloading you would simply use the following code.
$shell    = \MTS\Factories::getDevices()->getLocalHost()->getShell('bash', true);
$return1  = $shell->exeCmd('php /path/to/your/script');