Q: How to create google play menu in xamarin I'm new to Xamarin. How can i design a pop up menu that looks like google play menu in Xamarin ? I.e see the image below :

A: There are several ways to go about making a fly-out menu, which is what I believe you are after. The very basic approach, is to add something similar to the following to your AXML:
<?xml version="1.0" encoding="utf-8"?>
<flyoutmenu.FlyOutContainer xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <include
        layout="@layout/MenuLayout" />
    <include
        layout="@layout/ContentLayout" />
</flyoutmenu.FlyOutContainer>

Source: http://blog.neteril.org/blog/2013/04/19/fly-out-menu-xamarin-android/
Another Source: http://www.appliedcodelog.com/2016/01/navigation-drawer-using-material-design.html
I hope this helps!


Q: AWS Elastic BeanStalk Security Group I am trying to create Worker Environmenton EBS with Sample Application of Node js which should use existing Security group on VPC.
I create this environment inside VPC (Virtual Private Cloud).
When I create this environment, I keep following configuration for VPC.
Security Group which is selected here is already exist.

In the next screen, I also select instance profile and service role which also exist.

While I create Environment with this setting, It does create Environment fine but it always create new Security group instead of using existing security group.

Why it always create new Security group and not use existing one ?
I want to reuse Security group and not create separate for each worker environment.
Appreciate if someone can guide me in right direction.
Thanks in advance.

A: Beanstalk uses the security group you asked for, but on creation it also creates a unique one for that configuration. If you launch your instance it will be in the security group as expected.

A: Instead of stopping it from being created, was able to modify its rules such that I changed to just allow port 22 access only from my private security group.
Namespace: aws:autoscaling:launchconfiguration
OptionName: SSHSourceRestriction
Value: tcp, 22, 22, my-private-security-group

Visit : https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options-general.html#SSHSourceRestriction


Q: How can I get an entity from Doctrine Fixture reference? I have added data fixtures in my project that relies on referencing entity objects from each other.
In data fixture one, I have added entity references such as:
            // GroupEntity_Fixtures.php file
    $this->addReference('GROUP_USER', $groupUser);
    $this->addReference('GROUP_ADMIN', $groupAdmin);

Where $groupAdmin and $groupUser are both Group() entities. In my second fixtures file I want to add those entities to my User entity via:
             //UserEntity_Fixtures.php file
             $userActive->addGroup($this->getReference('GROUP_USER'));

$userActive is a User entity with a Many to Many relationship to Group Entity. Unfortunately it seems that I am only passing in a proxy of the entity and not the entity itself which renders the following error:
 [Symfony\Component\Debug\Exception\ContextErrorException]
  Catchable Fatal Error: Argument 1 passed to Blogger\BlogBundle\Entity\User:
  :addGroup() must be an instance of Blogger\BlogBundle\Entity\groups, instan
  ce of Proxies\__CG__\Blogger\BlogBundle\Entity\Group given, called in /home
  /na/Practice/src/Blogger/BlogBundle/DataFixtures/ORM/CreateUserController_S
  ignUpForm_UserEntity_Fixtures.php on line 27 and defined in /home/na/Practi
  ce/src/Blogger/BlogBundle/Entity/User.php line 305

How do I convert the reference from a proxy to the entity it expects?

Code for Group Fixture:
<?php
// DataFixtures/ORM/GroupEntity_Fixtrues.php

namespace Blogger\BlogBundle\DataFixtures\ORM;

use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\Persistence\ObjectManager;
use Blogger\BlogBundle\Entity\User;
use Blogger\BlogBundle\Entity\Group;

class GroupEntity_Fixtures extends AbstractFixture implements OrderedFixtureInterface
{
    /**
     * {@inheritDoc}
     */
     public function load(ObjectManager $manager)
     {
        $groupUser = new Group();
        $groupUser->setName('GROUP_USER');
        $groupUser->setRole('ROLE_USER');
        $manager->persist($groupUser);

        $groupAdmin = new Group();
        $groupAdmin->setName('GROUP_ADMIN');
        $groupAdmin->setRole('ROLE_USER,ROLE_ADMIN');
        $manager->persist($groupAdmin);

        $manager->flush();

        $this->addReference('GROUP_USER', $groupUser);
        $this->addReference('GROUP_ADMIN', $groupAdmin);
     }

     public function getOrder()
     {
        return 1;
     }
}

Code for User Fixture
<?php
// DataFixtures/ORM/CreateUserController_SignUpForm_UserEntity_Fixtrues.php

namespace Blogger\BlogBundle\DataFixtures\ORM;

use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\Persistence\ObjectManager;
use Blogger\BlogBundle\Entity\User;
use Blogger\BlogBundle\Entity\Group;

class CreateUserController_SignUpForm_UserEntity_Fixtures extends AbstractFixture implements OrderedFixtureInterface
{
    /**
     * {@inheritDoc}
     */
     public function load(ObjectManager $manager)
     {
        $groupUser2 = new Group();
        $groupUser2->setName('GROUP_USER');
        $groupUser2->setRole('ROLE_USER');
        $manager->persist($groupUser2);

        // This person represents an active (email verified) user.
        $userActive = new User();
        $userActive->setPassword("passwordActive");
        $userActive->setEmail("testActive@test.com");
        $userActive->setUserName("testActive");
        $userActive->setPassword(crypt($userActive->getPassword(),$userActive->getSalt()));
        $userActive->setEmailToken(md5(uniqid(rand(), true)));
        $userActive->addGroup($groupUser2);
        //$userActive->getGroups()->add($groupRepository->getGroupByName("BASIC_USER"));

        // This person represents an unactive (email not verified) user.
        $userUnactive = new User();
        $userUnactive->setPassword("passwordUnactive");
        $userUnactive->setEmail("testUnactive@test.com");
        $userUnactive->setUserName("testUnactive");
        $userUnactive->setPassword(crypt($userUnactive->getPassword(),$userUnactive->getSalt()));
        $userUnactive->setEmailToken(md5(uniqid(rand(), true)));

        // Persist objects into the database
        $manager->persist($userActive);
        $manager->persist($userUnactive);
        $manager->flush();

     }

     public function getOrder()
     {
        return 2;
     }
}

Code for Group Entity:
/**
 * @ORM\ManyToMany(targetEntity="User", inversedBy="groups")
 */
private $users;

Code for User Entity:
/**
 * @ORM\ManyToMany(targetEntity="Group", mappedBy="users")
 */
protected $groups;

Added Group Methos:
/**
 * Add groups
 *
 * @param \Blogger\BlogBundle\Entity\groups $groups
 * @return User
 */
public function addGroup(\Blogger\BlogBundle\Entity\groups $groups)
{
    $this->groups[] = $groups;

    return $this;
}

A: The addGroup method has the wrong type hint:
It should be:
/**
 * Add groups
 *
 * @param \Blogger\BlogBundle\Entity\Group $groups
 * @return User
 */
public function addGroup(\Blogger\BlogBundle\Entity\Group $groups)
{
    $this->groups[] = $groups;

    return $this;
}

Notice \Blogger\BlogBundle\Entity\Group instead of \Blogger\BlogBundle\Entity\groups.


Q: Can updating drivers cause Power surges My friend is a bit of a dunce when it comes to tech. He was complaining about frame rate issues and we went through a number of attempts to fix it. Turning off anti-aliasing, lower the settings stuff of that nature in the game. I eventually told him to update his graphics card driver.
Two days later his system goes "pop!" when he attempts to boot it up. PSU is smoking and leaking and now were checking his other computer parts to see what survived. Did updating the driver cause his system to die spectacularly or was it just bad luck? I don't know his exact specs as it's a pre-built but here is what I do know:
PSU Apevia ATX-PR600W
GPU Radeon 580
CPU Ryzen 5 3600

A: No, updating the driver did not cause the problem. The PSU just went bad. As you mentioned that it's a pre-built check the warranty. If it's still in warranty send the machine back to the seller and let them fix/replace it.
As an aside, when your friend does get his machine back, here's a list of things to try to fix the graphics issues:
Overheating issues

*

*Make sure the PC is clean and free of dust.

*Make sure the PC is in a well ventilated case. If the fans get noticeably quieter when you open the side-panel, you likely have a problem.

*Make sure the PC is in an open space with the intakes and outtakes unobstructed.

*GPU-Z can be a great tool to help you check what the temperature of your card is and what is holding your card back (temp, power limits, voltage).

Driver/Software issues

*

*Make sure the BIOS, system, Windows, GPU, etc are all up to date.

*Make sure the PC doesn't have two different performance managers fighting for control.

*Check Task Manager so you can find where all the performance is going to.

*Remove bloatware.

*Verify your friend hasn't been downloading shady stuff off the web.

Misc

*

*Verify that the DisplayPort/HDMI cables are undamaged and plugged into the GPU.

*Verify that the DisplayPort/HDMI cables are modern enough to support the resolution/framerate you are trying to reach.

*If you haven't already, get that PC a surge protector. Don't let a $1000 machine be ruined because you weren't willing to shell out $35.

A:
Did updating the driver cause his system to die spectacularly

No. That is entirely unlikely (99.5 plus %).
Some other event, some other power surge, coincidence, bad luck will have caused this.
Leaking is likely an electrolytic capacitor gone bad. A PSU does not normally contain a battery that would leak.
Test the components, replace the PSU and any other components needing replacement as the result of the PSU failure and test again for proper operation.


Q: how to print more than one rows through PL/SQL procedure? How to write a procedure where user will give department number, and the procedure will show the list of those employees who are working in that department.
My procedure:
create or replace procedure p1(
  dno in number,
  name out varchar2 )
is
begin
 select ename
   into name
   from emp
  where deptno=dno;
end;

PLSQL:
declare
   dno emp.deptno%type:=:dept;
   name emp.ename%type;
begin
  p1(dno,name );
  dbms_output.put_line(name);
end;

But this is showing an error:
ORA-01422: exact fetch returns more than requested number of rows

How can I print multiple values through procedure?

A: I haven't tried your code, but you seen to call the procedure p1(dno,name ); and insert name in it.
But name can only be output becuase of the OUT, you need to use IN OUT in your procedure at least.


Q: How do I secure a SQL Server 2005 database? I have a database for a web application that is home to some personal information about my users.
What should I do to make sure the data is secure?
Encrypting the data makes sense, of course... but what about stopping somebody from getting on the machine to begin with?
What do I do about the developers that need access to the data, to make fixes, etc...?
Is there a document or best practice site that I can use as a guide?

A: Depending on the type of data I'm not sure that encryption is necessary providing you secure access to the system and the database itself.  All of our production database servers are behind a firewall.  Only systems that are on the administrative network are allowed access through the firewall and then only on specific, required ports.  Database servers don't host web servers.
Access to the database servers themselves is strictly limited to DBAs and platform support personnel.  They use administrative logins, not their personal login ids.  That way if their personal account is compromised the database servers aren't.
For web servers only web admins and platform support have access (I happen to wear two hats, web developer and web admin, although that is rare in our organization).
Developers have access to shares where they can publish their application, usually coordinated with the web admin for any setup/configuration.  Some senior developers are given administrator access to databases in order to create/modify schemas.
Usually, what happens is you develop using a locally installed database server, upload code to QA servers that have a little looser access policy, but are only accessible from company networks, then have the DBAs copy the database schema and roles to production and publish your app to the production web server.
Web apps are often configured to run under limited credential service accounts which have read/write, but not admin, access to the database.  I typically encrypt any part of my web.config that contains connection information as well.
The general idea is to give enough access to get your job done without too much bother, but limit access to the minimum required.
Oh.  And no "real" data on development or QA servers.
[EDIT] We don't keep SSNs or credit card numbers.  If you do, you'll need to be even more careful.  Most of my apps do access logging, some are required to due to HIPPA, but I find that it is a good practice for just about anything meaningful

A: Well the developers should probably do all their work on a development database that doesn't contain sensitive information to start with.

A: Here in the UK we have legislation known as the Data Protection Act. If you worked for a UK company I would advise you to speak to your company's 'data controller' (being the individual whom the Information Commissioner's Office can pursue legally in instances of non-compliance) and they will be able to furnish you with a definitive answer about what 'secure' means as regards the data in question, probably enshrined in a written company policy.
If you are in the US I'd guess your corporation might have a bunch of highly paid lawyers who will be able to similarly give a definitive answer :)
I'm no legal expert but would suggest that obfuscating data does not make it fit for any purposes other than that for which it was obtained e.g. integration testing by developers using obfuscated 'real life' data is probably a no-no.

A: You need to pratice standard security for a windows server.  A good place to start is to use integrated logins rather that SQL logins.
You will need to study the books on-line.  You can give some users read-only access.  Others can be denied access to sensitive tables.

A: I would use Active Directory to control access to SQL Server or any network resource.  By grouping the users and applying security to the group, it will make it so much easier to make changes in the future.
Here is a guide from Microsoft on SQL Server 2005 Security Best Practices:
http://download.microsoft.com/download/8/5/e/85eea4fa-b3bb-4426-97d0-7f7151b2011c/SQL2005SecBestPract.doc
*Note: it downloads a Word document, so you will need MS Word or the MS Word viewer
This document has a lot of detail so you may want to grab some coffee first :).
However, I agree with the others, active development shouldn't happen against production data.  We currently use a process of cleaning production data before it gets to the QA or Dev environments.
Another option we explored is developing a solution to generate data for Dev and QA.


Q: Can;t install lxml package on windwos 11 "PS D:\Complete-Python-3-Bootcamp-master\12-Advanced Python Modules\puzzle_unzip> pip install lxml
Collecting lxml
  Using cached lxml-4.9.1.tar.gz (3.4 MB)
  Preparing metadata (setup.py) ... done
Installing collected packages: lxml
  DEPRECATION: lxml is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for lxml ... error
  error: subprocess-exited-with-error

  × Running setup.py install for lxml did not run successfully.
  │ exit code: 1
  ╰─> [96 lines of output]
      Building lxml version 4.9.1.
      Building without Cython.
      Building against pre-built libxml2 andl libxslt libraries
      running install
      C:\Users\lohar\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-311
      creating build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\builder.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\cssselect.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\doctestcompare.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\ElementInclude.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\pyclasslookup.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\sax.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\usedoctest.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\_elementpath.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\__init__.py -> build\lib.win-amd64-cpython-311\lxml
      creating build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\__init__.py -> build\lib.win-amd64-cpython-311\lxml\includes
      creating build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\builder.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\clean.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\defs.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\diff.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\ElementSoup.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\formfill.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\html5parser.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\soupparser.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\usedoctest.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\_diffcommand.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\_html5builder.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\_setmixin.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\__init__.py -> build\lib.win-amd64-cpython-311\lxml\html
      creating build\lib.win-amd64-cpython-311\lxml\isoschematron
      copying src\lxml\isoschematron\__init__.py -> build\lib.win-amd64-cpython-311\lxml\isoschematron
      copying src\lxml\etree.h -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\etree_api.h -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\lxml.etree.h -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\lxml.etree_api.h -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\includes\c14n.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\config.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\dtdvalid.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\etreepublic.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\htmlparser.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\relaxng.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\schematron.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\tree.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\uri.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\xinclude.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\xmlerror.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\xmlparser.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\xmlschema.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\xpath.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\xslt.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\__init__.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\etree_defs.h -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\lxml-version.h -> build\lib.win-amd64-cpython-311\lxml\includes
      creating build\lib.win-amd64-cpython-311\lxml\isoschematron\resources
      creating build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\rng
      copying src\lxml\isoschematron\resources\rng\iso-schematron.rng -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\rng
      creating build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl
      copying src\lxml\isoschematron\resources\xsl\RNG2Schtrn.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl
      copying src\lxml\isoschematron\resources\xsl\XSD2Schtrn.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl
      creating build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_abstract_expand.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_dsdl_include.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_message.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_skeleton_for_xslt1.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_svrl_for_xslt1.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\readme.txt -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      running build_ext
      building 'lxml.etree' extension
      creating build\temp.win-amd64-cpython-311
      creating build\temp.win-amd64-cpython-311\Release
      creating build\temp.win-amd64-cpython-311\Release\src
      creating build\temp.win-amd64-cpython-311\Release\src\lxml
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DCYTHON_CLINE_IN_TRACEBACK=0 -Isrc -Isrc\lxml\includes -IC:\Users\lohar\AppData\Local\Programs\Python\Python311\include -IC:\Users\lohar\AppData\Local\Programs\Python\Python311\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" /Tcsrc\lxml\etree.c /Fobuild\temp.win-amd64-cpython-311\Release\src\lxml\etree.obj -w
      cl : Command line warning D9025 : overriding '/W3' with '/w'
      etree.c
      C:\Users\lohar\AppData\Local\Temp\pip-install-v8_cypj7\lxml_b1e7951ab83046e384fffcd4610d3736\src\lxml\includes/etree_defs.h(14): fatal error C1083: Cannot open include file: 'libxml/xmlversion.h': No such file or directory
      Compile failed: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      creating Users
      creating Users\lohar
      creating Users\lohar\AppData
      creating Users\lohar\AppData\Local
      creating Users\lohar\AppData\Local\Temp
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -I/usr/include/libxml2 "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" /TcC:\Users\lohar\AppData\Local\Temp\xmlXPathInituop21067.c /FoUsers\lohar\AppData\Local\Temp\xmlXPathInituop21067.obj
      xmlXPathInituop21067.c
      C:\Users\lohar\AppData\Local\Temp\xmlXPathInituop21067.c(1): fatal error C1083: Cannot open include file: 'libxml/xpath.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      *********************************************************************************
      Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
      *********************************************************************************
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> lxml

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
PS D:\Complete-Python-3-Bootcamp-master\12-Advanced Python Modules\puzzle_unzip> "

*

*im trying to install lxml library by pip install lxml.

*i also installed vs build tools 2022 .

*after that i stuck on this error i tryed multiple things but they dont work

*thigs that i tried manually installing packages.

*multiple internet solutions

im expecting a solution to install lxml on W11 machine.and also im using vs code and pycharm python version 3.11 and pip version 22.3.1

A: The Python lxml module is a language-binding / wrapper for two C libraries.
For Windows they provide binary builds that include these libraries. Otherwise it will be pain and suffering getting it installed and running on Windows. Because it's Windows. "Developers, developers, developers".. (As lxml developers put it: "users of that platform usually fail to build lxml themselves")
Normally you should get the binary distribution when doing install through pip but in this case you don't.

*

*Try to pin an older version, maybe binaries are available for it:
pip install lxml==4.9.0

*Try to download the lxml binary distribution by Christoph Gohlke available here.
You can install the wheel file also via pip.
Sources:

*

*Where are the binary builds?

*Source builds on MS Windows


Q: Reliable Ways to Send Large Files to Clients we have a need to regularly provide large files to clients on a daily or weekly basis.  Currently our process is this:

*

*Internal process creates the file and places it in a specific folder

*Our client connects via SFTP and downloads the file

This work well when the files are small.  As they get bigger (50-100 GB in size), we keep getting network interruptions and internal disk space related issues.
What I'd like to see is the following:

*

*Our internal process creates the file.

*This file is copied to an intermediary service (similar to something like FileDropper).

*Our client will download the file from this intermediary service.

I'd like to know if other people had similar issues and what possible solutions are in place.  File Dropper works great for non-business related files but obviously I won't be putting client data on there.  We also have an Office 365 subscription.  I tried to see what I could use with that but I haven't found anything yet that would help solve this.
Any hints, suggestions or feedback is much appreciated!

A: Consider Amazon S3.
I have used it several times in the past and it is very reliable both for processing a lot of files and for processing large files


Q: PowerShell How to use -and in Where-Object I want to filter a command result using two conditions. Here are my commands
 $list=Get-PnpDevice | Sort-Object -Property Name | Where-Object -Property ConfigurationFlags -NotLike '*DISABLED*' | ft Name, InstanceId -AutoSize

and the next filter is
 $list=Get-PnpDevice | Sort-Object -Property Name | Where-Object -Property FriendlyName -like '*touch screen*' | ft Name, InstanceId -AutoSize

both of them works separately but I want to join them using and command. I tried to use -AND as following command but it keeps raising errors

 Get-PnpDevice | Sort-Object -Property Name | Where-Object{
      ( ConfigurationFlags -NotLike '*DISABLED*') -and
      ( FriendlyName -like '*touch screen*' ) }| ft Name, InstanceId -AutoSize

A: Simply use the The $_ automatic variable in your Where-Object to reference the property names:
Get-PnpDevice | Sort-Object -Property Name | Where-Object{
      ( $_.ConfigurationFlags -NotLike '*DISABLED*') -and
      ( $_.FriendlyName -like '*touch screen*' ) }| ft Name, InstanceId -AutoSize

A: You can pipe 'Where' clauses together... it's simpler syntax and easier to read
Get-PnpDevice | Sort-Object -Property Name | Where ConfigurationFlags -NotLike '*DISABLED*' | Where FriendlyName -like '*touch screen*' | ft Name, InstanceId -AutoSize


Q: Pay with paypal and recurring using billing agreement API I just want to understand that how can I redirect user to PayPal account ==> login ==> agreed to payment teand based on selection I can call my Billing Agreement Rest API.
Do I need to setUp My Own UI to process payment ?

A: The most important thing here is that you cannot sign a billing agreement without a billing plan
So the first thing you need to consider is how you could create a plan.
Its very simple just trigger this api: https://developer.paypal.com/docs/api/payments.billing-plans/v1/
Now you have your plan Id
now you can subscribe a user with this plan id
by triggering this API
https://developer.paypal.com/docs/api/payments.billing-agreements/v1/#billing-agreements_create


Q: sending email with delayed job within Rails_admin causes an error I have a custom collection action in Rails Admin as follows:
require 'rails_admin/config/actions'
require 'rails_admin/config/actions/base'
module RailsAdminSendNewsletter
end

module RailsAdmin
  module Config
    module Actions
      class SendNewsletter < RailsAdmin::Config::Actions::Base

      # Is the action on a model scope (Example: /admin/team/export)
       register_instance_option :collection? do
         true
       end

       register_instance_option :link_icon do
          'icon-share'
       end

       register_instance_option :pjax? do
           false
         end

        register_instance_option :controller do
          Proc.new do
              if request.xhr?
                  resources = Resource.where(:for_newsletter => true)
                  subscriber = Subscriber.all.each do |subscriber|
                     NewsletterMailer.delay.newsletter(subscriber, resources)
                  end
                  resources.each do |resource|
                        resource.update_column(:sent_on, Time.now)
                      end
              end
                flash[:success] = "The Newsletter has successfully been sent."
                redirect_to back_or_index
          end
      end

      end
    end
  end
end

produces the following error:
ArgumentError (wrong number of arguments (2 for 1)):
  lib/rails_admin_send_newsletter.rb:30:in `block (3 levels) in <class:SendNewsletter>'
  lib/rails_admin_send_newsletter.rb:29:in `each'
  lib/rails_admin_send_newsletter.rb:29:in `block (2 levels) in <class:SendNewsletter>'

Here is the newsletter mailer:
class NewsletterMailer < ActionMailer::Base
    default from: ' "Agile Designers" <info@agiledesigner.com>'

    def newsletter(subscriber, resources)
        @subscriber = subscriber
        @resources = resources
        @twitter = "https://twitter.com/agiledesigners"
        mail(:to => subscriber.email, :subject => "Agile Designer Newsletter")
    end
end

I don't understand what causes it
Any help appreciated.


Q: iPhone SDK have a different title on the tab bar and the navigation bar I have a simple question (maybe not a simple answer). Currently I have an iPhone app and I tab bar and navigation set up on it. When I set the self.title it puts it in both the tab bar and the navigation bar. I was wondering if there was a way to have a different title on the navigation bar and tab bar?

A: You're setting the title of the whole view, which in turn automatically sets the title of the tabBar and the nav controller. To set the title of them each individually,
You first set the nav bar by accessing the nav item:
[[self navigationItem] setTitle:(NSString *)];

Then you set the tabBar title by accessing the tab bar item and setting its title like so:
[self.tabBarItem setTitle:(NSString *)];

Good Luck!

A: use self.navigationItem.title for the navigation bar.

A: This is a common mistake and happened to me so many times.
To get around this, every ViewController comes with a navigationItem property giving you even further options.
Use following line inside your ViewControllers to set the title:
self.navigationItem.title = @"Your Desired Title";


Q: Event not working on templated dojo widget My widget makes the form but the event that is suposed to happen doesn't. When the button is clicked it is supposed to grab the value in the input box then put it into URL that is being requested then paste that page into the results div.
EDIT NOTE: Found out that if I have the searchNode WITHOUT the dijit Button type the event works but if I apply the dojo-data-type it doesn't.
Widget:
/**
 * Widget for creating a quick search form.
 */
define([
    "dojo/_base/declare",
    "dojo/request",
    "dijit/_WidgetBase",
    "dijit/_OnDijitClickMixin",
    "dijit/_TemplatedMixin",
    "dijit/_WidgetsInTemplateMixin",
    "dijit/form/Button",
    "dijit/form/TextBox",
    "dojo/text!./templates/quickSearch.html"
],function(declare, request, _WidgetBase, _OnDijitClickMixin, _TemplatedMixin, _WidgetsInTemplateMixin, Button, TextBox, template){
    return declare("js/widget/SASearch", [_WidgetBase, _OnDijitClickMixin, _TemplatedMixin, _WidgetsInTemplateMixin], {
        //  set our template
        templateString: template,

        //  some properties
        baseClass: "searchWidget",

        //  define an onClick handler
        _onClick: function() {
            var query = this.queryNode.value;
            alert(query);
            request("quick/" + query).then(
              function(text) {
                  this.resultsNode.innerHTML = text;
                  alert(text);
              },
              function(error) {}
            );
        }
    });
});

Template:

Search

A: Your event has to be
data-dojo-attach-event="onClick:_onClick"

On the button.
Also for the returns on the request, your going to have to use dojo.hitch to hitch this.
http://jsfiddle.net/theinnkeeper/qum452gm/


Q: Is there any way to automatically generate java classes from Neo4j graph database In my application, we choosen Neo4j as database. We have designed the database with all the required nodes and relationships. We are trying to integrate the in our springboot java program with reactive neo4j repository. Now we are planning to create equivalent entities.
Is there any way to automatically generate java classes from Neo4j graph database which will be equivalent to @Node and @RelationshipProperties used entities as we create manually.

A: No there is no tool for this and this is in general a good thing when it comes to "complex" data in the graph.
Spring Data Neo4j (6) does only fetch the relationships and properties of a node that you define in your model.
If you would map your graph 1:1 you might end up with ones you do not need. They will pollute your code base and create unnecessary long Cypher statements / data transfers.
I would say that there is -in contrast to the usage of RDBMS- a lot of "shared database" usage in the graph world.
The partial match of a domain model in the application to the graph model is no exception here.
Also a tool that blindly converts your data into a model can only make assumptions.
E.g. multiple labels: You can define them in multiple ways depending on your use-case in Spring Data Neo4j.
But which one is the right one for the tool?
This can produce code that is not your desired outcome and you would have to manually refactor it after creation.
Imagine having such a tool in a build chain: You would have to manually fine-tune the resulting model over and over again.


Q: Android onLoadCompleteListener how to implement? I have a custom class called "Sound" with SoundPool, I want to implement the loading complete listener so that my activity can play an intro sound and display the "start" button once loading is complete.
How would I go about implementing the listener and then testing for the complete status from my activity to make sure everything is loaded then go on to do the above.
A small example would be appreciated.
MyActivity creates an instance of my class "Sound" so that it can call various sound methods from it.
Sound mySound = new Sound();

Most of these are not a problem, because by the time they are called, the loading has completed, however, I need for MyActivity to be able to check if loading has completed before calling
mySound.playIntro();

(for example).
Maybe the OnLoadCompleteListener isn't the best solution, I'm still learning, so I'm open to ideas, this is just the way I guessed it should be done.
Thanks

A: It would look somthing like this:
SoundPool.setOnLoadCompleteListener(new OnLoadCompleteListener(){

@override
onLoadComplete(SoundPool soundPool, int sampleId, int status)
{
// show button and play intro sound here
}});

You should read the android guide for developers. And more specificly for this problem: SoundPool
Edit - Corrected a typo, "listner" to "listener"


Q: Compare two arrays in PowerShell I try to compare two arrays, but it won't work.
#System.Data.DataSet -> $Dataset.Tables.Identifier
#System.Xml.XmlElement -> $xmlarray

#$Arraytemp = $xmlarray | Where {$Dataset.Tables.Identifier -NotContains $xmlarray.myid}
$Arraytemp = $xmlarray | Where {$Dataset.Tables.Identifier -NotContains $x_}

Write-Host "Compared Results"
$Arraytemp | ft
Write-Host "XML Results"
$xmlarray | ft
Write-Host "SQL Results"
$Dataset.Tables.Identifier | ft

I read a XML result in an array $xmlarray. It contains the coloumn myid as a unique identifier (and other coloumns).
I read a MS SQL result in an array in $Dataset.Tables.Identifier, it only contains a unique identifier.
The SQL result contains only a part of the XML array. So I want to know, which rows are the difference, because I want to INSERT them in the database.
When I check the result with Write-Host the results looks good. When I compare them, nothing happens.
SQL is System.Data.DataSet.
SQL is System.Xml.XmlElement.
May be the dataformat is not compatible?


Q: less css mixin with parametric A as default for parametric B I'm currently working with LESS CSS and tried to create a mixin that mimics the default css behavior of shorthand parameters.
in css you often declare i.e.
margin: 5px 5px 10px;

and it's read as
margin: 5px 5px 10px 5px;

I tried the same with a border-radius mixin
.border-radius (@topright: 5px, @bottomright: @topright, @bottomleft: @topright, @topleft:  @bottomright) {}

I want it to take the first as default for all, if called with one parameter only. If I call it with 2 parameter it should take the first as default for the third and the second as default for the fourth.
Is there a way to achieve this behavior with LESS alone?

A: The correct way to do this would be to receive just one parameter
.border-radius(@px) {
    -webkit-border-radius: @px;
    -moz-border-radius: @px;
    border-radius: @px;
}

Then you can call it with one parameter:
.border-radius(5px);

or with many. This requires you to either put them in a variable, or escape them:
@myradius: 5px 5px 10px;
.border-radius(@myradius);

or
.border-radius(~"5px 5px 10px");

I read that the Bootstrap project uses the latter version for brevity.


Q: How to directly search string in PDF using any programming language Is it possible to search for a particular string in PDF using any programming language without converting it to a text or doc file. I want to search for a string directly without converting it, I tried to convert it to text and then search for the string but it gave me wrong result.
Thanks!
Kim

A: Docotic.Pdf library can be used for your task. Please see my answer for similar question.
Disclaimer: I work for the company that develops Docotic.Pdf library.

A: 1) Create your own PDF "parser":
http://www.quick-pdf.com/pdf-specification.htm
Probably could be minimal if you just need text data and not any of the formatting.
2) Find a library in your language of choice that can "natively" read .pdfs (tons of them out there).
3) use a pre-built tool (like pdf2text or pdfgrep): https://unix.stackexchange.com/questions/6704/grep-pdf-files

A: If your requirement is to search a for a word and replace it, you can go for Aspose.pdf.Kit

A: Poppler contains tools to extract text from a pdf document. Use it to search on documents.

A: In Java and C#, you can do that with iText, if the pdf file is not locked.
http://itextpdf.com/


Q: Need to collapse a data table by its ID I am fairly new to r, and I am working with a large data set. I made an example of what my problem is below (data set is tab delineated). Basically I want to collapse all data by its ID number so that all of its attributes are contained in 1 cell instead of many cells.
The actual data set I am working with is genomic in nature, with the "ID" being the "gene name" and the "attribute" being the "pathway" that the gene is associated with. My data set is ~5,000,000 rows long.
I have tried messing around with cbind and rbind, but they do not seem to be specific enough for what I need.
My data set currently looks something like this:
ID  Attributes
1   apple
1   banana
1   orange
1   pineapple
2   apple
2   banana
2   orange
3   apple
3   banana
3   pineapple

And I want it to look like this:
ID  Attributes
1   apple,banana,orange,pineapple
2   apple,banana,orange
3   apple,banana,pineapple

If you have another way besides using r, that would work as well.
Thank you for your help

A: a base solution. To split df by ID, then paste the Attributes together. Then rbind the list of results.
do.call(rbind, by(df, df$ID,
    function(x) data.frame(ID=x$ID[1], Attributes=paste(x$Attributes, collapse=","))
))

data:
df <- read.table(text="ID  Attributes
1   apple
1   banana
1   orange
1   pineapple
2   apple
2   banana
2   orange
3   apple
3   banana
3   pineapple", header=TRUE)

A: A tidyverse approach would be to group_by your ID and summarise with paste.
library(dplyr)

df <- read.table(text = "
  ID  Attributes
  1   apple
  1   banana
  1   orange
  1   pineapple
  2   apple
  2   banana
  2   orange
  3   apple
  3   banana
  3   pineapple", header = TRUE, stringsAsFactors = FALSE)

df %>%
  group_by(ID) %>%
  summarise(
    Attributes = paste(Attributes, collapse = ", ")
  )

# # A tibble: 3 x 2
#      ID Attributes
#   <int> <chr>
# 1     1 apple, banana, orange, pineapple
# 2     2 apple, banana, orange
# 3     3 apple, banana, pineapple


Q: Sorting a list in OCaml Here is the code on sorting any given list:
let rec sort lst =
   match lst with
     [] -> []
   | head :: tail -> insert head (sort tail)
 and insert elt lst =
   match lst with
     [] -> [elt]
   | head :: tail -> if elt <= head then elt :: lst else head :: insert elt tail;;

[Source: Code
However, I am getting an Unbound error:
Unbound value tail
# let rec sort lst =
   match lst with
     [] -> []
   | head :: tail -> insert head (sort tail)
 and insert elt lst =
   match lst with
     [] -> [elt]
   | head :: tail -> if elt <= head then elt :: lst else head :: insert elt tail;;
Characters 28-29:
     | head :: tail -> if elt <= head then elt :: lst else head :: insert elt tail;;
     ^
Error: Syntax error

Can anyone please help me understand the issue here?? I did not find head or tail to be predefined anywhere nor in the code

A: Your code seems correct, and compiles for me:
    Objective Caml version 3.11.1

# let rec sort lst = ...

val sort : 'a list -> 'a list = <fun>
val insert : 'a -> 'a list -> 'a list = <fun>

# sort [ 1 ; 3 ; 9 ; 2 ; 5 ; 4; 4; 8 ; 4 ] ;;
- : int list = [1; 2; 3; 4; 4; 4; 5; 8; 9]

A: Adding to what Pascal said, the list type is defined as:
type 'a list = [] | :: of 'a * 'a list

and that's what you are matching your list lst against.

A: The symbol “|“ is the horizontal line symbol, it is not l character and the -> are the minus symbol and the bigger symbol. I think you copied and pasted the segment of code in the website of Inria. Please check and rewrite the special symbols. I tested it and it works well.

A: Head and tail need not to be defined. They are matched from 'list' you give.


Q: How can I open a html file, after a php file is run? I am a complete beginner in web development in regards to php. Right not I am using:
    <form action="phpfile.php">
    <input type="submit" value="click on me!">
    </form>

To open up my php file, which is a simple echo "hello world!" (for testing purposes) The php file that I would use would be this sendmail file
    <?php
    $to = 'example@gmail.com';
    $subject = 'Mailer Test';
    $message = 'This is a test, Thanks Person';
    $headers = "From: your@email-address.com\r\n";
    ?>

How can, after this is run, a html file would open as soon as the file is done loading? Like a "You have completed the task" page essentially (Also I'm using Xampp which has inbuilt sendmail, so the file does work. Once again temporary before I move onto a webserver)
Thanks!!

A: use this :
header('Location: http://localhost/yourHtmlFile.html');
but make sure your php didn't output anything before it
update
another workaround is to use include ('yourHtmlFile.html');

A: PHP can answer code written in HTML back to the browser using echo:
<?php
//do some code
$name="superuser";
echo "Hi ".$name;
?>


Q: How to reference a lambda from inside it? I am trying to get height of a view in onCreate method but I couldn't find any way to remove OnGlobalLayoutListener.
In Java (working):
containerLayout.getViewTreeObserver.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
    @Override
    public void onGlobalLayout() {
        containerLayout.getViewTreeObserver().removeGlobalOnLayoutListener(this);
        int width  = layout.getMeasuredWidth();
        int height = layout.getMeasuredHeight();

    }
});

In Kotlin (not accepting "this"):
   containerLayout.viewTreeObserver.addOnGlobalLayoutListener {
            containerLayout.viewTreeObserver.removeOnGlobalLayoutListener(this)
            Toast.makeText(applicationContext, "size is "+ containerLayout.height,Toast.LENGTH_LONG).show()
        }

Is there any reference or example for this problem? Thanks.

A: What's about extension like this?
import android.annotation.SuppressLint
import android.os.Build
import android.view.View
import android.view.ViewTreeObserver

inline fun View.doOnGlobalLayout(crossinline action: (view: View) -> Unit) {
    val vto = viewTreeObserver
    vto.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener {
        @SuppressLint("ObsoleteSdkInt")
        @Suppress("DEPRECATION")
        override fun onGlobalLayout() {
            action(this@doOnGlobalLayout)
            when {
                vto.isAlive -> {
                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
                        vto.removeOnGlobalLayoutListener(this)
                    } else {
                        vto.removeGlobalOnLayoutListener(this)
                    }
                }
                else -> {
                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
                        viewTreeObserver.removeOnGlobalLayoutListener(this)
                    } else {
                        viewTreeObserver.removeGlobalOnLayoutListener(this)
                    }
                }
            }
        }
    })
}

Finally, you can call OnGlobalLayoutListener from View directly
val view: View = ...
view.doOnGlobalLayout {
  val width = view?.measuredWidth
  val height = view?.measuredHeight
}

A: Simple / clear approach (no generics or anonymous objects):
You could create the listener in advance, then add / use / remove as needed:
private var layoutChangedListener: ViewTreeObserver.OnGlobalLayoutListener? = null

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    super.onViewCreated(view, savedInstanceState)

    // create the listener
    layoutChangedListener = ViewTreeObserver.OnGlobalLayoutListener {

        // do something here

        // remove the listener from your view
        myContainerView.viewTreeObserver.removeOnGlobalLayoutListener(layoutChangedListener)
        layoutChangedListener = null
    }

    // add the listener to your view
    myContainerView.viewTreeObserver.addOnGlobalLayoutListener(layoutChangedListener)
}

use case:
I had to be able to remove the listener, in order to adjust the layout inside the listener itself - not removing the listener may result in a deadlock

A: Referencing a lambda from inside it is not supported.
As a workaround, you might use anonymous object instead of lambda SAM-converted to Java functional interface OnGlobalLayoutListener:
containerLayout.viewTreeObserver.addOnGlobalLayoutListener(object: OnGlobalLayoutListener {
    override fun onGlobalLayout() {
        // your code here. `this` should work
    }
})

A: Another solution is to implement and use self-reference:
class SelfReference<T>(val initializer: SelfReference<T>.() -> T) {
    val self: T by lazy {
        inner ?: throw IllegalStateException()
    }

    private val inner = initializer()
}

fun <T> selfReference(initializer: SelfReference<T>.() -> T): T {
    return SelfReference(initializer).self
}

Then the usage would be
containerLayout.viewTreeObserver.addOnGlobalLayoutListener(selfReference {
    OnGlobalLayoutListener {
        containerLayout.viewTreeObserver.removeOnGlobalLayoutListener(self)
        // ...
    }
}

Instead of this, self property is used.


Q: Argument to KnockoutJS function is returning the viewModel when not defined Still continuing to understand KO here. I have an argument to one of the KO methods,it works when I pass it an explicit value but when I call the function with no args it does not give
<button data-bind="click:LaterCall">click</button>

function InvoiceViewModel() {

    //Data
    var self = this;
    self.LaterCall = function (arg) {
        console.log(arg); // why is this not undefined????
    };

}
var viewModel = new InvoiceViewModel();
ko.applyBindings(viewModel);

http://jsfiddle.net/sajjansarkar/9TMv2/2/

A: Knockout's click binding (and event binding, which click is a subset of) pass the current data as the first argument and the event as the second argument to any handlers.
So, arg would be equal to your viewModel in your case.

A: The parameter arg will reference the parent and as you can see in your example the actual viewmodel is the parent. Putting an argument there is mainly used when you have nested controllers and want to reference the parent dynamically as stated in the second example here, http://knockoutjs.com/documentation/click-binding.html

        <button data-bind="click: $parent.removePlace">Remove</button>

I would also recommend you not to use self as a parameter name in javascript, instead go for that
var that = this;


Q: Question about Permutation Sets (Groups and Symmetries) Let $a = (123)(456)$ in $S_{10}$. Find the highest possible order of a permutation $b$ in $S_{10}$ such that $b^k=a$ for some $k$.
Attempt: I already know that there are only two possible cases for b. The first case in which the disjoint cycle form of b contains a 6-cycle, and the second case in which b contains exactly two 3-cycles (and perhaps some other cycles that aren't 3-cycles). I've already tried a few examples of each case but how would I know if I've attained a maximum order one? For the first case I have one example which is any permutation that contains $(142536)$ whose square is a. And in the second case all I can think of are the permutations that contain a itself. Are there any others?

A: Let $$x=(a_1,a_2...,a_6)(b_1,b_2,b_3,b_4)$$
Notice that $|x|=12$ and $$x^4=(a_1,a_5,a_3)(a_2,a_6,a_4)$$
So chosse $x=(1,4,3,6,2,5)(7,8,9,10)$.


Q: get all rows from orignal Dataframe which is having number or alpha number in particular column? I have Dataframe Like this in df_init
          column1
       0  hi all, i am fine
       1  How are you ? 123 a45
       2  123444234324!!!  (This is also string)
       3  sdsfds sdfsdf 233423
       5  adsfd xcvbb cbcvbcvcbc

I want to get all those values from this dataframe which is having a number or alpha number
I am expecting like this in df_final
          column1
       0  How are you ? 123 a45
       1  123444234324!!!  (This is also string)
       2  sdsfds sdfsdf 233423

A: Use str.contains with \d for match number and filter by boolean indexing:
df = df[df.column1.str.contains('\d')]
print (df)
                                  column1
1                   How are you ? 123 a45
2  123444234324!!!  (This is also string)
3                    sdsfds sdfsdf 233423

EDIT:
print (df)
                  column1
0   hi all, i am fine d78
1   How are you ? 123 a45
2         123444234324!!!
3    sdsfds sdfsdf 233423
4  adsfd xcvbb cbcvbcvcbc
5                 234324@
6                 123! vc

df = df[df.column1.str.contains(r'^\d+[<!\-[.*?\]>@]+$')]
print (df)
           column1
2  123444234324!!!
5          234324@


Q: Hausdorff quotient space with compact or finite inverse images Let $X$ be a locally compact, second countable Hausdorff topological space and let $Y$ be a Hausdorff quotient of $X$. Let $q:X\to Y$ denote the quotient map. Then for $y\in Y$, $q^{-1}(y)$ is a closed subset of $X$ but not necessarily compact.
Is it possible to find another locally compact, second countable Hausdorff space $X_1$ such that $Y$ is quotient of $X_1$ and such that for all $y\in Y$, $q_1^{-1}(y)$ is compact, where $q_1:X_1\to Y$ is the quotient map? Is it possible even to arrange that each $q_1^{-1}(y)$ is finite?

A: I think the answer is no. I'll basically point to two exercises in Engelking.
A map $q:X\to Y$ is called hereditary quotient, if for any $B\subset Y$, the restriction of $q$ on $q^{-1}(B)$ is a quotient map (see Exercise 2.4.F for some characterizations). In particular, it is said there that any quotient map onto a Hausdorff Frechet-Urysohn space is hereditary quotient.
On the other hand Exercise 3.7.D says that if $q$ is hereditary quotient with compact preimages of points, then $w(Y)\le w(X)$ and if $X$ is locally compact, then $Y$ is locally compact (the point is that hereditary quotient + compact preimages + $X$ is locally compact implies that the map is perfect, and in particular closed).
Now let $X=\mathbb{R}$ and let $q$ be the map that sends all integer into a point, and so you get a countable wedge of circles. Note that it is not locally compact at the point where all the circles meet. However, it is a metrizable space and in particular, it is Frechet-Urysohn.
Hence, if $X_1$ is locally compact and $q_1:X_1\to Y$ is quotient, then it is hereditary quotient, and so if we further assume that preimages under $q_1$ are compact, then $Y$ is locally compact, which leads to a contradiction.


Q: Short echo repurposed in newer versions of PHP? I have heard from several people that <?= has been re-purposed / replaced in newer versions of PHP, but am unable to find supporting documentation to this change, or to what version(s) it effects. Has short echo been replaced or re-purposed and is there supporting documentation to it?

A: The current documentation does not reflect any change of behaviour of shorthand echo (<?=) since version 5.4.0, in which only the necessary configuration to enable it was changed.

*

*http://php.net/manual/en/function.echo.php


Q: Remembering window workspace between Unity sessions When I log in to Ubuntu I have 6 workspaces set up in Unity/compiz. On four of those workspaces I place a chrome window, in another RStudio, and another just has a few Terminals. I also have pidgin on the RHS of each workspace (sticky).
When I log in the next time I'd like to be able to run something which:
a - places the programs I always use (Terminal, chrome, Rstudio) on the correct workspace;
b - fixes their dimensions (when I switch laptop between external screen and internal screen Unity changes the workspace - see Switching displays while keeping windows in workspaces);
Is there a way to record window size and workspace so I can write a shell script to restore my preferred setup ?
The solution should (if possible) work with chrome in particular.
There is a partial answer to this, pointed out by Jacob - Is there a script (or software) to open an application window on a specific viewport and position? - but that is targeted at opening up the same set of windows each time, rather than recording a particular setup and then restoring that. It therefore solves some of my problems, but not the full restoration of chrome windows (with tabs) which were open at the time I saved  the session.
I think that is down to me imperfectly explaining the issue - I think the solution found by Jacob sorts out the problem I identified, so will accept and come back to this if I need the other element sorted.
thanks


Q: Mac loses the ability to set desktop image after a few days of automatic setting I have a script that pulls images from Reddit and sets them as my wallpaper. This works fine for the first few days, though after that it just stops changing the wallpaper. The images continue to download to the local folder but for some reason I just can't set my wallpaper anymore.  Even doing right click 'set desktop picture' on an image or manually using my automator app.
The only way to fix this is to reset it by going to wallpaper in settings and manually setting it. I've even tried using different methods of setting the wallpaper but the result is the same.
Does anyone know what might be causing this or how to debug?

A: Eventually figured out that "there is a problem where OS X would cache the wallpaper in RAM and not check to see if the picture file had changed given that it was using the same filename each time." So solved by just using the hash of the image as a filename.


Q: Pandas: Adding column with calculations from other columns I have a csv with measurements:
YY-MO-DD HH-MI-SS_SSS    |        x          |          y
2015-12-07 20:51:06:608  |        2          |          4
2015-12-07 20:51:07:609  |        3          |          4

and I want to add another column with the square root of the sum of x^2+y^2,
z=sqrt(x^2+y^2)
like this:
 YY-MO-DD HH-MI-SS_SSS       |        x          |          y     |     z
    2015-12-07 20:51:06:608  |        2          |          4     |   4.472
    2015-12-07 20:51:07:609  |        3          |          4     |    5

Any ideas?
Thank you !

A: Use np.sqrt on the result of the squares:
In [10]:
df['z'] = np.sqrt(df['x']**2 + df['y']**2)
df

Out[10]:
   x  y         z
0  2  4  4.472136
1  3  4  5.000000

You can also sum row-wise the result of np.square and call np.sqrt:
In [13]:
df['z'] = np.sqrt(np.square(df[['x','y']]).sum(axis=1))
df

Out[13]:
   x  y         z
0  2  4  4.472136
1  3  4  5.000000


Q: Map in Fragment: incompatible types cannot be converted to Fragment I checked several solutions on StackOverflow but nothing fitted my special problem.
I have several Fragments and I want a google map activity in one of those.
So I prepared the layout and created a new google map Activity with the necessary name.
When I try to run it it says:
Error:(20, 42) error: incompatible types: FragmentScreenD cannot be converted to Fragment

Furthermore it is written
"Wrong 2nd argument type. Found "com.example.name.yapplication.FragmentScreenD", required "android.support.v4.app.Fragment".

After doing this the message did not disappear.
package com.example.name.myapplication;

import android.support.v4.app.FragmentActivity;
import android.os.Bundle;

public class MainActivity extends FragmentActivity {

    @Override
    protected void onCreate(Bundle arg0) {
        super.onCreate(arg0);
        setContentView(R.layout.activity_main);
        getSupportFragmentManager().beginTransaction()
                .replace(R.id.fragment1, new FragmentScreenA()).commit();
        getSupportFragmentManager().beginTransaction()
                .replace(R.id.fragment2, new FragmentScreenB()).commit();
        getSupportFragmentManager().beginTransaction()
                .replace(R.id.fragment3, new FragmentScreenC()).commit();
        getSupportFragmentManager().beginTransaction()
                .replace(R.id.fragment4, new FragmentScreenD()).commit();
    }
}

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="2"
    android:orientation="horizontal"
    android:paddingBottom="10dp"
    android:weightSum="2" >

    <FrameLayout
        android:id="@+id/fragment3"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="0dp"
        android:layout_weight="1" />

    <FrameLayout
        android:id="@+id/fragment4"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_weight="1" />
</LinearLayout>

package com.example.name.myapplication;

import android.support.v4.app.FragmentActivity;
import android.os.Bundle;

import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;

public class FragmentScreenD extends FragmentActivity implements OnMapReadyCallback {

    private GoogleMap mMap;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_fragment_screen_d);
        // Obtain the SupportMapFragment and get notified when the map is ready to be used.
        SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
                .findFragmentById(R.id.map);
        mapFragment.getMapAsync(this);
    }

    /**
     * Manipulates the map once available.
     * This callback is triggered when the map is ready to be used.
     * This is where we can add markers or lines, add listeners or move the camera. In this case,
     * we just add a marker near Sydney, Australia.
     * If Google Play services is not installed on the device, the user will be prompted to install
     * it inside the SupportMapFragment. This method will only be triggered once the user has
     * installed Google Play services and returned to the app.
     */
    @Override
    public void onMapReady(GoogleMap googleMap) {
        mMap = googleMap;

        // Add a marker in Sydney and move the camera
        LatLng sydney = new LatLng(-34, 151);
        mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
        mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
    }
}

A: FragmentScreenD which is extended From FragmentActivity does not Fragment and the second arguement of FragmentManager's replace method needs a Fragment , FragmentScreenD can be started via intent and its behavior is like an Activity, change FragmentActivity to Fragment and implement the methods in FragmentScreenA,B,C,...

A:
I have several fragments and I want a google map activity in one of those.

You don't want an Activity, you want a Fragment, as the error is trying to tell you.
You can add a new SupportMapFragment() directly to the FrameLayout, or you need to instead extend that rather than FragmentActivity

A: Just take a map fragment in fragment XML and check this link it will helpful to solve problem
android MapView in Fragment


Q: Forget Content Before Pause in Beamer I am using beamer
and I am drawing some figures on an image, which should appear sequentially on the image.
    \documentclass{beamer}
    \usepackage{tikz}

    \begin{document}

\begin{frame}
        \begin{tikzpicture}

            \node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=0.9\textwidth]{1.png}};
            \begin{scope}[x={(image.south east)},y={(image.north west)}]
                \draw[help lines,xstep=.1,ystep=.1] (0,0) grid (1,1);
                \foreach \x in {0,1,...,9} { \node [anchor=north] at (\x/10,0) {0.\x}; }
                \foreach \y in {0,1,...,9} { \node [anchor=east] at (0,\y/10) {0.\y}; }
                \draw[red,ultra thick,rounded corners] (0.2,0.84) rectangle (0.1,0.95); \pause
                \draw[red,ultra thick,rounded corners] (0.52,0.7) rectangle (0.85,0.36); \pause
                \draw[red,ultra thick,rounded corners] (0.09,0.84) rectangle (0.294,0.16); \pause
                \draw[red,ultra thick,rounded corners] (0.12,0.15) rectangle (0.294,0.06); \pause
                \draw[red,ultra thick,rounded corners] (0.36,0.7) rectangle (0.48,0.31); \pause
                \draw[red,ultra thick,rounded corners] (0.04,0.94) rectangle (0.85,0.2);

            \end{scope}
        \end{tikzpicture}

\end{frame}
    \end{document}

The problem: after a new figure appears on the image, I want the old one to fade out.
How could this be done ? Thanks a lot for your help.

A: If you want animated fading, beamer can achieve this by creating multiple slides on which the objects have slightly different colors, and showing those in rapid succession (like a flip-book, only works in presentation mode). This could generate a pdf with many pages, which I'm not sure you want. Furthermore, fading to invisible may be problematic. The current version of beamer (3.36) does not support "true" transparency, so instead fakes it by blending an object's color with the frame background color. This will cause problems in your case because you're drawing shapes atop a figure. In trying to make the objects transparent beamer will actually make them white (to match the background), regardless of the figure colors.
If you wish the objects to disappear completely after you've drawn them, you can use \visible to specify the slides on which each object should be visible.
\documentclass{beamer}
\usepackage{tikz}
\begin{document}
\begin{frame}
\begin{tikzpicture}
    \node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=0.9\textwidth]{example-image}};
    \begin{scope}[x={(image.south east)},y={(image.north west)}]
        \draw[help lines,xstep=.1,ystep=.1] (0,0) grid (1,1);
        \foreach \x in {0,1,...,9} { \node [anchor=north] at (\x/10,0) {0.\x}; }
        \foreach \y in {0,1,...,9} { \node [anchor=east] at (0,\y/10) {0.\y}; }
        \visible<1>{\draw[red,ultra thick,rounded corners] (0.2,0.84) rectangle (0.1,0.95);}
        \visible<2>{\draw[red,ultra thick,rounded corners] (0.52,0.7) rectangle (0.85,0.36);}
        \visible<3>{\draw[red,ultra thick,rounded corners] (0.09,0.84) rectangle (0.294,0.16);}
        \visible<4>{\draw[red,ultra thick,rounded corners] (0.12,0.15) rectangle (0.294,0.06);}
        \visible<5>{\draw[red,ultra thick,rounded corners] (0.36,0.7) rectangle (0.48,0.31);}
        \visible<6>{\draw[red,ultra thick,rounded corners] (0.04,0.94) rectangle (0.85,0.2);}
    \end{scope}
\end{tikzpicture}
\end{frame}
\end{document}

Alternatively, you could use \temporal to define the appearance before, on, and after a given slide. In the following, \colorize is defined to be invisible before the given slide, red on the given slide, and 35% black thereafter.
\documentclass{beamer}
\usepackage{tikz}
\def\colorize<#1>{%
    \temporal<#1>{\invisible<-#1>}{\color{red}}{\color{black!35}}}
\begin{document}
\begin{frame}
\begin{tikzpicture}
    \node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=0.9\textwidth]{example-image}};
    \begin{scope}[x={(image.south east)},y={(image.north west)}]
        \draw[help lines,xstep=.1,ystep=.1] (0,0) grid (1,1);
        \foreach \x in {0,1,...,9} { \node [anchor=north] at (\x/10,0) {0.\x}; }
        \foreach \y in {0,1,...,9} { \node [anchor=east] at (0,\y/10) {0.\y}; }

        \colorize<1>{\draw[ultra thick,rounded corners] (0.2,0.84) rectangle (0.1,0.95);}
        \colorize<2>{\draw[ultra thick,rounded corners] (0.52,0.7) rectangle (0.85,0.36);}
        \colorize<3>{\draw[ultra thick,rounded corners] (0.09,0.84) rectangle (0.294,0.16);}
        \colorize<4>{\draw[ultra thick,rounded corners] (0.12,0.15) rectangle (0.294,0.06);}
        \colorize<5>{\draw[ultra thick,rounded corners] (0.36,0.7) rectangle (0.48,0.31);}
        \colorize<6>{\draw[ultra thick,rounded corners] (0.04,0.94) rectangle (0.85,0.2);}
    \end{scope}
\end{tikzpicture}
\end{frame}
\end{document}


Q: Nodejs application healthcheck best practice I'm looking into setting up a healthcheck mechanism for nodejs microservices running via container orchestrations. From a nodejs/express point of view, what is considered best practice to ensure that the service is indeed running on a given port on a given container? Eg. A healthcheck middleware or particular nodejs library, using a separate service port etc.

A: In order to implement healthcheck in nodejs, use the following
use express-healthcheck as a dependency in your nodejs project
in your app.js or equivalent code, use the following line
app.use('/healthcheck', require('express-healthcheck')());
if your app is up your response will be like
{
  "uptime":23.09
}
also it returns a status code of 200
Hope this helps


Q: Next.js refreshes indefinitely when query params are present I'm running a pretty basic Next.js app on local (next dev) and whenever a route has query parameters, it loads an reloads in an infinite loop. I've removed all calls to router.push, router.replace, and window.location but to no avail. When there are no query params present, this doesn't happen, and when I deploy the app for production (next export) I see no such behavior. Any idea what could be going on?


Q: Why does read_edgelist from networkx not accept arrays/lists as weights? I am using Python and the networkx package to read an edgelist from file in order to build a graph.
My edgelist looks something like this:
[(0, 114, {'pts': array([[  1, 822],
       [  1, 821],
       [  2, 820],
       [  3, 819]], dtype=int16), 'weight': 23.38477631085024}),
(1, 110, {'pts': array([[ 1,  3],
       [ 1,  2],
       [ 2,  1]], dtype=int16), 'weight': 18.414213562373096})]

I wrote this edgelist with:
nx.write_edgelist(G, 'my_el.edgelist', data=True)

My edges are defined by the start and the end node, and following that, I have my weights. Each edge has two weights. The first weight is a array of pixel-coordinates, and the second is a float.
The graph was constructed from a skeleton with the ´sknw´ library using the build_sknw function:
def build_sknw(ske, multi=False):
    buf = buffer(ske)
    nbs = neighbors(buf.shape)
    acc = np.cumprod((1,)+buf.shape[::-1][:-1])[::-1]
    mark(buf, nbs)
    pts = np.array(np.where(buf.ravel()==2))[0]
    nodes, edges = parse_struc(buf, pts, nbs, acc)
    return build_graph(nodes, edges, multi)

Now I want to read in this edgelist to build a graph. However, Python does not recognize my array of pixel-coords as a single weight-element.
I've tried nx.read_edgelist('my_el.edgelist', data=True), which gives me the following error:
TypeError: Failed to convert edge data (["{'pts':", 'array([[', '1,', '822],']) to dictionary.

nx.read_edgelist('my_el.edgelist', data=['pts', 'weight'] gives me:
IndexError: Edge data ["{'pts':", 'array([[', '1,', '822],'] and data_keys ['pts', 'weight'] are not the same length

and nx.read_edgelist('my_el.edgelist', data=(('pts', int), ('weight', float'))) gives me
IndexError: Edge data ["{'pts':", 'array([[', '1,', '822],'] and data_keys (('pts', <class 'int'>), ('weight', <class 'float'>)) are not the same length

I assume that the function is having a problem with either the array as a weight, or with the formatting of the my_el.edgelist file, but I do not really know, how to properly solve this issue without any workarounds via conversion to string, or similar.
I'd be thankful if someone can point me in the right direction and help me out with this!

A: Dealing with numpy arrays seems to be a major problem for networkx. The function that converts my image skeleton to the graph G however seems to be using numpy arrays.
Since I prefer not to alter the imported function, a possible workaround that seemed to mitigate the problem when writing the edgelist to file was to change the array type thus:
for (s, e) in G.edges():
    G[s][e]['pts'] = G[s][e]['pts'].tolist()

It might not be the most computationally efficient, and doesn't deal with the root of the problem, but will get the job done, in case anybody encounters a similar issue.


Q: Noda Time Date Comparison I am new to Noda Time and I basically want to compare if a date has expired or not. In my case I have an object with the date it was created, represented by a LocalDate and the amount of months it's valid as an int, so I wanted to do a simple:
if ( Now > (dateCreated + validMonths) ) expired = true;

But I can't find in the Noda Time documentation the proper way to get the Now Date (they only show how to get the Now Time as SystemClock.Instance.Now) and the proper way to handle time comparisons.
For example if today is January 1st 2015 and the document was created in December 1st 2014, and it was valid for one month, today it expires its one month validity.
I miss methods such as isBefore() and isAfter() to compare dates and times. Simple overloads of the < > operators could also be very helpful.

EDIT:
1 - Sorry, there are < > operators to compare dates.
2 - I solve my problem using this code (not tested yet!):
...
LocalDate dateNow = this.clock.Now.InZone(DateTimeZoneProviders.Tzdb.GetSystemDefault()).LocalDateTime.Date;
LocalDate dateExpiration = DataASO.PlusMonths(validity);
return (dateNow < dateExpiration);

A: To get the current date, you need to specify which time zone you're in. So given a clock and a time zone, you'd use:
LocalDate today = clock.Now.InZone(zone).Date;

While you can use SystemClock.Instance, it's generally better to inject an IClock into your code, so you can test it easily.
Note that in Noda Time 2.0 this will be simpler, using ZonedClock, where it will just be:
LocalDate today = zonedClock.GetCurrentDate();

... but of course you'll need to create a ZonedClock by combining an IClock and a DateTimeZone. The fundamentals are still the same, it's just a bit more convenient if you're using the same zone in multiple places. For example:
// These are IClock extension methods...
ZonedClock zonedClock = SystemClock.Instance.InTzdbSystemDefaultZone();

// Or...
ZonedClock zonedClock = SystemClock.Instance.InZone(specificZone);


Q: DataFrame column data to series I have the following DataFrame that contains some rainfall data. I want to reformat this so that I get a Series with 24 entries indexed with 'Month-Year' so that it will be easier to plot this as a line.
    JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC
Year
2015    96.6    58.9    23.5    18.6    62.9    26.7    60.0    108.6   67.9    58.1    78.0    80.4
2016    131.8   54.2    80.2    51.2    64.1    91.3    17.4    38.8    50.9    29.8    100.6   17.4

I was thinking I could iterate through each row and pull out each month individually and add it to a series. I was wondering if there was a better way.

A: Use unstack with to_frame i.e
ndf = df.unstack().to_frame().sort_index(level=1)

             0
    Year
JAN 2015   96.6
FEB 2015   58.9
MAR 2015   23.5
APR 2015   18.6
MAY 2015   62.9
JUN 2015   26.7
JUL 2015   60.0
AUG 2015  108.6
SEP 2015   67.9
OCT 2015   58.1
NOV 2015   78.0
DEC 2015   80.4
JAN 2016  131.8
FEB 2016   54.2
MAR 2016   80.2
APR 2016   51.2
MAY 2016   64.1
JUN 2016   91.3
JUL 2016   17.4
AUG 2016   38.8
SEP 2016   50.9
OCT 2016   29.8
NOV 2016  100.6
DEC 2016   17.4

If you need index as a string then
ndf.index = ['{} {}'.format(i,j) for i,j in ndf.index.values]

If you need it as a datetime then
ndf.index = pd.to_datetime(['{} {}'.format(i,j) for i,j in ndf.index.values])


Q: Is it possible to create a sub-folder wihtin a library in salesforce? To be able to create a hierarchical content structure within the salesforce library it is necessary to be able to create folders within folders. Is this possible or what is the best work around?

A: The answer depends on the type of content you want to put in your folders...
Code. Files representing code on the Salesforce.com platform are represented in a mostly flat, folderless structure. In order to represent them on your local disc for development and storage in source control, there is a basic folder structure to categorise, Apex code, Visualforce pages, Object definitions etc. each in its own subfolder. However, while its a much requested enhancement, you cannot currently split your Apex code into sub-folders, the best you can do is using prefixing of the class names. Beyond that, you could use Packages to further scope and contain your code (using a namespace prefix), however that is in most cases a bit to heavy weight.

Documents. As in images, written documents, pdf's, csv files, general end user files etc. These can be stored in a growing number of ways in Salesforce, Attachments, Chatter Files, Content Workspace and via the Document object. This option does permit the organisation of Document records (which represent your files) in a single depth Folder structure only, no sub-folders are permitted. Note as per the documentation you can also use them to contain other Salesforce components, such as Email Templates.

A: See new app Folderize on AppExchange.
From the overview:  "Folderize provides the missing folder structure for Salesforce Content Libraries. Create a hierarchy of folders like in a file system; then link documents from existing libraries to one or more subfolders."


Q: Sumar values desde checked inputs - Javascript Tengo la siguiente función para obtener los los valores 0, 1 o 2 de los botones tipo radio de 2 categorías (ciclos for)
La idea es poder sumar (y enviar al botón TOTAL) las 2 categorías.
Dejo el código. Me arroja undefined.
<form>
   <input type="radio" name="dressing"  value="0">0 </input>
   <input type="radio" name="dressing"  value="1">1 </input>
   <input type="radio" name="dressing"  value="2">2 </input>

   <input type="radio" name="stairs"  value="0">0 </input>
   <input type="radio" name="stairs"  value="1">1 </input>
   <input type="radio" name="stairs"  value="2">2 </input>
                                </form>

Value of Radio Bottons in Dressing

Value of Radio Bottons in Stairs

   <button type="button" onclick="displayRadioValue()">  Get Categories Values </button>

TOTAL SCORE

   <button  type="button" onclick="displayRadioValue()">TOTAL Button</button>

A: El problema es que donde estas implementando la operación de suma al final ya no tienes acceso a los valores internos de los loops, para solucionarlo podrias adicionar un par de variables para que se les pueda reasignar el valor y poder acceder a diferentes escopos.
Aqui te dejo un ejemplo con parte del codigo que modifique, me haces saber si te fue de ayuda.

function displayRadioValue() {
    var dressing = document.getElementsByName('dressing');
    var dressingValue = 0;

      for(i = 0; i < dressing.length; i++)  {
        if(dressing[i].checked) {
          dressingValue = dressing[i].value;
          document.getElementById("resultRadioDressing").innerHTML = "Value of Radio Bottons in Dressing is " + dressingValue;
        }
      }

    var stairs = document.getElementsByName('stairs');
    var stairsValue = 0;

      for(j = 0; j < stairs.length; j++) {
          if(stairs[j].checked) {
            stairsValue = stairs[j].value;
            document.getElementById("resultRadioStairs").innerHTML = "Value of Radio Bottons in Stairs is " + stairsValue;
          }
        }

    document.getElementById("ResultTOTAL").innerHTML = parseInt(dressingValue) + parseInt(stairsValue);
  }
<form>
  <input type="radio" name="dressing"  value="0">0 </input>
  <input type="radio" name="dressing"  value="1">1 </input>
  <input type="radio" name="dressing"  value="2">2 </input>

  <input type="radio" name="stairs"  value="0">0 </input>
  <input type="radio" name="stairs"  value="1">1 </input>
  <input type="radio" name="stairs"  value="2">2 </input>
</form>

Value of Radio Bottons in Dressing

Value of Radio Bottons in Stairs

<button type="button" onclick="displayRadioValue()">  Get Categories Values </button>

TOTAL SCORE

<button  type="button" onclick="displayRadioValue()">TOTAL Button</button>

A: Try this:


Q: How recursively find files with Unicode names in C++? I found and modify solution from here:
#include <iostream>
#include <windows.h>
#include <vector>
#include <fstream>

using namespace std;

//wofstream out;

void FindFile(const std::wstring &directory)
{
    std::wcout << endl << endl << endl << "FindFile(" << directory << ")" << std::endl;

    std::wstring tmp = directory + L"\\*";
    WIN32_FIND_DATAW file;
    HANDLE search_handle = FindFirstFileW(tmp.c_str(), &file);
    if (search_handle != INVALID_HANDLE_VALUE)
    {
        std::vector<std::wstring> directories;

        do
        {
            std::wcout << std::endl;
            std::wcout << "    [" << file.cFileName << "]" << std::endl;
            tmp = directory + L"\\" + std::wstring(file.cFileName);

            if (file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
            {
                if ((!lstrcmpW(file.cFileName, L".")) || (!lstrcmpW(file.cFileName, L".."))) {
                    std::wcout << "continuing..." << std::endl;
                }
                else {
                    std::wcout << "saving path to this directory" << std::endl;
                    directories.push_back(tmp);
                }
            } else {
                std::wcout << "save [" << tmp << "] as file" << std::endl;
            }

            //std::wcout << tmp << std::endl;
            //out << tmp << std::endl;
        }
        while (FindNextFileW(search_handle, &file));

        std::wcout << "all items inside current directory was worked out. close it's handle." << std::endl;
        FindClose(search_handle);

        for(std::vector<std::wstring>::iterator iter = directories.begin(), end = directories.end(); iter != end; ++iter) {
            std::wcout << "recursively find in next directory: [" << *iter << "]" << std::endl;
            FindFile(*iter);
        }
    } else {
        std::wcout << "invalid handle value" << std::endl;
    }
}

int main()
{
    //out.open("C:\\temp\\found.txt");

    FindFile(L"C:\\test");

    //out.close();

    cout << "The end" << endl;
    string str;
    cin >> str;

    return 0;
}

but this code isn't working with folders or files with cyrillic names (but I use Unicode versions of all types and functions!)
Update: Application just finish, without any exceptions, as if all commands was executed.
Update-2 (print-screen):
Who had the same problem? Thanks for any help.
SOLVED
Thanks a lot to @zett42 !
After some refactoring working code looks like:
#include <iostream>
#include <windows.h>
#include <vector>
#include <fstream>
#include <io.h>
#include <fcntl.h>

using namespace std;

vector<wstring> FindFiles(const std::wstring &directory) {
    vector<wstring> files;
    std::vector<std::wstring> directories;

    std::wstring fullPath = directory + L"\\*";
    WIN32_FIND_DATAW file;
    HANDLE search_handle = FindFirstFileW(fullPath.c_str(), &file);

    if (search_handle == INVALID_HANDLE_VALUE)
        return files;

    do
    {
        fullPath = directory + L"\\" + std::wstring(file.cFileName);

        if (!(file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
            files.push_back(fullPath);
        else {
            if ((lstrcmpW(file.cFileName, L".")) && (lstrcmpW(file.cFileName, L"..")))
                directories.push_back(fullPath);
        }
    }
    while (FindNextFileW(search_handle, &file));

    FindClose(search_handle);

    for(std::vector<std::wstring>::iterator iter = directories.begin(), end = directories.end(); iter != end; ++iter) {
        vector<wstring> newFiles = FindFiles(*iter);
        files.insert(files.begin(), newFiles.begin(), newFiles.end());
    }

    return files;
}

int main()
{
    _setmode( _fileno(stdout), _O_U16TEXT );

    vector<wstring> files = FindFiles(L"E:\\test");

    wcout << L"All found files: " << endl;
    for (int i = 0; i < files.size(); ++i)
        wcout << files[i] << endl;

    cout << "The end" << endl;
    string str;
    cin >> str;

    return 0;
}

A: On Windows, Unicode output to console doesn't work by default, even if you use std::wcout.
To make it work, insert the following line at the beginning of your program:
_setmode( _fileno(stdout), _O_U16TEXT );

_setmode and _fileno are Microsoft specific function.
You may also have to change console font. I'm using Lucida Console which works fine for cyrillic letters.
Complete example:
#include <iostream>
#include <io.h>      // _setmode()
#include <fcntl.h>   // _O_U16TEXT

int main()
{
    // Windows needs a little non-standard magic for Unicode console output.
    _setmode( _fileno(stdout), _O_U16TEXT );

    std::wcout << L"по русски\n";
}

Example should be saved as UTF-8 encoded file because of the Unicode string literal, but this is not relevant in your case because you don't have Unicode string literals.
I have successfully tested this code under MSVC2015 and MSVC2017 on Win10.


Q: Is it possible to use angular lazy loading without a routes file I am using angular lazy loading for my modules.
For example I load the modules like this as recommended by AG8
const routes: Routes = [
  {path: 'home', component: HomeComponent, data: {title: 'Home', animation: 'Home'}},
  {path: 'services', loadChildren: () => import('./modules/services.module').then(module => module.ServicesModule), data: {title: 'Services', animation: 'Services'}},
  // {path: '', redirectTo: 'home', pathMatch: 'full'},
  {path: 'login', loadChildren: () => import('./modules/login.module').then(module => module.LoginModule), data: {title: 'Login', animation: 'Login'}},
  {path: 'dashboard', loadChildren: () => import('./modules/dashboard.module').then(module => module.DashboardModule ), data: {title: 'Dashboard', animation: 'Dashboard'}, canActivate: [AppAuthGuard]},
  {path: 'user/:userID/event/:eventID', loadChildren: () => import('./modules/event.module').then(module => module.EventModule ), data: {title: 'Event Details', animation: 'Event'}},
  {path: 'user/:userID', loadChildren: () => import('./modules/user.module').then(module => module.UserModule), data: {title: 'Profile', animation: 'User'}},
  {path: '**', redirectTo: 'home', pathMatch: 'full' },
];

The for each of those modules I have their corresponding files eg:
@NgModule({
  imports: [
    CommonModule,
    SomeRoutingModule
  ],
  declarations: [SomeComponent]
})
export class SomeModule { }

But for all those modules I have to create their corresponding router files eg:
const routes: Routes = [
  {
    path: '',
    component: SomeComponent
  }
];

Is there a way to just guide from the parent module the route to load the lazy module's declared component without having to create a router file?
Something like:
loadChildren: () => import('./modules/services.module').then(module => module.ServicesModule.SomeComponent)


Q: Jquery menu breaking on fast clicking/ scrolling over I have this jquery code below, but the problem is that if I scroll over and out of the trigger element quickly and through the menu, then it breaks, progressively showing less elements each time until nothing is shown. Can I add a timer or easing to stop this breaking?

Read the blog

paperback

Signed edition

kindle edition

hardback edition

postcard edition

(function ($) {
Drupal.behaviors.weaveoftheride = {
attach: function(context, settings) {

 console.log('called');
$('.buying-dropdown li').hover(
        function () {
            //show its submenu
            $('ul', this).stop().slideDown(100);

        },
        function () {
            //hide its submenu
            $('ul', this).stop().slideUp(100);
        }
    );
}

};
})(jQuery);

A: You should force jQuery to clear the animation queue and jump to the end of the animation when using the .stop() method, i.e. .stop(true, true).


Q: what does "with four no. 10 tins of Seven X per carton" mean I was reading this article, and found one sentence that I couldn't understand.
https://www.quora.com/Is-it-legal-for-Coca-Cola-to-not-reveal-what-is-in-the-recipe/answer/Donald-Pearline
What does this mean?
"At the plant level we received cartons with four no. 10 tins of Seven X per carton, unlabeled except as Seven X." mean

A: "Seven X" is the name of the ingredient put on the cans by Coca-Cola to keep its true identity secret.
"No 10" is a size of can. I'm not familiar with American can sizes, but I'd guess that it was reasonably large.
"unlabeled except as Seven X" means that the only label on the can was "Seven X", there were no other identifying marks.
So the whole sentence means

We received cartons each containing 4 off size 10 cans of an ingredient known only as "Seven X"


Q: Python, simple calculation User types an integer number (smaller than 100, bigger than 0)
If user types 0, the program ends. In case of numbers that are 100 or bigger, or that are -1 or smaller, it shows INVALID, and prompts user to keep entering number.
a = int(input('Enter a number: '))

total =0
keep = True

while keep:

    if a ==0:
        print('Thanks for playing.. goodbye')
        break;
    else:
        while a>99 or a <0:
            print('INVALID')
            a = int(input('Enter a number: '))

    total = total + a
    print(total)
    a = int(input('Enter a number: '))

Just putting normal numbers and getting the sum, I enter 0, then it stops, but when I enter 100, INVALID shows up, then I enter 0, the program doesn't end and it keeps showing me INVALID.
Any suggestions will be appreciated. Thanks!

A: At your code, the else never breaks the loop so it only sums the total after it has exitted that 2nd loop, but that 2nd one doesn't have a behaviour for 0. You should try to keep it simple with just one loop.
total =0
while True:
    a = int(input('Enter a number: '))
    if a == 0:
        print('Thanks for playing.. goodbye')
        break
    else:
        if a > 99 or a < 0: # You don't need a second while, just an if.
            print('INVALID')
        else:
            total = total + a
            print(total)

Identation is key at python, be careful with it.
Also cleaned a bit your code. As example: Since you get into a loop with the while there is no need to use 2-3 different inputs in and out of the loop, just add it once at the beginning inside of the loop.

A: I think this is a more pythonic approach
total =0

while True:
    a = int(input('Enter a number: '))
    if a == 0:
        break
    if a>99 or a <0:
            print('INVALID')
    else:
        total = total + a

print(total)
print('Thanks for playing.. goodbye')

A: When using your code, the result is :
Enter a number: 100
INVALID

Enter a number: 0
0

Enter a number: 0
Thanks for playing.. goodbye

And I think your code may should be:
a = int(input('Enter a number: '))

total =0
keep = True

while keep:

    if a ==0:
        print('Thanks for playing.. goodbye')
        break;
    else:
        while a>99 or a <0:
            print('INVALID')
            a = int(input('Enter a number: '))
            if a ==0:
                print('Thanks for playing.. goodbye')
                break;

    total = total + a
    print(total)
    a = int(input('Enter a number: '))

You may procide your requirement more detail.

A: You are in while loop of else conditional since you entered 100 at first and you can't get out of there unless you enter a number satisfies 0 <= a <= 99. You can make another if statement for a == 0 to exit the while loop just below a = int(input('Enter a number')) of else conditional.
I think it is good to check where you are in while loop using just one print(a). For example, just before if-else conditional or just before while of else conditional. Then, you can check where it gets wrong.
a = int(input('Enter a number: '))

total = 0
keep = True

while keep:
    \\ print(a) here to make sure if you are passing here or not.
    if a == 0:
        print('Thanks for playing.. goodbye')
        break;
    else:
        \\ print(a) here to make sure if you are passing here or not.
        while a > 99 or a < 0:   \\You are in while loop since you entered 100 at first and you can't get out from here unless you enter a: 0 <= a <= 99.
            print('INVALID')
            a = int(input('Enter a number: '))
            if a == 0:
                print('Thanks for playing.. goodbye')
                break;
    total = total + a
    print(total)
    a = int(input('Enter a number: '))


Q: Zend Framework - Issue with delete from database code In my Application_Model_DbTable_User, I have the following function:
public function deleteUser($username)
{
    $this->delete('username = ' . (string) $username);
}

This function is being called from my AdminController, with this three lines of code.
$uname = $this->getRequest()->getParam('username');
$user = new Application_Model_DbTable_User();
$user->deleteUser($uname);

This error however, turns up.

Column not found: 1054 Unknown column 'test' in 'where clause'

With test being the user I am trying to delete.
This code is adapted from a previous code which deletes based on id, a INT field, which works perfectly fine. What am I doing wrong? I would be happy to give more detailed codes if needed. Thanks.

A: Your query isn't quoted:
$this->delete('username = ' . (string) $username);

This equates to:
WHERE username = test

If you use the where() method, it will do this for you:
$table->where('username = ?', $username);

Or (like the example in the docs):
$where = $table->getAdapter()->quoteInto('bug_id = ?', 1235);
$table->delete($where);


Q: Winapi detect button hovering I've got a C++ project in which I'm using the Winapi to develop a window with a button and I want to change the text of the button when it's being hovered. For example, changing "Click me" to "Click me NOW!", when hovered. I've tried searching but I've not found any good ways to do this.
I noticed that when user hovers, the WM_NOTIFY message is received, but I don't know how to ensure that it has been called by the mouse hover. I've found that I can use TrackMouseEvent to detect hovering, but it's limited to a period of time and I want to execute an action every time the user hovers the button.
Here is how I create a button:
HWND Button = CreateWindow("BUTTON", "Click me",
        WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON | BS_NOTIFY,
        20, 240, 120, 20,
        hwnd, (HMENU)101, NULL, NULL);

And this my window procedure:
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{

    switch (msg)
    {
    case WM_NOTIFY:
    {
        //??? Here is where I get a message everytime I hover the button, But I don't know any proper way to see if it has been executed by the button.
    }
    case WM_CREATE: //On Window Create
    {
        //...
    }
    case WM_COMMAND: //Command execution
    {
        //...
        break;
    }
    case WM_DESTROY: //Form Destroyed
    {
        PostQuitMessage(0);
        break;
    }
    }
    return DefWindowProc(hwnd, msg, wParam, lParam);
}

A: Assuming you're using the common controls there is the BCN_HOTITEMCHANGE notification code for the WM_NOTIFY message. The message includes the NMBCHOTITEM structure, which includes information for whether the mouse is entering or leaving the hover area.
Here's an example:
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    switch(msg)
    {
        case WM_NOTIFY:
        {
            LPNMHDR header = *reinterpret_cast<LPNMHDR>(lParam);

            switch (header->code)
            {
                case BCN_HOTITEMCHANGE:
                {
                    NMBCHOTITEM* hot_item = reinterpret_cast<NMBCHOTITEM*>(lParam);

                    // Handle to the button
                    HWND button_handle = header->hwndFrom;

                    // ID of the button, if you're using resources
                    UINT_PTR button_id = header->idFrom;

                    // You can check if the mouse is entering or leaving the hover area
                    bool entering = hot_item->dwFlags & HICF_ENTERING;

                    return 0;
                }
            }

            return 0;
        }
    }

    return DefWindowProcW(hwnd, msg, wParam, lParam);
}

A: You can check the code of the WM_NOTIFY message to see if it is a NM_HOVER message.
switch(msg)
{
case WM_NOTIFY:
    if(((LPNMHDR)lParam)->code == NM_HOVER)
    {
       // Process the hover message
    }
    else if (...) // any other WM_NOTIFY messages you care about
    {}
}

A: You can use simply SFML to do this.
Code:
RectangleShape button;
button.setPosition(Vector2f(50, 50));
button.setSize(Vector2f(100, 40));
button.setFillColor(Color::Green);
if(button.getGlobalBounds().contains(static_cast<Vector2f>(Mouse::getPosition(/*your
window name*/window)
{
    button.setFillColor(Color::Red);
}