text:
Q: Visual Assist X: curly braces are moving during refactoring I use Visual Assist X, build from 05.01.2009, but the same problem occurred in the previous releases as well. (I run it on MSVS 2005)
When I do some refactoring (like extracting a method), everything's fine, but all the curly braces move forward. For example, before refactoring the code looked like this:
while (expr)
{
  doSmth();
}

After refactoring:
while (expr)
  {
  doSmth();
  }

So, I need to move manually all the brackets. Sure, the problem is minor, but it becomes annoying when you do a lot of refactoring. Is it a bug or just default settings? So, does anyone know a workaround?

A: It looks like Visual Assist takes its cue from the Visual Studio brace placement settings. To tweak this option, visit Tools|Options, then navigate to Text Editor, C/C++, Formatting. Make sure "Indent braces" is unticked.
(A related tip for general formatting issues after fiddling around with text is that you can get Visual Studio to do the reformatting for you. Put the cursor on one of the mispositioned braces, press Ctrl+Shift+] (extend selection to matching brace), then press Ctrl+K, Ctrl+F (reformat selection).)
BTW for genuine Visual Assist bugs the forum is a good place to go:
http://www.wholetomato.com/forum/
They seem to be only a small company, but they're generally pretty good at keeping track of open issues.


text:
Q: UDF python in Hive with File Json I have two problem with Hive view in Ambari.
1. Problem 1:I have script :

DELETE FILE /user/admin/hive/scripts/MKT_UDF/fb_audit_ads_creatives.py;

ADD FILE /user/admin/hive/scripts/MKT_UDF/fb_audit_ads_creatives.py;

SELECT TRANSFORM (line) USING 'python fb_audit_ads_creatives.py' as (ad_id) FROM stg_fb_audit_ads_creatives_json where date_time='2018-05-05';

I run it many times, It's run smoothly. But on some times, I get error:
You can see it: Here's Log error
I think it's due config (Hive, Ambari, ...time out...v.v.)
Problem 2: I have file json:
{
  "body": "https://www.facebook.com/groupkiemhieptinhduyen #truongsinhquyet #sapramat #tsq #game3d",
  "thumbnail_url": "https://external.xx.fbcdn.net/safe_image.php?d=AQDU01asRxdnCObW&w=64&h=64&url=https%3A%2F%2Fscontent.xx.fbcdn.net%2Fv%2Ft15.0-10%",
  "campaign_id": "23842841688740666"
}

I use script HQL above  and UDF Python:
for line in sys.stdin:
data = json.loads(line)
print (data)
print(data['thumbnail_url']

I run it's okay.
But with UDF Python:
for line in sys.stdin:
data = json.loads(line)
print (data)
print(data['body']

I get error: Log error
 Can you help me?

A: Instead of working with python, I recommend to try this UDTF that allows working on json columns within hive It is then possible to manipulate large json and fetch needed data in a distributed and optimized way.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to set particular Array using onClick to a common ListView (android)? I have two activity, first of which contains few buttons and the second one shows listview. For each button there is a particular array. Now i want to show for each onClick method in First activity, listview in 2nd activity should populate with that particular array.
I can have separate Class for each Array. But for large numbers of array, there will be same no. of Classes.
Any help will be appreciated.
Below is my code : 1st Activity
public void onClick1 (View view){
     startActivity(new Intent ("com.questions"));

 }
 public void onClick2 (View view){
     startActivity(new Intent ("com.questions"));

 }

2nd Activity :
 public static class mSectionFragment extends ListFragment {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {

        View rootView = inflater.inflate(R.layout.common_listview, container, false);
        final String[] sm =  getResources().getStringArray(R.array.first_array);

        setListAdapter(new ArrayAdapter<String>(getActivity(),
                android.R.layout.simple_list_item_1, sm));
        setListAdapter(getListAdapter());
        return rootView;
      }
    }

now i want to change R.array.first_array to second_array for onClick2

A: Pass the specific data(array) using intent .
In onClick1:
Intent i =new Intent(this,SecondActivity.class);

I.putextra("key",array1);

startActivity(i);

In OnClick2:
Intent i =new Intent(this,SecondActivity.class);

I.putextra("key",array2);

startActivity(i);

In your SecondActivity u need to extract the data using bundle:-
In your onCreateView:
String str[]=savedInstanceState.getExtra("key");


text:
Q: How to send attachments using mailgun? In my form there is section to upload resume I use mailgun API for my mails to send, I am finding trouble for sending attachments using the form.
How to send the attached file along with other details of my form when user submits.
Please see the below image of my form the attachments should be dynamic but not static.

A: Example with Node.js
var mailgun = require('mailgun-js')({apiKey: api_key, domain: domain});
var filename = 'mailgun_logo.png';
var filepath = path.join(__dirname, filename);
var file = fs.readFileSync(filepath);

var attch = new mailgun.Attachment({data: file, filename: filename});

var data = {
  from: 'Excited User <me@samples.mailgun.org>',
  to: 'serobnic@mail.ru',
  subject: 'Hello',
  text: 'Testing some Mailgun awesomness!',
  attachment: attch
};

mailgun.messages().send(data, function (error, body) {
  console.log(body);
});


text:
Q: Can a miswired ethernet cable destroy a client when connected to a POE switch? This question is similar to Can a miswired UTP cable destroy a router? - except my circumstances are more specific.
I have a client (A solax Hybrid inverter), where the installer wired the ethernet connection incorrectly - specifically he used 568B wiring, but he reversed the connector, so pin 1 went to pin 8, 2 to 7 and so on.   Not knowing this, I then attempted to wire the other side of the cable (I tried both 568A and 568B wiring), and plugged it into my POE switch.
I've now corrected the wiring issue on the inverter side, but I am not getting any connectivity to the switch.   Unfortunately the inverter is still not connecting to ethernet, and I'm wondering if the port could have been damaged by the incorrect cabling?

A: The answer would appear to be no (at least in this case, and I suspect most standard cases).   I fixed the problem issue and the port came to life.
Thinking about it, this makes sense as POE has negotiation (at least of 802.1af and newer) of power - so this negotiation would presumably fail before power blew anything up.


text:
Q: Deploying Visual Studio 2012 solutions to SharePoint 2010 like WSPBuilder I have spent several years developing SharePoint solutions for WSS 3.0 using Visual Studio 2008 and the WSPBuilder add-in. WSPBuilder would generate a folder containing a setup.exe file. This file executes the stsadm commands to deploy the .WSP file (also in the same folder) to the SharePoint server. I just had to copy the deployment folder to a shared folder for my SharePoint Admins to deploy for testing, staging, and production.
I am now working with Visual Studio 2012 to build SharePoint solutions for SharePoint 2010. In my development environment on VirtualBox, I have everything on a single virtual machine (AD, Visual Studio, SQL Server, IIS, etc.). I am able to deploy the solutions directly to IIS on my development machine, all is right with the world. Now, I am getting ready to deploy my first solution to our testing server. I have a Publish option in Visual Studio that generates the .WSP file but nothing else. What I have found so far online are directions to deploy the .WSP with a series of stsadm commands (either in PowerShell or Command Prompt). Is there a process in Visual Studio 2012 to build a deployment package just like WSPBuilder provided? What is the best practice for deploying SharePoint solutions to 2010?

A: What our team did was create a package for the Engineers with the .wsp file in it, and used powershell to deploy them to the farm.  This has been the best way to do it for us.  Just copy the wsp file into a folder for them and deploy it from there using the script below.
PowerShell Script:
Add-SPSolution –LiteralPath "C:\Desktop\file\mywspsolution.wsp"
Install-SPSolution –Identity myWebpart.wsp  –WebApplication http://servername -CASPolicies

//or -GACDeployment if you want it to go to the GAC

Then, make sure the feature has been actived in the site settings.  Should be good to go like this.

A: I love the CKSdev tool add-in for Visual Studio 2012 (and 2010/2013).  It adds packaging to wsp (and quick deployments directly to the server) directly from VS and many other fantastic utilities.


text:
Q: EF 4.3 saving One to Many causing errors or duplicate rows Really hope someone can help, as been twearing my hair out the last two nights and going no where fast! and desperately trying to get a family project going which I'm doing for no profit and its rapidly eating up my time as I'm trying to use it to learn some new technologies.
It seems this is a common issue, as found a few similar ish posts on stackoverflow etc but now seem to have guided me to a working solution.
I either get errors or duplicate rows going into the database, my simplified model is a one to many relationship. But I'm trying to store the WebsiteUserSession object in the users session to save a database hit on every page load.
Model:
public class WebsitePageTracking
{
    [Key]
    public long Id { get; set; }
    public virtual WebsiteUserSession WebsiteUserSession { get; set; }
    public DateTime DateTime { get; set; }
    public string TrackUrl { get; set; }
}

public class WebsiteUserSession
{
    [Key]
    public long Id { get; set; }
    public Guid Guid { get; set; }
    public string IpAddress { get; set; }
    public DateTime DateTime_Created { get; set; }
    public DateTime DateTime_LastSessionStart { get; set; }

    public virtual ICollection<WebsitePageTracking> WebsitePageTracking { get; set; }
}

Then my code is as follows, a little more complex but hopefully get the idea. Note the datacontext is stored in the HttpContext.Items which was one suggestion.
/// <summary>
/// public method for fetching and persisting website user session
/// </summary>
/// <returns></returns>
public static WebsiteUserSession GetWebsiteUserSession()
{
    // set initial variables
    Guid? websiteUserGuid = null;
    string websiteUserIpAddress = HttpContext.Current.Request.UserHostAddress;
    WebsiteUserSession websiteUserSession = null;

    // first try and get from the session
    if (HttpContext.Current.Session["WebsiteUserSession"] != null)
    {
        // load the website user session, and fetch out the guid
        websiteUserSession = HttpContext.Current.Session["WebsiteUserSession"] as WebsiteUserSession;
        websiteUserGuid = websiteUserSession.Guid;

        // check to see if ip has changed, if so drop website user session
        if (websiteUserSession.IpAddress != websiteUserIpAddress)
            websiteUserSession = null;
    }
    else
    {
        // nothing so create brand new guid
        websiteUserGuid = Guid.NewGuid();
    }

    // if we don't have one which came from the session then get the website user session using guid/ip
    if (websiteUserSession == null)
        websiteUserSession = GetWebsiteUserSession((Guid)websiteUserGuid, websiteUserIpAddress);

    // if not stored in the session add that now
    if (HttpContext.Current.Session["WebsiteUserSession"] == null)
        HttpContext.Current.Session.Add("WebsiteUserSession", websiteUserSession);

    // return back website user session object
    return websiteUserSession;
}

/// <summary>
/// gets or creates a website user session record in the database
/// </summary>
/// <param name="guid">guid generated for the website user</param>
/// <param name="ipAddress">public ip address of website user</param>
/// <returns></returns>
private static WebsiteUserSession GetWebsiteUserSession(Guid guid, string ipAddress)
{
    DataContext dataContext = HttpContext.Current.Items["DataContext"] as DataContext;

    // try and fetch a user session from database
    WebsiteUserSession websiteUserSession = dataContext
        .WebsiteUserSessions
        .Where(x => x.Guid == guid && x.IpAddress == ipAddress)
        .SingleOrDefault();

    if (websiteUserSession != null)
    {
        // if found update last session time
        websiteUserSession.DateTime_LastSessionStart = DateTime.Now;
    }
    else
    {
        // create a new website user session
        websiteUserSession = new WebsiteUserSession();
        websiteUserSession.Guid = guid;
        websiteUserSession.IpAddress = ipAddress;
        websiteUserSession.DateTime_Created = websiteUserSession.DateTime_LastSessionStart = DateTime.Now;
        dataContext.WebsiteUserSessions.Add(websiteUserSession);
    }

    // persist changes
    dataContext.SaveChanges();

    return websiteUserSession;
}

/// <summary>
/// log a stock page view to database
/// </summary>
/// <param name="stockId">id of stock being viewed</param>
public static void LogStockPageView(int stockId)
{
    DataContext dataContext = HttpContext.Current.Items["DataContext"] as DataContext;

    WebsiteUserSession websiteUserSession = GetWebsiteUserSession();

    //dataContext.WebsiteUserSessions.Attach(websiteUserSession);
    //dataContext.Entry(websiteUserSession).State = EntityState.Unchanged;

    WebsitePageTracking pageTrack = new WebsitePageTracking();
    pageTrack.WebsiteUserSession = websiteUserSession;
    pageTrack.DateTime = DateTime.Now;
    pageTrack.TrackUrl = HttpContext.Current.Request.Url.ToString();

    dataContext.Entry(client).State = EntityState.Unchanged;
    dataContext.Entry(website).State = EntityState.Unchanged;
    dataContext.Entry(websiteUserSession).State = EntityState.Unchanged;

    //dataContext.Entry(websiteUserSession.WebsitePageTracking).State = EntityState.Detached;

    //dataContext.WebsiteUserSessions.Attach(pageTrack.WebsiteUserSession);

    dataContext.WebsitePageTracking.Add(pageTrack);

    //dataContext.Entry(pageTrack.WebsiteUserSession).State = EntityState.Unchanged;

    dataContext.SaveChanges();
}

Basically what should happen is someone browses a page, LogStockPageView() gets called which in turn gets a WebsiteUserSession entity either from the session, database or creates a new one. Then WebsitePageTracking entity is added to the database with an association to the WebsiteUserSession.
You can see all the commented lines of attempts to get this working, but I either get errors or lots of duplicate rows being inserted :(
One such error is this "An object with the same key already exists in the ObjectStateManager. The ObjectStateManager cannot track multiple objects with the same key.".
Please please can someone see where I'm going wrong or even suggest better solutions? really trying to get going with EF but struggling :(
Thanks, Carl

A: This simple code has a lot of problems because of the way how EF works. The very first problem is using session. Session will save you database queries but you will have to add a lot of special code to your application to make this work in all expected scenarios. I will use session only in scenario where my entity stored in session is never used for data modification (it is never used by EF again). You can use FK properties to avoid a lot of pain in this case.
The first problem appears in GetWebsiteUserSession where you return attached entity from the method. If you also have lazy loading enabled you can be quite sure that adding tracking in the next request will result in ObjectDisposedException. The reason is that proxied attached entity keeps internally reference to the current context which is disposed at the end of the current request. When the entity tries to load navigation property it uses that reference. It can work if you turn off proxy creation / lazy loading but the better solution can be detaching entity prior to returning it from the method because it will allow rest of your code working with only single scenario:
dataContext.Entry(websiteUserSession).State = EntityState.Detached;

Be aware that detaching will empty your WebSitePageTracking collection. If you want to detach entity graph you must create deep clone (serialization / deserialization).
The second problem is whole LogStockPageView. If your current session instance is attached to the context you don't need to attach it again or change its state but you will have to do it in case of detached entity. Try this:
public static void LogStockPageView(int stockId)
{
    DataContext dataContext = HttpContext.Current.Items["DataContext"] as DataContext;

    WebsiteUserSession websiteUserSession = GetWebsiteUserSession();

    dataContext.WebsiteUserSessions.Attach(websiteUserSession);

    WebsitePageTracking pageTrack = new WebsitePageTracking();
    pageTrack.DateTime = DateTime.Now;
    pageTrack.TrackUrl = HttpContext.Current.Request.Url.ToString();

    dataContext.WebsitePageTracking.Add(pageTrack);

    // Make connection after both session and track are correctly configured and attached
    pageTrack.WebsiteUserSession = websiteUserSession;

    dataContext.SaveChanges();

    // again detach session
    dataContext.Entry(websiteUserSession).State = EntityState.Detached;
}

Your sample code also contains multiple references to other entities. Those have the same problem. If you store them in session and they are somehow related to your saving code you must deal with them as well.
If you want your websiteUserSession to keep whole track in the session it will become more complex because instead of detaching you will have to use entity graph cloning.


text:
Q: Random characters starts showing on terminal on Ubuntu 20.04.3 TS I see below characters on Ubuntu 20.04.3 which is wierd. I am new to Ubuntu so please assist with this issue.

*

*Random characters like given below shows up on terminal

*Even when characters dont show up, the sound of repeated keyboard typing is heard.

*Randomly it starts deleting the entered characters, like backspace character being pressed

^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^["^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^[[3~^
or
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"

A: Your Delete (not your Backspace) key is stuck or faulty. The terminal prints this key as ^[[3~ if it not handling special keys.
Try to release it.  If this doesn't work, and the problem persists after rebooting, clean or replace your keyboard.


text:
Q: how do I use Imagemagick to determine the framerate of a GIF? I am using Imagemagick to turn a gif into a corresponding series of jpgs and I am trying to determine when each jpg happens in a series.
stolen from How do I detect an animated GIF's ticks per second?: identify  -format "%T ticks:  %f: Frame[%s]  %m %wx%h %P%O %r %z-bit\n" tree.gif
4 ticks:  tree.gif: Frame[0]  GIF 247x175 247x175+0+0 PseudoClassRGBMatte 8-bit
4 ticks:  tree.gif: Frame[1]  GIF 247x175 247x175+0+0 PseudoClassRGBMatte 8-bit
4 ticks:  tree.gif: Frame[2]  GIF 247x175 247x175+0+0 PseudoClassRGBMatte 8-bit
4 ticks:  tree.gif: Frame[3]  GIF 247x175 247x175+0+0 PseudoClassRGBMatte 8-bit
4 ticks:  tree.gif: Frame[4]  GIF 247x175 247x175+0+0 PseudoClassRGBMatte 8-bit
4 ticks:  tree.gif: Frame[5]  GIF 247x175 247x175+0+0 PseudoClassRGBMatte 8-bit

and identify tree.gif gives me
tree.gif[0] GIF 247x175 247x175+0+0 8-bit PseudoClass 256c 1.923MB 0.000u 0:00.000
tree.gif[1] GIF 247x175 247x175+0+0 8-bit PseudoClass 256c 1.923MB 0.000u 0:00.000
tree.gif[2] GIF 247x175 247x175+0+0 8-bit PseudoClass 256c 1.923MB 0.000u 0:00.000
tree.gif[3] GIF 247x175 247x175+0+0 8-bit PseudoClass 256c 1.923MB 0.000u 0:00.000
tree.gif[4] GIF 247x175 247x175+0+0 8-bit PseudoClass 256c 1.923MB 0.000u 0:00.010
tree.gif[5] GIF 247x175 247x175+0+0 8-bit PseudoClass 256c 1.923MB 0.000u 0:00.010
tree.gif[6] GIF 247x175 247x175+0+0 8-bit PseudoClass 256c 1.923MB 0.000u 0:00.010
...

can anyone translate this output that will tell me either the framerate or when each frame appears?  Extra points if you can make it work using RMagick.

A: There are complications. First of all, you need to use the %T and %s escapes to look at the frame number and the delay (in centiseconds), not the vanilla identify command. Second, the delay from one frame to the next varies, so you need to be prepared to deal with cases when your animated GIF does not have a unified "frame rate" from end to end.
Here is an example command: identify -format "Frame %s: %Tcs\n" A.gif
For more info:

*

*http://imagemagick.org/Usage/anim_basics/

*http://imagemagick.org/script/escape.php


text:
Q: Laravel Valet+ all sites yield "undefined function apcu_fetch()" I did something stupid and while in the middle of a valet use 7.1 process, I pressed ctrl-C. In an attempt to get everything working since then I uninstalled valet+, did a composer global update, a brew update, valet fix, and valet install yet still every site I visit just spits out "Fatal error: Call to undefined function apcu_fetch() in /Users/n8klatt/.composer/vendor/weprovide/valet-plus/server.php on line 37". Any ideas on how I can get Valet+ working again?
(The initial error after interrupting the valet use 7.1 call was "Unable to determine linked PHP", which I remedied with a brew link --force php@5.6 since 5.6 was what I had been using. That allowed me to proceed with the valet use 7.1 but then all my sites started throwing that apcu_fetch error.)

A: So you're experiencing 2 problems here:

*

*Call to undefined function apcu_fetch() is most likely caused by having PHP-FPM run your webserver on a different PHP version as your CLI. Makes sure your webserver is running the same version as your CLI. An easy was to check this is adding the PHPINFO within the server.php file and check the result. Often restarting your PC allows old PHP-FPM instances to die.

*Unable to determine linked PHP is an error thrown when you're running on a native PHP version which is not installed by brew. In this case valet-plus cannot find the correct version number of your PHP installation and throws this error.
Solutions:

*

*Make sure APCu is installed correctly as mentioned in weprovide/valet-plus#133

*Make sure your PHP installation is not faulty as mentioned in weprovide/valet-plus#127
Hope that helps, if not give me a comment.

A: I had the same problem with php56. But I'm not using valet, after I reinstall the PHP56 with brew, and it added pear and pecl module. I installed apcu (couldn't install apc directly) with pecl channel-update pecl.php.net and pecl install apcu-4.0.11.
After that installation added extension="apcu.so" in php56 .ini file, which points to /usr/local/Cellar/php@5.6/5.6.38/lib/php/20131226/apcu.so where the image does not exist really because it was installed by PECL, so I had to change php56 .ini to apcu extension to match extension=/usr/local/lib/php/pecl/20131226/apcu.so where the image file resides for real, and then restart apache and it works.


text:
Q: Trouble with Generic Repository in Spring Data JPA I'm trying to do some basic database operations using a generic repository in Spring Data JPA. However, I keep running into an IllegalArgumentException "Not an managed type: " + whatever class/interface I have my parameter extend.
GenericRepository.java
@Transactional
public interface GenericRepository<T> extends PagingAndSortingRepository<T, Integer> {

  @Query("SELECT g "
          + "FROM " + "#{#entityName}" + " g "
          + "WHERE g.#{#entityName}Id = ?1"
         )
  public T findById(int Id);

For example, the above complains about class Object, whereas using GenericRepository (a marker interface I was trying to use) it'll complain about interface DatabaseDerived being not a managed type.
I'm simply using @SpringBootApplication for most of my setup, and the answers I've been able to find for this problem either definitely don't work in my case or I can't seem to figure out how to apply them to my setup or I just plain don't understand them. I would be grateful if someone could point me to a useful tutorial (couldn't find one on Google) or walk me through how to get this working with my setup.
Application.java
@SpringBootApplication
@ComponentScan("radius.hibernate")
public class Application {

    public static void main(String[] args) {
        ApplicationContext ctx = SpringApplication.run(Application.class, args);
    }

}

pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>annonymized</groupId>
    <artifactId>radius.hibernate</artifactId>
    <version>0.1.0</version>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.2.6.RELEASE</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>2.6.2</version>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-hibernate4</artifactId>
            <version>2.6.2</version>
        </dependency>

        <dependency>
            <groupId>org.reflections</groupId>
            <artifactId>reflections</artifactId>
            <version>0.9.10</version>
        </dependency>

        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>7.0</version>
        </dependency>

    </dependencies>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

Adjuster.java
/**
 * Adjuster generated by hbm2java
 */
@Entity(name = "adjuster")
@Table(name = "Adjuster", schema = "dbo", catalog = "annonymized")
public class Adjuster implements java.io.Serializable, DatabaseDerived {

    private int adjusterId;
    private EagleUsers eagleUsersBySupervisorId;
    private EagleUsers eagleUsersByUserId;
    private boolean isW2;
    private boolean autoAssign;
    private boolean active;
    private boolean isRecordDeleted;
    private Set<AdjusterSoftware> adjusterSoftwares = new HashSet<AdjusterSoftware>(0);
    private Set<BankInvoiceCorrection> bankInvoiceCorrectionsForOldAdjusterId = new HashSet<BankInvoiceCorrection>(0);
    private Set<BankAdjuster> bankAdjusters = new HashSet<BankAdjuster>(0);
    private Set<SymbilityAdjuster> symbilityAdjusters = new HashSet<SymbilityAdjuster>(0);
    private AdjusterCompensation adjusterCompensation;
    private AdjusterContact adjusterContact;
    private Set<AdjusterClaimType> adjusterClaimTypes = new HashSet<AdjusterClaimType>(0);
    private Set<AdjusterClientExclude> adjusterClientExcludes = new HashSet<AdjusterClientExclude>(0);
    private Set<AdjusterEquipment> adjusterEquipments = new HashSet<AdjusterEquipment>(0);
    private Set<ClaimAdjuster> claimAdjusters = new HashSet<ClaimAdjuster>(0);
    private Set<ClaimReport> claimReports = new HashSet<ClaimReport>(0);
    private Set<Invoice> invoices = new HashSet<Invoice>(0);
    private Set<LicenseAdjuster> licenseAdjusters = new HashSet<LicenseAdjuster>(0);
    private Set<AdjusterClientContactExclude> adjusterClientContactExcludes = new HashSet<AdjusterClientContactExclude>(
            0);
    private Set<BankInvoiceCorrection> bankInvoiceCorrectionsForNewAdjusterId = new HashSet<BankInvoiceCorrection>(0);
    private AdjusterAutoAssign adjusterAutoAssign;
    private Set<AdjusterLossType> adjusterLossTypes = new HashSet<AdjusterLossType>(0);

    public Adjuster() {
    }

    public Adjuster(int adjusterId, EagleUsers eagleUsersBySupervisorId, EagleUsers eagleUsersByUserId, boolean isW2,
            boolean autoAssign, boolean active, boolean isRecordDeleted) {
        this.adjusterId = adjusterId;
        this.eagleUsersBySupervisorId = eagleUsersBySupervisorId;
        this.eagleUsersByUserId = eagleUsersByUserId;
        this.isW2 = isW2;
        this.autoAssign = autoAssign;
        this.active = active;
        this.isRecordDeleted = isRecordDeleted;
    }

    public Adjuster(int adjusterId, EagleUsers eagleUsersBySupervisorId, EagleUsers eagleUsersByUserId, boolean isW2,
            boolean autoAssign, boolean active, boolean isRecordDeleted, Set<AdjusterSoftware> adjusterSoftwares,
            Set<BankInvoiceCorrection> bankInvoiceCorrectionsForOldAdjusterId, Set<BankAdjuster> bankAdjusters,
            Set<SymbilityAdjuster> symbilityAdjusters, AdjusterCompensation adjusterCompensation,
            AdjusterContact adjusterContact, Set<AdjusterClaimType> adjusterClaimTypes,
            Set<AdjusterClientExclude> adjusterClientExcludes, Set<AdjusterEquipment> adjusterEquipments,
            Set<ClaimAdjuster> claimAdjusters, Set<ClaimReport> claimReports, Set<Invoice> invoices,
            Set<LicenseAdjuster> licenseAdjusters, Set<AdjusterClientContactExclude> adjusterClientContactExcludes,
            Set<BankInvoiceCorrection> bankInvoiceCorrectionsForNewAdjusterId, AdjusterAutoAssign adjusterAutoAssign,
            Set<AdjusterLossType> adjusterLossTypes) {
        this.adjusterId = adjusterId;
        this.eagleUsersBySupervisorId = eagleUsersBySupervisorId;
        this.eagleUsersByUserId = eagleUsersByUserId;
        this.isW2 = isW2;
        this.autoAssign = autoAssign;
        this.active = active;
        this.isRecordDeleted = isRecordDeleted;
        this.adjusterSoftwares = adjusterSoftwares;
        this.bankInvoiceCorrectionsForOldAdjusterId = bankInvoiceCorrectionsForOldAdjusterId;
        this.bankAdjusters = bankAdjusters;
        this.symbilityAdjusters = symbilityAdjusters;
        this.adjusterCompensation = adjusterCompensation;
        this.adjusterContact = adjusterContact;
        this.adjusterClaimTypes = adjusterClaimTypes;
        this.adjusterClientExcludes = adjusterClientExcludes;
        this.adjusterEquipments = adjusterEquipments;
        this.claimAdjusters = claimAdjusters;
        this.claimReports = claimReports;
        this.invoices = invoices;
        this.licenseAdjusters = licenseAdjusters;
        this.adjusterClientContactExcludes = adjusterClientContactExcludes;
        this.bankInvoiceCorrectionsForNewAdjusterId = bankInvoiceCorrectionsForNewAdjusterId;
        this.adjusterAutoAssign = adjusterAutoAssign;
        this.adjusterLossTypes = adjusterLossTypes;
    }

    @Id

    @Column(name = "AdjusterId", unique = true, nullable = false)
    public int getAdjusterId() {
        return this.adjusterId;
    }

    public void setAdjusterId(int adjusterId) {
        this.adjusterId = adjusterId;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "SupervisorId", nullable = false)
    public EagleUsers getEagleUsersBySupervisorId() {
        return this.eagleUsersBySupervisorId;
    }

    public void setEagleUsersBySupervisorId(EagleUsers eagleUsersBySupervisorId) {
        this.eagleUsersBySupervisorId = eagleUsersBySupervisorId;
    }

    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "UserId", nullable = false)
    public EagleUsers getEagleUsersByUserId() {
        return this.eagleUsersByUserId;
    }

    public void setEagleUsersByUserId(EagleUsers eagleUsersByUserId) {
        this.eagleUsersByUserId = eagleUsersByUserId;
    }

    @Column(name = "IsW2", nullable = false)
    public boolean isIsW2() {
        return this.isW2;
    }

    public void setIsW2(boolean isW2) {
        this.isW2 = isW2;
    }

    @Column(name = "AutoAssign", nullable = false)
    public boolean isAutoAssign() {
        return this.autoAssign;
    }

    public void setAutoAssign(boolean autoAssign) {
        this.autoAssign = autoAssign;
    }

    @Column(name = "Active", nullable = false)
    public boolean isActive() {
        return this.active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    @Column(name = "IsRecordDeleted", nullable = false)
    public boolean isIsRecordDeleted() {
        return this.isRecordDeleted;
    }

    public void setIsRecordDeleted(boolean isRecordDeleted) {
        this.isRecordDeleted = isRecordDeleted;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "adjuster", cascade = CascadeType.REMOVE)
    public Set<AdjusterSoftware> getAdjusterSoftwares() {
        return this.adjusterSoftwares;
    }

    public void setAdjusterSoftwares(Set<AdjusterSoftware> adjusterSoftwares) {
        this.adjusterSoftwares = adjusterSoftwares;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "adjusterByOldAdjusterId")
    public Set<BankInvoiceCorrection> getBankInvoiceCorrectionsForOldAdjusterId() {
        return this.bankInvoiceCorrectionsForOldAdjusterId;
    }

    public void setBankInvoiceCorrectionsForOldAdjusterId(
            Set<BankInvoiceCorrection> bankInvoiceCorrectionsForOldAdjusterId) {
        this.bankInvoiceCorrectionsForOldAdjusterId = bankInvoiceCorrectionsForOldAdjusterId;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "adjuster", cascade = CascadeType.REMOVE)
    public Set<BankAdjuster> getBankAdjusters() {
        return this.bankAdjusters;
    }

    public void setBankAdjusters(Set<BankAdjuster> bankAdjusters) {
        this.bankAdjusters = bankAdjusters;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "adjuster", cascade = CascadeType.REMOVE)
    public Set<SymbilityAdjuster> getSymbilityAdjusters() {
        return this.symbilityAdjusters;
    }

    public void setSymbilityAdjusters(Set<SymbilityAdjuster> symbilityAdjusters) {
        this.symbilityAdjusters = symbilityAdjusters;
    }

    @OneToOne(fetch = FetchType.LAZY, mappedBy = "adjuster", optional = false)
    public AdjusterCompensation getAdjusterCompensation() {
        return this.adjusterCompensation;
    }

    public void setAdjusterCompensation(AdjusterCompensation adjusterCompensation) {
        this.adjusterCompensation = adjusterCompensation;
    }

    @OneToOne(fetch = FetchType.LAZY, mappedBy = "adjuster")
    public AdjusterContact getAdjusterContact() {
        return this.adjusterContact;
    }

    public void setAdjusterContact(AdjusterContact adjusterContact) {
        this.adjusterContact = adjusterContact;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "adjuster", cascade = CascadeType.REMOVE)
    public Set<AdjusterClaimType> getAdjusterClaimTypes() {
        return this.adjusterClaimTypes;
    }

    public void setAdjusterClaimTypes(Set<AdjusterClaimType> adjusterClaimTypes) {
        this.adjusterClaimTypes = adjusterClaimTypes;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "adjuster", cascade = CascadeType.REMOVE)
    public Set<AdjusterClientExclude> getAdjusterClientExcludes() {
        return this.adjusterClientExcludes;
    }

    public void setAdjusterClientExcludes(Set<AdjusterClientExclude> adjusterClientExcludes) {
        this.adjusterClientExcludes = adjusterClientExcludes;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "adjuster", cascade = CascadeType.REMOVE)
    public Set<AdjusterEquipment> getAdjusterEquipments() {
        return this.adjusterEquipments;
    }

    public void setAdjusterEquipments(Set<AdjusterEquipment> adjusterEquipments) {
        this.adjusterEquipments = adjusterEquipments;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "adjuster", cascade = CascadeType.REMOVE)
    public Set<ClaimAdjuster> getClaimAdjusters() {
        return this.claimAdjusters;
    }

    public void setClaimAdjusters(Set<ClaimAdjuster> claimAdjusters) {
        this.claimAdjusters = claimAdjusters;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "adjuster", cascade = CascadeType.REMOVE)
    public Set<ClaimReport> getClaimReports() {
        return this.claimReports;
    }

    public void setClaimReports(Set<ClaimReport> claimReports) {
        this.claimReports = claimReports;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "adjuster", cascade = CascadeType.REMOVE)
    public Set<Invoice> getInvoices() {
        return this.invoices;
    }

    public void setInvoices(Set<Invoice> invoices) {
        this.invoices = invoices;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "adjuster", cascade = CascadeType.REMOVE)
    public Set<LicenseAdjuster> getLicenseAdjusters() {
        return this.licenseAdjusters;
    }

    public void setLicenseAdjusters(Set<LicenseAdjuster> licenseAdjusters) {
        this.licenseAdjusters = licenseAdjusters;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "adjuster", cascade = CascadeType.REMOVE)
    public Set<AdjusterClientContactExclude> getAdjusterClientContactExcludes() {
        return this.adjusterClientContactExcludes;
    }

    public void setAdjusterClientContactExcludes(Set<AdjusterClientContactExclude> adjusterClientContactExcludes) {
        this.adjusterClientContactExcludes = adjusterClientContactExcludes;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "adjusterByNewAdjusterId")
    public Set<BankInvoiceCorrection> getBankInvoiceCorrectionsForNewAdjusterId() {
        return this.bankInvoiceCorrectionsForNewAdjusterId;
    }

    public void setBankInvoiceCorrectionsForNewAdjusterId(
            Set<BankInvoiceCorrection> bankInvoiceCorrectionsForNewAdjusterId) {
        this.bankInvoiceCorrectionsForNewAdjusterId = bankInvoiceCorrectionsForNewAdjusterId;
    }

    @OneToOne(fetch = FetchType.LAZY, mappedBy = "adjuster", optional = false)
    public AdjusterAutoAssign getAdjusterAutoAssign() {
        return this.adjusterAutoAssign;
    }

    public void setAdjusterAutoAssign(AdjusterAutoAssign adjusterAutoAssign) {
        this.adjusterAutoAssign = adjusterAutoAssign;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "adjuster", cascade = CascadeType.REMOVE)
    public Set<AdjusterLossType> getAdjusterLossTypes() {
        return this.adjusterLossTypes;
    }

    public void setAdjusterLossTypes(Set<AdjusterLossType> adjusterLossTypes) {
        this.adjusterLossTypes = adjusterLossTypes;
    }

    @Override
    public Integer getId() {
        return getAdjusterId();
    }

    @Override
    public void setId(Integer id) {
        setAdjusterId(id);
    }

}

HelloController.java
@Autowired
@RequestMapping("/testGeneric")
public @ResponseBody String indexTest6(GenericRepository2<Adjuster, Integer> genericDao) throws JsonProcessingException {

Adjuster adjuster = (Adjuster) genericDao.findById(5567);

ObjectMapper mapper = new ObjectMapper();
Hibernate4Module module = new Hibernate4Module();
mapper.registerModule(module);
String result = mapper.writeValueAsString(adjuster);
return result;

}

A: That's not how it works.
You have to provide a repository interface with a concrete class for Spring Data to generate the implementation.
Like this:
public interface AdjusterRepository extends PagingAndSortingRepository<Adjuster, Long> {

  @Query("SELECT g " // Don't know what this is doing
          + "FROM " + "#{#entityName}" + " g "
          + "WHERE g.#{#entityName}Id = ?1"
         )
  public Adjuster findById(long id);

}

In your case, I see you try to reuse your custom query for different classes. But Spring will pick up your GenericRepository and won't know what to do.
The correct approach is to mark this GenericRepositoy as @NoRepositoryBean so Spring doesn't try to instantiate it at runtime, which is the cause of your error.
So you can do this:
@NoRepositoryBean
public interface GenericRepository<T> extends PagingAndSortingRepository<T, Long> {

  @Query("SELECT g " // Don't know what this is doing
          + "FROM " + "#{#entityName}" + " g "
          + "WHERE g.#{#entityName}Id = ?1"
         )
  public T findById(T id);

}

public interface AdjusterRepository extends GenericRepository<Adjuster> {
    // will inherit from GenericRepository
}

By doing this, Spring will ignore the GenericRepository, avoiding you error, and create a concrete implementation only for AdjusterRepository, and any others that you subclass from GenericRepository.
I didn't test this code, there may be some typos. I recommend reading this section from the Spring Data reference: Defining repository interfaces


text:
Q: Multiply Columns from Multiple DataFrames, Keeping Non-Overlapping Columns, and Creating New DataFrames For the sake of simplicity, let's say I have two dataframes as shown below:
import pandas as pd

df1 = {'B36': {'A44': 0.218, 'A45': 0.062, 'A46': 0.035,  'plt': 0.450, 'rs': 0.878},
        'B43': {'A44': 0.018, 'A45': 0.427, 'A46': 0.100, 'plt': 0.450, 'rs': 0.878}}
df1 = pd.DataFrame(df1)
df1

df2 = {'lID':  [26, 26, 26, 26, 26, 12, 12, 12, 12, 12],
       'lCTY': [18, 18, 18, 18, 18, 18, 18, 18, 18, 18],
       'A44':[77, 37, 51, 55, 57, 10, 10, 10, 10, 10],
       'A45':[77, 37, 51, 55, 57, 10, 10, 10, 10, 10],
       'A46':[78, 36, 49, 53, 50, 99, 99, 99, 10, 99]
       }
df2 = pd.DataFrame(df2)
df2

What I want to do is multiply rows in df1 with similarly-named columns in df2. I want to do this for each column in df1
and output these as separate dataframes. Additionally, I want to keep the non-overlapping rows/columns in both df1 and df2.
My attempt at doing both is shown below. What I was hoping for was a more concise way of going about this.
df1_index = set(df1.index)
df2_cols = set(df2.columns)
col = list(df1_index.intersection(df2_cols))

# multiply df1 B36 items with df2 columns
df2[col] = df1['B36'][col].mul(df2[col], axis=0, fill_value=1)
df2['rs'] = df1.loc['rs'][0]
df2['plt'] = df1.loc['plt'][0]
df2

# multiply df1 B43 items with df2 columns
df2[col] = df1['B43'][col].mul(df2[col], axis=0, fill_value=1)
df2['rs'] = df1.loc['rs'][0]
df2['plt'] = df1.loc['plt'][0]
df2

A: One option is to melt the column before multiplying; I'd like to think that your step may be more efficient (tests are a sure way to confirm/refute):
# melt df2:
# keeping the index helps ensure unique index
# which we need later when unstacking
(df2
.melt(["lID", "lCTY"], ignore_index = False)
.set_index(["variable", "lID", "lCTY"], append = True)
 # move variable to level 0, so we can use it for multiplying
.reorder_levels(['variable', 'lID', 'lCTY', None])
.value # not really necessary to convert to a series here
# multiply independently, since the index is df1 is unique
# easier this way
.mul(df1.B36, level=0)
.mul(df1.B43, level=0)
.unstack('variable')
# sorting can be ignored if it is not that important
.sort_index(level = -1)
# assign the remaining rows that do not match
.assign(rs=df1.at["rs", "B36"], plt=df1.at["plt", "B36"])
.rename_axis(columns = None)
.reset_index(level = ['lID', 'lCTY'])
)

   lID  lCTY       A44       A45     A46     rs   plt
0   26    18  0.302148  2.038498  0.2730  0.878  0.45
1   26    18  0.145188  0.979538  0.1260  0.878  0.45
2   26    18  0.200124  1.350174  0.1715  0.878  0.45
3   26    18  0.215820  1.456070  0.1855  0.878  0.45
4   26    18  0.223668  1.509018  0.1750  0.878  0.45
5   12    18  0.039240  0.264740  0.3465  0.878  0.45
6   12    18  0.039240  0.264740  0.3465  0.878  0.45
7   12    18  0.039240  0.264740  0.3465  0.878  0.45
8   12    18  0.039240  0.264740  0.0350  0.878  0.45
9   12    18  0.039240  0.264740  0.3465  0.878  0.45

This matches the example shared; depending on the complexity, you may have to break it up, put into separate variables and recombine, or use the pipe method (i prefer the first, as pipe , when combined with anonymous functions can lead to incomprehensible code)

A: @ sammywemmy, based on your answer I used the following steps which I think works well for what I want to do.
1. the multiplication code
this code excludes all non-similar indices/columns from df1 and df2
d1idx = set(df1.index)
d2cols = set(df2.columns)
col = list(d1idx.intersection(d2cols))

collt = []
for idx, colname in enumerate(df1, start=1):
    collt.append(df1[colname][col].mul(df2[col], axis=0, fill_value=1))
print(collt)

2. collect non-similar indices/columns from df1 and df2
this combines the non-similar indices/columns from df1 and df2.  I chose to use  use df.iloc[:,][0], instead of df.at[] because the variable name at that index might change, so this approach makes it a bit easier.
d2 = df2.loc[:, ['lID', 'lCTY']]
d2 = d2.join(pd.DataFrame({'plt': df1.loc['plt'][0],
                           'rs': df1.loc['rs'][0]}, index=d2.index))

print(d2)

3. merge non-similar columns into the multiplied dataframe
finally, add the non-similar columns back into the dataframe
lstdf = {}
for idx, dif in enumerate(collt, start=1):
    lstdf[idx] = dif.merge(d2, left_index=True, right_index=True)
print(lstdf)


text:
Q: On Test Failure, WebDriverEventListener's method "beforeGetScreenshotAs" is running continously. What will be the best implementation for this method? I am trying to implement WebDriverEventListneter for customized log and test steps into report file but during test execution- on Fail  method "beforeGetScreenshotAs"  is running infinetly. Refer below for my WebDriverEventListneter's code:
public class WebEventListener extendsBaseTest implements WebDriverEventListener {

    private static final Logger logger = Logger.getLogger(WebEventListener.class.getName());
    ExtentReports extent = ExtentManager.getInstance();

    public void afterChangeValueOf(WebElement element, WebDriver driver) {
        // TODO Auto-generated method stub
        logger.info("Action performed on element ");

    }

    public void afterClickOn(WebElement element, WebDriver driver) {
        // TODO Auto-generated method stub
        logger.info("Clicked on element");
    }

    public void afterFindBy(By arg0, WebElement arg1, WebDriver driver) {
        // TODO Auto-generated method stub
        logger.info("Element found By " + arg0.toString());
    }

    public void afterNavigateBack(WebDriver driver) {
        // TODO Auto-generated method stub
        logger.info("Navigating to Back  " + driver.getCurrentUrl());

    }

    public void afterNavigateForward(WebDriver driver) {
        // TODO Auto-generated method stub
        logger.info("Navigating to Back  " + driver.getCurrentUrl());

    }

    public void afterNavigateTo(String arg0, WebDriver driver) {
        // TODO Auto-generated method stub
        logger.info("Navigating to url  " + arg0);

    }

    public void afterScript(String arg0, WebDriver driver) {
        // TODO Auto-generated method stub
        logger.info("Remote WebDriver executed Script" + arg0);

    }

    public void beforeChangeValueOf(WebElement element, WebDriver driver) {
        // TODO Auto-generated method stub
        logger.info("Action is performing on " + element.getText());
    }

    public void beforeClickOn(WebElement arg0, WebDriver driver) {
        // TODO Auto-generated method stub
        System.out.println("About to click on the " + arg0.toString());
        logger.info("About to click on the " + arg0.toString());

    }

    public void beforeFindBy(By arg0, WebElement arg1, WebDriver driver) {
        logger.info("About to Find By on the " + arg0.toString());

    }

    public void beforeNavigateBack(WebDriver driver) {
        logger.info("Just before beforeNavigateBack " + driver.getCurrentUrl());
        System.out.println("Just before beforeNavigateBack " + driver.getCurrentUrl());

    }

    public void beforeNavigateForward(WebDriver driver) {
        logger.info("Just before beforeNavigateForward " + driver.getCurrentUrl());
        System.out.println("Just before beforeNavigateForward " + driver.getCurrentUrl());

    }

    public void beforeNavigateTo(String arg0, WebDriver driver) {
        // TODO Auto-generated method stub
        System.out.println("Just before beforeNavigateTo " + arg0);
        logger.info("Just before beforeNavigateTo " + arg0);
    }

    public void beforeScript(String arg0, WebDriver driver) {
        // TODO Auto-generated method stub
        System.out.println("Just before beforeScript " + arg0);
        logger.info("Just before beforeScript " + arg0);
    }

    public void onException(Throwable error, WebDriver driver) {
        // TODO Auto-generated method stub
        System.out.println("Exception occured at " + error);
        try {
            TestUtil.takeScreenshot();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void beforeAlertAccept(WebDriver driver) {
        logger.info("Accepting Alert");

    }

    public void afterAlertAccept(WebDriver driver) {
        try {
            logger.info("Alert accepted");
        } catch (Exception E) {
            logger.error("Failed to Accept alert!");
        }

    }

    public void afterAlertDismiss(WebDriver driver) {
        try {
            logger.info("Alert is dismissed");
        } catch (Exception E) {
            logger.error("Failed to Dismiss alert");
        }

    }

    public void beforeAlertDismiss(WebDriver driver) {
        try {
            logger.info("Trying to dismiss alert");
        } catch (Exception e) {
            logger.error("Not able to dismiss alert");
        }

    }

    public void beforeNavigateRefresh(WebDriver driver) {
        try {
            logger.info("Going to refresh Page!");
        } catch (Exception e) {
            logger.error("Failed to refresh page");
        }

    }

    public void afterNavigateRefresh(WebDriver driver) {
        try {
            logger.info("Page Refreshed !");
        } catch (Exception e) {
            logger.error("Failed to refresh page");
        }

    }

    public void beforeChangeValueOf(WebElement element, WebDriver driver, CharSequence[] keysToSend) {
        try {
            logger.info("Going to enter text : " + keysToSend + "in field" + element.getText());
        } catch (Exception e) {
            logger.error("Failed to enter text");
        }

    }

    public void afterChangeValueOf(WebElement element, WebDriver driver, CharSequence[] keysToSend) {
        try {
            logger.info("Entered text : " + keysToSend + "in field");
        } catch (Exception e) {
            logger.error("Failed to enter text");
        }

    }

    public void beforeSwitchToWindow(String windowName, WebDriver driver) {
        try {
            logger.info("Going to switch window" + windowName);
        } catch (Exception e) {
            logger.error("unable to switch window" + windowName);
        }

    }

    public void afterSwitchToWindow(String windowName, WebDriver driver) {
        try {
            logger.info("Switched into window" + windowName);
        } catch (Exception e) {
            logger.error("unable to switch window" + windowName);
        }

    }

    public <X> void afterGetScreenshotAs(OutputType<X> target, X screenshot) {
        logger.info("Captured screenshot afterGetScreenShot As ");

    }

    public void beforeGetText(WebElement element, WebDriver driver) {
        try {
            logger.info("Getting Text from " + element.getText());
        } catch (Exception e) {
            logger.error("Failed to get Text" + element.getText());
        }`
    }

    public void afterGetText(WebElement element, WebDriver driver, String text) {
        try {
            logger.info("Text found " + element.getText());
        } catch (Exception e) {
            logger.error("Faied to get Text" + element.getText());
        }

    }

    public <X> void beforeGetScreenshotAs(OutputType<X> target) {

        logger.info("Capturing screenshot " + target.toString());

    }
}

On Failure, I am getting infinite log on console:
Session ID: dc5a3e7f94d464a0588c8db7678f772e
2019-11-26 16:49:13 INFO  WebEventListener:226 - Capturing screenshot OutputType.FILE
2019-11-26 16:49:13 INFO  WebEventListener:226 - Capturing screenshot OutputType.FILE
2019-11-26 16:49:13 INFO  WebEventListener:226 - Capturing screenshot OutputType.FILE

Please suggest best implementation of method public <X> void beforeGetScreenshotAs(OutputType<X> target)


text:
Q: Elasticsearch _update_by_query updates docs anyway even in case of versions conflicts I am using NEST and trying to make _update_by_query operation
(ES v. 6.5.1, NEST v.6.4.0)
var response = await client.UpdateByQueryAsync<T> (x => {
    x.Query ( * query text * )
    .Index (index)
    .Script ( * script * )
}, cancellationToken);

If I have for example two updates one by one under the same documents I will get list of failures caused by different versions (in case I add conflicts.Proceed) or exception will be thrown (by default or in case conflicts.Abort)
But in both cases documents being updated.
Elasticsearch documentation says update will happen only when versions are the same. Maybe someone faced this issue and can explain why docs are updated anyway?


text:
Q: Periodic Solution of Damped Pendulum with Constant Torque I have a system of ordinary differential equations
$  \theta' = v$
$ v' = -bv - \sin \theta + k$
These are the equations for a pendulum with $\theta$ being angular position, and $v$ being angular velocity. The constant $b > 0$ is a damping constant, and $k \geq 0$ is a constant torque in the counterclockwise direction. I am asked to prove that for $k > 1$ there exists a unique periodic solution for this system. There are two hints:

*

*The first hint, to prove existence, says to consider a vector field in a strip of the form $0 < v_1 < (k - \sin \theta)/b < v_2$.

*The second hint, to prove uniqueness, says to consider $E(\theta, v) = 1/2 v^2 - \cos \theta + 1$ and use the fact that the total change of E along any periodic solution must be $0$.
So far I've noticed that the if we set $v' = 0$ we get that $v = (k - \sin \theta) / b$ is a v-nullcline. Therefore the strip $0 < v_1 < (k - \sin \theta)/b < v_2$ is divided by this nullcline into two regions. I'm thinking I should consider some solution with initial condition in this strip and show that this is periodic but I'm not sure how to go about doing that exactly.


text:
Q: pandas if column is true, perform percent change on that row I have a df with an additional column of boolean values based off a conditional statement.
df = pd.DataFrame({'col1': [1,2,3,2.5,5,2]})
df['bool'] =  df['col1'] >= 3

The df looks like...
    col bool
0   1.0 False
1   2.0 False
2   3.0 True
3   2.5 False
4   5.0 True
5   2.0 False

I would like to get pct_change() of "col1" if "bool" is true and if false return NaN. The output should look something like...
    col pct_change
0   1.0 NaN
1   2.0 NaN
2   3.0 -0.169
3   2.5 NaN
4   5.0 -0.400
5   2.0 NaN

What would be the best way of going about this?

A: Use numpy.where to use df["bool"] as a boolean mask:
df["pct_change"] = np.where(df["bool"], df["col"].pct_change().shift(-1), np.nan)
print(df)

Output:
   col   bool  pct_change
0  1.0  False         NaN
1  2.0  False         NaN
2  3.0   True   -0.166667
3  2.5  False         NaN
4  5.0   True   -0.400000
5  3.0  False         NaN


text:
Q: How do I access an attribute within a nested object in a loop using VueJS I am currently having an error when trying to access a property within a nested object using a loop in my vuejs project. It's surprising as other similar nested objects work effectively but one.
<template>

           <router-link :to="'/expense/'+ travel.data.request_no +'/travel' "> {{ travel.data.request_no }} </router-link>

           {{ travel.data.summary.purpose}}

           {{ travel.data.user.surname }} {{ travel.data.user.first_name }}
           {{ travel.data.added_by.surname}} {{ travel.data.added_by.first_name }}
           {{ travel.data.created_at }}
           {{ travel.data.status }}

</template>

The travel.data.summary.purpose is what throws the error even though it is exists within the travels object.
{{ travel.data.summary }} returns an object containing the attribute of purpose but I cannot access it. The error shown is
[Vue warn]: Error in render: "TypeError: Cannot read property 'purpose' of null"

Please see This link for reference

A: In some items the field summary is null, so you should check its value before rendering the nested field purpose :
   {{ travel.data.summary.purpose}}


text:
Q: Flatten XML into simple list with XSLT I have an XML document full of ICD10 codes formatted like this:
<ICD10CM.index>
    <version>2019</version>
    <title>ICD-10-CM INDEX TO DISEASES and INJURIES</title>
    <letter>
        <title>A</title>
        <mainTerm>
            <title>Abnormal, abnormality, abnormalities</title>
            <seeAlso>Anomaly</seeAlso>
            <term level="1">
                <title>chromosome, chromosomal</title>
                Q99.9
                <term level="2">
                    <title>with more than three X chromosomes,  female</title>
                    Q97.1
                </term>
                <term level="2">
                    <title>analysis result</title>
                    R89.8
                    <term level="3">
                        <title>bronchial washings</title>
                        R84.8
                    </term>
                    <term level="3">
                        <title>cerebrospinal fluid</title>
                        R83.8
                    </term>
                </term>
            </term>
        </mainTerm>
    </letter>
</ICD10CM.index>

I would like to end up with a collapsed list of items, but each item in the final list needs to reference its parent(s), potentially recursively. I would like the output to look something like this:
<codes>

        <id>Q99.9</id>
        <description>Chromosome, chromosomal</description>

        <id>Q97.1</id>
        <description>Chromosome, chromosomal – with more than three X chromosomes, female</description>

        <id>R89.8</id>
        <description>Chromosome, chromosomal – analysis result</description>

        <id>R84.8</id>
        <description>Chromosome, chromosomal – analysis result – bronchial washings</description>

        <id>R83.8</id>
        <description>Chromosome, chromosomal – analysis result – cerebrospinal fluid</description>

</codes>

I'm fairly new to XSLT and have only built a handful of transforms, so huge bonus points for helping me understand the answer instead of just providing a code snippet that does the job.
This level="3" example is the most deeply-nested sample I found in a quick search of the data but I'd prefer an example that works for any depth.
Edit: Since folks have asked, I am using XSLT 2.0

A: I believe it can be simply:
XSLT 1.0
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:template match="/ICD10CM.index">
    <codes>
        <xsl:apply-templates select="letter/mainTerm/term[@level='1']"/>
    </codes>
</xsl:template>

<xsl:template match="term">

        <id>
            <xsl:value-of select="code" />
        </id>
        <description>
            <xsl:for-each select="ancestor::term">
                <xsl:value-of select="title" />
                <xsl:text> - </xsl:text>
            </xsl:for-each>
            <xsl:value-of select="title" />
        </description>

    <xsl:apply-templates select="term"/>
</xsl:template>

</xsl:stylesheet>

The code should be self-explanatory - if not, ask.

If you can use XSLT 2.0, you could shorten this to:
XSLT 2.0
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:template match="/ICD10CM.index">
    <codes>
        <xsl:apply-templates select="letter/mainTerm/term[@level='1']"/>
    </codes>
</xsl:template>

<xsl:template match="term">

        <id>
            <xsl:value-of select="code" />
        </id>
        <description>
            <xsl:value-of select="ancestor-or-self::term/title" separator=" - "/>
        </description>

    <xsl:apply-templates select="term"/>
</xsl:template>

</xsl:stylesheet>

Note that this could be made a bit more efficient by passing down the accumulated description as a parameter, instead of traversing up the entire ancestor axis for each term:
XSLT 1.0
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:template match="/ICD10CM.index">
    <codes>
        <xsl:apply-templates select="letter/mainTerm/term[@level='1']"/>
    </codes>
</xsl:template>

<xsl:template match="term">
    <xsl:param name="accumulated-description"/>
    <xsl:variable name="description" select="concat($accumulated-description, title)" />

        <id>
            <xsl:value-of select="code" />
        </id>
        <description>
            <xsl:value-of select="$description" />
        </description>

    <xsl:apply-templates select="term">
        <xsl:with-param name="accumulated-description" select="concat($description, ' - ')"/>
    </xsl:apply-templates>
</xsl:template>

</xsl:stylesheet>

A: One of the solution in XSLT 1.0 can be:
Note: I have tried to explain at each level via comments what the template or loop does. Let me know if I am missing something.
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:output method="xml" indent="yes" />
<xsl:strip-space elements="*" />

<xsl:variable name="dash"> - </xsl:variable>

<xsl:template match="/">
    <codes>
        <xsl:apply-templates />
    </codes>
</xsl:template>

<xsl:template match="code">

        <id><xsl:value-of select="." /></id>

        <description>

            <xsl:for-each select="ancestor::term/preceding-sibling::title[name(parent::node()) = 'term']">
                <xsl:value-of select="normalize-space(.)" />

                <xsl:if test="position() != last()">
                    <xsl:value-of select="$dash" />
                </xsl:if>
            </xsl:for-each>

            <xsl:choose>

                <xsl:when test="not(ancestor::term/preceding-sibling::title[name(parent::node()) = 'term'])">
                    <xsl:value-of select="preceding-sibling::title" />
                </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="concat($dash, preceding-sibling::title)" />
                </xsl:otherwise>
            </xsl:choose>
        </description>

</xsl:template>

<xsl:template match="text()" />

</xsl:stylesheet>

http://xsltransform.net/93wkLJ4/1


text:
Q: Remove special characters from filenames I have a website that i transfered recently from one host to another. Unfortunately when i did that, i noticed that all the images that had special characters in it lik (é, è, à, ...) weren't showing anymore in my pages.
I'm trying to resolve to this issue. I'm thinking maybe if i can rename these imagaes by removing/replacing the special characters in them i can solve this problem.
So my question if anyone of you knows a plugin that changes the names of the "upload" files and in the database aswell that would be much helpful.
Thank you in advance


text:
Q: Definition of coordinate basis vectors for manifolds I am currently learning about manifolds from Hobson's General Relativity: An Introduction for Physicists.
In Chapter 3 on 'Vector Calculus on Manifolds', pg. 57, the author defined coordinate basis vectors for a point $P$ on a $N$-dimensional manifold with coordinate system $x^a$ as $$\vec{e_a}=\lim_{\delta x^a \rightarrow 0}\frac{\delta \vec{s}}{\delta x^a}$$
where $\delta \vec{s}$ is the infinitesimal vector displacement between point $P$ and a nearby point $Q$ whose coordinate separation from $P$ is $\delta x^a$ along the $x^a$ coordinate curve.
Say if $P$ and $Q$ are points on the $x^1$ coordinate cuve,  the coordinate separation $\delta x^1$ between them will be $0$ since on the coordinate curve the $x^1$ coordinate stays constant. If this is correct, the definition for $\vec{e}_a$ will not make sense since it is dividing by $0$. What am I getting wrong?

A: Maybe it becomes clear for the example of polar coordinates in the plane:
$$\mathbf e_r = \left(\frac{\partial x}{\partial r} , \frac{\partial y}{\partial r}\right) = (\cos(\theta) , \sin(\theta))$$
$$\mathbf e_{\theta} = \left(\frac{\partial x}{\partial \theta} , \frac{\partial y}{\partial \theta}\right) = (-r\sin(\theta) , r\cos(\theta))$$
The derivatives are the limits mentioned.


text:
Q: Proving a function satisfies the binomial recurrence relation and that it equals $\binom{n-k+1}{k}$ I have the recurrence relation $g(n,k)=g(n-2,k-1) + g(n-1,k)$ for all $k\geq1$
 with the boundary conditions $g(n,k)=0$ if $n<2k-1$ and $g(2k-1,k)=1$
What I'm trying to do is define a new function by the equation $ h(p,q) = g(n,k)$ where $n=p+q-1$ and $k=q$ and show that $ h(p,q)$ satisfies the binomial recurrence relation and its boundary conditions and hence deduce that $g(n,k)=\binom{n-k+1}{k}$
My workings are:
We have the binomial recurrence relation $$\binom{p}{q}=\binom{p-1}{q-1}+\binom{p-1}{q}$$
where$$\begin{align*} \\&\binom{p}{q}=0\text{ when }q>p \\&\binom{p}{q}=1\text{ when }p=q \end{align*}$$ Now if $$\begin{align*} \\&p=n-k+1 \\&q=k \end{align*}$$
Then $$\begin{align*} \\&\binom{n-k+1}{k}=0\mbox{ when }n<2k-1\text{ (the first boundary condition)}\end{align*}$$ and $$\begin{align*} \\&\binom{n-k+1}{k}=1\text{ when }n=2k-1 \text{ (the second boundary condition)}\end{align*}$$
Also $$\begin{align*}\\&\binom{n-k+1}{k}=\binom{n-k}{k-1}+\binom{n-k}{k}\end{align*}\tag{a}$$
Now from the recurrence relation  $g(n,k)$ we have (Is this true???): $$\binom{n}{k}=\binom{n-2}{k-1}+\binom{n-1}{k}$$ Which therefore equals: $$ \binom{n-k+1}{k}=\binom{n-k-1}{k-1}+\binom{n-k}{k}\tag{b}
$$
Setting $(a)$ equal to $(b)$ we now get: $$\begin{align*}\binom{n-k}{k-1}+\binom{n-k}{k}&=\binom{n-k-1}{k-1}+\binom{n-k}{k}\\ \binom{n-k}{k-1}&=\binom{n-k-1}{k-1}\end{align*}$$
However, I am not sure where to go from here. I'm rather dubious as to the veracity of this identity as I have been unable to prove that it is true. Am I on the right track? If so how do I go about proving this identity? If I'm off beam any ideas where I went wrong?
Thanks in advance.

A: The basic problem is that you're starting at the wrong end: you should be working with $h$.
Let's restate the problem a little more clearly. You're to define $h(p,q)=g(p+q-1,q)$ and prove that the function $h$ satisfies the binomial recurrence, which, stated in terms of $h$, is $$h(p,q)=h(p-1,q-1)+h(p-1,q)\tag{1}\;.$$ Let's see what happens when we expand the righthand side of $(1)$ in terms of $g$:
$$\begin{align*}
h(p-1,q-1)+h(p-1,q)&=g(p+q-3,q-1)+g(p+q-2,q)\\
&=g(p+q-1,q)\\
&=h(p,q)\;,
\end{align*}$$
which is exactly what we wanted. The only step that might be puzzling for a moment is the second, which uses the fact that $g(n,k)=g(n-2,k-1)+g(n-1,k)$: just let $n=p+q-1$ and $k=q$.
Next, you're to check that $h$ satisfies the same boundary conditions as the binomial coefficients. In other words, you're to show that $g(p,q)=0$ when $p>q$, and $g(p,q)=1$ when $p=q$. When $p=q$, for instance, $g(p,q)=g(p,p)=h(2p-1,p)$, which is what? The case $p>q$ is equally easy.
Once you finish that, you'll have shown that $h(p,q)=\binom{p}q$: they satisfy the same boundary conditions and the same recurrence, so by an easy induction they're always equal.
Your final task is to use this to show that $g(n,k)=\binom{n+k-1}k$; this will be easy once you express $g(n,k)$ in terms of $h$. That is, just as $h(p,q)=g(p+q-1,q)$, you can express $g(n,k)$ as $h(\text{thing}_1,\text{thing}_2)$ and therefore as $\binom{\text{thing}_1}{\text{thing}_2}$.


text:
Q: Sinch call button error? I am trying to access a class in another class and i can getting this error. I am using sinch to implement app to app phone call in my application and it is still not working.
This is my error
 FATAL EXCEPTION: main
                                                                                Process: com.example.thinker.myapplication2, PID: 10039
                                                                                java.lang.NullPointerException: Attempt to invoke virtual method 'com.sinch.android.rtc.calling.Call com.example.thinker.myapplication2.SinchService$SinchServiceInterface.callUser(java.lang.String)' on a null object reference
                                                                                at com.example.thinker.myapplication2.tabs.Chatting$Bases.callButtonClicked(Chatting.java:128)
                                                                                at com.example.thinker.myapplication2.tabs.Chatting$1.onClick(Chatting.java:83)
                                                                                at android.view.View.performClick(View.java:5265)
                                                                                at android.view.View$PerformClick.run(View.java:21534)
                                                                                at android.os.Handler.handleCallback(Handler.java:815)
                                                                                at android.os.Handler.dispatchMessage(Handler.java:104)
                                                                                at android.os.Looper.loop(Looper.java:207)
                                                                                at android.app.ActivityThread.main(ActivityThread.java:5683)
                                                                                at java.lang.reflect.Method.invoke(Native Method)
                                                                                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
                                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)

This is my java class.
public class Chatting extends ListActivity {
        Runnable refresh, refres;
        ImageView send,back,call;
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.yon);
                call= (ImageView)findViewById(R.id.call);
            call.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View arg0) {
                    if (!isOnline(Chatting.this)) {
                        Toast.makeText(Chatting.this, "No network connection",
                                Toast.LENGTH_SHORT).show();
                        return;
                    }
                    Bases ba = new Bases();
                    ba.onServiceConnected();
                    ba.callButtonClicked();
                }
            });

        }
        public class Bases extends BaseActivity {
                @Override
                protected void onServiceConnected() {
                    Toast.makeText(this, " call ready", Toast.LENGTH_LONG).show();
                }

                public void callButtonClicked() {
                    SharedPreferences sp = PreferenceManager
                            .getDefaultSharedPreferences(this);
                    String emaill = sp.getString("friend_email", "anon");
                    if (emaill.isEmpty()) {
                        Toast.makeText(this, "Please enter a user to call", Toast.LENGTH_LONG).show();
                        return;
                    }

                    try {
                        Call call = getSinchServiceInterface().callUser("emaill");
                        if (call == null) {
                            // Service failed for some reason, show a Toast and abort
                            Toast.makeText(this, "Service is not started. Try stopping the service and starting it again before "
                                    + "placing a call.", Toast.LENGTH_LONG).show();
                            return;
                        }
                        String callId = call.getCallId();
                        Intent callScreen = new Intent(this, CallScreenActivity.class);
                        callScreen.putExtra(SinchService.CALL_ID, callId);
                        startActivity(callScreen);
                    } catch (MissingPermissionException e) {
                        ActivityCompat.requestPermissions(this, new String[]{e.getRequiredPermission()}, 0);
                    }

                }
            }
}

below is the baseactivity class that has the getSinchServiceInterface(). that is returning null
public abstract class BaseActivity extends Activity implements ServiceConnection {

    private SinchService.SinchServiceInterface mSinchServiceInterface;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getApplicationContext().bindService(new Intent(this, SinchService.class), this,
                BIND_AUTO_CREATE);
    }

    @Override
    public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
        if (SinchService.class.getName().equals(componentName.getClassName())) {
            mSinchServiceInterface = (SinchService.SinchServiceInterface) iBinder;
            onServiceConnected();
        }
    }

    @Override
    public void onServiceDisconnected(ComponentName componentName) {
        if (SinchService.class.getName().equals(componentName.getClassName())) {
            mSinchServiceInterface = null;
            onServiceDisconnected();
        }
    }

    protected void onServiceConnected() {
        // for subclasses
    }

    protected void onServiceDisconnected() {
        // for subclasses
    }

    protected SinchService.SinchServiceInterface getSinchServiceInterface() {
        return mSinchServiceInterface;
    }

}

A: Most of time this happen when someone use wrong way to pass context try to pass context as YourActivityName.this (eg Bases.this )rather than just this or getApplicationContext()
start with
                @Override
                protected void onServiceConnected() {
                    Toast.makeText(Bases.this, " call ready", Toast.LENGTH_LONG).show();
                }

this is not the proper method to call activity
  Bases ba = new Bases();
  ba.onServiceConnected();
  ba.callButtonClicked();

use
Intent intent = new Intent(YourCurrentActivityName.this,Bases.class);
startActivity(intent);

in the oncreate method you can call this methods callButtonClicked()


text:
Q: Downloading a webpage as a PDF in Google Drive using Google Apps Script I am working on a Google apps script that is supposed to save web pages as pdf files in a folder inside my google drive. Here is my code for now:
function downloadFiles(){
   var fileName ="";
   var fileSize ="";
   var response=UrlFetchApp.fetch("https://fr.wikipedia.org/wiki/Wikip%C3%A9dia:Accueil_principal");

   var rc=response.getResponseCode()
   if(rc==200){
     var fileBlob=response.getAs('application/pdf');
     var folder= DriveApp.getFolderById("ID")// folder where the files to compare will be stored
     if (folder!=null){
       var file=folder.createFile(fileBlob)
       fileName= file.getName()
       fileSize= file.getSize()
     }
   }
   var fileInfo={'rc':rc, "filename":fileName,"filesize":fileSize}
 }

for some reason, when I run my script I get this error:
Exception: Conversion from text/html to application/pdf failed.
I read on some websites that it could be related to a limitation or something like that... Do you know how I can solve this issue?

A: From what I understand the problem might come from the getAs() that fails to do the conversion.
I tried with the following version
var page = response.getContentText();
var fileBlob = Utilities.newBlob(page,"application/pdf");
fileBlob.setName("name");

And it manages to create a pdf, but the content is corrupted beyond the first page. I'll keep looking

A: That conversion service seems to be failing in the last 24 hours (I've been trying to fix my script since then). The script was running for 2 years and is failing since yesterday.
Someone else opened this stackoverflow issue:
Google App Script convert HTML to PDF not working but it was flagged (wrongly) as duplicate.
My bet: Something wrong on Google App's side, but I'll subscribe to this question just in case.


text:
Q: How to display page first then load custom fonts? I have a time-sensitive webpage and I would wish it to display the page first, before loading any custom fonts. In other words, the page would first be displayed as though the fonts are not loaded.
This means that the custom fonts (if cached by the browser) would only be used when the user visits the page on the second and subsequent times.
I have tried:
<style>
@font-face {
    font-family: 'FontName';
    src: url('http://domain.com/fonts/font.ttf');
}
</style>

But it does not post-load the fonts. This means that page-loading is delayed.
What may be some solutions / hacks to achieve this functionality without Javascript?

A:
What may be some solutions to achieve this functionality without Javascript?

Not Possible. You can not load the full page and then load the font while the font is part of the full page. That's contradicting into itself.
With javascript you could change the page so have one full page and then make it even "fuller".

A: That's a tough one ... But here's an out-of-the-box kludgy idea... No idea if it works and it's probably going to get down-voted. :
Use 2 pages that are nearly identical:

*

*Load page 'A' that uses no custom fonts except for a bit of text at the very bottom rendered using an inline style using the custom font.  Hopefully this give the browser a chance to cache the font.

*Redirect without js (meta-refresh?) to page 'B' which has identical content except for the cached font applied.
Without js, though, I can't think of a way to time this correctly, so you're stuck in a race condition.


text: Q: Load only one region or country and not the whole world map in yandex mapkit Is there a possibility to load only one region of the map instead of the whole world map in yandex mapkit in android or react native ?


text:
Q: Rendering list from list of arrays I've got an app where by clicking on a button i'm adding data from the randomuser api to my array and then rendering it as a list.
   const onClickHandler = () => {
     axios.get("https://api.randomuser.me/")
     .then(res => {
        const data = res.data.results["0"]
        setPosts(data)
        addHistory(prevInputState => ([...prevInputState,data.name.first]))
        console.log(data)
     })
   }

   const[posts,setPosts] = useState([])
   const[history,addHistory] = useState([])

In this case Im loading entire dataset into "posts" and first name into "history"
then i'm able to render a list of all first names fetched using :
{history.map((name)=> (
  <Item> {name} </Item>
))}

This works well when im only saving first name from the data into the "history" state . How would I proceed if i wanted to store entire data ( not data.name.first ) and then use list to retrieve the same list of first names?
Thanks

A: Instead of keeping a seperate state for history, can't you just use the existing posts state to iterate and access the relevent data?
{posts.map((data)=> (
    <Item> {data.name.first} </Item>
  ))}

A: In your addHistory function, could you just replace data.name.first with data? Then you'd pass the entire object into the history, and can access all of its fields in your later calls.
const onClickHandler = () => {
     axios.get("https://api.randomuser.me/")
     .then(res => {
        const data = res.data.results["0"]
        setPosts(data)
        addHistory(prevInputState => ([...prevInputState,data]))
        console.log(data)
     })
   }

   const[posts,setPosts] = useState([])
   const[history,addHistory] = useState([])

Then,
{history.map((data)=> (
  <Item> {data.name.first} </Item>
))}

access whatever other object fields you may need.


text:
Q: Can we increase number of pods per node in Kubernetes? I've deployed Kubernetes cluster on my local machine.The default allocatable pods in Kubernetes are 110. I want to increase the number of pods per node in my cluster.Can anyone let me know if it's possible ? If yes, how can we do it?

A: Yes, you can control this with the max-pods option to the Kubelet, either via a command line flag or Kubelet config file option. But beware that we don't test as much outside the normal scaling targets so you might be able to break things.


text:
Q: Android : WIFI Only Tablets Marked Incompatible on PlayStore I have an App on Play Store which can be installed by all Devices Except the Wifi only devices (who do not have SIM) , How to make the Application Compatible with those devices too ?
Below is My Manifest file -
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.example.mypackage"
    android:exported="false"
    android:installLocation="preferExternal">
    <!-- 11 -->
    <permission
        android:name="com.pixako.trackn.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />

    <uses-permission android:name="com.pixako.trackn.permission.MAPS_RECEIVE" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    <uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY" />
    <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
    <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
    <uses-permission
        android:name="android.hardware.telephony"
        android:required="false" />

    <uses-feature
        android:name="android.hardware.camera.autofocus"
        android:required="false" />
    <uses-feature android:name="android.hardware.location.gps" />
    <uses-feature
        android:name="android.hardware.camera"
        android:required="false" />

    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.GET_TASKS" />
    <uses-permission android:name="android.permission.REORDER_TASKS" />
    <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    <uses-permission android:name="android.permission.BLUETOOTH_PRIVILEGE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="com.android.alarm.permission.SET_ALARM" />
    <uses-permission android:name="com.android.permission.CLEAR_APP_CACHE" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

    <protected-broadcast android:name="android.intent.action.MEDIA_MOUNTED" /> <!-- Smart watch permission -->
    <uses-permission android:name="com.samsung.wmanager.ENABLE_NOTIFICATION" />
    <uses-permission android:name="com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY" />

    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission
        android:name="android.permission.INTERACT_ACROSS_USERS_FULL"
        tools:ignore="ProtectedPermissions" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <!-- Required OpenGL ES 2.0. for Maps V2 -->
    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />
    <uses-feature
        android:name="android.hardware.bluetooth_le"
        android:required="true" />

    <application
        android:name="com.pixako.application.AppDelegate"
        android:allowBackup="false"
        android:hardwareAccelerated="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:supportsRtl="true"
        android:theme="@style/AppThemes"
        android:requestLegacyExternalStorage="true"
        android:usesCleartextTraffic="true"
        tools:replace="android:allowBackup"> MyClasses </application> </manifest>

asking run time permissions too

    int REQUEST_PERMISSIONS = 20;
        String[] permissions = new String[]{
                Manifest.permission.INTERNET,
                Manifest.permission.READ_PHONE_STATE,
                Manifest.permission.WRITE_EXTERNAL_STORAGE,
                Manifest.permission.READ_EXTERNAL_STORAGE,
                Manifest.permission.ACCESS_FINE_LOCATION,
                Manifest.permission.CAMERA,
                Manifest.permission.BLUETOOTH,
                Manifest.permission.ACCESS_NOTIFICATION_POLICY,
                Manifest.permission.SET_ALARM,
                "",
                ""
        };

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
            permissions[9] = Manifest.permission.FOREGROUND_SERVICE;
            permissions[10] = Manifest.permission.ACCESS_BACKGROUND_LOCATION;
        }

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
            permissions[9] = Manifest.permission.FOREGROUND_SERVICE;
        }

        LoginProcessActivity.super.requestAppPermissions(permissions, R.string.runtime_permissions_txt
                    , REQUEST_PERMISSIONS);

have already implemented the changes described in this issue
Android Manifest File: App Supports Tablets, but is marked "not compatible" in market?


text:
Q: facebook apps hellowolrd i just downloaded the library here
https://github.com/facebook/php-sdk/
the followings is my code:
require_once "/facebook-platform/clients/php/trunk/facebook.php";

$appapikey = 'secret';
$appsecret = 'secret';

$facebook = new Facebook($appapikey, $appsecret);
$user_id = $facebook->require_login();

echo "
Hello, <fb:name uid=\"$user_id\" useyou=\"false\" />!
";

but there is nothing output, what's the problem? thanks

A: Where did you get this from?
$user_id = $facebook->require_login();

Obviously you are following an out-dated article that is using the old SDK. You can just follow the new SDK example from the link you posted:
<?php

require '../src/facebook.php';

$facebook = new Facebook(array(
  'appId'  => '191149314281714',
  'secret' => '73b67bf1c825fa47efae70a46c18906b',
));

// See if there is a user from a cookie
$user = $facebook->getUser();

if ($user) {
  try {
    // Proceed knowing you have a logged in user who's authenticated.
    $user_profile = $facebook->api('/me');
  } catch (FacebookApiException $e) {
    echo '
'.htmlspecialchars(print_r($e, true)).'
';
    $user = null;
  }
}

?>
<!DOCTYPE html>

    <?php if ($user) { ?>
      Your user profile is

        <?php print htmlspecialchars(print_r($user_profile, true)) ?>

    <?php } else { ?>
      <fb:login-button></fb:login-button>
    <?php } ?>

Also it seems that you are using the deprecated FBML in your code, don't FBML is now deprecated. Use iframes instead!


text:
Q: How do you pass a variable to VBS script in a powershell command? I know that you can use something like:
$variable = "value 1"

cscript test.vbs $variable

but how exactly do you capture that variable inside the vbs script?
Thanks.

A: By accessing the WScript.Arguments collection. HowTo

A: WScript.Arguments is a good way to go. Another option is to use a WSF file to put a bit more structure around your script.


text:
Q: How to convert dataframe of mostly factors into numeric matrix; unlist is not working I am having trouble turning my data.frame into a matrix format. Because I wanted to change my data.frame with mostly factor variables into a numeric matrix, I used the following code
UN2010frame <- data.matrix(lapply(UN2010, as.numeric))

However when I checked the mode of the UN2010frame, it still showed up as a list. Because the code I want to run (Ordrating) does not accept data in a list format, I used UN2010matrix <- unlist(UN2010frame) to unlist my matrix. When I did this, my first row ( which was formerly a row with column names) turned into NAs. This was a problem for me because when I tried to run an ordinal IRT model using this data set, I got the following error message.
> Error in 1:nrow(Y) : argument of
> length 0

I think it is because all the values in my first row are now gone.
If you could help me on any front, It would be deeply appreciated.
Thank you very much!
Haillie

A: First, the correct use of data.matrix is :
data.matrix(UN2010)

as it converts automatically to numeric. The lapply in your code is the first source for the error you get. You put a list in the data.matrix function, not a dataframe. So it returns a list of matrices, and not a matrix.
Second, unlist returns a vector, not a matrix. So pretty sure you won't find a "first row with NA", as you have a vector. Which might explain part of your confusion.
You probably have a character column somewhere. Converting this to numeric gives NA. If you don't want this, then exclude them from the further analysis. One possibility is to use colwise() from the plyr package to convert only the factors:
colwise(as.numeric,is.factor)(UN2010)

Which returns a dataframe with only the factors. This can be easily converted by data.matrix() or as.matrix(). Alternatively you use the base solution :
id <- sapply(UN2010,is.character)
sapply(UN2010[!id],as.numeric)

which will return you a matrix with all non-character columns converted to numeric.If you really want to keep the dataframe with all original columns, you can do :
UN2010frame <- UN2010
UN2010frame[!id] <- lapply(UN2010[!id],as.numeric)

Toy example code :
UN2010 <- data.frame(
  F1 = factor(rep(letters[1:3],10)),
  F2 = factor(rep(letters[5:10],5)),
  Char = rep(letters[11:16],each=5),
  Num = 1:30,
  stringsAsFactors=FALSE
)

A: Try as.data.frame instead of data.matrix.


text:
Q: Sharing a link causing unauthorised access error I have created a page and it is shared with everyone.
When I send a user a link to that http://sharepoint.ac.uk/DispForm.aspx?ID=1, the user get an error saying they are not authorised to view the page. But the user can view the contents of this page if they click on the link on the dashboard.
Unsure what the problem is
Any help is appreciated

A: Permission issue was due to the user clicking on the link that opened in a non IE browser.


text:
Q: Помогите с решением задания на C
код у мен такой
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int d,c=5;
    float a=5.0,b;
    printf("b = ");
    scanf("%f", &b);
    printf("d = ");
    scanf("%d", &d);
    a+=b-2;
    d+=++c-a;
    a*=c--;
    a/=10;
    c/=2;
    b--;
    d*=c+b+a;
    printf("RES = %f, %f, %d, %d", &a,&b,&c,&d);
    return 0;
}

при выводе выдает НИЧЕГО


text:
Q: Algebraic Topology Hatcher Chapter 3.2 Problem 3 The Problem: Using the cup product structure, show there is no map $\mathbb{R}P^n \rightarrow \mathbb{R}P^m$ inducing a nontrivial map $H^1(\mathbb{R}P^m; \mathbb{Z_2}) \rightarrow H^1(\mathbb{R}P^n; \mathbb{Z_2})$ if $n > m$. What is the corresponding result for maps $\mathbb{C}P^n \rightarrow \mathbb{C}P^n$?
Notes: For cochains $\phi \in C^k(X; R)$ and $\psi \in C^l(X; R)$ we can define the cup product $\phi \smile \psi \in C^{k+l}(X;R)$ is the cochain defined on the singular simplex $\sigma: \Delta^{k+l} \rightarrow X$ is given by the formula:
$$\phi \smile \psi(\sigma) = \phi(\sigma|[v_0,...,v_k])\psi(\sigma|[v_k,...,v_{k+l}])$$
There are some properties of these cochairs for instance we have the induced cup product $H^k(X; R) \times H^l(X; R) \xrightarrow{\smile} H^{k+l}(X; R)$. I'm not sure if the induced map in this problem is the same as this one. I suspect this problem has something to do with Theorem 3.12 of this section because that theorem is about the projective space but it only contains $H^*$ which is defined to be the direct sum of all homology groups. I'm having trouble finding in this section information that relates the first cohomology group of $\mathbb{R}P^m$ and $\mathbb{R}P^n$.
Thank you!

A: The only nontrivial map $H^1(\mathbb{R}P^m;\mathbb{Z}/(2))\to H^1(\mathbb{R}P^n;\mathbb{Z}/(2))$ is the identity since both domain and codomain is isomorphic to $\mathbb{Z}/(2)$. Assume for contradiction that $f:\mathbb{R}P^n\to \mathbb{R}P^m$ induces this nontrivial map on $H^1$.
Recall that $H^*(\mathbb{R}P^n;\mathbb{Z}/(2))\cong \mathbb{Z}/(2)[x]/(x^{n+1})$ with $|x|=1$, and that the induced map $f^*:H^*(\mathbb{R}P^m;\mathbb{Z}/(2))\to H^*(\mathbb{R}P^n;\mathbb{Z}/(2))$ is a ring homomorphism. This gives us that we have ring homomorphism $f^*:\mathbb{Z}/(2)[x]/(x^{m+1})\to \mathbb{Z}/(2)[x]/(x^{n+1})$ which maps $x\to x$. However, this is not a ring homomorphism since $n>m$, hence we have arrived at a contradiction. We conclude that no such $f$ exists.
The similar result for $\mathbb{C}P^n$ is that there exists no map $\mathbb{C}P^n\to \mathbb{C}P^m$ inducing a nontrivial map $H^2(\mathbb{C}P^m;\mathbb{Z})\to H^2(\mathbb{C}P^n;\mathbb{Z})$ when $n>m$. The argument for this is the same mutatis mutandis. Note in this case the nontrivial map on $H^2$ does not need to be the identity since we are working with coefficients over $\mathbb{Z}$ now. However, it is still multiplication by a non-zero integer which still leads to the contradiction.


text:
Q: How does mothership cloak behave while being revealed? If I am being revealed, and my mothership is cloaking my buildings,

*

*Are the buildings visible to the opponent?

*Can the opponent attack the buildings without detection?

A: If your Mothership is cloaking your buildings while you are being revealed they will not be able to see them if they hover over the buildings. They will, however, be able to see them on the mini-map. This way they still won't be able to attack the building while you are being revealed.
EDIT: Without detection that is. They won't be able to attack your buildings without Detection.

A: From this quite old TeamLiquid thread, it seems like the buildings will be revealed and attackable:
http://www.teamliquid.net/forum/viewmessage.php?topic_id=144315
I didn't test it myself due to being at work though. If i remember, i will test it when i am back home.