Q: Debian 10: How can I change the screen resolution for remote desktop with xrdp and remmina I have two Debian 10 systems, and I am trying to remote manage one from the other.
I am using remmina as the client and xrdp as the server. I connect with RDP protocol.
How can I change the screen resolution. It is currently stuck with display rdp0 smaller than 640x480.
Is this a client or server side setting?

A: Solution
This was another issue caused by a program which has a criminally bad UI. I've figured it out now. It's a client side setting.

*

*Click the button on the top window decoration which contains an icon with 3 lines on it.

*Select preferences. Why preferences are hidden in this menu with an obscure button with an obscure icon I have no clue. (First bad UI design problem)

*On the default "Options" tab (second bad UI design element, bad generic name "Options" when all the tabs are different types of options

*Click button "Set up" next to the text "Screen Resolutions" (third bad element of UI design. Easy to miss text. Not obvious that button is related to "Screen Resolutions" by looking at it.

*Add 1920x1080 or whatever you want. Be careful of syntax. Must be NxM format.

*Close this window

*On main Remmina window, now click top left button which is a page symbol with a plus on it. This is to add a new profile. (Again bad UI design)

*Put server address in and change Resolution to "Custom" (select one). Test before changing other options
Remmina dev team please fix the UI!

A: In addition to @user3728501 answer, I would suggest to "Add a new connection profile" from the Remmina client and set the resolution directly from the options there. To add a custom resolution follow the accepted answer till step 5.


Q: Bibliography in the following text? In the following text I don't get bibliography citation. I want Fricker (1995: 396--7) in the body of the text to be a hyperlinked to the bibliography at the end of the document.
\documentclass[preprint,12pt]{elsarticle}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{cite}
\usepackage{lineno}
\usepackage[colorlinks=true]{hyperref}
\usepackage{natbib}
\usepackage{footnotebackref}

\journal{Journal Name}
\begin{document}
\begin{frontmatter}
\title{\textbf What there is}
\end{frontmatter}

\section{Prelude}
\label{S:1}
It is \footnote{that can be found in \cite{Fricker(1995: 396--7)} in the recent decades, the awareness about the political role.}

\begin{thebibliography}{99}

\bibitem{Fricker(1995: 396--7)} Fricker, E. (1994). Against gullibility. In B. K. Matilal \& A. Chakrabarti (eds.), \textit{Knowing from words} (pp. 125-61). Dordrecht: Kluwer Academic Publishers.

\end{thebibliography}
\end{document}


Q: How to delete data from the list view after checked in android Hi the issue is that the selected data's are appearing in the list view, but actually we would like to delete the data's from the list view which is checked means position deletion
can anybody join us to resolve the problem
coding
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
        super.onActivityResult(requestCode, resultCode, data);
        if(data!=null){enter code here
            Bundle bundle = data.getExtras();
            if(requestCode ==1){
                selectedConatcts = bundle.getStringArrayList("sel_contacts");
                Log.v("", "Selected contacts-->"+selectedConatcts);
                if(selectedConatcts.size()<0){

                }else{
                    for(int i =0;i<selectedConatcts.size();i++){
                        RelativeLayout lnr_inflate = (RelativeLayout)View.inflate(thisActivity, R.layout.contacts_inflate, null);

                        // EditText edt = (EditText)lnr_inflate.findViewById(R.id.edt_contact);

                        String selectednames =selectedConatcts.get(i) ;

                        List<String> stringList = new ArrayList<String>(Arrays.asList(selectednames));

                        final ListView edt = (ListView)lnr_inflate.findViewById(R.id.edt_contact);

                        ArrayAdapter<String> adaptercon = new ArrayAdapter<String>(thisActivity, android.R.layout.select_dialog_multichoice,stringList);
                        edt.setAdapter(adaptercon);
                        edt.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
                        edt.setOnItemClickListener(new OnItemClickListener() {

                            @Override
                            public void onItemClick(AdapterView<?> arg0,
                                    View arg1, int arg2, long arg3) {
                                // TODO Auto-generated method stub
                                 final int len = edt.getCount();
                                    final SparseBooleanArray checked = edt.getCheckedItemPositions();

                                    for(int i =0;i<len;i++){

                                        if (checked.get(i)) {
//                                            selectedContacts.add(names[i]);
//                                          selectedConatcts.get(i);
//                                          selectedConatcts.remove(i);
                                            selectedConatcts.remove(phone_nos[i]);
                                            contactdisp.removeViewAt(i);

                                           //you can you this array list to next activity
//                                         do whatever you want with the checked item
                                         }
//                                      selectedConatcts.get(i);
                                        System.out.println("i m in check button cheked"+selectedConatcts.get(i));

                                    }
                                selectedConatcts.remove(phone_nos[arg2]);
                                contactdisp.removeViewAt(arg2);

                            }
                        });

                        contactdisp.addView(lnr_inflate);
}}}}

A: *

*Better check whether the checkbox is checked or not code  write under the button_click

*Remove Items
remove selectedConatcts.remove(phone_nos[arg2]);    contactdisp.removeViewAt(arg2);


Q: How to do restful ajax routes to methods in Laravel 5? So I have a route that looks like this:
Route::any('some/page', ['as' => 'some-page', 'uses' => 'SomePageController@index']);

However, I also have ajax calls at the same URL (using a request parameter called ajax like: some/page/?ajax=my_action) that I want to hit methods on my controller:

index                   already routes:   'SomePageController@index'
ajax = my_action        needs to route:   'SomePageController@ajaxMyAction'
ajax = my_other_action  needs to route:   'SomePageController@ajaxMyOtherAction'
ajax = blah_blah        needs to route:   'SomePageController@ajaxBlahBlah
...

What's the elegant solution to setting this up in my routes.php file?

A: After inspection of Laravel's Http Request and Route classes, I found the route() and setAction() methods could be useful.
So I created a middleware to handle this:
<?php namespace App\Http\Middleware;

class Ajax {

    public function handle($request, Closure $next)
    {
        // Looks for the value of request parameter called "ajax"
        // to determine controller's method call
        if ($request->ajax()) {
            $routeAction = $request->route()->getAction();
            $ajaxValue = studly_case($request->input("ajax"));
            $routeAction['uses'] = str_replace("@index", "@ajax".$ajaxValue, $routeAction['uses']);
            $routeAction['controller'] = str_replace("@index", "@ajax".$ajaxValue, $routeAction['controller']);
            $request->route()->setAction($routeAction);
        }

        return $next($request);
    }

}

Now my route looks like:
Route::any('some/page/', ['as' => 'some-page', 'middleware'=>'ajax', 'uses' => 'SomePageController@index']);

And correctly hits my controller methods (without disturbing Laravel's normal flow):
<?php namespace App\Http\Controllers;

class SomePageController extends Controller {

    public function index()
    {
        return view('some.page.index');
    }

    public function ajaxMyAction(Requests\SomeFormRequest $request){
        die('Do my action here!');
    }

    public function ajaxMyOtherAction(Requests\SomeFormRequest $request){
        die('Do my other action here!');
    }
    ...

I think this is a fairly clean solution.

A: You can't make this dispatch in the routing layer if you keep the same URL. You have two options :

*

*Use different routes for your AJAX calls. For example, you can prefix all your ajax calls by /api. This is a common way :
Route::group(['prefix' => 'api'], function()
{

    Route::get('items', function()
    {
        //
    });

});

*If the only different thing is your response format. You can use a condition in your controller. Laravel provides methods for that, for example :
public function index()
{
    $items = ...;

    if (Request::ajax()) {
        return Response::json($items);
    } else {
        return View::make('items.index');
    }
}

You can read this http://laravel.com/api/5.0/Illuminate/Http/Request.html#method_ajax and this http://laravel.com/docs/5.0/routing#route-groups if you want more details.


Q: How can I scaffold with bootstrap different number of columns? Is there a way to scaffold on a fluid layout two rows with the one having 3 the other 4 and have those centered on my page.
            _________________  __________________  ______________________
            ______________ _______________  ______________  _____________

The problem is that I use the first and the last grid column to center and then I have 10 columns and not been
able to separate them properly.

A: Have you tried using the offset*classes?
http://twitter.github.io/bootstrap/scaffolding.html


Q: How to sort by texture? Now and then the phrase "sort by texture" appears in OpenGL-related posts. While I see how this sort could be implemented for a single texture bound to a certain texture unit, I am not certain how this might be done for multiple textures bound to arbitrary texture units. Perhaps by capturing the state of the TUs into an integer id, then use the id as an index into either an array or a map? How to best do the "sort by texture" in an OpenGL application?

A: Treating texture units as levels in a tree and do a sorted depth-first traversal is a good starting point.
Ideally what you want to do is minimize the number of texture unit state changes which may mean that the same texture gets selected and deselected multiple times in the optimal case. You suggestion of sorting the tuples of texture IDs is a good idea as well.


Q: OpenVPN cannot connect to local machine that has two NIC cards This is my first time EVER posting to these forums. Most of the time when I have an issue I can usually solve them by searching forums/Google. But this one issue has me stumped! My company just deployed a VMware ESXI server that has a VM of pfsense which is setup for routing all LAN and WAN traffic for the most part all except my web server that has its own WAN IP. Our ISP is Comcast. Everything is working flawlessly except this one issue. I installed OpenVPN server onto my pfsense VM and is configured correctly and everything is working great!
My only problem is when i'm connected to OpenVPN I cannot connect to ONE of the CentOS 7 boxes which happens to be our web development server in which we send out development links to clients regularly. I try to connect to the CentOS 7 box via ssh on the local network or any other service and I can not access the machine. I can't even ping the machine. If I am at the office and connect to the local network I have no trouble connecting to any services on that box via the LAN. If I disable the WAN (ifcfg-ens192) everything works fine with OpenVPN but of course now the server can not be accessed from the outside, which kind of makes the development server pointless! >:[ if i set the default gateway using the following command:
[code]route add default gw 10.1.1.1 dev ens160[/code]
Everything works fine, but again the outside world will not be able to access the development server. I have tried adding a route-ens160 to help with the routing but to be exactly honest I don't quite understand whats going on! Below are my network configuration files and setup. I have changed some of the WAN IP info a little due to obvious security issues.
This is the ONLY box that is giving me this issue, so I believe everything on ESXI and pfsense is configured properly.We currently have three other VMs on the ESXI server. I can connect to every other VM including the ESXI server itself (vSphere).
Can any of you give me a hand or guide me in the right direction?
Thanks in advance, any help would be greatly appreciated!
-Bryan
Gateway (esxi/pfsense):
Gateway/IP: 10.1.1.1
Subnet: 255.255.255.0
WAN: 74.64.100.122

Comcast IP Block:
IP(s): 74.64.100.121 - 125
Subnet: 255.255.255.248
Gateway: 74.64.100.126

ifcfg-ens160 (LAN):
DEVICE="ens160"
BOOTPROTO="static"
HWADDR="00:0C:49:A9:D1:EB"
IPADDR="10.1.1.13"
NETMASK="255.255.255.0"
#GATEWAY="10.1.1.1"
DEFROUTE="no"
DNS1="75.75.75.75"
DNS2="75.76.76.76"
ONBOOT="yes"
NM_CONTROLLED="no"
ZONE="work"

ifcfg-ens192 (WAN):
DEVICE="ens192"
BOOTPROTO="static"
HWADDR="00:0C:59:A9:D3:F5"
IPADDR="74.64.100.125"
NETMASK="255.255.255.248"
DEFROUTE="yes"
GATEWAY="74.64.100.126"
DNS1="75.75.75.75"
DNS2="75.76.76.76"
ONBOOT="yes"
NM_CONTROLLED="no"
ZONE="public"

route-ens160 (route):
ADDRESS0="10.1.1.0"
NETMASK0="255.255.255.0"
GATEWAY0="74.64.100.126"
ADDRESS1="74.64.100.0"
NETMASK1="255.255.255.248"
GATEWAY1="74.64.100.126"

/etc/sysconfig/network:
NETWORKING="yes"
HOSTNAME="web"

route -n:
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         74.64.100.126   0.0.0.0         UG    0      0        0 ens192
10.1.1.0        0.0.0.0         255.255.255.0   U     0      0        0 ens160
74.64.100.120   0.0.0.0         255.255.255.248 U     0      0        0 ens192
169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0        0 ens160
169.254.0.0     0.0.0.0         255.255.0.0     U     1003   0        0 ens192

A: I solved it my self, I had to create a new routing table. Here is what I did:
Added new routing table to /etc/iproute2/rt_tables
#echo "1 rt2" >> /etc/iproute2/rt_tables

Added routes to LAN config /etc/sysconfig/network-scripts/route-ens160:
#echo "10.1.1.0/24 dev ens160 src 10.1.1.13 table rt2" >> /etc/sysconfig/network-scripts/route-ens160
#echo "default via 10.1.1.1 dev ens160 table rt2" >> /etc/sysconfig/network-scripts/route-ens160

Added rules to LAN config /etc/sysconfig/network-scripts/rule-ens160:
#echo "from 10.1.1.8/29 table rt2" >> /etc/sysconfig/network-scripts/rule-ens160
#echo "to 10.1.1.8/29 table rt2" >> /etc/sysconfig/network-scripts/rule-ens160

Restart network:
#systemctl restart network

Verify new routes and rules:
#ip route list table rt2
-----------
default via 10.1.1.1 dev ens160
10.1.1.0/24 dev ens160  scope link  src 10.1.1.13

#ip rule show
-----------
0:      from all lookup local
32764:  from all to 10.1.1.8/29 lookup rt2
32765:  from 10.1.1.8/29 lookup rt2
32766:  from all lookup main
32767:  from all lookup default

That is it! I will leave my configuration files below as well:
rt_table (/etc/iproute2/rt_tables):
# reserved values
#
255     local
254     main
253     default
0       unspec
#
# local
#
#1      inr.ruhep
1 rt2

ifcfg-ens160 (/etc/sysconfg/network-scripts/ifcg-ens160):
# LAN CONFIGURATION
# -----------------
DEVICE="ens160"
BOOTPROTO="static"
HWADDR="00:0C:49:A9:D1:EB"
IPADDR="10.1.1.13"
NETMASK="255.255.255.0"
#GATEWAY="10.1.1.1"
DEFROUTE="no"
DNS1="75.75.75.75"
DNS2="75.76.76.76"
ONBOOT="yes"
NM_CONTROLLED="no"
ZONE="work"

route-ens160 (/etc/sysconfg/network-scripts/route-ens160):
# LAN ROUTE CONFIGURATION
# -----------------------
10.1.1.0/24 dev ens160 src 10.1.1.13 table rt2
default via 10.1.1.1 dev ens160 table rt2

rule-ens160 (/etc/sysconfg/network-scripts/rule-ens160):
# LAN RULE CONFIGURATION
# ----------------------
from 10.1.1.8/29 table rt2
to 10.1.1.8/29 table rt2

ifcfg-ens192 (/etc/sysconfig/network-scripts/ifcfg-ens192):
# WAN CONFIGURATION
# -----------------
DEVICE="ens192"
BOOTPROTO="static"
HWADDR="00:0C:59:A9:D3:F5"
IPADDR="74.64.100.125"
NETMASK="255.255.255.248"
DEFROUTE="yes"
GATEWAY="74.64.100.126"
DNS1="75.75.75.75"
DNS2="75.76.76.76"
ONBOOT="yes"
NM_CONTROLLED="no"
ZONE="public"

network (/etc/sysconfig/network)
# NETWORK CONFIGURATION
# ---------------------
NETWORKING="yes"
HOSTNAME="web"

Hope this will one day help someone!


Q: Spread two rows to one with tidyr I've seen this, this and this but still don't know how to solve the following problem within the tidyr::spread() function.
Here's my example data frame:
libary(tidyverse)

df <- structure(list(Jaar = c(2014L, 2018L), Gemeente = c("Stichtse Vecht",
"Stichtse Vecht"), GMcode = c("GM1904", "GM1904"), Partij = c("VVD",
"VVD"), Aantal_stemmen = c(4347L, 0L)), .Names = c("Jaar", "Gemeente",
"GMcode", "Partij", "Aantal_stemmen"), row.names = c(NA, -2L), class = c("tbl_df",
"tbl", "data.frame"))

result:
# A tibble: 2 x 5
   Jaar Gemeente       GMcode Partij Aantal_stemmen
  <int> <chr>          <chr>  <chr>           <int>
1  2014 Stichtse Vecht GM1904 VVD              4347
2  2018 Stichtse Vecht GM1904 VVD                 0

When I run the following code I don't get the desired one row but two with NA's:
df %>%
  rowid_to_column() %>% # Without this in my original dataframe I'll get an error: Error: Duplicate identifiers for rows
  spread(Jaar, Aantal_stemmen)

result:
# A tibble: 5,938 x 6
   rowid Gemeente       GMcode Partij   `2014` `2018`
   <int> <chr>          <chr>  <chr>     <int>  <int>
 1     1 Stichtse Vecht GM1904 VVD        4347     NA
 2     2 Stichtse Vecht GM1904 VVD          NA      0

A: I am not exactly sure what you want as you didn't provide the wanted output. I hope the following is of help to you.
The call to rowid_to_column generates a column with 2 rows. That is what it is intended to do. Dropping it solves your problem:
df %>%
  # rowid_to_column() %>%
  spread(Jaar, Aantal_stemmen)

which gives
# A tibble: 1 x 5
  Gemeente       GMcode Partij `2014` `2018`
  <chr>          <chr>  <chr>   <int>  <int>
1 Stichtse Vecht GM1904 VVD      4347      0

Please let me know whether this is what you want.


Q: PyInstaller and EasyOCR I have a ocr gui application which has easyocr in it. When I ran the project from pyCharm, it works without any problem. However when I build the project with pyinstaller to an exe form, other ocr algorithms work but easyOCR terminates without showing any error.
python -m PyInstaller --paths "fullpath-to-custom-libraries" --add-data "C:\Program Files\Tesseract-OCR;Tesseract-OCR" --collect-all easyocr --onedir -w main.py

Following warning messages appear after PyInstaller command :
13048 INFO: Determining a mapping of distributions to packages...
40136 WARNING: Unable to find package for requirement opencv-python-headless from package easyocr.
40136 WARNING: Unable to find package for requirement Pillow from package easyocr.
40137 WARNING: Unable to find package for requirement scikit-image from package easyocr.
40137 WARNING: Unable to find package for requirement python-bidi from package easyocr.
40137 WARNING: Unable to find package for requirement PyYAML from package easyocr.
40137 INFO: Packages required by easyocr:
['torch', 'torchvision', 'scipy', 'numpy']

EXE file is generated successfully. But, when I distribute the bundle, application terminates without any error in easyOCR operation. Other OCR's work.
I noticed that dist info folder name and library folder name differ for these below in "venv" environment. I have many other packages installed. However, their library and dist info folder names are same. Can this cause the warnings in PyInstaller ?
cv2
opencv_python_headless-4.5.1.48.dist-info
PIL
Pillow-8.2.0.dist-info
skimage
scikit_image-0.19.2.dist-info
bidi
python_bidi-0.4.2.dist-info
yaml
PyYAML-6.0.dist-info

I cannot pass easyOCR to PyInstaller. How to add required libraries for easyOCR properly then?


Q: Adding views with controllers to a view with controller - proper way? I have to add several views (each having own controller) to a main view (with controller). I am following MVC. Should the code to add these subviews be written in view class or controller class? Also, what is proper way,
MyViewController1 *myViewController1 = [[MyViewController1 alloc] init];
[myMainViewController.view addSubview:myViewController1.view];

Or, some other way?
There is another option - container view controller (with addChildViewController method), but that is tough to manage, so I need the simple way.

A: If you're adding view controllers to the view of another view controller, then you need to use container containment. You can do that in IB with container views. That makes it easier, than making custom container controllers in code.

A: The Absolute best way is to maintain ViewControllers according to their functionality (ex. one might be dashboardView one might be settingsView). Now when moving from one view controller to another is to use navigationController.
The practice I follow is to declare one navigationController in appDelegate when your app starts and then keep reusing this. Example -
YourAppDelegate *delegate=(YourAppDelegate *)[[UIApplication sharedApplication] delegate];
MyViewController1 *myVC = [[ FLOHome alloc ]initWithNibName:@"MyViewController1" bundle:[NSBundle mainBundle]];
[delegate.navigationController pushViewController:myVC animated:NO];

This is the absolute best way when dealing with viewControllers. navigationController handles whole lot of stuff like memory management, caching views to make them snappy. You could keep pushing viewcontrollers and poping them when you exit from them...


Q: What's wrong with my camera? I'm using VS2010 together with C# and XNA 4.0. I'm following the book "Learning XNA 4.0" by Aaron Reed. I added the camera game component to my project but this camera behaves really weird. Moving mouse makes it "jump" and then crash. I don't know what is causing this. It looks that the code is almost identical to that in book. It worked earlier, but now it isn't, although I can't remember whether I change anything in it (I think not). Note that I am only registering this component in game, nothing more. It should work, but it does not. Any help would be great. Here's the code:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;

namespace MyGame
{
    public class Camera : Microsoft.Xna.Framework.GameComponent
    {

        public Matrix View { get; protected set; }
        public Matrix Projection { get; protected set; }
        public Vector3 CameraPosition { get; protected set; }
        public Vector3 CameraDirection { get; protected set; }
        public Vector3 CameraUp { get; protected set; }
        private MouseState prevMouseState;

        public Camera(Game game, Vector3 pos, Vector3 target, Vector3 up)
            : base(game)
        {
            // Some initialization of camera.
            CameraPosition = pos;
            CameraDirection = target - pos;
            CameraDirection.Normalize();
            CameraUp = up;
            CreateLookAt();

            Projection = Matrix.CreatePerspectiveFieldOfView(
                MathHelper.PiOver4,
                (float)Game.Window.ClientBounds.Width /
                (float)Game.Window.ClientBounds.Height,
                1f, 3000f);
        }

        public override void Initialize()
        {
            // Set mouse position and do initial get state.
            Mouse.SetPosition(Game.Window.ClientBounds.Width / 2,
                Game.Window.ClientBounds.Height / 2);
            prevMouseState = Mouse.GetState();

            base.Initialize();
        }

        public override void Update(GameTime gameTime)
        {
            // Standard WSAD keyboard movement.
            if (Keyboard.GetState().IsKeyDown(Keys.W))
                CameraPosition += CameraDirection;
            if (Keyboard.GetState().IsKeyDown(Keys.S))
                CameraPosition -= CameraDirection;
            if (Keyboard.GetState( ).IsKeyDown(Keys.A))
                CameraPosition += Vector3.Cross(CameraUp, CameraDirection);
            if (Keyboard.GetState().IsKeyDown(Keys.D))
                CameraPosition -= Vector3.Cross(CameraUp, CameraDirection);

            // Yaw rotation (via mouse).
            CameraDirection = Vector3.Transform(CameraDirection,
                Matrix.CreateFromAxisAngle(CameraUp, (-MathHelper.PiOver4 / 150) *
                (Mouse.GetState().X - prevMouseState.X)
                ));

            // Pitch rotation (via mouse).
            CameraDirection = Vector3.Transform(CameraDirection,
                Matrix.CreateFromAxisAngle(Vector3.Cross(CameraUp, CameraDirection),
                (MathHelper.PiOver4 / 100) *
                (Mouse.GetState().Y - prevMouseState.Y)
                ));

            CameraUp = Vector3.Transform(CameraUp,
                Matrix.CreateFromAxisAngle(Vector3.Cross(CameraUp, CameraDirection),
                (MathHelper.PiOver4 / 100) *
                (Mouse.GetState().Y - prevMouseState.Y)
                ));

            prevMouseState = Mouse.GetState();

            CreateLookAt();
            base.Update(gameTime);
        }

        private void CreateLookAt()
        {
            View = Matrix.CreateLookAt(CameraPosition,
                CameraPosition + CameraDirection, CameraUp);
        }
    }
}

Can someone please check whether this code works for him? Any idea would be great!
//EDIT 1:
In game's initialization I use code:
Camera cam = new Camera(this, new Vector3(0, 0, 100), Vector3.Zero, Vector3.Up);
Components.Add(cam);

and then I draw model. I use cam's view and projection matrices in model's BasicEffect.
//EDIT 2:
Something's seriously wrong. I did some debuging and it seems that at some point those Vector3 objects have their X,Y,Z properties set to NaN. I couldn't find out how and when. Also (perhaps this is nothing) after running for some time gameTime shows that the elapsed game time is ONLY 16 miliseconds (like it skips frames?) and that the game is running slowly. This 16 miliseconds is always the same, no matter when I debug.
Is it possible that I somehow messed up XNA/C# settings? If so, can someone give me any hint what to do now?

A:     // Pitch rotation (via mouse).
    CameraDirection = Vector3.Transform(CameraDirection,
        Matrix.CreateFromAxisAngle(Vector3.Cross(CameraUp, CameraDirection),
        (MathHelper.PiOver4 / 100) *
        (Mouse.GetState().Y - prevMouseState.Y)
        ));

    CameraUp = Vector3.Transform(CameraUp,
        Matrix.CreateFromAxisAngle(Vector3.Cross(CameraUp, CameraDirection),
        (MathHelper.PiOver4 / 100) *
        (Mouse.GetState().Y - prevMouseState.Y)
        ));

Whenever you use CreateFromAxisAngle, the first param (the axis) needs to be a unit length vector. If it isn't a unit length vector, it will result in a distorted (skewed) Matrix and one that is over (or under) rotated.
Whenever you cross two vectors the result in rarely a unit length vector. To make a result of a cross unit length. try this:
Vector3.Transform(CameraDirection, Matrix.CreateFromAxisAngle(Vector3.Normalize(Vector3.Cross(CameraUp, CameraDirection)), ...

by adding the 'Normalize', it makes the result of the cross a unit length vector. Don't forget to do the same to the yaw line as well.


Q: How to use SharedPreferences value to fill EditText? I'd like to know how to fill EditText field with the values of SharedPreferences. My code is as follows:
 protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(this);
        sharedPreferences = getSharedPreferences(getString(R.string.preference_file_key),MODE_PRIVATE);
        textViewCheck();
    }

    public void textViewCheck()
    {
        EditText sil_key = (EditText)findViewById(R.id.silent_key);
        String silent_mode_key = sil_key.getText().toString();
        EditText gen_key = (EditText)findViewById(R.id.general_key);
        String general_mode_key = gen_key.getText().toString();
        EditText vib_key = (EditText)findViewById(R.id.vibrate_key);
        String vibrate_mode_key = vib_key.getText().toString();
        SharedPreferences.Editor editor = sharedPreferences.edit();
        if((sharedPreferences.contains("silent")) && (sharedPreferences.contains("general")) && (sharedPreferences.contains("vibrate")))
        {
            sil_key.setText(sharedPreferences.getString("silent","silent1"));
            gen_key.setText(sharedPreferences.getString("general","general1"));
            vib_key.setText(sharedPreferences.getString("vibrate","vibrate1"));
        }
        editor.putString("silent",silent_mode_key);
        editor.putString("general",general_mode_key);
        editor.putString("vibrate",vibrate_mode_key);
        editor.apply();
    }

I keep getting the same values even after changing in the EditText fields. I would like to know why I keep getting this and how to overcome this. ( I am so sorry for the previous error with getString() method, didn't notice that.Please clarify this one)

A: i think you may be messing when creating the strings
EditText sil_key = (EditText)findViewById(R.id.silent_key);
String silent_mode_key = sil_key.toString();

I think you meant to make it a string from the content of the edit text
like this
    String silent_mode_key = sil_key.getText().toString();

try this
    EditText sil_key = (EditText)findViewById(R.id.silent_key);
    String silent_mode_key = sil_key.getText().toString();
    EditText gen_key = (EditText)findViewById(R.id.general_key);
    String general_mode_key = gen_key.getText().toString();
    EditText vib_key = (EditText)findViewById(R.id.vibrate_key);
    String vibrate_mode_key = vib_key.getText().toString();
    SharedPreferences.Editor editor = sharedPreferences.edit();
    if((sharedPreferences.contains("silent")) && (sharedPreferences.contains("general")) && (sharedPreferences.contains("vibrate")))
    {
        sil_key.setText(sharedPreferences.getString("silent","silent"));
        gen_key.setText(sharedPreferences.getString("general","general"));
        vib_key.setText(sharedPreferences.getString("vibrate","vibrate"));
    }
    editor.putString("silent",silent_mode_key);
    editor.putString("general",general_mode_key);
    editor.putString("vibrate",vibrate_mode_key);
    editor.apply();

A: try to add  getText() like below for all the strings:
EditText sil_key = (EditText)findViewById(R.id.silent_key);
    String silent_mode_key = sil_key.getText().toString();

A: I think that you have to add this before sharedPreferences.getString
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);


Q: How to connect to Windows PC in graphical mode? My basic desktop PC uses Ubuntu 12.04. However for work I need a few programs (like Hec-Ras) that I didn't succeed to run trough wine or play on linux.
I thought of easy solution: to connect Windows PC in graphical mode. I can succeed with it using TeamViewer, however I'd like to connect trough my local network. How do I achieve that?
Thanks in advance,
Misery

A: I suggest to try tightvnc.  TightVNC is a free remote control software package. With TightVNC, you can see the desktop of a remote machine and control it.

A: You can just use Teamviewer for Linux if you are familiar with it.
Otherwise you have 2 options, RDP or VNC.
RDP is windows Remote desktop sharing and there are linux clients for it like rdesktop. Advantage of RDP is windows side setup is relatively easier.
Install the rdesktop package, then from a terminal window use the following command line:
rdesktop -u REMOTE_USER_NAME -g 1024x768 REMOTE_HOST

It opens a remote session for the REMOTE_USER_NAME on the REMOTE_HOST. The screen (window) resolution is set through the -g parameter.
VNC is more well known on Linux. There are several servers you can use on Windows(UltraVNC  is one that I have some experience with) to share your desktop and then connect using the inbuild VNC client in Ubuntu.

A: You can use rdesktop to access windows PCs from a linux box. or check whether your distribution is having remote desktop client. Create a new connection in that and use the protocol remote desktop protocol.


Q: Usage of 'Hi' and 'Dear' in Formal Communication I always hesitate using 'Hi' in formal mails. Is it OK to use it like "Hi Sir,..."?
Same with 'Dear Junior,...'.
Any help would be appreciated.

A: Hi is informal and Dear . . .. is formal, but Sir is formal and Junior is informal. It follows that Hi Sir and Dear Junior are mismatched. (I have to qualify that by saying that I can’t imagine anyone addressing anyone else in writing as Junior, but that is perhaps because it’s not used in British English.)

A: You could start your first mail or two with "Hello [name]" and then switch to "Hi [name]" in future mails once you have established some rapport with the person. If you're in an environment where informal exchanges are encouraged, then you could start with "Hi [name]" in your communications.
"Dear Sir" or "Dear Madam" is always for formal communication where you do not intend to get to know the person well or cannot really form a personal rapport with the person (like for example, in the case of you being a service provider, say a bank, and addressing a customer or maybe you're in HR and are addressing an employee).
For addressing juniors, you could use "Hello" if you wish to be formal or "Hi" for informal communication.

A: If you know the recipient's title, then starting the conversation "Dear Mr/Ms/Dr/(whatever) Surname" is unlikely to be wrong.  I have been known to use "Dear Firstname Surname" but don't like it.  After the first exchange, see how they sign off their reply - If they sign off with a given name, and use a fairly informal tone, then switch to "Hi Firstname" by all means.  By way of context, I normally sign emails "Chris", and expect "Hi Chris" or "Dear Chris" as the conversation progresses.
Of course, when dealing with older correspondents, or some cultures, you may need to stay more formal.


Q: OCI with long double I'm developing a C++ library with oracle OCI library. I'm loading from a Oracle Database 11g database. Here I need to load large values with decimal places. In this case I need to use long double instead of double. I'm not sure whether OCI supports for long double.
According to the documentation SQLT_FLT is for float and double only. Can someone let me know whether OCI supports for long double and if so how to retrieve them

A: Yes and no.
According to the server docs on floats, the 'native' C types support up to double precision (BINARY_DOUBLE). However, the NUMBER type can store:

*

*Positive numbers in the range 1 x 10-130 to 9.99...9 x 10125 with up to 38 significant digits

*Negative numbers from -1 x 10-130 to 9.99...99 x 10125 with up to 38 significant digits

which is more precision than long double on x86/amd64.
So, you'd need to use that type instead of BINARY_*. Sadly, the developer docs say:

You should not need to use NUMBER as an external datatype. If you do use it, Oracle returns numeric values in its internal 21-byte binary format and will expect this format on input. The following discussion is included for completeness only.

On the other hand, there are also docs on:

*

*using the OCINumber type;

*OCI NUMBER Functions.

AFAICS OCINumberFromReal() supports long double; and if you want even more precision, then you could use OCINumberFromText() with decimal string.


Q: Does harmonic mean of a convergent series converge? Given $a_n>0$, and $\sum_{n=1}^{\infty}a_n$ converges.
Let $$A_m=\frac{1}{m}\sum_{n=1}^{m}a_n\ ,\ B_m=\frac{m}{\sum_{n=1}^{m}a_n^{-1}}$$
representing arithmetic mean and harmonic mean.It's trivial that $\sum_{m=1}^{\infty}A_m$ is not convergent.However, does $\sum_{m=1}^{\infty}B_m$ converge?And if we define
$$H_{m}^{s}=\left(\frac{a_1^s+a_2^s+\cdots+a_m^s}{m}\right)^{\frac{1}{s}}$$
where $s\neq0$. Can we find all values of $s$ that makes $\sum_{m=1}^{\infty}H_{m}^{s}$ converge?


Q: мне нужно сделать подсчёт количества элементов в массиве с указанной характеристикой (положительные, отрицательные, , используя предикатные функции Нужно реализовать в виде функции на языке C++. мне даже дан пример но я не очень понимаю как реализовать подсчёт
 //--- Функция, где аргумент - указатель на функцию -----------------

int  multy ( int* mas, int size, bool  (*fun) (int) ) {

 int  p=1;

  for (int i=0; i< size; i++)

      if ((*fun)(mas[i])) p*=mas[i];

  if (p==1) p=0;

  return p;

 }

//------------ функциии-предикаты-----------------------------------

bool pol (int k) {return k>0;}   //положительное

bool otr (int k) {return k<0;}   //отрицательное

bool mod2 (int k) {return k%2;}   //кратное 2

//--------- основная программа решения------------------------------

int main(int argc, char* argv[ ]){

  int m[5]={-1,2,4,-7,0};

  cout<<multy(m, 5, pol);      //применение предиката pol

  cout<<multy(m, 5, otr);

  cout<<multy(m, 5, mod2);

 return 0;

    }


Q: Can GlassFish or Payara be configured to specify server preferred order of cipher suites? I would like to prioritize cipher suites so I can implement perfect forward secrecy. I am not sure if this is feasible in GlassFish or Payara. We are currently running Payara Server 4.1.1.154.

A: You can do that by selecting which cipher suites should be used. You have to specify the suites in the order of priority.
The Admin Console doesn't provide UI to order the selected cipher suites but you can work around it by selecting cipher suites one by one - additional suites are added at the end of the list and the order is preserved. If you want to use all available suites, you still need to select all of them one by one.
For HTTPS listeners, you would configure it with Admin Console in the SSL tab of HTTP Service -> Http Listeners -> http-listener-2 (or another listener):

Alternatively, you can specify the cipher suites using the asadmin tool:

asadmin set configs.config.server-config.network-config.protocols.protocol.http-listener-2.ssl.ssl3-tls-ciphers=+SSL_RSA_WITH_3DES_EDE_CBC_SHA,+TLS_RSA_WITH_AES_128_CBC_SHA

Again, the order of suites is preserved.
In case you need to set the order of ciphers for communication with the cluster of servers, you should configure the Admin Service instead.


Q: Android Resolve Host I am getting the following error while trying to access the web-service.
Error in http connection java.net.UnknownHostException: Unable to resolve host "192.168.1.109"
Web-service is working fine, when checked using browser.
I am using AsyncTask to access web-service, so it cannot be a background thread issue.
Missed this permission:
<uses-permission android:name="android.permission.INTERNET" />
as identified in the answer below.

A: Mostly I doubt it has to do with the permission you need to give while running the app. Are you making sure you are setting the the network permission in manifest?
More information or code could help you get better answers though.


Q: email template security Can we secure email templates to restrict usage within an organization?  We have a couple of email templates that we want to make available to only a couple of people in the organization and wondering if there was a way to do this.  If not, does anyone have suggestions for an alternative?

A: Yes, to an extent. Email templates are stored in folders, each of which can have separate security policies. When you create a new folder, you can set it to be either Public Read Only or Public Read/Write, but further down are the sharing settings:

*

*This folder is accessible by all users

*This folder is hidden from all users

*This folder is accessible only by the following users

If you choose option 3, you can give access by:

*

*Public groups

*Roles

*Roles and Subordinates

If you only need a few users to have access, the Public Group route is probably your best option.
See Creating and Editing Folders for more information.


Q: Azure Table Storage Not saving Property I have an abstract class that inherits from Table Entity.
public abstract class AzureEntityBase : TableEntity
{
    public AzureEntityBase()
    {

    }
    public virtual string TableName
    {
        get
        {
            return string.Empty;
        }
    }
    private string ObjectHash { get; set; }

    public bool IsBackedUp { get; set; }

}

I then have a class that implements this abstract class
public class DepartmentTotalEntity : AzureEntityBase
{
    public override string TableName
    {
        get
        {
            return "DepartmentTotals";
        }
    }
    public Int64 SessionDateTimeInteger { get; set; }
    public string StoreID { get { return PartitionKey; } set { PartitionKey = value; } }
    public string DetailKey { get; set; }
    public string RangeString { get; set; }
    public string DateStart { get; set; }
    public string DateEnd { get; set; }
    public Int64 DateStartInt { get; set; }
    public Int64 DateEndInt { get; set; }
    public string Dept_ID { get; set; }
    public string DepartmentDescription { get; set; }
    public decimal Quantity { get; set; }
    public decimal TotalPrice { get; set; }
}

I am submitting a revised entity to Azure table storage with the IsBackedUp value set to false.
I then have a service that runs on an Azure Compute instance that copies the row from one table storage account to another.  The other Azure table storage account is at a different Azure datacenter.  After all the rows are copied, I want to limit what I grab when I copy the next round and the IsBackedUp field is supposed to do this.
I run a function that loops the rows already inserted, checks to see if they exist at the destination, if they do exist, then update the source table row to reflect that it was backed up and write that to azure via the following code.
   foreach (DepartmentTotalEntity row in CopiedRows)
       {
           DepartmentTotalEntity find = dst.BrowseSingle(row.PartitionKey, row.RowKey);
           if (find != null)
           {
               row.IsBackedUp = true;
               int tmp = src.InsertOrReplace(row);
            }
       }

The return integer from the InsertOrReplace is the HttpStatusCode of the tableoperation and it always reads 204.  This is expected for a successful write the ATS.
For completeness here is the InsertOrReplaceRow function.
public int InsertOrReplace(DepartmentTotalEntity input)
        {
            if (input.PartitionKey.IsNull())
            {
                throw new ArgumentNullException("PartitionKey");
            }
            if (input.RowKey.IsNull())
            {
                throw new ArgumentNullException("RowKey");
            }

            TableOperation replaceOperation = TableOperation.InsertOrReplace(input);
            TableResult result = table.Execute(replaceOperation);
            return result.HttpStatusCode;
        }

The main problem is that the IsBackedUp field is not being updated when the InsertOrReplace command is being called in the third block of code.
Banging me head against a wall here trying to figure out why ATS will not accept my revision.
I can successfully change the value of IsBackedUp using Azure Table Storage Explorer.  I have confirmed that the datatype of the column is Boolean.
Any help would be greatly appreciated.  Let me know if I have posted enough of the code to be of assistance.  The only class that is not posted is the rest of the class that surrounds the last code block. It is over 2000 lines so I omitted it for brevity.  That class has the CloudTable, CloudTableClient and CloudStorageAccount variables.


Q: Weird error when initializing SKView
I have this block of code on my project to practice SpriteKit. But, for some unexpected reason, it gives me this error(compiles fine).

Just for the reference, I don't have anything on my HelloScene.h file. I hope this doesn't matter. There's nothing else other than these code. So, I can't see why this is happening. Can anyone tell me why? Thanks.

A: Check your storyboard, the view inside your ViewController should be SKView instead of UIView.


Q: Go create struct from XML Please see this playground: https://play.golang.org/p/FOMWqhjdneg
As you can see I have a XML response which I want to unmarshal into a Product struct. The XML has an "assetBlock" which contains nested nodes and extract data to Product struct. Any help would be appreciated

A: You need to make a struct for AssetBlock and all of the types below it, I've done it up to group to show you what I mean:
https://play.golang.org/p/vj_CkneHuLd
type Product struct {
    GlobalID   string     `xml:"globalId"`
    Title      string     `xml:"title"`
    ChunkID    int        `xml:"gpcChunkId"`
    AssetBlock assetBlock `xml:"assetBlock"`
}
type assetBlock struct {
    Images images `xml:"images"`
}
type images struct {
    GroupList groupList `xml:"groupList"`
}
type groupList struct {
    Groups []group `xml:"group"`
}
type group struct {
    Usage string `xml:"usage"`
    Size string `xml:"size"`
}


Q: Forcing UTF8 Format with PHP's XMLReader, DOM and SimpleXML We have a script that parses XML feeds from user generated sources which from time to time contain improperly formated entries with special characters.
While I would normally just run utf8_encode() on the line, I'm not certain how to do this as DOM is progressively reading the file and the error is thrown as the expand command takes place.
Since simple_xml chokes on the code, subsequent lines are also off.
Here's the code.
$z = new XMLReader;
$z->open($filename); $doc = new DOMDocument('1.0','UTF-8');
while ($z->read() && $z->name !== 'product');
while ($z->nodeType == XMLReader::ELEMENT AND $z->name === 'product'){
$producti = simplexml_import_dom($doc->importNode($z->expand(), true));
print_r($producti);
}

Errors:

Message:  XMLReader::expand(): foo.xml:29081: parser error : Input is
  not proper UTF-8, indicate encoding ! Bytes: 0x05 0x20 0x2D 0x35
Severity: Warning Message:  XMLReader::expand(): An Error
  Occured while expanding  Filename: controllers/feeds.php
Line Number: 106
Message:  Argument 1 passed to DOMDocument::importNode() must be an
  instance of DOMNode, boolean given Filename:
  controllers/feeds.php Line Number: 106

A: Use HTML Tidy library first to clean your string.
Also I'd better use DOMDocument instead of XMLReader.
Something like that:
        $tidy = new Tidy;

        $config = array(
                'drop-font-tags' => true,
                'drop-proprietary-attributes' => true,
                'hide-comments' => true,
                'indent' => true,
                'logical-emphasis' => true,
                'numeric-entities' => true,
                'output-xhtml' => true,
                'wrap' => 0
        );

        $tidy->parseString($html, $config, 'utf8');

        $tidy->cleanRepair();

        $xml = $tidy->value; // Get clear string

        $dom = new DOMDocument;

        $dom->loadXML($xml);

        ...


Q: Is there any way to move your dragonvale park to another facebook account? I've realized that my dragonvale is linked to my personal fb account and I want to have a separate account just for dragonvale. Is there anyway to transfer my park?

A: http://www.backflipstudios.com/help/androidfaq/ has this to say:

DragonVale park progress is stored on our servers for Android devices when the park is associated with a Facebook account.  If you would like to associate your Local park with your Facebook account, please follow these steps (please note that this is a permanent choice and once you associate your Local park to your Facebook account, this cannot be undone)...

So you cannot undo the link yourself. It's unlikely that support has the capability to do this as well. You'll have to start a new park, sorry.


Q: Value are showing different results can anybody explain why this below code is showing different values
class ABC: UIViewController

    {
        var Distance : Int!

        override func viewDidLoad()
        {
            super.viewDidLoad()

            var obj_A = ABC()
            obj_A.Distance = 10
            var obj_B =  objVR_A
            obj_A.Distance = 30

            print(obj_A.Distance) // 30
            print(obj_B.Distance) // 30

            var x = 10
            let y = x
            x = 30
            print(x) //30
            print(y) //10
    }}

Why the value of Obj_B is 30 while value of Y is 10.
Thanks.

A: From Apple documentation:
// Reference type example
class C { var data: Int = -1 }
var x = C()
var y = x                       // x is copied to y
x.data = 42                     // changes the instance referred to by x (and y)
println("\(x.data), \(y.data)") // prints "42, 42"

Copying a reference implicitly creates a shared instance. After a copy, two variables then refer to a single instance of the data.

A: This is because primitives are value-based types, and classes are reference-based. You can find detailed explanation on Apple's blog.
// Value type example
struct S { var data: Int = -1 }
var a = S()
var b = a                       // a is copied to b
a.data = 42                     // Changes a, not b
println("\(a.data), \(b.data)") // prints "42, -1"

// Reference type example
    class C { var data: Int = -1 }
    var x = C()
    var y = x                       // x is copied to y
    x.data = 42                     // changes the instance referred to by x (and y)
    println("\(x.data), \(y.data)") // prints "42, 42"


Q: Unity Power Factor Correction from Waveforms So I needed to find a value for a capacitor (Zx, where the resistive component is zero) to perform power factor correction (PF = 1) on the following circuit:

w = 1250
ZL = (98.1+157.5)+j(1250)(0.15)
Rt = 1k
I calculated that I need a capacitor with value C = 1.032E-7F, so I used a 0.1uF cap and measured voltage waveforms of the source and load with the NI MyDaq (garbage, but we have to use it for our lab class.) I realized that I need to be looking at the current waveform though. I obtained the following waveform:

This shows the voltage of the capacitor/load node is in phase with the source. However, I have no way of measuring current. I know that i = C(dv/dt) for the capacitor. So the current waveform would be 90 degrees out of phase with both voltage waveforms. Similarly, the inductor equation for current (Zl has an inductor of L = 0.15 H,) has an integral so it introduces a phase shift.
My question is as follows:
Is looking at the voltage waveform for the inductor and capacitor and deducing the fact that each respective current's phase offset will cancel with the other enough to say that we actually have achieved a unity power factor?

A: No, you can't assume from the fact the the C & L current is 180 deg. out of phase -- you'd need to know the magnitude of each component's current also.
Else -- you could use any value of C & L and come to the same conclusion.
But since RT is real, and the voltage on each side is in pause, then the voltage across it is in phase ==> the current is in phase...


Q: Lit-html not found when using polymer build I have a fairly basic lit-html app that works locally when it's not build.
However when I build it using polymer build using the following config:
{
    "entrypoint": "index.html",
    "shell": "src/school-home.js",
    "sources": [
    "src/**.js",
    "package.json"
    ],
    "extraDependencies": [
    "node_modules/@webcomponents/webcomponentsjs/bundles/**"
    ],
    "builds": [
    {"preset": "es6-bundled"}
    ]
}

This results in a successful build but for some reason I keep getting an error:

I just don't get why it doesn't work. This like the basics of the basics yet it doesn't get found?
Aside: I use nginx for windows since I want to test E2E with my developed APIs.
An additional issue is that I keep getting CORS error for my API calls even though they are on the exact same location?!!
Please help.
Edit:
My NGINX config:
worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       cors-settings.conf;
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  65;

    map $http_upgrade $connection_upgrade {
        default upgrade;
        '' close;
    }

    server {
        listen       8000;
        server_name  localhost;

    location /school {
        root /html/ing-school;
        try_files $uri $uri/ $uri.html /index.html;
    }

    location ~ ^/(api|login|logout) {
        proxy_pass http://localhost:8080;
        proxy_set_header Connection "";

     if ($request_method = 'OPTIONS') {
        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
        add_header 'Access-Control-Max-Age' 1728000;
        add_header 'Content-Type' 'text/plain; charset=utf-8';
        add_header 'Content-Length' 0;
        return 204;
     }
     if ($request_method = 'POST') {
        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
        add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
        add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
     }
    if ($request_method = 'GET') {
            add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
        add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-    With,If-Modified-Since,Cache-Control,Content-Type,Range';
        add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-    Range';
     }
       }

        location /ws {
            proxy_pass http://127.0.0.1:8080;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection $connection_upgrade;
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }
}


Q: 'Can't find' repo error - missing a repo and can't move past it
I'm new to git/github.  A few months ago, I put an old wordpress site as a repo on there, that I've since deleted from my computer.  Had alot of trouble since then with github.  When I try and put a new repo on github, it won't let me, and says it's missing the original repo (see attached pic).  I thought this might be a github issue for my account, so I tried creating a brand new github profile from scratch to bypass the error.  But even logged into the new github (with no repos), I still get this error.  It's like my computer is stuck on this git issue for this one old repo.  I'm using a M1 macbook pro if that matters.  Can anyone help?
I have a copy of the wordpress site that it was originally linked to, but it's a different version.  I don't know if I need to put this in a specific location and that will make the error go away?


Q: Radio buttons are circle on PC, but square on mobile I have coded some simple radio buttons (with no styling)
<input onclick="calcAdult()" type="radio" name="age">Adult
<input onclick="calcPup()" type="radio" name="age">Puppy (younger than 1 year)

On pc they show as normal circles, but on mobile they are check boxes, how can I change this?

A: You can make customize.
Simple example
<!DOCTYPE html>

Custom Radio Buttons

One
  <input type="radio" checked="checked" name="radio">

Two
  <input type="radio" name="radio">

Three
  <input type="radio" name="radio">

Four
  <input type="radio" name="radio">


Q: How to make Youtube videos play from code without having the user to switch to that tab I am making a chrome extension where user can make playlists of songs. For that when I click on play button I need that new tab should open and the video should start playing but youtube video doesn't play without switching over to that tab. I tried to use the 'canplay' eventlistener but it also is called only when I switch over to that tab in which video is played. Can somebody help?

console.log("Hello from content script!");
var video = document.getElementsByTagName("video")[0];
if(video) {
  video.addEventListener("ended", function() {
    console.log("Video ended");
    //alert('Ended');
    chrome.runtime.sendMessage(
        "ended"
    );
  })
  video.addEventListener("canplay", function(event) {
      alert("noted");
      //video.play();
      let playbtn = document.getElementsByClassName('ytp-play-button ytp-button')[0];
      playbtn.click();
  })
} else {
  //console.error("Video element not found");
}

A: Have you tried adding I?&autoplay=1 to the end of the youtube links?


Q: Finding the volume of a sphere with a triple integral and trig sub How is trigonometric substitution done with a triple integral?  For instance,
$$
8 \int_0^r \int_0^{\sqrt{r^2-x^2}} \int_0^{\sqrt{r^2-x^2-y^2}} (1) dz dy dx
$$
Here the limits have been chosen to slice an 8th of a sphere through the origin of radius r, and to multiply this volume by 8.  Without converting coordinates, how might a trig substitution be done to solve this?

A: "The hard way" to go at this multiple integral looks as follows:
The innermost integral has the value $\sqrt{r^2-x^2-y^2}$. The next integral we are faced with is
$$I(x):=\int_0^{\sqrt{r^2-x^2}}\sqrt{r^2-x^2-y^2}\ dy\ .$$
During the integration $x$ is constant. "Trigonometric substitution" means here  that we somehow should use $1-\sin^2 t \equiv\cos^2 t$ to get rid of the square root. Therefore we substitute
$$y:=\sqrt{r^2-x^2} \sin t\ ,\quad  dy= \sqrt{r^2-x^2}\cos t\ dt \qquad(0\leq t\leq {\pi\over2})\ ,$$
and $I(x)$ becomes
$$I(x)=(r^2-x^2)\ \int_0^{\pi/2} \cos^2 t\ dt\ .$$
Now use the rule "$\cos^2(\omega t)$ or $\sin^2(\omega t)$ integrated over an integer number of quarter periods gives half of the length of the integration interval" and obtain $I(x)={\pi\over4}(r^2-x^2)$.
It remains to compute the outermost integral:
$${\rm vol}(B_r)=8\int_0^r I(x)\ dx=2\pi\ \int_0^r(r^2-x^2)\ dx=2\pi (r^2x-{x^3\over 3})\Bigr|_0^r ={4\pi\over3}\ r^3\ .$$

A: The volume of the sphere $B(0,r)=\{(x,y,z): x^2+y^2+z^2 \leq r^2\}$ is usually calculated as follows:
Make the change of variable $x=r\cos \theta \sin \phi;\ y=r\sin \theta \sin \phi;\ z=r \cos \phi$, with the Jacobian equal to $r^2 \sin\phi$.
$V=\int_{B(0,r)}1 dx=\int_0^r \int_0^{2\pi} \int_0^\pi r^2 \sin \phi d \phi d \theta d r=\frac{4\pi r^3}{3}$.
For further reference on spherical coordinates, take a look at this article


Q: Is there a way to channel some HTTP server events into a single javascript function? I have a C# webserver which provides some html/js/css and images to a browser-based client.
I create the page dynamically using javascript, filling images and divs while receiving messages from a websocket C# server.
Sometimes, I receive a message from the websocket and I try to access a resource in the webserver which might be protected.
I have some custom http server events for this (say, 406) because otherwise the browser pops up a dialog box for digest auth login.
I was wondering whether there is a way to channel all 406 events into the same function, say
RegisterHttpEventHandler(406,myFunction);

I guess I could just wrap any request/dynamic load in try and catches, although I'd love a cleaner way of doing this.
EDIT
Here is an example of the workflow which I implemented so far, and which works fine.
// Websocket definition
var conn = new WebSocket('ws://' + addressIP);
// Websocket receiver callback

conn.onmessage = function (event) {
        // my messages are json-formatted
        var mObj = JSON.parse(event.data);
        // check if we have something nice
        if(mObj.message == "I have got a nice image for you"){
        showImageInANiceDiv(mObj.ImageUrl);
        }
    };

// Dynamic load image
function showImageInANiceDiv(imgUrl )
{
    var imgHtml = wrapUrlInErrorHandler(imgUrl);
    $("#imageBox").html(imgHtml);
}

// function to wrap everything in an error handler
function wrapUrlInErrorHandler(Url)
{
    return '<img src="' + Url + '" onerror="errorHandler(\''+ Url +'\');"/>';
}

// function to handle errors
function errorHandler(imgUrl)
{
     console.log("this guy triggered an error : "  + imgUrl);
}

//

A:
the onerror does not tell me what failed, so I have to make an XHR just to find it out. That's a minor thing

You could first try the XHR. If it fails, you know what happened, if it succeeds you can display the image from cache (see also here). And of course you also could make it call some globally-defined custom hooks for special status codes - yet you will need to call that manually, there is no pre-defined global event source.

I'd like to have something like a document.onerror handler to avoid using the wrapUrlInErrorHandler function every time I have to put an image in the page

That's impossible. The error event (MDN, MSDN) does not bubble, it fires directly and only on the <img> element. However, you could get around that ugly wrapUrlInErrorHandler if you didn't use inline event attributes, but (traditional) advanced event handling:
function showImageInANiceDiv(imgUrl) {
    var img = new Image();
    img.src = imgUrl;
    img.onerror = errorHandler; // here
    $("#imageBox").empty().append(img);
}
// function to handle errors
function errorHandler(event) {
     var img = event.srcElement; // or use the "this" keyword
     console.log("this guy triggered an "+event.type+": "  + img.src);
}


Q: Selecting records based on maximum value of another field I am trying to pull a list of distinct city names with their latitudes and longitudes based on the maximum value of the land area field.   The best I get is a "SQL: Error correlating fields" error.
SELECT a.primary_city as city ;
    , a.state as state_id ;
    , SPACE(30) as state_name ;
    , a.approximate_latitude as latitude ;
    , a.approximate_longitude as longitude ;
FROM citystate a ;
WHERE a.area_land = ;
    (SELECT MAX(VAL(b.area_land)) ;
    FROM citystate b ;
    WHERE (b.primary_city = a.primary_city ;
        AND b.state = a.state)) ;
GROUP BY a.primary_city ;
    , a.state ;
    , a.approximate_latitude ;
    , a.approximate_longitude

Not sure this will even work so hoping for some help.
Thanks.

A: Such SQL is not supported in VFP. You can write that as:
SELECT csa.primary_city as city ;
    , csa.state as state_id ;
    , SPACE(30) as state_name ;
    , csa.approximate_latitude as latitude ;
    , csa.approximate_longitude as longitude ;
FROM citystate csa ;
INNER JOIN ;
    (SELECT primary_city, state, MAX(VAL(area_land)) as maxALand ;
    FROM citystate ;
    GROUP BY primary_city, state ) csb ;
  ON csb.primary_city = csa.primary_city ;
        AND csb.state = csa.state ;
WHERE VAL(csa.area_land) = csb.maxALand

A: VFP has not problem at all with 'such SQL', contrary to the pronouncement of master Basoz on the matter.
Normally you should get a type mismatch error because of the comparison of land_area to max(val(land_area)). Fox is nowhere near as eager with implicit conversions as, for example, MS SQL Server, and hence you have to match data types correctly.
However, not knowing what your table structures are it is difficult to offer specific pointers as to where the problem may be. Here are two similar queries using sample data available in VFP (using the freight cost as a stand-in for land_area value):
_VFP.DoCmd("set path to " + set("PATH") + ";" + _SAMPLES)

use Northwind/orders alia nw_orders in sele("nw_orders") shar noup agai

sele o.shipcountry, o.shipcity, o.shipname, o.orderid, o.freight ;
   from nw_orders o ;
   wher o.freight == ( ;
      sele max(x.freight) from nw_orders x wher x.shipcountry == o.shipcountry ) ;
   orde by 1 ;
   into curs nw_result
brow last nowa

use Tastrade/orders alia tt_orders in sele("tt_orders") shar noup agai

sele o.ship_to_country, o.ship_to_city, o.ship_to_name, o.order_number, o.freight ;
   from tt_orders o ;
   wher o.freight == ( ;
      sele max(x.freight) from tt_orders x wher x.ship_to_country == o.ship_to_country ) ;
   orde by 1 ;
   into curs tt_result
brow last nowa

Tastrade and Northwind are very similar in structure and contain very similar data; one or the other should be available in your VFP installation. However, neither sample database seems to in the public domain, at least not in the VFP incarnation. That is why I put Northwind first, since it is publicly available in versions for MS SQL Server etc. pp., and dumping its orders table to Fox format should not present insurmountable difficulties.
Here's a C# LINQPad script for running the Northwind query via OLEDB:
const string DIR = @"d:\dev\sub\FoxIDA\data\Northwind\";
const string SQL = @"
sele o.shipcountry, o.shipcity, o.shipname, o.orderid, o.freight
   from orders o
   wher o.freight == (sele max(x.freight) from orders x wher x.shipcountry == o.shipcountry)
   orde by 1";

using (var con = new System.Data.OleDb.OleDbConnection("provider=VFPOLEDB;data source=" + DIR))
{
    using (var cmd = new System.Data.OleDb.OleDbCommand(SQL, con))
    {
        con.Open();
        cmd.ExecuteReader().Dump();
    }
}

Obviously, you'd need to adapt the DIR definition to where the data is located on your machine. Equally obviously you'd have to use a 32-bit version of LINQPad, since there is no 64-bit OLEDB driver for VFP. Here's the result:


Q: Question about proper time in general relativity I think I may have some fundamental misunderstanding about what $dt, dx$ are in general relativity.
As I understand it, in special relativity, $ds^2=dt^2-dx^2$, we call this the length because it is a quantity that is invariant under Lorentz boosts. If a ball is moving in space and I want to calculate the $ds$ for the ball to travel from point A to point B, then $d\tau=ds$  (where $\tau$ is proper time) because according to the ball, $dx=0$, since point A and point B are at the same place in its own frame.
Assuming this is correct, this is all fine with me. Now fast forward to general relativity. $ds^2=g_{\mu\nu}dx^{\mu}dx^{\nu}$...so if a ball is travelling in spacetime under whatever metric, then to me it would seem like, in the ball's frame, we should set $dx^i=0$, and then we get $ds^2=g_{00}d\tau^2$...however, from what I am told and from what I have read, $ds^2=d\tau^2$. When I look at the Schwarzschild metric, for example, $g_{00}$ doesn't appear to be 1 in a travelling ball's frame.
What have I misunderstood about the interval $ds$?. Is it that $ds$ only purely has to do with geometry of spacetime, and doesn't quite represent the distance between events?

A: The problem arose when you wrote $ds^2 = g_{00} d\tau^2$. Generally one of your coordinates $x^\mu$ will be timelike, and the others spacelike, but the timelike one is not in general the proper time of someone whose spatial coordinates are not changing. That is, $t \neq \tau$. Using your sign convention,1 $d\tau^2 = ds^2$, so the (arbitrarily large) lapse in proper time between two events A and B is
$$ \Delta\tau = \int\limits_\text{path} \sqrt{ds^2} = \int_{\sigma_\mathrm{A}}^{\sigma_\mathrm{B}} \sqrt{g_{\mu\nu} \frac{\mathrm{d}x^\mu}{\mathrm{d}\sigma} \frac{\mathrm{d}x^\nu}{\mathrm{d}\sigma}} \ \mathrm{d}\sigma. $$
Here $\sigma$ is any parameter that parametrizes the specific path (required to be timelike) taken from A to B, and your location along the path at parameter $\sigma$ has coordinates $x^\mu(\sigma)$.
Suppose $x^i \equiv 0$ along the path. Also call $x^0$ by the name $t$. Then most of the terms in the sum vanish and we have
$$ \Delta\tau = \int_{t_\mathrm{A}}^{t_\mathrm{B}} \sqrt{g_{00}} \ \mathrm{d}t. $$
In fact we could have gotten this just by examining
$$ d\tau^2 = g_{\mu\nu} \mathrm{d}x^\mu \mathrm{d}x^\nu. $$
Now often in GR we do call that timelike coordinate $t$, as I have done. Usually when this is done, as in the Schwarzschild metric
$$ ds^2 = \left(1 - \frac{2M}{r}\right) \mathrm{d}t^2 - \left(1 - \frac{2M}{r}\right)^{-1} \mathrm{d}r^2 - r^2 \left(\mathrm{d}\theta^2 + \sin^2(\theta) \ \mathrm{d}\phi^2\right), $$
that $t$ becomes arbitrarily close to the $\tau$ of a local observer "at rest" in these coordinates as you move into the flat regime. In this case, as you move away from the mass at small $r$, $t \to \tau$. In other words, you can only neglect the $g_{00}$ term in some asymptotic cases (which you'll note correspond to $g_{00} \to 1$). In your SR example, you happened to use coordinates that matched those of the observer whose proper time you cared to measure, but you could have boosted to a new frame, in which case the $\mathrm{d}t^2$ part of the metric would have had some prefactor involving $\gamma$.

1 I will point out that most often in GR proper, $ds^2$ is negative for timelike separations, with $d\tau^2 = -ds^2$. The convention you adopted is more common in particle physics.

A: Expanded on Michael Brown's comments, you seem to have confused $dt$ with $d\tau$.  They are not the same.  It is true that $ds^2 = dt^2$, but also true that $ds^2 = g_{tt} dt^2 + \ldots$ (other terms omitted).
What this means physically is that, even for two events that take place at the same location but different coordinate times (according to a given frame), there is a difference between elapsed coordinate time and actual (or proper) elapsed time.
This can happen in special relativity, too.  Choose a time coordinate $\bar t$ such that $dt = \alpha \, d\bar t$, and the metric would look like $ds^2 = \alpha^2 \, d\bar t^2 = d\tau^2$.  What this should emphasize is that one's choice of time coordinate can end up being quite poor, not corresponding well (if at all!) to the physically meaningful quantity, proper time.
While it may be confusing for the time coordinate to not correspond exactly to proper time, it nevertheless gives an enormous amount of freedom to recast the metric in a way that is convenient--you do not have to have proper time be your time coordinate if you don't want it to be, and it will always have a well-defined expression regardless of your choice of coordinates, as all physical quantities must have.


Q: jquery closest() or children not working jquery code :-
$('.cycle-status-update')
  .on('mouseenter', (function(){
    $(this).closest('.delete-status-update-link').show();
  }))
  .on('mouseleave', (function(){
    $(this).closest('.delete-status-update-link').hide();
  }))

html code :-
.status-partial
    -@user.status_updates.latest.limit(5).each do |status_update|
        .row-fluid.cycle-status-update{:class => cycle("dark", "light")}
            .row-fluid
                .span11
                    = status_update.status
                .span1
                    .delete-status-update-link
                        %strong= link_to "X", [@user,status_update], :remote => true, :method => :delete, :class => "delete-status-update"
            .row-fluid
                .time-ago-in-words
                    ="#{time_ago_in_words(status_update.created_at)} ago"

what could be the issue here ?

A: use find()
$(this).find('.delete-status-update-link').show();

A: You have issues with your code, (function extra ( before function and after ):
$('.cycle-status-update')
     .on('mouseenter', (function(){
     $(this).closest('.delete-status-update-link').show();
}))//<----here
.on('mouseleave', (function(){ //<--before function
    $(this).closest('.delete-status-update-link').hide();
}))
//^----here

try this:
$('.cycle-status-update').on('mouseenter', function(){
  $('.delete-status-update-link').show();
}).on('mouseleave', function(){
  $('.delete-status-update-link').hide();
});


Q: If $\alpha$, $\beta$, $\gamma$ are the zeros of $x^3 + 4x + 1=0$, compute a expression containing them If $\alpha$, $\beta$, $\gamma$ are the zeros of $x^3 + 4x + 1$, then calculate the value of: $$(\alpha + \beta)–1 + (\beta + \gamma)–1 + (\gamma + \alpha)–1$$

A: HINT: You want to calculates $2(\alpha+\beta+\gamma)-3$. There is a formula to find $\alpha+\beta+\gamma$ when you know the coeficients of the polynomial.

A: Note that $(\alpha + \beta)-1+(\beta+\gamma)-1+(\gamma +\alpha)-1=\left(2\alpha+2\beta+2\gamma\right)-3=2(\alpha+\beta+\gamma)-3$. We know from Vieta's formulae that:
$$\alpha+\beta+\gamma=-\frac{0}{1}=0$$
Therefore, $(α + β)–1 + (β + γ)–1 + (γ + α)–1=2(0)-3=-3$.

A: Hint:
Sum of the roots of equation : $x^3+bx^2+cx+d=0$ is $-b$.
So convert it into this form. You see that co-efficient of $x^2$ is zero, so the expression's value is $-3$.
Hail Vieta!!

A: Hint $\ $ Exploit symmetry. The sum $\rm = 2(a+b+c) - 3,\:$ and $\rm\:a+b+c = $ -coef of $\rm\,x^2\,$ by Vieta.
Remark $\ $ Generally one can calculate any symmetric polynomial of the roots in the same way, since, by a simple algorithm of Gauss, any symmetric polynomial may be written as a polynomial in the elementary symmetric polynomials  (Fundamental Theorem of Symmetric Polynomials)

A: Hint: So you want $2(\alpha + \beta + \gamma) - 3$ ?


Q: Dynamically Populate the linear layout depending upon Markers on the Map I am working on the android project in which I need to draw a UI something like below. I need to divide the android screen in two half. In the Top Half I need to show the google maps. And in the Bottom Half I need to show the user information as soon as anyone clicked on the Google Maps. Top Half part is done and its working for me.
Problem Statement:-
I need to dynamically keep on creating the linear layout in the bottom half part depending on how many markers(users) are there on the maps. Below is the screen shot in which I have created two layouts in the bottom half part considering two user's are there on the google maps. But how can I make this thing to work dynamically, suppose if I have three user's on the google maps currently, then in the bottom half part three layout will get plotted automatically. I hope I am clear enough.

A: Yes you can do use a listview and create custom adapter. set your map as header in listview and use your listview rows for data representation.
Another thing which you can do is create listview and maps seperate. Align your listview just below to the map
Here i am giving you a simple example the code below will create listview. You may need to I have created custom adapter for your purpose.
public class my_map_activity extends Activity {

    ArrayList<String> name = null;
    ArrayList<String> gender = null;
    ArrayList<String> latitude = null;
    ArrayList<String> longitude = null;
    Context activity_context = null;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        ListView user_listview = (ListView) findViewById(R.id.user_listview);

        name = new ArrayList<String>();
        gender = new ArrayList<String>();
        latitude = new ArrayList<String>();
        longitude = new ArrayList<String>();

        for (int i = 0; i < 10; i++) {
            name.add ("test user " + i);
            gender.add ("Male");
            latitude.add (""+ i);
            longitude.add (""+ i);
        }

        custom_adapter list_adapter = new custom_adapter (this, android.R.layout.simple_list_item_1, name, gender, latitude, longitude);
        user_listview.setAdapter(list_adapter);
    }
}

Here is my main.xml file. Which will tell you how to create that layout. I am using Relative layout as my parent layout.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/RelativeLayout1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="250dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:src="@drawable/ic_launcher" />

    <ListView
        android:id="@+id/user_listview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/imageView1" >
    </ListView>

</RelativeLayout>

here i am posting you my custom adapter code which you can use for your listview purpose.
public class custom_adapter extends ArrayAdapter<String>{

    ArrayList<String> name = null;
    ArrayList<String> gender = null;
    ArrayList<String> latitude = null;
    ArrayList<String> longitude = null;
    Context activity_context = null;

    public custom_adapter(Context context,
                          int resource,
                          ArrayList<String> name ,
                          ArrayList<String> gender,
                          ArrayList<String> latitude,
                          ArrayList<String> longitude) {
        super(context, resource, name );
        this.name = name;
        this.gender = gender;
        this.latitude = latitude;
        this.longitude = longitude;
        activity_context = context;
    }

    static class ViewHolder
    {
        public TextView txt_name;
        public TextView txt_gender;
        public TextView txt_latitude;
        public TextView txt_longitude;
        public ImageView img_view;
    }

    @Override
    public View getView (final int position,
                         View      convertView,
                         ViewGroup parent)
    {
        View rowView = convertView;
        ViewHolder holder = null;

        if (rowView == null) {
            LayoutInflater inflater = (LayoutInflater)activity_context.getSystemService(
                                               Context.LAYOUT_INFLATER_SERVICE);
            rowView = inflater.inflate(R.layout.row_file, null, false);
            holder = new ViewHolder();
            holder.txt_name = (TextView) rowView.findViewById(R.id.textView1);
            holder.txt_gender = (TextView) rowView.findViewById(R.id.textView2);
            holder.txt_latitude = (TextView) rowView.findViewById(R.id.textView3);
            holder.txt_longitude = (TextView) rowView.findViewById(R.id.textView4);
            holder.img_view = (ImageView) rowView.findViewById(R.id.imageView1);
            rowView.setTag(holder);

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

        if (holder != null) {
            holder.txt_name.setText(name.get(position));
            holder.txt_gender.setText(gender.get(position));
            holder.txt_latitude.setText(latitude.get(position));
            holder.txt_longitude.setText(longitude.get(position));
        }
        return rowView;
    }
}

Here is the layout which you can inflate in your custom adapter and set it on listview.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/RelativeLayout1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:src="@drawable/ic_launcher" android:layout_marginTop="10dp" android:layout_marginLeft="10dp" android:contentDescription="TODO"/>

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:layout_toRightOf="@+id/imageView1"
        android:text="Medium Text"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/textView1"
        android:layout_toRightOf="@+id/imageView1"
        android:text="Medium Text"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/textView2"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/textView2"
        android:text="Medium Text"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:id="@+id/textView4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/textView3"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/textView3"
        android:text="Medium Text"
        android:textAppearance="?android:attr/textAppearanceMedium" />

</RelativeLayout>

So i have given you all four files. Here i am explaining what every file will do.

*

*my_map_activity : This is the main activity which contains listivew and map both. I am using a big imageview. Instead of that imageview you can place your map.

*main.xml : This is layout file which contains both listview and map.

*custom_adapter : This is the custom adapter which i have created for you. I am extending array adapter. In this i am taking data from arraylist and inflating the row layout and the i am setting respective values.

*row_layout : This is the row layout which will contain imageview for user, name, gender and all other thing.
So i have created several things for you if you need any help then you can ask and try to get the concept of each file how i am using.


Q: Is this a bug in Power BI? I have several .pbix files where I mostly consume live from SSAS. Last week I was able to see the model, (I downloaded today the december 2022 version) and after I installed it, I can't see them anymore... why? Is this the expected behavior? it seems like a bug...


Q: How can I detect if in Android , soft-keyboard's delete has been long pressed when a particular TextInputLauout field is in focus I have many custom TextInputLayout with custom TextInputEditText views in the XML.
For some TextInputFields I need to give the below feature:

*

*When the field is in focus

*Soft keyboard should launch

*When the user presses the delete button for long approx (2 secs)

*It should clear the content in TextInputEditText
I tried --> Implementing onKeyPreIme(int keyCode, KeyEvent event) in Fragment


Q: Conditional Left Join I'm trying to figure out how to return columns only when needed.
Data will only exists in the 1_finance_add_details and the addresses e tables when t.trans_type=2
SELECT t.*,
 a.company,
 a.house_number,
 a.flat_number,
 a.house_name,
 a.address1,
 a.address2,
 a.address3,
 a.town,
 a.county,
 a.post_code,
 a.country,
 f.*,
 e.company,
 e.house_number,
 e.flat_number,
 e.house_name,
 e.address1,
 e.address2,
 e.address3,
 e.town,
 e.county,
 e.post_code,
 e.country
FROM 1_transactions t
LEFT JOIN addresses a ON a.id=t.fk_addresses_id
LEFT JOIN 1_finance_add_details f ON t.id=f.fk_transactions_id
LEFT JOIN addresses e ON e.id=f.employ_fk_addresses_id
WHERE trans_location=1 AND t.id=19;

A: Not sure if this is the result that you want, but you can just add another condition in your left join like this:
FROM 1_transactions t
LEFT JOIN addresses a ON a.id=t.fk_addresses_id
LEFT JOIN 1_finance_add_details f ON t.id=f.fk_transactions_id
LEFT JOIN addresses e ON e.id=f.employ_fk_addresses_id AND t.trans_type=2
WHERE trans_location=1 AND t.id=19;

Note: this would render the field of addresses e NULL on every t with type != 2.


Q: Hibernate enableFilter not working when loading entity by id I have 3 classes:

*

*Event

*PublicEvent extends Event

*PersonalEvent extends Event
my hibernate mapping file is somethings like bellow. i wanna add one filter for PersonalEvent and before loading this object, i was enabled that's filter. but this is not working. my hibernate version is 4.3.11.Final.
Event.hbm.xml
<hibernate-mapping>
    <class name="org.calendar.Event">
        ...
        <filter name="personalEventAuthorize" condition="person_ID = :personId" />
    </class>
    <joined-subclass name="org.calendar.PersonalEvent" extends="org.calendar.Event">
        <key column="id" property-ref="id" />
        ...
        <many-to-one name="person" column="person_ID" entity-name="org.person.Person" />
     </joined-subclass>
     <joined-subclass name="org.calendar.PublicEvent" extends="org.calendar.Event">
        <key column="id" property-ref="id" />
        ...
     </joined-subclass>
     <filter-def name="personEventAuthorize">
        <filter-param name="personId" type="integer" />
     </filter-def>
</hibernate-mapping>

PersonalEventRepository
@Override
public PersonalEvent load(Long id) {
    Filter filter = getSession().enableFilter("personEventAuthorize");
    filter.setParameter("personId", getAuthenticatedPersonId());
    return super.loadById(id);
}

hibernate generated SQL Query without my filter. what is my problem? why hibernate can not enabled filter for joined-subclass?
thanks for all...

A: This is not a bug, it's the intended behavior. I updated the Hibernate User Guide to make it more obvious.
The @Filter does not apply when you load the entity directly:
Account account1 = entityManager.find( Account.class, 1L );
Account account2 = entityManager.find( Account.class, 2L );

assertNotNull( account1 );
assertNotNull( account2 );

While it applies if you use an entity query (JPQL, HQL, Criteria API):
Account account1 = entityManager.createQuery(
    "select a from Account a where a.id = :id",
    Account.class)
    .setParameter( "id", 1L )
.getSingleResult();
assertNotNull( account1 );
try {
    Account account2 = entityManager.createQuery(
        "select a from Account a where a.id = :id",
        Account.class)
    .setParameter( "id", 2L )
    .getSingleResult();
}
catch (NoResultException expected) {
    expected.fillInStackTrace();
}

So, as a workaround, use the entity query (JPQL, HQL, Criteria API) to load the entity.


Q: Node Js Firestore accessing a database value with a space new to node Js expecting this to be very easy!
in node JS with Firestore i want to access  "display name": James, "Age": 22
Age has no space so i can just put
const newValue = doc.data();
             const age = newValue.Age;

but display name contains a space
how to you type this?
 const displayName = newValue.displayName;

A: You'll need to use [] notation to get at the property.
So:
const displayName = newValue["display name"];


Q: Control Android LED from shell I have seen several questions (and blog posts, elsewhere) with Java code for controlling the notification LED on an Android device. That's not what I'm looking for.
I'm wondering if there is any way to access the appropriate commands / controls / frameworks from the shell (Perl, ruby).
What I want, ultimately, is a very simple "heartbeat" pulse - when the device is on and the display is off, blink at me.
Alternatively, if anyone has written a really simple "toy" app that blinks the LED, I'd love to play with it.

A: You can find all leds of your device under
/sys/class/leds/

In my case, I have the following leds
amber
button-backlight
flashlight
green
lcd-backlight

If I have a look inside "green", I see
> cd green
> ls
blink
brightness
currents
device
lut_coefficient
max_brightness
off_timer
power
pwm_coefficient
subsystem
trigger
uevent

These files are interfaces to the kernel module, which controls leds. In this case, I think they are char-devices. You can use the command "echo" and "cat" to communicate with the kernel module. Here an example..
echo 1 > brightness  # Turn on led
echo 0 > brightness  # Turn off led

For implementing a "heartbeat" pulse as you mentioned, I would have a look into "blink". If you not want to perform reverse engineering, this could be a good entry point to check what happens in the kernel leds-gpio.c


Q: How to use palettes in SDL 2 I'm updating a program from SDL 1 to SDL 2 and need to use color palettes. Originally, I used SDL_SetColors(screen, color, 0, intColors); but that does't work in SDL 2. I'm trying to use:
SDL_Palette *palette = (SDL_Palette *)malloc(sizeof(color)*intColors);
SDL_SetPaletteColors(palette, color, 0, intColors);
SDL_SetSurfacePalette(surface, palette);

But SDL_SetPaletteColors() returns -1 and fails. SDL_GetError gives me no information.
How can I make a palette from a SDL_Color and then set it as my surface's palette?

A: It's hard to tell what your variables are and how you intend to use them without seeing your declarations.
Here's how I set up a grayscale palette in SDL_gpu:
SDL_Color colors[256];
int i;

for(i = 0; i < 256; i++)
{
    colors[i].r = colors[i].g = colors[i].b = (Uint8)i;
}

#ifdef SDL_GPU_USE_SDL2
SDL_SetPaletteColors(result->format->palette, colors, 0, 256);
#else
SDL_SetPalette(result, SDL_LOGPAL, colors, 0, 256);
#endif

The result SDL_Surface already has a palette because it is has an 8-bit pixel depth (see note in https://wiki.libsdl.org/SDL_Palette).

A: It has been awhile since the OP posted the question and there has been no accepted answer. I ran into the same issue while trying to migrate a SDL 1.2 based game into using 2.0. here is what I did hoping it could help other who may be facing similar issue:
    Replace:
SDL_SetColors(screen, color, 0, intColors);
With:
SDL_ SDL_SetPaletteColors(screen->format->palette, color, 0, intColors);
David